Coverage Report

Created: 2026-03-21 06:57

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