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 WORD32 *qmf_real_out[MAX_ENV_COLS], WORD32 *qmf_imag_out[MAX_ENV_COLS], 90 ia_sbr_scale_fact_struct *sbr_scale_factor, WORD16 *time_out, 91 ia_sbr_qmf_filter_bank_struct *qmf_bank, ia_ps_dec_struct *ptr_ps_dec, 92 FLAG active, FLAG low_pow_flag, ia_sbr_tables_struct *sbr_tables_ptr, 93 ixheaacd_misc_tables *pstr_common_tables, WORD ch_fac, FLAG drc_on, 94 WORD32 drc_sbr_factors[][64], WORD32 audio_object_type); 95 96 VOID ixheaacd_esbr_qmfanal32_winadd(WORD32 *inp1, WORD32 *inp2, 97 WORD32 *tmp_qmf_1, WORD32 *tmp_qmf_2, 98 WORD32 *out, WORD32 num_band); 99 100 VOID ixheaacd_esbr_fwd_modulation(const WORD32 *time_in, WORD32 *r_subband, 101 WORD32 *i_subband, 102 ia_sbr_qmf_filter_bank_struct *qmf_bank, 103 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 104 105 VOID ixheaacd_esbr_inv_modulation(WORD32 *qmf_real, 106 ia_sbr_qmf_filter_bank_struct *syn_qmf, 107 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 108 WORD32 no_synthesis_channels); 109 110 VOID ixheaacd_shiftrountine_with_rnd_hq(WORD32 *qmf_real, WORD32 *qmf_imag, 111 WORD32 *filter_states, WORD32 len, 112 WORD32 shift); 113 114 VOID ixheaacd_esbr_qmfsyn64_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1, 115 WORD32 *sample_buffer, WORD32 ch_fac); 116 117 VOID ixheaacd_esbr_qmfsyn32_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1, 118 WORD32 *sample_buffer, WORD32 ch_fac); 119 120 VOID ixheaacd_sbr_qmfanal32_winadds(WORD16 *fp1, WORD16 *fp2, WORD16 *filter_1, 121 WORD16 *filter_2, WORD32 *analysis_buffer, 122 WORD16 *filter_states, 123 const WORD16 *time_sample_buf, 124 WORD32 ch_fac); 125 126 VOID ixheaacd_sbr_qmfanal32_winadds_eld(WORD16 *fp1, WORD16 *fp2, 127 WORD16 *filter_1, WORD16 *filter_2, 128 WORD32 *analysis_buffer, 129 WORD16 *filter_states, 130 const WORD16 *time_sample_buf, 131 WORD32 ch_fac); 132 133 VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband, 134 WORD32 *imag_subband, 135 ia_sbr_qmf_filter_bank_struct *qmf_bank, 136 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 137 WORD32 ld_mps_flag); 138 VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output, 139 const WORD16 *main_twidle_fwd, const WORD16 *post_tbl, 140 const WORD16 *w_16, const WORD32 *p_table); 141 142 VOID ixheaacd_dec_DCT2_64_asm(WORD32 *dct_in, WORD32 *ptime_out, WORD32 *w1024, 143 UWORD8 *dig_rev_table2_128, WORD16 *post_fft_tbl, 144 WORD16 *dct23_tw, WORD16 *filter_states); 145 VOID ixheaacd_cos_sin_mod(WORD32 *subband, 146 ia_sbr_qmf_filter_bank_struct *qmf_bank, 147 WORD16 *p_twiddle, WORD32 *p_dig_rev_tbl); 148 VOID ixheaacd_shiftrountine(WORD32 *qmf_real, WORD32 *qmf_imag, WORD32 len, 149 WORD32 common_shift); 150 VOID ixheaacd_shiftrountine_with_rnd(WORD32 *qmf_real, WORD32 *qmf_imag, 151 WORD16 *filter_states, WORD32 len, 152 WORD32 shift); 153 154 VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 npoints, 155 WORD32 ch_fac); 156 157 VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x, 158 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 159 160 VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x, 161 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 162 163 VOID ixheaacd_shiftrountine_with_rnd_eld(WORD32 *qmf_real, WORD32 *qmf_imag, 164 WORD16 *filter_states, WORD32 len, 165 WORD32 shift); 166 167 void ixheaacd_sbr_imdct_using_fft(const WORD32 *ptr_w, WORD32 npoints, 168 WORD32 *ptr_x, WORD32 *ptr_y, 169 UWORD8 *bit_rev_1024, UWORD8 *bit_rev_512, 170 UWORD8 *bit_rev_128, UWORD8 *bit_rev_32); 171 172 VOID ixheaacd_esbr_cos_sin_mod_loop1(WORD32 *subband, WORD32 M, 173 const WORD32 *p_sin_cos, 174 WORD32 subband_tmp[]); 175 176 VOID ixheaacd_esbr_cos_sin_mod_loop2(WORD32 *subband, const WORD32 *p_sin, 177 WORD32 M); 178 179 VOID ixheaacd_esbr_radix4bfly(const WORD32 *p_twiddle, WORD32 subband_tmp[], 180 WORD32 a, WORD32 npoint); 181 182 VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 npoints, 183 WORD32 ch_fac); 184 185 VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x, 186 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 187 188 VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x, 189 const WORD32 *p_dig_rev_tbl, WORD32 npoints); 190 191 VOID ixheaacd_cos_sin_mod_loop1(WORD32 *subband, WORD32 M, 192 const WORD16 *p_sin_cos, WORD32 subband_tmp[]); 193 194 VOID ixheaacd_cos_sin_mod_loop2(WORD32 *subband, const WORD16 *p_sin, WORD32 M); 195 196 VOID ixheaacd_sbr_qmfsyn64_winadd(WORD16 *tmp1, WORD16 *tmp2, WORD16 *inp1, 197 WORD16 *sample_buffer, FLAG shift, 198 WORD32 ch_fac); 199 200 VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband, 201 ia_sbr_qmf_filter_bank_struct *qmf_bank, 202 WORD32 *p_twiddle, WORD32 *p_dig_rev_tbl); 203 204 VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states, 205 ia_sbr_qmf_filter_bank_struct *syn_qmf, 206 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 207 208 VOID ixheaacd_sbr_pre_twiddle(WORD32 *p_xre, WORD32 *p_xim, WORD16 *p_twiddles); 209 210 VOID ixheaacd_inv_emodulation(WORD32 *qmf_real, 211 ia_sbr_qmf_filter_bank_struct *syn_qmf, 212 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 213 214 VOID ixheaacd_pretwdct2(WORD32 *inp, WORD32 *out_fwd); 215 216 VOID ixheaacd_sbr_qmfanal32_winadd_eld(WORD16 *inp1, WORD16 *inp2, 217 const WORD16 *p_qmf1, 218 const WORD16 *p_qmf2, WORD32 *p_out); 219 220 VOID ixheaacd_sbr_qmfanal32_winadd_eld_32(WORD32 *inp1, WORD32 *inp2, 221 const WORD32 *p_qmf1, 222 const WORD32 *p_qmf2, WORD32 *p_out); 223 224 VOID ixheaacd_sbr_qmfanal32_winadd_eld_mps(WORD32 *inp1, WORD32 *inp2, 225 const WORD32 *p_qmf1, 226 const WORD32 *p_qmf2, WORD32 *p_out); 227 228 VOID ixheaacd_dct2_32(WORD32 *inp, WORD32 *out, 229 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, 230 WORD16 *filter_states); 231 232 VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states, 233 ia_sbr_qmf_filter_bank_struct *syn_qmf, 234 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 235 236 VOID ixheaacd_fftposttw(WORD32 *out, 237 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 238 239 VOID ixheaacd_posttwdct2(WORD32 *inp, WORD16 *out_fwd, 240 ia_qmf_dec_tables_struct *qmf_dec_tables_ptr); 241 242 #endif 243