Coverage Report

Created: 2025-12-14 07:13

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