1 /****************************************************************************** 2 * * 3 * Copyright (C) 2018 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 #include <stdio.h> 21 #include <string.h> 22 #include "ixheaacd_sbr_common.h" 23 #include <ixheaacd_type_def.h> 24 25 #include "ixheaacd_constants.h" 26 #include <ixheaacd_basic_ops32.h> 27 #include <ixheaacd_basic_ops16.h> 28 #include <ixheaacd_basic_ops40.h> 29 #include "ixheaacd_basic_ops.h" 30 31 #include <ixheaacd_basic_op.h> 32 #include "ixheaacd_intrinsics.h" 33 #include "ixheaacd_common_rom.h" 34 #include "ixheaacd_sbrdecsettings.h" 35 #include "ixheaacd_bitbuffer.h" 36 #include "ixheaacd_defines.h" 37 38 #include "ixheaacd_pns.h" 39 40 #include <ixheaacd_aac_rom.h> 41 #include "ixheaacd_aac_imdct.h" 42 #include "ixheaacd_pulsedata.h" 43 44 #include "ixheaacd_drc_data_struct.h" 45 #include "ixheaacd_channelinfo.h" 46 #include "ixheaacd_drc_dec.h" 47 48 #include "ixheaacd_sbrdecoder.h" 49 #include "ixheaacd_tns.h" 50 #include "ixheaacd_sbr_scale.h" 51 #include "ixheaacd_lpp_tran.h" 52 #include "ixheaacd_env_extr_part.h" 53 #include <ixheaacd_sbr_rom.h> 54 #include "ixheaacd_block.h" 55 #include "ixheaacd_hybrid.h" 56 #include "ixheaacd_ps_dec.h" 57 #include "ixheaacd_env_extr.h" 58 #include "ixheaacd_basic_funcs.h" 59 #include "ixheaacd_env_calc.h" 60 61 WORD32 (*ixheaacd_fix_div)(WORD32, WORD32) = &ixheaacd_fix_div_armv7; 62 63 VOID(*ixheaacd_covariance_matrix_calc) 64 (WORD32 *, ixheaacd_lpp_trans_cov_matrix *, 65 WORD32) = &ixheaacd_covariance_matrix_calc_armv7; 66 67 VOID(*ixheaacd_covariance_matrix_calc_2) 68 (ixheaacd_lpp_trans_cov_matrix *, WORD32 *, WORD32, 69 WORD16) = &ixheaacd_covariance_matrix_calc_2_armv7; 70 71 VOID(*ixheaacd_over_lap_add1) 72 (WORD32 *, WORD32 *, WORD16 *, const WORD16 *, WORD16, WORD16, 73 WORD16) = &ixheaacd_over_lap_add1_dec; 74 75 VOID(*ixheaacd_over_lap_add2) 76 (WORD32 *, WORD32 *, WORD32 *, const WORD16 *, WORD16, WORD16, 77 WORD16) = &ixheaacd_over_lap_add2_dec; 78 79 VOID(*ixheaacd_decorr_filter2) 80 (ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_buf_left_real, WORD32 *p_buf_left_imag, 81 WORD32 *p_buf_right_real, WORD32 *p_buf_right_imag, 82 ia_ps_tables_struct *ps_tables_ptr, 83 WORD16 *transient_ratio) = &ixheaacd_decorr_filter2_armv7; 84 85 VOID(*ixheaacd_decorr_filter1) 86 (ia_ps_dec_struct *ptr_ps_dec, ia_ps_tables_struct *ps_tables_ptr, 87 WORD16 *transient_ratio) = &ixheaacd_decorr_filter1_armv7; 88 89 WORD32(*ixheaacd_divide16_pos) 90 (WORD32 op1, WORD32 op2) = &ixheaacd_divide16_pos_armv7; 91 92 VOID(*ixheaacd_decorrelation) 93 (ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_buf_left_real, WORD32 *p_buf_left_imag, 94 WORD32 *p_buf_right_real, WORD32 *p_buf_right_imag, 95 ia_ps_tables_struct *ps_tables_ptr) = &ixheaacd_decorrelation_armv7; 96 97 VOID(*ixheaacd_apply_rot) 98 (ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_qmf_left_re, WORD32 *p_qmf_left_im, 99 WORD32 *p_qmf_right_re, WORD32 *p_qmf_right_im, 100 ia_sbr_tables_struct *sbr_tables_ptr, 101 const WORD16 *ptr_res) = &ixheaacd_apply_rot_armv7; 102 103 VOID(*ixheaacd_conv_ergtoamplitudelp) 104 (WORD32 bands, WORD16 noise_e, WORD16 *nrg_sine, WORD16 *nrg_gain, 105 WORD16 *noise_level_mant, 106 WORD16 *sqrt_table) = &ixheaacd_conv_ergtoamplitudelp_armv7; 107 108 VOID(*ixheaacd_conv_ergtoamplitude) 109 (WORD32 bands, WORD16 noise_e, WORD16 *nrg_sine, WORD16 *nrg_gain, 110 WORD16 *noise_level_mant, 111 WORD16 *sqrt_table) = &ixheaacd_conv_ergtoamplitude_armv7; 112 113 VOID(*ixheaacd_adjust_scale) 114 (WORD32 **re, WORD32 **im, WORD32 sub_band_start, WORD32 sub_band_end, 115 WORD32 start_pos, WORD32 next_pos, WORD32 shift, 116 FLAG low_pow_flag) = &ixheaacd_adjust_scale_armv7; 117 118 WORD16(*ixheaacd_ixheaacd_expsubbandsamples) 119 (WORD32 **re, WORD32 **im, WORD32 sub_band_start, WORD32 sub_band_end, 120 WORD32 start_pos, WORD32 next_pos, 121 FLAG low_pow_flag) = &ixheaacd_expsubbandsamples_armv7; 122 123 VOID(*ixheaacd_enery_calc_per_subband) 124 (WORD32 start_pos, WORD32 next_pos, WORD32 sub_band_start, WORD32 sub_band_end, 125 WORD32 frame_exp, WORD16 *nrg_est_mant, FLAG low_pow_flag, 126 ia_sbr_tables_struct *ptr_sbr_tables, 127 WORD32 *ptr_qmf_matrix) = &ixheaacd_enery_calc_per_subband_dec; 128 129 VOID(*ixheaacd_harm_idx_zerotwolp) 130 (WORD32 *ptr_real_buf, WORD16 *ptr_gain_buf, WORD32 scale_change, 131 WORD16 *ptr_sine_level_buf, const WORD32 *ptr_rand_ph, 132 WORD16 *noise_level_mant, WORD32 num_sub_bands, FLAG noise_absc_flag, 133 WORD32 harm_index) = &ixheaacd_harm_idx_zerotwolp_armv7; 134 135 VOID(*ixheaacd_tns_ar_filter_fixed) 136 (WORD32 *spectrum, WORD32 size, WORD32 inc, WORD32 *lpc, WORD32 order, 137 WORD32 shift_value, 138 WORD scale_spec) = &ixheaacd_tns_ar_filter_fixed_non_neon_armv7; 139 140 VOID(*ixheaacd_tns_ar_filter) 141 (WORD32 *spectrum, WORD32 size, WORD32 inc, WORD16 *lpc, WORD32 order, 142 WORD32 shift_value, WORD scale_spec, 143 WORD32 *ptr_filter_state) = &ixheaacd_tns_ar_filter_armv7; 144 145 VOID(*ixheaacd_tns_parcor_lpc_convert) 146 (WORD16 *parcor, WORD16 *lpc, WORD16 *scale, 147 WORD order) = &ixheaacd_tns_parcor_lpc_convert_armv7; 148 149 WORD32(*ixheaacd_calc_max_spectral_line) 150 (WORD32 *ptr_tmp, WORD32 size) = &ixheaacd_calc_max_spectral_line_dec; 151 152 VOID(*ixheaacd_post_twiddle) 153 (WORD32 out_ptr[], WORD32 spec_data[], 154 ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, 155 WORD npoints) = &ixheaacd_post_twiddle_dec; 156 157 VOID(*ixheaacd_post_twid_overlap_add) 158 (WORD16 pcm_out[], WORD32 spec_data[], 159 ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD npoints, 160 WORD32 *ptr_overlap_buf, WORD16 q_shift, const WORD16 *window, 161 WORD16 ch_fac) = &ixheaacd_post_twid_overlap_add_dec; 162 163 VOID(*ixheaacd_neg_shift_spec) 164 (WORD32 *coef, WORD16 *out, WORD16 q_shift, 165 WORD16 ch_fac) = &ixheaacd_neg_shift_spec_dec; 166 167 VOID(*ixheaacd_spec_to_overlapbuf) 168 (WORD32 *ptr_overlap_buf, WORD32 *ptr_spec_coeff, WORD32 q_shift, 169 WORD32 size) = &ixheaacd_spec_to_overlapbuf_armv7; 170 171 VOID(*ixheaacd_overlap_buf_out) 172 (WORD16 *out_samples, WORD32 *ptr_overlap_buf, WORD32 size, 173 const WORD16 ch_fac) = &ixheaacd_overlap_buf_out_armv7; 174 175 VOID(*ixheaacd_overlap_out_copy) 176 (WORD16 *out_samples, WORD32 *ptr_overlap_buf, WORD32 *ptr_overlap_buf1, 177 const WORD16 ch_fac) = &ixheaacd_overlap_out_copy_armv7; 178 179 VOID(*ixheaacd_pretwiddle_compute) 180 (WORD32 *spec_data1, WORD32 *spec_data2, WORD32 *out_ptr, 181 ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD npoints4, 182 WORD32 neg_expo) = &ixheaacd_pretwiddle_compute_dec; 183 184 VOID(*ixheaacd_imdct_using_fft) 185 (ia_aac_dec_imdct_tables_struct *ptr_imdct_tables, WORD32 npoints, 186 WORD32 *ptr_x, WORD32 *ptr_y) = &ixheaacd_imdct_using_fft_dec; 187