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 "ixheaacd_sbr_common.h"
22 #include "ixheaac_type_def.h"
23
24 #include "ixheaac_constants.h"
25 #include "ixheaac_basic_ops32.h"
26 #include "ixheaac_basic_ops16.h"
27 #include "ixheaac_basic_ops40.h"
28 #include "ixheaac_basic_ops.h"
29 #include "ixheaacd_bitbuffer.h"
30
31 #include "ixheaac_basic_op.h"
32 #include "ixheaacd_intrinsics.h"
33
34 #include "ixheaacd_defines.h"
35
36 #include "ixheaacd_aac_rom.h"
37
38 #include "ixheaacd_definitions.h"
39
40 #include "ixheaacd_error_codes.h"
41
42 #include "ixheaacd_pulsedata.h"
43
44 #include "ixheaacd_pns.h"
45 #include "ixheaacd_drc_data_struct.h"
46
47 #include "ixheaacd_lt_predict.h"
48 #include "ixheaacd_cnst.h"
49 #include "ixheaacd_ec_defines.h"
50 #include "ixheaacd_ec_struct_def.h"
51 #include "ixheaacd_channelinfo.h"
52 #include "ixheaacd_drc_dec.h"
53
54 #include "ixheaacd_sbrdecoder.h"
55
56 #include "ixheaacd_block.h"
57 #include "ixheaacd_channel.h"
58
59 #include "ixheaacd_sbr_payload.h"
60 #include "ixheaacd_common_rom.h"
61 #include "ixheaacd_sbrdecsettings.h"
62 #include "ixheaacd_sbr_scale.h"
63 #include "ixheaacd_env_extr_part.h"
64 #include "ixheaacd_sbr_rom.h"
65
66 #include "ixheaacd_lpp_tran.h"
67 #include "ixheaacd_hybrid.h"
68 #include "ixheaacd_ps_dec.h"
69
70 #include "ixheaacd_env_extr.h"
71 #include "ixheaacd_adts.h"
72 #include "ixheaacd_audioobjtypes.h"
73 #include "ixheaacd_memory_standards.h"
74
75 #include "ixheaacd_latmdemux.h"
76
77 #include "ixheaacd_qmf_dec.h"
78 #include "ixheaacd_aacdec.h"
79 #include "ixheaacd_mps_polyphase.h"
80 #include "ixheaacd_config.h"
81 #include "ixheaacd_mps_macro_def.h"
82 #include "ixheaacd_mps_struct_def.h"
83 #include "ixheaacd_mps_res_rom.h"
84 #include "ixheaacd_mps_aac_struct.h"
85 #include "ixheaacd_mps_dec.h"
86 #include "ixheaacd_struct_def.h"
87
88 #include "ixheaacd_tns.h"
89 #include "ixheaacd_aac_imdct.h"
90
91 #include "ixheaacd_multichannel.h"
92 #include "ixheaacd_function_selector.h"
93
ixheaacd_process_win_seq(WORD32 * coef,WORD32 * prev,WORD32 * out,const WORD16 * window_long,const WORD16 * window_short,WORD16 q_shift,WORD16 ch_fac,WORD16 flag,WORD16 size_01)94 VOID ixheaacd_process_win_seq(WORD32 *coef, WORD32 *prev, WORD32 *out,
95 const WORD16 *window_long,
96 const WORD16 *window_short, WORD16 q_shift,
97 WORD16 ch_fac, WORD16 flag, WORD16 size_01) {
98 WORD32 i, accu;
99 WORD32 *coef_1;
100 const WORD16 *temp_win_sh, *temp_win_long;
101 WORD32 *out1, *out2;
102 WORD32 *temp_prev;
103
104 WORD16 size_07 = 7 * size_01;
105 WORD16 size_08 = 8 * size_01;
106 WORD16 size_09 = 9 * size_01;
107 WORD16 size_14 = 14 * size_01;
108 WORD16 size_15 = 15 * size_01;
109
110 if (flag == 1) {
111 for (i = 0; i < size_07; i++) {
112 WORD32 temp1 = ixheaac_shl32_dir_sat_limit(
113 ixheaac_mult32x16in32(coef[size_08 + i], window_long[2 * i]),
114 (q_shift + 1));
115
116 accu = ixheaac_add32_sat(temp1, ((WORD32)prev[i] << 16));
117 out[ch_fac * i] = accu;
118
119 accu = ixheaac_shl32_dir_sat_limit(
120 ixheaac_mult32x16in32(-(coef[size_15 - 1 - i]),
121 window_long[2 * (size_07 - i) - 1]),
122 q_shift);
123 out[ch_fac * (i + size_09)] = (accu << 1);
124 }
125
126 temp_win_sh = &(window_short[0]);
127 coef_1 = &(coef[size_15]);
128 temp_win_long = &(window_long[size_14]);
129 temp_prev = &(prev[size_08 - 1]);
130 out1 = &(out[ch_fac * (size_07)]);
131 out2 = &(out[ch_fac * (size_09 - 1)]);
132
133 } else {
134 for (i = 0; i < size_07; i++) {
135 accu = ixheaac_mult32x16in32_sat(
136 prev[size_08 - 1 - i], ixheaac_negate16(window_long[2 * i + 1]));
137
138 out[ch_fac * i] = accu;
139
140 accu = ixheaac_sub32_sat(
141 ixheaac_shl32_dir_sat_limit(-(coef[size_15 - 1 - i]), (q_shift - 1)),
142 ixheaac_mult32x16in32_sat(prev[i + size_01],
143 window_long[2 * size_07 - 2 - 2 * i]));
144
145 out[ch_fac * (size_09 + i)] = accu;
146 }
147
148 temp_win_sh = &(window_long[size_14]);
149 coef_1 = &(coef[size_15]);
150 temp_win_long = &(window_short[0]);
151 temp_prev = &(prev[size_01 - 1]);
152 out1 = &(out[ch_fac * (size_07)]);
153 out2 = &(out[ch_fac * (size_09 - 1)]);
154 }
155
156 for (i = size_01 - 1; i >= 0; i--) {
157 WORD32 temp_coef = *coef_1++;
158 WORD16 win1 = *temp_win_long++;
159 WORD16 win2 = *temp_win_long++;
160 WORD32 prev1 = *temp_prev--;
161 WORD16 win4 = *temp_win_sh++;
162 WORD16 win3 = *temp_win_sh++;
163 accu = ixheaac_sub32_sat(
164 ixheaac_shl32_dir_sat_limit(ixheaac_mult32x16in32(temp_coef, win1),
165 q_shift),
166 ixheaac_mult32x16in32_sat(prev1, win3));
167 *out1 = accu << flag;
168 out1 += ch_fac;
169
170 accu = ixheaac_sub32_sat(
171 ixheaac_shl32_dir_sat_limit(
172 ixheaac_mult32x16in32(ixheaac_negate32_sat(temp_coef), win2),
173 q_shift),
174 ixheaac_mult32x16in32_sat(prev1, win4));
175 *out2 = accu << flag;
176 out2 -= ch_fac;
177 }
178 }
179
ixheaacd_long_short_win_process(WORD32 * current,WORD32 * prev,WORD32 * out,const WORD16 * short_window,const WORD16 * long_window_prev,WORD16 q_shift,WORD16 ch_fac,WORD32 flag,WORD16 size_01)180 static PLATFORM_INLINE VOID ixheaacd_long_short_win_process(
181 WORD32 *current, WORD32 *prev, WORD32 *out, const WORD16 *short_window,
182 const WORD16 *long_window_prev, WORD16 q_shift, WORD16 ch_fac,
183 WORD32 flag, WORD16 size_01) {
184
185 WORD16 size_02 = 2 * size_01;
186 WORD16 size_03 = 3 * size_01;
187 WORD i;
188 WORD32 accu;
189 WORD32 *current_tmp1 = &(current[(size_03 - 1)]);
190 WORD32 *current_tmp2 = &(current[-size_01]);
191 const WORD16 *short_ptr = &(short_window[size_02 - 1]);
192
193 for (i = size_01 - 1; i >= 0; i--) {
194 WORD32 tmp1_cur = *current_tmp1--;
195 WORD32 tmp2_cur = *current_tmp2++;
196 WORD16 short1 = *short_ptr--;
197 WORD16 short2 = *short_ptr--;
198 accu = ixheaac_sub32_sat(
199 ixheaac_shl32_dir_sat_limit((ixheaac_mult32x16in32(tmp1_cur, short2) -
200 ixheaac_mult32x16in32(tmp2_cur, short1)),
201 q_shift),
202 ixheaac_mult32x16in32_sat(prev[i], long_window_prev[0 - 2 - 2 * i]));
203 out[ch_fac * (0 + i)] = accu;
204
205 if (flag) {
206 accu = ixheaac_sub32_sat(
207 ixheaac_shl32_dir_sat_limit(
208 (ixheaac_mult32x16in32(ixheaac_negate32_sat(tmp1_cur), short1) -
209 ixheaac_mult32x16in32(tmp2_cur, short2)),
210 q_shift),
211 ixheaac_mult32x16in32_sat(prev[size_02 - 1 - i],
212 long_window_prev[-2 * size_02 + 2 * i]));
213 out[ch_fac * (size_02 - 1 - i)] = accu;
214 }
215 }
216 }
217
ixheaacd_long_short_win_seq(WORD32 * current,WORD32 * prev,WORD32 * out,const WORD16 * short_window,const WORD16 * short_window_prev,const WORD16 * long_window_prev,WORD16 q_shift,WORD16 ch_fac,WORD16 size_01)218 VOID ixheaacd_long_short_win_seq(WORD32 *current, WORD32 *prev, WORD32 *out,
219 const WORD16 *short_window,
220 const WORD16 *short_window_prev,
221 const WORD16 *long_window_prev, WORD16 q_shift,
222 WORD16 ch_fac, WORD16 size_01) {
223
224 WORD16 size_02 = 2 * size_01;
225 WORD16 size_06 = 6 * size_01;
226 WORD16 size_07 = 7 * size_01;
227 WORD16 size_08 = 8 * size_01;
228 WORD16 size_09 = 9 * size_01;
229 WORD16 size_10 = 10 * size_01;
230 WORD16 size_16 = 16 * size_01;
231
232 WORD32 i, flag;
233 WORD32 accu;
234 for (i = 0; i < size_07; i++) {
235 accu = ixheaac_mult32x16in32_sat(
236 prev[size_08 - 1 - i], ixheaac_negate16(long_window_prev[2 * i + 1]));
237 out[ch_fac * i] = accu;
238 }
239
240 for (i = 0; i < size_01; i++) {
241 accu = ixheaac_sub32_sat(
242 ixheaac_shl32_dir_sat_limit(
243 ixheaac_mult32x16in32(current[size_01 + i],
244 short_window_prev[2 * i]),
245 q_shift),
246 ixheaac_mult32x16in32_sat(prev[size_01 - 1 - i],
247 long_window_prev[2 * size_07 + 1 + 2 * i]));
248 out[ch_fac * (size_07 + i)] = accu;
249 }
250
251 for (i = 0; i < size_01; i++) {
252 accu = ixheaac_sub32_sat(
253 ixheaac_shl32_dir_sat_limit(
254 ixheaac_mult32x16in32(ixheaac_negate32_sat(current[size_02 - 1 - i]),
255 short_window_prev[size_02 - 2 * i - 1]),
256 q_shift),
257 ixheaac_mult32x16in32_sat(prev[i],
258 long_window_prev[size_16 - 2 - (2 * i)]));
259 out[ch_fac * (size_08 + i)] = accu;
260 }
261
262 flag = 1;
263 for (i = 0; i < 4; i++) {
264 WORD32 inc = i * size_02;
265
266 if (i == 3) {
267 flag = 0;
268 }
269
270 ixheaacd_long_short_win_process(¤t[size_01 + inc], &prev[size_01 + inc],
271 &out[ch_fac * (size_09 + inc)], short_window,
272 &long_window_prev[2 * (size_07 - inc)],
273 q_shift, ch_fac, flag, size_01);
274 }
275
276 for (i = 0; i < size_01; i++) {
277 accu = (ixheaac_mult32x16in32(-(current[size_10 - 1 - i]),
278 short_window[size_02 - 2 * i - 1]) -
279 ixheaac_mult32x16in32(current[size_06 + i],
280 short_window[size_02 - 2 * i - 2]));
281 prev[i] =
282 ixheaac_round16(ixheaac_shl32_dir_sat_limit(accu, (q_shift + 1)));
283 }
284 }
285
ixheaacd_nolap1_32(WORD32 * coef,WORD32 * out,WORD16 q_shift,WORD16 ch_fac,WORD16 size_01)286 VOID ixheaacd_nolap1_32(WORD32 *coef, WORD32 *out, WORD16 q_shift,
287 WORD16 ch_fac, WORD16 size_01) {
288 WORD16 size_07 = 7 * size_01;
289 WORD32 i;
290
291 for (i = 0; i < size_07; i++) {
292 out[ch_fac * i] = ixheaac_shr32_sat(
293 ixheaac_negate32_sat(coef[size_07 - 1 - i]), 16 - q_shift);
294 }
295 }
296
ixheaacd_neg_shift_spec_dec(WORD32 * coef,WORD32 * out,WORD16 q_shift,WORD16 ch_fac)297 VOID ixheaacd_neg_shift_spec_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift,
298 WORD16 ch_fac) {
299 WORD32 i;
300 for (i = 0; i < SIZE07; i++) {
301 out[ch_fac * i] = (ixheaac_shl32_dir_sat_limit(
302 ixheaac_negate32_sat(coef[SIZE07 - 1 - i]), q_shift));
303 }
304 }
305
ixheaacd_Nolap_dec(WORD32 * coef,WORD32 * out,WORD16 q_shift,WORD16 ch_fac,WORD16 size_01)306 VOID ixheaacd_Nolap_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift,
307 WORD16 ch_fac, WORD16 size_01) {
308 WORD16 size_07 = 7 * size_01;
309 WORD32 i;
310 for (i = 0; i < size_07; i++) {
311 out[ch_fac * i] = ixheaac_shl32_dir_sat_limit(
312 ixheaac_negate32_sat(coef[size_07 - 1 - i]), q_shift);
313 }
314 }
315
ixheaacd_spec_to_overlapbuf_dec(WORD32 * ptr_overlap_buf,WORD32 * ptr_spec_coeff,WORD32 q_shift,WORD32 size)316 VOID ixheaacd_spec_to_overlapbuf_dec(WORD32 *ptr_overlap_buf,
317 WORD32 *ptr_spec_coeff, WORD32 q_shift,
318 WORD32 size) {
319 WORD32 i;
320 for (i = 0; i < size; i++) {
321 ptr_overlap_buf[i] = ixheaac_shr32_sat(ptr_spec_coeff[i], 16 - q_shift);
322 }
323 }
324
ixheaacd_overlap_buf_out_dec(WORD32 * out_samples,WORD32 * ptr_overlap_buf,WORD32 size,const WORD16 ch_fac)325 VOID ixheaacd_overlap_buf_out_dec(WORD32 *out_samples, WORD32 *ptr_overlap_buf,
326 WORD32 size, const WORD16 ch_fac) {
327 WORD32 i;
328
329 for (i = 0; i < size; i++) {
330 out_samples[ch_fac * i] =
331 (ixheaac_shl32_sat((WORD16)ptr_overlap_buf[i], 15));
332 }
333 }
334
ixheaacd_overlap_out_copy_dec(WORD32 * out_samples,WORD32 * ptr_overlap_buf,WORD32 * ptr_overlap_buf1,const WORD16 ch_fac,WORD16 size_01)335 VOID ixheaacd_overlap_out_copy_dec(WORD32 *out_samples, WORD32 *ptr_overlap_buf,
336 WORD32 *ptr_overlap_buf1,
337 const WORD16 ch_fac, WORD16 size_01) {
338 WORD32 i;
339
340 for (i = 0; i < size_01; i++) {
341 out_samples[ch_fac * i] =
342 ixheaac_shl32_sat((WORD16)ptr_overlap_buf[i], 15);
343 ptr_overlap_buf[i] = ptr_overlap_buf1[i];
344 }
345 }
346
ixheaacd_imdct_process(ia_aac_dec_overlap_info * ptr_aac_dec_overlap_info,WORD32 * ptr_spec_coeff,ia_ics_info_struct * ptr_ics_info,VOID * out_samples,const WORD16 ch_fac,WORD32 * scratch,ia_aac_dec_tables_struct * ptr_aac_tables,WORD32 object_type,WORD32 ld_mps_present,WORD slot_element)347 VOID ixheaacd_imdct_process(ia_aac_dec_overlap_info *ptr_aac_dec_overlap_info,
348 WORD32 *ptr_spec_coeff,
349 ia_ics_info_struct *ptr_ics_info, VOID *out_samples,
350 const WORD16 ch_fac, WORD32 *scratch,
351 ia_aac_dec_tables_struct *ptr_aac_tables,
352 WORD32 object_type, WORD32 ld_mps_present,
353 WORD slot_element) {
354 WORD32 *ptr_overlap_buf;
355 const WORD16 *ptr_long_window;
356 const WORD16 *ptr_short_window;
357 WORD16 max_bin_long = ptr_ics_info->frame_length;
358 WORD16 size_01;
359 if (max_bin_long == 960)
360 size_01 = (max_bin_long / 16);
361 else
362 size_01 = (MAX_BINS_LONG / 16);
363 WORD16 size_02 = 2 * size_01;
364 WORD16 size_04 = 4 * size_01;
365 WORD16 size_06 = 6 * size_01;
366 WORD16 size_07 = 7 * size_01;
367 WORD16 size_08 = 8 * size_01;
368 WORD16 size_09 = 9 * size_01;
369 WORD16 size_10 = 10 * size_01;
370 WORD16 size_14 = 14 * size_01;
371 WORD16 size_15 = 15 * size_01;
372
373 ptr_overlap_buf = ptr_aac_dec_overlap_info->ptr_overlap_buf;
374 ptr_long_window =
375 ptr_aac_dec_overlap_info
376 ->ptr_long_window[(WORD32)ptr_aac_dec_overlap_info->window_shape];
377 ptr_short_window =
378 ptr_aac_dec_overlap_info
379 ->ptr_short_window[(WORD32)ptr_aac_dec_overlap_info->window_shape];
380
381 if (ptr_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
382 WORD16 q_shift;
383 WORD32 expo, imdct_scale;
384
385 if ((512 == ptr_ics_info->frame_length) ||
386 (480 == ptr_ics_info->frame_length)) {
387 ptr_ics_info->qshift_adj = -2;
388
389 if (512 == ptr_ics_info->frame_length) {
390 WORD32 *ld_cos_sin_ptr =
391 (WORD32 *)ptr_aac_tables->pstr_imdct_tables->cosine_array_1024;
392
393 ixheaacd_inverse_transform_512(
394 ptr_spec_coeff, scratch, &imdct_scale, ld_cos_sin_ptr,
395 ptr_aac_tables->pstr_imdct_tables, object_type);
396
397 } else {
398 ixheaacd_mdct_480_ld(ptr_spec_coeff, scratch, &imdct_scale, 0,
399 ptr_aac_tables->pstr_imdct_tables, object_type);
400 }
401
402 if (object_type == AOT_ER_AAC_ELD) {
403 int i, N = (ptr_ics_info->frame_length << 1);
404
405 for (i = 0; i < N / 2; i++) {
406 ptr_spec_coeff[i] = -ptr_spec_coeff[i + N];
407 ptr_spec_coeff[i + N + N / 2] = -ptr_spec_coeff[i + N / 2];
408 }
409 }
410 } else if (960 == ptr_ics_info->frame_length) {
411 ixheaacd_mdct_960(ptr_spec_coeff, scratch, &imdct_scale, 0,
412 ptr_aac_tables->pstr_imdct_tables);
413 } else {
414 expo = (*ixheaacd_calc_max_spectral_line)(ptr_spec_coeff, 1024) - 1;
415
416 expo = 8 - expo;
417
418 imdct_scale = ixheaacd_inverse_transform(
419 ptr_spec_coeff, scratch, ptr_aac_tables->pstr_imdct_tables, expo,
420 1024);
421 }
422
423 q_shift = (31 + imdct_scale) + (-1 - 16 - 9);
424
425 switch (ptr_ics_info->window_sequence) {
426 case ONLY_LONG_SEQUENCE:
427
428 switch (ptr_aac_dec_overlap_info->window_sequence) {
429 case ONLY_LONG_SEQUENCE:
430 case LONG_STOP_SEQUENCE:
431
432 if (1024 == ptr_ics_info->frame_length) {
433 ia_ics_info_struct *tmp_ptr_ics_info = ptr_ics_info;
434
435 (*ixheaacd_post_twid_overlap_add)(
436 (WORD32 *)out_samples, ptr_spec_coeff,
437 ptr_aac_tables->pstr_imdct_tables, 1024, ptr_overlap_buf,
438 q_shift, ptr_long_window, ch_fac);
439
440 ptr_ics_info->qshift_adj = 2;
441 ptr_ics_info = tmp_ptr_ics_info;
442 }
443
444 if (960 == ptr_ics_info->frame_length)
445 {
446 ixheaacd_over_lap_add1_dec(ptr_spec_coeff, ptr_overlap_buf,
447 (WORD32*)out_samples, ptr_long_window, q_shift,
448 480, ch_fac);
449
450 ixheaacd_spec_to_overlapbuf(ptr_overlap_buf, ptr_spec_coeff,
451 q_shift, 480);
452
453 ptr_ics_info->qshift_adj = 2;
454 }
455
456 if ((512 == ptr_ics_info->frame_length) ||
457 (480 == ptr_ics_info->frame_length)) {
458 if (object_type != AOT_ER_AAC_ELD) {
459 if (512 == ptr_ics_info->frame_length) {
460 ixheaacd_lap1_512_480(ptr_spec_coeff, ptr_overlap_buf,
461 (WORD16 *)out_samples, ptr_long_window,
462 q_shift, size_04, ch_fac, slot_element);
463 ixheaacd_spec_to_overlapbuf(ptr_overlap_buf, ptr_spec_coeff,
464 q_shift, size_04);
465 } else if (480 == ptr_ics_info->frame_length) {
466 ixheaacd_lap1_512_480(ptr_spec_coeff, ptr_overlap_buf,
467 (WORD16 *)out_samples, ptr_long_window,
468 q_shift, 240, ch_fac, slot_element);
469 ixheaacd_spec_to_overlapbuf(ptr_overlap_buf, ptr_spec_coeff,
470 q_shift, 240);
471 }
472 } else {
473 if (ld_mps_present == 1) {
474 ixheaacd_eld_dec_windowing_32bit(
475 ptr_spec_coeff, ptr_long_window,
476 ptr_ics_info->frame_length, q_shift, ptr_overlap_buf,
477 ch_fac, (WORD32 *)out_samples);
478 } else {
479 ixheaacd_eld_dec_windowing(
480 ptr_spec_coeff, ptr_long_window,
481 ptr_ics_info->frame_length, q_shift, ptr_overlap_buf,
482 ch_fac, (WORD16 *)out_samples, slot_element);
483 }
484 ptr_ics_info->qshift_adj = -2;
485 }
486 }
487 break;
488
489 case LONG_START_SEQUENCE:
490 case EIGHT_SHORT_SEQUENCE:
491 if (1024 == ptr_ics_info->frame_length) {
492 (*ixheaacd_post_twiddle)(scratch, ptr_spec_coeff,
493 ptr_aac_tables->pstr_imdct_tables, 1024);
494 ixheaacd_process_win_seq(scratch, ptr_overlap_buf,
495 (WORD32*)out_samples, ptr_long_window,
496 ptr_short_window, q_shift, ch_fac, 1,
497 size_01);
498 (*ixheaacd_spec_to_overlapbuf)(ptr_overlap_buf, scratch, q_shift,
499 size_08);
500 }
501
502 if (960 == ptr_ics_info->frame_length) {
503 ixheaacd_process_win_seq(ptr_spec_coeff, ptr_overlap_buf,
504 (WORD32*)out_samples, ptr_long_window,
505 ptr_short_window, q_shift, ch_fac, 1,
506 size_01);
507 ixheaacd_spec_to_overlapbuf(ptr_overlap_buf, ptr_spec_coeff,
508 q_shift, 480);
509 }
510
511 ptr_ics_info->qshift_adj = 1;
512
513 if (512 == ptr_ics_info->frame_length) {
514 ixheaacd_spec_to_overlapbuf(ptr_overlap_buf, ptr_spec_coeff,
515 q_shift, size_04);
516 }
517 if (480 == ptr_ics_info->frame_length) {
518 ixheaacd_spec_to_overlapbuf(ptr_overlap_buf, ptr_spec_coeff,
519 q_shift, 240);
520 }
521 break;
522 }
523
524 break;
525
526 case LONG_START_SEQUENCE:
527 if (1024 == ptr_ics_info->frame_length) {
528 (*ixheaacd_post_twiddle)(scratch, ptr_spec_coeff,
529 ptr_aac_tables->pstr_imdct_tables, 1024);
530 }
531 switch (ptr_aac_dec_overlap_info->window_sequence) {
532 case ONLY_LONG_SEQUENCE:
533 case LONG_STOP_SEQUENCE:
534
535 if (1024 == ptr_ics_info->frame_length) {
536 (*ixheaacd_over_lap_add1)(scratch, ptr_overlap_buf,
537 (WORD32*)out_samples, ptr_long_window,
538 q_shift, size_08, ch_fac);
539 } else {
540 ixheaacd_over_lap_add1_dec(ptr_spec_coeff, ptr_overlap_buf,
541 (WORD32*)out_samples, ptr_long_window,
542 q_shift, size_08, ch_fac);
543 }
544 ptr_ics_info->qshift_adj = 2;
545 break;
546
547 case LONG_START_SEQUENCE:
548 case EIGHT_SHORT_SEQUENCE:
549
550 if (1024 == ptr_ics_info->frame_length) {
551 ixheaacd_process_win_seq(scratch, ptr_overlap_buf,
552 (WORD32*)out_samples, ptr_long_window,
553 ptr_short_window, q_shift, ch_fac, 1,
554 size_01);
555 } else {
556 ixheaacd_process_win_seq(ptr_spec_coeff, ptr_overlap_buf,
557 (WORD32*)out_samples, ptr_long_window,
558 ptr_short_window, q_shift, ch_fac, 1,
559 size_01);
560 }
561
562 ptr_ics_info->qshift_adj = 1;
563
564 break;
565 }
566
567 if (960 != ptr_ics_info->frame_length) {
568 ixheaacd_nolap1_32(&scratch[size_01], ptr_overlap_buf, q_shift, 1,
569 size_01);
570
571 (*ixheaacd_spec_to_overlapbuf)(&ptr_overlap_buf[size_07], scratch,
572 q_shift, size_01);
573 } else {
574 ixheaacd_nolap1_32(&ptr_spec_coeff[size_01], ptr_overlap_buf,
575 q_shift, 1, size_01);
576
577 (*ixheaacd_spec_to_overlapbuf)(&ptr_overlap_buf[size_07],
578 ptr_spec_coeff, q_shift, size_01);
579 }
580
581 break;
582
583 case LONG_STOP_SEQUENCE:
584 if (1024 == ptr_ics_info->frame_length) {
585 (*ixheaacd_post_twiddle)(scratch, ptr_spec_coeff,
586 ptr_aac_tables->pstr_imdct_tables, 1024);
587 }
588
589 switch (ptr_aac_dec_overlap_info->window_sequence) {
590 case EIGHT_SHORT_SEQUENCE:
591 case LONG_START_SEQUENCE:
592
593 if (960 != ptr_ics_info->frame_length) {
594 (*ixheaacd_overlap_buf_out)((WORD32*)out_samples,
595 ptr_overlap_buf, size_07, ch_fac);
596 (*ixheaacd_over_lap_add1)(
597 &scratch[size_14], &ptr_overlap_buf[size_07],
598 ((WORD32*)out_samples + ch_fac * (size_07)),
599 ptr_short_window, q_shift, size_01, ch_fac);
600 } else {
601 ixheaacd_dec_copy_outsample((WORD32*)out_samples,
602 ptr_overlap_buf, size_07, ch_fac);
603 ixheaacd_over_lap_add1_dec(&ptr_spec_coeff[size_14],
604 &ptr_overlap_buf[size_07],
605 ((WORD32*)out_samples + ch_fac * (size_07)),
606 ptr_short_window, q_shift, size_01,
607 ch_fac);
608 }
609
610 {
611 if (960 != ptr_ics_info->frame_length) {
612
613 WORD16 q_shift1 = q_shift - 1;
614 (*ixheaacd_neg_shift_spec)(&scratch[size_08],
615 ((WORD32*)out_samples + ch_fac * size_09),
616 q_shift1, ch_fac);
617 } else {
618 WORD16 q_shift1 = q_shift - 1;
619 ixheaacd_Nolap_dec(&ptr_spec_coeff[size_08],
620 ((WORD32*)out_samples + ch_fac * size_09),
621 q_shift1, ch_fac, size_01);
622 }
623 }
624 ptr_ics_info->qshift_adj = 2;
625
626 break;
627 case ONLY_LONG_SEQUENCE:
628 case LONG_STOP_SEQUENCE:
629
630 if (1024 == ptr_ics_info->frame_length) {
631 ixheaacd_process_win_seq(scratch, ptr_overlap_buf,
632 (WORD32*)out_samples, ptr_long_window,
633 ptr_short_window, q_shift, ch_fac, 0,
634 size_01);
635 } else {
636 ixheaacd_process_win_seq(ptr_spec_coeff, ptr_overlap_buf,
637 (WORD32*)out_samples, ptr_long_window,
638 ptr_short_window, q_shift, ch_fac, 0,
639 size_01);
640 }
641
642 ptr_ics_info->qshift_adj = 2;
643 break;
644 }
645
646 if (1024 == ptr_ics_info->frame_length) {
647 (*ixheaacd_spec_to_overlapbuf)(ptr_overlap_buf, scratch, q_shift,
648 size_08);
649 } else {
650 (*ixheaacd_spec_to_overlapbuf)(ptr_overlap_buf, ptr_spec_coeff,
651 q_shift, size_08);
652 }
653
654 break;
655 }
656
657 } else {
658 WORD16 q_shift, max_scale;
659 WORD32 imdct_scale[8], i;
660 const WORD16 *short_window;
661
662 short_window = ptr_aac_dec_overlap_info
663 ->ptr_short_window[(WORD32)ptr_ics_info->window_shape];
664
665 {
666 WORD32 expo;
667
668 if (1024 == ptr_ics_info->frame_length) {
669 expo = (*ixheaacd_calc_max_spectral_line)(ptr_spec_coeff, 1024) - 1;
670
671 expo = 5 - expo;
672
673 for (i = 0; i < MAX_WINDOWS; i++) {
674 imdct_scale[i] = ixheaacd_inverse_transform(
675 &ptr_spec_coeff[i * size_02], &scratch[i * size_02],
676 ptr_aac_tables->pstr_imdct_tables, expo, 128);
677
678 (*ixheaacd_post_twiddle)(&scratch[i * size_02],
679 &ptr_spec_coeff[i * size_02],
680 ptr_aac_tables->pstr_imdct_tables, 128);
681 }
682 max_scale = 31 + imdct_scale[0];
683 q_shift = max_scale + (-16 - 6 - 1);
684 } else {
685 expo = (*ixheaacd_calc_max_spectral_line)(ptr_spec_coeff, 960) - 1;
686 memcpy(scratch, ptr_spec_coeff, sizeof(WORD32) * 960);
687
688 for (i = 0; i < MAX_WINDOWS; i++) {
689 ixheaacd_inverse_transform_960(
690 &ptr_spec_coeff[i * size_02], &scratch[i * size_02],
691 ptr_aac_tables->pstr_imdct_tables, expo, &imdct_scale[i]);
692
693 imdct_scale[i] -= expo;
694 }
695 max_scale = 31 + imdct_scale[0];
696 q_shift = max_scale + (-16 - 6 - 1);
697
698 }
699 }
700 switch (ptr_aac_dec_overlap_info->window_sequence) {
701 WORD32 overlap_buf_loc[64];
702
703 case EIGHT_SHORT_SEQUENCE:
704 case LONG_START_SEQUENCE:
705
706 (*ixheaacd_overlap_buf_out)((WORD32 *)out_samples, ptr_overlap_buf,
707 size_07, ch_fac);
708
709 if (1024 == ptr_ics_info->frame_length) {
710 (*ixheaacd_over_lap_add1)(&scratch[0], &ptr_overlap_buf[size_07],
711 ((WORD32*)out_samples + ch_fac * size_07),
712 ptr_short_window, q_shift, size_01, ch_fac);
713 } else {
714 ixheaacd_over_lap_add1_dec(&ptr_spec_coeff[0], &ptr_overlap_buf[size_07],
715 ((WORD32*)out_samples + ch_fac * size_07),
716 ptr_short_window, q_shift, size_01, ch_fac);
717 }
718
719 for (i = 0; i < 3; i++) {
720 WORD32 inc = (i * size_02);
721
722 if (1024 == ptr_ics_info->frame_length) {
723 (*ixheaacd_spec_to_overlapbuf)(overlap_buf_loc, &scratch[inc],
724 q_shift, size_01);
725
726 (*ixheaacd_over_lap_add1)(&scratch[size_02 + inc], overlap_buf_loc,
727 ((WORD32*)out_samples + ch_fac * (size_09 + inc)),
728 short_window, q_shift, size_01, ch_fac);
729 } else {
730 (*ixheaacd_spec_to_overlapbuf)(overlap_buf_loc, &ptr_spec_coeff[inc],
731 q_shift, size_01);
732
733 ixheaacd_over_lap_add1_dec(&ptr_spec_coeff[size_02 + inc], overlap_buf_loc,
734 ((WORD32*)out_samples + ch_fac * (size_09 + inc)),
735 short_window, q_shift, size_01, ch_fac);
736 }
737 }
738
739 if (1024 == ptr_ics_info->frame_length) {
740 (*ixheaacd_over_lap_add2)(&scratch[size_08], &scratch[size_06],
741 ptr_overlap_buf, short_window, q_shift,
742 size_01, 1);
743 } else {
744 ixheaacd_over_lap_add2_dec(&ptr_spec_coeff[size_08], &ptr_spec_coeff[size_06],
745 ptr_overlap_buf, short_window, q_shift,
746 size_01, 1);
747 }
748
749
750 (*ixheaacd_overlap_out_copy)(((WORD32 *)out_samples + ch_fac * size_15),
751 ptr_overlap_buf, &ptr_overlap_buf[size_01],
752 ch_fac, size_01);
753
754 ptr_ics_info->qshift_adj = 2;
755
756 break;
757
758 case ONLY_LONG_SEQUENCE:
759 case LONG_STOP_SEQUENCE:
760
761 if (1024 == ptr_ics_info->frame_length) {
762
763 ixheaacd_long_short_win_seq(
764 scratch, ptr_overlap_buf, (WORD32*)out_samples, short_window,
765 ptr_short_window, ptr_long_window, q_shift, ch_fac, size_01);
766 } else {
767 ixheaacd_long_short_win_seq(
768 ptr_spec_coeff, ptr_overlap_buf, (WORD32*)out_samples, short_window,
769 ptr_short_window, ptr_long_window, q_shift, ch_fac, size_01);
770 }
771
772 ptr_ics_info->qshift_adj = 2;
773 break;
774 }
775
776 for (i = 0; i < 3; i++) {
777 WORD32 inc = (i * size_02);
778
779 if (1024 == ptr_ics_info->frame_length) {
780 (*ixheaacd_over_lap_add2)(&scratch[size_10 + inc], &scratch[size_08 + inc],
781 &ptr_overlap_buf[size_01 + inc], short_window,
782 q_shift, size_01, 1);
783 } else {
784 ixheaacd_over_lap_add2_dec(&ptr_spec_coeff[size_10 + inc],
785 &ptr_spec_coeff[size_08 + inc],
786 &ptr_overlap_buf[size_01 + inc],
787 short_window, q_shift, size_01, 1);
788 }
789 }
790
791 if (1024 == ptr_ics_info->frame_length) {
792 (*ixheaacd_spec_to_overlapbuf)(&ptr_overlap_buf[size_07], &scratch[size_14],
793 q_shift, size_01);
794 } else {
795 (*ixheaacd_spec_to_overlapbuf)(&ptr_overlap_buf[size_07], &ptr_spec_coeff[size_14],
796 q_shift, size_01);
797 }
798 }
799
800 ptr_aac_dec_overlap_info->window_shape = ptr_ics_info->window_shape;
801 ptr_aac_dec_overlap_info->window_sequence = ptr_ics_info->window_sequence;
802 }
803
ixheaacd_eld_dec_windowing(WORD32 * ptr_spect_coeff,const WORD16 * p_win,WORD32 framesize,WORD16 q_shift,WORD32 * p_overlap_buffer,const WORD16 stride,VOID * out_samples_t,WORD slot_element)804 void ixheaacd_eld_dec_windowing(WORD32 *ptr_spect_coeff, const WORD16 *p_win,
805 WORD32 framesize, WORD16 q_shift,
806 WORD32 *p_overlap_buffer, const WORD16 stride,
807 VOID *out_samples_t, WORD slot_element) {
808 int i = 0;
809 int loop_size;
810 WORD32 *ptr_z = ptr_spect_coeff;
811
812 WORD32 *ptr_out, *p_out2;
813 WORD32 *p_overlap_buffer32 = (WORD32 *)p_overlap_buffer;
814 WORD32 delay = framesize >> 2;
815
816 WORD16 *out_samples = (WORD16 *)out_samples_t - slot_element;
817
818 ptr_z = ptr_spect_coeff + delay;
819 p_win += delay;
820 ptr_out = p_overlap_buffer32;
821
822 q_shift = q_shift + 2;
823
824 if (q_shift >= 0) {
825 for (i = (delay)-1; i >= 0; i--) {
826 WORD32 win_op;
827 WORD32 win_ovadd_op;
828 WORD16 win_val;
829
830 win_val = *p_win++;
831
832 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
833
834 win_ovadd_op =
835 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
836
837 *out_samples = ixheaac_round16(ixheaac_shl32_sat(win_ovadd_op, 1));
838 out_samples += stride;
839
840 win_val = *p_win++;
841
842 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
843
844 win_ovadd_op =
845 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
846
847 *out_samples = ixheaac_round16(ixheaac_shl32_sat(win_ovadd_op, 1));
848 out_samples += stride;
849 win_val = *p_win++;
850
851 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
852
853 win_ovadd_op =
854 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
855
856 *out_samples = ixheaac_round16(ixheaac_shl32_sat(win_ovadd_op, 1));
857 out_samples += stride;
858
859 win_val = *p_win++;
860
861 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
862
863 win_ovadd_op =
864 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
865
866 *out_samples = ixheaac_round16(ixheaac_shl32_sat(win_ovadd_op, 1));
867 out_samples += stride;
868 }
869
870 p_out2 = p_overlap_buffer32;
871 loop_size = (((framesize * 3) - framesize) >> 2) - 1;
872
873 for (i = loop_size; i >= 0; i--) {
874 WORD32 win_op;
875 WORD16 win_val;
876 win_val = *p_win++;
877 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
878 *p_out2++ =
879 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
880
881 win_val = *p_win++;
882 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
883 *p_out2++ =
884 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
885
886 win_val = *p_win++;
887 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
888 *p_out2++ =
889 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
890
891 win_val = *p_win++;
892 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
893 *p_out2++ =
894 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
895 }
896
897 loop_size = ((((framesize << 2) - delay) - (framesize * 3)) >> 2) - 1;
898 for (i = loop_size; i >= 0; i--) {
899 WORD32 win_op;
900 WORD16 win_val;
901
902 win_val = *p_win++;
903 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
904 *p_out2++ = ixheaac_shl32(win_op, q_shift);
905
906 win_val = *p_win++;
907 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
908 *p_out2++ = ixheaac_shl32(win_op, q_shift);
909
910 win_val = *p_win++;
911 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
912 *p_out2++ = ixheaac_shl32(win_op, q_shift);
913
914 win_val = *p_win++;
915 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
916 *p_out2++ = ixheaac_shl32(win_op, q_shift);
917 }
918 } else {
919 q_shift = -q_shift;
920
921 for (i = (delay)-1; i >= 0; i--) {
922 WORD32 win_op;
923 WORD32 win_ovadd_op;
924 WORD16 win_val;
925
926 win_val = *p_win++;
927 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
928
929 win_ovadd_op =
930 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
931
932 *out_samples = ixheaac_round16(ixheaac_shl32(win_ovadd_op, 1));
933 out_samples += stride;
934
935 win_val = *p_win++;
936 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
937
938 win_ovadd_op =
939 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
940
941 *out_samples = ixheaac_round16(ixheaac_shl32(win_ovadd_op, 1));
942 out_samples += stride;
943
944 win_val = *p_win++;
945 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
946
947 win_ovadd_op =
948 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
949
950 *out_samples = ixheaac_round16(ixheaac_shl32(win_ovadd_op, 1));
951 out_samples += stride;
952
953 win_val = *p_win++;
954 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
955
956 win_ovadd_op =
957 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
958
959 *out_samples = ixheaac_round16(ixheaac_shl32(win_ovadd_op, 1));
960 out_samples += stride;
961 }
962
963 p_out2 = p_overlap_buffer32;
964 loop_size = (((framesize * 3) - framesize) >> 2) - 1;
965
966 for (i = loop_size; i >= 0; i--) {
967 WORD32 win_op;
968 WORD16 win_val;
969 win_val = *p_win++;
970 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
971 *p_out2++ =
972 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
973
974 win_val = *p_win++;
975 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
976 *p_out2++ =
977 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
978
979 win_val = *p_win++;
980 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
981 *p_out2++ =
982 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
983
984 win_val = *p_win++;
985 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
986 *p_out2++ =
987 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
988 }
989 loop_size = ((((framesize << 2) - delay) - (framesize * 3)) >> 2) - 1;
990 for (i = loop_size; i >= 0; i--) {
991 WORD32 win_op;
992 WORD16 win_val;
993 win_val = *p_win++;
994 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
995 *p_out2++ = ixheaac_shr32(win_op, q_shift);
996
997 win_val = *p_win++;
998 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
999 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1000
1001 win_val = *p_win++;
1002 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1003 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1004
1005 win_val = *p_win++;
1006 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1007 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1008 }
1009 }
1010 }
1011
ixheaacd_eld_dec_windowing_32bit(WORD32 * ptr_spect_coeff,const WORD16 * p_win,WORD32 framesize,WORD16 q_shift,WORD32 * p_overlap_buffer,const WORD16 stride,WORD32 * out_samples)1012 void ixheaacd_eld_dec_windowing_32bit(WORD32 *ptr_spect_coeff,
1013 const WORD16 *p_win, WORD32 framesize,
1014 WORD16 q_shift, WORD32 *p_overlap_buffer,
1015 const WORD16 stride, WORD32 *out_samples)
1016
1017 {
1018 WORD32 i = 0;
1019 WORD32 loop_size;
1020 WORD32 *ptr_z = ptr_spect_coeff;
1021
1022 WORD32 *ptr_out, *p_out2;
1023 WORD32 *p_overlap_buffer32 = (WORD32 *)p_overlap_buffer;
1024 WORD32 delay = framesize >> 2;
1025
1026 ptr_z = ptr_spect_coeff + delay;
1027 p_win += delay;
1028 ptr_out = p_overlap_buffer32;
1029
1030 q_shift = q_shift + 2;
1031
1032 if (q_shift >= 0) {
1033 for (i = (delay)-1; i >= 0; i--) {
1034 WORD32 win_op;
1035 WORD16 win_val;
1036
1037 win_val = *p_win++;
1038
1039 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1040
1041 *out_samples =
1042 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1043
1044 out_samples += stride;
1045
1046 win_val = *p_win++;
1047
1048 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1049
1050 *out_samples =
1051 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1052
1053 out_samples += stride;
1054 win_val = *p_win++;
1055
1056 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1057
1058 *out_samples =
1059 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1060
1061 out_samples += stride;
1062
1063 win_val = *p_win++;
1064
1065 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1066
1067 *out_samples =
1068 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1069
1070 out_samples += stride;
1071 }
1072
1073 p_out2 = p_overlap_buffer32;
1074 loop_size = (((framesize * 3) - framesize) >> 2) - 1;
1075
1076 for (i = loop_size; i >= 0; i--) {
1077 WORD32 win_op;
1078 WORD16 win_val;
1079 win_val = *p_win++;
1080 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1081 *p_out2++ =
1082 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1083
1084 win_val = *p_win++;
1085 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1086 *p_out2++ =
1087 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1088
1089 win_val = *p_win++;
1090 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1091 *p_out2++ =
1092 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1093
1094 win_val = *p_win++;
1095 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1096 *p_out2++ =
1097 ixheaac_add32_sat(ixheaac_shl32(win_op, q_shift), *ptr_out++);
1098 }
1099
1100 loop_size = ((((framesize << 2) - delay) - (framesize * 3)) >> 2) - 1;
1101 for (i = loop_size; i >= 0; i--) {
1102 WORD32 win_op;
1103 WORD16 win_val;
1104
1105 win_val = *p_win++;
1106 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1107 *p_out2++ = ixheaac_shl32(win_op, q_shift);
1108
1109 win_val = *p_win++;
1110 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1111 *p_out2++ = ixheaac_shl32(win_op, q_shift);
1112
1113 win_val = *p_win++;
1114 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1115 *p_out2++ = ixheaac_shl32(win_op, q_shift);
1116
1117 win_val = *p_win++;
1118 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1119 *p_out2++ = ixheaac_shl32(win_op, q_shift);
1120 }
1121 } else {
1122 q_shift = -q_shift;
1123
1124 for (i = (delay)-1; i >= 0; i--) {
1125 WORD32 win_op;
1126 WORD16 win_val;
1127
1128 win_val = *p_win++;
1129 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1130
1131 *out_samples =
1132 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1133
1134 out_samples += stride;
1135
1136 win_val = *p_win++;
1137 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1138
1139 *out_samples =
1140 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1141
1142 out_samples += stride;
1143
1144 win_val = *p_win++;
1145 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1146
1147 *out_samples =
1148 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1149
1150 out_samples += stride;
1151
1152 win_val = *p_win++;
1153 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1154
1155 *out_samples =
1156 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1157
1158 out_samples += stride;
1159 }
1160
1161 p_out2 = p_overlap_buffer32;
1162 loop_size = (((framesize * 3) - framesize) >> 2) - 1;
1163
1164 for (i = loop_size; i >= 0; i--) {
1165 WORD32 win_op;
1166 WORD16 win_val;
1167 win_val = *p_win++;
1168 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1169 *p_out2++ =
1170 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1171
1172 win_val = *p_win++;
1173 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1174 *p_out2++ =
1175 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1176
1177 win_val = *p_win++;
1178 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1179 *p_out2++ =
1180 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1181
1182 win_val = *p_win++;
1183 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1184 *p_out2++ =
1185 ixheaac_add32_sat(ixheaac_shr32(win_op, q_shift), *ptr_out++);
1186 }
1187 loop_size = ((((framesize << 2) - delay) - (framesize * 3)) >> 2) - 1;
1188 for (i = loop_size; i >= 0; i--) {
1189 WORD32 win_op;
1190 WORD16 win_val;
1191 win_val = *p_win++;
1192 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1193 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1194
1195 win_val = *p_win++;
1196 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1197 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1198
1199 win_val = *p_win++;
1200 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1201 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1202
1203 win_val = *p_win++;
1204 win_op = ixheaac_mult32x16in32(*ptr_z++, (win_val));
1205 *p_out2++ = ixheaac_shr32(win_op, q_shift);
1206 }
1207 }
1208 }
1209