/src/libxaac/decoder/ixheaacd_mps_hybrid_filt.c
Line | Count | Source |
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 <string.h> |
21 | | #include "ixheaac_type_def.h" |
22 | | #include "ixheaacd_bitbuffer.h" |
23 | | #include "ixheaacd_common_rom.h" |
24 | | #include "ixheaacd_sbrdecsettings.h" |
25 | | #include "ixheaacd_sbr_scale.h" |
26 | | #include "ixheaacd_env_extr_part.h" |
27 | | #include "ixheaacd_sbr_rom.h" |
28 | | #include "ixheaacd_hybrid.h" |
29 | | #include "ixheaacd_ps_dec.h" |
30 | | #include "ixheaacd_config.h" |
31 | | #include "ixheaacd_qmf_dec.h" |
32 | | #include "ixheaacd_mps_polyphase.h" |
33 | | #include "ixheaac_constants.h" |
34 | | #include "ixheaacd_mps_struct_def.h" |
35 | | #include "ixheaacd_mps_res_rom.h" |
36 | | #include "ixheaacd_mps_aac_struct.h" |
37 | | #include "ixheaacd_mps_dec.h" |
38 | | #include "ixheaac_basic_ops32.h" |
39 | | #include "ixheaac_basic_ops40.h" |
40 | | #include "ixheaacd_mps_macro_def.h" |
41 | | #include "ixheaacd_mps_basic_op.h" |
42 | | |
43 | | extern const FLOAT32 ixheaacd_ia_mps_hyb_filter_coeff_8[QMF_HYBRID_FILT_ORDER]; |
44 | | extern const FLOAT32 ixheaacd_mps_hyb_filter_coeff_2[QMF_HYBRID_FILT_ORDER]; |
45 | | |
46 | | extern const FLOAT32 ixheaacd_sine[8][8]; |
47 | | extern const FLOAT32 ixheaacd_cosine[8][8]; |
48 | | |
49 | | static VOID ixheaacd_mps_hyb_filt_type1(ia_cmplx_flt_struct *input, |
50 | | ia_cmplx_flt_struct output[8][MAX_TIME_SLOTS], |
51 | 159k | WORD32 num_samples, const FLOAT32 *filt_coeff) { |
52 | 159k | WORD32 i, n, q; |
53 | | |
54 | 159k | FLOAT32 in_re, in_im; |
55 | 159k | FLOAT32 coeff; |
56 | 159k | FLOAT32 acc_re_l, acc_re_h, acc_im_l, acc_im_h; |
57 | | |
58 | 6.20M | for (i = 0; i < num_samples; i++) { |
59 | 6.04M | FLOAT32 x0_re[13], x0_im[13], x0_1_re[8], x0_1_im[8]; |
60 | 6.04M | FLOAT32 acc_re_val[8], acc_im_val[8]; |
61 | 84.5M | for (n = 0; n < QMF_HYBRID_FILT_ORDER; n++) { |
62 | 78.5M | in_re = input[n + i].re; |
63 | 78.5M | in_im = input[n + i].im; |
64 | | |
65 | 78.5M | coeff = filt_coeff[QMF_HYBRID_FILT_ORDER - 1 - n]; |
66 | | |
67 | 78.5M | x0_re[n] = coeff * in_re; |
68 | 78.5M | x0_im[n] = coeff * in_im; |
69 | 78.5M | } |
70 | | |
71 | 6.04M | x0_1_re[0] = x0_re[6]; |
72 | 6.04M | x0_1_im[0] = x0_im[6]; |
73 | | |
74 | 6.04M | x0_1_re[1] = x0_re[7]; |
75 | 6.04M | x0_1_im[1] = x0_im[7]; |
76 | | |
77 | 6.04M | x0_1_re[2] = x0_re[8] - x0_re[0]; |
78 | 6.04M | x0_1_im[2] = x0_im[8] - x0_im[0]; |
79 | | |
80 | 6.04M | x0_1_re[3] = x0_re[9] - x0_re[1]; |
81 | 6.04M | x0_1_im[3] = x0_im[9] - x0_im[1]; |
82 | | |
83 | 6.04M | x0_1_re[4] = x0_re[10] - x0_re[2]; |
84 | 6.04M | x0_1_im[4] = x0_im[10] - x0_im[2]; |
85 | | |
86 | 6.04M | x0_1_re[5] = x0_re[11] - x0_re[3]; |
87 | 6.04M | x0_1_im[5] = x0_im[11] - x0_im[3]; |
88 | | |
89 | 6.04M | x0_1_re[6] = x0_re[12] - x0_re[4]; |
90 | 6.04M | x0_1_im[6] = x0_im[12] - x0_im[4]; |
91 | | |
92 | 6.04M | x0_1_re[7] = -(x0_re[5]); |
93 | 6.04M | x0_1_im[7] = -(x0_im[5]); |
94 | | |
95 | 6.04M | acc_re_val[0] = x0_1_re[0]; |
96 | 6.04M | acc_re_val[1] = x0_1_re[1] - x0_1_re[7]; |
97 | 6.04M | acc_re_val[2] = x0_1_re[2] - x0_1_re[6]; |
98 | 6.04M | acc_re_val[3] = x0_1_re[3] - x0_1_re[5]; |
99 | 6.04M | acc_re_val[4] = x0_1_im[1] + x0_1_im[7]; |
100 | 6.04M | acc_re_val[5] = x0_1_im[2] + x0_1_im[6]; |
101 | 6.04M | acc_re_val[6] = x0_1_im[3] + x0_1_im[5]; |
102 | 6.04M | acc_re_val[7] = x0_1_im[4]; |
103 | | |
104 | 6.04M | acc_im_val[0] = x0_1_im[0]; |
105 | 6.04M | acc_im_val[1] = x0_1_im[1] - x0_1_im[7]; |
106 | 6.04M | acc_im_val[2] = x0_1_im[2] - x0_1_im[6]; |
107 | 6.04M | acc_im_val[3] = x0_1_im[3] - x0_1_im[5]; |
108 | 6.04M | acc_im_val[4] = x0_1_re[1] + x0_1_re[7]; |
109 | 6.04M | acc_im_val[5] = x0_1_re[2] + x0_1_re[6]; |
110 | 6.04M | acc_im_val[6] = x0_1_re[3] + x0_1_re[5]; |
111 | 6.04M | acc_im_val[7] = x0_1_re[4]; |
112 | | |
113 | 30.2M | for (q = 0; q < 4; q++) { |
114 | 24.1M | acc_re_l = 0; |
115 | 24.1M | acc_im_l = 0; |
116 | 24.1M | acc_re_h = 0; |
117 | 24.1M | acc_im_h = 0; |
118 | | |
119 | 24.1M | acc_re_l += acc_re_val[0]; |
120 | 24.1M | acc_re_l += acc_re_val[1] * ixheaacd_cosine[q][1]; |
121 | 24.1M | acc_re_l += acc_re_val[2] * ixheaacd_cosine[q][2]; |
122 | 24.1M | acc_re_l += acc_re_val[3] * ixheaacd_cosine[q][3]; |
123 | | |
124 | 24.1M | acc_re_h = acc_re_l; |
125 | | |
126 | 24.1M | acc_re_l -= acc_re_val[4] * ixheaacd_sine[q][1]; |
127 | 24.1M | acc_re_l -= acc_re_val[5] * ixheaacd_sine[q][2]; |
128 | 24.1M | acc_re_l -= acc_re_val[6] * ixheaacd_sine[q][3]; |
129 | 24.1M | acc_re_l -= acc_re_val[7] * ixheaacd_sine[q][4]; |
130 | | |
131 | 24.1M | acc_re_h = acc_re_h - (acc_re_l - acc_re_h); |
132 | | |
133 | 24.1M | acc_im_l += acc_im_val[0]; |
134 | 24.1M | acc_im_l += acc_im_val[1] * ixheaacd_cosine[q][1]; |
135 | 24.1M | acc_im_l += acc_im_val[2] * ixheaacd_cosine[q][2]; |
136 | 24.1M | acc_im_l += acc_im_val[3] * ixheaacd_cosine[q][3]; |
137 | | |
138 | 24.1M | acc_im_h = acc_im_l; |
139 | | |
140 | 24.1M | acc_im_l += acc_im_val[4] * ixheaacd_sine[q][1]; |
141 | 24.1M | acc_im_l += acc_im_val[5] * ixheaacd_sine[q][2]; |
142 | 24.1M | acc_im_l += acc_im_val[6] * ixheaacd_sine[q][3]; |
143 | 24.1M | acc_im_l += acc_im_val[7] * ixheaacd_sine[q][4]; |
144 | | |
145 | 24.1M | acc_im_h = acc_im_h - (acc_im_l - acc_im_h); |
146 | | |
147 | 24.1M | output[q][i].re = acc_re_l; |
148 | 24.1M | output[q][i].im = acc_im_l; |
149 | | |
150 | 24.1M | output[7 - q][i].re = acc_re_h; |
151 | 24.1M | output[7 - q][i].im = acc_im_h; |
152 | 24.1M | } |
153 | 6.04M | } |
154 | 159k | } |
155 | | |
156 | | static VOID ixheaacd_mps_hyb_filt_type2(ia_cmplx_flt_struct *input, |
157 | | ia_cmplx_flt_struct output[2][MAX_TIME_SLOTS], |
158 | 319k | WORD32 num_samples, const FLOAT32 *filt_coeff) { |
159 | 319k | WORD32 i, n; |
160 | | |
161 | 319k | FLOAT32 in_re, in_im; |
162 | 319k | FLOAT32 coeff; |
163 | 319k | FLOAT32 acc_re[2], acc_im[2]; |
164 | | |
165 | 12.4M | for (i = 0; i < num_samples; i++) { |
166 | 12.0M | FLOAT32 x_0_re[13], x_0_im[13]; |
167 | | |
168 | 48.3M | for (n = 1; n < 6; n = n + 2) { |
169 | 36.2M | in_re = input[n + i].re; |
170 | 36.2M | in_im = input[n + i].im; |
171 | | |
172 | 36.2M | in_re += input[12 - n + i].re; |
173 | 36.2M | in_im += input[12 - n + i].im; |
174 | | |
175 | 36.2M | coeff = filt_coeff[QMF_HYBRID_FILT_ORDER - 1 - n]; |
176 | | |
177 | 36.2M | x_0_re[n] = coeff * in_re; |
178 | 36.2M | x_0_im[n] = coeff * in_im; |
179 | 36.2M | } |
180 | | |
181 | 12.0M | n = 6; |
182 | 12.0M | in_re = input[n + i].re; |
183 | 12.0M | in_im = input[n + i].im; |
184 | | |
185 | 12.0M | coeff = filt_coeff[QMF_HYBRID_FILT_ORDER - 1 - n]; |
186 | | |
187 | 12.0M | x_0_re[n] = coeff * in_re; |
188 | 12.0M | x_0_im[n] = coeff * in_im; |
189 | | |
190 | 12.0M | x_0_re[1] = x_0_re[1] + x_0_re[3] + x_0_re[5]; |
191 | 12.0M | x_0_im[1] = x_0_im[1] + x_0_im[3] + x_0_im[5]; |
192 | | |
193 | 12.0M | acc_re[0] = x_0_re[6] + x_0_re[1]; |
194 | 12.0M | acc_im[0] = x_0_im[6] + x_0_im[1]; |
195 | | |
196 | 12.0M | acc_re[1] = x_0_re[6] - x_0_re[1]; |
197 | 12.0M | acc_im[1] = x_0_im[6] - x_0_im[1]; |
198 | | |
199 | 12.0M | output[0][i].re = acc_re[0]; |
200 | 12.0M | output[0][i].im = acc_im[0]; |
201 | | |
202 | 12.0M | output[1][i].re = acc_re[1]; |
203 | 12.0M | output[1][i].im = acc_im[1]; |
204 | 12.0M | } |
205 | 319k | } |
206 | | |
207 | 4.71k | VOID ixheaacd_mps_qmf_hybrid_analysis_init(ia_mps_hybrid_filt_struct *handle) { |
208 | 4.71k | memset(handle->lf_buffer, 0, |
209 | 4.71k | QMF_BANDS_TO_HYBRID * BUFFER_LEN_LF_MPS * sizeof(ia_cmplx_w32_struct)); |
210 | 4.71k | memset(handle->hf_buffer, 0, |
211 | 4.71k | MAX_NUM_QMF_BANDS_MPS * BUFFER_LEN_HF_MPS * sizeof(ia_cmplx_flt_struct)); |
212 | 4.71k | } |
213 | | |
214 | | VOID ixheaacd_mps_qmf_hybrid_analysis_no_pre_mix( |
215 | | ia_mps_hybrid_filt_struct *handle, |
216 | | ia_cmplx_flt_struct in_qmf[MAX_NUM_QMF_BANDS_MPS][MAX_TIME_SLOTS], WORD32 num_bands, |
217 | 138k | WORD32 num_samples, ia_cmplx_flt_struct v[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS]) { |
218 | 138k | WORD32 lf_samples_shift; |
219 | 138k | WORD32 hf_samples_shift; |
220 | 138k | WORD32 lf_qmf_bands; |
221 | 138k | WORD32 k, n; |
222 | | |
223 | 138k | ia_cmplx_flt_struct scratch[MAX_HYBRID_ONLY_BANDS_PER_QMF][MAX_TIME_SLOTS]; |
224 | | |
225 | 138k | lf_samples_shift = BUFFER_LEN_LF_MPS - num_samples; |
226 | 138k | hf_samples_shift = BUFFER_LEN_HF_MPS - num_samples; |
227 | | |
228 | 138k | lf_qmf_bands = QMF_BANDS_TO_HYBRID; |
229 | | |
230 | 552k | for (k = 0; k < lf_qmf_bands; k++) { |
231 | 414k | memmove(&handle->lf_buffer[k][0].re, &handle->lf_buffer[k][num_samples].re, |
232 | 414k | 2 * lf_samples_shift * sizeof(FLOAT32)); |
233 | 414k | } |
234 | | |
235 | 552k | for (k = 0; k < lf_qmf_bands; k++) { |
236 | 414k | memcpy(&handle->lf_buffer[k][lf_samples_shift].re, &in_qmf[k][0].re, |
237 | 414k | 2 * num_samples * sizeof(FLOAT32)); |
238 | 414k | } |
239 | | |
240 | 8.56M | for (k = 0; k < MAX_NUM_QMF_BANDS_SAC / 2 - lf_qmf_bands; k++) { |
241 | 8.43M | memmove(&handle->hf_buffer[k][0].re, &handle->hf_buffer[k][num_samples].re, |
242 | 8.43M | 2 * hf_samples_shift * sizeof(FLOAT32)); |
243 | 8.43M | } |
244 | | |
245 | 4.45M | for (k = 0; k < num_bands - lf_qmf_bands; k++) { |
246 | 4.31M | memcpy(&handle->hf_buffer[k][hf_samples_shift].re, &in_qmf[k + lf_qmf_bands][0].re, |
247 | 4.31M | 2 * num_samples * sizeof(FLOAT32)); |
248 | 4.31M | } |
249 | | |
250 | 138k | ixheaacd_mps_hyb_filt_type1( |
251 | 138k | &(handle->lf_buffer[0][lf_samples_shift + 1 - QMF_HYBRID_FILT_ORDER]), scratch, num_samples, |
252 | 138k | ixheaacd_ia_mps_hyb_filter_coeff_8); |
253 | | |
254 | 414k | for (k = 0; k < 2; k++) { |
255 | 10.4M | for (n = 0; n < num_samples; n++) { |
256 | 10.1M | v[n][k].re = scratch[k + 6][n].re; |
257 | 10.1M | v[n][k + 2].re = scratch[k][n].re; |
258 | 10.1M | v[n][k + 4].re = scratch[k + 2][n].re; |
259 | 10.1M | v[n][k + 4].re += scratch[5 - k][n].re; |
260 | | |
261 | 10.1M | v[n][k].im = scratch[k + 6][n].im; |
262 | 10.1M | v[n][k + 2].im = scratch[k][n].im; |
263 | 10.1M | v[n][k + 4].im = scratch[k + 2][n].im; |
264 | 10.1M | v[n][k + 4].im += scratch[5 - k][n].im; |
265 | 10.1M | } |
266 | 276k | } |
267 | | |
268 | 138k | ixheaacd_mps_hyb_filt_type2( |
269 | 138k | &(handle->lf_buffer[1][lf_samples_shift + 1 - QMF_HYBRID_FILT_ORDER]), scratch, num_samples, |
270 | 138k | ixheaacd_mps_hyb_filter_coeff_2); |
271 | | |
272 | 414k | for (k = 0; k < 2; k++) { |
273 | 10.4M | for (n = 0; n < num_samples; n++) { |
274 | 10.1M | v[n][k + 6].re = scratch[1 - k][n].re; |
275 | 10.1M | v[n][k + 6].im = scratch[1 - k][n].im; |
276 | 10.1M | } |
277 | 276k | } |
278 | | |
279 | 138k | ixheaacd_mps_hyb_filt_type2( |
280 | 138k | &(handle->lf_buffer[2][lf_samples_shift + 1 - QMF_HYBRID_FILT_ORDER]), scratch, num_samples, |
281 | 138k | ixheaacd_mps_hyb_filter_coeff_2); |
282 | | |
283 | 414k | for (k = 0; k < 2; k++) { |
284 | 10.4M | for (n = 0; n < num_samples; n++) { |
285 | 10.1M | v[n][k + 8].re = scratch[k][n].re; |
286 | 10.1M | v[n][k + 8].im = scratch[k][n].im; |
287 | 10.1M | } |
288 | 276k | } |
289 | | |
290 | 4.45M | for (k = 0; k < num_bands - lf_qmf_bands; k++) { |
291 | 152M | for (n = 0; n < num_samples; n++) { |
292 | 147M | v[n][k + 10].re = (handle->hf_buffer[k][n + hf_samples_shift].re); |
293 | 147M | v[n][k + 10].im = (handle->hf_buffer[k][n + hf_samples_shift].im); |
294 | 147M | } |
295 | 4.31M | } |
296 | 138k | } |
297 | | |
298 | | VOID ixheaacd_mps_qmf_hybrid_analysis( |
299 | | ia_mps_hybrid_filt_struct *handle, |
300 | | ia_cmplx_flt_struct in_qmf[MAX_NUM_QMF_BANDS_MPS_NEW][MAX_TIME_SLOTS], WORD32 num_bands, |
301 | 21.3k | WORD32 num_samples, ia_cmplx_flt_struct hyb[MAX_HYBRID_BANDS_MPS][MAX_TIME_SLOTS]) { |
302 | 21.3k | WORD32 lf_samples_shift; |
303 | 21.3k | WORD32 hf_samples_shift; |
304 | 21.3k | WORD32 lf_qmf_bands; |
305 | 21.3k | WORD32 k, n; |
306 | | |
307 | 21.3k | ia_cmplx_flt_struct scratch[MAX_HYBRID_ONLY_BANDS_PER_QMF][MAX_TIME_SLOTS]; |
308 | | |
309 | 21.3k | lf_samples_shift = BUFFER_LEN_LF_MPS - num_samples; |
310 | 21.3k | hf_samples_shift = BUFFER_LEN_HF_MPS - num_samples; |
311 | | |
312 | 21.3k | lf_qmf_bands = QMF_BANDS_TO_HYBRID; |
313 | | |
314 | 85.2k | for (k = 0; k < lf_qmf_bands; k++) { |
315 | 63.9k | memmove(&handle->lf_buffer[k][0].re, &handle->lf_buffer[k][num_samples].re, |
316 | 63.9k | 2 * lf_samples_shift * sizeof(FLOAT32)); |
317 | 63.9k | } |
318 | | |
319 | 85.2k | for (k = 0; k < lf_qmf_bands; k++) { |
320 | 63.9k | memcpy(&handle->lf_buffer[k][lf_samples_shift].re, &in_qmf[k][0].re, |
321 | 63.9k | 2 * num_samples * sizeof(FLOAT32)); |
322 | 63.9k | } |
323 | | |
324 | 1.32M | for (k = 0; k < MAX_NUM_QMF_BANDS_SAC / 2 - lf_qmf_bands; k++) { |
325 | 1.30M | memmove(&handle->hf_buffer[k][0].re, &handle->hf_buffer[k][num_samples].re, |
326 | 1.30M | 2 * hf_samples_shift * sizeof(FLOAT32)); |
327 | 1.30M | } |
328 | | |
329 | 987k | for (k = 0; k < num_bands - lf_qmf_bands; k++) { |
330 | 966k | memcpy(&handle->hf_buffer[k][hf_samples_shift].re, &in_qmf[k + lf_qmf_bands][0].re, |
331 | 966k | 2 * num_samples * sizeof(FLOAT32)); |
332 | 966k | } |
333 | | |
334 | 21.3k | ixheaacd_mps_hyb_filt_type1( |
335 | 21.3k | &(handle->lf_buffer[0][lf_samples_shift + 1 - QMF_HYBRID_FILT_ORDER]), scratch, num_samples, |
336 | 21.3k | ixheaacd_ia_mps_hyb_filter_coeff_8); |
337 | | |
338 | 63.9k | for (k = 0; k < 2; k++) { |
339 | 1.96M | for (n = 0; n < num_samples; n++) { |
340 | 1.92M | hyb[k][n].re = scratch[k + 6][n].re; |
341 | 1.92M | hyb[k + 2][n].re = scratch[k][n].re; |
342 | 1.92M | hyb[k + 4][n].re = scratch[k + 2][n].re; |
343 | 1.92M | hyb[k + 4][n].re += scratch[5 - k][n].re; |
344 | | |
345 | 1.92M | hyb[k][n].im = scratch[k + 6][n].im; |
346 | 1.92M | hyb[k + 2][n].im = scratch[k][n].im; |
347 | 1.92M | hyb[k + 4][n].im = scratch[k + 2][n].im; |
348 | 1.92M | hyb[k + 4][n].im += scratch[5 - k][n].im; |
349 | 1.92M | } |
350 | 42.6k | } |
351 | | |
352 | 21.3k | ixheaacd_mps_hyb_filt_type2( |
353 | 21.3k | &(handle->lf_buffer[1][lf_samples_shift + 1 - QMF_HYBRID_FILT_ORDER]), scratch, num_samples, |
354 | 21.3k | ixheaacd_mps_hyb_filter_coeff_2); |
355 | | |
356 | 63.9k | for (k = 0; k < 2; k++) { |
357 | 1.96M | for (n = 0; n < num_samples; n++) { |
358 | 1.92M | hyb[k + 6][n].re = scratch[1 - k][n].re; |
359 | 1.92M | hyb[k + 6][n].im = scratch[1 - k][n].im; |
360 | 1.92M | } |
361 | 42.6k | } |
362 | | |
363 | 21.3k | ixheaacd_mps_hyb_filt_type2( |
364 | 21.3k | &(handle->lf_buffer[2][lf_samples_shift + 1 - QMF_HYBRID_FILT_ORDER]), scratch, num_samples, |
365 | 21.3k | ixheaacd_mps_hyb_filter_coeff_2); |
366 | | |
367 | 63.9k | for (k = 0; k < 2; k++) { |
368 | 1.96M | for (n = 0; n < num_samples; n++) { |
369 | 1.92M | hyb[k + 8][n].re = scratch[k][n].re; |
370 | 1.92M | hyb[k + 8][n].im = scratch[k][n].im; |
371 | 1.92M | } |
372 | 42.6k | } |
373 | | |
374 | 987k | for (k = 0; k < num_bands - lf_qmf_bands; k++) { |
375 | 966k | memcpy(&hyb[k + 10][0].re, &handle->hf_buffer[k][hf_samples_shift].re, |
376 | 966k | 2 * num_samples * sizeof(FLOAT32)); |
377 | 966k | } |
378 | 21.3k | } |
379 | | |
380 | | VOID ixheaacd_mps_qmf_hybrid_synthesis( |
381 | | ia_cmplx_flt_struct hyb[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS], WORD32 num_bands, |
382 | 204k | WORD32 num_samples, ia_cmplx_flt_struct in_qmf[MAX_TIME_SLOTS][MAX_NUM_QMF_BANDS_MPS]) { |
383 | 204k | WORD32 k, n; |
384 | | |
385 | 7.72M | for (n = 0; n < num_samples; n++) { |
386 | 7.51M | in_qmf[n][0].re = hyb[n][0].re; |
387 | 7.51M | in_qmf[n][0].im = hyb[n][0].im; |
388 | | |
389 | 45.0M | for (k = 1; k < 6; k++) { |
390 | 37.5M | in_qmf[n][0].re += hyb[n][k].re; |
391 | 37.5M | in_qmf[n][0].im += hyb[n][k].im; |
392 | 37.5M | } |
393 | | |
394 | 7.51M | in_qmf[n][1].re = hyb[n][6].re + hyb[n][7].re; |
395 | 7.51M | in_qmf[n][1].im = hyb[n][6].im + hyb[n][7].im; |
396 | | |
397 | 7.51M | in_qmf[n][2].re = hyb[n][8].re + hyb[n][9].re; |
398 | 7.51M | in_qmf[n][2].im = hyb[n][8].im + hyb[n][9].im; |
399 | | |
400 | 7.51M | memcpy(&in_qmf[n][3].re, &hyb[n][10].re, 2 * (num_bands - 3) * sizeof(FLOAT32)); |
401 | 7.51M | } |
402 | 204k | } |
403 | | |
404 | | VOID ixheaacd_mps_fft(complex *out, LOOPINDEX idx, WORD32 nob, |
405 | 2.21M | const ia_mps_dec_hybrid_tables_struct *hyb_tab) { |
406 | 2.21M | LOOPINDEX block_per_stage, stage_num, inner; |
407 | 2.21M | const WORD32 *cosine_array = hyb_tab->cosine_array; |
408 | 2.21M | const WORD32 *sine_array = hyb_tab->sine_array; |
409 | 2.21M | WORD32 index_1, index_2, index, tab_modifier; |
410 | 2.21M | WORD32 len, increment, i; |
411 | | |
412 | 2.21M | WORD32 cos_val; |
413 | 2.21M | WORD32 sin_val; |
414 | | |
415 | 2.21M | WORD16 index1; |
416 | 2.21M | WORD32 re_temp; |
417 | 2.21M | WORD32 im_temp; |
418 | 2.21M | WORD32 *out1_w32, *out2_w32; |
419 | | |
420 | 2.21M | len = idx; |
421 | 2.21M | i = 1; |
422 | 2.21M | increment = 0; |
423 | | |
424 | 2.21M | len = len >> 1; |
425 | 2.21M | index_1 = 0; |
426 | 2.21M | increment += 1; |
427 | | |
428 | 2.21M | index = 11 - increment; |
429 | 2.21M | tab_modifier = ixheaac_shl32(1, index); |
430 | | |
431 | 2.21M | out1_w32 = (WORD32 *)&out[index_1]; |
432 | 2.21M | out2_w32 = (WORD32 *)&out[index_1 + 1]; |
433 | | |
434 | 11.0M | for (block_per_stage = 0; block_per_stage < len; block_per_stage++) { |
435 | 8.85M | re_temp = out2_w32[0]; |
436 | 8.85M | im_temp = out2_w32[1]; |
437 | | |
438 | 8.85M | out2_w32[0] = ixheaac_sub32_sat(out1_w32[0], re_temp); |
439 | 8.85M | out2_w32[1] = ixheaac_sub32_sat(out1_w32[1], im_temp); |
440 | | |
441 | 8.85M | out1_w32[0] = ixheaac_add32_sat(re_temp, out1_w32[0]); |
442 | 8.85M | out1_w32[1] = ixheaac_add32_sat(im_temp, out1_w32[1]); |
443 | | |
444 | 8.85M | out1_w32 += 4; |
445 | 8.85M | out2_w32 += 4; |
446 | 8.85M | } |
447 | | |
448 | 2.21M | i <<= 1; |
449 | | |
450 | 6.63M | for (stage_num = 1; stage_num < nob; stage_num++) { |
451 | 4.42M | len = len >> 1; |
452 | 4.42M | index_1 = 0; |
453 | 4.42M | increment += 1; |
454 | | |
455 | 4.42M | index = 11 - increment; |
456 | 4.42M | tab_modifier = ixheaac_shl32(1, index); |
457 | | |
458 | 11.0M | for (block_per_stage = 0; block_per_stage < len; block_per_stage++) { |
459 | 6.63M | index_2 = index_1 + i; |
460 | | |
461 | 6.63M | out1_w32 = (WORD32 *)&out[index_1]; |
462 | 6.63M | out2_w32 = (WORD32 *)&out[index_2]; |
463 | | |
464 | 6.63M | re_temp = out1_w32[0]; |
465 | 6.63M | im_temp = out1_w32[1]; |
466 | | |
467 | 6.63M | out1_w32[0] = ((WORD64)re_temp + (WORD64)out2_w32[0]) >> 1; |
468 | 6.63M | out1_w32[1] = ((WORD64)im_temp + (WORD64)out2_w32[1]) >> 1; |
469 | | |
470 | 6.63M | out2_w32[0] = ((WORD64)re_temp - (WORD64)out2_w32[0]) >> 1; |
471 | 6.63M | out2_w32[1] = ((WORD64)im_temp - (WORD64)out2_w32[1]) >> 1; |
472 | | |
473 | 6.63M | index1 = tab_modifier; |
474 | | |
475 | 6.63M | out1_w32 += 2; |
476 | 6.63M | out2_w32 += 2; |
477 | | |
478 | 17.7M | for (inner = 0; inner < ((i - 1) << 1); inner += 2) { |
479 | 11.0M | cos_val = cosine_array[index1]; |
480 | 11.0M | sin_val = sine_array[index1]; |
481 | | |
482 | 11.0M | re_temp = ixheaacd_mps_mult32x16_shr_16(out2_w32[inner], cos_val) + |
483 | 11.0M | ixheaacd_mps_mult32x16_shr_16(out2_w32[inner + 1], sin_val); |
484 | 11.0M | im_temp = ixheaacd_mps_mult32x16_shr_16(out2_w32[inner + 1], cos_val) - |
485 | 11.0M | ixheaacd_mps_mult32x16_shr_16(out2_w32[inner], sin_val); |
486 | | |
487 | 11.0M | out1_w32[inner] >>= 1; |
488 | 11.0M | out1_w32[inner + 1] >>= 1; |
489 | | |
490 | 11.0M | out2_w32[inner] = ixheaac_sub32_sat(out1_w32[inner], re_temp); |
491 | 11.0M | out2_w32[inner + 1] = ixheaac_sub32_sat(out1_w32[inner + 1], im_temp); |
492 | | |
493 | 11.0M | out1_w32[inner] = ixheaac_add32_sat(out1_w32[inner], re_temp); |
494 | 11.0M | out1_w32[inner + 1] = ixheaac_add32_sat(out1_w32[inner + 1], im_temp); |
495 | | |
496 | 11.0M | index1 += tab_modifier; |
497 | 11.0M | } |
498 | | |
499 | 6.63M | index_1 += ixheaac_shl32(1, increment); |
500 | 6.63M | } |
501 | 4.42M | i <<= 1; |
502 | 4.42M | } |
503 | 2.21M | } |
504 | | |
505 | | VOID ixheaacd_8ch_filtering(const WORD32 *p_qmf_real, const WORD32 *p_qmf_imag, |
506 | | WORD32 *m_hybrid_real, WORD32 *m_hybrid_imag, |
507 | 2.21M | const ia_mps_dec_hybrid_tables_struct *hyb_tab) { |
508 | 2.21M | WORD32 n; |
509 | 2.21M | WORD32 real, imag; |
510 | 2.21M | const WORD16 tcos = COS_PI_BY_8; |
511 | 2.21M | const WORD16 tsin = SIN_PI_BY_8; |
512 | 2.21M | WORD32 cum[16]; |
513 | 2.21M | WORD32 *p_complex; |
514 | 2.21M | const WORD16 *p8_13 = hyb_tab->p8_13; |
515 | | |
516 | 2.21M | real = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[4], p8_13[4]) + |
517 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[12], p8_13[12])), |
518 | 2.21M | 1); |
519 | 2.21M | imag = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[4], p8_13[4]) + |
520 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[12], p8_13[12])), |
521 | 2.21M | 1); |
522 | | |
523 | 2.21M | cum[5] = ixheaac_sub32_sat(imag, real); |
524 | 2.21M | cum[4] = -ixheaac_add32_sat(imag, real); |
525 | | |
526 | 2.21M | real = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[3], p8_13[3]) + |
527 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[11], p8_13[11])), |
528 | 2.21M | 1); |
529 | 2.21M | imag = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[3], p8_13[3]) + |
530 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[11], p8_13[11])), |
531 | 2.21M | 1); |
532 | | |
533 | 2.21M | cum[13] = ixheaac_shl32( |
534 | 2.21M | (ixheaac_mult32x16in32(imag, tcos) - ixheaac_mult32x16in32(real, tsin)), 1); |
535 | 2.21M | cum[12] = ixheaac_shl32( |
536 | 2.21M | -((ixheaac_mult32x16in32(imag, tsin) + ixheaac_mult32x16in32(real, tcos))), 1); |
537 | | |
538 | 2.21M | cum[2] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[2], p8_13[10]) - |
539 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[10], p8_13[10])), |
540 | 2.21M | 1); |
541 | 2.21M | cum[3] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[2], p8_13[2]) - |
542 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[10], p8_13[2])), |
543 | 2.21M | 1); |
544 | 2.21M | real = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[1], p8_13[1]) + |
545 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[9], p8_13[9])), |
546 | 2.21M | 1); |
547 | 2.21M | imag = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[1], p8_13[1]) + |
548 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[9], p8_13[9])), |
549 | 2.21M | 1); |
550 | | |
551 | 2.21M | cum[11] = ixheaac_shl32( |
552 | 2.21M | (ixheaac_mult32x16in32(imag, tcos) + ixheaac_mult32x16in32(real, tsin)), 1); |
553 | 2.21M | cum[10] = ixheaac_shl32( |
554 | 2.21M | (ixheaac_mult32x16in32(imag, tsin) - ixheaac_mult32x16in32(real, tcos)), 1); |
555 | | |
556 | 2.21M | real = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[0], p8_13[0]) + |
557 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[8], p8_13[8])), |
558 | 2.21M | 1); |
559 | 2.21M | imag = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[0], p8_13[0]) + |
560 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[8], p8_13[8])), |
561 | 2.21M | 1); |
562 | | |
563 | 2.21M | cum[7] = ixheaac_add32_sat(imag, real); |
564 | 2.21M | cum[6] = ixheaac_sub32_sat(imag, real); |
565 | | |
566 | 2.21M | cum[15] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[7], p8_13[14]) + |
567 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[7], p8_13[13])), |
568 | 2.21M | 1); |
569 | 2.21M | cum[14] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[7], p8_13[13]) - |
570 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[7], p8_13[14])), |
571 | 2.21M | 1); |
572 | | |
573 | 2.21M | cum[1] = ixheaac_shl32( |
574 | 2.21M | ixheaac_mult32x16in32(p_qmf_real[HYBRID_FILTER_DELAY], p8_13[HYBRID_FILTER_DELAY]), 1); |
575 | 2.21M | cum[0] = ixheaac_shl32( |
576 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[HYBRID_FILTER_DELAY], p8_13[HYBRID_FILTER_DELAY]), 1); |
577 | | |
578 | 2.21M | cum[9] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[5], p8_13[13]) - |
579 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[5], p8_13[14])), |
580 | 2.21M | 1); |
581 | 2.21M | cum[8] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[5], p8_13[14]) + |
582 | 2.21M | ixheaac_mult32x16in32(p_qmf_imag[5], p8_13[13])), |
583 | 2.21M | 1); |
584 | | |
585 | 2.21M | ixheaacd_mps_fft((complex *)cum, 8, 3, hyb_tab); |
586 | | |
587 | 2.21M | p_complex = cum; |
588 | | |
589 | 19.9M | for (n = 0; n < 8; n++) { |
590 | 17.7M | m_hybrid_imag[n] = *p_complex++; |
591 | 17.7M | m_hybrid_real[n] = *p_complex++; |
592 | 17.7M | } |
593 | 2.21M | } |
594 | | |
595 | | VOID ixheaacd_2ch_filtering(WORD32 *p_qmf, WORD32 *m_hybrid, |
596 | 8.85M | const ia_mps_dec_hybrid_tables_struct *hyb_tab_ptr) { |
597 | 8.85M | WORD32 cum0, cum1; |
598 | 8.85M | WORD64 temp; |
599 | 8.85M | const WORD16 *p2_6 = hyb_tab_ptr->p2_6; |
600 | | |
601 | 8.85M | cum0 = (WORD32)p_qmf[HYBRID_FILTER_DELAY] >> 1; |
602 | | |
603 | 8.85M | temp = (WORD64)((WORD64)p2_6[0] * ((WORD64)p_qmf[1] + (WORD64)p_qmf[11]) + |
604 | 8.85M | (WORD64)p2_6[1] * ((WORD64)p_qmf[3] + (WORD64)p_qmf[9])); |
605 | 8.85M | temp += (WORD64)p2_6[2] * ((WORD64)p_qmf[5] + (WORD64)p_qmf[7]); |
606 | 8.85M | cum1 = (WORD32)(temp >> 16); |
607 | | |
608 | 8.85M | m_hybrid[0] = ixheaac_add32_sat(cum0, cum1); |
609 | 8.85M | m_hybrid[1] = ixheaac_sub32_sat(cum0, cum1); |
610 | 8.85M | } |
611 | | |
612 | | WORD32 ixheaacd_get_qmf_sb( |
613 | | WORD32 hybrid_subband, |
614 | 3.69M | const ia_mps_dec_mdct2qmf_table_struct *ixheaacd_mps_dec_mdct2qmf_table) { |
615 | 3.69M | return ixheaacd_mps_dec_mdct2qmf_table->hybrid_2_qmf[hybrid_subband]; |
616 | 3.69M | } |
617 | | |
618 | 16.8k | VOID ixheaacd_init_ana_hyb_filt_bank(ia_mps_dec_thyb_filter_state_struct *hyb_state) { |
619 | 16.8k | WORD32 k, n; |
620 | | |
621 | 67.4k | for (k = 0; k < QMF_BANDS_TO_HYBRID; k++) { |
622 | 4.29M | for (n = 0; n < PROTO_LEN - 1 + MAX_TIME_SLOTS; n++) { |
623 | 4.24M | hyb_state->buffer_lf_real[k][n] = 0; |
624 | 4.24M | hyb_state->buffer_lf_imag[k][n] = 0; |
625 | 4.24M | hyb_state->qmf_lf_real[k][n] = 0; |
626 | 4.24M | hyb_state->qmf_lf_imag[k][n] = 0; |
627 | 4.24M | } |
628 | 50.5k | } |
629 | | |
630 | 1.09M | for (k = 0; k < MAX_NUM_QMF_BANDS; k++) { |
631 | 85.2M | for (n = 0; n < ((PROTO_LEN - 1) >> 1) + MAX_TIME_SLOTS; n++) { |
632 | 84.1M | hyb_state->buffer_hf_real[k][n] = 0; |
633 | 84.1M | hyb_state->buffer_hf_imag[k][n] = 0; |
634 | 84.1M | } |
635 | 1.07M | } |
636 | 16.8k | } |
637 | | |
638 | | VOID ixheaacd_apply_ana_hyb_filt_bank_create_x( |
639 | | ia_mps_dec_thyb_filter_state_struct *hyb_state, WORD32 *m_qmf_real, WORD32 *m_qmf_imag, |
640 | | WORD32 nr_bands, WORD32 nr_samples, WORD32 *m_hybrid_real, WORD32 *m_hybrid_imag, |
641 | 74.1k | const ia_mps_dec_hybrid_tables_struct *hyb_tab_ptr) { |
642 | 74.1k | WORD32 nr_samples_shift_lf; |
643 | 74.1k | WORD32 nr_qmf_bands_lf; |
644 | 74.1k | WORD32 k, n; |
645 | 74.1k | WORD32 time_slot; |
646 | | |
647 | 74.1k | WORD32 proto_len = (PROTO_LEN - 1) >> 1; |
648 | 74.1k | WORD32 val = nr_samples - proto_len; |
649 | 74.1k | WORD32 val_xhb = val * MAX_HYBRID_BANDS; |
650 | 74.1k | WORD32 loop_cnt, loop_cnt_x4; |
651 | 74.1k | WORD32 *p_qmf_real, *p_qmf_re, *p_qmf_imag, *p_qmf_im; |
652 | | |
653 | 74.1k | WORD32 m_temp_output_real[MAX_HYBRID_ONLY_BANDS_PER_QMF]; |
654 | 74.1k | WORD32 m_temp_output_imag[MAX_HYBRID_ONLY_BANDS_PER_QMF]; |
655 | | |
656 | 74.1k | WORD32 *p_hybrid_real = m_hybrid_real + 10; |
657 | 74.1k | WORD32 *p_hybrid_imag = m_hybrid_imag + 10; |
658 | | |
659 | 74.1k | WORD32 *p_hybrid_re, *p_hybrid_im; |
660 | | |
661 | 74.1k | nr_samples_shift_lf = BUFFER_LEN_LF - nr_samples; |
662 | | |
663 | 74.1k | nr_qmf_bands_lf = QMF_BANDS_TO_HYBRID; |
664 | 74.1k | loop_cnt = nr_bands - nr_qmf_bands_lf; |
665 | 74.1k | loop_cnt_x4 = (loop_cnt << 2); |
666 | | |
667 | 296k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
668 | 12.3M | for (n = 0; n < nr_samples_shift_lf; n++) { |
669 | 12.1M | hyb_state->buffer_lf_real[k][n] = hyb_state->buffer_lf_real[k][n + nr_samples]; |
670 | 12.1M | hyb_state->buffer_lf_imag[k][n] = hyb_state->buffer_lf_imag[k][n + nr_samples]; |
671 | | |
672 | 12.1M | hyb_state->qmf_lf_real[k][n] = hyb_state->qmf_lf_real[k][n + nr_samples]; |
673 | 12.1M | hyb_state->qmf_lf_imag[k][n] = hyb_state->qmf_lf_imag[k][n + nr_samples]; |
674 | 12.1M | } |
675 | 222k | } |
676 | | |
677 | 74.1k | p_qmf_real = m_qmf_real; |
678 | 74.1k | p_qmf_imag = m_qmf_imag; |
679 | 296k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
680 | 222k | p_qmf_re = p_qmf_real; |
681 | 222k | p_qmf_im = p_qmf_imag; |
682 | | |
683 | 6.80M | for (n = 0; n < nr_samples; n++) { |
684 | 6.58M | hyb_state->buffer_lf_real[k][n + nr_samples_shift_lf] = *p_qmf_re; |
685 | 6.58M | hyb_state->buffer_lf_imag[k][n + nr_samples_shift_lf] = *p_qmf_im; |
686 | | |
687 | 6.58M | hyb_state->qmf_lf_imag[k][n + nr_samples_shift_lf] = *p_qmf_im; |
688 | 6.58M | hyb_state->qmf_lf_real[k][n + nr_samples_shift_lf] = *p_qmf_re; |
689 | | |
690 | 6.58M | p_qmf_re += MAX_HYBRID_BANDS; |
691 | 6.58M | p_qmf_im += MAX_HYBRID_BANDS; |
692 | 6.58M | } |
693 | | |
694 | 222k | p_qmf_real++; |
695 | 222k | p_qmf_imag++; |
696 | 222k | } |
697 | | |
698 | 74.1k | p_qmf_real = m_qmf_real + nr_qmf_bands_lf + val_xhb; |
699 | 74.1k | p_qmf_imag = m_qmf_imag + nr_qmf_bands_lf + val_xhb; |
700 | | |
701 | 519k | for (n = 0; n < proto_len; n++) { |
702 | 445k | p_qmf_re = p_qmf_real; |
703 | 445k | p_qmf_im = p_qmf_imag; |
704 | | |
705 | 445k | p_hybrid_re = p_hybrid_real; |
706 | 445k | p_hybrid_im = p_hybrid_imag; |
707 | | |
708 | 22.0M | for (k = 0; k < loop_cnt; k++) { |
709 | 21.6M | *p_hybrid_re++ = hyb_state->buffer_hf_real[k][n]; |
710 | 21.6M | *p_hybrid_im++ = hyb_state->buffer_hf_imag[k][n]; |
711 | | |
712 | 21.6M | hyb_state->buffer_hf_real[k][n] = *p_qmf_re++; |
713 | 21.6M | hyb_state->buffer_hf_imag[k][n] = *p_qmf_im++; |
714 | 21.6M | } |
715 | 445k | p_qmf_real += MAX_HYBRID_BANDS; |
716 | 445k | p_qmf_imag += MAX_HYBRID_BANDS; |
717 | | |
718 | 445k | p_hybrid_real += MAX_HYBRID_BANDS; |
719 | 445k | p_hybrid_imag += MAX_HYBRID_BANDS; |
720 | 445k | } |
721 | | |
722 | 74.1k | p_qmf_real = m_qmf_real; |
723 | 74.1k | p_qmf_imag = m_qmf_imag; |
724 | | |
725 | 74.1k | p_hybrid_real = m_hybrid_real + 10; |
726 | 74.1k | p_hybrid_imag = m_hybrid_imag + 10; |
727 | | |
728 | 74.1k | k = proto_len * MAX_HYBRID_BANDS; |
729 | | |
730 | 74.1k | p_hybrid_re = p_hybrid_real + k; |
731 | 74.1k | p_hybrid_im = p_hybrid_imag + k; |
732 | | |
733 | 74.1k | p_qmf_re = p_qmf_real + nr_qmf_bands_lf; |
734 | 74.1k | p_qmf_im = p_qmf_imag + nr_qmf_bands_lf; |
735 | | |
736 | 1.82M | for (n = 0; n < val; n++) { |
737 | 1.74M | memcpy(p_hybrid_re, p_qmf_re, loop_cnt_x4); |
738 | 1.74M | memcpy(p_hybrid_im, p_qmf_im, loop_cnt_x4); |
739 | | |
740 | 1.74M | p_qmf_re += MAX_HYBRID_BANDS; |
741 | 1.74M | p_qmf_im += MAX_HYBRID_BANDS; |
742 | | |
743 | 1.74M | p_hybrid_re += MAX_HYBRID_BANDS; |
744 | 1.74M | p_hybrid_im += MAX_HYBRID_BANDS; |
745 | 1.74M | } |
746 | | |
747 | 74.1k | p_hybrid_real = m_hybrid_real; |
748 | 74.1k | p_hybrid_imag = m_hybrid_imag; |
749 | | |
750 | 2.26M | for (time_slot = 0; time_slot < nr_samples; time_slot++) { |
751 | 2.19M | p_hybrid_re = p_hybrid_real; |
752 | 2.19M | p_hybrid_im = p_hybrid_imag; |
753 | | |
754 | 2.19M | ixheaacd_8ch_filtering( |
755 | 2.19M | &(hyb_state->buffer_lf_real[0][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
756 | 2.19M | &(hyb_state->buffer_lf_imag[0][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
757 | 2.19M | m_temp_output_real, m_temp_output_imag, hyb_tab_ptr); |
758 | | |
759 | 2.19M | *p_hybrid_re++ = m_temp_output_real[6]; |
760 | 2.19M | *p_hybrid_re++ = m_temp_output_real[7]; |
761 | 2.19M | *p_hybrid_re++ = m_temp_output_real[0]; |
762 | 2.19M | *p_hybrid_re++ = m_temp_output_real[1]; |
763 | 2.19M | *p_hybrid_re++ = (m_temp_output_real[2] + m_temp_output_real[5]); |
764 | 2.19M | *p_hybrid_re++ = (m_temp_output_real[3] + m_temp_output_real[4]); |
765 | | |
766 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[6]; |
767 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[7]; |
768 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[0]; |
769 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[1]; |
770 | 2.19M | *p_hybrid_im++ = (m_temp_output_imag[2] + m_temp_output_imag[5]); |
771 | 2.19M | *p_hybrid_im++ = (m_temp_output_imag[3] + m_temp_output_imag[4]); |
772 | | |
773 | 2.19M | ixheaacd_2ch_filtering( |
774 | 2.19M | &(hyb_state->buffer_lf_real[1][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
775 | 2.19M | m_temp_output_real, hyb_tab_ptr); |
776 | | |
777 | 2.19M | ixheaacd_2ch_filtering( |
778 | 2.19M | &(hyb_state->buffer_lf_imag[1][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
779 | 2.19M | m_temp_output_imag, hyb_tab_ptr); |
780 | | |
781 | 2.19M | *p_hybrid_re++ = m_temp_output_real[1]; |
782 | 2.19M | *p_hybrid_re++ = m_temp_output_real[0]; |
783 | | |
784 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[1]; |
785 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[0]; |
786 | | |
787 | 2.19M | ixheaacd_2ch_filtering( |
788 | 2.19M | &(hyb_state->buffer_lf_real[2][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
789 | 2.19M | m_temp_output_real, hyb_tab_ptr); |
790 | | |
791 | 2.19M | ixheaacd_2ch_filtering( |
792 | 2.19M | &(hyb_state->buffer_lf_imag[2][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
793 | 2.19M | m_temp_output_imag, hyb_tab_ptr); |
794 | | |
795 | 2.19M | *p_hybrid_re++ = m_temp_output_real[0]; |
796 | 2.19M | *p_hybrid_re++ = m_temp_output_real[1]; |
797 | | |
798 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[0]; |
799 | 2.19M | *p_hybrid_im++ = m_temp_output_imag[1]; |
800 | | |
801 | 2.19M | p_hybrid_real += MAX_HYBRID_BANDS; |
802 | 2.19M | p_hybrid_imag += MAX_HYBRID_BANDS; |
803 | 2.19M | } |
804 | | |
805 | 74.1k | p_qmf_real = m_qmf_real; |
806 | 74.1k | p_qmf_imag = m_qmf_imag; |
807 | 296k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
808 | 222k | p_qmf_re = p_qmf_real; |
809 | 222k | p_qmf_im = p_qmf_imag; |
810 | 222k | for (n = MAX_TIME_SLOTS; n < nr_samples_shift_lf; n++) { |
811 | 0 | hyb_state->buffer_lf_real[k][n] = hyb_state->qmf_lf_real[k][n]; |
812 | 0 | hyb_state->buffer_lf_imag[k][n] = hyb_state->qmf_lf_imag[k][n]; |
813 | 0 | } |
814 | 6.80M | for (n = 0; n < nr_samples; n++) { |
815 | 6.58M | hyb_state->buffer_lf_real[k][n + nr_samples_shift_lf] = *p_qmf_re; |
816 | 6.58M | hyb_state->buffer_lf_imag[k][n + nr_samples_shift_lf] = *p_qmf_im; |
817 | | |
818 | 6.58M | p_qmf_re += MAX_HYBRID_BANDS; |
819 | 6.58M | p_qmf_im += MAX_HYBRID_BANDS; |
820 | 6.58M | } |
821 | 222k | p_qmf_real++; |
822 | 222k | p_qmf_imag++; |
823 | 222k | } |
824 | 74.1k | } |
825 | | |
826 | | ATTR_NO_SANITIZE_INTEGER |
827 | | VOID ixheaacd_apply_ana_hyb_filt_bank_merge_res_decor( |
828 | | ia_mps_dec_thyb_filter_state_struct *hyb_state, WORD32 *m_qmf_real, WORD32 *m_qmf_imag, |
829 | | WORD32 nr_bands, WORD32 nr_samples, WORD32 *m_hybrid_real, WORD32 *m_hybrid_imag, |
830 | 496 | const ia_mps_dec_hybrid_tables_struct *hyb_tab_ptr) { |
831 | 496 | WORD32 nr_samples_shift_lf; |
832 | 496 | WORD32 nr_qmf_bands_lf; |
833 | 496 | WORD32 k, n; |
834 | 496 | WORD32 time_slot; |
835 | | |
836 | 496 | WORD32 m_temp_output_real[MAX_HYBRID_ONLY_BANDS_PER_QMF]; |
837 | 496 | WORD32 m_temp_output_imag[MAX_HYBRID_ONLY_BANDS_PER_QMF]; |
838 | | |
839 | 496 | WORD32 proto_len = (PROTO_LEN - 1) >> 1; |
840 | 496 | WORD32 val = nr_samples - proto_len; |
841 | 496 | WORD32 loop_cnt; |
842 | | |
843 | 496 | WORD32 *p_qmf_real = m_qmf_real; |
844 | 496 | WORD32 *p_qmf_imag = m_qmf_imag; |
845 | | |
846 | 496 | WORD32 *p_hybrid_real = m_hybrid_real + 10; |
847 | 496 | WORD32 *p_hybrid_imag = m_hybrid_imag + 10; |
848 | 496 | WORD32 *p_buffer_lf_real, *p_buffer_lf_imag; |
849 | | |
850 | 496 | WORD32 nr_samples_x4 = nr_samples << 2; |
851 | | |
852 | 496 | nr_samples_shift_lf = BUFFER_LEN_LF - nr_samples; |
853 | | |
854 | 496 | nr_qmf_bands_lf = QMF_BANDS_TO_HYBRID; |
855 | 496 | loop_cnt = nr_bands - nr_qmf_bands_lf; |
856 | | |
857 | 1.98k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
858 | 89.6k | for (n = 0; n < nr_samples_shift_lf; n++) { |
859 | 88.2k | hyb_state->buffer_lf_real[k][n] = hyb_state->buffer_lf_real[k][n + nr_samples]; |
860 | 88.2k | hyb_state->buffer_lf_imag[k][n] = hyb_state->buffer_lf_imag[k][n + nr_samples]; |
861 | | |
862 | 88.2k | hyb_state->qmf_lf_real[k][n] = hyb_state->qmf_lf_real[k][n + nr_samples]; |
863 | 88.2k | hyb_state->qmf_lf_imag[k][n] = hyb_state->qmf_lf_imag[k][n + nr_samples]; |
864 | 88.2k | } |
865 | 1.48k | } |
866 | 1.98k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
867 | 1.48k | WORD32 *qmf_real = p_qmf_real; |
868 | 1.48k | WORD32 *qmf_imag = p_qmf_imag; |
869 | 38.2k | for (n = 0; n < nr_samples; n++) { |
870 | 36.7k | hyb_state->buffer_lf_real[k][n + nr_samples_shift_lf] = *qmf_real; |
871 | 36.7k | hyb_state->buffer_lf_imag[k][n + nr_samples_shift_lf] = *qmf_imag; |
872 | | |
873 | 36.7k | hyb_state->qmf_lf_imag[k][n + nr_samples_shift_lf] = *qmf_imag++; |
874 | 36.7k | hyb_state->qmf_lf_real[k][n + nr_samples_shift_lf] = *qmf_real++; |
875 | 36.7k | } |
876 | 1.48k | p_qmf_real += MAX_TIME_SLOTS; |
877 | 1.48k | p_qmf_imag += MAX_TIME_SLOTS; |
878 | 1.48k | } |
879 | | |
880 | 496 | p_qmf_real = m_qmf_real + nr_qmf_bands_lf * MAX_TIME_SLOTS; |
881 | 496 | p_qmf_imag = m_qmf_imag + nr_qmf_bands_lf * MAX_TIME_SLOTS; |
882 | | |
883 | 14.8k | for (k = 0; k < loop_cnt; k++) { |
884 | 14.3k | WORD32 *qmf_real = p_qmf_real + val; |
885 | 14.3k | WORD32 *qmf_imag = p_qmf_imag + val; |
886 | | |
887 | 14.3k | WORD32 *hybrid_real = p_hybrid_real; |
888 | 14.3k | WORD32 *hybrid_imag = p_hybrid_imag; |
889 | | |
890 | 100k | for (n = 0; n < proto_len; n++) { |
891 | 86.3k | *hybrid_real = hyb_state->buffer_hf_real[k][n]; |
892 | 86.3k | *hybrid_imag = hyb_state->buffer_hf_imag[k][n]; |
893 | | |
894 | 86.3k | hyb_state->buffer_hf_real[k][n] = *qmf_real++; |
895 | 86.3k | hyb_state->buffer_hf_imag[k][n] = *qmf_imag++; |
896 | | |
897 | 86.3k | hybrid_real += MAX_HYBRID_BANDS; |
898 | 86.3k | hybrid_imag += MAX_HYBRID_BANDS; |
899 | 86.3k | } |
900 | | |
901 | 14.3k | p_qmf_real += MAX_TIME_SLOTS; |
902 | 14.3k | p_qmf_imag += MAX_TIME_SLOTS; |
903 | | |
904 | 14.3k | p_hybrid_real++; |
905 | 14.3k | p_hybrid_imag++; |
906 | 14.3k | } |
907 | | |
908 | 496 | p_qmf_real = m_qmf_real + NR_QMF_BANDS_LFXTS; |
909 | 496 | p_qmf_imag = m_qmf_imag + NR_QMF_BANDS_LFXTS; |
910 | | |
911 | 496 | p_hybrid_real = m_hybrid_real + 10; |
912 | 496 | p_hybrid_imag = m_hybrid_imag + 10; |
913 | | |
914 | 14.8k | for (k = 0; k < loop_cnt; k++) { |
915 | 14.3k | WORD32 *qmf_real = p_qmf_real; |
916 | 14.3k | WORD32 *qmf_imag = p_qmf_imag; |
917 | | |
918 | 14.3k | WORD32 *hybrid_real = p_hybrid_real + proto_len * MAX_HYBRID_BANDS; |
919 | 14.3k | WORD32 *hybrid_imag = p_hybrid_imag + proto_len * MAX_HYBRID_BANDS; |
920 | | |
921 | 283k | for (n = 0; n < val; n++) { |
922 | 269k | *hybrid_real = *qmf_real++; |
923 | 269k | *hybrid_imag = *qmf_imag++; |
924 | | |
925 | 269k | hybrid_real += MAX_HYBRID_BANDS; |
926 | 269k | hybrid_imag += MAX_HYBRID_BANDS; |
927 | 269k | } |
928 | | |
929 | 14.3k | p_qmf_real += MAX_TIME_SLOTS; |
930 | 14.3k | p_qmf_imag += MAX_TIME_SLOTS; |
931 | | |
932 | 14.3k | p_hybrid_real++; |
933 | 14.3k | p_hybrid_imag++; |
934 | 14.3k | } |
935 | | |
936 | 496 | p_hybrid_real = m_hybrid_real; |
937 | 496 | p_hybrid_imag = m_hybrid_imag; |
938 | | |
939 | 12.7k | for (time_slot = 0; time_slot < nr_samples; time_slot++) { |
940 | 12.2k | WORD32 *hybrid_real = p_hybrid_real; |
941 | 12.2k | WORD32 *hybrid_imag = p_hybrid_imag; |
942 | | |
943 | 12.2k | ixheaacd_8ch_filtering( |
944 | 12.2k | &(hyb_state->buffer_lf_real[0][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
945 | 12.2k | &(hyb_state->buffer_lf_imag[0][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
946 | 12.2k | m_temp_output_real, m_temp_output_imag, hyb_tab_ptr); |
947 | | |
948 | 12.2k | *hybrid_real++ = m_temp_output_real[6]; |
949 | 12.2k | *hybrid_real++ = m_temp_output_real[7]; |
950 | 12.2k | *hybrid_real++ = m_temp_output_real[0]; |
951 | 12.2k | *hybrid_real++ = m_temp_output_real[1]; |
952 | 12.2k | *hybrid_imag++ = (m_temp_output_imag[2] + m_temp_output_imag[5]); |
953 | 12.2k | *hybrid_real++ = (m_temp_output_real[3] + m_temp_output_real[4]); |
954 | | |
955 | 12.2k | *hybrid_imag++ = m_temp_output_imag[6]; |
956 | 12.2k | *hybrid_imag++ = m_temp_output_imag[7]; |
957 | 12.2k | *hybrid_imag++ = m_temp_output_imag[0]; |
958 | 12.2k | *hybrid_imag++ = m_temp_output_imag[1]; |
959 | 12.2k | *hybrid_real++ = (m_temp_output_real[2] + m_temp_output_real[5]); |
960 | 12.2k | *hybrid_imag++ = (m_temp_output_imag[3] + m_temp_output_imag[4]); |
961 | | |
962 | 12.2k | ixheaacd_2ch_filtering( |
963 | 12.2k | &(hyb_state->buffer_lf_real[1][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
964 | 12.2k | m_temp_output_real, hyb_tab_ptr); |
965 | | |
966 | 12.2k | ixheaacd_2ch_filtering( |
967 | 12.2k | &(hyb_state->buffer_lf_imag[1][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
968 | 12.2k | m_temp_output_imag, hyb_tab_ptr); |
969 | | |
970 | 12.2k | *hybrid_real++ = m_temp_output_real[1]; |
971 | 12.2k | *hybrid_real++ = m_temp_output_real[0]; |
972 | | |
973 | 12.2k | *hybrid_imag++ = m_temp_output_imag[0]; |
974 | 12.2k | *hybrid_imag++ = m_temp_output_imag[1]; |
975 | | |
976 | 12.2k | ixheaacd_2ch_filtering( |
977 | 12.2k | &(hyb_state->buffer_lf_real[2][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
978 | 12.2k | m_temp_output_real, hyb_tab_ptr); |
979 | | |
980 | 12.2k | ixheaacd_2ch_filtering( |
981 | 12.2k | &(hyb_state->buffer_lf_imag[2][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
982 | 12.2k | m_temp_output_imag, hyb_tab_ptr); |
983 | | |
984 | 12.2k | *hybrid_real++ = m_temp_output_real[0]; |
985 | 12.2k | *hybrid_real++ = m_temp_output_real[1]; |
986 | | |
987 | 12.2k | *hybrid_imag++ = m_temp_output_imag[0]; |
988 | 12.2k | *hybrid_imag++ = m_temp_output_imag[1]; |
989 | | |
990 | 12.2k | p_hybrid_real += MAX_HYBRID_BANDS; |
991 | 12.2k | p_hybrid_imag += MAX_HYBRID_BANDS; |
992 | 12.2k | } |
993 | | |
994 | 496 | p_qmf_real = m_qmf_real; |
995 | 496 | p_qmf_imag = m_qmf_imag; |
996 | | |
997 | 496 | p_buffer_lf_real = &hyb_state->buffer_lf_real[0][nr_samples_shift_lf]; |
998 | 496 | p_buffer_lf_imag = &hyb_state->buffer_lf_imag[0][nr_samples_shift_lf]; |
999 | | |
1000 | 1.98k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
1001 | 1.48k | for (n = MAX_TIME_SLOTS; n < nr_samples_shift_lf; n++) { |
1002 | 0 | hyb_state->buffer_lf_real[k][n] = hyb_state->qmf_lf_real[k][n]; |
1003 | 0 | hyb_state->buffer_lf_imag[k][n] = hyb_state->qmf_lf_imag[k][n]; |
1004 | 0 | } |
1005 | 1.48k | { |
1006 | 1.48k | memcpy(p_buffer_lf_real, p_qmf_real, nr_samples_x4); |
1007 | 1.48k | memcpy(p_buffer_lf_imag, p_qmf_imag, nr_samples_x4); |
1008 | 1.48k | } |
1009 | 1.48k | p_qmf_real += MAX_TIME_SLOTS; |
1010 | 1.48k | p_qmf_imag += MAX_TIME_SLOTS; |
1011 | | |
1012 | 1.48k | p_buffer_lf_real += BUFFER_LEN_LF; |
1013 | 1.48k | p_buffer_lf_imag += BUFFER_LEN_LF; |
1014 | 1.48k | } |
1015 | 496 | } |
1016 | | |
1017 | | VOID ixheaacd_apply_ana_hyb_filt_bank_create_x_res( |
1018 | | ia_mps_dec_thyb_filter_state_struct *hyb_state, WORD32 *m_qmf_real, WORD32 *m_qmf_imag, |
1019 | | WORD32 nr_bands, WORD32 nr_samples, WORD32 *m_hybrid_real, WORD32 *m_hybrid_imag, |
1020 | | SIZE_T *indx, WORD32 res, WORD32 hyb_bands, WORD32 num_parameter_bands, WORD32 *counter, |
1021 | 306 | const ia_mps_dec_hybrid_tables_struct *hyb_tab_ptr) { |
1022 | 306 | WORD32 nr_samples_shift_lf; |
1023 | 306 | WORD32 nr_qmf_bands_lf; |
1024 | 306 | WORD32 k, n, qs; |
1025 | 306 | WORD32 time_slot, ch_off_set; |
1026 | 306 | SIZE_T *idx = indx; |
1027 | | |
1028 | 306 | WORD32 proto_len = (PROTO_LEN - 1) >> 1; |
1029 | 306 | WORD32 val = nr_samples - proto_len; |
1030 | | |
1031 | 306 | WORD32 *p_qmf_real = m_qmf_real; |
1032 | 306 | WORD32 *p_qmf_imag = m_qmf_imag; |
1033 | 306 | WORD32 loop_cnt; |
1034 | | |
1035 | 306 | WORD32 m_temp_output_real[MAX_HYBRID_ONLY_BANDS_PER_QMF]; |
1036 | 306 | WORD32 m_temp_output_imag[MAX_HYBRID_ONLY_BANDS_PER_QMF]; |
1037 | | |
1038 | 306 | WORD32 *p_hybrid_real = m_hybrid_real + 10; |
1039 | 306 | WORD32 *p_hybrid_imag = m_hybrid_imag + 10; |
1040 | | |
1041 | 306 | WORD32 *p_hybrid_re, *p_hybrid_im; |
1042 | | |
1043 | 306 | WORD32 *p_buffer_lf_real, *p_buffer_lf_imag; |
1044 | | |
1045 | 306 | WORD32 nr_samples_x4 = nr_samples << 2; |
1046 | | |
1047 | 306 | nr_samples_shift_lf = BUFFER_LEN_LF - nr_samples; |
1048 | | |
1049 | 306 | nr_qmf_bands_lf = QMF_BANDS_TO_HYBRID; |
1050 | 306 | loop_cnt = nr_bands - nr_qmf_bands_lf; |
1051 | 306 | ch_off_set = 0; |
1052 | | |
1053 | 1.22k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
1054 | 58.0k | for (n = 0; n < nr_samples_shift_lf; n++) { |
1055 | 57.1k | hyb_state->buffer_lf_real[k][n] = hyb_state->buffer_lf_real[k][n + nr_samples]; |
1056 | 57.1k | hyb_state->buffer_lf_imag[k][n] = hyb_state->buffer_lf_imag[k][n + nr_samples]; |
1057 | | |
1058 | 57.1k | hyb_state->qmf_lf_real[k][n] = hyb_state->qmf_lf_real[k][n + nr_samples]; |
1059 | 57.1k | hyb_state->qmf_lf_imag[k][n] = hyb_state->qmf_lf_imag[k][n + nr_samples]; |
1060 | 57.1k | } |
1061 | 918 | } |
1062 | 1.22k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
1063 | 918 | WORD32 *qmf_real = p_qmf_real; |
1064 | 918 | WORD32 *qmf_imag = p_qmf_imag; |
1065 | | |
1066 | 20.9k | for (n = 0; n < nr_samples; n++) { |
1067 | 19.9k | hyb_state->buffer_lf_real[k][n + nr_samples_shift_lf] = *qmf_real; |
1068 | 19.9k | hyb_state->buffer_lf_imag[k][n + nr_samples_shift_lf] = *qmf_imag; |
1069 | | |
1070 | 19.9k | hyb_state->qmf_lf_imag[k][n + nr_samples_shift_lf] = *qmf_imag++; |
1071 | 19.9k | hyb_state->qmf_lf_real[k][n + nr_samples_shift_lf] = *qmf_real++; |
1072 | 19.9k | } |
1073 | 918 | p_qmf_real += MAX_TIME_SLOTS; |
1074 | 918 | p_qmf_imag += MAX_TIME_SLOTS; |
1075 | 918 | } |
1076 | | |
1077 | 306 | p_qmf_real = m_qmf_real + NR_QMF_BANDS_LFXTS; |
1078 | 306 | p_qmf_imag = m_qmf_imag + NR_QMF_BANDS_LFXTS; |
1079 | | |
1080 | 9.37k | for (k = 0; k < loop_cnt; k++) { |
1081 | 9.06k | WORD32 *qmf_real = p_qmf_real + val; |
1082 | 9.06k | WORD32 *qmf_imag = p_qmf_imag + val; |
1083 | | |
1084 | 9.06k | p_hybrid_re = p_hybrid_real; |
1085 | 9.06k | p_hybrid_im = p_hybrid_imag; |
1086 | | |
1087 | 63.4k | for (n = 0; n < proto_len; n++) { |
1088 | 54.3k | *p_hybrid_re = hyb_state->buffer_hf_real[k][n]; |
1089 | 54.3k | *p_hybrid_im = hyb_state->buffer_hf_imag[k][n]; |
1090 | | |
1091 | 54.3k | hyb_state->buffer_hf_real[k][n] = *qmf_real++; |
1092 | 54.3k | hyb_state->buffer_hf_imag[k][n] = *qmf_imag++; |
1093 | | |
1094 | 54.3k | p_hybrid_re += MAX_HYBRID_BANDS; |
1095 | 54.3k | p_hybrid_im += MAX_HYBRID_BANDS; |
1096 | 54.3k | } |
1097 | 9.06k | p_qmf_real += MAX_TIME_SLOTS; |
1098 | 9.06k | p_qmf_imag += MAX_TIME_SLOTS; |
1099 | | |
1100 | 9.06k | p_hybrid_real++; |
1101 | 9.06k | p_hybrid_imag++; |
1102 | 9.06k | } |
1103 | | |
1104 | 306 | p_qmf_real = m_qmf_real + NR_QMF_BANDS_LFXTS; |
1105 | 306 | p_qmf_imag = m_qmf_imag + NR_QMF_BANDS_LFXTS; |
1106 | | |
1107 | 306 | p_hybrid_real = m_hybrid_real + 10; |
1108 | 306 | p_hybrid_imag = m_hybrid_imag + 10; |
1109 | | |
1110 | 9.37k | for (k = 0; k < loop_cnt; k++) { |
1111 | 9.06k | WORD32 *qmf_real = p_qmf_real; |
1112 | 9.06k | WORD32 *qmf_imag = p_qmf_imag; |
1113 | | |
1114 | 9.06k | p_hybrid_re = p_hybrid_real + proto_len * MAX_HYBRID_BANDS; |
1115 | 9.06k | p_hybrid_im = p_hybrid_imag + proto_len * MAX_HYBRID_BANDS; |
1116 | | |
1117 | 150k | for (n = 0; n < val; n++) { |
1118 | 141k | *p_hybrid_re = *qmf_real++; |
1119 | 141k | *p_hybrid_im = *qmf_imag++; |
1120 | | |
1121 | 141k | p_hybrid_re += MAX_HYBRID_BANDS; |
1122 | 141k | p_hybrid_im += MAX_HYBRID_BANDS; |
1123 | 141k | } |
1124 | 9.06k | p_qmf_real += MAX_TIME_SLOTS; |
1125 | 9.06k | p_qmf_imag += MAX_TIME_SLOTS; |
1126 | | |
1127 | 9.06k | p_hybrid_real++; |
1128 | 9.06k | p_hybrid_imag++; |
1129 | 9.06k | } |
1130 | | |
1131 | 306 | if (res == 1 && (num_parameter_bands == 20 || num_parameter_bands == 28)) |
1132 | 62 | *counter = 3; |
1133 | 244 | else { |
1134 | 244 | idx = indx; |
1135 | 5.56k | for (qs = 0; qs < hyb_bands; qs++) { |
1136 | 5.31k | if (*idx++ >= (SIZE_T)res) { |
1137 | 201 | *counter = qs; |
1138 | 201 | qs = hyb_bands; |
1139 | 201 | } |
1140 | 5.31k | } |
1141 | 244 | } |
1142 | | |
1143 | 306 | p_hybrid_real = m_hybrid_real; |
1144 | 306 | p_hybrid_imag = m_hybrid_imag; |
1145 | 6.97k | for (time_slot = 0; time_slot < nr_samples; time_slot++) { |
1146 | 6.66k | idx = indx; |
1147 | 6.66k | p_hybrid_re = p_hybrid_real; |
1148 | 6.66k | p_hybrid_im = p_hybrid_imag; |
1149 | | |
1150 | 6.66k | ixheaacd_8ch_filtering( |
1151 | 6.66k | &(hyb_state->buffer_lf_real[0][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
1152 | 6.66k | &(hyb_state->buffer_lf_imag[0][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
1153 | 6.66k | m_temp_output_real, m_temp_output_imag, hyb_tab_ptr); |
1154 | | |
1155 | 6.66k | *p_hybrid_re++ = m_temp_output_real[6]; |
1156 | 6.66k | *p_hybrid_re++ = m_temp_output_real[7]; |
1157 | 6.66k | *p_hybrid_re++ = m_temp_output_real[0]; |
1158 | | |
1159 | 6.66k | *p_hybrid_re++ = m_temp_output_real[1]; |
1160 | | |
1161 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[6]; |
1162 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[7]; |
1163 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[0]; |
1164 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[1]; |
1165 | | |
1166 | 6.66k | if (*counter > 4) { |
1167 | 4.28k | *p_hybrid_re++ = (m_temp_output_real[2] + m_temp_output_real[5]); |
1168 | 4.28k | *p_hybrid_im++ = (m_temp_output_imag[2] + m_temp_output_imag[5]); |
1169 | 4.28k | } |
1170 | | |
1171 | 6.66k | if (*counter > 5) { |
1172 | 3.59k | *p_hybrid_re++ = (m_temp_output_real[3] + m_temp_output_real[4]); |
1173 | 3.59k | *p_hybrid_im++ = (m_temp_output_imag[3] + m_temp_output_imag[4]); |
1174 | 3.59k | } |
1175 | | |
1176 | 6.66k | ch_off_set = 6; |
1177 | 6.66k | p_hybrid_re = p_hybrid_real + ch_off_set; |
1178 | 6.66k | p_hybrid_im = p_hybrid_imag + ch_off_set; |
1179 | | |
1180 | 6.66k | ixheaacd_2ch_filtering( |
1181 | 6.66k | &(hyb_state->buffer_lf_real[1][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
1182 | 6.66k | m_temp_output_real, hyb_tab_ptr); |
1183 | | |
1184 | 6.66k | ixheaacd_2ch_filtering( |
1185 | 6.66k | &(hyb_state->buffer_lf_imag[1][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
1186 | 6.66k | m_temp_output_imag, hyb_tab_ptr); |
1187 | | |
1188 | 6.66k | *p_hybrid_re++ = m_temp_output_real[1]; |
1189 | 6.66k | *p_hybrid_re++ = m_temp_output_real[0]; |
1190 | | |
1191 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[1]; |
1192 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[0]; |
1193 | | |
1194 | 6.66k | ixheaacd_2ch_filtering( |
1195 | 6.66k | &(hyb_state->buffer_lf_real[2][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
1196 | 6.66k | m_temp_output_real, hyb_tab_ptr); |
1197 | | |
1198 | 6.66k | ixheaacd_2ch_filtering( |
1199 | 6.66k | &(hyb_state->buffer_lf_imag[2][time_slot + nr_samples_shift_lf + 1 - PROTO_LEN]), |
1200 | 6.66k | m_temp_output_imag, hyb_tab_ptr); |
1201 | | |
1202 | 6.66k | *p_hybrid_re++ = m_temp_output_real[0]; |
1203 | 6.66k | *p_hybrid_re++ = m_temp_output_real[1]; |
1204 | | |
1205 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[0]; |
1206 | 6.66k | *p_hybrid_im++ = m_temp_output_imag[1]; |
1207 | | |
1208 | 6.66k | p_hybrid_real += MAX_HYBRID_BANDS; |
1209 | 6.66k | p_hybrid_imag += MAX_HYBRID_BANDS; |
1210 | 6.66k | } |
1211 | 306 | p_qmf_real = m_qmf_real; |
1212 | 306 | p_qmf_imag = m_qmf_imag; |
1213 | | |
1214 | 306 | p_buffer_lf_real = &hyb_state->buffer_lf_real[0][nr_samples_shift_lf]; |
1215 | 306 | p_buffer_lf_imag = &hyb_state->buffer_lf_imag[0][nr_samples_shift_lf]; |
1216 | | |
1217 | 1.22k | for (k = 0; k < nr_qmf_bands_lf; k++) { |
1218 | 918 | for (n = MAX_TIME_SLOTS; n < nr_samples_shift_lf; n++) { |
1219 | 0 | hyb_state->buffer_lf_real[k][n] = hyb_state->qmf_lf_real[k][n]; |
1220 | 0 | hyb_state->buffer_lf_imag[k][n] = hyb_state->qmf_lf_imag[k][n]; |
1221 | 0 | } |
1222 | 918 | { |
1223 | 918 | memcpy(p_buffer_lf_real, p_qmf_real, nr_samples_x4); |
1224 | 918 | memcpy(p_buffer_lf_imag, p_qmf_imag, nr_samples_x4); |
1225 | 918 | } |
1226 | 918 | p_qmf_real += MAX_TIME_SLOTS; |
1227 | 918 | p_qmf_imag += MAX_TIME_SLOTS; |
1228 | | |
1229 | 918 | p_buffer_lf_real += BUFFER_LEN_LF; |
1230 | 918 | p_buffer_lf_imag += BUFFER_LEN_LF; |
1231 | 918 | } |
1232 | 306 | } |