1 /******************************************************************************
2 *
3 * Copyright (C) 2023 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #include <string.h>
21 #include "ixheaacd_type_def.h"
22 #include "ixheaacd_mps_struct_def.h"
23 #include "ixheaacd_error_codes.h"
24 #include "ixheaacd_mps_res_rom.h"
25 #include "ixheaacd_mps_aac_struct.h"
26 #include "ixheaacd_constants.h"
27 #include "ixheaacd_basic_ops32.h"
28 #include "ixheaacd_basic_ops40.h"
29 #include "ixheaacd_bitbuffer.h"
30 #include "ixheaacd_common_rom.h"
31 #include "ixheaacd_sbrdecsettings.h"
32 #include "ixheaacd_sbr_scale.h"
33 #include "ixheaacd_env_extr_part.h"
34 #include "ixheaacd_sbr_rom.h"
35 #include "ixheaacd_hybrid.h"
36 #include "ixheaacd_ps_dec.h"
37 #include "ixheaacd_mps_polyphase.h"
38 #include "ixheaacd_config.h"
39 #include "ixheaacd_qmf_dec.h"
40 #include "ixheaacd_mps_dec.h"
41 #include "ixheaacd_mps_defines.h"
42 #include "ixheaacd_mps_macro_def.h"
43 #include "ixheaacd_mps_basic_op.h"
44 #include "ixheaacd_error_standards.h"
45
ixheaacd_fft32(WORD32 * vec,const WORD16 * fft_c)46 static VOID ixheaacd_fft32(WORD32 *vec, const WORD16 *fft_c) {
47 WORD32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13,
48 tmp14, tmp15;
49 WORD32 temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp110,
50 temp111, temp112, temp113, temp114, temp115;
51 WORD32 temp20, temp21, temp22, temp23, temp24, temp25, temp26, temp27, temp28, temp29, temp210,
52 temp211, temp212, temp213, temp214, temp215;
53 WORD32 temp30, temp31, temp32, temp33, temp34, temp35, temp36, temp37, temp38, temp39, temp310,
54 temp311, temp312, temp313, temp314, temp315;
55 WORD32 temp316, temp317, temp318, temp319, temp320, temp321, temp322, temp323, temp324, temp325,
56 temp326, temp327, temp328, temp329, temp330, temp331;
57 WORD32 temp40, temp41, temp42, temp43, temp44, temp45, temp46, temp47, temp48, temp49, temp410,
58 temp411, temp412, temp413, temp414, temp415;
59
60 temp20 = ixheaacd_sub32_sat(vec[2], vec[34]);
61 temp21 = ixheaacd_sub32_sat(vec[3], vec[35]);
62 temp30 = ixheaacd_add32_sat(vec[0], vec[32]);
63 temp31 = ixheaacd_add32_sat(vec[1], vec[33]);
64 temp32 = ixheaacd_add32_sat(vec[2], vec[34]);
65 temp33 = ixheaacd_add32_sat(vec[3], vec[35]);
66
67 temp22 = ixheaacd_sub32_sat(vec[6], vec[38]);
68 temp23 = ixheaacd_sub32_sat(vec[7], vec[39]);
69 temp34 = ixheaacd_add32_sat(vec[4], vec[36]);
70 temp35 = ixheaacd_add32_sat(vec[5], vec[37]);
71 temp36 = ixheaacd_add32_sat(vec[6], vec[38]);
72 temp37 = ixheaacd_add32_sat(vec[7], vec[39]);
73
74 temp24 = ixheaacd_sub32_sat(vec[10], vec[42]);
75 temp25 = ixheaacd_sub32_sat(vec[11], vec[43]);
76 temp38 = ixheaacd_add32_sat(vec[8], vec[40]);
77 temp39 = ixheaacd_add32_sat(vec[9], vec[41]);
78 temp310 = ixheaacd_add32_sat(vec[10], vec[42]);
79 temp311 = ixheaacd_add32_sat(vec[11], vec[43]);
80
81 temp26 = ixheaacd_sub32_sat(vec[14], vec[46]);
82 temp27 = ixheaacd_sub32_sat(vec[15], vec[47]);
83 temp312 = ixheaacd_add32_sat(vec[12], vec[44]);
84 temp313 = ixheaacd_add32_sat(vec[13], vec[45]);
85 temp314 = ixheaacd_add32_sat(vec[14], vec[46]);
86 temp315 = ixheaacd_add32_sat(vec[15], vec[47]);
87
88 temp28 = ixheaacd_sub32_sat(vec[18], vec[50]);
89 temp29 = ixheaacd_sub32_sat(vec[19], vec[51]);
90 temp316 = ixheaacd_add32_sat(vec[16], vec[48]);
91 temp317 = ixheaacd_add32_sat(vec[17], vec[49]);
92 temp318 = ixheaacd_add32_sat(vec[18], vec[50]);
93 temp319 = ixheaacd_add32_sat(vec[19], vec[51]);
94
95 temp210 = ixheaacd_sub32_sat(vec[22], vec[54]);
96 temp211 = ixheaacd_sub32_sat(vec[23], vec[55]);
97 temp320 = ixheaacd_add32_sat(vec[20], vec[52]);
98 temp321 = ixheaacd_add32_sat(vec[21], vec[53]);
99 temp322 = ixheaacd_add32_sat(vec[22], vec[54]);
100 temp323 = ixheaacd_add32_sat(vec[23], vec[55]);
101
102 temp212 = ixheaacd_sub32_sat(vec[26], vec[58]);
103 temp213 = ixheaacd_sub32_sat(vec[27], vec[59]);
104 temp324 = ixheaacd_add32_sat(vec[24], vec[56]);
105 temp325 = ixheaacd_add32_sat(vec[25], vec[57]);
106 temp326 = ixheaacd_add32_sat(vec[26], vec[58]);
107 temp327 = ixheaacd_add32_sat(vec[27], vec[59]);
108
109 temp214 = ixheaacd_sub32_sat(vec[30], vec[62]);
110 temp215 = ixheaacd_sub32_sat(vec[31], vec[63]);
111 temp328 = ixheaacd_add32_sat(vec[28], vec[60]);
112 temp329 = ixheaacd_add32_sat(vec[29], vec[61]);
113 temp330 = ixheaacd_add32_sat(vec[30], vec[62]);
114 temp331 = ixheaacd_add32_sat(vec[31], vec[63]);
115
116 temp41 = -ixheaacd_add32_sat(temp20, temp214);
117 temp42 = ixheaacd_sub32_sat(temp20, temp214);
118 temp40 = ixheaacd_add32_sat(temp21, temp215);
119 temp43 = ixheaacd_sub32_sat(temp21, temp215);
120 temp45 = -ixheaacd_add32_sat(temp22, temp212);
121 temp46 = ixheaacd_sub32_sat(temp22, temp212);
122 temp44 = ixheaacd_add32_sat(temp23, temp213);
123 temp47 = ixheaacd_sub32_sat(temp23, temp213);
124 temp49 = -ixheaacd_add32_sat(temp24, temp210);
125 temp410 = ixheaacd_sub32_sat(temp24, temp210);
126 temp48 = ixheaacd_add32_sat(temp25, temp211);
127 temp411 = ixheaacd_sub32_sat(temp25, temp211);
128 temp413 = -ixheaacd_add32_sat(temp26, temp28);
129 temp414 = ixheaacd_sub32_sat(temp26, temp28);
130 temp412 = ixheaacd_add32_sat(temp27, temp29);
131 temp415 = ixheaacd_sub32_sat(temp27, temp29);
132
133 temp20 = ixheaacd_add32_sat(ixheaacd_add32_sat(ixheaacd_add32_sat(
134 ixheaacd_mult32x16in32_shl(temp40, fft_c[3]),
135 ixheaacd_mult32x16in32_shl(temp44, fft_c[2])),
136 ixheaacd_mult32x16in32_shl(temp48, fft_c[1])),
137 ixheaacd_mult32x16in32_shl(temp412, fft_c[0]));
138
139 temp24 = ixheaacd_sub32_sat(ixheaacd_add32_sat(ixheaacd_add32_sat(
140 ixheaacd_mult32x16in32_shl(temp40, fft_c[2]),
141 ixheaacd_mult32x16in32_shl(temp44, fft_c[0])),
142 ixheaacd_mult32x16in32_shl(temp48, fft_c[3])),
143 ixheaacd_mult32x16in32_shl(temp412, fft_c[1]));
144
145 temp28 = ixheaacd_add32_sat(ixheaacd_sub32_sat(ixheaacd_add32_sat(
146 ixheaacd_mult32x16in32_shl(temp40, fft_c[1]),
147 ixheaacd_mult32x16in32_shl(temp44, fft_c[3])),
148 ixheaacd_mult32x16in32_shl(temp48, fft_c[0])),
149 ixheaacd_mult32x16in32_shl(temp412, fft_c[2]));
150
151 temp212 = ixheaacd_sub32_sat(ixheaacd_add32_sat(ixheaacd_sub32_sat(
152 ixheaacd_mult32x16in32_shl(temp40, fft_c[0]),
153 ixheaacd_mult32x16in32_shl(temp44, fft_c[1])),
154 ixheaacd_mult32x16in32_shl(temp48, fft_c[2])),
155 ixheaacd_mult32x16in32_shl(temp412, fft_c[3]));
156
157 temp21 = ixheaacd_add32_sat(ixheaacd_add32_sat(ixheaacd_add32_sat(
158 ixheaacd_mult32x16in32_shl(temp41, fft_c[3]),
159 ixheaacd_mult32x16in32_shl(temp45, fft_c[2])),
160 ixheaacd_mult32x16in32_shl(temp49, fft_c[1])),
161 ixheaacd_mult32x16in32_shl(temp413, fft_c[0]));
162
163 temp25 = ixheaacd_sub32_sat(ixheaacd_add32_sat(ixheaacd_add32_sat(
164 ixheaacd_mult32x16in32_shl(temp41, fft_c[2]),
165 ixheaacd_mult32x16in32_shl(temp45, fft_c[0])),
166 ixheaacd_mult32x16in32_shl(temp49, fft_c[3])),
167 ixheaacd_mult32x16in32_shl(temp413, fft_c[1]));
168
169 temp29 = ixheaacd_add32_sat(ixheaacd_sub32_sat(ixheaacd_add32_sat(
170 ixheaacd_mult32x16in32_shl(temp41, fft_c[1]),
171 ixheaacd_mult32x16in32_shl(temp45, fft_c[3])),
172 ixheaacd_mult32x16in32_shl(temp49, fft_c[0])),
173 ixheaacd_mult32x16in32_shl(temp413, fft_c[2]));
174
175 temp213 = ixheaacd_sub32_sat(ixheaacd_add32_sat(ixheaacd_sub32_sat(
176 ixheaacd_mult32x16in32_shl(temp41, fft_c[0]),
177 ixheaacd_mult32x16in32_shl(temp45, fft_c[1])),
178 ixheaacd_mult32x16in32_shl(temp49, fft_c[2])),
179 ixheaacd_mult32x16in32_shl(temp413, fft_c[3]));
180
181 temp22 = ixheaacd_add32_sat(ixheaacd_add32_sat(ixheaacd_add32_sat(
182 ixheaacd_mult32x16in32_shl(temp42, fft_c[0]),
183 ixheaacd_mult32x16in32_shl(temp46, fft_c[1])),
184 ixheaacd_mult32x16in32_shl(temp410, fft_c[2])),
185 ixheaacd_mult32x16in32_shl(temp414, fft_c[3]));
186
187 temp26 = ixheaacd_sub32_sat(ixheaacd_sub32_sat(ixheaacd_sub32_sat(
188 ixheaacd_mult32x16in32_shl(temp42, fft_c[1]),
189 ixheaacd_mult32x16in32_shl(temp46, fft_c[3])),
190 ixheaacd_mult32x16in32_shl(temp410, fft_c[0])),
191 ixheaacd_mult32x16in32_shl(temp414, fft_c[2]));
192
193 temp210 = ixheaacd_add32_sat(ixheaacd_add32_sat(ixheaacd_sub32_sat(
194 ixheaacd_mult32x16in32_shl(temp42, fft_c[2]),
195 ixheaacd_mult32x16in32_shl(temp46, fft_c[0])),
196 ixheaacd_mult32x16in32_shl(temp410, fft_c[3])),
197 ixheaacd_mult32x16in32_shl(temp414, fft_c[1]));
198
199 temp214 = ixheaacd_sub32_sat(ixheaacd_add32_sat(ixheaacd_sub32_sat(
200 ixheaacd_mult32x16in32_shl(temp42, fft_c[3]),
201 ixheaacd_mult32x16in32_shl(temp46, fft_c[2])),
202 ixheaacd_mult32x16in32_shl(temp410, fft_c[1])),
203 ixheaacd_mult32x16in32_shl(temp414, fft_c[0]));
204
205 temp23 = ixheaacd_add32_sat(ixheaacd_add32_sat(ixheaacd_add32_sat(
206 ixheaacd_mult32x16in32_shl(temp43, fft_c[0]),
207 ixheaacd_mult32x16in32_shl(temp47, fft_c[1])),
208 ixheaacd_mult32x16in32_shl(temp411, fft_c[2])),
209 ixheaacd_mult32x16in32_shl(temp415, fft_c[3]));
210
211 temp27 = ixheaacd_sub32_sat(ixheaacd_sub32_sat(ixheaacd_sub32_sat(
212 ixheaacd_mult32x16in32_shl(temp43, fft_c[1]),
213 ixheaacd_mult32x16in32_shl(temp47, fft_c[3])),
214 ixheaacd_mult32x16in32_shl(temp411, fft_c[0])),
215 ixheaacd_mult32x16in32_shl(temp415, fft_c[2]));
216
217 temp211 = ixheaacd_add32_sat(ixheaacd_add32_sat(ixheaacd_sub32_sat(
218 ixheaacd_mult32x16in32_shl(temp43, fft_c[2]),
219 ixheaacd_mult32x16in32_shl(temp47, fft_c[0])),
220 ixheaacd_mult32x16in32_shl(temp411, fft_c[3])),
221 ixheaacd_mult32x16in32_shl(temp415, fft_c[1]));
222
223 temp215 = ixheaacd_sub32_sat(ixheaacd_add32_sat(ixheaacd_sub32_sat(
224 ixheaacd_mult32x16in32_shl(temp43, fft_c[3]),
225 ixheaacd_mult32x16in32_shl(temp47, fft_c[2])),
226 ixheaacd_mult32x16in32_shl(temp411, fft_c[1])),
227 ixheaacd_mult32x16in32_shl(temp415, fft_c[0]));
228
229 temp40 = ixheaacd_add32_sat(temp20, temp22);
230 temp414 = ixheaacd_sub32_sat(temp20, temp22);
231 temp41 = ixheaacd_add32_sat(temp21, temp23);
232 temp415 = ixheaacd_sub32_sat(temp21, temp23);
233 temp42 = ixheaacd_add32_sat(temp24, temp26);
234 temp412 = ixheaacd_sub32_sat(temp24, temp26);
235 temp43 = ixheaacd_add32_sat(temp25, temp27);
236 temp413 = ixheaacd_sub32_sat(temp25, temp27);
237 temp44 = ixheaacd_add32_sat(temp28, temp210);
238 temp410 = ixheaacd_sub32_sat(temp28, temp210);
239 temp45 = ixheaacd_add32_sat(temp29, temp211);
240 temp411 = ixheaacd_sub32_sat(temp29, temp211);
241 temp46 = ixheaacd_add32_sat(temp212, temp214);
242 temp48 = ixheaacd_sub32_sat(temp212, temp214);
243 temp47 = ixheaacd_add32_sat(temp213, temp215);
244 temp49 = ixheaacd_sub32_sat(temp213, temp215);
245
246 temp10 = ixheaacd_add32_sat(temp30, temp316);
247 temp11 = ixheaacd_add32_sat(temp31, temp317);
248 temp12 = ixheaacd_add32_sat(temp32, temp318);
249 temp13 = ixheaacd_add32_sat(temp33, temp319);
250 temp14 = ixheaacd_add32_sat(temp34, temp320);
251 temp15 = ixheaacd_add32_sat(temp35, temp321);
252 temp16 = ixheaacd_add32_sat(temp36, temp322);
253 temp17 = ixheaacd_add32_sat(temp37, temp323);
254 temp18 = ixheaacd_add32_sat(temp38, temp324);
255 temp19 = ixheaacd_add32_sat(temp39, temp325);
256 temp110 = ixheaacd_add32_sat(temp310, temp326);
257 temp111 = ixheaacd_add32_sat(temp311, temp327);
258 temp112 = ixheaacd_add32_sat(temp312, temp328);
259 temp113 = ixheaacd_add32_sat(temp313, temp329);
260 temp114 = ixheaacd_add32_sat(temp314, temp330);
261 temp115 = ixheaacd_add32_sat(temp315, temp331);
262
263 tmp0 = ixheaacd_add32_sat(temp10, temp18);
264 tmp2 = ixheaacd_sub32_sat(temp10, temp18);
265 tmp1 = ixheaacd_add32_sat(temp11, temp19);
266 tmp3 = ixheaacd_sub32_sat(temp11, temp19);
267 tmp4 = ixheaacd_add32_sat(temp12, temp110);
268 tmp6 = ixheaacd_sub32_sat(temp12, temp110);
269 tmp5 = ixheaacd_add32_sat(temp13, temp111);
270 tmp7 = ixheaacd_sub32_sat(temp13, temp111);
271 tmp8 = ixheaacd_add32_sat(temp14, temp112);
272 tmp10 = ixheaacd_sub32_sat(temp14, temp112);
273 tmp9 = ixheaacd_add32_sat(temp15, temp113);
274 tmp11 = ixheaacd_sub32_sat(temp15, temp113);
275 tmp12 = ixheaacd_add32_sat(temp16, temp114);
276 tmp14 = ixheaacd_sub32_sat(temp16, temp114);
277 tmp13 = ixheaacd_add32_sat(temp17, temp115);
278 tmp15 = ixheaacd_sub32_sat(temp17, temp115);
279
280 temp20 = ixheaacd_add32_sat(tmp0, tmp8);
281 temp24 = ixheaacd_sub32_sat(tmp0, tmp8);
282 temp21 = ixheaacd_add32_sat(tmp1, tmp9);
283 temp25 = ixheaacd_sub32_sat(tmp1, tmp9);
284 temp28 = ixheaacd_sub32_sat(tmp2, tmp11);
285 temp210 = ixheaacd_add32_sat(tmp2, tmp11);
286 temp29 = ixheaacd_add32_sat(tmp3, tmp10);
287 temp211 = ixheaacd_sub32_sat(tmp3, tmp10);
288 temp22 = ixheaacd_add32_sat(tmp4, tmp12);
289 temp27 = ixheaacd_sub32_sat(tmp4, tmp12);
290 temp23 = ixheaacd_add32_sat(tmp5, tmp13);
291 temp26 = ixheaacd_sub32_sat(tmp13, tmp5);
292
293 tmp1 = ixheaacd_add32_sat(tmp6, tmp14);
294 tmp2 = ixheaacd_sub32_sat(tmp6, tmp14);
295 tmp0 = ixheaacd_add32_sat(tmp7, tmp15);
296 tmp3 = ixheaacd_sub32_sat(tmp7, tmp15);
297
298 temp212 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(tmp0, tmp2), INV_SQRT2_Q15);
299 temp214 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(tmp0, tmp2), INV_SQRT2_Q15);
300 temp213 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(tmp3, tmp1), INV_SQRT2_Q15);
301 temp215 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(tmp1, tmp3), -INV_SQRT2_Q15);
302
303 temp10 = ixheaacd_sub32_sat(temp30, temp316);
304 temp11 = ixheaacd_sub32_sat(temp31, temp317);
305 temp12 = ixheaacd_sub32_sat(temp32, temp318);
306 temp13 = ixheaacd_sub32_sat(temp33, temp319);
307 temp14 = ixheaacd_sub32_sat(temp34, temp320);
308 temp15 = ixheaacd_sub32_sat(temp35, temp321);
309 temp16 = ixheaacd_sub32_sat(temp36, temp322);
310 temp17 = ixheaacd_sub32_sat(temp37, temp323);
311 temp18 = ixheaacd_sub32_sat(temp38, temp324);
312 temp19 = ixheaacd_sub32_sat(temp39, temp325);
313 temp110 = ixheaacd_sub32_sat(temp310, temp326);
314 temp111 = ixheaacd_sub32_sat(temp311, temp327);
315 temp112 = ixheaacd_sub32_sat(temp312, temp328);
316 temp113 = ixheaacd_sub32_sat(temp313, temp329);
317 temp114 = ixheaacd_sub32_sat(temp314, temp330);
318 temp115 = ixheaacd_sub32_sat(temp315, temp331);
319
320 temp30 = ixheaacd_add32_sat(temp20, temp22);
321 temp316 = ixheaacd_sub32_sat(temp20, temp22);
322 temp31 = ixheaacd_add32_sat(temp21, temp23);
323 temp317 = ixheaacd_sub32_sat(temp21, temp23);
324 temp38 = ixheaacd_sub32_sat(temp24, temp26);
325 temp324 = ixheaacd_add32_sat(temp24, temp26);
326 temp39 = ixheaacd_sub32_sat(temp25, temp27);
327 temp325 = ixheaacd_add32_sat(temp25, temp27);
328 temp312 = ixheaacd_add32_sat(temp28, temp214);
329 temp328 = ixheaacd_sub32_sat(temp28, temp214);
330 temp313 = ixheaacd_add32_sat(temp29, temp215);
331 temp329 = ixheaacd_sub32_sat(temp29, temp215);
332 temp34 = ixheaacd_add32_sat(temp210, temp212);
333 temp320 = ixheaacd_sub32_sat(temp210, temp212);
334 temp35 = ixheaacd_add32_sat(temp211, temp213);
335 temp321 = ixheaacd_sub32_sat(temp211, temp213);
336
337 tmp9 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp12, temp114), -COS_3PI_BY_8_Q15);
338 tmp10 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp12, temp114), COS_PI_BY_8_Q15);
339 tmp8 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp13, temp115), COS_3PI_BY_8_Q15);
340 tmp11 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp13, temp115), COS_PI_BY_8_Q15);
341 tmp5 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp14, temp112), -INV_SQRT2_Q15);
342 tmp6 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp14, temp112), INV_SQRT2_Q15);
343 tmp4 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp15, temp113), INV_SQRT2_Q15);
344 tmp7 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp15, temp113), INV_SQRT2_Q15);
345 tmp13 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp16, temp110), -COS_PI_BY_8_Q15);
346 tmp14 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp16, temp110), COS_3PI_BY_8_Q15);
347 tmp12 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp17, temp111), COS_PI_BY_8_Q15);
348 tmp15 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp17, temp111), COS_3PI_BY_8_Q15);
349
350 temp12 = ixheaacd_sub32_sat(ixheaacd_shl32(ixheaacd_mult32x16in32(tmp8, SQRT2PLUS1_Q13), 3),
351 ixheaacd_mult32x16in32_shl(tmp12, SQRT2MINUS1_Q15));
352 temp13 = ixheaacd_sub32_sat(ixheaacd_shl32(ixheaacd_mult32x16in32(tmp9, SQRT2PLUS1_Q13), 3),
353 ixheaacd_mult32x16in32_shl(tmp13, SQRT2MINUS1_Q15));
354 temp14 = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(tmp10, SQRT2MINUS1_Q15),
355 ixheaacd_shl32(ixheaacd_mult32x16in32(tmp14, SQRT2PLUS1_Q13), 3));
356 temp15 = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(tmp11, SQRT2MINUS1_Q15),
357 ixheaacd_shl32(ixheaacd_mult32x16in32(tmp15, SQRT2PLUS1_Q13), 3));
358
359 tmp8 = ixheaacd_add32_sat(tmp8, tmp12);
360 tmp9 = ixheaacd_add32_sat(tmp9, tmp13);
361 tmp10 = ixheaacd_add32_sat(tmp10, tmp14);
362 tmp11 = ixheaacd_add32_sat(tmp11, tmp15);
363 temp16 = ixheaacd_add32_sat(temp10, tmp4);
364 temp110 = ixheaacd_sub32_sat(temp10, tmp4);
365 temp17 = ixheaacd_add32_sat(temp11, tmp5);
366 temp111 = ixheaacd_sub32_sat(temp11, tmp5);
367
368 temp112 = ixheaacd_sub32_sat(tmp6, temp19);
369 temp114 = ixheaacd_add32_sat(tmp6, temp19);
370 temp113 = ixheaacd_add32_sat(temp18, tmp7);
371 temp115 = ixheaacd_sub32_sat(temp18, tmp7);
372
373 tmp0 = ixheaacd_sub32_sat(temp16, temp114);
374 tmp2 = ixheaacd_add32_sat(temp16, temp114);
375 tmp1 = ixheaacd_add32_sat(temp17, temp115);
376 tmp3 = ixheaacd_sub32_sat(temp17, temp115);
377 tmp4 = ixheaacd_add32_sat(temp110, temp112);
378 tmp6 = ixheaacd_sub32_sat(temp110, temp112);
379 tmp5 = ixheaacd_add32_sat(temp111, temp113);
380 tmp7 = ixheaacd_sub32_sat(temp111, temp113);
381
382 temp110 = ixheaacd_add32_sat(tmp8, tmp10);
383 tmp10 = ixheaacd_sub32_sat(tmp8, tmp10);
384 temp111 = ixheaacd_add32_sat(tmp9, tmp11);
385 tmp11 = ixheaacd_sub32_sat(tmp9, tmp11);
386
387 tmp12 = ixheaacd_add32_sat(temp12, temp14);
388 tmp14 = ixheaacd_sub32_sat(temp12, temp14);
389 tmp13 = ixheaacd_add32_sat(temp13, temp15);
390 tmp15 = ixheaacd_sub32_sat(temp13, temp15);
391
392 temp32 = ixheaacd_add32_sat(tmp2, temp110);
393 temp318 = ixheaacd_sub32_sat(tmp2, temp110);
394 temp33 = ixheaacd_add32_sat(tmp3, temp111);
395 temp319 = ixheaacd_sub32_sat(tmp3, temp111);
396 temp36 = ixheaacd_add32_sat(tmp0, tmp12);
397 temp322 = ixheaacd_sub32_sat(tmp0, tmp12);
398 temp37 = ixheaacd_add32_sat(tmp1, tmp13);
399 temp323 = ixheaacd_sub32_sat(tmp1, tmp13);
400 temp314 = ixheaacd_add32_sat(tmp4, tmp10);
401 temp330 = ixheaacd_sub32_sat(tmp4, tmp10);
402 temp315 = ixheaacd_add32_sat(tmp5, tmp11);
403 temp331 = ixheaacd_sub32_sat(tmp5, tmp11);
404 temp310 = ixheaacd_add32_sat(tmp6, tmp14);
405 temp326 = ixheaacd_sub32_sat(tmp6, tmp14);
406 temp311 = ixheaacd_add32_sat(tmp7, tmp15);
407 temp327 = ixheaacd_sub32_sat(tmp7, tmp15);
408
409 temp10 = ixheaacd_sub32_sat(vec[0], vec[32]);
410 temp11 = ixheaacd_sub32_sat(vec[1], vec[33]);
411 temp12 = ixheaacd_sub32_sat(vec[4], vec[36]);
412 temp13 = ixheaacd_sub32_sat(vec[5], vec[37]);
413 temp14 = ixheaacd_sub32_sat(vec[8], vec[40]);
414 temp15 = ixheaacd_sub32_sat(vec[9], vec[41]);
415 temp16 = ixheaacd_sub32_sat(vec[12], vec[44]);
416 temp17 = ixheaacd_sub32_sat(vec[13], vec[45]);
417 temp18 = ixheaacd_sub32_sat(vec[16], vec[48]);
418 temp19 = ixheaacd_sub32_sat(vec[17], vec[49]);
419 temp110 = ixheaacd_sub32_sat(vec[20], vec[52]);
420 temp111 = ixheaacd_sub32_sat(vec[21], vec[53]);
421 temp112 = ixheaacd_sub32_sat(vec[24], vec[56]);
422 temp113 = ixheaacd_sub32_sat(vec[25], vec[57]);
423 temp114 = ixheaacd_sub32_sat(vec[28], vec[60]);
424 temp115 = ixheaacd_sub32_sat(vec[29], vec[61]);
425
426 tmp9 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp12, temp114), -COS_3PI_BY_8_Q15);
427 tmp10 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp12, temp114), COS_PI_BY_8_Q15);
428 tmp8 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp13, temp115), COS_3PI_BY_8_Q15);
429 tmp11 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp13, temp115), COS_PI_BY_8_Q15);
430 tmp5 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp14, temp112), -INV_SQRT2_Q15);
431 tmp6 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp14, temp112), INV_SQRT2_Q15);
432 tmp4 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp15, temp113), INV_SQRT2_Q15);
433 tmp7 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp15, temp113), INV_SQRT2_Q15);
434 tmp13 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp16, temp110), -COS_PI_BY_8_Q15);
435 tmp14 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp16, temp110), COS_3PI_BY_8_Q15);
436 tmp12 = ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(temp17, temp111), COS_PI_BY_8_Q15);
437 tmp15 = ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(temp17, temp111), COS_3PI_BY_8_Q15);
438
439 temp12 = ixheaacd_sub32_sat(ixheaacd_shl32(ixheaacd_mult32x16in32(tmp8, SQRT2PLUS1_Q13), 3),
440 ixheaacd_mult32x16in32_shl(tmp12, SQRT2MINUS1_Q15));
441 temp13 = ixheaacd_sub32_sat(ixheaacd_shl32(ixheaacd_mult32x16in32(tmp9, SQRT2PLUS1_Q13), 3),
442 ixheaacd_mult32x16in32_shl(tmp13, SQRT2MINUS1_Q15));
443 temp14 = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(tmp10, SQRT2MINUS1_Q15),
444 ixheaacd_shl32(ixheaacd_mult32x16in32(tmp14, SQRT2PLUS1_Q13), 3));
445 temp15 = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(tmp11, SQRT2MINUS1_Q15),
446 ixheaacd_shl32(ixheaacd_mult32x16in32(tmp15, SQRT2PLUS1_Q13), 3));
447
448 tmp8 = ixheaacd_add32_sat(tmp8, tmp12);
449 tmp9 = ixheaacd_add32_sat(tmp9, tmp13);
450 tmp10 = ixheaacd_add32_sat(tmp10, tmp14);
451 tmp11 = ixheaacd_add32_sat(tmp11, tmp15);
452 temp16 = ixheaacd_add32_sat(temp10, tmp4);
453 temp110 = ixheaacd_sub32_sat(temp10, tmp4);
454 temp17 = ixheaacd_add32_sat(temp11, tmp5);
455 temp111 = ixheaacd_sub32_sat(temp11, tmp5);
456
457 temp112 = ixheaacd_sub32_sat(tmp6, temp19);
458 temp114 = ixheaacd_add32_sat(tmp6, temp19);
459 temp113 = ixheaacd_add32_sat(temp18, tmp7);
460 temp115 = ixheaacd_sub32_sat(temp18, tmp7);
461
462 tmp0 = ixheaacd_sub32_sat(temp16, temp114);
463 tmp2 = ixheaacd_add32_sat(temp16, temp114);
464 tmp1 = ixheaacd_add32_sat(temp17, temp115);
465 tmp3 = ixheaacd_sub32_sat(temp17, temp115);
466 tmp4 = ixheaacd_add32_sat(temp110, temp112);
467 tmp6 = ixheaacd_sub32_sat(temp110, temp112);
468 tmp5 = ixheaacd_add32_sat(temp111, temp113);
469 tmp7 = ixheaacd_sub32_sat(temp111, temp113);
470
471 temp110 = ixheaacd_add32_sat(tmp8, tmp10);
472 tmp10 = ixheaacd_sub32_sat(tmp8, tmp10);
473 temp111 = ixheaacd_add32_sat(tmp9, tmp11);
474 tmp11 = ixheaacd_sub32_sat(tmp9, tmp11);
475
476 tmp12 = ixheaacd_add32_sat(temp12, temp14);
477 tmp14 = ixheaacd_sub32_sat(temp12, temp14);
478 tmp13 = ixheaacd_add32_sat(temp13, temp15);
479 tmp15 = ixheaacd_sub32_sat(temp13, temp15);
480
481 temp10 = ixheaacd_add32_sat(tmp2, temp110);
482 temp18 = ixheaacd_sub32_sat(tmp2, temp110);
483 temp11 = ixheaacd_add32_sat(tmp3, temp111);
484 temp19 = ixheaacd_sub32_sat(tmp3, temp111);
485 temp12 = ixheaacd_add32_sat(tmp0, tmp12);
486 temp110 = ixheaacd_sub32_sat(tmp0, tmp12);
487 temp13 = ixheaacd_add32_sat(tmp1, tmp13);
488 temp111 = ixheaacd_sub32_sat(tmp1, tmp13);
489 temp16 = ixheaacd_add32_sat(tmp4, tmp10);
490 temp114 = ixheaacd_sub32_sat(tmp4, tmp10);
491 temp17 = ixheaacd_add32_sat(tmp5, tmp11);
492 temp115 = ixheaacd_sub32_sat(tmp5, tmp11);
493 temp14 = ixheaacd_add32_sat(tmp6, tmp14);
494 temp112 = ixheaacd_sub32_sat(tmp6, tmp14);
495 temp15 = ixheaacd_add32_sat(tmp7, tmp15);
496 temp113 = ixheaacd_sub32_sat(tmp7, tmp15);
497
498 *vec++ = temp30;
499 *vec++ = temp31;
500 *vec++ = ixheaacd_add32_sat(temp10, temp40);
501 *vec++ = ixheaacd_add32_sat(temp11, temp41);
502 *vec++ = temp32;
503 *vec++ = temp33;
504 *vec++ = ixheaacd_add32_sat(temp12, temp42);
505 *vec++ = ixheaacd_add32_sat(temp13, temp43);
506 *vec++ = temp34;
507 *vec++ = temp35;
508 *vec++ = ixheaacd_add32_sat(temp14, temp44);
509 *vec++ = ixheaacd_add32_sat(temp15, temp45);
510 *vec++ = temp36;
511 *vec++ = temp37;
512 *vec++ = ixheaacd_add32_sat(temp16, temp46);
513 *vec++ = ixheaacd_add32_sat(temp17, temp47);
514 *vec++ = temp38;
515 *vec++ = temp39;
516 *vec++ = ixheaacd_add32_sat(temp18, temp48);
517 *vec++ = ixheaacd_add32_sat(temp19, temp49);
518 *vec++ = temp310;
519 *vec++ = temp311;
520 *vec++ = ixheaacd_add32_sat(temp110, temp410);
521 *vec++ = ixheaacd_add32_sat(temp111, temp411);
522 *vec++ = temp312;
523 *vec++ = temp313;
524 *vec++ = ixheaacd_add32_sat(temp112, temp412);
525 *vec++ = ixheaacd_add32_sat(temp113, temp413);
526 *vec++ = temp314;
527 *vec++ = temp315;
528 *vec++ = ixheaacd_add32_sat(temp114, temp414);
529 *vec++ = ixheaacd_add32_sat(temp115, temp415);
530 *vec++ = temp316;
531 *vec++ = temp317;
532 *vec++ = ixheaacd_sub32_sat(temp10, temp40);
533 *vec++ = ixheaacd_sub32_sat(temp11, temp41);
534 *vec++ = temp318;
535 *vec++ = temp319;
536 *vec++ = ixheaacd_sub32_sat(temp12, temp42);
537 *vec++ = ixheaacd_sub32_sat(temp13, temp43);
538 *vec++ = temp320;
539 *vec++ = temp321;
540 *vec++ = ixheaacd_sub32_sat(temp14, temp44);
541 *vec++ = ixheaacd_sub32_sat(temp15, temp45);
542 *vec++ = temp322;
543 *vec++ = temp323;
544 *vec++ = ixheaacd_sub32_sat(temp16, temp46);
545 *vec++ = ixheaacd_sub32_sat(temp17, temp47);
546 *vec++ = temp324;
547 *vec++ = temp325;
548 *vec++ = ixheaacd_sub32_sat(temp18, temp48);
549 *vec++ = ixheaacd_sub32_sat(temp19, temp49);
550 *vec++ = temp326;
551 *vec++ = temp327;
552 *vec++ = ixheaacd_sub32_sat(temp110, temp410);
553 *vec++ = ixheaacd_sub32_sat(temp111, temp411);
554 *vec++ = temp328;
555 *vec++ = temp329;
556 *vec++ = ixheaacd_sub32_sat(temp112, temp412);
557 *vec++ = ixheaacd_sub32_sat(temp113, temp413);
558 *vec++ = temp330;
559 *vec++ = temp331;
560 *vec++ = ixheaacd_sub32_sat(temp114, temp414);
561 *vec++ = ixheaacd_sub32_sat(temp115, temp415);
562 }
563
ixheaacd_cos_mod(WORD32 * subband,ia_mps_dec_qmf_tables_struct * qmf_table_ptr)564 static VOID ixheaacd_cos_mod(WORD32 *subband, ia_mps_dec_qmf_tables_struct *qmf_table_ptr) {
565 WORD32 i, m;
566 WORD16 wim, wre;
567 WORD32 temp_1;
568 const WORD16 *ptr1, *ptr2, *ptr3, *ptr4;
569 WORD32 re1, im1, re2, im2;
570
571 m = WORD_LENGTH;
572 ptr1 = qmf_table_ptr->sbr_sin_twiddle;
573 ptr2 = qmf_table_ptr->sbr_cos_twiddle;
574 ptr3 = qmf_table_ptr->sbr_sin_twiddle + 31;
575 ptr4 = qmf_table_ptr->sbr_cos_twiddle + 31;
576 for (i = 0; i < 16; i++) {
577 temp_1 = (i << 1);
578 re1 = subband[temp_1];
579 im2 = subband[temp_1 + 1];
580 re2 = subband[62 - temp_1];
581 im1 = subband[63 - temp_1];
582
583 wim = *ptr1++;
584 wre = *ptr2++;
585
586 subband[temp_1] = ixheaacd_add32_sat(
587 ixheaacd_mult32x16in32_shl(im1, wim), ixheaacd_mult32x16in32_shl(re1, wre));
588 subband[temp_1 + 1] = ixheaacd_sub32_sat(
589 ixheaacd_mult32x16in32_shl(im1, wre), ixheaacd_mult32x16in32_shl(re1, wim));
590
591 wim = *ptr3--;
592 wre = *ptr4--;
593
594 subband[62 - temp_1] = ixheaacd_add32_sat(
595 ixheaacd_mult32x16in32_shl(im2, wim), ixheaacd_mult32x16in32_shl(re2, wre));
596 subband[63 - temp_1] = ixheaacd_sub32_sat(
597 ixheaacd_mult32x16in32_shl(im2, wre), ixheaacd_mult32x16in32_shl(re2, wim));
598 }
599
600 ixheaacd_fft32(subband, qmf_table_ptr->fft_c);
601
602 ptr1 = qmf_table_ptr->sbr_alt_sin_twiddle;
603 ptr2 = qmf_table_ptr->sbr_alt_sin_twiddle + m;
604 wim = *ptr1++;
605 wre = *ptr2--;
606
607 for (i = 0; i < 16; i++) {
608 temp_1 = (i << 1);
609 re1 = subband[temp_1];
610 im1 = subband[temp_1 + 1];
611 re2 = subband[62 - temp_1];
612 im2 = subband[63 - temp_1];
613
614 subband[temp_1] = ixheaacd_add32_sat(
615 ixheaacd_mult32x16in32_shl(re1, wre), ixheaacd_mult32x16in32_shl(im1, wim));
616 subband[63 - temp_1] = ixheaacd_sub32_sat(
617 ixheaacd_mult32x16in32_shl(re1, wim), ixheaacd_mult32x16in32_shl(im1, wre));
618
619 wim = *ptr1++;
620 wre = *ptr2--;
621
622 subband[62 - temp_1] = ixheaacd_add32_sat(
623 ixheaacd_mult32x16in32_shl(re2, wim), ixheaacd_mult32x16in32_shl(im2, wre));
624 subband[temp_1 + 1] = ixheaacd_sub32_sat(
625 ixheaacd_mult32x16in32_shl(re2, wre), ixheaacd_mult32x16in32_shl(im2, wim));
626 }
627 }
628
ixheaacd_sin_mod(WORD32 * subband,ia_mps_dec_qmf_tables_struct * qmf_table_ptr)629 static VOID ixheaacd_sin_mod(WORD32 *subband, ia_mps_dec_qmf_tables_struct *qmf_table_ptr) {
630 WORD32 i, m;
631 WORD16 wre, wim;
632 WORD32 temp_1;
633 WORD32 re1, im1, re2, im2;
634 const WORD16 *ptr1, *ptr2, *ptr3, *ptr4;
635
636 ptr1 = qmf_table_ptr->sbr_sin_twiddle;
637 ptr2 = qmf_table_ptr->sbr_cos_twiddle;
638 ptr3 = qmf_table_ptr->sbr_sin_twiddle + 31;
639 ptr4 = qmf_table_ptr->sbr_cos_twiddle + 31;
640
641 m = WORD_LENGTH;
642
643 for (i = 0; i < 16; i++) {
644 temp_1 = (i << 1);
645
646 re1 = subband[temp_1];
647 im2 = subband[temp_1 + 1];
648 re2 = subband[62 - temp_1];
649 im1 = subband[63 - temp_1];
650
651 wre = *ptr1++;
652 wim = *ptr2++;
653
654 subband[temp_1 + 1] = ixheaacd_add32_sat(
655 ixheaacd_mult32x16in32_shl(im1, wim), ixheaacd_mult32x16in32_shl(re1, wre));
656 subband[temp_1] = ixheaacd_sub32_sat(
657 ixheaacd_mult32x16in32_shl(im1, wre), ixheaacd_mult32x16in32_shl(re1, wim));
658
659 wre = *ptr3--;
660 wim = *ptr4--;
661
662 subband[63 - temp_1] = ixheaacd_add32_sat(
663 ixheaacd_mult32x16in32_shl(im2, wim), ixheaacd_mult32x16in32_shl(re2, wre));
664 subband[62 - temp_1] = ixheaacd_sub32_sat(
665 ixheaacd_mult32x16in32_shl(im2, wre), ixheaacd_mult32x16in32_shl(re2, wim));
666 }
667
668 ixheaacd_fft32(subband, qmf_table_ptr->fft_c);
669
670 ptr1 = qmf_table_ptr->sbr_alt_sin_twiddle;
671 ptr2 = qmf_table_ptr->sbr_alt_sin_twiddle + m;
672
673 wim = *ptr1++;
674 wre = *ptr2--;
675
676 for (i = 0; i < 16; i++) {
677 temp_1 = (i << 1);
678 re1 = subband[temp_1];
679 im1 = subband[temp_1 + 1];
680 re2 = subband[62 - temp_1];
681 im2 = subband[63 - temp_1];
682
683 subband[63 - temp_1] = -ixheaacd_add32_sat(
684 ixheaacd_mult32x16in32_shl(re1, wre), ixheaacd_mult32x16in32_shl(im1, wim));
685 subband[temp_1] = -ixheaacd_sub32_sat(
686 ixheaacd_mult32x16in32_shl(re1, wim), ixheaacd_mult32x16in32_shl(im1, wre));
687
688 wim = *ptr1++;
689 wre = *ptr2--;
690
691 subband[temp_1 + 1] = -ixheaacd_add32_sat(
692 ixheaacd_mult32x16in32_shl(re2, wim), ixheaacd_mult32x16in32_shl(im2, wre));
693 subband[62 - temp_1] = -ixheaacd_sub32_sat(
694 ixheaacd_mult32x16in32_shl(re2, wre), ixheaacd_mult32x16in32_shl(im2, wim));
695 }
696 }
697
ixheaacd_inverse_modulation(WORD32 * qmf_real,WORD32 * qmf_imag,ia_mps_dec_qmf_tables_struct * qmf_table_ptr)698 static VOID ixheaacd_inverse_modulation(WORD32 *qmf_real, WORD32 *qmf_imag,
699 ia_mps_dec_qmf_tables_struct *qmf_table_ptr) {
700 WORD32 i;
701
702 const WORD16 *ptr1, *ptr2, *ptr3, *ptr4;
703 const WORD16 *fft = qmf_table_ptr->fft_c;
704 WORD16 wre, wim;
705 WORD32 re1, im1, re2, im2;
706 WORD32 re12, im12, re22, im22;
707 WORD32 temp_1;
708
709 ptr1 = qmf_table_ptr->sbr_sin_twiddle;
710 ptr2 = qmf_table_ptr->sbr_cos_twiddle;
711 ptr3 = ptr1 + 31;
712 ptr4 = ptr2 + 31;
713
714 for (i = 0; i < 16; i++) {
715 temp_1 = (i << 1);
716
717 re1 = qmf_real[temp_1];
718 im1 = qmf_real[63 - temp_1];
719
720 wim = *ptr1++;
721 wre = *ptr2++;
722
723 qmf_real[temp_1] = ixheaacd_add32_sat(
724 ixheaacd_mult32x16in32_shl(im1, wim), ixheaacd_mult32x16in32_shl(re1, wre));
725
726 re12 = qmf_imag[temp_1];
727 im12 = qmf_imag[63 - temp_1];
728
729 qmf_imag[temp_1] = ixheaacd_sub32_sat(
730 ixheaacd_mult32x16in32_shl(im12, wim), ixheaacd_mult32x16in32_shl(re12, wre));
731
732 im2 = qmf_real[temp_1 + 1];
733
734 qmf_real[temp_1 + 1] = ixheaacd_sub32_sat(
735 ixheaacd_mult32x16in32_shl(im1, wre), ixheaacd_mult32x16in32_shl(re1, wim));
736
737 im22 = qmf_imag[temp_1 + 1];
738
739 qmf_imag[temp_1 + 1] = ixheaacd_add32_sat(
740 ixheaacd_mult32x16in32_shl(im12, wre), ixheaacd_mult32x16in32_shl(re12, wim));
741
742 wim = *ptr3--;
743 wre = *ptr4--;
744
745 re2 = qmf_real[62 - temp_1];
746
747 qmf_real[62 - temp_1] = ixheaacd_add32_sat(
748 ixheaacd_mult32x16in32_shl(im2, wim), ixheaacd_mult32x16in32_shl(re2, wre));
749
750 re22 = qmf_imag[62 - temp_1];
751
752 qmf_imag[62 - temp_1] = ixheaacd_sub32_sat(
753 ixheaacd_mult32x16in32_shl(im22, wim), ixheaacd_mult32x16in32_shl(re22, wre));
754
755 qmf_real[63 - temp_1] = ixheaacd_sub32_sat(
756 ixheaacd_mult32x16in32_shl(im2, wre), ixheaacd_mult32x16in32_shl(re2, wim));
757 qmf_imag[63 - temp_1] = ixheaacd_add32_sat(
758 ixheaacd_mult32x16in32_shl(im22, wre), ixheaacd_mult32x16in32_shl(re22, wim));
759 }
760
761 ixheaacd_fft32(qmf_real, fft);
762 ixheaacd_fft32(qmf_imag, fft);
763
764 ptr1 = qmf_table_ptr->sbr_alt_sin_twiddle;
765 ptr2 = ptr1 + 32;
766
767 wim = *ptr1++;
768 wre = *ptr2--;
769 for (i = 0; i < 16; i++) {
770 temp_1 = (i << 1);
771 re1 = qmf_real[temp_1];
772 im1 = qmf_real[temp_1 + 1];
773 re12 = qmf_imag[temp_1];
774 im12 = qmf_imag[temp_1 + 1];
775
776 qmf_real[temp_1] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(
777 im12, re1), wre), ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(im1, re12), wim));
778 qmf_imag[temp_1] = ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl((ixheaacd_add32_sat(
779 im12, re1)), wre), ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(im1, re12), wim));
780
781 im2 = qmf_real[63 - temp_1];
782 im22 = qmf_imag[63 - temp_1];
783
784 qmf_real[63 - temp_1] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(
785 im1, re12), wre), ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(im12, re1), wim));
786 qmf_imag[63 - temp_1] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(
787 re1, im12), wim), ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(im1, re12), wre));
788
789 wim = *ptr1++;
790 wre = *ptr2--;
791 re2 = qmf_real[62 - temp_1];
792 re22 = qmf_imag[62 - temp_1];
793
794 qmf_real[temp_1 + 1] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(
795 im2, re22), wim), ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(im22, re2), wre));
796 qmf_imag[temp_1 + 1] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(
797 re2, im22), wre), ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(im2, re22), wim));
798
799 qmf_real[62 - temp_1] = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(
800 im22, re2), wim), ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(im2, re22), wre));
801 qmf_imag[62 - temp_1] = ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(ixheaacd_add32_sat(
802 re2, im22), wim), ixheaacd_mult32x16in32_shl(ixheaacd_sub32_sat(im2, re22), wre));
803 }
804 }
805
ixheaacd_calculate_syn_filt_bank_res64(ia_mps_dec_qmf_syn_filter_bank * syn,WORD32 * sr,WORD32 * si,WORD32 * time_sig,WORD32 channel,WORD32 resolution,WORD32 nr_samples,ia_mps_dec_qmf_tables_struct * qmf_table_ptr)806 VOID ixheaacd_calculate_syn_filt_bank_res64(ia_mps_dec_qmf_syn_filter_bank *syn, WORD32 *sr,
807 WORD32 *si, WORD32 *time_sig, WORD32 channel,
808 WORD32 resolution, WORD32 nr_samples,
809 ia_mps_dec_qmf_tables_struct *qmf_table_ptr) {
810 WORD32 j, k;
811 WORD32 *synth_buf;
812 WORD32 *syn_buf_p1, *syn_buf_p2, *syn_buf_p3;
813 WORD32 val;
814 const WORD32 *p_filter_1, *p_filter_6;
815 const WORD32 *p_filter_2, *p_filter_7;
816 const WORD32 *p_filter_3, *p_filter_8;
817 const WORD32 *p_filter_4, *p_filter_9;
818 const WORD32 *p_filter_5, *p_filter_10;
819
820 WORD32 *p_sr, *p_si;
821
822 WORD32 *sbr_qmf_states_synthesis = syn->sbr_qmf_states_synthesis;
823 synth_buf = &(sbr_qmf_states_synthesis[channel * QMF_FILTER_STATE_SYN_SIZE_MPS]);
824
825 p_sr = sr;
826 p_si = si;
827 for (k = 0; k < nr_samples; k++) {
828 WORD32 *new_samp = p_si;
829 WORD32 *new_samp1, *new_samp2;
830
831 ixheaacd_inverse_modulation(p_sr, p_si, qmf_table_ptr);
832
833 p_filter_1 = syn->p_filter_syn;
834 p_filter_2 = p_filter_1 + 64;
835 p_filter_3 = p_filter_2 + 65;
836 p_filter_4 = p_filter_3 + 65;
837 p_filter_5 = p_filter_4 + 65;
838
839 syn_buf_p1 = &synth_buf[63];
840 val = *(p_sr);
841
842 {
843 WORD32 val1 = *(p_si + 63);
844 syn_buf_p2 = &synth_buf[63];
845
846 *time_sig++ = ixheaacd_add32_sat(syn_buf_p1[512],
847 ixheaacd_mps_mult32_shr_30(*(p_filter_5 + 65), val));
848 syn_buf_p1[512] = ixheaacd_add32_sat(syn_buf_p2[448],
849 ixheaacd_mps_mult32_shr_30(*(p_filter_5 + 64), val1));
850 syn_buf_p2[448] = ixheaacd_add32_sat(syn_buf_p1[384],
851 ixheaacd_mps_mult32_shr_30(*p_filter_5++, val));
852 syn_buf_p1[384] = ixheaacd_add32_sat(syn_buf_p2[320],
853 ixheaacd_mps_mult32_shr_30(*(p_filter_4 + 64), val1));
854 syn_buf_p2[320] = ixheaacd_add32_sat(syn_buf_p1[256],
855 ixheaacd_mps_mult32_shr_30(*p_filter_4++, val));
856 syn_buf_p1[256] = ixheaacd_add32_sat(syn_buf_p2[192],
857 ixheaacd_mps_mult32_shr_30(*(p_filter_3 + 64), val1));
858 syn_buf_p2[192] = ixheaacd_add32_sat(syn_buf_p1[128],
859 ixheaacd_mps_mult32_shr_30(*p_filter_3++, val));
860 syn_buf_p1[128] = ixheaacd_add32_sat(syn_buf_p2[64],
861 ixheaacd_mps_mult32_shr_30(*(p_filter_2 + 64), val1));
862 syn_buf_p2[64] = ixheaacd_add32_sat(syn_buf_p1[0],
863 ixheaacd_mps_mult32_shr_30(*p_filter_2++, val));
864 syn_buf_p1[0] = ixheaacd_mps_mult32_shr_30(*(p_filter_1 + 63), val1);
865 }
866 p_filter_6 = p_filter_1 + 62;
867 p_filter_7 = p_filter_2 + 62;
868 p_filter_8 = p_filter_3 + 62;
869 p_filter_9 = p_filter_4 + 62;
870 p_filter_10 = p_filter_5 + 62;
871 time_sig += 62;
872
873 syn_buf_p2 = synth_buf;
874 syn_buf_p3 = syn_buf_p2;
875 new_samp1 = p_sr + 1;
876 new_samp2 = p_sr + 63;
877 for (j = 0; j < resolution - 1; j++) {
878 *time_sig-- = ixheaacd_add32_sat(syn_buf_p3[512],
879 ixheaacd_mps_mult32_shr_30(*p_filter_6--, (*new_samp2)));
880 syn_buf_p3[512] = ixheaacd_add32_sat(syn_buf_p2[448],
881 ixheaacd_mps_mult32_shr_30(*p_filter_5++, (*new_samp)));
882 syn_buf_p2[448] = ixheaacd_add32_sat(syn_buf_p3[384],
883 ixheaacd_mps_mult32_shr_30(*p_filter_7--, (*new_samp2)));
884 syn_buf_p3[384] = ixheaacd_add32_sat(syn_buf_p2[320],
885 ixheaacd_mps_mult32_shr_30(*p_filter_4++, (*new_samp)));
886 syn_buf_p2[320] = ixheaacd_add32_sat(syn_buf_p3[256],
887 ixheaacd_mps_mult32_shr_30(*p_filter_8--, (*new_samp2)));
888 syn_buf_p3[256] = ixheaacd_add32_sat(syn_buf_p2[192],
889 ixheaacd_mps_mult32_shr_30(*p_filter_3++, (*new_samp)));
890 syn_buf_p2[192] = ixheaacd_add32_sat(syn_buf_p3[128],
891 ixheaacd_mps_mult32_shr_30(*p_filter_9--, (*new_samp2)));
892 syn_buf_p3[128] = ixheaacd_add32_sat(syn_buf_p2[64],
893 ixheaacd_mps_mult32_shr_30(*p_filter_2++, (*new_samp)));
894 syn_buf_p2[64] = ixheaacd_add32_sat(syn_buf_p3[0],
895 ixheaacd_mps_mult32_shr_30(*p_filter_10--, (*new_samp2)));
896 syn_buf_p3[0] = ixheaacd_mps_mult32_shr_30(*p_filter_1++, (*new_samp));
897
898 new_samp++;
899 syn_buf_p2++;
900
901 new_samp1++;
902 new_samp2--;
903 syn_buf_p3++;
904 }
905
906 time_sig += 64;
907
908 p_sr += MAX_HYBRID_BANDS;
909 p_si += MAX_HYBRID_BANDS;
910 }
911 }
912
ixheaacd_calculate_syn_filt_bank(ia_mps_dec_qmf_syn_filter_bank * syn,WORD32 * sr,WORD32 * si,WORD32 * time_sig,WORD32 channel,WORD32 resolution,WORD32 nr_samples,ia_mps_dec_qmf_tables_struct * qmf_table_ptr)913 VOID ixheaacd_calculate_syn_filt_bank(ia_mps_dec_qmf_syn_filter_bank *syn, WORD32 *sr, WORD32 *si,
914 WORD32 *time_sig, WORD32 channel, WORD32 resolution,
915 WORD32 nr_samples,
916 ia_mps_dec_qmf_tables_struct *qmf_table_ptr) {
917 WORD32 j, k;
918 WORD32 *synth_buf;
919 WORD32 *p_sr, *p_si;
920 WORD32 *buf_ptr;
921 WORD32 resx2 = resolution << 1;
922 WORD32 *sbr_qmf_states_synthesis = syn->sbr_qmf_states_synthesis;
923
924 synth_buf = &(sbr_qmf_states_synthesis[channel * QMF_FILTER_STATE_SYN_SIZE_MPS]);
925
926 p_sr = sr;
927 p_si = si;
928 for (k = 0; k < nr_samples; k++) {
929 WORD32 *new_samp = p_si + 63;
930
931 const WORD32 *p_filter_1 = syn->p_filter_syn;
932 const WORD32 *p_filter_2 = p_filter_1 + 65;
933 const WORD32 *p_filter_3 = p_filter_2 + 65;
934 const WORD32 *p_filter_4 = p_filter_3 + 65;
935 const WORD32 *p_filter_5 = p_filter_4 + 65;
936
937 ixheaacd_inverse_modulation(p_sr, p_si, qmf_table_ptr);
938
939 for (j = 0; j < resolution; j++) {
940 synth_buf[j] = ixheaacd_mps_mult32_shr_30(*p_filter_1++, (*new_samp));
941 synth_buf[resx2 + j] = ixheaacd_add32_sat(synth_buf[resx2 + j],
942 ixheaacd_mps_mult32_shr_30(*p_filter_2++, (*new_samp)));
943 synth_buf[resx2 * 2 + j] = ixheaacd_add32_sat(synth_buf[resx2 * 2 + j],
944 ixheaacd_mps_mult32_shr_30(*p_filter_3++, (*new_samp)));
945 synth_buf[resx2 * 3 + j] = ixheaacd_add32_sat(synth_buf[resx2 * 3 + j],
946 ixheaacd_mps_mult32_shr_30(*p_filter_4++, (*new_samp)));
947 synth_buf[resx2 * 4 + j] = ixheaacd_add32_sat(synth_buf[resx2 * 4 + j],
948 ixheaacd_mps_mult32_shr_30(*p_filter_5++, (*new_samp)));
949
950 new_samp--;
951 }
952
953 synth_buf[resx2 - 1] = ixheaacd_add32_sat(synth_buf[resx2 - 1],
954 ixheaacd_mps_mult32_shr_30(*p_filter_1++, *p_sr));
955 synth_buf[resx2 * 2 - 1] = ixheaacd_add32_sat(synth_buf[resx2 * 2 - 1],
956 ixheaacd_mps_mult32_shr_30(*p_filter_2++, *p_sr));
957 synth_buf[3 * resx2 - 1] = ixheaacd_add32_sat(synth_buf[3 * resx2 - 1],
958 ixheaacd_mps_mult32_shr_30(*p_filter_3++, *p_sr));
959 synth_buf[4 * resx2 - 1] = ixheaacd_add32_sat(synth_buf[4 * resx2 - 1],
960 ixheaacd_mps_mult32_shr_30(*p_filter_4++, *p_sr));
961 *time_sig++ = ixheaacd_add32_sat(synth_buf[5 * resx2 - 1],
962 ixheaacd_mps_mult32_shr_30(*p_filter_5++, *p_sr));
963
964 p_filter_1 -= 2;
965 p_filter_2 -= 2;
966 p_filter_3 -= 2;
967 p_filter_4 -= 2;
968 p_filter_5 -= 2;
969
970 new_samp = p_sr + resolution - 1;
971
972 for (j = 0; j < resolution - 1; j++) {
973 synth_buf[resolution + j] = ixheaacd_add32_sat(synth_buf[resolution + j],
974 ixheaacd_mps_mult32_shr_30(*--p_filter_5, (*new_samp)));
975 synth_buf[resolution * (3) + j] =
976 ixheaacd_add32_sat(synth_buf[resolution * (3) + j],
977 ixheaacd_mps_mult32_shr_30(*--p_filter_4, (*new_samp)));
978 synth_buf[resolution * (5) + j] =
979 ixheaacd_add32_sat(synth_buf[resolution * (5) + j],
980 ixheaacd_mps_mult32_shr_30(*--p_filter_3, (*new_samp)));
981 synth_buf[resolution * (7) + j] =
982 ixheaacd_add32_sat(synth_buf[resolution * (7) + j],
983 ixheaacd_mps_mult32_shr_30(*--p_filter_2, (*new_samp)));
984 synth_buf[resolution * (9) + j] =
985 ixheaacd_add32_sat(synth_buf[resolution * (9) + j],
986 ixheaacd_mps_mult32_shr_30(*--p_filter_1, (*new_samp)));
987 new_samp--;
988 }
989
990 buf_ptr = synth_buf + 9 * resolution + resolution - 2;
991 for (j = 0; j < resolution - 1; j++) {
992 *time_sig++ = *buf_ptr--;
993 }
994
995 memmove((synth_buf + resolution), synth_buf, (9 * resolution) * sizeof(WORD32));
996
997 p_sr += MAX_HYBRID_BANDS;
998 p_si += MAX_HYBRID_BANDS;
999 }
1000 }
1001
1002 IA_ERRORCODE
ixheaacd_syn_filt_bank_init(ia_mps_dec_synthesis_interface_handle self,WORD32 resolution)1003 ixheaacd_syn_filt_bank_init(ia_mps_dec_synthesis_interface_handle self, WORD32 resolution) {
1004 switch (resolution) {
1005 case QMF_BANDS_32:
1006 self->syn_filter_bank = ixheaacd_calculate_syn_filt_bank;
1007 break;
1008 case QMF_BANDS_64:
1009 self->syn_filter_bank = ixheaacd_calculate_syn_filt_bank_res64;
1010 break;
1011 case QMF_BANDS_128:
1012 self->syn_filter_bank = ixheaacd_calculate_syn_filt_bank;
1013 break;
1014 default:
1015 return IA_XHEAAC_MPS_DEC_INIT_NONFATAL_INVALID_QMF_BAND;
1016 break;
1017 }
1018 return IA_NO_ERROR;
1019 }
1020
ia_mps_enc_fwd_mod(WORD32 * time_in,WORD32 * r_subband,WORD32 * i_subband,ia_mps_dec_qmf_tables_struct * qmf_table_ptr)1021 static VOID ia_mps_enc_fwd_mod(WORD32 *time_in, WORD32 *r_subband, WORD32 *i_subband,
1022 ia_mps_dec_qmf_tables_struct *qmf_table_ptr) {
1023 WORD32 i;
1024
1025 for (i = 0; i < 64; i++) {
1026 r_subband[i] = time_in[i] - time_in[127 - i];
1027 i_subband[i] = time_in[i] + time_in[127 - i];
1028 }
1029 ixheaacd_cos_mod(r_subband, qmf_table_ptr);
1030 ixheaacd_sin_mod(i_subband, qmf_table_ptr);
1031 }
1032
ixheaacd_calc_ana_filt_bank(ia_heaac_mps_state_struct * pstr_mps_state,WORD16 * time_in,WORD32 * r_analysis,WORD32 * i_analysis,WORD32 channel)1033 VOID ixheaacd_calc_ana_filt_bank(ia_heaac_mps_state_struct *pstr_mps_state, WORD16 *time_in,
1034 WORD32 *r_analysis, WORD32 *i_analysis, WORD32 channel) {
1035 ia_mps_dec_qmf_ana_filter_bank *qmf_bank = &pstr_mps_state->qmf_bank[channel];
1036 ia_mps_dec_qmf_tables_struct *qmf_table_ptr =
1037 pstr_mps_state->ia_mps_dec_mps_table.qmf_table_ptr;
1038 WORD32 i, k, m;
1039
1040 WORD32 *syn_buffer = pstr_mps_state->mps_scratch_mem_v;
1041 WORD64 accu1 = 0, accu2 = 0;
1042 WORD16 flag;
1043 WORD32 *fp1;
1044 WORD32 *fp2;
1045 WORD32 *temp;
1046 const WORD32 *start_co_eff_ptr_l;
1047 const WORD32 *start_co_eff_ptr_r;
1048 const WORD32 *ptr_pf_l, *ptr_pf_r;
1049 WORD32 *qmf_states_curr_pos;
1050 WORD32 offset = 0;
1051 WORD32 n_channels = pstr_mps_state->num_input_channels;
1052 WORD32 nr_samples = pstr_mps_state->time_slots;
1053 WORD32 qmf_bands = pstr_mps_state->qmf_bands;
1054 WORD32 shift = pstr_mps_state->bits_per_sample - 16;
1055 WORD32 gain = pstr_mps_state->clip_protect_gain;
1056
1057 WORD32 *p_ana_real = r_analysis;
1058 WORD32 *p_ana_imag = i_analysis;
1059
1060 WORD32 *p_ana_re, *p_ana_im;
1061
1062 flag = qmf_bank->flag;
1063 if (!flag) {
1064 fp1 = qmf_bank->qmf_states_buffer;
1065 fp2 = qmf_bank->qmf_states_buffer + qmf_bands;
1066 } else {
1067 fp2 = qmf_bank->qmf_states_buffer;
1068 fp1 = qmf_bank->qmf_states_buffer + qmf_bands;
1069 }
1070
1071 qmf_bank->qmf_states_curr_pos =
1072 ((WORD32 *)(qmf_bank->qmf_states_buffer) + (qmf_bank->offset * qmf_bands));
1073
1074 offset = qmf_bank->offset;
1075 start_co_eff_ptr_l = qmf_bank->ref_co_eff_ptr_l + qmf_bank->offset_l;
1076 start_co_eff_ptr_r = qmf_bank->ref_co_eff_ptr_r - qmf_bank->offset_r;
1077
1078 for (i = 0; i < nr_samples; i++) {
1079 const WORD16 *pcoz = qmf_table_ptr->ia_qmf_anl_addt_cos,
1080 *psin = qmf_table_ptr->ia_qmf_anl_addt_sin;
1081 qmf_states_curr_pos = qmf_bank->qmf_states_curr_pos;
1082
1083 p_ana_re = p_ana_real;
1084 p_ana_im = p_ana_imag;
1085
1086 temp = fp1;
1087 fp1 = fp2;
1088 fp2 = temp;
1089
1090 if (flag) {
1091 start_co_eff_ptr_l--;
1092
1093 if (start_co_eff_ptr_l == qmf_bank->ref_co_eff_ptr_l) start_co_eff_ptr_l += 5;
1094 } else {
1095 start_co_eff_ptr_r++;
1096 if (start_co_eff_ptr_r == qmf_bank->ref_co_eff_ptr_r) start_co_eff_ptr_r -= 5;
1097 }
1098
1099 flag++;
1100 if ((flag & ONE_BIT_MASK) == 0) flag = 0;
1101
1102 if (shift == 0) {
1103 for (k = 0; k < qmf_bands; k++) {
1104 qmf_states_curr_pos[k] = ixheaacd_mps_mult32_shr_15(
1105 (WORD32)time_in[n_channels * (i * qmf_bands + k) + channel], gain);
1106 }
1107 } else {
1108 for (k = 0; k < qmf_bands; k++) {
1109 WORD32 temp;
1110 temp = ixheaacd_mps_mult32_shr_15(
1111 (WORD32)time_in[n_channels * (i * qmf_bands + k) + channel], gain);
1112
1113 qmf_states_curr_pos[k] = temp >> shift;
1114 }
1115 }
1116
1117 ptr_pf_l = start_co_eff_ptr_l;
1118 ptr_pf_r = start_co_eff_ptr_r;
1119
1120 for (k = 0; k < qmf_bands; k++) {
1121 {
1122 accu1 = (WORD64)((WORD64)ptr_pf_l[0] * (WORD64)fp1[k]);
1123 accu1 += (WORD64)((WORD64)ptr_pf_l[1] * (WORD64)fp1[128 + k]);
1124 accu1 += (WORD64)((WORD64)ptr_pf_l[2] * (WORD64)fp1[256 + k]);
1125 accu1 += (WORD64)((WORD64)ptr_pf_l[3] * (WORD64)fp1[384 + k]);
1126 accu1 += (WORD64)((WORD64)ptr_pf_l[4] * (WORD64)fp1[512 + k]);
1127
1128 accu2 = (WORD64)((WORD64)ptr_pf_r[-1] * (WORD64)fp2[k]);
1129 accu2 += (WORD64)((WORD64)ptr_pf_r[-2] * (WORD64)fp2[128 + k]);
1130 accu2 += (WORD64)((WORD64)ptr_pf_r[-3] * (WORD64)fp2[256 + k]);
1131 accu2 += (WORD64)((WORD64)ptr_pf_r[-4] * (WORD64)fp2[384 + k]);
1132 accu2 += (WORD64)((WORD64)ptr_pf_r[-5] * (WORD64)fp2[512 + k]);
1133 }
1134 syn_buffer[(qmf_bands << 1) - 1 - k] = (WORD32)((WORD64)accu1 >> 21);
1135 syn_buffer[qmf_bands - 1 - k] = (WORD32)((WORD64)accu2 >> 21);
1136 ptr_pf_l += 10;
1137 ptr_pf_r -= 10;
1138 }
1139
1140 ia_mps_enc_fwd_mod(syn_buffer, p_ana_re, p_ana_im, qmf_table_ptr);
1141
1142 for (m = 0; m < (qmf_bands >> 1); m++) {
1143 WORD32 a_cos, b_cos, a_sin, b_sin;
1144 WORD32 a_cos1, b_cos1, a_sin1, b_sin1;
1145
1146 WORD16 coz = *pcoz++, sin = *psin++;
1147
1148 a_cos = ixheaacd_mult32x16in32(p_ana_re[m], coz);
1149 b_sin = ixheaacd_mult32x16in32(p_ana_im[m], sin);
1150 b_cos = ixheaacd_mult32x16in32(p_ana_im[m], coz);
1151 a_sin = ixheaacd_mult32x16in32(p_ana_re[m], sin);
1152
1153 p_ana_re[m] = ((a_cos + b_sin) << 1);
1154 p_ana_im[m] = ((b_cos - a_sin) << 1);
1155
1156 a_cos1 = ixheaacd_mult32x16in32(p_ana_re[qmf_bands - 1 - m], coz);
1157 b_sin1 = ixheaacd_mult32x16in32(p_ana_im[qmf_bands - 1 - m], sin);
1158
1159 a_sin1 = ixheaacd_mult32x16in32(p_ana_re[qmf_bands - 1 - m], sin);
1160 p_ana_re[qmf_bands - 1 - m] = ((-a_cos1 + b_sin1) << 1);
1161 b_cos1 = ixheaacd_mult32x16in32(p_ana_im[qmf_bands - 1 - m], coz);
1162
1163 p_ana_im[qmf_bands - 1 - m] = ((-b_cos1 - a_sin1) << 1);
1164 }
1165
1166 qmf_bank->qmf_states_curr_pos = qmf_bank->qmf_states_curr_pos + qmf_bands;
1167 offset++;
1168 if (offset == 10) {
1169 offset = 0;
1170 qmf_bank->qmf_states_curr_pos = qmf_bank->qmf_states_buffer;
1171 }
1172
1173 p_ana_real += MAX_NUM_QMF_BANDS;
1174 p_ana_imag += MAX_NUM_QMF_BANDS;
1175 }
1176
1177 qmf_bank->offset_l = (WORD32)(start_co_eff_ptr_l - qmf_bank->ref_co_eff_ptr_l);
1178 qmf_bank->offset_r = (WORD32)(qmf_bank->ref_co_eff_ptr_r - start_co_eff_ptr_r);
1179
1180 qmf_bank->flag = flag;
1181 qmf_bank->offset = offset;
1182 }
1183