Coverage Report

Created: 2026-12-01 07:00

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
68.7M
#define SHIFT_VAL 8
51
4.47M
#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
144k
    UWORD32 frame_len, WORD32 *in_data, WORD32 *out_data) {
58
144k
  ia_ics_info_struct *ptr_ics_info = &ptr_aac_dec_channel_info->str_ics_info;
59
144k
  WORD16 *lt_pred_stat = ptr_aac_dec_channel_info->ltp_buf;
60
144k
  UWORD16 win_shape = ptr_aac_dec_channel_info->str_ics_info.window_shape;
61
144k
  WORD16 sfb;
62
144k
  WORD16 bin, i, num_samples;
63
144k
  const WORD8 *swb_offset = aac_tables_ptr->scale_factor_bands_long[sr_index];
64
144k
  WORD32 *ptr_spec = &spec[0];
65
144k
  WORD32 *ptr_x_est = &out_data[0];
66
67
144k
  if (512 == ptr_ics_info->frame_length) {
68
64.7k
    swb_offset = aac_tables_ptr->scale_fac_bands_512[sr_index];
69
79.3k
  } else if (480 == ptr_ics_info->frame_length) {
70
24.9k
    swb_offset = aac_tables_ptr->scale_fac_bands_480[sr_index];
71
24.9k
  }
72
73
144k
  if (ptr_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
74
113k
    if (ltp->data_present) {
75
54.4k
      num_samples = frame_len << 1;
76
77
64.3M
      for (i = 0; i < num_samples; i++) {
78
64.3M
        in_data[i] =
79
64.3M
            ixheaac_shr32(ixheaac_mult32x16in32_shl_sat(
80
64.3M
                               ixheaacd_codebook_Q30[ltp->coef],
81
64.3M
                               lt_pred_stat[num_samples + i - ltp->lag]),
82
64.3M
                           SHIFT_VAL);
83
64.3M
      }
84
85
54.4k
      ixheaacd_filter_bank_ltp(aac_tables_ptr, ptr_ics_info->window_sequence,
86
54.4k
                               win_shape, win_shape_prev, in_data, out_data,
87
54.4k
                               object_type, frame_len);
88
89
54.4k
      if (ptr_aac_dec_channel_info->str_tns_info.tns_data_present == 1)
90
11.5k
        ixheaacd_aac_tns_process(ptr_aac_dec_channel_info, 1, aac_tables_ptr,
91
11.5k
                                 object_type, 0, out_data);
92
93
1.10M
      for (sfb = 0; sfb < ltp->last_band; sfb++) {
94
1.04M
        WORD8 sfb_width = swb_offset[sfb];
95
1.04M
        if (ltp->long_used[sfb]) {
96
4.92M
          for (bin = sfb_width - 1; bin >= 0; bin--) {
97
4.47M
            WORD32 temp = *ptr_spec;
98
4.47M
            temp = ixheaac_add32_sat(temp,
99
4.47M
                                      ixheaac_shr32(*ptr_x_est++, SHIFT_VAL1));
100
4.47M
            *ptr_spec++ = temp;
101
4.47M
          }
102
590k
        } else {
103
590k
          ptr_spec += sfb_width;
104
590k
          ptr_x_est += sfb_width;
105
590k
        }
106
1.04M
      }
107
54.4k
    }
108
113k
  }
109
144k
}
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
54.4k
                              UWORD32 frame_len) {
116
54.4k
  WORD32 i;
117
118
54.4k
  const WORD16 *window_long = NULL;
119
54.4k
  const WORD16 *window_long_prev = NULL;
120
54.4k
  const WORD16 *window_short = NULL;
121
54.4k
  const WORD16 *window_short_prev = NULL;
122
123
54.4k
  UWORD16 nlong = frame_len;
124
54.4k
  UWORD16 nlong2 = frame_len << 1;
125
54.4k
  UWORD16 nshort = frame_len / 8;
126
54.4k
  UWORD16 nflat_ls = (nlong - nshort) / 2;
127
54.4k
  WORD32 imdct_scale = 0;
128
54.4k
  WORD32 expo = 0;
129
130
54.4k
  if (object_type == AOT_ER_AAC_LD) {
131
44.2k
    if (!window_shape) {
132
18.8k
      if (512 == frame_len) {
133
13.6k
        window_long =
134
13.6k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_512;
135
13.6k
      } else {
136
5.16k
        window_long =
137
5.16k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_480;
138
5.16k
      }
139
25.4k
    } else {
140
25.4k
      if (512 == frame_len) {
141
18.6k
        window_long =
142
18.6k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win;
143
18.6k
      } else {
144
6.78k
        window_long =
145
6.78k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win_480;
146
6.78k
      }
147
25.4k
    }
148
149
44.2k
    if (!window_shape_prev) {
150
21.6k
      if (512 == frame_len) {
151
15.5k
        window_long_prev =
152
15.5k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_512;
153
15.5k
      } else {
154
6.06k
        window_long_prev =
155
6.06k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_480;
156
6.06k
      }
157
22.6k
    } else {
158
22.6k
      if (512 == frame_len) {
159
16.7k
        window_long_prev =
160
16.7k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win;
161
16.7k
      } else {
162
5.88k
        window_long_prev =
163
5.88k
            (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win_480;
164
5.88k
      }
165
22.6k
    }
166
167
44.2k
    if (!window_shape)
168
18.8k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
169
25.4k
    else
170
25.4k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
171
44.2k
    if (!window_shape_prev)
172
21.6k
      window_short_prev =
173
21.6k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
174
22.6k
    else
175
22.6k
      window_short_prev =
176
22.6k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
177
178
44.2k
  } else {
179
10.1k
    if (!window_shape)
180
7.01k
      window_long = aac_tables_ptr->pstr_imdct_tables->only_long_window_sine;
181
3.13k
    else
182
3.13k
      window_long = aac_tables_ptr->pstr_imdct_tables->only_long_window_kbd;
183
10.1k
    if (!window_shape_prev)
184
7.51k
      window_long_prev =
185
7.51k
          aac_tables_ptr->pstr_imdct_tables->only_long_window_sine;
186
2.63k
    else
187
2.63k
      window_long_prev =
188
2.63k
          aac_tables_ptr->pstr_imdct_tables->only_long_window_kbd;
189
190
10.1k
    if (!window_shape)
191
7.01k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
192
3.13k
    else
193
3.13k
      window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
194
10.1k
    if (!window_shape_prev)
195
7.51k
      window_short_prev =
196
7.51k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
197
2.63k
    else
198
2.63k
      window_short_prev =
199
2.63k
          aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
200
10.1k
  }
201
202
54.4k
  switch (window_sequence) {
203
24.4k
    case ONLY_LONG_SEQUENCE:
204
205
24.4k
      if ((512 != nlong) && (480 != nlong)) {
206
3.48M
        for (i = 0; i<nlong>> 1; i++) {
207
3.47M
          in_data[i] =
208
3.47M
              ixheaac_mult32x16in32_shl(in_data[i], window_long_prev[2 * i]);
209
210
3.47M
          in_data[i + nlong] = ixheaac_mult32x16in32_shl(
211
3.47M
              in_data[i + nlong], window_long[2 * i + 1]);
212
3.47M
        }
213
3.48M
        for (i = 0; i<nlong>> 1; i++) {
214
3.47M
          in_data[i + (nlong >> 1)] = ixheaac_mult32x16in32_shl(
215
3.47M
              in_data[i + (nlong >> 1)], window_long_prev[nlong - 1 - 2 * i]);
216
217
3.47M
          in_data[i + nlong + (nlong >> 1)] =
218
3.47M
              ixheaac_mult32x16in32_shl(in_data[i + nlong + (nlong >> 1)],
219
3.47M
                                         window_long[nlong - 1 - 2 * i - 1]);
220
3.47M
        }
221
222
17.2k
      } else {
223
17.2k
        WORD32 *win1, *win2;
224
17.2k
        WORD32 *ptr_in1, *ptr_in2;
225
17.2k
        win1 = (WORD32 *)window_long_prev;
226
17.2k
        win2 = (WORD32 *)window_long;
227
17.2k
        ptr_in1 = &in_data[0];
228
17.2k
        ptr_in2 = &in_data[nlong];
229
230
8.70M
        for (i = nlong - 1; i >= 0; i--) {
231
8.68M
          WORD32 temp1 = ixheaac_mult32_shl(*ptr_in1, *win1++);
232
8.68M
          WORD32 temp2 = ixheaac_mult32_shl(*ptr_in2, win2[i]);
233
234
8.68M
          *ptr_in1++ = temp1;
235
8.68M
          *ptr_in2++ = temp2;
236
8.68M
        }
237
17.2k
      }
238
239
7.84M
      for (i = 0; i < nlong / 2; i++) {
240
7.81M
        out_mdct[nlong / 2 + i] =
241
7.81M
            ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
242
7.81M
        out_mdct[i] = (-ixheaac_add32(in_data[nlong + i + nlong / 2],
243
7.81M
                                       in_data[nlong2 - nlong / 2 - 1 - i]));
244
7.81M
      }
245
246
24.4k
      if (512 == nlong || (480 == nlong)) {
247
17.2k
        if (512 == nlong)
248
12.5k
          ixheaacd_inverse_transform_512(
249
12.5k
              out_mdct, in_data, &imdct_scale,
250
12.5k
              aac_tables_ptr->pstr_imdct_tables->cosine_array_1024,
251
12.5k
              aac_tables_ptr->pstr_imdct_tables, object_type);
252
253
4.75k
        else
254
4.75k
          ixheaacd_mdct_480_ld(out_mdct, in_data, &imdct_scale, 1,
255
4.75k
                               aac_tables_ptr->pstr_imdct_tables, object_type);
256
257
17.2k
        imdct_scale += 1;
258
259
17.2k
        if (imdct_scale > 0) {
260
8.98k
          WORD32 *ptr_out_mdct = &out_mdct[0];
261
262
1.13M
          for (i = nlong - 1; i >= 0; i -= 4) {
263
1.12M
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
264
1.12M
            ptr_out_mdct++;
265
1.12M
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
266
1.12M
            ptr_out_mdct++;
267
1.12M
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
268
1.12M
            ptr_out_mdct++;
269
1.12M
            *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
270
1.12M
            ptr_out_mdct++;
271
1.12M
          }
272
8.98k
        } else if (imdct_scale < 0) {
273
8.16k
          WORD32 *ptr_out_mdct = &out_mdct[0];
274
8.16k
          imdct_scale = -imdct_scale;
275
1.03M
          for (i = nlong - 1; i >= 0; i -= 4) {
276
1.02M
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
277
1.02M
            ptr_out_mdct++;
278
1.02M
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
279
1.02M
            ptr_out_mdct++;
280
1.02M
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
281
1.02M
            ptr_out_mdct++;
282
1.02M
            *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
283
1.02M
            ptr_out_mdct++;
284
1.02M
          }
285
8.16k
        }
286
17.2k
      }
287
288
7.23k
      else if (1024 == nlong) {
289
86
        expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
290
291
86
        expo = 8 - expo;
292
293
86
        imdct_scale = ixheaacd_inverse_transform(
294
86
            out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
295
296
86
        ixheaacd_post_twiddle_dec(in_data, out_mdct,
297
86
                                  aac_tables_ptr->pstr_imdct_tables, 1024);
298
299
86
        imdct_scale += 1;
300
301
88.1k
        for (i = 0; i < nlong; i++) {
302
88.0k
          out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
303
88.0k
        }
304
86
      }
305
306
24.4k
      break;
307
308
16.0k
    case LONG_START_SEQUENCE:
309
310
4.79M
      for (i = 0; i<nlong>> 1; i++)
311
4.77M
        in_data[i] =
312
4.77M
            ixheaac_mult32x16in32_shl(in_data[i], window_long_prev[2 * i]);
313
314
4.79M
      for (i = 0; i<nlong>> 1; i++)
315
4.77M
        in_data[i + (nlong >> 1)] = ixheaac_mult32x16in32_shl(
316
4.77M
            in_data[i + (nlong >> 1)], window_long_prev[nlong - 1 - 2 * i - 1]);
317
318
613k
      for (i = 0; i<nshort>> 1; i++)
319
597k
        in_data[i + nlong + nflat_ls + (nshort >> 1)] =
320
597k
            ixheaac_mult32x16in32_shl(
321
597k
                in_data[i + nlong + nflat_ls + (nshort >> 1)],
322
597k
                window_short[nshort - 1 - 2 * i - 1]);
323
324
4.19M
      for (i = 0; i < nflat_ls; i++) in_data[i + nlong + nflat_ls + nshort] = 0;
325
326
4.79M
      for (i = 0; i < nlong / 2; i++) {
327
4.77M
        out_mdct[nlong / 2 + i] =
328
4.77M
            ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
329
4.77M
        out_mdct[nlong / 2 - 1 - i] =
330
4.77M
            -ixheaac_add32(in_data[nlong + i], in_data[nlong2 - 1 - i]);
331
4.77M
      }
332
333
16.0k
      {
334
16.0k
        expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
335
336
16.0k
        expo = 8 - expo;
337
16.0k
        imdct_scale = ixheaacd_inverse_transform(
338
16.0k
            out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
339
340
16.0k
        ixheaacd_post_twiddle_dec(in_data, out_mdct,
341
16.0k
                                  aac_tables_ptr->pstr_imdct_tables, 1024);
342
16.0k
      }
343
344
16.0k
      imdct_scale += 1;
345
346
9.57M
      for (i = 0; i < nlong; i++) {
347
9.55M
        out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
348
9.55M
      }
349
16.0k
      break;
350
351
13.8k
    case LONG_STOP_SEQUENCE:
352
3.06M
      for (i = 0; i < nflat_ls; i++) in_data[i] = 0;
353
354
449k
      for (i = 0; i<nshort>> 1; i++)
355
435k
        in_data[i + nflat_ls] = ixheaac_mult32x16in32_shl(
356
435k
            in_data[i + nflat_ls], window_short_prev[2 * i]);
357
358
449k
      for (i = 0; i<nshort>> 1; i++)
359
435k
        in_data[i + nflat_ls + (nshort >> 1)] =
360
435k
            ixheaac_mult32x16in32_shl(in_data[i + nflat_ls + (nshort >> 1)],
361
435k
                                       window_short_prev[127 - 2 * i]);
362
363
3.49M
      for (i = 0; i<nlong>> 1; i++)
364
3.48M
        in_data[i + nlong] = ixheaac_mult32x16in32_shl(in_data[i + nlong],
365
3.48M
                                                        window_long[2 * i + 1]);
366
367
3.49M
      for (i = 0; i<nlong>> 1; i++)
368
3.48M
        in_data[i + nlong + (nlong >> 1)] =
369
3.48M
            ixheaac_mult32x16in32_shl(in_data[i + nlong + (nlong >> 1)],
370
3.48M
                                       window_long[nlong - 1 - 2 * i - 1]);
371
372
3.49M
      for (i = 0; i < nlong / 2; i++) {
373
3.48M
        out_mdct[nlong / 2 + i] =
374
3.48M
            ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
375
3.48M
        out_mdct[nlong / 2 - 1 - i] =
376
3.48M
            -ixheaac_add32(in_data[nlong + i], in_data[nlong2 - 1 - i]);
377
3.48M
      }
378
379
13.8k
      {
380
13.8k
        expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
381
382
13.8k
        expo = 8 - expo;
383
13.8k
        imdct_scale = ixheaacd_inverse_transform(
384
13.8k
            out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
385
386
13.8k
        ixheaacd_post_twiddle_dec(in_data, out_mdct,
387
13.8k
                                  aac_tables_ptr->pstr_imdct_tables, 1024);
388
13.8k
      }
389
390
13.8k
      imdct_scale += 1;
391
392
6.98M
      for (i = 0; i < nlong; i++) {
393
6.96M
        out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
394
6.96M
      }
395
396
13.8k
      break;
397
54.4k
  }
398
54.4k
}
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
143k
                              WORD slot_element) {
405
143k
  WORD32 i;
406
407
143k
  if (object_type == AOT_ER_AAC_LD) {
408
104k
    WORD16 *ptr_ltp_state0 = &lt_pred_stat[0];
409
104k
    WORD16 *ptr_ltp_state_fl = &lt_pred_stat[frame_len + 0];
410
104k
    WORD16 *ptr_ltp_state_2fl = &lt_pred_stat[(frame_len * 2) + 0];
411
104k
    WORD16 *time = (WORD16 *)time_t - slot_element;
412
104k
    WORD16 *ptr_time_in = &time[0 * stride];
413
414
52.7M
    for (i = 0; i < frame_len; i++) {
415
52.6M
      *ptr_ltp_state0++ = *ptr_ltp_state_fl;
416
52.6M
      *ptr_ltp_state_fl++ = *ptr_ltp_state_2fl;
417
52.6M
      *ptr_ltp_state_2fl++ = *ptr_time_in;
418
52.6M
      ptr_time_in += stride;
419
52.6M
    }
420
421
104k
  } else {
422
39.0k
    WORD16 *ptr_ltp_state0 = &lt_pred_stat[0];
423
39.0k
    WORD16 *ptr_ltp_state_fl = &lt_pred_stat[frame_len + 0];
424
39.0k
    WORD32 *time = (WORD32 *)time_t;
425
39.0k
    WORD32 *ptr_time_in = &time[0 * stride];
426
427
39.0k
    time = (WORD32 *)time_t;
428
429
37.9M
    for (i = 0; i < frame_len; i++) {
430
37.9M
      *ptr_ltp_state0++ = *ptr_ltp_state_fl;
431
37.9M
      *ptr_ltp_state_fl++ =
432
37.9M
          ixheaac_round16(ixheaac_shl32_sat(*ptr_time_in, 2));
433
37.9M
      ptr_time_in += stride;
434
37.9M
    }
435
39.0k
  }
436
437
143k
  if ((window_sequence == ONLY_LONG_SEQUENCE) ||
438
91.1k
      (window_sequence == LONG_STOP_SEQUENCE)) {
439
91.1k
    if (512 == frame_len) {
440
42.4k
      WORD32 *window = (WORD32 *)p_window_next;
441
442
10.9M
      for (i = 0; i < 256; i++) {
443
10.8M
        lt_pred_stat[(frame_len * 3) + i] =
444
10.8M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
445
10.8M
                (WORD16)ixheaac_shl16(
446
10.8M
                    (WORD16)-ixheaac_sat16(overlap[255 - i]), 1),
447
10.8M
                (WORD16)ixheaac_shr32(window[511 - i], 15)));
448
449
10.8M
        lt_pred_stat[(frame_len * 3) + 256 + i] =
450
10.8M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
451
10.8M
                (WORD16)ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[i]), 1),
452
10.8M
                (WORD16)ixheaac_shr32(window[255 - i], 15)));
453
10.8M
      }
454
48.6k
    } else if (480 == frame_len) {
455
20.6k
      WORD32 *window = (WORD32 *)p_window_next;
456
457
4.98M
      for (i = 0; i < 240; i++) {
458
4.95M
        lt_pred_stat[(frame_len * 3) + i] =
459
4.95M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
460
4.95M
                (WORD16)ixheaac_shl16(
461
4.95M
                    (WORD16)-ixheaac_sat16(overlap[239 - i]), 1),
462
4.95M
                (WORD16)ixheaac_shr32(window[479 - i], 15)));
463
464
4.95M
        lt_pred_stat[(frame_len * 3) + 240 + i] =
465
4.95M
            ixheaac_round16(ixheaac_mult16x16in32_shl(
466
4.95M
                (WORD16)ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[i]), 1),
467
4.95M
                (WORD16)ixheaac_shr32(window[239 - i], 15)));
468
4.95M
      }
469
27.9k
    } else {
470
14.3M
      for (i = 0; i < 512; i++) {
471
14.3M
        lt_pred_stat[(frame_len * 2) + i] = ixheaac_round16(
472
14.3M
            ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
473
14.3M
                                   (WORD16)-ixheaac_sat16(overlap[511 - i]),
474
14.3M
                                   p_window_next[2 * i + 1]),
475
14.3M
                               1));
476
477
14.3M
        lt_pred_stat[(frame_len * 2) + 512 + i] =
478
14.3M
            ixheaac_round16(ixheaac_shl32_sat(
479
14.3M
                ixheaac_mult16x16in32_shl((WORD16)-ixheaac_sat16(overlap[i]),
480
14.3M
                                           p_window_next[1023 - 2 * i - 1]),
481
14.3M
                1));
482
14.3M
      }
483
27.9k
    }
484
485
91.1k
  } else if (window_sequence == LONG_START_SEQUENCE) {
486
9.86M
    for (i = 0; i < 448; i++) {
487
9.84M
      lt_pred_stat[(frame_len * 2) + i] =
488
9.84M
          ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[511 - i]), 1);
489
9.84M
    }
490
1.42M
    for (i = 0; i < 64; i++) {
491
1.40M
      lt_pred_stat[(frame_len * 2) + 448 + i] =
492
1.40M
          ixheaac_round16(ixheaac_shl32_sat(
493
1.40M
              ixheaac_mult16x16in32_shl(
494
1.40M
                  (WORD16)-ixheaac_sat16(overlap[511 - 448 - i]),
495
1.40M
                  p_window_next[2 * i + 1]),
496
1.40M
              1));
497
1.40M
    }
498
1.42M
    for (i = 0; i < 64; i++) {
499
1.40M
      lt_pred_stat[(frame_len * 2) + 512 + i] =
500
1.40M
          ixheaac_round16(ixheaac_shl32_sat(
501
1.40M
              ixheaac_mult16x16in32_shl((WORD16)-ixheaac_sat16(overlap[i]),
502
1.40M
                                         p_window_next[127 - 2 * i - 1]),
503
1.40M
              1));
504
1.40M
    }
505
9.86M
    for (i = 576; i < 1024; i++) {
506
9.84M
      lt_pred_stat[(frame_len * 2) + i] = 0;
507
9.84M
    }
508
30.7k
  } else {
509
13.8M
    for (i = 0; i < 448; i++) {
510
13.7M
      lt_pred_stat[(frame_len * 2) + i] =
511
13.7M
          ixheaac_shl16(ixheaac_sat16(overlap[i]), 1);
512
13.7M
    }
513
1.99M
    for (i = 0; i < 64; i++) {
514
1.96M
      lt_pred_stat[(frame_len * 2) + 448 + i] = ixheaac_round16(
515
1.96M
          ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
516
1.96M
                                 (WORD16)-ixheaac_sat16(overlap[511 - i]),
517
1.96M
                                 p_window_next[2 * i + 1]),
518
1.96M
                             1));
519
1.96M
    }
520
1.99M
    for (i = 0; i < 64; i++) {
521
1.96M
      lt_pred_stat[(frame_len * 2) + 512 + i] = ixheaac_round16(
522
1.96M
          ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
523
1.96M
                                 (WORD16)-ixheaac_sat16(overlap[448 + i]),
524
1.96M
                                 p_window_next[127 - 2 * i - 1]),
525
1.96M
                             1));
526
1.96M
    }
527
13.8M
    for (i = 576; i < 1024; i++) {
528
13.7M
      lt_pred_stat[(frame_len * 2) + i] = 0;
529
13.7M
    }
530
30.7k
  }
531
143k
}