Coverage Report

Created: 2026-02-07 06:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/decoder/generic/ixheaacd_qmf_dec_generic.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
22
#include "ixheaacd_sbr_common.h"
23
#include "ixheaac_type_def.h"
24
25
#include "ixheaac_constants.h"
26
#include "ixheaac_basic_ops32.h"
27
#include "ixheaac_basic_ops16.h"
28
#include "ixheaac_basic_ops40.h"
29
#include "ixheaac_basic_ops.h"
30
31
#include "ixheaacd_intrinsics.h"
32
#include "ixheaacd_common_rom.h"
33
#include "ixheaacd_bitbuffer.h"
34
#include "ixheaacd_sbrdecsettings.h"
35
#include "ixheaacd_sbr_scale.h"
36
#include "ixheaacd_lpp_tran.h"
37
#include "ixheaacd_env_extr_part.h"
38
#include "ixheaacd_sbr_rom.h"
39
#include "ixheaacd_hybrid.h"
40
#include "ixheaacd_ps_dec.h"
41
#include "ixheaacd_env_extr.h"
42
#include "ixheaacd_qmf_dec.h"
43
44
#include "ixheaac_basic_op.h"
45
#include "ixheaacd_env_calc.h"
46
47
#include "ixheaacd_interface.h"
48
49
#include "ixheaacd_function_selector.h"
50
#include "ixheaacd_audioobjtypes.h"
51
#if !__ARM_NEON__
52
53
0
#define DCT3_LEN (32)
54
#define DCT2_LEN (64)
55
56
0
#define LP_SHIFT_VAL 7
57
511M
#define HQ_SHIFT_64 4
58
1.22G
#define RADIXSHIFT 1
59
54.2M
#define HQ_SHIFT_VAL 4
60
61
extern const WORD32 ixheaacd_ldmps_polyphase_filter_coeff_fix[1280];
62
63
VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
64
                      const WORD16 *main_twidle_fwd, const WORD16 *post_tbl,
65
0
                      const WORD16 *w_16, const WORD32 *p_table) {
66
0
  WORD32 n, k;
67
68
0
  WORD32 temp1[6];
69
0
  WORD32 temp2[4];
70
0
  WORD16 twid_re, twid_im;
71
0
  WORD32 *ptr_reverse, *ptr_forward, *p_out, *ptr_out1;
72
0
  const WORD16 *twidle_fwd, *twidle_rev;
73
74
0
  ptr_forward = &input[49];
75
0
  ptr_reverse = &input[47];
76
77
0
  p_out = output;
78
0
  twidle_fwd = main_twidle_fwd;
79
0
  twidle_fwd += 4;
80
81
0
  *p_out++ = input[48] >> LP_SHIFT_VAL;
82
0
  *p_out++ = 0;
83
84
0
  for (n = 1; n < DCT3_LEN / 2; n++) {
85
0
    temp1[0] = *ptr_forward++;
86
0
    temp1[1] = *ptr_reverse--;
87
0
    temp1[0] = ixheaac_add32_sat(ixheaac_shr32(temp1[0], LP_SHIFT_VAL),
88
0
                                  ixheaac_shr32(temp1[1], LP_SHIFT_VAL));
89
90
0
    temp1[2] = *(ptr_forward - 33);
91
0
    temp1[3] = *(ptr_reverse - 31);
92
0
    temp1[1] = ixheaac_sub32_sat(ixheaac_shr32(temp1[2], LP_SHIFT_VAL),
93
0
                                  ixheaac_shr32(temp1[3], LP_SHIFT_VAL));
94
0
    twid_re = *twidle_fwd++;
95
96
0
    twid_im = *twidle_fwd;
97
0
    twidle_fwd += 3;
98
99
0
    *p_out++ = ixheaac_mult32x16in32(temp1[0], twid_re) +
100
0
               ixheaac_mult32x16in32(temp1[1], twid_im);
101
0
    *p_out++ = -ixheaac_mult32x16in32(temp1[1], twid_re) +
102
0
               ixheaac_mult32x16in32(temp1[0], twid_im);
103
0
  }
104
105
0
  twid_re = *twidle_fwd++;
106
107
0
  twid_im = *twidle_fwd;
108
0
  twidle_fwd += 3;
109
110
0
  temp1[1] = *ptr_reverse--;
111
0
  temp1[0] = *(ptr_reverse - 31);
112
0
  temp1[1] = ixheaac_sub32_sat(ixheaac_shr32(temp1[1], LP_SHIFT_VAL),
113
0
                                ixheaac_shr32(temp1[0], LP_SHIFT_VAL));
114
115
0
  temp1[0] = temp1[1];
116
117
0
  temp2[2] = ixheaac_mult32x16in32(temp1[0], twid_re) +
118
0
             ixheaac_mult32x16in32(temp1[1], twid_im);
119
0
  temp2[3] = -ixheaac_mult32x16in32(temp1[1], twid_re) +
120
0
             ixheaac_mult32x16in32(temp1[0], twid_im);
121
122
0
  ptr_forward = output;
123
0
  ptr_reverse = &output[DCT3_LEN - 1];
124
125
0
  temp2[0] = *ptr_forward++;
126
0
  temp2[1] = *ptr_forward--;
127
128
0
  temp1[0] = -temp2[1] - temp2[3];
129
0
  temp1[1] = temp2[0] - temp2[2];
130
0
  temp2[0] = (temp2[0] + temp2[2] + temp1[0]);
131
0
  temp2[1] = (temp2[1] - temp2[3] + temp1[1]);
132
133
0
  temp2[0] >>= 1;
134
0
  temp2[1] >>= 1;
135
136
0
  *ptr_forward++ = temp2[0];
137
0
  *ptr_forward++ = temp2[1];
138
139
0
  twidle_fwd = post_tbl + 2;
140
0
  twidle_rev = post_tbl + 14;
141
142
0
  for (n = 1; n < DCT3_LEN / 4; n++) {
143
0
    temp2[0] = *ptr_forward++;
144
0
    temp2[1] = *ptr_forward--;
145
0
    temp2[3] = *ptr_reverse--;
146
0
    temp2[2] = *ptr_reverse++;
147
148
0
    twid_re = *twidle_rev;
149
0
    twidle_rev -= 2;
150
0
    twid_im = *twidle_fwd;
151
0
    twidle_fwd += 2;
152
153
0
    temp1[0] = temp2[0] - temp2[2];
154
0
    temp1[1] = (temp2[0] + temp2[2]);
155
156
0
    temp1[2] = temp2[1] + temp2[3];
157
0
    temp1[3] = (temp2[1] - temp2[3]);
158
159
0
    temp1[4] = ixheaac_mult32x16in32(temp1[0], twid_re) +
160
0
               ixheaac_mult32x16in32(temp1[2], twid_im);
161
0
    temp1[5] = -ixheaac_mult32x16in32(temp1[2], twid_re) +
162
0
               ixheaac_mult32x16in32(temp1[0], twid_im);
163
164
0
    temp1[1] >>= 1;
165
0
    temp1[3] >>= 1;
166
167
0
    *ptr_forward++ = temp1[1] - temp1[4];
168
0
    *ptr_forward++ = temp1[3] + temp1[5];
169
170
0
    *ptr_reverse-- = -temp1[3] + temp1[5];
171
0
    *ptr_reverse-- = temp1[1] + temp1[4];
172
0
  }
173
0
  temp2[0] = *ptr_forward++;
174
0
  temp2[1] = *ptr_forward--;
175
0
  temp2[3] = *ptr_reverse--;
176
0
  temp2[2] = *ptr_reverse++;
177
178
0
  twid_re = -*twidle_rev;
179
0
  twidle_rev -= 2;
180
0
  twid_im = *twidle_fwd;
181
0
  twidle_fwd += 2;
182
183
0
  temp1[0] = temp2[0] - temp2[2];
184
0
  temp1[1] = (temp2[0] + temp2[2]);
185
186
0
  temp1[2] = temp2[1] + temp2[3];
187
0
  temp1[3] = (temp2[1] - temp2[3]);
188
189
0
  temp1[4] = ixheaac_mult32x16in32(temp1[0], twid_re) -
190
0
             ixheaac_mult32x16in32(temp1[2], twid_im);
191
0
  temp1[5] = ixheaac_mult32x16in32(temp1[2], twid_re) +
192
0
             ixheaac_mult32x16in32(temp1[0], twid_im);
193
194
0
  temp1[1] >>= 1;
195
0
  temp1[3] >>= 1;
196
0
  *ptr_forward++ = temp1[1] + temp1[4];
197
0
  *ptr_forward++ = temp1[3] + temp1[5];
198
199
0
  ixheaacd_radix4bfly(w_16, output, 1, 4);
200
0
  ixheaacd_postradixcompute4(input, output, p_table, 16);
201
202
0
  output[0] = input[0];
203
0
  output[2] = input[1];
204
205
0
  p_out = input + 2;
206
0
  ptr_forward = output + 1;
207
0
  ptr_reverse = output + 30;
208
0
  ptr_out1 = input + 18;
209
210
0
  for (k = (DCT3_LEN / 4) - 1; k != 0; k--) {
211
0
    WORD32 tempre, tempim;
212
213
0
    tempre = *p_out++;
214
0
    tempim = *p_out++;
215
0
    *ptr_forward = (tempim);
216
0
    ptr_forward += 2;
217
0
    *ptr_forward = (tempre);
218
0
    ptr_forward += 2;
219
220
0
    tempre = *ptr_out1++;
221
0
    tempim = *ptr_out1++;
222
0
    *ptr_reverse = (tempim);
223
0
    ptr_reverse -= 2;
224
0
    *ptr_reverse = (tempre);
225
0
    ptr_reverse -= 2;
226
0
  }
227
228
0
  {
229
0
    WORD32 tempre, tempim;
230
0
    tempre = *p_out++;
231
0
    tempim = *p_out++;
232
0
    *ptr_forward = (tempim);
233
0
    ptr_forward += 2;
234
0
    *ptr_forward = (tempre);
235
0
    ptr_forward += 2;
236
0
  }
237
238
0
  return;
239
0
}
240
241
VOID ixheaacd_dct2_64(WORD32 *x, WORD32 *X,
242
                      ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
243
0
                      WORD16 *filter_states) {
244
0
  ixheaacd_pretwdct2(x, X);
245
246
0
  ixheaacd_radix4bfly(qmf_dec_tables_ptr->w_32, X, 1, 8);
247
248
0
  ixheaacd_radix4bfly(qmf_dec_tables_ptr->w_32 + 48, X, 4, 2);
249
250
0
  ixheaacd_postradixcompute2(x, X, qmf_dec_tables_ptr->dig_rev_table2_32, 32);
251
252
0
  ixheaacd_fftposttw(x, qmf_dec_tables_ptr);
253
254
0
  ixheaacd_posttwdct2(x, filter_states, qmf_dec_tables_ptr);
255
256
0
  return;
257
0
}
258
259
VOID ixheaacd_cos_sin_mod(WORD32 *subband,
260
                          ia_sbr_qmf_filter_bank_struct *qmf_bank,
261
1.44M
                          WORD16 *p_twiddle, WORD32 *p_dig_rev_tbl) {
262
1.44M
  WORD32 re2, re3;
263
1.44M
  WORD16 wim, wre;
264
265
1.44M
  WORD32 i, M_2;
266
1.44M
  WORD32 M = ixheaac_shr32(qmf_bank->no_channels, 1);
267
268
1.44M
  const WORD16 *p_sin;
269
1.44M
  const WORD16 *p_sin_cos = &qmf_bank->cos_twiddle[0];
270
1.44M
  WORD32 subband_tmp[128];
271
1.44M
  WORD32 re;
272
1.44M
  WORD32 im;
273
1.44M
  WORD32 *psubband, *psubband1;
274
1.44M
  WORD32 *psubband_t, *psubband1_t;
275
1.44M
  WORD32 *psubband2, *psubband12;
276
1.44M
  WORD32 *psubband_t2, *psubband1_t2;
277
278
1.44M
  M_2 = ixheaac_shr32(M, 1);
279
280
1.44M
  psubband = &subband[0];
281
1.44M
  psubband1 = &subband[2 * M - 1];
282
1.44M
  psubband_t = subband_tmp;
283
1.44M
  psubband1_t = &subband_tmp[2 * M - 1];
284
285
1.44M
  psubband2 = &subband[64];
286
1.44M
  psubband12 = &subband[2 * M - 1 + 64];
287
1.44M
  psubband_t2 = &subband_tmp[64];
288
1.44M
  psubband1_t2 = &subband_tmp[2 * M - 1 + 64];
289
290
8.64M
  for (i = (M_2 >> 1) - 1; i >= 0; i--) {
291
7.20M
    re = *psubband++;
292
7.20M
    im = *psubband1--;
293
294
7.20M
    wim = *p_sin_cos++;
295
7.20M
    wre = *p_sin_cos++;
296
297
7.20M
    *psubband_t++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
298
7.20M
                                       ixheaac_mult32x16in32(im, wim));
299
7.20M
    *psubband_t++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
300
7.20M
                                       ixheaac_mult32x16in32(re, wim));
301
302
7.20M
    re = *psubband2++;
303
7.20M
    im = *psubband12--;
304
305
7.20M
    *psubband_t2++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
306
7.20M
                                        ixheaac_mult32x16in32(re, wre));
307
7.20M
    *psubband_t2++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
308
7.20M
                                        ixheaac_mult32x16in32(im, wre));
309
310
7.20M
    re = *psubband1--;
311
7.20M
    im = *psubband++;
312
313
7.20M
    wim = *p_sin_cos++;
314
7.20M
    wre = *p_sin_cos++;
315
316
7.20M
    *psubband1_t-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
317
7.20M
                                        ixheaac_mult32x16in32(re, wim));
318
7.20M
    *psubband1_t-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
319
7.20M
                                        ixheaac_mult32x16in32(im, wim));
320
321
7.20M
    re = *psubband12--;
322
7.20M
    im = *psubband2++;
323
324
7.20M
    *psubband1_t2-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
325
7.20M
                                         ixheaac_mult32x16in32(im, wre));
326
7.20M
    *psubband1_t2-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
327
7.20M
                                         ixheaac_mult32x16in32(re, wre));
328
329
7.20M
    re = *psubband++;
330
7.20M
    im = *psubband1--;
331
332
7.20M
    wim = *p_sin_cos++;
333
7.20M
    wre = *p_sin_cos++;
334
335
7.20M
    *psubband_t++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
336
7.20M
                                       ixheaac_mult32x16in32(im, wim));
337
7.20M
    *psubband_t++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
338
7.20M
                                       ixheaac_mult32x16in32(re, wim));
339
340
7.20M
    re = *psubband2++;
341
7.20M
    im = *psubband12--;
342
343
7.20M
    *psubband_t2++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
344
7.20M
                                        ixheaac_mult32x16in32(re, wre));
345
7.20M
    *psubband_t2++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
346
7.20M
                                        ixheaac_mult32x16in32(im, wre));
347
348
7.20M
    re = *psubband1--;
349
7.20M
    im = *psubband++;
350
351
7.20M
    wim = *p_sin_cos++;
352
7.20M
    wre = *p_sin_cos++;
353
354
7.20M
    *psubband1_t-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
355
7.20M
                                        ixheaac_mult32x16in32(re, wim));
356
7.20M
    *psubband1_t-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
357
7.20M
                                        ixheaac_mult32x16in32(im, wim));
358
359
7.20M
    re = *psubband12--;
360
7.20M
    im = *psubband2++;
361
7.20M
    ;
362
363
7.20M
    *psubband1_t2-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
364
7.20M
                                         ixheaac_mult32x16in32(im, wre));
365
7.20M
    *psubband1_t2-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
366
7.20M
                                         ixheaac_mult32x16in32(re, wre));
367
7.20M
  }
368
369
1.44M
  if (M == 32) {
370
358k
    ixheaacd_radix4bfly(p_twiddle, subband_tmp, 1, 8);
371
358k
    ixheaacd_radix4bfly(p_twiddle + 48, subband_tmp, 4, 2);
372
358k
    ixheaacd_postradixcompute2(subband, subband_tmp, p_dig_rev_tbl, 32);
373
374
358k
    ixheaacd_radix4bfly(p_twiddle, &subband_tmp[64], 1, 8);
375
358k
    ixheaacd_radix4bfly(p_twiddle + 48, &subband_tmp[64], 4, 2);
376
358k
    ixheaacd_postradixcompute2(&subband[64], &subband_tmp[64], p_dig_rev_tbl,
377
358k
                               32);
378
379
1.08M
  } else {
380
1.08M
    ixheaacd_radix4bfly(p_twiddle, subband_tmp, 1, 4);
381
1.08M
    ixheaacd_postradixcompute4(subband, subband_tmp, p_dig_rev_tbl, 16);
382
383
1.08M
    ixheaacd_radix4bfly(p_twiddle, &subband_tmp[64], 1, 4);
384
1.08M
    ixheaacd_postradixcompute4(&subband[64], &subband_tmp[64], p_dig_rev_tbl,
385
1.08M
                               16);
386
1.08M
  }
387
388
1.44M
  psubband = &subband[0];
389
1.44M
  psubband1 = &subband[2 * M - 1];
390
391
1.44M
  re = *psubband1;
392
393
1.44M
  *psubband = *psubband >> 1;
394
1.44M
  psubband++;
395
1.44M
  *psubband1 = ixheaac_negate32_sat(*psubband >> 1);
396
1.44M
  psubband1--;
397
398
1.44M
  p_sin = &qmf_bank->alt_sin_twiddle[0];
399
1.44M
  wim = *p_sin++;
400
1.44M
  wre = *p_sin++;
401
402
1.44M
  im = *psubband1;
403
404
1.44M
  *psubband1-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
405
1.44M
                                    ixheaac_mult32x16in32(im, wim));
406
1.44M
  *psubband++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
407
1.44M
                                   ixheaac_mult32x16in32(re, wim));
408
409
1.44M
  psubband2 = &subband[64];
410
1.44M
  psubband12 = &subband[2 * M - 1 + 64];
411
412
1.44M
  re = *psubband12;
413
414
1.44M
  *psubband12-- = ixheaac_negate32_sat(*psubband2 >> 1);
415
416
1.44M
  *psubband2 = psubband2[1] >> 1;
417
418
1.44M
  psubband2++;
419
420
1.44M
  im = *psubband12;
421
422
1.44M
  *psubband2++ = ixheaac_negate32_sat(ixheaac_add32_sat(
423
1.44M
      ixheaac_mult32x16in32(re, wre), ixheaac_mult32x16in32(im, wim)));
424
1.44M
  *psubband12-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(re, wim),
425
1.44M
                                     ixheaac_mult32x16in32(im, wre));
426
427
14.4M
  for (i = (M_2 - 2); i >= 0; i--) {
428
12.9M
    im = psubband[0];
429
430
12.9M
    re = psubband[1];
431
432
12.9M
    re2 = *psubband1;
433
434
12.9M
    *psubband++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
435
12.9M
                                     ixheaac_mult32x16in32(im, wre));
436
12.9M
    *psubband1-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
437
12.9M
                                      ixheaac_mult32x16in32(re, wre));
438
439
12.9M
    im = psubband2[0];
440
441
12.9M
    re = psubband2[1];
442
443
12.9M
    re3 = *psubband12;
444
445
12.9M
    *psubband12-- = ixheaac_negate32_sat(ixheaac_add32_sat(
446
12.9M
        ixheaac_mult32x16in32(re, wim), ixheaac_mult32x16in32(im, wre)));
447
12.9M
    *psubband2++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(re, wre),
448
12.9M
                                      ixheaac_mult32x16in32(im, wim));
449
450
12.9M
    wim = *p_sin++;
451
12.9M
    wre = *p_sin++;
452
12.9M
    im = psubband1[0];
453
454
12.9M
    *psubband1-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re2, wre),
455
12.9M
                                      ixheaac_mult32x16in32(im, wim));
456
12.9M
    *psubband++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
457
12.9M
                                     ixheaac_mult32x16in32(re2, wim));
458
459
12.9M
    im = psubband12[0];
460
461
12.9M
    *psubband2++ = ixheaac_negate32_sat(ixheaac_add32_sat(
462
12.9M
        ixheaac_mult32x16in32(re3, wre), ixheaac_mult32x16in32(im, wim)));
463
12.9M
    *psubband12-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(re3, wim),
464
12.9M
                                       ixheaac_mult32x16in32(im, wre));
465
12.9M
  }
466
1.44M
}
467
468
VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
469
                             WORD32 *imag_subband,
470
                             ia_sbr_qmf_filter_bank_struct *qmf_bank,
471
                             ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
472
721k
                             WORD32 ld_mps_flag) {
473
721k
  WORD32 i;
474
721k
  const WORD32 *p_time_in2 = &p_time_in1[2 * qmf_bank->no_channels - 1];
475
721k
  WORD32 temp1, temp2;
476
721k
  WORD32 *t_real_subband = real_subband;
477
721k
  WORD32 *t_imag_subband = imag_subband;
478
721k
  const WORD16 *tcos;
479
480
27.8M
  for (i = qmf_bank->no_channels - 1; i >= 0; i--) {
481
27.1M
    temp1 = ixheaac_shr32(*p_time_in1++, HQ_SHIFT_VAL);
482
27.1M
    temp2 = ixheaac_shr32(*p_time_in2--, HQ_SHIFT_VAL);
483
484
27.1M
    *t_real_subband++ = ixheaac_sub32_sat(temp1, temp2);
485
486
27.1M
    *t_imag_subband++ = ixheaac_add32_sat(temp1, temp2);
487
27.1M
  }
488
489
721k
  if (qmf_bank->no_channels != 64)
490
595k
    ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_16,
491
595k
                         qmf_dec_tables_ptr->dig_rev_table4_16);
492
126k
  else
493
126k
    ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_32,
494
126k
                         qmf_dec_tables_ptr->dig_rev_table2_32);
495
496
721k
  if (ld_mps_flag == 0) {
497
654k
    tcos = qmf_bank->t_cos;
498
499
11.1M
    for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
500
10.4M
      WORD16 cosh, sinh;
501
10.4M
      WORD32 re, im;
502
503
10.4M
      re = *real_subband;
504
10.4M
      im = *imag_subband;
505
10.4M
      cosh = *tcos++;
506
10.4M
      sinh = *tcos++;
507
10.4M
      *real_subband++ =
508
10.4M
          ixheaac_add32_sat(ixheaac_mult32x16in32_shl(re, cosh),
509
10.4M
                             ixheaac_mult32x16in32_shl(im, sinh));
510
10.4M
      *imag_subband++ =
511
10.4M
          ixheaac_sub32_sat(ixheaac_mult32x16in32_shl(im, cosh),
512
10.4M
                             ixheaac_mult32x16in32_shl(re, sinh));
513
10.4M
    }
514
654k
  } else {
515
66.9k
    WORD32 i_band;
516
1.14M
    for (i = 0; i < min(64, qmf_bank->no_channels); i += 2) {
517
1.07M
      i_band = real_subband[i];
518
1.07M
      real_subband[i] = -imag_subband[i];
519
1.07M
      imag_subband[i] = i_band;
520
521
1.07M
      i_band = -real_subband[i + 1];
522
1.07M
      real_subband[i + 1] = imag_subband[i + 1];
523
1.07M
      imag_subband[i + 1] = i_band;
524
1.07M
    }
525
66.9k
  }
526
721k
}
527
528
VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2,
529
                                   const WORD16 *p_qmf1, const WORD16 *p_qmf2,
530
0
                                   WORD32 *p_out) {
531
0
  WORD32 n;
532
533
0
  for (n = 0; n < 32; n += 2) {
534
0
    WORD32 accu;
535
536
0
    accu = ixheaac_mult16x16in32(inp1[n + 0], p_qmf1[2 * (n + 0)]);
537
0
    accu = ixheaac_add32_sat(
538
0
        accu, ixheaac_mult16x16in32(inp1[n + 64], p_qmf1[2 * (n + 64)]));
539
0
    accu = ixheaac_add32_sat(
540
0
        accu, ixheaac_mult16x16in32(inp1[n + 128], p_qmf1[2 * (n + 128)]));
541
0
    accu = ixheaac_add32_sat(
542
0
        accu, ixheaac_mult16x16in32(inp1[n + 192], p_qmf1[2 * (n + 192)]));
543
0
    accu = ixheaac_add32_sat(
544
0
        accu, ixheaac_mult16x16in32(inp1[n + 256], p_qmf1[2 * (n + 256)]));
545
0
    p_out[n] = accu;
546
547
0
    accu = ixheaac_mult16x16in32(inp1[n + 1 + 0], p_qmf1[2 * (n + 1 + 0)]);
548
0
    accu = ixheaac_add32_sat(
549
0
        accu,
550
0
        ixheaac_mult16x16in32(inp1[n + 1 + 64], p_qmf1[2 * (n + 1 + 64)]));
551
0
    accu = ixheaac_add32_sat(
552
0
        accu,
553
0
        ixheaac_mult16x16in32(inp1[n + 1 + 128], p_qmf1[2 * (n + 1 + 128)]));
554
0
    accu = ixheaac_add32_sat(
555
0
        accu,
556
0
        ixheaac_mult16x16in32(inp1[n + 1 + 192], p_qmf1[2 * (n + 1 + 192)]));
557
0
    accu = ixheaac_add32_sat(
558
0
        accu,
559
0
        ixheaac_mult16x16in32(inp1[n + 1 + 256], p_qmf1[2 * (n + 1 + 256)]));
560
0
    p_out[n + 1] = accu;
561
562
0
    accu = ixheaac_mult16x16in32(inp2[n + 0], p_qmf2[2 * (n + 0)]);
563
0
    accu = ixheaac_add32_sat(
564
0
        accu, ixheaac_mult16x16in32(inp2[n + 64], p_qmf2[2 * (n + 64)]));
565
0
    accu = ixheaac_add32_sat(
566
0
        accu, ixheaac_mult16x16in32(inp2[n + 128], p_qmf2[2 * (n + 128)]));
567
0
    accu = ixheaac_add32_sat(
568
0
        accu, ixheaac_mult16x16in32(inp2[n + 192], p_qmf2[2 * (n + 192)]));
569
0
    accu = ixheaac_add32_sat(
570
0
        accu, ixheaac_mult16x16in32(inp2[n + 256], p_qmf2[2 * (n + 256)]));
571
0
    p_out[n + 32] = accu;
572
573
0
    accu = ixheaac_mult16x16in32(inp2[n + 1 + 0], p_qmf2[2 * (n + 1 + 0)]);
574
0
    accu = ixheaac_add32_sat(
575
0
        accu,
576
0
        ixheaac_mult16x16in32(inp2[n + 1 + 64], p_qmf2[2 * (n + 1 + 64)]));
577
0
    accu = ixheaac_add32_sat(
578
0
        accu,
579
0
        ixheaac_mult16x16in32(inp2[n + 1 + 128], p_qmf2[2 * (n + 1 + 128)]));
580
0
    accu = ixheaac_add32_sat(
581
0
        accu,
582
0
        ixheaac_mult16x16in32(inp2[n + 1 + 192], p_qmf2[2 * (n + 1 + 192)]));
583
0
    accu = ixheaac_add32_sat(
584
0
        accu,
585
0
        ixheaac_mult16x16in32(inp2[n + 1 + 256], p_qmf2[2 * (n + 1 + 256)]));
586
0
    p_out[n + 1 + 32] = accu;
587
0
  }
588
0
}
589
590
VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
591
                                ia_sbr_scale_fact_struct *sbr_scale_factor,
592
                                WORD32 **qmf_real, WORD32 **qmf_imag,
593
                                ia_sbr_qmf_filter_bank_struct *qmf_bank,
594
                                ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
595
                                WORD32 ch_fac, WORD32 low_pow_flag,
596
41.8k
                                WORD audio_object_type) {
597
41.8k
  WORD32 i, k;
598
41.8k
  WORD32 num_time_slots = qmf_bank->num_time_slots;
599
600
41.8k
  WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS] = { 0 };
601
41.8k
  WORD16 *filter_states = qmf_bank->core_samples_buffer;
602
603
41.8k
  WORD16 *fp1, *fp2, *tmp;
604
605
41.8k
  WORD16 *filter_1;
606
41.8k
  WORD16 *filter_2;
607
41.8k
  WORD16 *filt_ptr;
608
41.8k
  WORD32 start_slot = 0;
609
610
41.8k
  if (audio_object_type != AOT_ER_AAC_ELD &&
611
0
      audio_object_type != AOT_ER_AAC_LD) {
612
0
    qmf_bank->filter_pos +=
613
0
        (qmf_dec_tables_ptr->qmf_c - qmf_bank->analy_win_coeff);
614
0
    qmf_bank->analy_win_coeff = qmf_dec_tables_ptr->qmf_c;
615
41.8k
  } else {
616
41.8k
    qmf_bank->filter_pos +=
617
41.8k
        (qmf_dec_tables_ptr->qmf_c_eld3 - qmf_bank->analy_win_coeff);
618
41.8k
    qmf_bank->analy_win_coeff = qmf_dec_tables_ptr->qmf_c_eld3;
619
41.8k
  }
620
621
41.8k
  filter_1 = qmf_bank->filter_pos;
622
623
41.8k
  if (audio_object_type != AOT_ER_AAC_ELD &&
624
0
      audio_object_type != AOT_ER_AAC_LD) {
625
0
    filter_2 = filter_1 + 64;
626
41.8k
  } else {
627
41.8k
    filter_2 = filter_1 + qmf_bank->no_channels;
628
41.8k
  }
629
630
41.8k
  sbr_scale_factor->st_lb_scale = 0;
631
41.8k
  sbr_scale_factor->lb_scale = -10;
632
41.8k
  if (!low_pow_flag) {
633
41.8k
    if (audio_object_type != AOT_ER_AAC_ELD &&
634
0
        audio_object_type != AOT_ER_AAC_LD) {
635
0
      sbr_scale_factor->lb_scale = -8;
636
41.8k
    } else {
637
41.8k
      sbr_scale_factor->lb_scale = -9;
638
41.8k
    }
639
41.8k
    if (qmf_bank->no_channels != 64) {
640
33.8k
      qmf_bank->cos_twiddle =
641
33.8k
          (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
642
33.8k
      qmf_bank->alt_sin_twiddle =
643
33.8k
          (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
644
33.8k
    } else {
645
8.06k
      qmf_bank->cos_twiddle =
646
8.06k
          (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
647
8.06k
      qmf_bank->alt_sin_twiddle =
648
8.06k
          (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
649
8.06k
    }
650
41.8k
    if (audio_object_type != AOT_ER_AAC_ELD &&
651
0
        audio_object_type != AOT_ER_AAC_LD) {
652
0
      qmf_bank->t_cos = (WORD16 *)qmf_dec_tables_ptr->sbr_t_cos_sin_l32;
653
41.8k
    } else {
654
41.8k
      qmf_bank->t_cos =
655
41.8k
          (WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
656
41.8k
    }
657
41.8k
  }
658
659
41.8k
  fp1 = qmf_bank->anal_filter_states;
660
41.8k
  fp2 = qmf_bank->anal_filter_states + qmf_bank->no_channels;
661
662
41.8k
  if (audio_object_type == AOT_ER_AAC_ELD ||
663
41.8k
      audio_object_type == AOT_ER_AAC_LD) {
664
41.8k
    filter_2 = qmf_bank->filter_2;
665
41.8k
    fp1 = qmf_bank->fp1_anal;
666
41.8k
    fp2 = qmf_bank->fp2_anal;
667
41.8k
  }
668
669
696k
  for (i = start_slot; i < num_time_slots + start_slot; i++) {
670
25.6M
    for (k = 0; k < qmf_bank->no_channels; k++)
671
24.9M
      filter_states[qmf_bank->no_channels - 1 - k] =
672
24.9M
          time_sample_buf[ch_fac * k];
673
674
654k
    if (audio_object_type != AOT_ER_AAC_ELD &&
675
0
        audio_object_type != AOT_ER_AAC_LD) {
676
0
      ixheaacd_sbr_qmfanal32_winadd(fp1, fp2, filter_1, filter_2,
677
0
                                    analysis_buffer);
678
654k
    } else {
679
654k
      ixheaacd_sbr_qmfanal32_winadd_eld(fp1, fp2, filter_1, filter_2,
680
654k
                                        analysis_buffer);
681
654k
    }
682
683
654k
    time_sample_buf += qmf_bank->no_channels * ch_fac;
684
685
654k
    filter_states -= qmf_bank->no_channels;
686
654k
    if (filter_states < qmf_bank->anal_filter_states) {
687
67.2k
      filter_states = qmf_bank->anal_filter_states +
688
67.2k
                      ((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
689
67.2k
    }
690
691
654k
    tmp = fp1;
692
654k
    fp1 = fp2;
693
654k
    fp2 = tmp;
694
654k
    if (audio_object_type != AOT_ER_AAC_ELD &&
695
0
        audio_object_type != AOT_ER_AAC_LD) {
696
0
      filter_1 += 64;
697
0
      filter_2 += 64;
698
654k
    } else {
699
654k
      filter_1 += qmf_bank->no_channels;
700
654k
      filter_2 += qmf_bank->no_channels;
701
654k
    }
702
703
654k
    filt_ptr = filter_1;
704
654k
    filter_1 = filter_2;
705
654k
    filter_2 = filt_ptr;
706
654k
    if (audio_object_type != AOT_ER_AAC_ELD &&
707
0
        audio_object_type != AOT_ER_AAC_LD) {
708
0
      if (filter_2 > (qmf_bank->analy_win_coeff + 640)) {
709
0
        filter_1 = (WORD16 *)qmf_bank->analy_win_coeff;
710
0
        filter_2 = (WORD16 *)qmf_bank->analy_win_coeff + 64;
711
0
      }
712
654k
    } else {
713
654k
      if (filter_2 >
714
654k
          (qmf_bank->analy_win_coeff + (qmf_bank->no_channels * 10))) {
715
63.5k
        filter_1 = (WORD16 *)qmf_bank->analy_win_coeff;
716
63.5k
        filter_2 = (WORD16 *)qmf_bank->analy_win_coeff + qmf_bank->no_channels;
717
63.5k
      }
718
654k
    }
719
720
654k
    if (!low_pow_flag) {
721
654k
      ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i],
722
654k
                              qmf_bank, qmf_dec_tables_ptr, 0);
723
654k
    } else {
724
0
      ixheaacd_dct3_32(
725
0
          (WORD32 *)analysis_buffer, qmf_real[i], qmf_dec_tables_ptr->dct23_tw,
726
0
          qmf_dec_tables_ptr->post_fft_tbl, qmf_dec_tables_ptr->w_16,
727
0
          qmf_dec_tables_ptr->dig_rev_table4_16);
728
0
    }
729
654k
  }
730
731
41.8k
  qmf_bank->filter_pos = filter_1;
732
41.8k
  qmf_bank->core_samples_buffer = filter_states;
733
734
41.8k
  if (audio_object_type == AOT_ER_AAC_ELD || audio_object_type == AOT_ER_AAC_LD)
735
736
41.8k
  {
737
41.8k
    qmf_bank->fp1_anal = fp1;
738
41.8k
    qmf_bank->fp2_anal = fp2;
739
41.8k
    qmf_bank->filter_2 = filter_2;
740
41.8k
  }
741
41.8k
}
742
743
VOID ixheaacd_cplx_anal_qmffilt_32(const WORD32 *time_sample_buf,
744
                                   ia_sbr_scale_fact_struct *sbr_scale_factor,
745
                                   WORD32 **qmf_real, WORD32 **qmf_imag,
746
                                   ia_sbr_qmf_filter_bank_struct *qmf_bank,
747
                                   ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
748
4.25k
                                   WORD32 ch_fac, WORD32 ldsbr_present) {
749
4.25k
  WORD32 i, k;
750
4.25k
  WORD32 num_time_slots = qmf_bank->num_time_slots;
751
752
4.25k
  WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS];
753
4.25k
  WORD32 *filter_states = qmf_bank->core_samples_buffer_32;
754
755
4.25k
  WORD32 *fp1, *fp2, *tmp;
756
757
4.25k
  WORD32 *filter_1;
758
4.25k
  WORD32 *filter_2;
759
4.25k
  WORD32 *filt_ptr;
760
4.25k
  WORD32 start_slot = 2;
761
762
4.25k
  if (ldsbr_present) {
763
4.14k
    qmf_bank->filter_pos_32 +=
764
4.14k
        (qmf_dec_tables_ptr->qmf_c_ldsbr_mps - qmf_bank->analy_win_coeff_32);
765
4.14k
    qmf_bank->analy_win_coeff_32 = qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
766
4.14k
  } else {
767
107
    qmf_bank->filter_pos_32 += (ixheaacd_ldmps_polyphase_filter_coeff_fix -
768
107
                                qmf_bank->analy_win_coeff_32);
769
107
    qmf_bank->analy_win_coeff_32 =
770
107
        (WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
771
107
  }
772
773
4.25k
  filter_1 = qmf_bank->filter_pos_32;
774
4.25k
  filter_2 = filter_1 + qmf_bank->no_channels;
775
776
4.25k
  sbr_scale_factor->st_lb_scale = 0;
777
4.25k
  sbr_scale_factor->lb_scale = -10;
778
779
4.25k
  sbr_scale_factor->lb_scale = -9;
780
4.25k
  if (qmf_bank->no_channels != 64) {
781
4.22k
    qmf_bank->cos_twiddle =
782
4.22k
        (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
783
4.22k
    qmf_bank->alt_sin_twiddle =
784
4.22k
        (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
785
4.22k
  } else {
786
27
    qmf_bank->cos_twiddle =
787
27
        (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
788
27
    qmf_bank->alt_sin_twiddle =
789
27
        (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
790
27
  }
791
4.25k
  qmf_bank->t_cos =
792
4.25k
      (WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
793
794
4.25k
  fp1 = qmf_bank->anal_filter_states_32;
795
4.25k
  fp2 = qmf_bank->anal_filter_states_32 + qmf_bank->no_channels;
796
797
4.25k
  filter_2 = qmf_bank->filter_2_32;
798
4.25k
  fp1 = qmf_bank->fp1_anal_32;
799
4.25k
  fp2 = qmf_bank->fp2_anal_32;
800
801
71.1k
  for (i = start_slot; i < num_time_slots + start_slot; i++) {
802
2.21M
    for (k = 0; k < qmf_bank->no_channels; k++)
803
2.15M
      filter_states[qmf_bank->no_channels - 1 - k] =
804
2.15M
          time_sample_buf[ch_fac * k];
805
806
66.9k
    if (ldsbr_present) {
807
65.6k
      ixheaacd_sbr_qmfanal32_winadd_eld_32(fp1, fp2, filter_1, filter_2,
808
65.6k
                                           analysis_buffer);
809
65.6k
    } else {
810
1.26k
      ixheaacd_sbr_qmfanal32_winadd_eld_mps(fp1, fp2, filter_1, filter_2,
811
1.26k
                                            analysis_buffer);
812
1.26k
    }
813
814
66.9k
    time_sample_buf += qmf_bank->no_channels * ch_fac;
815
816
66.9k
    filter_states -= qmf_bank->no_channels;
817
818
66.9k
    if (filter_states < qmf_bank->anal_filter_states_32) {
819
7.11k
      filter_states = qmf_bank->anal_filter_states_32 +
820
7.11k
                      ((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
821
7.11k
    }
822
823
66.9k
    tmp = fp1;
824
66.9k
    fp1 = fp2;
825
66.9k
    fp2 = tmp;
826
827
66.9k
    filter_1 += qmf_bank->no_channels;
828
66.9k
    filter_2 += qmf_bank->no_channels;
829
830
66.9k
    filt_ptr = filter_1;
831
66.9k
    filter_1 = filter_2;
832
66.9k
    filter_2 = filt_ptr;
833
834
66.9k
    if (filter_2 >
835
66.9k
        (qmf_bank->analy_win_coeff_32 + (qmf_bank->no_channels * 10))) {
836
6.22k
      filter_1 = (WORD32 *)qmf_bank->analy_win_coeff_32;
837
6.22k
      filter_2 = (WORD32 *)qmf_bank->analy_win_coeff_32 + qmf_bank->no_channels;
838
6.22k
    }
839
840
66.9k
    ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i], qmf_bank,
841
66.9k
                            qmf_dec_tables_ptr, 1);
842
66.9k
  }
843
844
4.25k
  qmf_bank->filter_pos_32 = filter_1;
845
4.25k
  qmf_bank->core_samples_buffer_32 = filter_states;
846
847
4.25k
  qmf_bank->fp1_anal_32 = fp1;
848
4.25k
  qmf_bank->fp2_anal_32 = fp2;
849
4.25k
  qmf_bank->filter_2_32 = filter_2;
850
4.25k
}
851
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
852
                                ia_sbr_qmf_filter_bank_struct *syn_qmf,
853
0
                                ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
854
0
  WORD32 L = syn_qmf->no_channels;
855
0
  const WORD32 M = (L >> 1);
856
0
  WORD32 *dct_in = qmf_real;
857
0
  WORD32 time_out[2 * NO_SYNTHESIS_CHANNELS];
858
859
0
  WORD32 *ptime_out = &time_out[0];
860
861
0
  if (L == 64)
862
0
    ixheaacd_dct2_64(dct_in, ptime_out, qmf_dec_tables_ptr, filter_states + M);
863
0
  else
864
0
    ixheaacd_dct2_32(dct_in, time_out, qmf_dec_tables_ptr, filter_states);
865
866
0
  filter_states[3 * M] = 0;
867
0
}
868
869
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
870
                              ia_sbr_qmf_filter_bank_struct *syn_qmf,
871
720k
                              ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
872
720k
  if (syn_qmf->no_channels == 64)
873
232k
    ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_32,
874
232k
                         qmf_dec_tables_ptr->dig_rev_table2_32);
875
488k
  else
876
488k
    ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_16,
877
488k
                         qmf_dec_tables_ptr->dig_rev_table4_16);
878
720k
}
879
880
VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
881
29.5M
                              WORD32 index) {
882
29.5M
  int i;
883
29.5M
  WORD32 l1, l2, h2, fft_jmp;
884
29.5M
  WORD32 xt0_0, yt0_0, xt1_0, yt1_0, xt2_0, yt2_0;
885
29.5M
  WORD32 xh0_0, xh1_0, xh20_0, xh21_0, xl0_0, xl1_0, xl20_0, xl21_0;
886
29.5M
  WORD32 x_0, x_1, x_l1_0, x_l1_1, x_l2_0, x_l2_1;
887
29.5M
  WORD32 x_h2_0, x_h2_1;
888
29.5M
  WORD32 si10, si20, si30, co10, co20, co30;
889
890
29.5M
  WORD64 mul_1, mul_2, mul_3, mul_4, mul_5, mul_6;
891
29.5M
  WORD64 mul_7, mul_8, mul_9, mul_10, mul_11, mul_12;
892
29.5M
  const WORD32 *w_ptr = w;
893
29.5M
  WORD32 i1;
894
895
29.5M
  h2 = index << 1;
896
29.5M
  l1 = index << 2;
897
29.5M
  l2 = (index << 2) + (index << 1);
898
899
29.5M
  fft_jmp = 6 * (index);
900
901
83.5M
  for (i1 = 0; i1 < index1; i1++) {
902
237M
    for (i = 0; i < index; i++) {
903
183M
      si10 = (*w_ptr++);
904
183M
      co10 = (*w_ptr++);
905
183M
      si20 = (*w_ptr++);
906
183M
      co20 = (*w_ptr++);
907
183M
      si30 = (*w_ptr++);
908
183M
      co30 = (*w_ptr++);
909
910
183M
      x_0 = x[0];
911
183M
      x_h2_0 = x[h2];
912
183M
      x_l1_0 = x[l1];
913
183M
      x_l2_0 = x[l2];
914
915
183M
      xh0_0 = ixheaac_add32_sat(x_0, x_l1_0);
916
183M
      xl0_0 = ixheaac_sub32_sat(x_0, x_l1_0);
917
918
183M
      xh20_0 = ixheaac_add32_sat(x_h2_0, x_l2_0);
919
183M
      xl20_0 = ixheaac_sub32_sat(x_h2_0, x_l2_0);
920
921
183M
      x[0] = ixheaac_add32_sat(xh0_0, xh20_0);
922
183M
      xt0_0 = ixheaac_sub32_sat(xh0_0, xh20_0);
923
924
183M
      x_1 = x[1];
925
183M
      x_h2_1 = x[h2 + 1];
926
183M
      x_l1_1 = x[l1 + 1];
927
183M
      x_l2_1 = x[l2 + 1];
928
929
183M
      xh1_0 = ixheaac_add32_sat(x_1, x_l1_1);
930
183M
      xl1_0 = ixheaac_sub32_sat(x_1, x_l1_1);
931
932
183M
      xh21_0 = ixheaac_add32_sat(x_h2_1, x_l2_1);
933
183M
      xl21_0 = ixheaac_sub32_sat(x_h2_1, x_l2_1);
934
935
183M
      x[1] = ixheaac_add32_sat(xh1_0, xh21_0);
936
183M
      yt0_0 = ixheaac_sub32_sat(xh1_0, xh21_0);
937
938
183M
      xt1_0 = ixheaac_add32_sat(xl0_0, xl21_0);
939
183M
      xt2_0 = ixheaac_sub32_sat(xl0_0, xl21_0);
940
941
183M
      yt2_0 = ixheaac_add32_sat(xl1_0, xl20_0);
942
183M
      yt1_0 = ixheaac_sub32_sat(xl1_0, xl20_0);
943
944
183M
      mul_11 = ixheaac_mult64(xt2_0, co30);
945
183M
      mul_3 = ixheaac_mult64(yt2_0, si30);
946
183M
      x[l2] = (WORD32)((mul_3 + mul_11) >> 32) << RADIXSHIFT;
947
948
183M
      mul_5 = ixheaac_mult64(xt2_0, si30);
949
183M
      mul_9 = ixheaac_mult64(yt2_0, co30);
950
183M
      x[l2 + 1] = (WORD32)((mul_9 - mul_5) >> 32) << RADIXSHIFT;
951
952
183M
      mul_12 = ixheaac_mult64(xt0_0, co20);
953
183M
      mul_2 = ixheaac_mult64(yt0_0, si20);
954
183M
      x[l1] = (WORD32)((mul_2 + mul_12) >> 32) << RADIXSHIFT;
955
956
183M
      mul_6 = ixheaac_mult64(xt0_0, si20);
957
183M
      mul_8 = ixheaac_mult64(yt0_0, co20);
958
183M
      x[l1 + 1] = (WORD32)((mul_8 - mul_6) >> 32) << RADIXSHIFT;
959
960
183M
      mul_4 = ixheaac_mult64(xt1_0, co10);
961
183M
      mul_1 = ixheaac_mult64(yt1_0, si10);
962
183M
      x[h2] = (WORD32)((mul_1 + mul_4) >> 32) << RADIXSHIFT;
963
964
183M
      mul_10 = ixheaac_mult64(xt1_0, si10);
965
183M
      mul_7 = ixheaac_mult64(yt1_0, co10);
966
183M
      x[h2 + 1] = (WORD32)((mul_7 - mul_10) >> 32) << RADIXSHIFT;
967
968
183M
      x += 2;
969
183M
    }
970
54.0M
    x += fft_jmp;
971
54.0M
    w_ptr = w_ptr - fft_jmp;
972
54.0M
  }
973
29.5M
}
974
975
VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
976
                                     const WORD32 *pdig_rev_tbl,
977
8.17M
                                     WORD32 npoints) {
978
8.17M
  WORD32 i, k;
979
8.17M
  WORD32 h2;
980
8.17M
  WORD32 x_0, x_1, x_2, x_3;
981
8.17M
  WORD32 x_4, x_5, x_6, x_7;
982
8.17M
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
983
8.17M
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
984
8.17M
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
985
8.17M
  WORD32 *x2, *x0;
986
8.17M
  WORD32 *y0, *y1, *y2, *y3;
987
988
8.17M
  y0 = ptr_y;
989
8.17M
  y2 = ptr_y + (WORD32)npoints;
990
8.17M
  x0 = ptr_x;
991
8.17M
  x2 = ptr_x + (WORD32)(npoints >> 1);
992
993
8.17M
  y1 = y0 + (WORD32)(npoints >> 2);
994
8.17M
  y3 = y2 + (WORD32)(npoints >> 2);
995
996
24.5M
  for (k = 0; k < 2; k++) {
997
49.0M
    for (i = 0; i<npoints>> 1; i += 8) {
998
32.7M
      h2 = *pdig_rev_tbl++ >> 2;
999
1000
32.7M
      x_0 = *x0++;
1001
32.7M
      x_1 = *x0++;
1002
32.7M
      x_2 = *x0++;
1003
32.7M
      x_3 = *x0++;
1004
32.7M
      x_4 = *x0++;
1005
32.7M
      x_5 = *x0++;
1006
32.7M
      x_6 = *x0++;
1007
32.7M
      x_7 = *x0++;
1008
1009
32.7M
      n00 = ixheaac_add32_sat(x_0, x_2);
1010
32.7M
      n01 = ixheaac_add32_sat(x_1, x_3);
1011
32.7M
      n20 = ixheaac_sub32_sat(x_0, x_2);
1012
32.7M
      n21 = ixheaac_sub32_sat(x_1, x_3);
1013
32.7M
      n10 = ixheaac_add32_sat(x_4, x_6);
1014
32.7M
      n11 = ixheaac_add32_sat(x_5, x_7);
1015
32.7M
      n30 = ixheaac_sub32_sat(x_4, x_6);
1016
32.7M
      n31 = ixheaac_sub32_sat(x_5, x_7);
1017
1018
32.7M
      y0[h2] = n00;
1019
32.7M
      y0[h2 + 1] = n01;
1020
32.7M
      y1[h2] = n10;
1021
32.7M
      y1[h2 + 1] = n11;
1022
32.7M
      y2[h2] = n20;
1023
32.7M
      y2[h2 + 1] = n21;
1024
32.7M
      y3[h2] = n30;
1025
32.7M
      y3[h2 + 1] = n31;
1026
1027
32.7M
      x_8 = *x2++;
1028
32.7M
      x_9 = *x2++;
1029
32.7M
      x_a = *x2++;
1030
32.7M
      x_b = *x2++;
1031
32.7M
      x_c = *x2++;
1032
32.7M
      x_d = *x2++;
1033
32.7M
      x_e = *x2++;
1034
32.7M
      x_f = *x2++;
1035
1036
32.7M
      n02 = ixheaac_add32_sat(x_8, x_a);
1037
32.7M
      n03 = ixheaac_add32_sat(x_9, x_b);
1038
32.7M
      n22 = ixheaac_sub32_sat(x_8, x_a);
1039
32.7M
      n23 = ixheaac_sub32_sat(x_9, x_b);
1040
32.7M
      n12 = ixheaac_add32_sat(x_c, x_e);
1041
32.7M
      n13 = ixheaac_add32_sat(x_d, x_f);
1042
32.7M
      n32 = ixheaac_sub32_sat(x_c, x_e);
1043
32.7M
      n33 = ixheaac_sub32_sat(x_d, x_f);
1044
1045
32.7M
      y0[h2 + 2] = n02;
1046
32.7M
      y0[h2 + 3] = n03;
1047
32.7M
      y1[h2 + 2] = n12;
1048
32.7M
      y1[h2 + 3] = n13;
1049
32.7M
      y2[h2 + 2] = n22;
1050
32.7M
      y2[h2 + 3] = n23;
1051
32.7M
      y3[h2 + 2] = n32;
1052
32.7M
      y3[h2 + 3] = n33;
1053
32.7M
    }
1054
16.3M
    x0 += (WORD32)npoints >> 1;
1055
16.3M
    x2 += (WORD32)npoints >> 1;
1056
16.3M
  }
1057
8.17M
}
1058
1059
VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
1060
                                     const WORD32 *p_dig_rev_tbl,
1061
13.1M
                                     WORD32 npoints) {
1062
13.1M
  WORD32 i, k;
1063
13.1M
  WORD32 h2;
1064
13.1M
  WORD32 xh0_0, xh1_0, xl0_0, xl1_0;
1065
13.1M
  WORD32 xh0_1, xh1_1, xl0_1, xl1_1;
1066
13.1M
  WORD32 x_0, x_1, x_2, x_3;
1067
13.1M
  WORD32 xh0_2, xh1_2, xl0_2, xl1_2, xh0_3, xh1_3, xl0_3, xl1_3;
1068
13.1M
  WORD32 x_4, x_5, x_6, x_7;
1069
13.1M
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
1070
13.1M
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
1071
13.1M
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
1072
13.1M
  WORD32 *x2, *x0;
1073
13.1M
  WORD32 *y0, *y1, *y2, *y3;
1074
1075
13.1M
  y0 = ptr_y;
1076
13.1M
  y2 = ptr_y + (WORD32)npoints;
1077
13.1M
  x0 = ptr_x;
1078
13.1M
  x2 = ptr_x + (WORD32)(npoints >> 1);
1079
1080
13.1M
  y1 = y0 + (WORD32)(npoints >> 1);
1081
13.1M
  y3 = y2 + (WORD32)(npoints >> 1);
1082
1083
39.5M
  for (k = 0; k < 2; k++) {
1084
52.6M
    for (i = 0; i<npoints>> 1; i += 8) {
1085
26.3M
      h2 = *p_dig_rev_tbl++ >> 2;
1086
26.3M
      x_0 = *x0++;
1087
26.3M
      x_1 = *x0++;
1088
26.3M
      x_2 = *x0++;
1089
26.3M
      x_3 = *x0++;
1090
26.3M
      x_4 = *x0++;
1091
26.3M
      x_5 = *x0++;
1092
26.3M
      x_6 = *x0++;
1093
26.3M
      x_7 = *x0++;
1094
1095
26.3M
      xh0_0 = ixheaac_add32_sat(x_0, x_4);
1096
26.3M
      xh1_0 = ixheaac_add32_sat(x_1, x_5);
1097
26.3M
      xl0_0 = ixheaac_sub32_sat(x_0, x_4);
1098
26.3M
      xl1_0 = ixheaac_sub32_sat(x_1, x_5);
1099
26.3M
      xh0_1 = ixheaac_add32_sat(x_2, x_6);
1100
26.3M
      xh1_1 = ixheaac_add32_sat(x_3, x_7);
1101
26.3M
      xl0_1 = ixheaac_sub32_sat(x_2, x_6);
1102
26.3M
      xl1_1 = ixheaac_sub32_sat(x_3, x_7);
1103
1104
26.3M
      n00 = ixheaac_add32_sat(xh0_0, xh0_1);
1105
26.3M
      n01 = ixheaac_add32_sat(xh1_0, xh1_1);
1106
26.3M
      n10 = ixheaac_add32_sat(xl0_0, xl1_1);
1107
26.3M
      n11 = ixheaac_sub32_sat(xl1_0, xl0_1);
1108
26.3M
      n20 = ixheaac_sub32_sat(xh0_0, xh0_1);
1109
26.3M
      n21 = ixheaac_sub32_sat(xh1_0, xh1_1);
1110
26.3M
      n30 = ixheaac_sub32_sat(xl0_0, xl1_1);
1111
26.3M
      n31 = ixheaac_add32_sat(xl1_0, xl0_1);
1112
1113
26.3M
      y0[h2] = n00;
1114
26.3M
      y0[h2 + 1] = n01;
1115
26.3M
      y1[h2] = n10;
1116
26.3M
      y1[h2 + 1] = n11;
1117
26.3M
      y2[h2] = n20;
1118
26.3M
      y2[h2 + 1] = n21;
1119
26.3M
      y3[h2] = n30;
1120
26.3M
      y3[h2 + 1] = n31;
1121
1122
26.3M
      x_8 = *x2++;
1123
26.3M
      x_9 = *x2++;
1124
26.3M
      x_a = *x2++;
1125
26.3M
      x_b = *x2++;
1126
26.3M
      x_c = *x2++;
1127
26.3M
      x_d = *x2++;
1128
26.3M
      x_e = *x2++;
1129
26.3M
      x_f = *x2++;
1130
1131
26.3M
      xh0_2 = ixheaac_add32_sat(x_8, x_c);
1132
26.3M
      xh1_2 = ixheaac_add32_sat(x_9, x_d);
1133
26.3M
      xl0_2 = ixheaac_sub32_sat(x_8, x_c);
1134
26.3M
      xl1_2 = ixheaac_sub32_sat(x_9, x_d);
1135
26.3M
      xh0_3 = ixheaac_add32_sat(x_a, x_e);
1136
26.3M
      xh1_3 = ixheaac_add32_sat(x_b, x_f);
1137
26.3M
      xl0_3 = ixheaac_sub32_sat(x_a, x_e);
1138
26.3M
      xl1_3 = ixheaac_sub32_sat(x_b, x_f);
1139
1140
26.3M
      n02 = ixheaac_add32_sat(xh0_2, xh0_3);
1141
26.3M
      n03 = ixheaac_add32_sat(xh1_2, xh1_3);
1142
26.3M
      n12 = ixheaac_add32_sat(xl0_2, xl1_3);
1143
26.3M
      n13 = ixheaac_sub32_sat(xl1_2, xl0_3);
1144
26.3M
      n22 = ixheaac_sub32_sat(xh0_2, xh0_3);
1145
26.3M
      n23 = ixheaac_sub32_sat(xh1_2, xh1_3);
1146
26.3M
      n32 = ixheaac_sub32_sat(xl0_2, xl1_3);
1147
26.3M
      n33 = ixheaac_add32_sat(xl1_2, xl0_3);
1148
1149
26.3M
      y0[h2 + 2] = n02;
1150
26.3M
      y0[h2 + 3] = n03;
1151
26.3M
      y1[h2 + 2] = n12;
1152
26.3M
      y1[h2 + 3] = n13;
1153
26.3M
      y2[h2 + 2] = n22;
1154
26.3M
      y2[h2 + 3] = n23;
1155
26.3M
      y3[h2 + 2] = n32;
1156
26.3M
      y3[h2 + 3] = n33;
1157
26.3M
    }
1158
26.3M
    x0 += (WORD32)npoints >> 1;
1159
26.3M
    x2 += (WORD32)npoints >> 1;
1160
26.3M
  }
1161
13.1M
}
1162
1163
VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
1164
                               ia_sbr_qmf_filter_bank_struct *qmf_bank,
1165
13.0M
                               WORD32 *p_twiddle, WORD32 *p_dig_rev_tbl) {
1166
13.0M
  WORD32 z;
1167
13.0M
  WORD32 temp[128];
1168
13.0M
  WORD32 scaleshift = 0;
1169
1170
13.0M
  WORD32 re2, re3;
1171
13.0M
  WORD32 wim, wre;
1172
1173
13.0M
  WORD32 i, M_2;
1174
13.0M
  WORD32 M = ixheaac_shr32(qmf_bank->no_channels, 1);
1175
1176
13.0M
  const WORD32 *p_sin;
1177
13.0M
  const WORD32 *p_sin_cos;
1178
1179
13.0M
  WORD32 subband_tmp[128];
1180
13.0M
  WORD32 re;
1181
13.0M
  WORD32 im;
1182
13.0M
  WORD32 *psubband, *psubband1;
1183
13.0M
  WORD32 *psubband_t, *psubband1_t;
1184
13.0M
  WORD32 *psubband2, *psubband12;
1185
13.0M
  WORD32 *psubband_t2, *psubband1_t2;
1186
1187
13.0M
  M_2 = ixheaac_shr32(M, 1);
1188
1189
13.0M
  p_sin_cos = qmf_bank->esbr_cos_twiddle;
1190
1191
13.0M
  psubband = &subband[0];
1192
13.0M
  psubband1 = &subband[2 * M - 1];
1193
13.0M
  psubband_t = subband_tmp;
1194
13.0M
  psubband1_t = &subband_tmp[2 * M - 1];
1195
1196
13.0M
  psubband2 = &subband[64];
1197
13.0M
  psubband12 = &subband[2 * M - 1 + 64];
1198
13.0M
  psubband_t2 = &subband_tmp[64];
1199
13.0M
  psubband1_t2 = &subband_tmp[2 * M - 1 + 64];
1200
1201
77.8M
  for (i = (M_2 >> 1) - 1; i >= 0; i--) {
1202
64.7M
    re = *psubband++;
1203
64.7M
    im = *psubband1--;
1204
1205
64.7M
    wim = *p_sin_cos++;
1206
64.7M
    wre = *p_sin_cos++;
1207
1208
64.7M
    *psubband_t++ = (WORD32)(
1209
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1210
64.7M
        32);
1211
64.7M
    *psubband_t++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1212
64.7M
                                                 ixheaac_mult64(re, wim))) >>
1213
64.7M
                             32);
1214
1215
64.7M
    re = *psubband2++;
1216
64.7M
    im = *psubband12--;
1217
1218
64.7M
    *psubband_t2++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1219
64.7M
                                                  ixheaac_mult64(re, wre))) >>
1220
64.7M
                              32);
1221
64.7M
    *psubband_t2++ = (WORD32)(
1222
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1223
64.7M
        32);
1224
1225
64.7M
    re = *psubband1--;
1226
64.7M
    im = *psubband++;
1227
1228
64.7M
    wim = *p_sin_cos++;
1229
64.7M
    wre = *p_sin_cos++;
1230
1231
64.7M
    *psubband1_t-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1232
64.7M
                                                  ixheaac_mult64(re, wim))) >>
1233
64.7M
                              32);
1234
64.7M
    *psubband1_t-- = (WORD32)(
1235
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1236
64.7M
        32);
1237
1238
64.7M
    re = *psubband12--;
1239
64.7M
    im = *psubband2++;
1240
1241
64.7M
    *psubband1_t2-- = (WORD32)(
1242
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1243
64.7M
        32);
1244
64.7M
    *psubband1_t2-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1245
64.7M
                                                   ixheaac_mult64(re, wre))) >>
1246
64.7M
                               32);
1247
1248
64.7M
    re = *psubband++;
1249
64.7M
    im = *psubband1--;
1250
1251
64.7M
    wim = *p_sin_cos++;
1252
64.7M
    wre = *p_sin_cos++;
1253
1254
64.7M
    *psubband_t++ = (WORD32)(
1255
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1256
64.7M
        32);
1257
64.7M
    *psubband_t++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1258
64.7M
                                                 ixheaac_mult64(re, wim))) >>
1259
64.7M
                             32);
1260
1261
64.7M
    re = *psubband2++;
1262
64.7M
    im = *psubband12--;
1263
1264
64.7M
    *psubband_t2++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1265
64.7M
                                                  ixheaac_mult64(re, wre))) >>
1266
64.7M
                              32);
1267
64.7M
    *psubband_t2++ = (WORD32)(
1268
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1269
64.7M
        32);
1270
1271
64.7M
    re = *psubband1--;
1272
64.7M
    im = *psubband++;
1273
1274
64.7M
    wim = *p_sin_cos++;
1275
64.7M
    wre = *p_sin_cos++;
1276
1277
64.7M
    *psubband1_t-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1278
64.7M
                                                  ixheaac_mult64(re, wim))) >>
1279
64.7M
                              32);
1280
64.7M
    *psubband1_t-- = (WORD32)(
1281
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1282
64.7M
        32);
1283
1284
64.7M
    re = *psubband12--;
1285
64.7M
    im = *psubband2++;
1286
1287
64.7M
    *psubband1_t2-- = (WORD32)(
1288
64.7M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1289
64.7M
        32);
1290
64.7M
    *psubband1_t2-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1291
64.7M
                                                   ixheaac_mult64(re, wre))) >>
1292
64.7M
                               32);
1293
64.7M
  }
1294
1295
13.0M
  if (M == 32) {
1296
4.08M
    ixheaacd_esbr_radix4bfly(p_twiddle, subband_tmp, 1, 8);
1297
4.08M
    ixheaacd_esbr_radix4bfly(p_twiddle + 48, subband_tmp, 4, 2);
1298
4.08M
    ixheaacd_esbr_postradixcompute2(subband, subband_tmp, p_dig_rev_tbl, 32);
1299
1300
4.08M
    ixheaacd_esbr_radix4bfly(p_twiddle, &subband_tmp[64], 1, 8);
1301
4.08M
    ixheaacd_esbr_radix4bfly(p_twiddle + 48, &subband_tmp[64], 4, 2);
1302
4.08M
    ixheaacd_esbr_postradixcompute2(&subband[64], &subband_tmp[64],
1303
4.08M
                                    p_dig_rev_tbl, 32);
1304
1305
4.08M
  }
1306
1307
8.99M
  else if (M == 16) {
1308
6.58M
    ixheaacd_esbr_radix4bfly(p_twiddle, subband_tmp, 1, 4);
1309
6.58M
    ixheaacd_esbr_postradixcompute4(subband, subband_tmp, p_dig_rev_tbl, 16);
1310
1311
6.58M
    ixheaacd_esbr_radix4bfly(p_twiddle, &subband_tmp[64], 1, 4);
1312
6.58M
    ixheaacd_esbr_postradixcompute4(&subband[64], &subband_tmp[64],
1313
6.58M
                                    p_dig_rev_tbl, 16);
1314
1315
6.58M
  }
1316
1317
2.40M
  else if (M == 12) {
1318
11.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1319
10.3M
      temp[z] = subband_tmp[2 * z];
1320
10.3M
      temp[12 + z] = subband_tmp[2 * z + 1];
1321
10.3M
    }
1322
1323
862k
    ixheaacd_complex_fft_p3(temp, &temp[12], 12, -1, &scaleshift);
1324
1325
11.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1326
10.3M
      subband[2 * z] = temp[z];
1327
10.3M
      subband[2 * z + 1] = temp[z + 12];
1328
10.3M
    }
1329
862k
    scaleshift = 0;
1330
11.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1331
10.3M
      temp[z] = subband_tmp[64 + 2 * z];
1332
10.3M
      temp[12 + z] = subband_tmp[64 + 2 * z + 1];
1333
10.3M
    }
1334
1335
862k
    ixheaacd_complex_fft_p3(temp, &temp[12], 12, -1, &scaleshift);
1336
1337
11.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1338
10.3M
      subband[64 + 2 * z] = temp[z];
1339
10.3M
      subband[64 + 2 * z + 1] = temp[z + 12];
1340
10.3M
    }
1341
1342
862k
  }
1343
1344
1.54M
  else {
1345
13.9M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1346
12.3M
      temp[z] = subband_tmp[2 * z];
1347
12.3M
      temp[8 + z] = subband_tmp[2 * z + 1];
1348
12.3M
    }
1349
1350
1.54M
    (*ixheaacd_complex_fft_p2)(temp, &temp[8], 8, -1, &scaleshift);
1351
1352
13.9M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1353
12.3M
      subband[2 * z] = temp[z] << scaleshift;
1354
12.3M
      subband[2 * z + 1] = temp[z + 8] << scaleshift;
1355
12.3M
    }
1356
1.54M
    scaleshift = 0;
1357
13.9M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1358
12.3M
      temp[z] = subband_tmp[64 + 2 * z];
1359
12.3M
      temp[8 + z] = subband_tmp[64 + 2 * z + 1];
1360
12.3M
    }
1361
1362
1.54M
    (*ixheaacd_complex_fft_p2)(temp, &temp[8], 8, -1, &scaleshift);
1363
1364
13.9M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1365
12.3M
      subband[64 + 2 * z] = temp[z] << scaleshift;
1366
12.3M
      subband[64 + 2 * z + 1] = temp[8 + z] << scaleshift;
1367
12.3M
    }
1368
1.54M
  }
1369
1370
13.0M
  psubband = &subband[0];
1371
13.0M
  psubband1 = &subband[2 * M - 1];
1372
1373
13.0M
  re = *psubband1;
1374
1375
13.0M
  *psubband = *psubband >> 1;
1376
13.0M
  psubband++;
1377
13.0M
  *psubband1 = ixheaac_negate32_sat(*psubband >> 1);
1378
13.0M
  psubband1--;
1379
1380
13.0M
  p_sin = qmf_bank->esbr_alt_sin_twiddle;
1381
1382
13.0M
  wim = *p_sin++;
1383
13.0M
  wre = *p_sin++;
1384
1385
13.0M
  im = *psubband1;
1386
1387
13.0M
  *psubband1-- = (WORD32)(
1388
13.0M
      (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1389
13.0M
      32);
1390
13.0M
  *psubband++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1391
13.0M
                                             ixheaac_mult64(re, wim))) >>
1392
13.0M
                         32);
1393
1394
13.0M
  psubband2 = &subband[64];
1395
13.0M
  psubband12 = &subband[2 * M - 1 + 64];
1396
1397
13.0M
  re = *psubband12;
1398
1399
13.0M
  *psubband12-- = ixheaac_negate32_sat(*psubband2 >> 1);
1400
1401
13.0M
  *psubband2 = psubband2[1] >> 1;
1402
1403
13.0M
  psubband2++;
1404
1405
13.0M
  im = *psubband12;
1406
1407
13.0M
  *psubband2++ = ixheaac_negate32_sat((WORD32)(
1408
13.0M
      (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1409
13.0M
      32));
1410
13.0M
  *psubband12-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(re, wim),
1411
13.0M
                                               ixheaac_mult64(im, wre))) >>
1412
13.0M
                           32);
1413
1414
129M
  for (i = (M_2 - 2); i >= 0; i--) {
1415
116M
    im = psubband[0];
1416
1417
116M
    re = psubband[1];
1418
1419
116M
    re2 = *psubband1;
1420
1421
116M
    *psubband++ = (WORD32)(
1422
116M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1423
116M
        32);
1424
116M
    *psubband1-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1425
116M
                                                ixheaac_mult64(re, wre))) >>
1426
116M
                            32);
1427
1428
116M
    im = psubband2[0];
1429
1430
116M
    re = psubband2[1];
1431
1432
116M
    re3 = *psubband12;
1433
1434
116M
    *psubband12-- = ixheaac_negate32_sat((WORD32)(
1435
116M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1436
116M
        32));
1437
116M
    *psubband2++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(re, wre),
1438
116M
                                                ixheaac_mult64(im, wim))) >>
1439
116M
                            32);
1440
1441
116M
    wim = *p_sin++;
1442
116M
    wre = *p_sin++;
1443
116M
    im = psubband1[0];
1444
1445
116M
    *psubband1-- = (WORD32)(
1446
116M
        (ixheaac_add64(ixheaac_mult64(re2, wre), ixheaac_mult64(im, wim))) >>
1447
116M
        32);
1448
116M
    *psubband++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1449
116M
                                               ixheaac_mult64(re2, wim))) >>
1450
116M
                           32);
1451
1452
116M
    im = psubband12[0];
1453
1454
116M
    *psubband2++ = ixheaac_negate32_sat((WORD32)(
1455
116M
        (ixheaac_add64(ixheaac_mult64(re3, wre), ixheaac_mult64(im, wim))) >>
1456
116M
        32));
1457
116M
    *psubband12-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(re3, wim),
1458
116M
                                                 ixheaac_mult64(im, wre))) >>
1459
116M
                             32);
1460
116M
  }
1461
13.0M
}
1462
1463
VOID ixheaacd_esbr_fwd_modulation(
1464
    const WORD32 *time_sample_buf, WORD32 *real_subband, WORD32 *imag_subband,
1465
    ia_sbr_qmf_filter_bank_struct *qmf_bank,
1466
8.98M
    ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
1467
8.98M
  WORD32 i;
1468
8.98M
  const WORD32 *time_sample_buf1 =
1469
8.98M
      &time_sample_buf[2 * qmf_bank->no_channels - 1];
1470
8.98M
  WORD32 temp1, temp2;
1471
8.98M
  WORD32 *t_real_subband = real_subband;
1472
8.98M
  WORD32 *t_imag_subband = imag_subband;
1473
8.98M
  const WORD32 *tcos;
1474
1475
264M
  for (i = qmf_bank->no_channels - 1; i >= 0; i--) {
1476
255M
    temp1 = ixheaac_shr32(*time_sample_buf++, HQ_SHIFT_64);
1477
255M
    temp2 = ixheaac_shr32(*time_sample_buf1--, HQ_SHIFT_64);
1478
1479
255M
    *t_real_subband++ = ixheaac_sub32_sat(temp1, temp2);
1480
1481
255M
    *t_imag_subband++ = ixheaac_add32_sat(temp1, temp2);
1482
255M
  }
1483
1484
8.98M
  ixheaacd_esbr_cos_sin_mod(real_subband, qmf_bank,
1485
8.98M
                            qmf_dec_tables_ptr->esbr_w_16,
1486
8.98M
                            qmf_dec_tables_ptr->dig_rev_table4_16);
1487
1488
8.98M
  tcos = qmf_bank->esbr_t_cos;
1489
1490
264M
  for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
1491
255M
    WORD32 cosh, sinh;
1492
255M
    WORD32 re, im;
1493
1494
255M
    re = *real_subband;
1495
255M
    im = *imag_subband;
1496
255M
    cosh = *tcos++;
1497
255M
    sinh = *tcos++;
1498
255M
    *real_subband++ = (WORD32)((ixheaac_add64(ixheaac_mult64(re, cosh),
1499
255M
                                               ixheaac_mult64(im, sinh))) >>
1500
255M
                               31);
1501
255M
    *imag_subband++ =
1502
255M
        (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, cosh),
1503
255M
                                     ixheaac_mult64(re, sinh))) >>
1504
255M
                 31);
1505
255M
  }
1506
8.98M
}
1507
1508
VOID ixheaacd_sbr_qmfsyn64_winadd(WORD16 *tmp1, WORD16 *tmp2, WORD16 *inp1,
1509
                                  WORD16 *sample_buffer, FLAG shift,
1510
232k
                                  WORD32 ch_fac) {
1511
232k
  WORD32 k;
1512
232k
  WORD32 rounding_fac = 0x8000;
1513
232k
  rounding_fac = rounding_fac >> shift;
1514
1515
15.0M
  for (k = 0; k < 64; k++) {
1516
14.8M
    WORD32 syn_out = rounding_fac;
1517
1518
14.8M
    syn_out = ixheaac_add32_sat(
1519
14.8M
        syn_out, ixheaac_mult16x16in32(tmp1[0 + k], inp1[k + 0]));
1520
14.8M
    syn_out = ixheaac_add32_sat(
1521
14.8M
        syn_out, ixheaac_mult16x16in32(tmp1[256 + k], inp1[k + 128]));
1522
14.8M
    syn_out = ixheaac_add32_sat(
1523
14.8M
        syn_out, ixheaac_mult16x16in32(tmp1[512 + k], inp1[k + 256]));
1524
14.8M
    syn_out = ixheaac_add32_sat(
1525
14.8M
        syn_out, ixheaac_mult16x16in32(tmp1[768 + k], inp1[k + 384]));
1526
14.8M
    syn_out = ixheaac_add32_sat(
1527
14.8M
        syn_out, ixheaac_mult16x16in32(tmp1[1024 + k], inp1[k + 512]));
1528
1529
14.8M
    syn_out = ixheaac_add32_sat(
1530
14.8M
        syn_out, ixheaac_mult16x16in32(tmp2[128 + k], inp1[k + 64]));
1531
14.8M
    syn_out = ixheaac_add32_sat(
1532
14.8M
        syn_out, ixheaac_mult16x16in32(tmp2[384 + k], inp1[k + 192]));
1533
14.8M
    syn_out = ixheaac_add32_sat(
1534
14.8M
        syn_out, ixheaac_mult16x16in32(tmp2[640 + k], inp1[k + 320]));
1535
14.8M
    syn_out = ixheaac_add32_sat(
1536
14.8M
        syn_out, ixheaac_mult16x16in32(tmp2[896 + k], inp1[k + 448]));
1537
14.8M
    syn_out = ixheaac_add32_sat(
1538
14.8M
        syn_out, ixheaac_mult16x16in32(tmp2[1152 + k], inp1[k + 576]));
1539
1540
14.8M
    sample_buffer[ch_fac * k] = (ixheaac_shl32_sat(syn_out, shift) >> 16);
1541
14.8M
  }
1542
232k
}
1543
1544
VOID ixheaacd_esbr_qmfsyn64_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1,
1545
4.08M
                                   WORD32 *sample_buffer, WORD32 ch_fac) {
1546
4.08M
  WORD32 k;
1547
1548
265M
  for (k = 0; k < 64; k++) {
1549
261M
    WORD64 syn_out = 0;
1550
1551
261M
    syn_out =
1552
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[0 + k], inp1[k + 0]));
1553
261M
    syn_out =
1554
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[256 + k], inp1[k + 128]));
1555
261M
    syn_out =
1556
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[512 + k], inp1[k + 256]));
1557
261M
    syn_out =
1558
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[768 + k], inp1[k + 384]));
1559
261M
    syn_out =
1560
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[1024 + k], inp1[k + 512]));
1561
1562
261M
    syn_out =
1563
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[128 + k], inp1[k + 64]));
1564
261M
    syn_out =
1565
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[384 + k], inp1[k + 192]));
1566
261M
    syn_out =
1567
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[640 + k], inp1[k + 320]));
1568
261M
    syn_out =
1569
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[896 + k], inp1[k + 448]));
1570
261M
    syn_out =
1571
261M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[1152 + k], inp1[k + 576]));
1572
1573
261M
    sample_buffer[ch_fac * k] = (WORD32)(syn_out >> 31);
1574
261M
  }
1575
4.08M
}
1576
1577
VOID ixheaacd_esbr_qmfsyn32_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1,
1578
7.20k
                                   WORD32 *sample_buffer, WORD32 ch_fac) {
1579
7.20k
  WORD32 k;
1580
1581
237k
  for (k = 0; k < 32; k++) {
1582
230k
    WORD64 syn_out = 0;
1583
1584
230k
    syn_out =
1585
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[0 + k], inp1[2 * (k + 0)]));
1586
230k
    syn_out =
1587
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[128 + k], inp1[2 * (k + 64)]));
1588
230k
    syn_out =
1589
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[256 + k], inp1[2 * (k + 128)]));
1590
230k
    syn_out =
1591
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[384 + k], inp1[2 * (k + 192)]));
1592
230k
    syn_out =
1593
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[512 + k], inp1[2 * (k + 256)]));
1594
1595
230k
    syn_out =
1596
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[64 + k], inp1[2 * (k + 32)]));
1597
230k
    syn_out =
1598
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[192 + k], inp1[2 * (k + 96)]));
1599
230k
    syn_out =
1600
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[320 + k], inp1[2 * (k + 160)]));
1601
230k
    syn_out =
1602
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[448 + k], inp1[2 * (k + 224)]));
1603
230k
    syn_out =
1604
230k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[576 + k], inp1[2 * (k + 288)]));
1605
1606
230k
    sample_buffer[ch_fac * k] = (WORD32)(syn_out >> 31);
1607
230k
  }
1608
7.20k
}
1609
1610
VOID ixheaacd_shiftrountine(WORD32 *qmf_real, WORD32 *qmf_imag, WORD32 len,
1611
0
                            WORD32 common_shift) {
1612
0
  WORD32 treal, timag;
1613
0
  WORD32 j;
1614
1615
0
  if (common_shift < 0) {
1616
0
    WORD32 cshift = -common_shift;
1617
0
    cshift = ixheaac_min32(cshift, 31);
1618
0
    for (j = len - 1; j >= 0; j--) {
1619
0
      treal = *qmf_real;
1620
0
      timag = *qmf_imag;
1621
1622
0
      treal = (ixheaac_shr32(treal, cshift));
1623
0
      timag = (ixheaac_shr32(timag, cshift));
1624
1625
0
      *qmf_real++ = treal;
1626
0
      *qmf_imag++ = timag;
1627
0
    }
1628
0
  } else {
1629
0
    for (j = len - 1; j >= 0; j--) {
1630
0
      treal = (ixheaac_shl32_sat(*qmf_real, common_shift));
1631
0
      timag = (ixheaac_shl32_sat(*qmf_imag, common_shift));
1632
0
      *qmf_real++ = treal;
1633
0
      *qmf_imag++ = timag;
1634
0
    }
1635
0
  }
1636
0
}
1637
1638
VOID ixheaacd_shiftrountine_with_rnd(WORD32 *qmf_real, WORD32 *qmf_imag,
1639
                                     WORD16 *filter_states, WORD32 len,
1640
0
                                     WORD32 shift) {
1641
0
  WORD16 *filter_states_rev = filter_states + len;
1642
0
  WORD32 treal, timag;
1643
0
  WORD32 j;
1644
1645
0
  for (j = (len - 1); j >= 0; j -= 2) {
1646
0
    WORD32 r1, r2, i1, i2;
1647
0
    i2 = qmf_imag[j];
1648
0
    r2 = qmf_real[j];
1649
1650
0
    r1 = *qmf_real++;
1651
0
    i1 = *qmf_imag++;
1652
1653
0
    timag = ixheaac_add32_sat(i1, r1);
1654
0
    timag = (ixheaac_shl32_sat(timag, shift));
1655
0
    filter_states_rev[j] = ixheaac_round16(timag);
1656
1657
0
    treal = ixheaac_sub32_sat(i2, r2);
1658
0
    treal = (ixheaac_shl32_sat(treal, shift));
1659
0
    filter_states[j] = ixheaac_round16(treal);
1660
1661
0
    treal = ixheaac_sub32_sat(i1, r1);
1662
0
    treal = (ixheaac_shl32_sat(treal, shift));
1663
0
    *filter_states++ = ixheaac_round16(treal);
1664
1665
0
    timag = ixheaac_add32_sat(i2, r2);
1666
0
    ;
1667
0
    timag = (ixheaac_shl32_sat(timag, shift));
1668
0
    *filter_states_rev++ = ixheaac_round16(timag);
1669
0
  }
1670
0
}
1671
1672
VOID ixheaacd_shiftrountine_with_rnd_eld(WORD32 *qmf_real, WORD32 *qmf_imag,
1673
                                         WORD16 *filter_states, WORD32 len,
1674
720k
                                         WORD32 shift) {
1675
720k
  WORD16 *filter_states_rev = filter_states + len;
1676
720k
  WORD32 treal, timag;
1677
720k
  WORD32 j;
1678
1679
15.9M
  for (j = (len - 1); j >= 0; j -= 2) {
1680
15.2M
    WORD32 r1, r2, i1, i2;
1681
15.2M
    i2 = qmf_imag[j];
1682
15.2M
    r2 = qmf_real[j];
1683
15.2M
    r1 = *qmf_real++;
1684
15.2M
    i1 = *qmf_imag++;
1685
1686
15.2M
    timag = ixheaac_negate32_sat(ixheaac_add32_sat(i1, r1));
1687
15.2M
    timag = (ixheaac_shl32_sat(timag, shift));
1688
15.2M
    filter_states_rev[j] = ixheaac_round16(timag);
1689
1690
15.2M
    treal = ixheaac_sub32_sat(r2, i2);
1691
15.2M
    treal = (ixheaac_shl32_sat(treal, shift));
1692
15.2M
    filter_states[j] = ixheaac_round16(treal);
1693
1694
15.2M
    treal = ixheaac_sub32_sat(r1, i1);
1695
15.2M
    treal = (ixheaac_shl32_sat(treal, shift));
1696
15.2M
    *filter_states++ = ixheaac_round16(treal);
1697
1698
15.2M
    timag = ixheaac_negate32_sat(ixheaac_add32_sat(i2, r2));
1699
15.2M
    timag = (ixheaac_shl32_sat(timag, shift));
1700
15.2M
    *filter_states_rev++ = ixheaac_round16(timag);
1701
15.2M
  }
1702
720k
}
1703
1704
VOID ixheaacd_shiftrountine_with_rnd_hq(WORD32 *qmf_real, WORD32 *qmf_imag,
1705
                                        WORD32 *filter_states, WORD32 len,
1706
4.09M
                                        WORD32 shift) {
1707
4.09M
  WORD32 *filter_states_rev = filter_states + len;
1708
4.09M
  WORD32 treal, timag;
1709
4.09M
  WORD32 j;
1710
1711
135M
  for (j = (len - 1); j >= 0; j -= 2) {
1712
130M
    WORD32 r1, r2, i1, i2;
1713
130M
    i2 = qmf_imag[j];
1714
130M
    r2 = qmf_real[j];
1715
130M
    r1 = *qmf_real++;
1716
130M
    i1 = *qmf_imag++;
1717
1718
130M
    timag = ixheaac_add32_sat(i1, r1);
1719
130M
    timag = (ixheaac_shl32_sat(timag, shift));
1720
130M
    filter_states_rev[j] = timag;
1721
1722
130M
    treal = ixheaac_sub32_sat(i2, r2);
1723
130M
    treal = (ixheaac_shl32_sat(treal, shift));
1724
130M
    filter_states[j] = treal;
1725
1726
130M
    treal = ixheaac_sub32_sat(i1, r1);
1727
130M
    treal = (ixheaac_shl32_sat(treal, shift));
1728
130M
    *filter_states++ = treal;
1729
1730
130M
    timag = ixheaac_add32_sat(i2, r2);
1731
130M
    timag = (ixheaac_shl32_sat(timag, shift));
1732
130M
    *filter_states_rev++ = timag;
1733
130M
  }
1734
4.09M
}
1735
1736
VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
1737
3.60M
                         WORD32 index) {
1738
3.60M
  int i;
1739
3.60M
  WORD32 l1, l2, h2, fft_jmp;
1740
3.60M
  WORD32 xt0_0, yt0_0, xt1_0, yt1_0, xt2_0, yt2_0;
1741
3.60M
  WORD32 xh0_0, xh1_0, xh20_0, xh21_0, xl0_0, xl1_0, xl20_0, xl21_0;
1742
3.60M
  WORD32 x_0, x_1, x_l1_0, x_l1_1, x_l2_0, x_l2_1;
1743
3.60M
  WORD32 x_h2_0, x_h2_1;
1744
3.60M
  WORD16 si10, si20, si30, co10, co20, co30;
1745
1746
3.60M
  WORD32 mul_1, mul_2, mul_3, mul_4, mul_5, mul_6;
1747
3.60M
  WORD32 mul_7, mul_8, mul_9, mul_10, mul_11, mul_12;
1748
3.60M
  const WORD16 *w_ptr = w;
1749
3.60M
  WORD32 i1;
1750
1751
3.60M
  h2 = index << 1;
1752
3.60M
  l1 = index << 2;
1753
3.60M
  l2 = (index << 2) + (index << 1);
1754
1755
3.60M
  fft_jmp = 6 * (index);
1756
1757
9.35M
  for (i1 = 0; i1 < index1; i1++) {
1758
25.8M
    for (i = 0; i < index; i++) {
1759
20.1M
      si10 = (*w_ptr++);
1760
20.1M
      co10 = (*w_ptr++);
1761
20.1M
      si20 = (*w_ptr++);
1762
20.1M
      co20 = (*w_ptr++);
1763
20.1M
      si30 = (*w_ptr++);
1764
20.1M
      co30 = (*w_ptr++);
1765
1766
20.1M
      x_0 = x[0];
1767
20.1M
      x_h2_0 = x[h2];
1768
20.1M
      x_l1_0 = x[l1];
1769
20.1M
      x_l2_0 = x[l2];
1770
1771
20.1M
      xh0_0 = ixheaac_add32_sat(x_0, x_l1_0);
1772
20.1M
      xl0_0 = ixheaac_sub32_sat(x_0, x_l1_0);
1773
1774
20.1M
      xh20_0 = ixheaac_add32_sat(x_h2_0, x_l2_0);
1775
20.1M
      xl20_0 = ixheaac_sub32_sat(x_h2_0, x_l2_0);
1776
1777
20.1M
      x[0] = ixheaac_add32_sat(xh0_0, xh20_0);
1778
20.1M
      xt0_0 = ixheaac_sub32_sat(xh0_0, xh20_0);
1779
1780
20.1M
      x_1 = x[1];
1781
20.1M
      x_h2_1 = x[h2 + 1];
1782
20.1M
      x_l1_1 = x[l1 + 1];
1783
20.1M
      x_l2_1 = x[l2 + 1];
1784
1785
20.1M
      xh1_0 = ixheaac_add32_sat(x_1, x_l1_1);
1786
20.1M
      xl1_0 = ixheaac_sub32_sat(x_1, x_l1_1);
1787
1788
20.1M
      xh21_0 = ixheaac_add32_sat(x_h2_1, x_l2_1);
1789
20.1M
      xl21_0 = ixheaac_sub32_sat(x_h2_1, x_l2_1);
1790
1791
20.1M
      x[1] = ixheaac_add32_sat(xh1_0, xh21_0);
1792
20.1M
      yt0_0 = ixheaac_sub32_sat(xh1_0, xh21_0);
1793
1794
20.1M
      xt1_0 = ixheaac_add32_sat(xl0_0, xl21_0);
1795
20.1M
      xt2_0 = ixheaac_sub32_sat(xl0_0, xl21_0);
1796
1797
20.1M
      yt2_0 = ixheaac_add32_sat(xl1_0, xl20_0);
1798
20.1M
      yt1_0 = ixheaac_sub32_sat(xl1_0, xl20_0);
1799
1800
20.1M
      mul_11 = ixheaac_mult32x16in32(xt2_0, co30);
1801
20.1M
      mul_3 = ixheaac_mult32x16in32(yt2_0, si30);
1802
20.1M
      x[l2] = (mul_3 + mul_11) << RADIXSHIFT;
1803
1804
20.1M
      mul_5 = ixheaac_mult32x16in32(xt2_0, si30);
1805
20.1M
      mul_9 = ixheaac_mult32x16in32(yt2_0, co30);
1806
20.1M
      x[l2 + 1] = (mul_9 - mul_5) << RADIXSHIFT;
1807
1808
20.1M
      mul_12 = ixheaac_mult32x16in32(xt0_0, co20);
1809
20.1M
      mul_2 = ixheaac_mult32x16in32(yt0_0, si20);
1810
20.1M
      x[l1] = (mul_2 + mul_12) << RADIXSHIFT;
1811
1812
20.1M
      mul_6 = ixheaac_mult32x16in32(xt0_0, si20);
1813
20.1M
      mul_8 = ixheaac_mult32x16in32(yt0_0, co20);
1814
20.1M
      x[l1 + 1] = (mul_8 - mul_6) << RADIXSHIFT;
1815
1816
20.1M
      mul_4 = ixheaac_mult32x16in32(xt1_0, co10);
1817
20.1M
      mul_1 = ixheaac_mult32x16in32(yt1_0, si10);
1818
20.1M
      x[h2] = (mul_1 + mul_4) << RADIXSHIFT;
1819
1820
20.1M
      mul_10 = ixheaac_mult32x16in32(xt1_0, si10);
1821
20.1M
      mul_7 = ixheaac_mult32x16in32(yt1_0, co10);
1822
20.1M
      x[h2 + 1] = (mul_7 - mul_10) << RADIXSHIFT;
1823
1824
20.1M
      x += 2;
1825
20.1M
    }
1826
5.75M
    x += fft_jmp;
1827
5.75M
    w_ptr = w_ptr - fft_jmp;
1828
5.75M
  }
1829
3.60M
}
1830
1831
VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
1832
2.16M
                                const WORD32 *p_dig_rev_tbl, WORD32 npoints) {
1833
2.16M
  WORD32 i, k;
1834
2.16M
  WORD32 h2;
1835
2.16M
  WORD32 xh0_0, xh1_0, xl0_0, xl1_0;
1836
2.16M
  WORD32 xh0_1, xh1_1, xl0_1, xl1_1;
1837
2.16M
  WORD32 x_0, x_1, x_2, x_3;
1838
2.16M
  WORD32 xh0_2, xh1_2, xl0_2, xl1_2, xh0_3, xh1_3, xl0_3, xl1_3;
1839
2.16M
  WORD32 x_4, x_5, x_6, x_7;
1840
2.16M
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
1841
2.16M
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
1842
2.16M
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
1843
2.16M
  WORD32 *x2, *x0;
1844
2.16M
  WORD32 *y0, *y1, *y2, *y3;
1845
1846
2.16M
  y0 = ptr_y;
1847
2.16M
  y2 = ptr_y + (WORD32)npoints;
1848
2.16M
  x0 = ptr_x;
1849
2.16M
  x2 = ptr_x + (WORD32)(npoints >> 1);
1850
1851
2.16M
  y1 = y0 + (WORD32)(npoints >> 1);
1852
2.16M
  y3 = y2 + (WORD32)(npoints >> 1);
1853
1854
6.50M
  for (k = 0; k < 2; k++) {
1855
8.67M
    for (i = 0; i<npoints>> 1; i += 8) {
1856
4.33M
      h2 = *p_dig_rev_tbl++ >> 2;
1857
4.33M
      x_0 = *x0++;
1858
4.33M
      x_1 = *x0++;
1859
4.33M
      x_2 = *x0++;
1860
4.33M
      x_3 = *x0++;
1861
4.33M
      x_4 = *x0++;
1862
4.33M
      x_5 = *x0++;
1863
4.33M
      x_6 = *x0++;
1864
4.33M
      x_7 = *x0++;
1865
1866
4.33M
      xh0_0 = ixheaac_add32_sat(x_0, x_4);
1867
4.33M
      xh1_0 = ixheaac_add32_sat(x_1, x_5);
1868
4.33M
      xl0_0 = ixheaac_sub32_sat(x_0, x_4);
1869
4.33M
      xl1_0 = ixheaac_sub32_sat(x_1, x_5);
1870
4.33M
      xh0_1 = ixheaac_add32_sat(x_2, x_6);
1871
4.33M
      xh1_1 = ixheaac_add32_sat(x_3, x_7);
1872
4.33M
      xl0_1 = ixheaac_sub32_sat(x_2, x_6);
1873
4.33M
      xl1_1 = ixheaac_sub32_sat(x_3, x_7);
1874
1875
4.33M
      n00 = ixheaac_add32_sat(xh0_0, xh0_1);
1876
4.33M
      n01 = ixheaac_add32_sat(xh1_0, xh1_1);
1877
4.33M
      n10 = ixheaac_add32_sat(xl0_0, xl1_1);
1878
4.33M
      n11 = ixheaac_sub32_sat(xl1_0, xl0_1);
1879
4.33M
      n20 = ixheaac_sub32_sat(xh0_0, xh0_1);
1880
4.33M
      n21 = ixheaac_sub32_sat(xh1_0, xh1_1);
1881
4.33M
      n30 = ixheaac_sub32_sat(xl0_0, xl1_1);
1882
4.33M
      n31 = ixheaac_add32_sat(xl1_0, xl0_1);
1883
1884
4.33M
      y0[h2] = n00;
1885
4.33M
      y0[h2 + 1] = n01;
1886
4.33M
      y1[h2] = n10;
1887
4.33M
      y1[h2 + 1] = n11;
1888
4.33M
      y2[h2] = n20;
1889
4.33M
      y2[h2 + 1] = n21;
1890
4.33M
      y3[h2] = n30;
1891
4.33M
      y3[h2 + 1] = n31;
1892
1893
4.33M
      x_8 = *x2++;
1894
4.33M
      x_9 = *x2++;
1895
4.33M
      x_a = *x2++;
1896
4.33M
      x_b = *x2++;
1897
4.33M
      x_c = *x2++;
1898
4.33M
      x_d = *x2++;
1899
4.33M
      x_e = *x2++;
1900
4.33M
      x_f = *x2++;
1901
1902
4.33M
      xh0_2 = ixheaac_add32_sat(x_8, x_c);
1903
4.33M
      xh1_2 = ixheaac_add32_sat(x_9, x_d);
1904
4.33M
      xl0_2 = ixheaac_sub32_sat(x_8, x_c);
1905
4.33M
      xl1_2 = ixheaac_sub32_sat(x_9, x_d);
1906
4.33M
      xh0_3 = ixheaac_add32_sat(x_a, x_e);
1907
4.33M
      xh1_3 = ixheaac_add32_sat(x_b, x_f);
1908
4.33M
      xl0_3 = ixheaac_sub32_sat(x_a, x_e);
1909
4.33M
      xl1_3 = ixheaac_sub32_sat(x_b, x_f);
1910
1911
4.33M
      n02 = ixheaac_add32_sat(xh0_2, xh0_3);
1912
4.33M
      n03 = ixheaac_add32_sat(xh1_2, xh1_3);
1913
4.33M
      n12 = ixheaac_add32_sat(xl0_2, xl1_3);
1914
4.33M
      n13 = ixheaac_sub32_sat(xl1_2, xl0_3);
1915
4.33M
      n22 = ixheaac_sub32_sat(xh0_2, xh0_3);
1916
4.33M
      n23 = ixheaac_sub32_sat(xh1_2, xh1_3);
1917
4.33M
      n32 = ixheaac_sub32_sat(xl0_2, xl1_3);
1918
4.33M
      n33 = ixheaac_add32_sat(xl1_2, xl0_3);
1919
1920
4.33M
      y0[h2 + 2] = n02;
1921
4.33M
      y0[h2 + 3] = n03;
1922
4.33M
      y1[h2 + 2] = n12;
1923
4.33M
      y1[h2 + 3] = n13;
1924
4.33M
      y2[h2 + 2] = n22;
1925
4.33M
      y2[h2 + 3] = n23;
1926
4.33M
      y3[h2 + 2] = n32;
1927
4.33M
      y3[h2 + 3] = n33;
1928
4.33M
    }
1929
4.33M
    x0 += (WORD32)npoints >> 1;
1930
4.33M
    x2 += (WORD32)npoints >> 1;
1931
4.33M
  }
1932
2.16M
}
1933
1934
VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
1935
716k
                                const WORD32 *pdig_rev_tbl, WORD32 npoints) {
1936
716k
  WORD32 i, k;
1937
716k
  WORD32 h2;
1938
716k
  WORD32 x_0, x_1, x_2, x_3;
1939
716k
  WORD32 x_4, x_5, x_6, x_7;
1940
716k
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
1941
716k
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
1942
716k
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
1943
716k
  WORD32 *x2, *x0;
1944
716k
  WORD32 *y0, *y1, *y2, *y3;
1945
1946
716k
  y0 = ptr_y;
1947
716k
  y2 = ptr_y + (WORD32)npoints;
1948
716k
  x0 = ptr_x;
1949
716k
  x2 = ptr_x + (WORD32)(npoints >> 1);
1950
1951
716k
  y1 = y0 + (WORD32)(npoints >> 2);
1952
716k
  y3 = y2 + (WORD32)(npoints >> 2);
1953
1954
2.15M
  for (k = 0; k < 2; k++) {
1955
4.30M
    for (i = 0; i<npoints>> 1; i += 8) {
1956
2.86M
      h2 = *pdig_rev_tbl++ >> 2;
1957
1958
2.86M
      x_0 = *x0++;
1959
2.86M
      x_1 = *x0++;
1960
2.86M
      x_2 = *x0++;
1961
2.86M
      x_3 = *x0++;
1962
2.86M
      x_4 = *x0++;
1963
2.86M
      x_5 = *x0++;
1964
2.86M
      x_6 = *x0++;
1965
2.86M
      x_7 = *x0++;
1966
1967
2.86M
      n00 = ixheaac_add32_sat(x_0, x_2);
1968
2.86M
      n01 = ixheaac_add32_sat(x_1, x_3);
1969
2.86M
      n20 = ixheaac_sub32_sat(x_0, x_2);
1970
2.86M
      n21 = ixheaac_sub32_sat(x_1, x_3);
1971
2.86M
      n10 = ixheaac_add32_sat(x_4, x_6);
1972
2.86M
      n11 = ixheaac_add32_sat(x_5, x_7);
1973
2.86M
      n30 = ixheaac_sub32_sat(x_4, x_6);
1974
2.86M
      n31 = ixheaac_sub32_sat(x_5, x_7);
1975
1976
2.86M
      y0[h2] = n00;
1977
2.86M
      y0[h2 + 1] = n01;
1978
2.86M
      y1[h2] = n10;
1979
2.86M
      y1[h2 + 1] = n11;
1980
2.86M
      y2[h2] = n20;
1981
2.86M
      y2[h2 + 1] = n21;
1982
2.86M
      y3[h2] = n30;
1983
2.86M
      y3[h2 + 1] = n31;
1984
1985
2.86M
      x_8 = *x2++;
1986
2.86M
      x_9 = *x2++;
1987
2.86M
      x_a = *x2++;
1988
2.86M
      x_b = *x2++;
1989
2.86M
      x_c = *x2++;
1990
2.86M
      x_d = *x2++;
1991
2.86M
      x_e = *x2++;
1992
2.86M
      x_f = *x2++;
1993
1994
2.86M
      n02 = ixheaac_add32_sat(x_8, x_a);
1995
2.86M
      n03 = ixheaac_add32_sat(x_9, x_b);
1996
2.86M
      n22 = ixheaac_sub32_sat(x_8, x_a);
1997
2.86M
      n23 = ixheaac_sub32_sat(x_9, x_b);
1998
2.86M
      n12 = ixheaac_add32_sat(x_c, x_e);
1999
2.86M
      n13 = ixheaac_add32_sat(x_d, x_f);
2000
2.86M
      n32 = ixheaac_sub32_sat(x_c, x_e);
2001
2.86M
      n33 = ixheaac_sub32_sat(x_d, x_f);
2002
2003
2.86M
      y0[h2 + 2] = n02;
2004
2.86M
      y0[h2 + 3] = n03;
2005
2.86M
      y1[h2 + 2] = n12;
2006
2.86M
      y1[h2 + 3] = n13;
2007
2.86M
      y2[h2 + 2] = n22;
2008
2.86M
      y2[h2 + 3] = n23;
2009
2.86M
      y3[h2 + 2] = n32;
2010
2.86M
      y3[h2 + 3] = n33;
2011
2.86M
    }
2012
1.43M
    x0 += (WORD32)npoints >> 1;
2013
1.43M
    x2 += (WORD32)npoints >> 1;
2014
1.43M
  }
2015
716k
}
2016
#endif