Coverage Report

Created: 2025-08-29 06:15

/src/libxaac/decoder/generic/ixheaacd_qmf_dec_generic.c
Line
Count
Source (jump to first uncovered line)
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
713M
#define HQ_SHIFT_64 4
58
1.76G
#define RADIXSHIFT 1
59
66.7M
#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.75M
                          WORD16 *p_twiddle, WORD32 *p_dig_rev_tbl) {
262
1.75M
  WORD32 re2, re3;
263
1.75M
  WORD16 wim, wre;
264
265
1.75M
  WORD32 i, M_2;
266
1.75M
  WORD32 M = ixheaac_shr32(qmf_bank->no_channels, 1);
267
268
1.75M
  const WORD16 *p_sin;
269
1.75M
  const WORD16 *p_sin_cos = &qmf_bank->cos_twiddle[0];
270
1.75M
  WORD32 subband_tmp[128];
271
1.75M
  WORD32 re;
272
1.75M
  WORD32 im;
273
1.75M
  WORD32 *psubband, *psubband1;
274
1.75M
  WORD32 *psubband_t, *psubband1_t;
275
1.75M
  WORD32 *psubband2, *psubband12;
276
1.75M
  WORD32 *psubband_t2, *psubband1_t2;
277
278
1.75M
  M_2 = ixheaac_shr32(M, 1);
279
280
1.75M
  psubband = &subband[0];
281
1.75M
  psubband1 = &subband[2 * M - 1];
282
1.75M
  psubband_t = subband_tmp;
283
1.75M
  psubband1_t = &subband_tmp[2 * M - 1];
284
285
1.75M
  psubband2 = &subband[64];
286
1.75M
  psubband12 = &subband[2 * M - 1 + 64];
287
1.75M
  psubband_t2 = &subband_tmp[64];
288
1.75M
  psubband1_t2 = &subband_tmp[2 * M - 1 + 64];
289
290
10.5M
  for (i = (M_2 >> 1) - 1; i >= 0; i--) {
291
8.84M
    re = *psubband++;
292
8.84M
    im = *psubband1--;
293
294
8.84M
    wim = *p_sin_cos++;
295
8.84M
    wre = *p_sin_cos++;
296
297
8.84M
    *psubband_t++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
298
8.84M
                                       ixheaac_mult32x16in32(im, wim));
299
8.84M
    *psubband_t++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
300
8.84M
                                       ixheaac_mult32x16in32(re, wim));
301
302
8.84M
    re = *psubband2++;
303
8.84M
    im = *psubband12--;
304
305
8.84M
    *psubband_t2++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
306
8.84M
                                        ixheaac_mult32x16in32(re, wre));
307
8.84M
    *psubband_t2++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
308
8.84M
                                        ixheaac_mult32x16in32(im, wre));
309
310
8.84M
    re = *psubband1--;
311
8.84M
    im = *psubband++;
312
313
8.84M
    wim = *p_sin_cos++;
314
8.84M
    wre = *p_sin_cos++;
315
316
8.84M
    *psubband1_t-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
317
8.84M
                                        ixheaac_mult32x16in32(re, wim));
318
8.84M
    *psubband1_t-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
319
8.84M
                                        ixheaac_mult32x16in32(im, wim));
320
321
8.84M
    re = *psubband12--;
322
8.84M
    im = *psubband2++;
323
324
8.84M
    *psubband1_t2-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
325
8.84M
                                         ixheaac_mult32x16in32(im, wre));
326
8.84M
    *psubband1_t2-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
327
8.84M
                                         ixheaac_mult32x16in32(re, wre));
328
329
8.84M
    re = *psubband++;
330
8.84M
    im = *psubband1--;
331
332
8.84M
    wim = *p_sin_cos++;
333
8.84M
    wre = *p_sin_cos++;
334
335
8.84M
    *psubband_t++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
336
8.84M
                                       ixheaac_mult32x16in32(im, wim));
337
8.84M
    *psubband_t++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
338
8.84M
                                       ixheaac_mult32x16in32(re, wim));
339
340
8.84M
    re = *psubband2++;
341
8.84M
    im = *psubband12--;
342
343
8.84M
    *psubband_t2++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
344
8.84M
                                        ixheaac_mult32x16in32(re, wre));
345
8.84M
    *psubband_t2++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
346
8.84M
                                        ixheaac_mult32x16in32(im, wre));
347
348
8.84M
    re = *psubband1--;
349
8.84M
    im = *psubband++;
350
351
8.84M
    wim = *p_sin_cos++;
352
8.84M
    wre = *p_sin_cos++;
353
354
8.84M
    *psubband1_t-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
355
8.84M
                                        ixheaac_mult32x16in32(re, wim));
356
8.84M
    *psubband1_t-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
357
8.84M
                                        ixheaac_mult32x16in32(im, wim));
358
359
8.84M
    re = *psubband12--;
360
8.84M
    im = *psubband2++;
361
8.84M
    ;
362
363
8.84M
    *psubband1_t2-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
364
8.84M
                                         ixheaac_mult32x16in32(im, wre));
365
8.84M
    *psubband1_t2-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
366
8.84M
                                         ixheaac_mult32x16in32(re, wre));
367
8.84M
  }
368
369
1.75M
  if (M == 32) {
370
460k
    ixheaacd_radix4bfly(p_twiddle, subband_tmp, 1, 8);
371
460k
    ixheaacd_radix4bfly(p_twiddle + 48, subband_tmp, 4, 2);
372
460k
    ixheaacd_postradixcompute2(subband, subband_tmp, p_dig_rev_tbl, 32);
373
374
460k
    ixheaacd_radix4bfly(p_twiddle, &subband_tmp[64], 1, 8);
375
460k
    ixheaacd_radix4bfly(p_twiddle + 48, &subband_tmp[64], 4, 2);
376
460k
    ixheaacd_postradixcompute2(&subband[64], &subband_tmp[64], p_dig_rev_tbl,
377
460k
                               32);
378
379
1.28M
  } else {
380
1.28M
    ixheaacd_radix4bfly(p_twiddle, subband_tmp, 1, 4);
381
1.28M
    ixheaacd_postradixcompute4(subband, subband_tmp, p_dig_rev_tbl, 16);
382
383
1.28M
    ixheaacd_radix4bfly(p_twiddle, &subband_tmp[64], 1, 4);
384
1.28M
    ixheaacd_postradixcompute4(&subband[64], &subband_tmp[64], p_dig_rev_tbl,
385
1.28M
                               16);
386
1.28M
  }
387
388
1.75M
  psubband = &subband[0];
389
1.75M
  psubband1 = &subband[2 * M - 1];
390
391
1.75M
  re = *psubband1;
392
393
1.75M
  *psubband = *psubband >> 1;
394
1.75M
  psubband++;
395
1.75M
  *psubband1 = ixheaac_negate32_sat(*psubband >> 1);
396
1.75M
  psubband1--;
397
398
1.75M
  p_sin = &qmf_bank->alt_sin_twiddle[0];
399
1.75M
  wim = *p_sin++;
400
1.75M
  wre = *p_sin++;
401
402
1.75M
  im = *psubband1;
403
404
1.75M
  *psubband1-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wre),
405
1.75M
                                    ixheaac_mult32x16in32(im, wim));
406
1.75M
  *psubband++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
407
1.75M
                                   ixheaac_mult32x16in32(re, wim));
408
409
1.75M
  psubband2 = &subband[64];
410
1.75M
  psubband12 = &subband[2 * M - 1 + 64];
411
412
1.75M
  re = *psubband12;
413
414
1.75M
  *psubband12-- = ixheaac_negate32_sat(*psubband2 >> 1);
415
416
1.75M
  *psubband2 = psubband2[1] >> 1;
417
418
1.75M
  psubband2++;
419
420
1.75M
  im = *psubband12;
421
422
1.75M
  *psubband2++ = ixheaac_negate32_sat(ixheaac_add32_sat(
423
1.75M
      ixheaac_mult32x16in32(re, wre), ixheaac_mult32x16in32(im, wim)));
424
1.75M
  *psubband12-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(re, wim),
425
1.75M
                                     ixheaac_mult32x16in32(im, wre));
426
427
17.6M
  for (i = (M_2 - 2); i >= 0; i--) {
428
15.9M
    im = psubband[0];
429
430
15.9M
    re = psubband[1];
431
432
15.9M
    re2 = *psubband1;
433
434
15.9M
    *psubband++ = ixheaac_add32_sat(ixheaac_mult32x16in32(re, wim),
435
15.9M
                                     ixheaac_mult32x16in32(im, wre));
436
15.9M
    *psubband1-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wim),
437
15.9M
                                      ixheaac_mult32x16in32(re, wre));
438
439
15.9M
    im = psubband2[0];
440
441
15.9M
    re = psubband2[1];
442
443
15.9M
    re3 = *psubband12;
444
445
15.9M
    *psubband12-- = ixheaac_negate32_sat(ixheaac_add32_sat(
446
15.9M
        ixheaac_mult32x16in32(re, wim), ixheaac_mult32x16in32(im, wre)));
447
15.9M
    *psubband2++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(re, wre),
448
15.9M
                                      ixheaac_mult32x16in32(im, wim));
449
450
15.9M
    wim = *p_sin++;
451
15.9M
    wre = *p_sin++;
452
15.9M
    im = psubband1[0];
453
454
15.9M
    *psubband1-- = ixheaac_add32_sat(ixheaac_mult32x16in32(re2, wre),
455
15.9M
                                      ixheaac_mult32x16in32(im, wim));
456
15.9M
    *psubband++ = ixheaac_sub32_sat(ixheaac_mult32x16in32(im, wre),
457
15.9M
                                     ixheaac_mult32x16in32(re2, wim));
458
459
15.9M
    im = psubband12[0];
460
461
15.9M
    *psubband2++ = ixheaac_negate32_sat(ixheaac_add32_sat(
462
15.9M
        ixheaac_mult32x16in32(re3, wre), ixheaac_mult32x16in32(im, wim)));
463
15.9M
    *psubband12-- = ixheaac_sub32_sat(ixheaac_mult32x16in32(re3, wim),
464
15.9M
                                       ixheaac_mult32x16in32(im, wre));
465
15.9M
  }
466
1.75M
}
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
875k
                             WORD32 ld_mps_flag) {
473
875k
  WORD32 i;
474
875k
  const WORD32 *p_time_in2 = &p_time_in1[2 * qmf_bank->no_channels - 1];
475
875k
  WORD32 temp1, temp2;
476
875k
  WORD32 *t_real_subband = real_subband;
477
875k
  WORD32 *t_imag_subband = imag_subband;
478
875k
  const WORD16 *tcos;
479
480
34.2M
  for (i = qmf_bank->no_channels - 1; i >= 0; i--) {
481
33.3M
    temp1 = ixheaac_shr32(*p_time_in1++, HQ_SHIFT_VAL);
482
33.3M
    temp2 = ixheaac_shr32(*p_time_in2--, HQ_SHIFT_VAL);
483
484
33.3M
    *t_real_subband++ = ixheaac_sub32_sat(temp1, temp2);
485
486
33.3M
    *t_imag_subband++ = ixheaac_add32_sat(temp1, temp2);
487
33.3M
  }
488
489
875k
  if (qmf_bank->no_channels != 64)
490
707k
    ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_16,
491
707k
                         qmf_dec_tables_ptr->dig_rev_table4_16);
492
168k
  else
493
168k
    ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_32,
494
168k
                         qmf_dec_tables_ptr->dig_rev_table2_32);
495
496
875k
  if (ld_mps_flag == 0) {
497
803k
    tcos = qmf_bank->t_cos;
498
499
14.6M
    for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
500
13.8M
      WORD16 cosh, sinh;
501
13.8M
      WORD32 re, im;
502
503
13.8M
      re = *real_subband;
504
13.8M
      im = *imag_subband;
505
13.8M
      cosh = *tcos++;
506
13.8M
      sinh = *tcos++;
507
13.8M
      *real_subband++ =
508
13.8M
          ixheaac_add32_sat(ixheaac_mult32x16in32_shl(re, cosh),
509
13.8M
                             ixheaac_mult32x16in32_shl(im, sinh));
510
13.8M
      *imag_subband++ =
511
13.8M
          ixheaac_sub32_sat(ixheaac_mult32x16in32_shl(im, cosh),
512
13.8M
                             ixheaac_mult32x16in32_shl(re, sinh));
513
13.8M
    }
514
803k
  } else {
515
71.8k
    WORD32 i_band;
516
1.22M
    for (i = 0; i < min(64, qmf_bank->no_channels); i += 2) {
517
1.15M
      i_band = real_subband[i];
518
1.15M
      real_subband[i] = -imag_subband[i];
519
1.15M
      imag_subband[i] = i_band;
520
521
1.15M
      i_band = -real_subband[i + 1];
522
1.15M
      real_subband[i + 1] = imag_subband[i + 1];
523
1.15M
      imag_subband[i + 1] = i_band;
524
1.15M
    }
525
71.8k
  }
526
875k
}
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
51.4k
                                WORD audio_object_type) {
597
51.4k
  WORD32 i, k;
598
51.4k
  WORD32 num_time_slots = qmf_bank->num_time_slots;
599
600
51.4k
  WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS] = { 0 };
601
51.4k
  WORD16 *filter_states = qmf_bank->core_samples_buffer;
602
603
51.4k
  WORD16 *fp1, *fp2, *tmp;
604
605
51.4k
  WORD16 *filter_1;
606
51.4k
  WORD16 *filter_2;
607
51.4k
  WORD16 *filt_ptr;
608
51.4k
  WORD32 start_slot = 0;
609
610
51.4k
  if (audio_object_type != AOT_ER_AAC_ELD &&
611
51.4k
      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
51.4k
  } else {
616
51.4k
    qmf_bank->filter_pos +=
617
51.4k
        (qmf_dec_tables_ptr->qmf_c_eld3 - qmf_bank->analy_win_coeff);
618
51.4k
    qmf_bank->analy_win_coeff = qmf_dec_tables_ptr->qmf_c_eld3;
619
51.4k
  }
620
621
51.4k
  filter_1 = qmf_bank->filter_pos;
622
623
51.4k
  if (audio_object_type != AOT_ER_AAC_ELD &&
624
51.4k
      audio_object_type != AOT_ER_AAC_LD) {
625
0
    filter_2 = filter_1 + 64;
626
51.4k
  } else {
627
51.4k
    filter_2 = filter_1 + qmf_bank->no_channels;
628
51.4k
  }
629
630
51.4k
  sbr_scale_factor->st_lb_scale = 0;
631
51.4k
  sbr_scale_factor->lb_scale = -10;
632
51.4k
  if (!low_pow_flag) {
633
51.4k
    if (audio_object_type != AOT_ER_AAC_ELD &&
634
51.4k
        audio_object_type != AOT_ER_AAC_LD) {
635
0
      sbr_scale_factor->lb_scale = -8;
636
51.4k
    } else {
637
51.4k
      sbr_scale_factor->lb_scale = -9;
638
51.4k
    }
639
51.4k
    if (qmf_bank->no_channels != 64) {
640
40.6k
      qmf_bank->cos_twiddle =
641
40.6k
          (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
642
40.6k
      qmf_bank->alt_sin_twiddle =
643
40.6k
          (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
644
40.6k
    } else {
645
10.7k
      qmf_bank->cos_twiddle =
646
10.7k
          (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
647
10.7k
      qmf_bank->alt_sin_twiddle =
648
10.7k
          (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
649
10.7k
    }
650
51.4k
    if (audio_object_type != AOT_ER_AAC_ELD &&
651
51.4k
        audio_object_type != AOT_ER_AAC_LD) {
652
0
      qmf_bank->t_cos = (WORD16 *)qmf_dec_tables_ptr->sbr_t_cos_sin_l32;
653
51.4k
    } else {
654
51.4k
      qmf_bank->t_cos =
655
51.4k
          (WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
656
51.4k
    }
657
51.4k
  }
658
659
51.4k
  fp1 = qmf_bank->anal_filter_states;
660
51.4k
  fp2 = qmf_bank->anal_filter_states + qmf_bank->no_channels;
661
662
51.4k
  if (audio_object_type == AOT_ER_AAC_ELD ||
663
51.4k
      audio_object_type == AOT_ER_AAC_LD) {
664
51.4k
    filter_2 = qmf_bank->filter_2;
665
51.4k
    fp1 = qmf_bank->fp1_anal;
666
51.4k
    fp2 = qmf_bank->fp2_anal;
667
51.4k
  }
668
669
854k
  for (i = start_slot; i < num_time_slots + start_slot; i++) {
670
31.8M
    for (k = 0; k < qmf_bank->no_channels; k++)
671
31.0M
      filter_states[qmf_bank->no_channels - 1 - k] =
672
31.0M
          time_sample_buf[ch_fac * k];
673
674
803k
    if (audio_object_type != AOT_ER_AAC_ELD &&
675
803k
        audio_object_type != AOT_ER_AAC_LD) {
676
0
      ixheaacd_sbr_qmfanal32_winadd(fp1, fp2, filter_1, filter_2,
677
0
                                    analysis_buffer);
678
803k
    } else {
679
803k
      ixheaacd_sbr_qmfanal32_winadd_eld(fp1, fp2, filter_1, filter_2,
680
803k
                                        analysis_buffer);
681
803k
    }
682
683
803k
    time_sample_buf += qmf_bank->no_channels * ch_fac;
684
685
803k
    filter_states -= qmf_bank->no_channels;
686
803k
    if (filter_states < qmf_bank->anal_filter_states) {
687
82.3k
      filter_states = qmf_bank->anal_filter_states +
688
82.3k
                      ((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
689
82.3k
    }
690
691
803k
    tmp = fp1;
692
803k
    fp1 = fp2;
693
803k
    fp2 = tmp;
694
803k
    if (audio_object_type != AOT_ER_AAC_ELD &&
695
803k
        audio_object_type != AOT_ER_AAC_LD) {
696
0
      filter_1 += 64;
697
0
      filter_2 += 64;
698
803k
    } else {
699
803k
      filter_1 += qmf_bank->no_channels;
700
803k
      filter_2 += qmf_bank->no_channels;
701
803k
    }
702
703
803k
    filt_ptr = filter_1;
704
803k
    filter_1 = filter_2;
705
803k
    filter_2 = filt_ptr;
706
803k
    if (audio_object_type != AOT_ER_AAC_ELD &&
707
803k
        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
803k
    } else {
713
803k
      if (filter_2 >
714
803k
          (qmf_bank->analy_win_coeff + (qmf_bank->no_channels * 10))) {
715
78.0k
        filter_1 = (WORD16 *)qmf_bank->analy_win_coeff;
716
78.0k
        filter_2 = (WORD16 *)qmf_bank->analy_win_coeff + qmf_bank->no_channels;
717
78.0k
      }
718
803k
    }
719
720
803k
    if (!low_pow_flag) {
721
803k
      ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i],
722
803k
                              qmf_bank, qmf_dec_tables_ptr, 0);
723
803k
    } 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
803k
  }
730
731
51.4k
  qmf_bank->filter_pos = filter_1;
732
51.4k
  qmf_bank->core_samples_buffer = filter_states;
733
734
51.4k
  if (audio_object_type == AOT_ER_AAC_ELD || audio_object_type == AOT_ER_AAC_LD)
735
736
51.4k
  {
737
51.4k
    qmf_bank->fp1_anal = fp1;
738
51.4k
    qmf_bank->fp2_anal = fp2;
739
51.4k
    qmf_bank->filter_2 = filter_2;
740
51.4k
  }
741
51.4k
}
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.54k
                                   WORD32 ch_fac, WORD32 ldsbr_present) {
749
4.54k
  WORD32 i, k;
750
4.54k
  WORD32 num_time_slots = qmf_bank->num_time_slots;
751
752
4.54k
  WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS];
753
4.54k
  WORD32 *filter_states = qmf_bank->core_samples_buffer_32;
754
755
4.54k
  WORD32 *fp1, *fp2, *tmp;
756
757
4.54k
  WORD32 *filter_1;
758
4.54k
  WORD32 *filter_2;
759
4.54k
  WORD32 *filt_ptr;
760
4.54k
  WORD32 start_slot = 2;
761
762
4.54k
  if (ldsbr_present) {
763
4.50k
    qmf_bank->filter_pos_32 +=
764
4.50k
        (qmf_dec_tables_ptr->qmf_c_ldsbr_mps - qmf_bank->analy_win_coeff_32);
765
4.50k
    qmf_bank->analy_win_coeff_32 = qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
766
4.50k
  } else {
767
43
    qmf_bank->filter_pos_32 += (ixheaacd_ldmps_polyphase_filter_coeff_fix -
768
43
                                qmf_bank->analy_win_coeff_32);
769
43
    qmf_bank->analy_win_coeff_32 =
770
43
        (WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
771
43
  }
772
773
4.54k
  filter_1 = qmf_bank->filter_pos_32;
774
4.54k
  filter_2 = filter_1 + qmf_bank->no_channels;
775
776
4.54k
  sbr_scale_factor->st_lb_scale = 0;
777
4.54k
  sbr_scale_factor->lb_scale = -10;
778
779
4.54k
  sbr_scale_factor->lb_scale = -9;
780
4.54k
  if (qmf_bank->no_channels != 64) {
781
4.53k
    qmf_bank->cos_twiddle =
782
4.53k
        (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
783
4.53k
    qmf_bank->alt_sin_twiddle =
784
4.53k
        (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
785
4.53k
  } else {
786
10
    qmf_bank->cos_twiddle =
787
10
        (WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
788
10
    qmf_bank->alt_sin_twiddle =
789
10
        (WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
790
10
  }
791
4.54k
  qmf_bank->t_cos =
792
4.54k
      (WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
793
794
4.54k
  fp1 = qmf_bank->anal_filter_states_32;
795
4.54k
  fp2 = qmf_bank->anal_filter_states_32 + qmf_bank->no_channels;
796
797
4.54k
  filter_2 = qmf_bank->filter_2_32;
798
4.54k
  fp1 = qmf_bank->fp1_anal_32;
799
4.54k
  fp2 = qmf_bank->fp2_anal_32;
800
801
76.4k
  for (i = start_slot; i < num_time_slots + start_slot; i++) {
802
2.37M
    for (k = 0; k < qmf_bank->no_channels; k++)
803
2.30M
      filter_states[qmf_bank->no_channels - 1 - k] =
804
2.30M
          time_sample_buf[ch_fac * k];
805
806
71.8k
    if (ldsbr_present) {
807
71.4k
      ixheaacd_sbr_qmfanal32_winadd_eld_32(fp1, fp2, filter_1, filter_2,
808
71.4k
                                           analysis_buffer);
809
71.4k
    } else {
810
400
      ixheaacd_sbr_qmfanal32_winadd_eld_mps(fp1, fp2, filter_1, filter_2,
811
400
                                            analysis_buffer);
812
400
    }
813
814
71.8k
    time_sample_buf += qmf_bank->no_channels * ch_fac;
815
816
71.8k
    filter_states -= qmf_bank->no_channels;
817
818
71.8k
    if (filter_states < qmf_bank->anal_filter_states_32) {
819
7.63k
      filter_states = qmf_bank->anal_filter_states_32 +
820
7.63k
                      ((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
821
7.63k
    }
822
823
71.8k
    tmp = fp1;
824
71.8k
    fp1 = fp2;
825
71.8k
    fp2 = tmp;
826
827
71.8k
    filter_1 += qmf_bank->no_channels;
828
71.8k
    filter_2 += qmf_bank->no_channels;
829
830
71.8k
    filt_ptr = filter_1;
831
71.8k
    filter_1 = filter_2;
832
71.8k
    filter_2 = filt_ptr;
833
834
71.8k
    if (filter_2 >
835
71.8k
        (qmf_bank->analy_win_coeff_32 + (qmf_bank->no_channels * 10))) {
836
6.68k
      filter_1 = (WORD32 *)qmf_bank->analy_win_coeff_32;
837
6.68k
      filter_2 = (WORD32 *)qmf_bank->analy_win_coeff_32 + qmf_bank->no_channels;
838
6.68k
    }
839
840
71.8k
    ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i], qmf_bank,
841
71.8k
                            qmf_dec_tables_ptr, 1);
842
71.8k
  }
843
844
4.54k
  qmf_bank->filter_pos_32 = filter_1;
845
4.54k
  qmf_bank->core_samples_buffer_32 = filter_states;
846
847
4.54k
  qmf_bank->fp1_anal_32 = fp1;
848
4.54k
  qmf_bank->fp2_anal_32 = fp2;
849
4.54k
  qmf_bank->filter_2_32 = filter_2;
850
4.54k
}
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
874k
                              ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
872
874k
  if (syn_qmf->no_channels == 64)
873
292k
    ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_32,
874
292k
                         qmf_dec_tables_ptr->dig_rev_table2_32);
875
582k
  else
876
582k
    ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_16,
877
582k
                         qmf_dec_tables_ptr->dig_rev_table4_16);
878
874k
}
879
880
VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
881
42.6M
                              WORD32 index) {
882
42.6M
  int i;
883
42.6M
  WORD32 l1, l2, h2, fft_jmp;
884
42.6M
  WORD32 xt0_0, yt0_0, xt1_0, yt1_0, xt2_0, yt2_0;
885
42.6M
  WORD32 xh0_0, xh1_0, xh20_0, xh21_0, xl0_0, xl1_0, xl20_0, xl21_0;
886
42.6M
  WORD32 x_0, x_1, x_l1_0, x_l1_1, x_l2_0, x_l2_1;
887
42.6M
  WORD32 x_h2_0, x_h2_1;
888
42.6M
  WORD32 si10, si20, si30, co10, co20, co30;
889
890
42.6M
  WORD64 mul_1, mul_2, mul_3, mul_4, mul_5, mul_6;
891
42.6M
  WORD64 mul_7, mul_8, mul_9, mul_10, mul_11, mul_12;
892
42.6M
  const WORD32 *w_ptr = w;
893
42.6M
  WORD32 i1;
894
895
42.6M
  h2 = index << 1;
896
42.6M
  l1 = index << 2;
897
42.6M
  l2 = (index << 2) + (index << 1);
898
899
42.6M
  fft_jmp = 6 * (index);
900
901
122M
  for (i1 = 0; i1 < index1; i1++) {
902
347M
    for (i = 0; i < index; i++) {
903
268M
      si10 = (*w_ptr++);
904
268M
      co10 = (*w_ptr++);
905
268M
      si20 = (*w_ptr++);
906
268M
      co20 = (*w_ptr++);
907
268M
      si30 = (*w_ptr++);
908
268M
      co30 = (*w_ptr++);
909
910
268M
      x_0 = x[0];
911
268M
      x_h2_0 = x[h2];
912
268M
      x_l1_0 = x[l1];
913
268M
      x_l2_0 = x[l2];
914
915
268M
      xh0_0 = ixheaac_add32_sat(x_0, x_l1_0);
916
268M
      xl0_0 = ixheaac_sub32_sat(x_0, x_l1_0);
917
918
268M
      xh20_0 = ixheaac_add32_sat(x_h2_0, x_l2_0);
919
268M
      xl20_0 = ixheaac_sub32_sat(x_h2_0, x_l2_0);
920
921
268M
      x[0] = ixheaac_add32_sat(xh0_0, xh20_0);
922
268M
      xt0_0 = ixheaac_sub32_sat(xh0_0, xh20_0);
923
924
268M
      x_1 = x[1];
925
268M
      x_h2_1 = x[h2 + 1];
926
268M
      x_l1_1 = x[l1 + 1];
927
268M
      x_l2_1 = x[l2 + 1];
928
929
268M
      xh1_0 = ixheaac_add32_sat(x_1, x_l1_1);
930
268M
      xl1_0 = ixheaac_sub32_sat(x_1, x_l1_1);
931
932
268M
      xh21_0 = ixheaac_add32_sat(x_h2_1, x_l2_1);
933
268M
      xl21_0 = ixheaac_sub32_sat(x_h2_1, x_l2_1);
934
935
268M
      x[1] = ixheaac_add32_sat(xh1_0, xh21_0);
936
268M
      yt0_0 = ixheaac_sub32_sat(xh1_0, xh21_0);
937
938
268M
      xt1_0 = ixheaac_add32_sat(xl0_0, xl21_0);
939
268M
      xt2_0 = ixheaac_sub32_sat(xl0_0, xl21_0);
940
941
268M
      yt2_0 = ixheaac_add32_sat(xl1_0, xl20_0);
942
268M
      yt1_0 = ixheaac_sub32_sat(xl1_0, xl20_0);
943
944
268M
      mul_11 = ixheaac_mult64(xt2_0, co30);
945
268M
      mul_3 = ixheaac_mult64(yt2_0, si30);
946
268M
      x[l2] = (WORD32)((mul_3 + mul_11) >> 32) << RADIXSHIFT;
947
948
268M
      mul_5 = ixheaac_mult64(xt2_0, si30);
949
268M
      mul_9 = ixheaac_mult64(yt2_0, co30);
950
268M
      x[l2 + 1] = (WORD32)((mul_9 - mul_5) >> 32) << RADIXSHIFT;
951
952
268M
      mul_12 = ixheaac_mult64(xt0_0, co20);
953
268M
      mul_2 = ixheaac_mult64(yt0_0, si20);
954
268M
      x[l1] = (WORD32)((mul_2 + mul_12) >> 32) << RADIXSHIFT;
955
956
268M
      mul_6 = ixheaac_mult64(xt0_0, si20);
957
268M
      mul_8 = ixheaac_mult64(yt0_0, co20);
958
268M
      x[l1 + 1] = (WORD32)((mul_8 - mul_6) >> 32) << RADIXSHIFT;
959
960
268M
      mul_4 = ixheaac_mult64(xt1_0, co10);
961
268M
      mul_1 = ixheaac_mult64(yt1_0, si10);
962
268M
      x[h2] = (WORD32)((mul_1 + mul_4) >> 32) << RADIXSHIFT;
963
964
268M
      mul_10 = ixheaac_mult64(xt1_0, si10);
965
268M
      mul_7 = ixheaac_mult64(yt1_0, co10);
966
268M
      x[h2 + 1] = (WORD32)((mul_7 - mul_10) >> 32) << RADIXSHIFT;
967
968
268M
      x += 2;
969
268M
    }
970
79.3M
    x += fft_jmp;
971
79.3M
    w_ptr = w_ptr - fft_jmp;
972
79.3M
  }
973
42.6M
}
974
975
VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
976
                                     const WORD32 *pdig_rev_tbl,
977
12.2M
                                     WORD32 npoints) {
978
12.2M
  WORD32 i, k;
979
12.2M
  WORD32 h2;
980
12.2M
  WORD32 x_0, x_1, x_2, x_3;
981
12.2M
  WORD32 x_4, x_5, x_6, x_7;
982
12.2M
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
983
12.2M
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
984
12.2M
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
985
12.2M
  WORD32 *x2, *x0;
986
12.2M
  WORD32 *y0, *y1, *y2, *y3;
987
988
12.2M
  y0 = ptr_y;
989
12.2M
  y2 = ptr_y + (WORD32)npoints;
990
12.2M
  x0 = ptr_x;
991
12.2M
  x2 = ptr_x + (WORD32)(npoints >> 1);
992
993
12.2M
  y1 = y0 + (WORD32)(npoints >> 2);
994
12.2M
  y3 = y2 + (WORD32)(npoints >> 2);
995
996
36.6M
  for (k = 0; k < 2; k++) {
997
73.2M
    for (i = 0; i<npoints>> 1; i += 8) {
998
48.8M
      h2 = *pdig_rev_tbl++ >> 2;
999
1000
48.8M
      x_0 = *x0++;
1001
48.8M
      x_1 = *x0++;
1002
48.8M
      x_2 = *x0++;
1003
48.8M
      x_3 = *x0++;
1004
48.8M
      x_4 = *x0++;
1005
48.8M
      x_5 = *x0++;
1006
48.8M
      x_6 = *x0++;
1007
48.8M
      x_7 = *x0++;
1008
1009
48.8M
      n00 = ixheaac_add32_sat(x_0, x_2);
1010
48.8M
      n01 = ixheaac_add32_sat(x_1, x_3);
1011
48.8M
      n20 = ixheaac_sub32_sat(x_0, x_2);
1012
48.8M
      n21 = ixheaac_sub32_sat(x_1, x_3);
1013
48.8M
      n10 = ixheaac_add32_sat(x_4, x_6);
1014
48.8M
      n11 = ixheaac_add32_sat(x_5, x_7);
1015
48.8M
      n30 = ixheaac_sub32_sat(x_4, x_6);
1016
48.8M
      n31 = ixheaac_sub32_sat(x_5, x_7);
1017
1018
48.8M
      y0[h2] = n00;
1019
48.8M
      y0[h2 + 1] = n01;
1020
48.8M
      y1[h2] = n10;
1021
48.8M
      y1[h2 + 1] = n11;
1022
48.8M
      y2[h2] = n20;
1023
48.8M
      y2[h2 + 1] = n21;
1024
48.8M
      y3[h2] = n30;
1025
48.8M
      y3[h2 + 1] = n31;
1026
1027
48.8M
      x_8 = *x2++;
1028
48.8M
      x_9 = *x2++;
1029
48.8M
      x_a = *x2++;
1030
48.8M
      x_b = *x2++;
1031
48.8M
      x_c = *x2++;
1032
48.8M
      x_d = *x2++;
1033
48.8M
      x_e = *x2++;
1034
48.8M
      x_f = *x2++;
1035
1036
48.8M
      n02 = ixheaac_add32_sat(x_8, x_a);
1037
48.8M
      n03 = ixheaac_add32_sat(x_9, x_b);
1038
48.8M
      n22 = ixheaac_sub32_sat(x_8, x_a);
1039
48.8M
      n23 = ixheaac_sub32_sat(x_9, x_b);
1040
48.8M
      n12 = ixheaac_add32_sat(x_c, x_e);
1041
48.8M
      n13 = ixheaac_add32_sat(x_d, x_f);
1042
48.8M
      n32 = ixheaac_sub32_sat(x_c, x_e);
1043
48.8M
      n33 = ixheaac_sub32_sat(x_d, x_f);
1044
1045
48.8M
      y0[h2 + 2] = n02;
1046
48.8M
      y0[h2 + 3] = n03;
1047
48.8M
      y1[h2 + 2] = n12;
1048
48.8M
      y1[h2 + 3] = n13;
1049
48.8M
      y2[h2 + 2] = n22;
1050
48.8M
      y2[h2 + 3] = n23;
1051
48.8M
      y3[h2 + 2] = n32;
1052
48.8M
      y3[h2 + 3] = n33;
1053
48.8M
    }
1054
24.4M
    x0 += (WORD32)npoints >> 1;
1055
24.4M
    x2 += (WORD32)npoints >> 1;
1056
24.4M
  }
1057
12.2M
}
1058
1059
VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
1060
                                     const WORD32 *p_dig_rev_tbl,
1061
18.2M
                                     WORD32 npoints) {
1062
18.2M
  WORD32 i, k;
1063
18.2M
  WORD32 h2;
1064
18.2M
  WORD32 xh0_0, xh1_0, xl0_0, xl1_0;
1065
18.2M
  WORD32 xh0_1, xh1_1, xl0_1, xl1_1;
1066
18.2M
  WORD32 x_0, x_1, x_2, x_3;
1067
18.2M
  WORD32 xh0_2, xh1_2, xl0_2, xl1_2, xh0_3, xh1_3, xl0_3, xl1_3;
1068
18.2M
  WORD32 x_4, x_5, x_6, x_7;
1069
18.2M
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
1070
18.2M
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
1071
18.2M
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
1072
18.2M
  WORD32 *x2, *x0;
1073
18.2M
  WORD32 *y0, *y1, *y2, *y3;
1074
1075
18.2M
  y0 = ptr_y;
1076
18.2M
  y2 = ptr_y + (WORD32)npoints;
1077
18.2M
  x0 = ptr_x;
1078
18.2M
  x2 = ptr_x + (WORD32)(npoints >> 1);
1079
1080
18.2M
  y1 = y0 + (WORD32)(npoints >> 1);
1081
18.2M
  y3 = y2 + (WORD32)(npoints >> 1);
1082
1083
54.7M
  for (k = 0; k < 2; k++) {
1084
73.0M
    for (i = 0; i<npoints>> 1; i += 8) {
1085
36.5M
      h2 = *p_dig_rev_tbl++ >> 2;
1086
36.5M
      x_0 = *x0++;
1087
36.5M
      x_1 = *x0++;
1088
36.5M
      x_2 = *x0++;
1089
36.5M
      x_3 = *x0++;
1090
36.5M
      x_4 = *x0++;
1091
36.5M
      x_5 = *x0++;
1092
36.5M
      x_6 = *x0++;
1093
36.5M
      x_7 = *x0++;
1094
1095
36.5M
      xh0_0 = ixheaac_add32_sat(x_0, x_4);
1096
36.5M
      xh1_0 = ixheaac_add32_sat(x_1, x_5);
1097
36.5M
      xl0_0 = ixheaac_sub32_sat(x_0, x_4);
1098
36.5M
      xl1_0 = ixheaac_sub32_sat(x_1, x_5);
1099
36.5M
      xh0_1 = ixheaac_add32_sat(x_2, x_6);
1100
36.5M
      xh1_1 = ixheaac_add32_sat(x_3, x_7);
1101
36.5M
      xl0_1 = ixheaac_sub32_sat(x_2, x_6);
1102
36.5M
      xl1_1 = ixheaac_sub32_sat(x_3, x_7);
1103
1104
36.5M
      n00 = ixheaac_add32_sat(xh0_0, xh0_1);
1105
36.5M
      n01 = ixheaac_add32_sat(xh1_0, xh1_1);
1106
36.5M
      n10 = ixheaac_add32_sat(xl0_0, xl1_1);
1107
36.5M
      n11 = ixheaac_sub32_sat(xl1_0, xl0_1);
1108
36.5M
      n20 = ixheaac_sub32_sat(xh0_0, xh0_1);
1109
36.5M
      n21 = ixheaac_sub32_sat(xh1_0, xh1_1);
1110
36.5M
      n30 = ixheaac_sub32_sat(xl0_0, xl1_1);
1111
36.5M
      n31 = ixheaac_add32_sat(xl1_0, xl0_1);
1112
1113
36.5M
      y0[h2] = n00;
1114
36.5M
      y0[h2 + 1] = n01;
1115
36.5M
      y1[h2] = n10;
1116
36.5M
      y1[h2 + 1] = n11;
1117
36.5M
      y2[h2] = n20;
1118
36.5M
      y2[h2 + 1] = n21;
1119
36.5M
      y3[h2] = n30;
1120
36.5M
      y3[h2 + 1] = n31;
1121
1122
36.5M
      x_8 = *x2++;
1123
36.5M
      x_9 = *x2++;
1124
36.5M
      x_a = *x2++;
1125
36.5M
      x_b = *x2++;
1126
36.5M
      x_c = *x2++;
1127
36.5M
      x_d = *x2++;
1128
36.5M
      x_e = *x2++;
1129
36.5M
      x_f = *x2++;
1130
1131
36.5M
      xh0_2 = ixheaac_add32_sat(x_8, x_c);
1132
36.5M
      xh1_2 = ixheaac_add32_sat(x_9, x_d);
1133
36.5M
      xl0_2 = ixheaac_sub32_sat(x_8, x_c);
1134
36.5M
      xl1_2 = ixheaac_sub32_sat(x_9, x_d);
1135
36.5M
      xh0_3 = ixheaac_add32_sat(x_a, x_e);
1136
36.5M
      xh1_3 = ixheaac_add32_sat(x_b, x_f);
1137
36.5M
      xl0_3 = ixheaac_sub32_sat(x_a, x_e);
1138
36.5M
      xl1_3 = ixheaac_sub32_sat(x_b, x_f);
1139
1140
36.5M
      n02 = ixheaac_add32_sat(xh0_2, xh0_3);
1141
36.5M
      n03 = ixheaac_add32_sat(xh1_2, xh1_3);
1142
36.5M
      n12 = ixheaac_add32_sat(xl0_2, xl1_3);
1143
36.5M
      n13 = ixheaac_sub32_sat(xl1_2, xl0_3);
1144
36.5M
      n22 = ixheaac_sub32_sat(xh0_2, xh0_3);
1145
36.5M
      n23 = ixheaac_sub32_sat(xh1_2, xh1_3);
1146
36.5M
      n32 = ixheaac_sub32_sat(xl0_2, xl1_3);
1147
36.5M
      n33 = ixheaac_add32_sat(xl1_2, xl0_3);
1148
1149
36.5M
      y0[h2 + 2] = n02;
1150
36.5M
      y0[h2 + 3] = n03;
1151
36.5M
      y1[h2 + 2] = n12;
1152
36.5M
      y1[h2 + 3] = n13;
1153
36.5M
      y2[h2 + 2] = n22;
1154
36.5M
      y2[h2 + 3] = n23;
1155
36.5M
      y3[h2 + 2] = n32;
1156
36.5M
      y3[h2 + 3] = n33;
1157
36.5M
    }
1158
36.5M
    x0 += (WORD32)npoints >> 1;
1159
36.5M
    x2 += (WORD32)npoints >> 1;
1160
36.5M
  }
1161
18.2M
}
1162
1163
VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
1164
                               ia_sbr_qmf_filter_bank_struct *qmf_bank,
1165
18.7M
                               WORD32 *p_twiddle, WORD32 *p_dig_rev_tbl) {
1166
18.7M
  WORD32 z;
1167
18.7M
  WORD32 temp[128];
1168
18.7M
  WORD32 scaleshift = 0;
1169
1170
18.7M
  WORD32 re2, re3;
1171
18.7M
  WORD32 wim, wre;
1172
1173
18.7M
  WORD32 i, M_2;
1174
18.7M
  WORD32 M = ixheaac_shr32(qmf_bank->no_channels, 1);
1175
1176
18.7M
  const WORD32 *p_sin;
1177
18.7M
  const WORD32 *p_sin_cos;
1178
1179
18.7M
  WORD32 subband_tmp[128];
1180
18.7M
  WORD32 re;
1181
18.7M
  WORD32 im;
1182
18.7M
  WORD32 *psubband, *psubband1;
1183
18.7M
  WORD32 *psubband_t, *psubband1_t;
1184
18.7M
  WORD32 *psubband2, *psubband12;
1185
18.7M
  WORD32 *psubband_t2, *psubband1_t2;
1186
1187
18.7M
  M_2 = ixheaac_shr32(M, 1);
1188
1189
18.7M
  p_sin_cos = qmf_bank->esbr_cos_twiddle;
1190
1191
18.7M
  psubband = &subband[0];
1192
18.7M
  psubband1 = &subband[2 * M - 1];
1193
18.7M
  psubband_t = subband_tmp;
1194
18.7M
  psubband1_t = &subband_tmp[2 * M - 1];
1195
1196
18.7M
  psubband2 = &subband[64];
1197
18.7M
  psubband12 = &subband[2 * M - 1 + 64];
1198
18.7M
  psubband_t2 = &subband_tmp[64];
1199
18.7M
  psubband1_t2 = &subband_tmp[2 * M - 1 + 64];
1200
1201
112M
  for (i = (M_2 >> 1) - 1; i >= 0; i--) {
1202
93.4M
    re = *psubband++;
1203
93.4M
    im = *psubband1--;
1204
1205
93.4M
    wim = *p_sin_cos++;
1206
93.4M
    wre = *p_sin_cos++;
1207
1208
93.4M
    *psubband_t++ = (WORD32)(
1209
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1210
93.4M
        32);
1211
93.4M
    *psubband_t++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1212
93.4M
                                                 ixheaac_mult64(re, wim))) >>
1213
93.4M
                             32);
1214
1215
93.4M
    re = *psubband2++;
1216
93.4M
    im = *psubband12--;
1217
1218
93.4M
    *psubband_t2++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1219
93.4M
                                                  ixheaac_mult64(re, wre))) >>
1220
93.4M
                              32);
1221
93.4M
    *psubband_t2++ = (WORD32)(
1222
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1223
93.4M
        32);
1224
1225
93.4M
    re = *psubband1--;
1226
93.4M
    im = *psubband++;
1227
1228
93.4M
    wim = *p_sin_cos++;
1229
93.4M
    wre = *p_sin_cos++;
1230
1231
93.4M
    *psubband1_t-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1232
93.4M
                                                  ixheaac_mult64(re, wim))) >>
1233
93.4M
                              32);
1234
93.4M
    *psubband1_t-- = (WORD32)(
1235
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1236
93.4M
        32);
1237
1238
93.4M
    re = *psubband12--;
1239
93.4M
    im = *psubband2++;
1240
1241
93.4M
    *psubband1_t2-- = (WORD32)(
1242
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1243
93.4M
        32);
1244
93.4M
    *psubband1_t2-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1245
93.4M
                                                   ixheaac_mult64(re, wre))) >>
1246
93.4M
                               32);
1247
1248
93.4M
    re = *psubband++;
1249
93.4M
    im = *psubband1--;
1250
1251
93.4M
    wim = *p_sin_cos++;
1252
93.4M
    wre = *p_sin_cos++;
1253
1254
93.4M
    *psubband_t++ = (WORD32)(
1255
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1256
93.4M
        32);
1257
93.4M
    *psubband_t++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1258
93.4M
                                                 ixheaac_mult64(re, wim))) >>
1259
93.4M
                             32);
1260
1261
93.4M
    re = *psubband2++;
1262
93.4M
    im = *psubband12--;
1263
1264
93.4M
    *psubband_t2++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1265
93.4M
                                                  ixheaac_mult64(re, wre))) >>
1266
93.4M
                              32);
1267
93.4M
    *psubband_t2++ = (WORD32)(
1268
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1269
93.4M
        32);
1270
1271
93.4M
    re = *psubband1--;
1272
93.4M
    im = *psubband++;
1273
1274
93.4M
    wim = *p_sin_cos++;
1275
93.4M
    wre = *p_sin_cos++;
1276
1277
93.4M
    *psubband1_t-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1278
93.4M
                                                  ixheaac_mult64(re, wim))) >>
1279
93.4M
                              32);
1280
93.4M
    *psubband1_t-- = (WORD32)(
1281
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1282
93.4M
        32);
1283
1284
93.4M
    re = *psubband12--;
1285
93.4M
    im = *psubband2++;
1286
1287
93.4M
    *psubband1_t2-- = (WORD32)(
1288
93.4M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1289
93.4M
        32);
1290
93.4M
    *psubband1_t2-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1291
93.4M
                                                   ixheaac_mult64(re, wre))) >>
1292
93.4M
                               32);
1293
93.4M
  }
1294
1295
18.7M
  if (M == 32) {
1296
6.10M
    ixheaacd_esbr_radix4bfly(p_twiddle, subband_tmp, 1, 8);
1297
6.10M
    ixheaacd_esbr_radix4bfly(p_twiddle + 48, subband_tmp, 4, 2);
1298
6.10M
    ixheaacd_esbr_postradixcompute2(subband, subband_tmp, p_dig_rev_tbl, 32);
1299
1300
6.10M
    ixheaacd_esbr_radix4bfly(p_twiddle, &subband_tmp[64], 1, 8);
1301
6.10M
    ixheaacd_esbr_radix4bfly(p_twiddle + 48, &subband_tmp[64], 4, 2);
1302
6.10M
    ixheaacd_esbr_postradixcompute2(&subband[64], &subband_tmp[64],
1303
6.10M
                                    p_dig_rev_tbl, 32);
1304
1305
6.10M
  }
1306
1307
12.6M
  else if (M == 16) {
1308
9.13M
    ixheaacd_esbr_radix4bfly(p_twiddle, subband_tmp, 1, 4);
1309
9.13M
    ixheaacd_esbr_postradixcompute4(subband, subband_tmp, p_dig_rev_tbl, 16);
1310
1311
9.13M
    ixheaacd_esbr_radix4bfly(p_twiddle, &subband_tmp[64], 1, 4);
1312
9.13M
    ixheaacd_esbr_postradixcompute4(&subband[64], &subband_tmp[64],
1313
9.13M
                                    p_dig_rev_tbl, 16);
1314
1315
9.13M
  }
1316
1317
3.52M
  else if (M == 12) {
1318
13.6M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1319
12.6M
      temp[z] = subband_tmp[2 * z];
1320
12.6M
      temp[12 + z] = subband_tmp[2 * z + 1];
1321
12.6M
    }
1322
1323
1.05M
    ixheaacd_complex_fft_p3(temp, &temp[12], 12, -1, &scaleshift);
1324
1325
13.6M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1326
12.6M
      subband[2 * z] = temp[z];
1327
12.6M
      subband[2 * z + 1] = temp[z + 12];
1328
12.6M
    }
1329
1.05M
    scaleshift = 0;
1330
13.6M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1331
12.6M
      temp[z] = subband_tmp[64 + 2 * z];
1332
12.6M
      temp[12 + z] = subband_tmp[64 + 2 * z + 1];
1333
12.6M
    }
1334
1335
1.05M
    ixheaacd_complex_fft_p3(temp, &temp[12], 12, -1, &scaleshift);
1336
1337
13.6M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1338
12.6M
      subband[64 + 2 * z] = temp[z];
1339
12.6M
      subband[64 + 2 * z + 1] = temp[z + 12];
1340
12.6M
    }
1341
1342
1.05M
  }
1343
1344
2.47M
  else {
1345
22.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1346
19.7M
      temp[z] = subband_tmp[2 * z];
1347
19.7M
      temp[8 + z] = subband_tmp[2 * z + 1];
1348
19.7M
    }
1349
1350
2.47M
    (*ixheaacd_complex_fft_p2)(temp, &temp[8], 8, -1, &scaleshift);
1351
1352
22.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1353
19.7M
      subband[2 * z] = temp[z] << scaleshift;
1354
19.7M
      subband[2 * z + 1] = temp[z + 8] << scaleshift;
1355
19.7M
    }
1356
2.47M
    scaleshift = 0;
1357
22.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1358
19.7M
      temp[z] = subband_tmp[64 + 2 * z];
1359
19.7M
      temp[8 + z] = subband_tmp[64 + 2 * z + 1];
1360
19.7M
    }
1361
1362
2.47M
    (*ixheaacd_complex_fft_p2)(temp, &temp[8], 8, -1, &scaleshift);
1363
1364
22.2M
    for (z = 0; z < (qmf_bank->no_channels >> 1); z++) {
1365
19.7M
      subband[64 + 2 * z] = temp[z] << scaleshift;
1366
19.7M
      subband[64 + 2 * z + 1] = temp[8 + z] << scaleshift;
1367
19.7M
    }
1368
2.47M
  }
1369
1370
18.7M
  psubband = &subband[0];
1371
18.7M
  psubband1 = &subband[2 * M - 1];
1372
1373
18.7M
  re = *psubband1;
1374
1375
18.7M
  *psubband = *psubband >> 1;
1376
18.7M
  psubband++;
1377
18.7M
  *psubband1 = ixheaac_negate32_sat(*psubband >> 1);
1378
18.7M
  psubband1--;
1379
1380
18.7M
  p_sin = qmf_bank->esbr_alt_sin_twiddle;
1381
1382
18.7M
  wim = *p_sin++;
1383
18.7M
  wre = *p_sin++;
1384
1385
18.7M
  im = *psubband1;
1386
1387
18.7M
  *psubband1-- = (WORD32)(
1388
18.7M
      (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1389
18.7M
      32);
1390
18.7M
  *psubband++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1391
18.7M
                                             ixheaac_mult64(re, wim))) >>
1392
18.7M
                         32);
1393
1394
18.7M
  psubband2 = &subband[64];
1395
18.7M
  psubband12 = &subband[2 * M - 1 + 64];
1396
1397
18.7M
  re = *psubband12;
1398
1399
18.7M
  *psubband12-- = ixheaac_negate32_sat(*psubband2 >> 1);
1400
1401
18.7M
  *psubband2 = psubband2[1] >> 1;
1402
1403
18.7M
  psubband2++;
1404
1405
18.7M
  im = *psubband12;
1406
1407
18.7M
  *psubband2++ = ixheaac_negate32_sat((WORD32)(
1408
18.7M
      (ixheaac_add64(ixheaac_mult64(re, wre), ixheaac_mult64(im, wim))) >>
1409
18.7M
      32));
1410
18.7M
  *psubband12-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(re, wim),
1411
18.7M
                                               ixheaac_mult64(im, wre))) >>
1412
18.7M
                           32);
1413
1414
186M
  for (i = (M_2 - 2); i >= 0; i--) {
1415
168M
    im = psubband[0];
1416
1417
168M
    re = psubband[1];
1418
1419
168M
    re2 = *psubband1;
1420
1421
168M
    *psubband++ = (WORD32)(
1422
168M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1423
168M
        32);
1424
168M
    *psubband1-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wim),
1425
168M
                                                ixheaac_mult64(re, wre))) >>
1426
168M
                            32);
1427
1428
168M
    im = psubband2[0];
1429
1430
168M
    re = psubband2[1];
1431
1432
168M
    re3 = *psubband12;
1433
1434
168M
    *psubband12-- = ixheaac_negate32_sat((WORD32)(
1435
168M
        (ixheaac_add64(ixheaac_mult64(re, wim), ixheaac_mult64(im, wre))) >>
1436
168M
        32));
1437
168M
    *psubband2++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(re, wre),
1438
168M
                                                ixheaac_mult64(im, wim))) >>
1439
168M
                            32);
1440
1441
168M
    wim = *p_sin++;
1442
168M
    wre = *p_sin++;
1443
168M
    im = psubband1[0];
1444
1445
168M
    *psubband1-- = (WORD32)(
1446
168M
        (ixheaac_add64(ixheaac_mult64(re2, wre), ixheaac_mult64(im, wim))) >>
1447
168M
        32);
1448
168M
    *psubband++ = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, wre),
1449
168M
                                               ixheaac_mult64(re2, wim))) >>
1450
168M
                           32);
1451
1452
168M
    im = psubband12[0];
1453
1454
168M
    *psubband2++ = ixheaac_negate32_sat((WORD32)(
1455
168M
        (ixheaac_add64(ixheaac_mult64(re3, wre), ixheaac_mult64(im, wim))) >>
1456
168M
        32));
1457
168M
    *psubband12-- = (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(re3, wim),
1458
168M
                                                 ixheaac_mult64(im, wre))) >>
1459
168M
                             32);
1460
168M
  }
1461
18.7M
}
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
12.6M
    ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
1467
12.6M
  WORD32 i;
1468
12.6M
  const WORD32 *time_sample_buf1 =
1469
12.6M
      &time_sample_buf[2 * qmf_bank->no_channels - 1];
1470
12.6M
  WORD32 temp1, temp2;
1471
12.6M
  WORD32 *t_real_subband = real_subband;
1472
12.6M
  WORD32 *t_imag_subband = imag_subband;
1473
12.6M
  const WORD32 *tcos;
1474
1475
369M
  for (i = qmf_bank->no_channels - 1; i >= 0; i--) {
1476
356M
    temp1 = ixheaac_shr32(*time_sample_buf++, HQ_SHIFT_64);
1477
356M
    temp2 = ixheaac_shr32(*time_sample_buf1--, HQ_SHIFT_64);
1478
1479
356M
    *t_real_subband++ = ixheaac_sub32_sat(temp1, temp2);
1480
1481
356M
    *t_imag_subband++ = ixheaac_add32_sat(temp1, temp2);
1482
356M
  }
1483
1484
12.6M
  ixheaacd_esbr_cos_sin_mod(real_subband, qmf_bank,
1485
12.6M
                            qmf_dec_tables_ptr->esbr_w_16,
1486
12.6M
                            qmf_dec_tables_ptr->dig_rev_table4_16);
1487
1488
12.6M
  tcos = qmf_bank->esbr_t_cos;
1489
1490
369M
  for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
1491
356M
    WORD32 cosh, sinh;
1492
356M
    WORD32 re, im;
1493
1494
356M
    re = *real_subband;
1495
356M
    im = *imag_subband;
1496
356M
    cosh = *tcos++;
1497
356M
    sinh = *tcos++;
1498
356M
    *real_subband++ = (WORD32)((ixheaac_add64(ixheaac_mult64(re, cosh),
1499
356M
                                               ixheaac_mult64(im, sinh))) >>
1500
356M
                               31);
1501
356M
    *imag_subband++ =
1502
356M
        (WORD32)((ixheaac_sub64_sat(ixheaac_mult64(im, cosh),
1503
356M
                                     ixheaac_mult64(re, sinh))) >>
1504
356M
                 31);
1505
356M
  }
1506
12.6M
}
1507
1508
VOID ixheaacd_sbr_qmfsyn64_winadd(WORD16 *tmp1, WORD16 *tmp2, WORD16 *inp1,
1509
                                  WORD16 *sample_buffer, FLAG shift,
1510
292k
                                  WORD32 ch_fac) {
1511
292k
  WORD32 k;
1512
292k
  WORD32 rounding_fac = 0x8000;
1513
292k
  rounding_fac = rounding_fac >> shift;
1514
1515
19.0M
  for (k = 0; k < 64; k++) {
1516
18.7M
    WORD32 syn_out = rounding_fac;
1517
1518
18.7M
    syn_out = ixheaac_add32_sat(
1519
18.7M
        syn_out, ixheaac_mult16x16in32(tmp1[0 + k], inp1[k + 0]));
1520
18.7M
    syn_out = ixheaac_add32_sat(
1521
18.7M
        syn_out, ixheaac_mult16x16in32(tmp1[256 + k], inp1[k + 128]));
1522
18.7M
    syn_out = ixheaac_add32_sat(
1523
18.7M
        syn_out, ixheaac_mult16x16in32(tmp1[512 + k], inp1[k + 256]));
1524
18.7M
    syn_out = ixheaac_add32_sat(
1525
18.7M
        syn_out, ixheaac_mult16x16in32(tmp1[768 + k], inp1[k + 384]));
1526
18.7M
    syn_out = ixheaac_add32_sat(
1527
18.7M
        syn_out, ixheaac_mult16x16in32(tmp1[1024 + k], inp1[k + 512]));
1528
1529
18.7M
    syn_out = ixheaac_add32_sat(
1530
18.7M
        syn_out, ixheaac_mult16x16in32(tmp2[128 + k], inp1[k + 64]));
1531
18.7M
    syn_out = ixheaac_add32_sat(
1532
18.7M
        syn_out, ixheaac_mult16x16in32(tmp2[384 + k], inp1[k + 192]));
1533
18.7M
    syn_out = ixheaac_add32_sat(
1534
18.7M
        syn_out, ixheaac_mult16x16in32(tmp2[640 + k], inp1[k + 320]));
1535
18.7M
    syn_out = ixheaac_add32_sat(
1536
18.7M
        syn_out, ixheaac_mult16x16in32(tmp2[896 + k], inp1[k + 448]));
1537
18.7M
    syn_out = ixheaac_add32_sat(
1538
18.7M
        syn_out, ixheaac_mult16x16in32(tmp2[1152 + k], inp1[k + 576]));
1539
1540
18.7M
    sample_buffer[ch_fac * k] = (ixheaac_shl32_sat(syn_out, shift) >> 16);
1541
18.7M
  }
1542
292k
}
1543
1544
VOID ixheaacd_esbr_qmfsyn64_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1,
1545
6.10M
                                   WORD32 *sample_buffer, WORD32 ch_fac) {
1546
6.10M
  WORD32 k;
1547
1548
397M
  for (k = 0; k < 64; k++) {
1549
390M
    WORD64 syn_out = 0;
1550
1551
390M
    syn_out =
1552
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[0 + k], inp1[k + 0]));
1553
390M
    syn_out =
1554
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[256 + k], inp1[k + 128]));
1555
390M
    syn_out =
1556
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[512 + k], inp1[k + 256]));
1557
390M
    syn_out =
1558
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[768 + k], inp1[k + 384]));
1559
390M
    syn_out =
1560
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[1024 + k], inp1[k + 512]));
1561
1562
390M
    syn_out =
1563
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[128 + k], inp1[k + 64]));
1564
390M
    syn_out =
1565
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[384 + k], inp1[k + 192]));
1566
390M
    syn_out =
1567
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[640 + k], inp1[k + 320]));
1568
390M
    syn_out =
1569
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[896 + k], inp1[k + 448]));
1570
390M
    syn_out =
1571
390M
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[1152 + k], inp1[k + 576]));
1572
1573
390M
    sample_buffer[ch_fac * k] = (WORD32)(syn_out >> 31);
1574
390M
  }
1575
6.10M
}
1576
1577
VOID ixheaacd_esbr_qmfsyn32_winadd(WORD32 *tmp1, WORD32 *tmp2, WORD32 *inp1,
1578
9.88k
                                   WORD32 *sample_buffer, WORD32 ch_fac) {
1579
9.88k
  WORD32 k;
1580
1581
326k
  for (k = 0; k < 32; k++) {
1582
316k
    WORD64 syn_out = 0;
1583
1584
316k
    syn_out =
1585
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[0 + k], inp1[2 * (k + 0)]));
1586
316k
    syn_out =
1587
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[128 + k], inp1[2 * (k + 64)]));
1588
316k
    syn_out =
1589
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[256 + k], inp1[2 * (k + 128)]));
1590
316k
    syn_out =
1591
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[384 + k], inp1[2 * (k + 192)]));
1592
316k
    syn_out =
1593
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp1[512 + k], inp1[2 * (k + 256)]));
1594
1595
316k
    syn_out =
1596
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[64 + k], inp1[2 * (k + 32)]));
1597
316k
    syn_out =
1598
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[192 + k], inp1[2 * (k + 96)]));
1599
316k
    syn_out =
1600
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[320 + k], inp1[2 * (k + 160)]));
1601
316k
    syn_out =
1602
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[448 + k], inp1[2 * (k + 224)]));
1603
316k
    syn_out =
1604
316k
        ixheaac_add64(syn_out, ixheaac_mult64(tmp2[576 + k], inp1[2 * (k + 288)]));
1605
1606
316k
    sample_buffer[ch_fac * k] = (WORD32)(syn_out >> 31);
1607
316k
  }
1608
9.88k
}
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
874k
                                         WORD32 shift) {
1675
874k
  WORD16 *filter_states_rev = filter_states + len;
1676
874k
  WORD32 treal, timag;
1677
874k
  WORD32 j;
1678
1679
19.5M
  for (j = (len - 1); j >= 0; j -= 2) {
1680
18.6M
    WORD32 r1, r2, i1, i2;
1681
18.6M
    i2 = qmf_imag[j];
1682
18.6M
    r2 = qmf_real[j];
1683
18.6M
    r1 = *qmf_real++;
1684
18.6M
    i1 = *qmf_imag++;
1685
1686
18.6M
    timag = ixheaac_negate32_sat(ixheaac_add32_sat(i1, r1));
1687
18.6M
    timag = (ixheaac_shl32_sat(timag, shift));
1688
18.6M
    filter_states_rev[j] = ixheaac_round16(timag);
1689
1690
18.6M
    treal = ixheaac_sub32_sat(r2, i2);
1691
18.6M
    treal = (ixheaac_shl32_sat(treal, shift));
1692
18.6M
    filter_states[j] = ixheaac_round16(treal);
1693
1694
18.6M
    treal = ixheaac_sub32_sat(r1, i1);
1695
18.6M
    treal = (ixheaac_shl32_sat(treal, shift));
1696
18.6M
    *filter_states++ = ixheaac_round16(treal);
1697
1698
18.6M
    timag = ixheaac_negate32_sat(ixheaac_add32_sat(i2, r2));
1699
18.6M
    timag = (ixheaac_shl32_sat(timag, shift));
1700
18.6M
    *filter_states_rev++ = ixheaac_round16(timag);
1701
18.6M
  }
1702
874k
}
1703
1704
VOID ixheaacd_shiftrountine_with_rnd_hq(WORD32 *qmf_real, WORD32 *qmf_imag,
1705
                                        WORD32 *filter_states, WORD32 len,
1706
6.11M
                                        WORD32 shift) {
1707
6.11M
  WORD32 *filter_states_rev = filter_states + len;
1708
6.11M
  WORD32 treal, timag;
1709
6.11M
  WORD32 j;
1710
1711
201M
  for (j = (len - 1); j >= 0; j -= 2) {
1712
195M
    WORD32 r1, r2, i1, i2;
1713
195M
    i2 = qmf_imag[j];
1714
195M
    r2 = qmf_real[j];
1715
195M
    r1 = *qmf_real++;
1716
195M
    i1 = *qmf_imag++;
1717
1718
195M
    timag = ixheaac_add32_sat(i1, r1);
1719
195M
    timag = (ixheaac_shl32_sat(timag, shift));
1720
195M
    filter_states_rev[j] = timag;
1721
1722
195M
    treal = ixheaac_sub32_sat(i2, r2);
1723
195M
    treal = (ixheaac_shl32_sat(treal, shift));
1724
195M
    filter_states[j] = treal;
1725
1726
195M
    treal = ixheaac_sub32_sat(i1, r1);
1727
195M
    treal = (ixheaac_shl32_sat(treal, shift));
1728
195M
    *filter_states++ = treal;
1729
1730
195M
    timag = ixheaac_add32_sat(i2, r2);
1731
195M
    timag = (ixheaac_shl32_sat(timag, shift));
1732
195M
    *filter_states_rev++ = timag;
1733
195M
  }
1734
6.11M
}
1735
1736
VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
1737
4.42M
                         WORD32 index) {
1738
4.42M
  int i;
1739
4.42M
  WORD32 l1, l2, h2, fft_jmp;
1740
4.42M
  WORD32 xt0_0, yt0_0, xt1_0, yt1_0, xt2_0, yt2_0;
1741
4.42M
  WORD32 xh0_0, xh1_0, xh20_0, xh21_0, xl0_0, xl1_0, xl20_0, xl21_0;
1742
4.42M
  WORD32 x_0, x_1, x_l1_0, x_l1_1, x_l2_0, x_l2_1;
1743
4.42M
  WORD32 x_h2_0, x_h2_1;
1744
4.42M
  WORD16 si10, si20, si30, co10, co20, co30;
1745
1746
4.42M
  WORD32 mul_1, mul_2, mul_3, mul_4, mul_5, mul_6;
1747
4.42M
  WORD32 mul_7, mul_8, mul_9, mul_10, mul_11, mul_12;
1748
4.42M
  const WORD16 *w_ptr = w;
1749
4.42M
  WORD32 i1;
1750
1751
4.42M
  h2 = index << 1;
1752
4.42M
  l1 = index << 2;
1753
4.42M
  l2 = (index << 2) + (index << 1);
1754
1755
4.42M
  fft_jmp = 6 * (index);
1756
1757
11.6M
  for (i1 = 0; i1 < index1; i1++) {
1758
32.2M
    for (i = 0; i < index; i++) {
1759
25.0M
      si10 = (*w_ptr++);
1760
25.0M
      co10 = (*w_ptr++);
1761
25.0M
      si20 = (*w_ptr++);
1762
25.0M
      co20 = (*w_ptr++);
1763
25.0M
      si30 = (*w_ptr++);
1764
25.0M
      co30 = (*w_ptr++);
1765
1766
25.0M
      x_0 = x[0];
1767
25.0M
      x_h2_0 = x[h2];
1768
25.0M
      x_l1_0 = x[l1];
1769
25.0M
      x_l2_0 = x[l2];
1770
1771
25.0M
      xh0_0 = ixheaac_add32_sat(x_0, x_l1_0);
1772
25.0M
      xl0_0 = ixheaac_sub32_sat(x_0, x_l1_0);
1773
1774
25.0M
      xh20_0 = ixheaac_add32_sat(x_h2_0, x_l2_0);
1775
25.0M
      xl20_0 = ixheaac_sub32_sat(x_h2_0, x_l2_0);
1776
1777
25.0M
      x[0] = ixheaac_add32_sat(xh0_0, xh20_0);
1778
25.0M
      xt0_0 = ixheaac_sub32_sat(xh0_0, xh20_0);
1779
1780
25.0M
      x_1 = x[1];
1781
25.0M
      x_h2_1 = x[h2 + 1];
1782
25.0M
      x_l1_1 = x[l1 + 1];
1783
25.0M
      x_l2_1 = x[l2 + 1];
1784
1785
25.0M
      xh1_0 = ixheaac_add32_sat(x_1, x_l1_1);
1786
25.0M
      xl1_0 = ixheaac_sub32_sat(x_1, x_l1_1);
1787
1788
25.0M
      xh21_0 = ixheaac_add32_sat(x_h2_1, x_l2_1);
1789
25.0M
      xl21_0 = ixheaac_sub32_sat(x_h2_1, x_l2_1);
1790
1791
25.0M
      x[1] = ixheaac_add32_sat(xh1_0, xh21_0);
1792
25.0M
      yt0_0 = ixheaac_sub32_sat(xh1_0, xh21_0);
1793
1794
25.0M
      xt1_0 = ixheaac_add32_sat(xl0_0, xl21_0);
1795
25.0M
      xt2_0 = ixheaac_sub32_sat(xl0_0, xl21_0);
1796
1797
25.0M
      yt2_0 = ixheaac_add32_sat(xl1_0, xl20_0);
1798
25.0M
      yt1_0 = ixheaac_sub32_sat(xl1_0, xl20_0);
1799
1800
25.0M
      mul_11 = ixheaac_mult32x16in32(xt2_0, co30);
1801
25.0M
      mul_3 = ixheaac_mult32x16in32(yt2_0, si30);
1802
25.0M
      x[l2] = (mul_3 + mul_11) << RADIXSHIFT;
1803
1804
25.0M
      mul_5 = ixheaac_mult32x16in32(xt2_0, si30);
1805
25.0M
      mul_9 = ixheaac_mult32x16in32(yt2_0, co30);
1806
25.0M
      x[l2 + 1] = (mul_9 - mul_5) << RADIXSHIFT;
1807
1808
25.0M
      mul_12 = ixheaac_mult32x16in32(xt0_0, co20);
1809
25.0M
      mul_2 = ixheaac_mult32x16in32(yt0_0, si20);
1810
25.0M
      x[l1] = (mul_2 + mul_12) << RADIXSHIFT;
1811
1812
25.0M
      mul_6 = ixheaac_mult32x16in32(xt0_0, si20);
1813
25.0M
      mul_8 = ixheaac_mult32x16in32(yt0_0, co20);
1814
25.0M
      x[l1 + 1] = (mul_8 - mul_6) << RADIXSHIFT;
1815
1816
25.0M
      mul_4 = ixheaac_mult32x16in32(xt1_0, co10);
1817
25.0M
      mul_1 = ixheaac_mult32x16in32(yt1_0, si10);
1818
25.0M
      x[h2] = (mul_1 + mul_4) << RADIXSHIFT;
1819
1820
25.0M
      mul_10 = ixheaac_mult32x16in32(xt1_0, si10);
1821
25.0M
      mul_7 = ixheaac_mult32x16in32(yt1_0, co10);
1822
25.0M
      x[h2 + 1] = (mul_7 - mul_10) << RADIXSHIFT;
1823
1824
25.0M
      x += 2;
1825
25.0M
    }
1826
7.18M
    x += fft_jmp;
1827
7.18M
    w_ptr = w_ptr - fft_jmp;
1828
7.18M
  }
1829
4.42M
}
1830
1831
VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
1832
2.57M
                                const WORD32 *p_dig_rev_tbl, WORD32 npoints) {
1833
2.57M
  WORD32 i, k;
1834
2.57M
  WORD32 h2;
1835
2.57M
  WORD32 xh0_0, xh1_0, xl0_0, xl1_0;
1836
2.57M
  WORD32 xh0_1, xh1_1, xl0_1, xl1_1;
1837
2.57M
  WORD32 x_0, x_1, x_2, x_3;
1838
2.57M
  WORD32 xh0_2, xh1_2, xl0_2, xl1_2, xh0_3, xh1_3, xl0_3, xl1_3;
1839
2.57M
  WORD32 x_4, x_5, x_6, x_7;
1840
2.57M
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
1841
2.57M
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
1842
2.57M
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
1843
2.57M
  WORD32 *x2, *x0;
1844
2.57M
  WORD32 *y0, *y1, *y2, *y3;
1845
1846
2.57M
  y0 = ptr_y;
1847
2.57M
  y2 = ptr_y + (WORD32)npoints;
1848
2.57M
  x0 = ptr_x;
1849
2.57M
  x2 = ptr_x + (WORD32)(npoints >> 1);
1850
1851
2.57M
  y1 = y0 + (WORD32)(npoints >> 1);
1852
2.57M
  y3 = y2 + (WORD32)(npoints >> 1);
1853
1854
7.73M
  for (k = 0; k < 2; k++) {
1855
10.3M
    for (i = 0; i<npoints>> 1; i += 8) {
1856
5.15M
      h2 = *p_dig_rev_tbl++ >> 2;
1857
5.15M
      x_0 = *x0++;
1858
5.15M
      x_1 = *x0++;
1859
5.15M
      x_2 = *x0++;
1860
5.15M
      x_3 = *x0++;
1861
5.15M
      x_4 = *x0++;
1862
5.15M
      x_5 = *x0++;
1863
5.15M
      x_6 = *x0++;
1864
5.15M
      x_7 = *x0++;
1865
1866
5.15M
      xh0_0 = ixheaac_add32_sat(x_0, x_4);
1867
5.15M
      xh1_0 = ixheaac_add32_sat(x_1, x_5);
1868
5.15M
      xl0_0 = ixheaac_sub32_sat(x_0, x_4);
1869
5.15M
      xl1_0 = ixheaac_sub32_sat(x_1, x_5);
1870
5.15M
      xh0_1 = ixheaac_add32_sat(x_2, x_6);
1871
5.15M
      xh1_1 = ixheaac_add32_sat(x_3, x_7);
1872
5.15M
      xl0_1 = ixheaac_sub32_sat(x_2, x_6);
1873
5.15M
      xl1_1 = ixheaac_sub32_sat(x_3, x_7);
1874
1875
5.15M
      n00 = ixheaac_add32_sat(xh0_0, xh0_1);
1876
5.15M
      n01 = ixheaac_add32_sat(xh1_0, xh1_1);
1877
5.15M
      n10 = ixheaac_add32_sat(xl0_0, xl1_1);
1878
5.15M
      n11 = ixheaac_sub32_sat(xl1_0, xl0_1);
1879
5.15M
      n20 = ixheaac_sub32_sat(xh0_0, xh0_1);
1880
5.15M
      n21 = ixheaac_sub32_sat(xh1_0, xh1_1);
1881
5.15M
      n30 = ixheaac_sub32_sat(xl0_0, xl1_1);
1882
5.15M
      n31 = ixheaac_add32_sat(xl1_0, xl0_1);
1883
1884
5.15M
      y0[h2] = n00;
1885
5.15M
      y0[h2 + 1] = n01;
1886
5.15M
      y1[h2] = n10;
1887
5.15M
      y1[h2 + 1] = n11;
1888
5.15M
      y2[h2] = n20;
1889
5.15M
      y2[h2 + 1] = n21;
1890
5.15M
      y3[h2] = n30;
1891
5.15M
      y3[h2 + 1] = n31;
1892
1893
5.15M
      x_8 = *x2++;
1894
5.15M
      x_9 = *x2++;
1895
5.15M
      x_a = *x2++;
1896
5.15M
      x_b = *x2++;
1897
5.15M
      x_c = *x2++;
1898
5.15M
      x_d = *x2++;
1899
5.15M
      x_e = *x2++;
1900
5.15M
      x_f = *x2++;
1901
1902
5.15M
      xh0_2 = ixheaac_add32_sat(x_8, x_c);
1903
5.15M
      xh1_2 = ixheaac_add32_sat(x_9, x_d);
1904
5.15M
      xl0_2 = ixheaac_sub32_sat(x_8, x_c);
1905
5.15M
      xl1_2 = ixheaac_sub32_sat(x_9, x_d);
1906
5.15M
      xh0_3 = ixheaac_add32_sat(x_a, x_e);
1907
5.15M
      xh1_3 = ixheaac_add32_sat(x_b, x_f);
1908
5.15M
      xl0_3 = ixheaac_sub32_sat(x_a, x_e);
1909
5.15M
      xl1_3 = ixheaac_sub32_sat(x_b, x_f);
1910
1911
5.15M
      n02 = ixheaac_add32_sat(xh0_2, xh0_3);
1912
5.15M
      n03 = ixheaac_add32_sat(xh1_2, xh1_3);
1913
5.15M
      n12 = ixheaac_add32_sat(xl0_2, xl1_3);
1914
5.15M
      n13 = ixheaac_sub32_sat(xl1_2, xl0_3);
1915
5.15M
      n22 = ixheaac_sub32_sat(xh0_2, xh0_3);
1916
5.15M
      n23 = ixheaac_sub32_sat(xh1_2, xh1_3);
1917
5.15M
      n32 = ixheaac_sub32_sat(xl0_2, xl1_3);
1918
5.15M
      n33 = ixheaac_add32_sat(xl1_2, xl0_3);
1919
1920
5.15M
      y0[h2 + 2] = n02;
1921
5.15M
      y0[h2 + 3] = n03;
1922
5.15M
      y1[h2 + 2] = n12;
1923
5.15M
      y1[h2 + 3] = n13;
1924
5.15M
      y2[h2 + 2] = n22;
1925
5.15M
      y2[h2 + 3] = n23;
1926
5.15M
      y3[h2 + 2] = n32;
1927
5.15M
      y3[h2 + 3] = n33;
1928
5.15M
    }
1929
5.15M
    x0 += (WORD32)npoints >> 1;
1930
5.15M
    x2 += (WORD32)npoints >> 1;
1931
5.15M
  }
1932
2.57M
}
1933
1934
VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
1935
921k
                                const WORD32 *pdig_rev_tbl, WORD32 npoints) {
1936
921k
  WORD32 i, k;
1937
921k
  WORD32 h2;
1938
921k
  WORD32 x_0, x_1, x_2, x_3;
1939
921k
  WORD32 x_4, x_5, x_6, x_7;
1940
921k
  WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
1941
921k
  WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
1942
921k
  WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
1943
921k
  WORD32 *x2, *x0;
1944
921k
  WORD32 *y0, *y1, *y2, *y3;
1945
1946
921k
  y0 = ptr_y;
1947
921k
  y2 = ptr_y + (WORD32)npoints;
1948
921k
  x0 = ptr_x;
1949
921k
  x2 = ptr_x + (WORD32)(npoints >> 1);
1950
1951
921k
  y1 = y0 + (WORD32)(npoints >> 2);
1952
921k
  y3 = y2 + (WORD32)(npoints >> 2);
1953
1954
2.76M
  for (k = 0; k < 2; k++) {
1955
5.53M
    for (i = 0; i<npoints>> 1; i += 8) {
1956
3.68M
      h2 = *pdig_rev_tbl++ >> 2;
1957
1958
3.68M
      x_0 = *x0++;
1959
3.68M
      x_1 = *x0++;
1960
3.68M
      x_2 = *x0++;
1961
3.68M
      x_3 = *x0++;
1962
3.68M
      x_4 = *x0++;
1963
3.68M
      x_5 = *x0++;
1964
3.68M
      x_6 = *x0++;
1965
3.68M
      x_7 = *x0++;
1966
1967
3.68M
      n00 = ixheaac_add32_sat(x_0, x_2);
1968
3.68M
      n01 = ixheaac_add32_sat(x_1, x_3);
1969
3.68M
      n20 = ixheaac_sub32_sat(x_0, x_2);
1970
3.68M
      n21 = ixheaac_sub32_sat(x_1, x_3);
1971
3.68M
      n10 = ixheaac_add32_sat(x_4, x_6);
1972
3.68M
      n11 = ixheaac_add32_sat(x_5, x_7);
1973
3.68M
      n30 = ixheaac_sub32_sat(x_4, x_6);
1974
3.68M
      n31 = ixheaac_sub32_sat(x_5, x_7);
1975
1976
3.68M
      y0[h2] = n00;
1977
3.68M
      y0[h2 + 1] = n01;
1978
3.68M
      y1[h2] = n10;
1979
3.68M
      y1[h2 + 1] = n11;
1980
3.68M
      y2[h2] = n20;
1981
3.68M
      y2[h2 + 1] = n21;
1982
3.68M
      y3[h2] = n30;
1983
3.68M
      y3[h2 + 1] = n31;
1984
1985
3.68M
      x_8 = *x2++;
1986
3.68M
      x_9 = *x2++;
1987
3.68M
      x_a = *x2++;
1988
3.68M
      x_b = *x2++;
1989
3.68M
      x_c = *x2++;
1990
3.68M
      x_d = *x2++;
1991
3.68M
      x_e = *x2++;
1992
3.68M
      x_f = *x2++;
1993
1994
3.68M
      n02 = ixheaac_add32_sat(x_8, x_a);
1995
3.68M
      n03 = ixheaac_add32_sat(x_9, x_b);
1996
3.68M
      n22 = ixheaac_sub32_sat(x_8, x_a);
1997
3.68M
      n23 = ixheaac_sub32_sat(x_9, x_b);
1998
3.68M
      n12 = ixheaac_add32_sat(x_c, x_e);
1999
3.68M
      n13 = ixheaac_add32_sat(x_d, x_f);
2000
3.68M
      n32 = ixheaac_sub32_sat(x_c, x_e);
2001
3.68M
      n33 = ixheaac_sub32_sat(x_d, x_f);
2002
2003
3.68M
      y0[h2 + 2] = n02;
2004
3.68M
      y0[h2 + 3] = n03;
2005
3.68M
      y1[h2 + 2] = n12;
2006
3.68M
      y1[h2 + 3] = n13;
2007
3.68M
      y2[h2 + 2] = n22;
2008
3.68M
      y2[h2 + 3] = n23;
2009
3.68M
      y3[h2 + 2] = n32;
2010
3.68M
      y3[h2 + 3] = n33;
2011
3.68M
    }
2012
1.84M
    x0 += (WORD32)npoints >> 1;
2013
1.84M
    x2 += (WORD32)npoints >> 1;
2014
1.84M
  }
2015
921k
}
2016
#endif