xref: /aosp_15_r20/external/libxaac/decoder/ixheaacd_lt_predict.c (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
1*15dc779aSAndroid Build Coastguard Worker /******************************************************************************
2*15dc779aSAndroid Build Coastguard Worker  *                                                                            *
3*15dc779aSAndroid Build Coastguard Worker  * Copyright (C) 2018 The Android Open Source Project
4*15dc779aSAndroid Build Coastguard Worker  *
5*15dc779aSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
6*15dc779aSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
7*15dc779aSAndroid Build Coastguard Worker  * You may obtain a copy of the License at:
8*15dc779aSAndroid Build Coastguard Worker  *
9*15dc779aSAndroid Build Coastguard Worker  * http://www.apache.org/licenses/LICENSE-2.0
10*15dc779aSAndroid Build Coastguard Worker  *
11*15dc779aSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
12*15dc779aSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
13*15dc779aSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*15dc779aSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
15*15dc779aSAndroid Build Coastguard Worker  * limitations under the License.
16*15dc779aSAndroid Build Coastguard Worker  *
17*15dc779aSAndroid Build Coastguard Worker  *****************************************************************************
18*15dc779aSAndroid Build Coastguard Worker  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*15dc779aSAndroid Build Coastguard Worker  */
20*15dc779aSAndroid Build Coastguard Worker 
21*15dc779aSAndroid Build Coastguard Worker #include <stdlib.h>
22*15dc779aSAndroid Build Coastguard Worker #include <stdio.h>
23*15dc779aSAndroid Build Coastguard Worker #include <string.h>
24*15dc779aSAndroid Build Coastguard Worker 
25*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_type_def.h"
26*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_constants.h"
27*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops32.h"
28*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops16.h"
29*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops40.h"
30*15dc779aSAndroid Build Coastguard Worker 
31*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_defines.h"
32*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_cnst.h"
33*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_aac_rom.h"
34*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_lt_predict.h"
35*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_ec_defines.h"
36*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_ec_struct_def.h"
37*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_audioobjtypes.h"
38*15dc779aSAndroid Build Coastguard Worker 
39*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_bitbuffer.h"
40*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_pulsedata.h"
41*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_pns.h"
42*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_channelinfo.h"
43*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_tns.h"
44*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_aac_imdct.h"
45*15dc779aSAndroid Build Coastguard Worker 
46*15dc779aSAndroid Build Coastguard Worker static const WORD32 ixheaacd_codebook_Q30[8] = {
47*15dc779aSAndroid Build Coastguard Worker     612922971,  747985734,  872956397,  978505219,
48*15dc779aSAndroid Build Coastguard Worker     1057528322, 1146642451, 1282693056, 1470524861};
49*15dc779aSAndroid Build Coastguard Worker 
50*15dc779aSAndroid Build Coastguard Worker #define SHIFT_VAL 8
51*15dc779aSAndroid Build Coastguard Worker #define SHIFT_VAL1 (15 - SHIFT_VAL)
52*15dc779aSAndroid Build Coastguard Worker 
ixheaacd_lt_prediction(ia_aac_dec_channel_info_struct * ptr_aac_dec_channel_info,ltp_info * ltp,WORD32 * spec,ia_aac_dec_tables_struct * aac_tables_ptr,UWORD16 win_shape_prev,UWORD32 sr_index,UWORD32 object_type,UWORD32 frame_len,WORD32 * in_data,WORD32 * out_data)53*15dc779aSAndroid Build Coastguard Worker VOID ixheaacd_lt_prediction(
54*15dc779aSAndroid Build Coastguard Worker     ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info, ltp_info *ltp,
55*15dc779aSAndroid Build Coastguard Worker     WORD32 *spec, ia_aac_dec_tables_struct *aac_tables_ptr,
56*15dc779aSAndroid Build Coastguard Worker     UWORD16 win_shape_prev, UWORD32 sr_index, UWORD32 object_type,
57*15dc779aSAndroid Build Coastguard Worker     UWORD32 frame_len, WORD32 *in_data, WORD32 *out_data) {
58*15dc779aSAndroid Build Coastguard Worker   ia_ics_info_struct *ptr_ics_info = &ptr_aac_dec_channel_info->str_ics_info;
59*15dc779aSAndroid Build Coastguard Worker   WORD16 *lt_pred_stat = ptr_aac_dec_channel_info->ltp_buf;
60*15dc779aSAndroid Build Coastguard Worker   UWORD16 win_shape = ptr_aac_dec_channel_info->str_ics_info.window_shape;
61*15dc779aSAndroid Build Coastguard Worker   WORD16 sfb;
62*15dc779aSAndroid Build Coastguard Worker   WORD16 bin, i, num_samples;
63*15dc779aSAndroid Build Coastguard Worker   const WORD8 *swb_offset = aac_tables_ptr->scale_factor_bands_long[sr_index];
64*15dc779aSAndroid Build Coastguard Worker   WORD32 *ptr_spec = &spec[0];
65*15dc779aSAndroid Build Coastguard Worker   WORD32 *ptr_x_est = &out_data[0];
66*15dc779aSAndroid Build Coastguard Worker 
67*15dc779aSAndroid Build Coastguard Worker   if (512 == ptr_ics_info->frame_length) {
68*15dc779aSAndroid Build Coastguard Worker     swb_offset = aac_tables_ptr->scale_fac_bands_512[sr_index];
69*15dc779aSAndroid Build Coastguard Worker   } else if (480 == ptr_ics_info->frame_length) {
70*15dc779aSAndroid Build Coastguard Worker     swb_offset = aac_tables_ptr->scale_fac_bands_480[sr_index];
71*15dc779aSAndroid Build Coastguard Worker   }
72*15dc779aSAndroid Build Coastguard Worker 
73*15dc779aSAndroid Build Coastguard Worker   if (ptr_ics_info->window_sequence != EIGHT_SHORT_SEQUENCE) {
74*15dc779aSAndroid Build Coastguard Worker     if (ltp->data_present) {
75*15dc779aSAndroid Build Coastguard Worker       num_samples = frame_len << 1;
76*15dc779aSAndroid Build Coastguard Worker 
77*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < num_samples; i++) {
78*15dc779aSAndroid Build Coastguard Worker         in_data[i] =
79*15dc779aSAndroid Build Coastguard Worker             ixheaac_shr32(ixheaac_mult32x16in32_shl_sat(
80*15dc779aSAndroid Build Coastguard Worker                                ixheaacd_codebook_Q30[ltp->coef],
81*15dc779aSAndroid Build Coastguard Worker                                lt_pred_stat[num_samples + i - ltp->lag]),
82*15dc779aSAndroid Build Coastguard Worker                            SHIFT_VAL);
83*15dc779aSAndroid Build Coastguard Worker       }
84*15dc779aSAndroid Build Coastguard Worker 
85*15dc779aSAndroid Build Coastguard Worker       ixheaacd_filter_bank_ltp(aac_tables_ptr, ptr_ics_info->window_sequence,
86*15dc779aSAndroid Build Coastguard Worker                                win_shape, win_shape_prev, in_data, out_data,
87*15dc779aSAndroid Build Coastguard Worker                                object_type, frame_len);
88*15dc779aSAndroid Build Coastguard Worker 
89*15dc779aSAndroid Build Coastguard Worker       if (ptr_aac_dec_channel_info->str_tns_info.tns_data_present == 1)
90*15dc779aSAndroid Build Coastguard Worker         ixheaacd_aac_tns_process(ptr_aac_dec_channel_info, 1, aac_tables_ptr,
91*15dc779aSAndroid Build Coastguard Worker                                  object_type, 0, out_data);
92*15dc779aSAndroid Build Coastguard Worker 
93*15dc779aSAndroid Build Coastguard Worker       for (sfb = 0; sfb < ltp->last_band; sfb++) {
94*15dc779aSAndroid Build Coastguard Worker         WORD8 sfb_width = swb_offset[sfb];
95*15dc779aSAndroid Build Coastguard Worker         if (ltp->long_used[sfb]) {
96*15dc779aSAndroid Build Coastguard Worker           for (bin = sfb_width - 1; bin >= 0; bin--) {
97*15dc779aSAndroid Build Coastguard Worker             WORD32 temp = *ptr_spec;
98*15dc779aSAndroid Build Coastguard Worker             temp = ixheaac_add32_sat(temp,
99*15dc779aSAndroid Build Coastguard Worker                                       ixheaac_shr32(*ptr_x_est++, SHIFT_VAL1));
100*15dc779aSAndroid Build Coastguard Worker             *ptr_spec++ = temp;
101*15dc779aSAndroid Build Coastguard Worker           }
102*15dc779aSAndroid Build Coastguard Worker         } else {
103*15dc779aSAndroid Build Coastguard Worker           ptr_spec += sfb_width;
104*15dc779aSAndroid Build Coastguard Worker           ptr_x_est += sfb_width;
105*15dc779aSAndroid Build Coastguard Worker         }
106*15dc779aSAndroid Build Coastguard Worker       }
107*15dc779aSAndroid Build Coastguard Worker     }
108*15dc779aSAndroid Build Coastguard Worker   }
109*15dc779aSAndroid Build Coastguard Worker }
110*15dc779aSAndroid Build Coastguard Worker 
ixheaacd_filter_bank_ltp(ia_aac_dec_tables_struct * aac_tables_ptr,WORD16 window_sequence,WORD16 window_shape,WORD16 window_shape_prev,WORD32 * in_data,WORD32 * out_mdct,UWORD32 object_type,UWORD32 frame_len)111*15dc779aSAndroid Build Coastguard Worker VOID ixheaacd_filter_bank_ltp(ia_aac_dec_tables_struct *aac_tables_ptr,
112*15dc779aSAndroid Build Coastguard Worker                               WORD16 window_sequence, WORD16 window_shape,
113*15dc779aSAndroid Build Coastguard Worker                               WORD16 window_shape_prev, WORD32 *in_data,
114*15dc779aSAndroid Build Coastguard Worker                               WORD32 *out_mdct, UWORD32 object_type,
115*15dc779aSAndroid Build Coastguard Worker                               UWORD32 frame_len) {
116*15dc779aSAndroid Build Coastguard Worker   WORD32 i;
117*15dc779aSAndroid Build Coastguard Worker 
118*15dc779aSAndroid Build Coastguard Worker   const WORD16 *window_long = NULL;
119*15dc779aSAndroid Build Coastguard Worker   const WORD16 *window_long_prev = NULL;
120*15dc779aSAndroid Build Coastguard Worker   const WORD16 *window_short = NULL;
121*15dc779aSAndroid Build Coastguard Worker   const WORD16 *window_short_prev = NULL;
122*15dc779aSAndroid Build Coastguard Worker 
123*15dc779aSAndroid Build Coastguard Worker   UWORD16 nlong = frame_len;
124*15dc779aSAndroid Build Coastguard Worker   UWORD16 nlong2 = frame_len << 1;
125*15dc779aSAndroid Build Coastguard Worker   UWORD16 nshort = frame_len / 8;
126*15dc779aSAndroid Build Coastguard Worker   UWORD16 nflat_ls = (nlong - nshort) / 2;
127*15dc779aSAndroid Build Coastguard Worker   WORD32 imdct_scale = 0;
128*15dc779aSAndroid Build Coastguard Worker   WORD32 expo = 0;
129*15dc779aSAndroid Build Coastguard Worker 
130*15dc779aSAndroid Build Coastguard Worker   if (object_type == AOT_ER_AAC_LD) {
131*15dc779aSAndroid Build Coastguard Worker     if (!window_shape) {
132*15dc779aSAndroid Build Coastguard Worker       if (512 == frame_len) {
133*15dc779aSAndroid Build Coastguard Worker         window_long =
134*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_512;
135*15dc779aSAndroid Build Coastguard Worker       } else {
136*15dc779aSAndroid Build Coastguard Worker         window_long =
137*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_480;
138*15dc779aSAndroid Build Coastguard Worker       }
139*15dc779aSAndroid Build Coastguard Worker     } else {
140*15dc779aSAndroid Build Coastguard Worker       if (512 == frame_len) {
141*15dc779aSAndroid Build Coastguard Worker         window_long =
142*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win;
143*15dc779aSAndroid Build Coastguard Worker       } else {
144*15dc779aSAndroid Build Coastguard Worker         window_long =
145*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win_480;
146*15dc779aSAndroid Build Coastguard Worker       }
147*15dc779aSAndroid Build Coastguard Worker     }
148*15dc779aSAndroid Build Coastguard Worker 
149*15dc779aSAndroid Build Coastguard Worker     if (!window_shape_prev) {
150*15dc779aSAndroid Build Coastguard Worker       if (512 == frame_len) {
151*15dc779aSAndroid Build Coastguard Worker         window_long_prev =
152*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_512;
153*15dc779aSAndroid Build Coastguard Worker       } else {
154*15dc779aSAndroid Build Coastguard Worker         window_long_prev =
155*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->window_sine_480;
156*15dc779aSAndroid Build Coastguard Worker       }
157*15dc779aSAndroid Build Coastguard Worker     } else {
158*15dc779aSAndroid Build Coastguard Worker       if (512 == frame_len) {
159*15dc779aSAndroid Build Coastguard Worker         window_long_prev =
160*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win;
161*15dc779aSAndroid Build Coastguard Worker       } else {
162*15dc779aSAndroid Build Coastguard Worker         window_long_prev =
163*15dc779aSAndroid Build Coastguard Worker             (WORD16 *)aac_tables_ptr->pstr_imdct_tables->low_overlap_win_480;
164*15dc779aSAndroid Build Coastguard Worker       }
165*15dc779aSAndroid Build Coastguard Worker     }
166*15dc779aSAndroid Build Coastguard Worker 
167*15dc779aSAndroid Build Coastguard Worker     if (!window_shape)
168*15dc779aSAndroid Build Coastguard Worker       window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
169*15dc779aSAndroid Build Coastguard Worker     else
170*15dc779aSAndroid Build Coastguard Worker       window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
171*15dc779aSAndroid Build Coastguard Worker     if (!window_shape_prev)
172*15dc779aSAndroid Build Coastguard Worker       window_short_prev =
173*15dc779aSAndroid Build Coastguard Worker           aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
174*15dc779aSAndroid Build Coastguard Worker     else
175*15dc779aSAndroid Build Coastguard Worker       window_short_prev =
176*15dc779aSAndroid Build Coastguard Worker           aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
177*15dc779aSAndroid Build Coastguard Worker 
178*15dc779aSAndroid Build Coastguard Worker   } else {
179*15dc779aSAndroid Build Coastguard Worker     if (!window_shape)
180*15dc779aSAndroid Build Coastguard Worker       window_long = aac_tables_ptr->pstr_imdct_tables->only_long_window_sine;
181*15dc779aSAndroid Build Coastguard Worker     else
182*15dc779aSAndroid Build Coastguard Worker       window_long = aac_tables_ptr->pstr_imdct_tables->only_long_window_kbd;
183*15dc779aSAndroid Build Coastguard Worker     if (!window_shape_prev)
184*15dc779aSAndroid Build Coastguard Worker       window_long_prev =
185*15dc779aSAndroid Build Coastguard Worker           aac_tables_ptr->pstr_imdct_tables->only_long_window_sine;
186*15dc779aSAndroid Build Coastguard Worker     else
187*15dc779aSAndroid Build Coastguard Worker       window_long_prev =
188*15dc779aSAndroid Build Coastguard Worker           aac_tables_ptr->pstr_imdct_tables->only_long_window_kbd;
189*15dc779aSAndroid Build Coastguard Worker 
190*15dc779aSAndroid Build Coastguard Worker     if (!window_shape)
191*15dc779aSAndroid Build Coastguard Worker       window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
192*15dc779aSAndroid Build Coastguard Worker     else
193*15dc779aSAndroid Build Coastguard Worker       window_short = aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
194*15dc779aSAndroid Build Coastguard Worker     if (!window_shape_prev)
195*15dc779aSAndroid Build Coastguard Worker       window_short_prev =
196*15dc779aSAndroid Build Coastguard Worker           aac_tables_ptr->pstr_imdct_tables->only_short_window_sine;
197*15dc779aSAndroid Build Coastguard Worker     else
198*15dc779aSAndroid Build Coastguard Worker       window_short_prev =
199*15dc779aSAndroid Build Coastguard Worker           aac_tables_ptr->pstr_imdct_tables->only_short_window_kbd;
200*15dc779aSAndroid Build Coastguard Worker   }
201*15dc779aSAndroid Build Coastguard Worker 
202*15dc779aSAndroid Build Coastguard Worker   switch (window_sequence) {
203*15dc779aSAndroid Build Coastguard Worker     case ONLY_LONG_SEQUENCE:
204*15dc779aSAndroid Build Coastguard Worker 
205*15dc779aSAndroid Build Coastguard Worker       if ((512 != nlong) && (480 != nlong)) {
206*15dc779aSAndroid Build Coastguard Worker         for (i = 0; i<nlong>> 1; i++) {
207*15dc779aSAndroid Build Coastguard Worker           in_data[i] =
208*15dc779aSAndroid Build Coastguard Worker               ixheaac_mult32x16in32_shl(in_data[i], window_long_prev[2 * i]);
209*15dc779aSAndroid Build Coastguard Worker 
210*15dc779aSAndroid Build Coastguard Worker           in_data[i + nlong] = ixheaac_mult32x16in32_shl(
211*15dc779aSAndroid Build Coastguard Worker               in_data[i + nlong], window_long[2 * i + 1]);
212*15dc779aSAndroid Build Coastguard Worker         }
213*15dc779aSAndroid Build Coastguard Worker         for (i = 0; i<nlong>> 1; i++) {
214*15dc779aSAndroid Build Coastguard Worker           in_data[i + (nlong >> 1)] = ixheaac_mult32x16in32_shl(
215*15dc779aSAndroid Build Coastguard Worker               in_data[i + (nlong >> 1)], window_long_prev[nlong - 1 - 2 * i]);
216*15dc779aSAndroid Build Coastguard Worker 
217*15dc779aSAndroid Build Coastguard Worker           in_data[i + nlong + (nlong >> 1)] =
218*15dc779aSAndroid Build Coastguard Worker               ixheaac_mult32x16in32_shl(in_data[i + nlong + (nlong >> 1)],
219*15dc779aSAndroid Build Coastguard Worker                                          window_long[nlong - 1 - 2 * i - 1]);
220*15dc779aSAndroid Build Coastguard Worker         }
221*15dc779aSAndroid Build Coastguard Worker 
222*15dc779aSAndroid Build Coastguard Worker       } else {
223*15dc779aSAndroid Build Coastguard Worker         WORD32 *win1, *win2;
224*15dc779aSAndroid Build Coastguard Worker         WORD32 *ptr_in1, *ptr_in2;
225*15dc779aSAndroid Build Coastguard Worker         win1 = (WORD32 *)window_long_prev;
226*15dc779aSAndroid Build Coastguard Worker         win2 = (WORD32 *)window_long;
227*15dc779aSAndroid Build Coastguard Worker         ptr_in1 = &in_data[0];
228*15dc779aSAndroid Build Coastguard Worker         ptr_in2 = &in_data[nlong];
229*15dc779aSAndroid Build Coastguard Worker 
230*15dc779aSAndroid Build Coastguard Worker         for (i = nlong - 1; i >= 0; i--) {
231*15dc779aSAndroid Build Coastguard Worker           WORD32 temp1 = ixheaac_mult32_shl(*ptr_in1, *win1++);
232*15dc779aSAndroid Build Coastguard Worker           WORD32 temp2 = ixheaac_mult32_shl(*ptr_in2, win2[i]);
233*15dc779aSAndroid Build Coastguard Worker 
234*15dc779aSAndroid Build Coastguard Worker           *ptr_in1++ = temp1;
235*15dc779aSAndroid Build Coastguard Worker           *ptr_in2++ = temp2;
236*15dc779aSAndroid Build Coastguard Worker         }
237*15dc779aSAndroid Build Coastguard Worker       }
238*15dc779aSAndroid Build Coastguard Worker 
239*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nlong / 2; i++) {
240*15dc779aSAndroid Build Coastguard Worker         out_mdct[nlong / 2 + i] =
241*15dc779aSAndroid Build Coastguard Worker             ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
242*15dc779aSAndroid Build Coastguard Worker         out_mdct[i] = (-ixheaac_add32(in_data[nlong + i + nlong / 2],
243*15dc779aSAndroid Build Coastguard Worker                                        in_data[nlong2 - nlong / 2 - 1 - i]));
244*15dc779aSAndroid Build Coastguard Worker       }
245*15dc779aSAndroid Build Coastguard Worker 
246*15dc779aSAndroid Build Coastguard Worker       if (512 == nlong || (480 == nlong)) {
247*15dc779aSAndroid Build Coastguard Worker         if (512 == nlong)
248*15dc779aSAndroid Build Coastguard Worker           ixheaacd_inverse_transform_512(
249*15dc779aSAndroid Build Coastguard Worker               out_mdct, in_data, &imdct_scale,
250*15dc779aSAndroid Build Coastguard Worker               aac_tables_ptr->pstr_imdct_tables->cosine_array_1024,
251*15dc779aSAndroid Build Coastguard Worker               aac_tables_ptr->pstr_imdct_tables, object_type);
252*15dc779aSAndroid Build Coastguard Worker 
253*15dc779aSAndroid Build Coastguard Worker         else
254*15dc779aSAndroid Build Coastguard Worker           ixheaacd_mdct_480_ld(out_mdct, in_data, &imdct_scale, 1,
255*15dc779aSAndroid Build Coastguard Worker                                aac_tables_ptr->pstr_imdct_tables, object_type);
256*15dc779aSAndroid Build Coastguard Worker 
257*15dc779aSAndroid Build Coastguard Worker         imdct_scale += 1;
258*15dc779aSAndroid Build Coastguard Worker 
259*15dc779aSAndroid Build Coastguard Worker         if (imdct_scale > 0) {
260*15dc779aSAndroid Build Coastguard Worker           WORD32 *ptr_out_mdct = &out_mdct[0];
261*15dc779aSAndroid Build Coastguard Worker 
262*15dc779aSAndroid Build Coastguard Worker           for (i = nlong - 1; i >= 0; i -= 4) {
263*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
264*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
265*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
266*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
267*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
268*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
269*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shl32(*ptr_out_mdct, imdct_scale);
270*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
271*15dc779aSAndroid Build Coastguard Worker           }
272*15dc779aSAndroid Build Coastguard Worker         } else if (imdct_scale < 0) {
273*15dc779aSAndroid Build Coastguard Worker           WORD32 *ptr_out_mdct = &out_mdct[0];
274*15dc779aSAndroid Build Coastguard Worker           imdct_scale = -imdct_scale;
275*15dc779aSAndroid Build Coastguard Worker           for (i = nlong - 1; i >= 0; i -= 4) {
276*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
277*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
278*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
279*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
280*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
281*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
282*15dc779aSAndroid Build Coastguard Worker             *ptr_out_mdct = ixheaac_shr32(*ptr_out_mdct, imdct_scale);
283*15dc779aSAndroid Build Coastguard Worker             ptr_out_mdct++;
284*15dc779aSAndroid Build Coastguard Worker           }
285*15dc779aSAndroid Build Coastguard Worker         }
286*15dc779aSAndroid Build Coastguard Worker       }
287*15dc779aSAndroid Build Coastguard Worker 
288*15dc779aSAndroid Build Coastguard Worker       else if (1024 == nlong) {
289*15dc779aSAndroid Build Coastguard Worker         expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
290*15dc779aSAndroid Build Coastguard Worker 
291*15dc779aSAndroid Build Coastguard Worker         expo = 8 - expo;
292*15dc779aSAndroid Build Coastguard Worker 
293*15dc779aSAndroid Build Coastguard Worker         imdct_scale = ixheaacd_inverse_transform(
294*15dc779aSAndroid Build Coastguard Worker             out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
295*15dc779aSAndroid Build Coastguard Worker 
296*15dc779aSAndroid Build Coastguard Worker         ixheaacd_post_twiddle_dec(in_data, out_mdct,
297*15dc779aSAndroid Build Coastguard Worker                                   aac_tables_ptr->pstr_imdct_tables, 1024);
298*15dc779aSAndroid Build Coastguard Worker 
299*15dc779aSAndroid Build Coastguard Worker         imdct_scale += 1;
300*15dc779aSAndroid Build Coastguard Worker 
301*15dc779aSAndroid Build Coastguard Worker         for (i = 0; i < nlong; i++) {
302*15dc779aSAndroid Build Coastguard Worker           out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
303*15dc779aSAndroid Build Coastguard Worker         }
304*15dc779aSAndroid Build Coastguard Worker       }
305*15dc779aSAndroid Build Coastguard Worker 
306*15dc779aSAndroid Build Coastguard Worker       break;
307*15dc779aSAndroid Build Coastguard Worker 
308*15dc779aSAndroid Build Coastguard Worker     case LONG_START_SEQUENCE:
309*15dc779aSAndroid Build Coastguard Worker 
310*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nlong>> 1; i++)
311*15dc779aSAndroid Build Coastguard Worker         in_data[i] =
312*15dc779aSAndroid Build Coastguard Worker             ixheaac_mult32x16in32_shl(in_data[i], window_long_prev[2 * i]);
313*15dc779aSAndroid Build Coastguard Worker 
314*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nlong>> 1; i++)
315*15dc779aSAndroid Build Coastguard Worker         in_data[i + (nlong >> 1)] = ixheaac_mult32x16in32_shl(
316*15dc779aSAndroid Build Coastguard Worker             in_data[i + (nlong >> 1)], window_long_prev[nlong - 1 - 2 * i - 1]);
317*15dc779aSAndroid Build Coastguard Worker 
318*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nshort>> 1; i++)
319*15dc779aSAndroid Build Coastguard Worker         in_data[i + nlong + nflat_ls + (nshort >> 1)] =
320*15dc779aSAndroid Build Coastguard Worker             ixheaac_mult32x16in32_shl(
321*15dc779aSAndroid Build Coastguard Worker                 in_data[i + nlong + nflat_ls + (nshort >> 1)],
322*15dc779aSAndroid Build Coastguard Worker                 window_short[nshort - 1 - 2 * i - 1]);
323*15dc779aSAndroid Build Coastguard Worker 
324*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nflat_ls; i++) in_data[i + nlong + nflat_ls + nshort] = 0;
325*15dc779aSAndroid Build Coastguard Worker 
326*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nlong / 2; i++) {
327*15dc779aSAndroid Build Coastguard Worker         out_mdct[nlong / 2 + i] =
328*15dc779aSAndroid Build Coastguard Worker             ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
329*15dc779aSAndroid Build Coastguard Worker         out_mdct[nlong / 2 - 1 - i] =
330*15dc779aSAndroid Build Coastguard Worker             -ixheaac_add32(in_data[nlong + i], in_data[nlong2 - 1 - i]);
331*15dc779aSAndroid Build Coastguard Worker       }
332*15dc779aSAndroid Build Coastguard Worker 
333*15dc779aSAndroid Build Coastguard Worker       {
334*15dc779aSAndroid Build Coastguard Worker         expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
335*15dc779aSAndroid Build Coastguard Worker 
336*15dc779aSAndroid Build Coastguard Worker         expo = 8 - expo;
337*15dc779aSAndroid Build Coastguard Worker         imdct_scale = ixheaacd_inverse_transform(
338*15dc779aSAndroid Build Coastguard Worker             out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
339*15dc779aSAndroid Build Coastguard Worker 
340*15dc779aSAndroid Build Coastguard Worker         ixheaacd_post_twiddle_dec(in_data, out_mdct,
341*15dc779aSAndroid Build Coastguard Worker                                   aac_tables_ptr->pstr_imdct_tables, 1024);
342*15dc779aSAndroid Build Coastguard Worker       }
343*15dc779aSAndroid Build Coastguard Worker 
344*15dc779aSAndroid Build Coastguard Worker       imdct_scale += 1;
345*15dc779aSAndroid Build Coastguard Worker 
346*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nlong; i++) {
347*15dc779aSAndroid Build Coastguard Worker         out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
348*15dc779aSAndroid Build Coastguard Worker       }
349*15dc779aSAndroid Build Coastguard Worker       break;
350*15dc779aSAndroid Build Coastguard Worker 
351*15dc779aSAndroid Build Coastguard Worker     case LONG_STOP_SEQUENCE:
352*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nflat_ls; i++) in_data[i] = 0;
353*15dc779aSAndroid Build Coastguard Worker 
354*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nshort>> 1; i++)
355*15dc779aSAndroid Build Coastguard Worker         in_data[i + nflat_ls] = ixheaac_mult32x16in32_shl(
356*15dc779aSAndroid Build Coastguard Worker             in_data[i + nflat_ls], window_short_prev[2 * i]);
357*15dc779aSAndroid Build Coastguard Worker 
358*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nshort>> 1; i++)
359*15dc779aSAndroid Build Coastguard Worker         in_data[i + nflat_ls + (nshort >> 1)] =
360*15dc779aSAndroid Build Coastguard Worker             ixheaac_mult32x16in32_shl(in_data[i + nflat_ls + (nshort >> 1)],
361*15dc779aSAndroid Build Coastguard Worker                                        window_short_prev[127 - 2 * i]);
362*15dc779aSAndroid Build Coastguard Worker 
363*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nlong>> 1; i++)
364*15dc779aSAndroid Build Coastguard Worker         in_data[i + nlong] = ixheaac_mult32x16in32_shl(in_data[i + nlong],
365*15dc779aSAndroid Build Coastguard Worker                                                         window_long[2 * i + 1]);
366*15dc779aSAndroid Build Coastguard Worker 
367*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i<nlong>> 1; i++)
368*15dc779aSAndroid Build Coastguard Worker         in_data[i + nlong + (nlong >> 1)] =
369*15dc779aSAndroid Build Coastguard Worker             ixheaac_mult32x16in32_shl(in_data[i + nlong + (nlong >> 1)],
370*15dc779aSAndroid Build Coastguard Worker                                        window_long[nlong - 1 - 2 * i - 1]);
371*15dc779aSAndroid Build Coastguard Worker 
372*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nlong / 2; i++) {
373*15dc779aSAndroid Build Coastguard Worker         out_mdct[nlong / 2 + i] =
374*15dc779aSAndroid Build Coastguard Worker             ixheaac_sub32(in_data[i], in_data[nlong - 1 - i]);
375*15dc779aSAndroid Build Coastguard Worker         out_mdct[nlong / 2 - 1 - i] =
376*15dc779aSAndroid Build Coastguard Worker             -ixheaac_add32(in_data[nlong + i], in_data[nlong2 - 1 - i]);
377*15dc779aSAndroid Build Coastguard Worker       }
378*15dc779aSAndroid Build Coastguard Worker 
379*15dc779aSAndroid Build Coastguard Worker       {
380*15dc779aSAndroid Build Coastguard Worker         expo = ixheaacd_calc_max_spectral_line_dec(out_mdct, 1024) - 1;
381*15dc779aSAndroid Build Coastguard Worker 
382*15dc779aSAndroid Build Coastguard Worker         expo = 8 - expo;
383*15dc779aSAndroid Build Coastguard Worker         imdct_scale = ixheaacd_inverse_transform(
384*15dc779aSAndroid Build Coastguard Worker             out_mdct, in_data, aac_tables_ptr->pstr_imdct_tables, expo, 1024);
385*15dc779aSAndroid Build Coastguard Worker 
386*15dc779aSAndroid Build Coastguard Worker         ixheaacd_post_twiddle_dec(in_data, out_mdct,
387*15dc779aSAndroid Build Coastguard Worker                                   aac_tables_ptr->pstr_imdct_tables, 1024);
388*15dc779aSAndroid Build Coastguard Worker       }
389*15dc779aSAndroid Build Coastguard Worker 
390*15dc779aSAndroid Build Coastguard Worker       imdct_scale += 1;
391*15dc779aSAndroid Build Coastguard Worker 
392*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < nlong; i++) {
393*15dc779aSAndroid Build Coastguard Worker         out_mdct[i] = ixheaac_shl32_dir(in_data[i], imdct_scale);
394*15dc779aSAndroid Build Coastguard Worker       }
395*15dc779aSAndroid Build Coastguard Worker 
396*15dc779aSAndroid Build Coastguard Worker       break;
397*15dc779aSAndroid Build Coastguard Worker   }
398*15dc779aSAndroid Build Coastguard Worker }
399*15dc779aSAndroid Build Coastguard Worker 
ixheaacd_lt_update_state(WORD16 * lt_pred_stat,VOID * time_t,WORD32 * overlap,WORD32 frame_len,WORD32 object_type,WORD32 stride,WORD16 window_sequence,WORD16 * p_window_next,WORD slot_element)400*15dc779aSAndroid Build Coastguard Worker VOID ixheaacd_lt_update_state(WORD16 *lt_pred_stat, VOID *time_t,
401*15dc779aSAndroid Build Coastguard Worker                               WORD32 *overlap, WORD32 frame_len,
402*15dc779aSAndroid Build Coastguard Worker                               WORD32 object_type, WORD32 stride,
403*15dc779aSAndroid Build Coastguard Worker                               WORD16 window_sequence, WORD16 *p_window_next,
404*15dc779aSAndroid Build Coastguard Worker                               WORD slot_element) {
405*15dc779aSAndroid Build Coastguard Worker   WORD32 i;
406*15dc779aSAndroid Build Coastguard Worker 
407*15dc779aSAndroid Build Coastguard Worker   if (object_type == AOT_ER_AAC_LD) {
408*15dc779aSAndroid Build Coastguard Worker     WORD16 *ptr_ltp_state0 = &lt_pred_stat[0];
409*15dc779aSAndroid Build Coastguard Worker     WORD16 *ptr_ltp_state_fl = &lt_pred_stat[frame_len + 0];
410*15dc779aSAndroid Build Coastguard Worker     WORD16 *ptr_ltp_state_2fl = &lt_pred_stat[(frame_len * 2) + 0];
411*15dc779aSAndroid Build Coastguard Worker     WORD16 *time = (WORD16 *)time_t - slot_element;
412*15dc779aSAndroid Build Coastguard Worker     WORD16 *ptr_time_in = &time[0 * stride];
413*15dc779aSAndroid Build Coastguard Worker 
414*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < frame_len; i++) {
415*15dc779aSAndroid Build Coastguard Worker       *ptr_ltp_state0++ = *ptr_ltp_state_fl;
416*15dc779aSAndroid Build Coastguard Worker       *ptr_ltp_state_fl++ = *ptr_ltp_state_2fl;
417*15dc779aSAndroid Build Coastguard Worker       *ptr_ltp_state_2fl++ = *ptr_time_in;
418*15dc779aSAndroid Build Coastguard Worker       ptr_time_in += stride;
419*15dc779aSAndroid Build Coastguard Worker     }
420*15dc779aSAndroid Build Coastguard Worker 
421*15dc779aSAndroid Build Coastguard Worker   } else {
422*15dc779aSAndroid Build Coastguard Worker     WORD16 *ptr_ltp_state0 = &lt_pred_stat[0];
423*15dc779aSAndroid Build Coastguard Worker     WORD16 *ptr_ltp_state_fl = &lt_pred_stat[frame_len + 0];
424*15dc779aSAndroid Build Coastguard Worker     WORD32 *time = (WORD32 *)time_t;
425*15dc779aSAndroid Build Coastguard Worker     WORD32 *ptr_time_in = &time[0 * stride];
426*15dc779aSAndroid Build Coastguard Worker 
427*15dc779aSAndroid Build Coastguard Worker     time = (WORD32 *)time_t;
428*15dc779aSAndroid Build Coastguard Worker 
429*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < frame_len; i++) {
430*15dc779aSAndroid Build Coastguard Worker       *ptr_ltp_state0++ = *ptr_ltp_state_fl;
431*15dc779aSAndroid Build Coastguard Worker       *ptr_ltp_state_fl++ =
432*15dc779aSAndroid Build Coastguard Worker           ixheaac_round16(ixheaac_shl32_sat(*ptr_time_in, 2));
433*15dc779aSAndroid Build Coastguard Worker       ptr_time_in += stride;
434*15dc779aSAndroid Build Coastguard Worker     }
435*15dc779aSAndroid Build Coastguard Worker   }
436*15dc779aSAndroid Build Coastguard Worker 
437*15dc779aSAndroid Build Coastguard Worker   if ((window_sequence == ONLY_LONG_SEQUENCE) ||
438*15dc779aSAndroid Build Coastguard Worker       (window_sequence == LONG_STOP_SEQUENCE)) {
439*15dc779aSAndroid Build Coastguard Worker     if (512 == frame_len) {
440*15dc779aSAndroid Build Coastguard Worker       WORD32 *window = (WORD32 *)p_window_next;
441*15dc779aSAndroid Build Coastguard Worker 
442*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < 256; i++) {
443*15dc779aSAndroid Build Coastguard Worker         lt_pred_stat[(frame_len * 3) + i] =
444*15dc779aSAndroid Build Coastguard Worker             ixheaac_round16(ixheaac_mult16x16in32_shl(
445*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shl16(
446*15dc779aSAndroid Build Coastguard Worker                     (WORD16)-ixheaac_sat16(overlap[255 - i]), 1),
447*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shr32(window[511 - i], 15)));
448*15dc779aSAndroid Build Coastguard Worker 
449*15dc779aSAndroid Build Coastguard Worker         lt_pred_stat[(frame_len * 3) + 256 + i] =
450*15dc779aSAndroid Build Coastguard Worker             ixheaac_round16(ixheaac_mult16x16in32_shl(
451*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[i]), 1),
452*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shr32(window[255 - i], 15)));
453*15dc779aSAndroid Build Coastguard Worker       }
454*15dc779aSAndroid Build Coastguard Worker     } else if (480 == frame_len) {
455*15dc779aSAndroid Build Coastguard Worker       WORD32 *window = (WORD32 *)p_window_next;
456*15dc779aSAndroid Build Coastguard Worker 
457*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < 240; i++) {
458*15dc779aSAndroid Build Coastguard Worker         lt_pred_stat[(frame_len * 3) + i] =
459*15dc779aSAndroid Build Coastguard Worker             ixheaac_round16(ixheaac_mult16x16in32_shl(
460*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shl16(
461*15dc779aSAndroid Build Coastguard Worker                     (WORD16)-ixheaac_sat16(overlap[239 - i]), 1),
462*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shr32(window[479 - i], 15)));
463*15dc779aSAndroid Build Coastguard Worker 
464*15dc779aSAndroid Build Coastguard Worker         lt_pred_stat[(frame_len * 3) + 240 + i] =
465*15dc779aSAndroid Build Coastguard Worker             ixheaac_round16(ixheaac_mult16x16in32_shl(
466*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[i]), 1),
467*15dc779aSAndroid Build Coastguard Worker                 (WORD16)ixheaac_shr32(window[239 - i], 15)));
468*15dc779aSAndroid Build Coastguard Worker       }
469*15dc779aSAndroid Build Coastguard Worker     } else {
470*15dc779aSAndroid Build Coastguard Worker       for (i = 0; i < 512; i++) {
471*15dc779aSAndroid Build Coastguard Worker         lt_pred_stat[(frame_len * 2) + i] = ixheaac_round16(
472*15dc779aSAndroid Build Coastguard Worker             ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
473*15dc779aSAndroid Build Coastguard Worker                                    (WORD16)-ixheaac_sat16(overlap[511 - i]),
474*15dc779aSAndroid Build Coastguard Worker                                    p_window_next[2 * i + 1]),
475*15dc779aSAndroid Build Coastguard Worker                                1));
476*15dc779aSAndroid Build Coastguard Worker 
477*15dc779aSAndroid Build Coastguard Worker         lt_pred_stat[(frame_len * 2) + 512 + i] =
478*15dc779aSAndroid Build Coastguard Worker             ixheaac_round16(ixheaac_shl32_sat(
479*15dc779aSAndroid Build Coastguard Worker                 ixheaac_mult16x16in32_shl((WORD16)-ixheaac_sat16(overlap[i]),
480*15dc779aSAndroid Build Coastguard Worker                                            p_window_next[1023 - 2 * i - 1]),
481*15dc779aSAndroid Build Coastguard Worker                 1));
482*15dc779aSAndroid Build Coastguard Worker       }
483*15dc779aSAndroid Build Coastguard Worker     }
484*15dc779aSAndroid Build Coastguard Worker 
485*15dc779aSAndroid Build Coastguard Worker   } else if (window_sequence == LONG_START_SEQUENCE) {
486*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < 448; i++) {
487*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + i] =
488*15dc779aSAndroid Build Coastguard Worker           ixheaac_shl16((WORD16)-ixheaac_sat16(overlap[511 - i]), 1);
489*15dc779aSAndroid Build Coastguard Worker     }
490*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < 64; i++) {
491*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + 448 + i] =
492*15dc779aSAndroid Build Coastguard Worker           ixheaac_round16(ixheaac_shl32_sat(
493*15dc779aSAndroid Build Coastguard Worker               ixheaac_mult16x16in32_shl(
494*15dc779aSAndroid Build Coastguard Worker                   (WORD16)-ixheaac_sat16(overlap[511 - 448 - i]),
495*15dc779aSAndroid Build Coastguard Worker                   p_window_next[2 * i + 1]),
496*15dc779aSAndroid Build Coastguard Worker               1));
497*15dc779aSAndroid Build Coastguard Worker     }
498*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < 64; i++) {
499*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + 512 + i] =
500*15dc779aSAndroid Build Coastguard Worker           ixheaac_round16(ixheaac_shl32_sat(
501*15dc779aSAndroid Build Coastguard Worker               ixheaac_mult16x16in32_shl((WORD16)-ixheaac_sat16(overlap[i]),
502*15dc779aSAndroid Build Coastguard Worker                                          p_window_next[127 - 2 * i - 1]),
503*15dc779aSAndroid Build Coastguard Worker               1));
504*15dc779aSAndroid Build Coastguard Worker     }
505*15dc779aSAndroid Build Coastguard Worker     for (i = 576; i < 1024; i++) {
506*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + i] = 0;
507*15dc779aSAndroid Build Coastguard Worker     }
508*15dc779aSAndroid Build Coastguard Worker   } else {
509*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < 448; i++) {
510*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + i] =
511*15dc779aSAndroid Build Coastguard Worker           ixheaac_shl16(ixheaac_sat16(overlap[i]), 1);
512*15dc779aSAndroid Build Coastguard Worker     }
513*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < 64; i++) {
514*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + 448 + i] = ixheaac_round16(
515*15dc779aSAndroid Build Coastguard Worker           ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
516*15dc779aSAndroid Build Coastguard Worker                                  (WORD16)-ixheaac_sat16(overlap[511 - i]),
517*15dc779aSAndroid Build Coastguard Worker                                  p_window_next[2 * i + 1]),
518*15dc779aSAndroid Build Coastguard Worker                              1));
519*15dc779aSAndroid Build Coastguard Worker     }
520*15dc779aSAndroid Build Coastguard Worker     for (i = 0; i < 64; i++) {
521*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + 512 + i] = ixheaac_round16(
522*15dc779aSAndroid Build Coastguard Worker           ixheaac_shl32_sat(ixheaac_mult16x16in32_shl(
523*15dc779aSAndroid Build Coastguard Worker                                  (WORD16)-ixheaac_sat16(overlap[448 + i]),
524*15dc779aSAndroid Build Coastguard Worker                                  p_window_next[127 - 2 * i - 1]),
525*15dc779aSAndroid Build Coastguard Worker                              1));
526*15dc779aSAndroid Build Coastguard Worker     }
527*15dc779aSAndroid Build Coastguard Worker     for (i = 576; i < 1024; i++) {
528*15dc779aSAndroid Build Coastguard Worker       lt_pred_stat[(frame_len * 2) + i] = 0;
529*15dc779aSAndroid Build Coastguard Worker     }
530*15dc779aSAndroid Build Coastguard Worker   }
531*15dc779aSAndroid Build Coastguard Worker }
532