Coverage Report

Created: 2026-02-26 06:35

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libxaac/decoder/ixheaacd_lt_predict.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
21
#include <stdlib.h>
22
#include <stdio.h>
23
#include <string.h>
24
25
#include "ixheaac_type_def.h"
26
#include "ixheaac_constants.h"
27
#include "ixheaac_basic_ops32.h"
28
#include "ixheaac_basic_ops16.h"
29
#include "ixheaac_basic_ops40.h"
30
31
#include "ixheaacd_defines.h"
32
#include "ixheaacd_cnst.h"
33
#include "ixheaacd_aac_rom.h"
34
#include "ixheaacd_lt_predict.h"
35
#include "ixheaacd_ec_defines.h"
36
#include "ixheaacd_ec_struct_def.h"
37
#include "ixheaacd_audioobjtypes.h"
38
39
#include "ixheaacd_bitbuffer.h"
40
#include "ixheaacd_pulsedata.h"
41
#include "ixheaacd_pns.h"
42
#include "ixheaacd_channelinfo.h"
43
#include "ixheaacd_tns.h"
44
#include "ixheaacd_aac_imdct.h"
45
46
static const WORD32 ixheaacd_codebook_Q30[8] = {
47
    612922971,  747985734,  872956397,  978505219,
48
    1057528322, 1146642451, 1282693056, 1470524861};
49
50
36.1M
#define SHIFT_VAL 8
51
2.03M
#define SHIFT_VAL1 (15 - SHIFT_VAL)
52
53
VOID ixheaacd_lt_prediction(
54
    ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, ltp_info *ltp,
55
    WORD32 *spec, ia_aac_dec_tables_struct *aac_tables_ptr,
56
    UWORD16 win_shape_prev, UWORD32 sr_index, UWORD32 object_type,
57
63.3k
    UWORD32 frame_len, WORD32 *in_data, WORD32 *out_data) {
58
63.3k
  ia_ics_info_struct *ptr_ics_info = &ptr_aac_dec_channel_info->str_ics_info;
59
63.3k
  WORD16 *lt_pred_stat = ptr_aac_dec_channel_info->ltp_buf;
60
63.3k
  UWORD16 win_shape = ptr_aac_dec_channel_info->str_ics_info.window_shape;
61
63.3k
  WORD16 sfb;
62
63.3k
  WORD16 bin, i, num_samples;
63
63.3k
  const WORD8 *swb_offset = aac_tables_ptr->scale_factor_bands_long[sr_index];
64
63.3k
  WORD32 *ptr_spec = &spec[0];
65
63.3k
  WORD32 *ptr_x_est = &out_data[0];
66
67
63.3k
  if (512 == ptr_ics_info->frame_length) {
68
34.4k
    swb_offset = aac_tables_ptr->scale_fac_bands_512[sr_index];
69
34.4k
  } else if (480 == ptr_ics_info->frame_length) {
70
4.85k
    swb_offset = aac_tables_ptr->scale_fac_bands_480[sr_index];
71
4.85k
  }
72
73
63.3k
  if (ptr_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
74
52.2k
    if (ltp->data_present) {
75
28.6k
      num_samples = frame_len << 1;
76
77
34.1M
      for (i = 0; i < num_samples; i++) {
78
34.0M
        in_data[i] =
79
34.0M
            ixheaac_shr32(ixheaac_mult32x16in32_shl_sat(
80
34.0M
                               ixheaacd_codebook_Q30[ltp->coef],
81
34.0M
                               lt_pred_stat[num_samples + i - ltp->lag]),
82
34.0M
                           SHIFT_VAL);
83
34.0M
      }
84
85
28.6k
      ixheaacd_filter_bank_ltp(aac_tables_ptr, ptr_ics_info->window_sequence,
86
28.6k
                               win_shape, win_shape_prev, in_data, out_data,
87
28.6k
                               object_type, frame_len);
88
89
28.6k
      if (ptr_aac_dec_channel_info->str_tns_info.tns_data_present == 1)
90
6.26k
        ixheaacd_aac_tns_process(ptr_aac_dec_channel_info, 1, aac_tables_ptr,
91
6.26k
                                 object_type, 0, out_data);
92
93
524k
      for (sfb = 0; sfb < ltp->last_band; sfb++) {
94
495k
        WORD8 sfb_width = swb_offset[sfb];
95
495k
        if (ltp->long_used[sfb]) {
96
2.25M
          for (bin = sfb_width - 1; bin >= 0; bin--) {
97
2.03M
            WORD32 temp = *ptr_spec;
98
2.03M
            temp = ixheaac_add32_sat(temp,
99
2.03M
                                      ixheaac_shr32(*ptr_x_est++, SHIFT_VAL1));
100
2.03M
            *ptr_spec++ = temp;
101
2.03M
          }
102
280k
        } else {
103
280k
          ptr_spec += sfb_width;
104
280k
          ptr_x_est += sfb_width;
105
280k
        }
106
495k
      }
107
28.6k
    }
108
52.2k
  }
109
63.3k
}
110
111
VOID ixheaacd_filter_bank_ltp(ia_aac_dec_tables_struct *aac_tables_ptr,
112
                              WORD16 window_sequence, WORD16 window_shape,
113
                              WORD16 window_shape_prev, WORD32 *in_data,
114
                              WORD32 *out_mdct, UWORD32 object_type,
115
28.6k
                              UWORD32 frame_len) {
116
28.6k
  WORD32 i;
117
118
28.6k
  const WORD16 *window_long = NULL;
119
28.6k
  const WORD16 *window_long_prev = NULL;
120
28.6k
  const WORD16 *window_short = NULL;
121
28.6k
  const WORD16 *window_short_prev = NULL;
122
123
28.6k
  UWORD16 nlong = frame_len;
124
28.6k
  UWORD16 nlong2 = frame_len << 1;
125
28.6k
  UWORD16 nshort = frame_len / 8;
126
28.6k
  UWORD16 nflat_ls = (nlong - nshort) / 2;
127
28.6k
  WORD32 imdct_scale = 0;
128
28.6k
  WORD32 expo = 0;
129
130
28.6k
  if (object_type == AOT_ER_AAC_LD) {
131
23.1k
    if (!window_shape) {
132
9.68k
      if (512 == frame_len) {
133
6.58k
        window_long =
134
6.58k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_512;
135
6.58k
      } else {
136
3.09k
        window_long =
137
3.09k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_480;
138
3.09k
      }
139
13.4k
    } else {
140
13.4k
      if (512 == frame_len) {
141
10.2k
        window_long =
142
10.2k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win;
143
10.2k
      } else {
144
3.16k
        window_long =
145
3.16k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win_480;
146
3.16k
      }
147
13.4k
    }
148
149
23.1k
    if (!window_shape_prev) {
150
10.7k
      if (512 == frame_len) {
151
7.47k
        window_long_prev =
152
7.47k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_512;
153
7.47k
      } else {
154
3.30k
        window_long_prev =
155
3.30k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_480;
156
3.30k
      }
157
12.3k
    } else {
158
12.3k
      if (512 == frame_len) {
159
9.40k
        window_long_prev =
160
9.40k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win;
161
9.40k
      } else {
162
2.95k
        window_long_prev =
163
2.95k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win_480;
164
2.95k
      }
165
12.3k
    }
166
167
23.1k
    if (!window_shape)
168
9.68k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
169
13.4k
    else
170
13.4k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
171
23.1k
    if (!window_shape_prev)
172
10.7k
      window_short_prev =
173
10.7k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
174
12.3k
    else
175
12.3k
      window_short_prev =
176
12.3k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
177
178
23.1k
  } else {
179
5.54k
    if (!window_shape)
180
4.17k
      window_long = aac_tables_ptr->pstr_imdct_tables->only_long_window_sine;
181
1.36k
    else
182
1.36k
      window_long = aac_tables_ptr->pstr_imdct_tables->only_long_window_kbd;
183
5.54k
    if (!window_shape_prev)
184
4.36k
      window_long_prev =
185
4.36k
          aac_tables_ptr->pstr_imdct_tables->only_long_window_sine;
186
1.18k
    else
187
1.18k
      window_long_prev =
188
1.18k
          aac_tables_ptr->pstr_imdct_tables->only_long_window_kbd;
189
190
5.54k
    if (!window_shape)
191
4.17k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
192
1.36k
    else
193
1.36k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
194
5.54k
    if (!window_shape_prev)
195
4.36k
      window_short_prev =
196
4.36k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
197
1.18k
    else
198
1.18k
      window_short_prev =
199
1.18k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
200
5.54k
  }
201
202
28.6k
  switch (window_sequence) {
203
13.3k
    case ONLY_LONG_SEQUENCE:
204
205
13.3k
      if ((512 != nlong) && (480 != nlong)) {
206
2.00M
        for (i = 0; i<nlong>> 1; i++) {
207
2.00M
          in_data[i] =
208
2.00M
              ixheaac_mult32x16in32_shl(in_data[i], window_long_prev[2 * i]);
209
210
2.00M
          in_data[i + nlong] = ixheaac_mult32x16in32_shl(
211
2.00M
              in_data[i + nlong], window_long[2 * i + 1]);
212
2.00M
        }
213
2.00M
        for (i = 0; i<nlong>> 1; i++) {
214
2.00M
          in_data[i + (nlong >> 1)] = ixheaac_mult32x16in32_shl(
215
2.00M
              in_data[i + (nlong >> 1)], window_long_prev[nlong - 1 - 2 * i]);
216
217
2.00M
          in_data[i + nlong + (nlong >> 1)] =
218
2.00M
              ixheaac_mult32x16in32_shl(in_data[i + nlong + (nlong >> 1)],
219
2.00M
                                         window_long[nlong - 1 - 2 * i - 1]);
220
2.00M
        }
221
222
9.17k
      } else {
223
9.17k
        WORD32 *win1, *win2;
224
9.17k
        WORD32 *ptr_in1, *ptr_in2;
225
9.17k
        win1 = (WORD32 *)window_long_prev;
226
9.17k
        win2 = (WORD32 *)window_long;
227
9.17k
        ptr_in1 = &in_data[0];
228
9.17k
        ptr_in2 = &in_data[nlong];
229
230
4.60M
        for (i = nlong - 1; i >= 0; i--) {
231
4.59M
          WORD32 temp1 = ixheaac_mult32_shl(*ptr_in1, *win1++);
232
4.59M
          WORD32 temp2 = ixheaac_mult32_shl(*ptr_in2, win2[i]);
233
234
4.59M
          *ptr_in1++ = temp1;
235
4.59M
          *ptr_in2++ = temp2;
236
4.59M
        }
237
9.17k
      }
238
239
4.31M
      for (i = 0; i < nlong / 2; i++) {
240
4.30M
        out_mdct[nlong / 2 + i] =
241
4.30M
            ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
242
4.30M
        out_mdct[i] = (-ixheaac_add32(in_data[nlong + i + nlong / 2],
243
4.30M
                                       in_data[nlong2 - nlong / 2 - 1 - i]));
244
4.30M
      }
245
246
13.3k
      if (512 == nlong || (480 == nlong)) {
247
9.17k
        if (512 == nlong)
248
6.11k
          ixheaacd_inverse_transform_512(
249
6.11k
              out_mdct, in_data, &imdct_scale,
250
6.11k
              aac_tables_ptr->pstr_imdct_tables->cosine_array_1024,
251
6.11k
              aac_tables_ptr->pstr_imdct_tables, object_type);
252
253
3.05k
        else
254
3.05k
          ixheaacd_mdct_480_ld(out_mdct, in_data, &imdct_scale, 1,
255
3.05k
                               aac_tables_ptr->pstr_imdct_tables, object_type);
256
257
9.17k
        imdct_scale += 1;
258
259
9.17k
        if (imdct_scale > 0) {
260
5.93k
          WORD32 *ptr_out_mdct = &out_mdct[0];
261
262
750k
          for (i = nlong - 1; i >= 0; i -= 4) {
263
744k
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
264
744k
            ptr_out_mdct++;
265
744k
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
266
744k
            ptr_out_mdct++;
267
744k
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
268
744k
            ptr_out_mdct++;
269
744k
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
270
744k
            ptr_out_mdct++;
271
744k
          }
272
5.93k
        } else if (imdct_scale < 0) {
273
3.18k
          WORD32 *ptr_out_mdct = &out_mdct[0];
274
3.18k
          imdct_scale = -imdct_scale;
275
402k
          for (i = nlong - 1; i >= 0; i -= 4) {
276
399k
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
277
399k
            ptr_out_mdct++;
278
399k
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
279
399k
            ptr_out_mdct++;
280
399k
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
281
399k
            ptr_out_mdct++;
282
399k
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
283
399k
            ptr_out_mdct++;
284
399k
          }
285
3.18k
        }
286
9.17k
      }
287
288
4.17k
      else if (1024 == nlong) {
289
12
        expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
290
291
12
        expo = 8 - expo;
292
293
12
        imdct_scale = ixheaacd_inverse_transform(
294
12
            out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
295
296
12
        ixheaacd_post_twiddle_dec(in_data, out_mdct,
297
12
                                  aac_tables_ptr->pstr_imdct_tables, 1024);
298
299
12
        imdct_scale += 1;
300
301
12.3k
        for (i = 0; i < nlong; i++) {
302
12.2k
          out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
303
12.2k
        }
304
12
      }
305
306
13.3k
      break;
307
308
8.70k
    case LONG_START_SEQUENCE:
309
310
2.55M
      for (i = 0; i<nlong>> 1; i++)
311
2.54M
        in_data[i] =
312
2.54M
            ixheaac_mult32x16in32_shl(in_data[i], window_long_prev[2 * i]);
313
314
2.55M
      for (i = 0; i<nlong>> 1; i++)
315
2.54M
        in_data[i + (nlong >> 1)] = ixheaac_mult32x16in32_shl(
316
2.54M
            in_data[i + (nlong >> 1)], window_long_prev[nlong - 1 - 2 * i - 1]);
317
318
326k
      for (i = 0; i<nshort>> 1; i++)
319
318k
        in_data[i + nlong + nflat_ls + (nshort >> 1)] =
320
318k
            ixheaac_mult32x16in32_shl(
321
318k
                in_data[i + nlong + nflat_ls + (nshort >> 1)],
322
318k
                window_short[nshort - 1 - 2 * i - 1]);
323
324
2.23M
      for (i = 0; i < nflat_ls; i++) in_data[i + nlong + nflat_ls + nshort] = 0;
325
326
2.55M
      for (i = 0; i < nlong / 2; i++) {
327
2.54M
        out_mdct[nlong / 2 + i] =
328
2.54M
            ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
329
2.54M
        out_mdct[nlong / 2 - 1 - i] =
330
2.54M
            -ixheaac_add32(in_data[nlong + i], in_data[nlong2 - 1 - i]);
331
2.54M
      }
332
333
8.70k
      {
334
8.70k
        expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
335
336
8.70k
        expo = 8 - expo;
337
8.70k
        imdct_scale = ixheaacd_inverse_transform(
338
8.70k
            out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
339
340
8.70k
        ixheaacd_post_twiddle_dec(in_data, out_mdct,
341
8.70k
                                  aac_tables_ptr->pstr_imdct_tables, 1024);
342
8.70k
      }
343
344
8.70k
      imdct_scale += 1;
345
346
5.10M
      for (i = 0; i < nlong; i++) {
347
5.09M
        out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
348
5.09M
      }
349
8.70k
      break;
350
351
6.64k
    case LONG_STOP_SEQUENCE:
352
1.47M
      for (i = 0; i < nflat_ls; i++) in_data[i] = 0;
353
354
215k
      for (i = 0; i<nshort>> 1; i++)
355
209k
        in_data[i + nflat_ls] = ixheaac_mult32x16in32_shl(
356
209k
            in_data[i + nflat_ls], window_short_prev[2 * i]);
357
358
215k
      for (i = 0; i<nshort>> 1; i++)
359
209k
        in_data[i + nflat_ls + (nshort >> 1)] =
360
209k
            ixheaac_mult32x16in32_shl(in_data[i + nflat_ls + (nshort >> 1)],
361
209k
                                       window_short_prev[127 - 2 * i]);
362
363
1.67M
      for (i = 0; i<nlong>> 1; i++)
364
1.67M
        in_data[i + nlong] = ixheaac_mult32x16in32_shl(in_data[i + nlong],
365
1.67M
                                                        window_long[2 * i + 1]);
366
367
1.67M
      for (i = 0; i<nlong>> 1; i++)
368
1.67M
        in_data[i + nlong + (nlong >> 1)] =
369
1.67M
            ixheaac_mult32x16in32_shl(in_data[i + nlong + (nlong >> 1)],
370
1.67M
                                       window_long[nlong - 1 - 2 * i - 1]);
371
372
1.67M
      for (i = 0; i < nlong / 2; i++) {
373
1.67M
        out_mdct[nlong / 2 + i] =
374
1.67M
            ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
375
1.67M
        out_mdct[nlong / 2 - 1 - i] =
376
1.67M
            -ixheaac_add32(in_data[nlong + i], in_data[nlong2 - 1 - i]);
377
1.67M
      }
378
379
6.64k
      {
380
6.64k
        expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
381
382
6.64k
        expo = 8 - expo;
383
6.64k
        imdct_scale = ixheaacd_inverse_transform(
384
6.64k
            out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
385
386
6.64k
        ixheaacd_post_twiddle_dec(in_data, out_mdct,
387
6.64k
                                  aac_tables_ptr->pstr_imdct_tables, 1024);
388
6.64k
      }
389
390
6.64k
      imdct_scale += 1;
391
392
3.35M
      for (i = 0; i < nlong; i++) {
393
3.34M
        out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
394
3.34M
      }
395
396
6.64k
      break;
397
28.6k
  }
398
28.6k
}
399
400
VOID ixheaacd_lt_update_state(WORD16 *lt_pred_stat, VOID *time_t,
401
                              WORD32 *overlap, WORD32 frame_len,
402
                              WORD32 object_type, WORD32 stride,
403
                              WORD16 window_sequence, WORD16 *p_window_next,
404
63.2k
                              WORD slot_element) {
405
63.2k
  WORD32 i;
406
407
63.2k
  if (object_type == AOT_ER_AAC_LD) {
408
45.5k
    WORD16 *ptr_ltp_state0 = &lt_pred_stat[0];
409
45.5k
    WORD16 *ptr_ltp_state_fl = &lt_pred_stat[frame_len + 0];
410
45.5k
    WORD16 *ptr_ltp_state_2fl = &lt_pred_stat[(frame_len * 2) + 0];
411
45.5k
    WORD16 *time = (WORD16 *)time_t - slot_element;
412
45.5k
    WORD16 *ptr_time_in = &time[0 * stride];
413
414
23.0M
    for (i = 0; i < frame_len; i++) {
415
23.0M
      *ptr_ltp_state0++ = *ptr_ltp_state_fl;
416
23.0M
      *ptr_ltp_state_fl++ = *ptr_ltp_state_2fl;
417
23.0M
      *ptr_ltp_state_2fl++ = *ptr_time_in;
418
23.0M
      ptr_time_in += stride;
419
23.0M
    }
420
421
45.5k
  } else {
422
17.7k
    WORD16 *ptr_ltp_state0 = &lt_pred_stat[0];
423
17.7k
    WORD16 *ptr_ltp_state_fl = &lt_pred_stat[frame_len + 0];
424
17.7k
    WORD32 *time = (WORD32 *)time_t;
425
17.7k
    WORD32 *ptr_time_in = &time[0 * stride];
426
427
17.7k
    time = (WORD32 *)time_t;
428
429
17.3M
    for (i = 0; i < frame_len; i++) {
430
17.3M
      *ptr_ltp_state0++ = *ptr_ltp_state_fl;
431
17.3M
      *ptr_ltp_state_fl++ =
432
17.3M
          ixheaac_round16(ixheaac_shl32_sat(*ptr_time_in, 2));
433
17.3M
      ptr_time_in += stride;
434
17.3M
    }
435
17.7k
  }
436
437
63.2k
  if ((window_sequence == ONLY_LONG_SEQUENCE) ||
438
42.0k
      (window_sequence == LONG_STOP_SEQUENCE)) {
439
42.0k
    if (512 == frame_len) {
440
21.1k
      WORD32 *window = (WORD32 *)p_window_next;
441
442
5.43M
      for (i = 0; i < 256; i++) {
443
5.41M
        lt_pred_stat[(frame_len * 3) + i] =
444
5.41M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
445
5.41M
                (WORD16)ixheaac_shl16(
446
5.41M
                    (WORD16)-ixheaac_sat16(overlap[255 - i]), 1),
447
5.41M
                (WORD16)ixheaac_shr32(window[511 - i], 15)));
448
449
5.41M
        lt_pred_stat[(frame_len * 3) + 256 + i] =
450
5.41M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
451
5.41M
                (WORD16)ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[i]), 1),
452
5.41M
                (WORD16)ixheaac_shr32(window[255 - i], 15)));
453
5.41M
      }
454
21.1k
    } else if (480 == frame_len) {
455
7.13k
      WORD32 *window = (WORD32 *)p_window_next;
456
457
1.71M
      for (i = 0; i < 240; i++) {
458
1.71M
        lt_pred_stat[(frame_len * 3) + i] =
459
1.71M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
460
1.71M
                (WORD16)ixheaac_shl16(
461
1.71M
                    (WORD16)-ixheaac_sat16(overlap[239 - i]), 1),
462
1.71M
                (WORD16)ixheaac_shr32(window[479 - i], 15)));
463
464
1.71M
        lt_pred_stat[(frame_len * 3) + 240 + i] =
465
1.71M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
466
1.71M
                (WORD16)ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[i]), 1),
467
1.71M
                (WORD16)ixheaac_shr32(window[239 - i], 15)));
468
1.71M
      }
469
13.7k
    } else {
470
7.06M
      for (i = 0; i < 512; i++) {
471
7.04M
        lt_pred_stat[(frame_len * 2) + i] = ixheaac_round16(
472
7.04M
            ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
473
7.04M
                                   (WORD16)-ixheaac_sat16(overlap[511 - i]),
474
7.04M
                                   p_window_next[2 * i + 1]),
475
7.04M
                               1));
476
477
7.04M
        lt_pred_stat[(frame_len * 2) + 512 + i] =
478
7.04M
            ixheaac_round16(ixheaac_shl32_sat(
479
7.04M
                ixheaac_mult16x16in32_shl((WORD16)-ixheaac_sat16(overlap[i]),
480
7.04M
                                           p_window_next[1023 - 2 * i - 1]),
481
7.04M
                1));
482
7.04M
      }
483
13.7k
    }
484
485
42.0k
  } else if (window_sequence == LONG_START_SEQUENCE) {
486
4.53M
    for (i = 0; i < 448; i++) {
487
4.52M
      lt_pred_stat[(frame_len * 2) + i] =
488
4.52M
          ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[511 - i]), 1);
489
4.52M
    }
490
656k
    for (i = 0; i < 64; i++) {
491
646k
      lt_pred_stat[(frame_len * 2) + 448 + i] =
492
646k
          ixheaac_round16(ixheaac_shl32_sat(
493
646k
              ixheaac_mult16x16in32_shl(
494
646k
                  (WORD16)-ixheaac_sat16(overlap[511 - 448 - i]),
495
646k
                  p_window_next[2 * i + 1]),
496
646k
              1));
497
646k
    }
498
656k
    for (i = 0; i < 64; i++) {
499
646k
      lt_pred_stat[(frame_len * 2) + 512 + i] =
500
646k
          ixheaac_round16(ixheaac_shl32_sat(
501
646k
              ixheaac_mult16x16in32_shl((WORD16)-ixheaac_sat16(overlap[i]),
502
646k
                                         p_window_next[127 - 2 * i - 1]),
503
646k
              1));
504
646k
    }
505
4.53M
    for (i = 576; i < 1024; i++) {
506
4.52M
      lt_pred_stat[(frame_len * 2) + i] = 0;
507
4.52M
    }
508
11.1k
  } else {
509
5.00M
    for (i = 0; i < 448; i++) {
510
4.99M
      lt_pred_stat[(frame_len * 2) + i] =
511
4.99M
          ixheaac_shl16(ixheaac_sat16(overlap[i]), 1);
512
4.99M
    }
513
724k
    for (i = 0; i < 64; i++) {
514
713k
      lt_pred_stat[(frame_len * 2) + 448 + i] = ixheaac_round16(
515
713k
          ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
516
713k
                                 (WORD16)-ixheaac_sat16(overlap[511 - i]),
517
713k
                                 p_window_next[2 * i + 1]),
518
713k
                             1));
519
713k
    }
520
724k
    for (i = 0; i < 64; i++) {
521
713k
      lt_pred_stat[(frame_len * 2) + 512 + i] = ixheaac_round16(
522
713k
          ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
523
713k
                                 (WORD16)-ixheaac_sat16(overlap[448 + i]),
524
713k
                                 p_window_next[127 - 2 * i - 1]),
525
713k
                             1));
526
713k
    }
527
5.00M
    for (i = 576; i < 1024; i++) {
528
4.99M
      lt_pred_stat[(frame_len * 2) + i] = 0;
529
4.99M
    }
530
11.1k
  }
531
63.2k
}