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 #ifndef IXHEAACD_QMF_DEC_H 21 #define IXHEAACD_QMF_DEC_H 22 23 typedef struct { 24 WORD32 no_channels; 25 const WORD16 *analy_win_coeff; 26 const WORD16 *p_filter; 27 const WORD16 *cos_twiddle; 28 const WORD16 *sin_twiddle; 29 const WORD16 *alt_sin_twiddle; 30 const WORD16 *t_cos; 31 const WORD16 *t_sin; 32 33 WORD16 *anal_filter_states; 34 WORD16 *filter_states; 35 WORD16 num_time_slots; 36 37 WORD16 lsb; 38 WORD16 usb; 39 40 WORD16 qmf_filter_state_size; 41 WORD16 *core_samples_buffer; 42 WORD16 ana_offset; 43 WORD16 *filter_pos; 44 WORD16 *dummy_0; 45 WORD16 ixheaacd_drc_offset; 46 WORD16 *filter_pos_syn; 47 WORD16 *dummy_1; 48 49 WORD32 *analy_win_coeff_32; 50 const WORD32 *p_filter_32; 51 const WORD32 *esbr_cos_twiddle; 52 const WORD32 *esbr_alt_sin_twiddle; 53 const WORD32 *esbr_t_cos; 54 WORD32 *anal_filter_states_32; 55 WORD32 *state_new_samples_pos_low_32; 56 WORD32 *filter_states_32; 57 WORD32 *filter_pos_32; 58 WORD32 *filter_pos_syn_32; 59 60 WORD16 *fp1_anal; 61 WORD16 *fp2_anal; 62 WORD16 *filter_2; 63 64 WORD16 *fp1_syn; 65 WORD16 *fp2_syn; 66 WORD16 sixty4; 67 WORD32 *core_samples_buffer_32; 68 WORD32 *fp1_anal_32; 69 WORD32 *fp2_anal_32; 70 WORD32 *filter_2_32; 71 72 } ia_sbr_qmf_filter_bank_struct; 73 74 VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_inp, 75 ia_sbr_scale_fact_struct *sbr_scale_factor, WORD32 **qmf_real, 76 WORD32 **qmf_imag, ia_sbr_qmf_filter_bank_struct *qmf_bank, 77 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, WORD ch_fac, 78 WORD32 low_pow_flag, WORD audio_object_type); 79 80 VOID ixheaacd_cplx_anal_qmffilt_32(const WORD32 *time_inp, 81 ia_sbr_scale_fact_struct *sbr_scale_factor, 82 WORD32 **qmf_real, WORD32 **qmf_imag, 83 ia_sbr_qmf_filter_bank_struct *qmf_bank, 84 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 85 WORD ch_fac, WORD32 ldsbr_present); 86 87 VOID ixheaacd_cplx_synt_qmffilt( 88 WORD32 **qmf_real, WORD32 **qmf_im, WORD32 split_slot, 89 ia_sbr_scale_fact_struct *sbr_scale_factor, WORD16 *time_out, 90 ia_sbr_qmf_filter_bank_struct *qmf_bank, ia_ps_dec_struct *ptr_ps_dec, 91 FLAG active, FLAG low_pow_flag, ia_sbr_tables_struct *sbr_tables_ptr, 92 ixheaacd_misc_tables *pstr_common_tables, WORD ch_fac, FLAG drc_on, 93 WORD32 drc_sbr_factors[][64], WORD32 audio_object_type); 94 95 VOID ixheaacd_esbr_qmfanal32_winadd(WORD32 *inp1, WORD32 *inp2, 96 WORD32 *tmp_qmf_1, WORD32 *tmp_qmf_2, 97 WORD32 *out, WORD32 num_band); 98 99 VOID ixheaacd_esbr_fwd_modulation(const WORD32 *time_in, WORD32 *r_subband, 100 WORD32 *i_subband, 101 ia_sbr_qmf_filter_bank_struct *qmf_bank, 102 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 103 104 VOID ixheaacd_esbr_inv_modulation(WORD32 *qmf_real, 105 ia_sbr_qmf_filter_bank_struct *syn_qmf, 106 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 107 WORD32 no_synthesis_channels); 108 109 VOID ixheaacd_shiftrountine_with_rnd_hq(WORD32 *qmf_real, WORD32 *qmf_imag, 110 WORD32 *filter_states, WORD32 len, 111 WORD32 shift); 112 113 VOID ixheaacd_esbr_qmfsyn64_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1, 114 WORD32 *sample_buffer, WORD32 ch_fac); 115 116 VOID ixheaacd_esbr_qmfsyn32_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1, 117 WORD32 *sample_buffer, WORD32 ch_fac); 118 119 VOID ixheaacd_sbr_qmfanal32_winadds(WORD16 *fp1, WORD16 *fp2, WORD16 *filter_1, 120 WORD16 *filter_2, WORD32 *analysis_buffer, 121 WORD16 *filter_states, 122 const WORD16 *time_sample_buf, 123 WORD32 ch_fac); 124 125 VOID ixheaacd_sbr_qmfanal32_winadds_eld(WORD16 *fp1, WORD16 *fp2, 126 WORD16 *filter_1, WORD16 *filter_2, 127 WORD32 *analysis_buffer, 128 WORD16 *filter_states, 129 const WORD16 *time_sample_buf, 130 WORD32 ch_fac); 131 132 VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband, 133 WORD32 *imag_subband, 134 ia_sbr_qmf_filter_bank_struct *qmf_bank, 135 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 136 WORD32 ld_mps_flag); 137 VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output, 138 const WORD16 *main_twidle_fwd, const WORD16 *post_tbl, 139 const WORD16 *w_16, const WORD32 *p_table); 140 141 VOID ixheaacd_dec_DCT2_64_asm(WORD32 *dct_in, WORD32 *ptime_out, WORD32 *w1024, 142 UWORD8 *dig_rev_table2_128, WORD16 *post_fft_tbl, 143 WORD16 *dct23_tw, WORD16 *filter_states); 144 VOID ixheaacd_cos_sin_mod(WORD32 *subband, 145 ia_sbr_qmf_filter_bank_struct *qmf_bank, 146 WORD16 *p_twiddle, WORD32 *p_dig_rev_tbl); 147 VOID ixheaacd_shiftrountine(WORD32 *qmf_real, WORD32 *qmf_imag, WORD32 len, 148 WORD32 common_shift); 149 VOID ixheaacd_shiftrountine_with_rnd(WORD32 *qmf_real, WORD32 *qmf_imag, 150 WORD16 *filter_states, WORD32 len, 151 WORD32 shift); 152 153 VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 npoints, 154 WORD32 ch_fac); 155 156 VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x, 157 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 158 159 VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x, 160 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 161 162 VOID ixheaacd_shiftrountine_with_rnd_eld(WORD32 *qmf_real, WORD32 *qmf_imag, 163 WORD16 *filter_states, WORD32 len, 164 WORD32 shift); 165 166 void ixheaacd_sbr_imdct_using_fft(const WORD32 *ptr_w, WORD32 npoints, 167 WORD32 *ptr_x, WORD32 *ptr_y, 168 UWORD8 *bit_rev_1024, UWORD8 *bit_rev_512, 169 UWORD8 *bit_rev_128, UWORD8 *bit_rev_32); 170 171 VOID ixheaacd_esbr_cos_sin_mod_loop1(WORD32 *subband, WORD32 M, 172 const WORD32 *p_sin_cos, 173 WORD32 subband_tmp[]); 174 175 VOID ixheaacd_esbr_cos_sin_mod_loop2(WORD32 *subband, const WORD32 *p_sin, 176 WORD32 M); 177 178 VOID ixheaacd_esbr_radix4bfly(const WORD32 *p_twiddle, WORD32 subband_tmp[], 179 WORD32 a, WORD32 npoint); 180 181 VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 npoints, 182 WORD32 ch_fac); 183 184 VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x, 185 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 186 187 VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x, 188 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 189 190 VOID ixheaacd_cos_sin_mod_loop1(WORD32 *subband, WORD32 M, 191 const WORD16 *p_sin_cos, WORD32 subband_tmp[]); 192 193 VOID ixheaacd_cos_sin_mod_loop2(WORD32 *subband, const WORD16 *p_sin, WORD32 M); 194 195 VOID ixheaacd_sbr_qmfsyn64_winadd(WORD16 *tmp1, WORD16 *tmp2, WORD16 *inp1, 196 WORD16 *sample_buffer, FLAG shift, 197 WORD32 ch_fac); 198 199 VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband, 200 ia_sbr_qmf_filter_bank_struct *qmf_bank, 201 WORD32 *p_twiddle, WORD32 *p_dig_rev_tbl); 202 203 VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states, 204 ia_sbr_qmf_filter_bank_struct *syn_qmf, 205 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 206 207 VOID ixheaacd_sbr_pre_twiddle(WORD32 *p_xre, WORD32 *p_xim, WORD16 *p_twiddles); 208 209 VOID ixheaacd_inv_emodulation(WORD32 *qmf_real, 210 ia_sbr_qmf_filter_bank_struct *syn_qmf, 211 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 212 213 VOID ixheaacd_pretwdct2(WORD32 *inp, WORD32 *out_fwd); 214 215 VOID ixheaacd_sbr_qmfanal32_winadd_eld(WORD16 *inp1, WORD16 *inp2, 216 const WORD16 *p_qmf1, 217 const WORD16 *p_qmf2, WORD32 *p_out); 218 219 VOID ixheaacd_sbr_qmfanal32_winadd_eld_32(WORD32 *inp1, WORD32 *inp2, 220 const WORD32 *p_qmf1, 221 const WORD32 *p_qmf2, WORD32 *p_out); 222 223 VOID ixheaacd_sbr_qmfanal32_winadd_eld_mps(WORD32 *inp1, WORD32 *inp2, 224 const WORD32 *p_qmf1, 225 const WORD32 *p_qmf2, WORD32 *p_out); 226 227 VOID ixheaacd_dct2_32(WORD32 *inp, WORD32 *out, 228 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 229 WORD16 *filter_states); 230 231 VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states, 232 ia_sbr_qmf_filter_bank_struct *syn_qmf, 233 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 234 235 VOID ixheaacd_fftposttw(WORD32 *out, 236 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 237 238 VOID ixheaacd_posttwdct2(WORD32 *inp, WORD16 *out_fwd, 239 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 240 241 #endif 242