Coverage Report

Created: 2025-11-09 07:01

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