Coverage Report

Created: 2026-04-12 06:52

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