Coverage Report

Created: 2025-09-17 07:02

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