Coverage Report

Created: 2026-10-17 07:12

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