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