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_error_standards.h"
38 #include "ixheaacd_mps_polyphase.h"
39 #include "ixheaacd_config.h"
40 #include "ixheaacd_qmf_dec.h"
41 #include "ixheaacd_mps_dec.h"
42 #include "ixheaacd_mps_bitdec.h"
43 #include "ixheaacd_mps_macro_def.h"
44 #include "ixheaacd_mps_basic_op.h"
45 #include "ixheaacd_mps_blind.h"
46
ixheaacd_get_sampling_freq_idx(WORD32 sampling_freq,ia_mps_dec_bitdec_tables_struct * ixheaacd_mps_dec_bitdec_tables,WORD32 * idx)47 static IA_ERRORCODE ixheaacd_get_sampling_freq_idx(
48 WORD32 sampling_freq, ia_mps_dec_bitdec_tables_struct *ixheaacd_mps_dec_bitdec_tables,
49 WORD32 *idx) {
50 WORD32 i;
51 for (i = 0; i < 13; i++) {
52 if (ixheaacd_mps_dec_bitdec_tables->sampling_freq_table[i] == sampling_freq) {
53 *idx = i;
54 return IA_NO_ERROR;
55 }
56 }
57 *idx = 3;
58 return IA_XHEAAC_DEC_CONFIG_FATAL_INVALID_SAMPLE_RATE;
59 }
60
ixheaacd_init_blind(ia_heaac_mps_state_struct * pstr_mps_state)61 VOID ixheaacd_init_blind(ia_heaac_mps_state_struct *pstr_mps_state) {
62 ia_mps_dec_blind_decoder_struct *blind = pstr_mps_state->mps_persistent_mem.blind_decoder;
63 ia_mps_dec_blind_tables_struct *p_blind_table =
64 pstr_mps_state->ia_mps_dec_mps_table.blind_table_ptr;
65 ia_mps_dec_auxilary_struct *p_aux_struct = pstr_mps_state->aux_struct;
66 WORD32 temp_1, temp_2;
67 WORD32 q_64, q_32, q_16, q_8, q_4, q_2;
68 WORD32 r_64, r_32, r_16, r_8, r_4, r_2;
69 WORD32 i;
70 WORD32 qmf_bands = pstr_mps_state->qmf_bands;
71
72 ixheaacd_get_sampling_freq_idx(pstr_mps_state->sampling_freq,
73 pstr_mps_state->ia_mps_dec_mps_table.bitdec_table_ptr, &temp_1);
74 if (pstr_mps_state->qmf_bands == 128)
75 blind->filter_coeff = p_blind_table->exp_128[temp_1];
76 else {
77 q_64 = (WORD32)(qmf_bands >> 6) ? p_blind_table->exp_64[temp_1] : ONE_IN_Q15;
78 r_64 = (WORD32)(qmf_bands & SIX_BIT_MASK);
79
80 q_32 = (WORD32)(r_64 >> 5) ? p_blind_table->exp_32[temp_1] : ONE_IN_Q15;
81 r_32 = (WORD32)(r_64 & FIVE_BIT_MASK);
82
83 q_16 = (WORD32)(r_32 >> 4) ? p_blind_table->exp_16[temp_1] : ONE_IN_Q15;
84 r_16 = (WORD32)(r_32 & FOUR_BIT_MASK);
85
86 q_8 = (WORD32)(r_16 >> 3) ? p_blind_table->exp_8[temp_1] : ONE_IN_Q15;
87 r_8 = (WORD32)(r_16 & THREE_BIT_MASK);
88
89 q_4 = (WORD32)(r_8 >> 2) ? p_blind_table->exp_4[temp_1] : ONE_IN_Q15;
90 r_4 = (WORD32)(r_8 & TWO_BIT_MASK);
91
92 q_2 = (WORD32)(r_4 >> 1) ? p_blind_table->exp_2[temp_1] : ONE_IN_Q15;
93 r_2 = (WORD32)(r_4 & ONE_BIT_MASK) ? p_blind_table->exp_1[temp_1] : ONE_IN_Q15;
94
95 temp_1 = ixheaacd_mps_mult32_shr_15(ixheaacd_mps_mult32_shr_15(q_64, q_32), q_16);
96 temp_2 = ixheaacd_mps_mult32_shr_15(ixheaacd_mps_mult32_shr_15(q_8, q_4), q_2);
97 blind->filter_coeff =
98 ixheaacd_mps_mult32_shr_15(ixheaacd_mps_mult32_shr_15(temp_1, temp_2), r_2);
99 }
100 for (i = 0; i < MAX_PARAMETER_BANDS; i++) {
101 blind->excitation[0][i] = ABS_THR_FIX;
102 blind->excitation[1][i] = ABS_THR_FIX;
103 blind->excitation[2][i] = ABS_THR_FIX;
104
105 blind->q_excitation[0][i] = 15;
106 blind->q_excitation[1][i] = 15;
107 blind->q_excitation[2][i] = 15;
108 }
109
110 memset(p_aux_struct->temp_shape_enable_channel_stp, 0,
111 MAX_OUTPUT_CHANNELS_MPS * sizeof(p_aux_struct->temp_shape_enable_channel_stp[0]));
112 memset(p_aux_struct->temp_shape_enable_channel_ges, 0,
113 MAX_OUTPUT_CHANNELS_MPS * sizeof(p_aux_struct->temp_shape_enable_channel_ges[0]));
114 }
115
ixheaacd_signal_2_parameters(ia_heaac_mps_state_struct * pstr_mps_state,WORD32 ps)116 static VOID ixheaacd_signal_2_parameters(ia_heaac_mps_state_struct *pstr_mps_state, WORD32 ps) {
117 ia_mps_dec_blind_decoder_struct *blind = pstr_mps_state->mps_persistent_mem.blind_decoder;
118 ia_mps_dec_blind_tables_struct *p_blind_table =
119 pstr_mps_state->ia_mps_dec_mps_table.blind_table_ptr;
120 ia_mps_dec_auxilary_struct *p_aux_struct = pstr_mps_state->aux_struct;
121
122 WORD32 cld_index;
123 WORD32 icc_index;
124 WORD32 mesh[2][2];
125 WORD32 pb;
126 WORD32 *dequant_cld;
127 WORD32 *dequant_icc;
128 WORD32 *dequant_cpc;
129 WORD32 cld;
130 WORD32 icc;
131 WORD16 q_icc;
132 WORD32 cld_delta;
133 WORD32 icc_delta;
134 WORD16 q_icc_delta;
135 WORD32 temp_1;
136 WORD16 qtemp1, qtemp;
137 const WORD32 *sqrt_tab = pstr_mps_state->ia_mps_dec_mps_table.common_table_ptr->sqrt_tab;
138
139 WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands;
140
141 ixheaacd_get_dequant_tables(&dequant_cld, &dequant_icc, &dequant_cpc,
142 pstr_mps_state->ia_mps_dec_mps_table.bitdec_table_ptr);
143
144 for (pb = 0; pb < num_parameter_bands; pb++) {
145 temp_1 = ixheaacd_mps_div_32(blind->excitation[0][pb], blind->excitation[1][pb], &qtemp1);
146 qtemp1 = qtemp1 + blind->q_excitation[0][pb] - blind->q_excitation[1][pb];
147 cld = 10 * ixheaacd_mps_log10(temp_1, qtemp1);
148
149 qtemp1 = blind->q_excitation[0][pb];
150 temp_1 = ixheaacd_mps_mult32(blind->excitation[0][pb], blind->excitation[1][pb], &qtemp1,
151 blind->q_excitation[1][pb]);
152 temp_1 = ixheaacd_mps_sqrt(temp_1, &qtemp1, sqrt_tab);
153 icc = ixheaacd_mps_div_32(blind->excitation[2][pb], temp_1, &q_icc);
154 q_icc = q_icc + blind->q_excitation[2][pb] - qtemp1;
155
156 if (abs(cld) > THIRTY_IN_Q16)
157 cld_delta = THIRTY_IN_Q16;
158 else
159 cld_delta = ixheaacd_abs32(cld);
160
161 q_icc_delta = q_icc;
162 icc_delta = ixheaacd_mps_add32(icc, ONE_IN_Q15, &q_icc_delta, 15);
163 icc_delta = ixheaacd_mps_mult32(icc_delta, 10, &q_icc_delta, 0);
164
165 temp_1 = cld_delta >> 16;
166 if (temp_1 > 29)
167 cld_index = 29;
168 else
169 cld_index = temp_1;
170
171 temp_1 = icc_delta >> q_icc_delta;
172 if (temp_1 > 19)
173 icc_index = 19;
174 else
175 icc_index = temp_1;
176
177 cld_delta -= (cld_index << 16);
178 icc_delta -= (icc_index << q_icc_delta);
179
180 mesh[0][0] = p_blind_table->mesh_table.blind_cld_mesh[cld_index][icc_index] + 15;
181 mesh[0][1] = p_blind_table->mesh_table.blind_cld_mesh[cld_index][icc_index + 1] + 15;
182 mesh[1][0] = p_blind_table->mesh_table.blind_cld_mesh[cld_index + 1][icc_index] + 15;
183 mesh[1][1] = p_blind_table->mesh_table.blind_cld_mesh[cld_index + 1][icc_index + 1] + 15;
184
185 qtemp1 = q_icc_delta;
186 temp_1 = ixheaacd_mps_mult32(icc_delta, (mesh[0][1] - mesh[0][0]), &qtemp1, 0);
187 qtemp = 15;
188 p_aux_struct->ott_cld[0][ps][pb] =
189 ixheaacd_mps_add32((mesh[0][0] << 15), temp_1, &qtemp, qtemp1);
190 qtemp1 = 16;
191 temp_1 = ixheaacd_mps_mult32(cld_delta, (mesh[1][0] - mesh[0][0]), &qtemp1, 0);
192 p_aux_struct->ott_cld[0][ps][pb] =
193 ixheaacd_mps_add32(p_aux_struct->ott_cld[0][ps][pb], temp_1, &qtemp, qtemp1);
194 qtemp1 = q_icc_delta;
195 temp_1 = ixheaacd_mps_mult32(icc_delta, cld_delta, &qtemp1, 16);
196 temp_1 = ixheaacd_mps_mult32(temp_1, (mesh[1][1] - mesh[0][1] - mesh[1][0] + mesh[0][0]),
197 &qtemp1, 0);
198 p_aux_struct->ott_cld[0][ps][pb] =
199 ixheaacd_mps_add32(p_aux_struct->ott_cld[0][ps][pb], temp_1, &qtemp, qtemp1);
200
201 p_aux_struct->ott_cld[0][ps][pb] =
202 ixheaacd_mps_add32(p_aux_struct->ott_cld[0][ps][pb], ONE_IN_Q14, &qtemp, 15);
203 p_aux_struct->ott_cld[0][ps][pb] = dequant_cld[((p_aux_struct->ott_cld[0][ps][pb]) >> qtemp)];
204
205 mesh[0][0] = p_blind_table->mesh_table.blind_icc_mesh[cld_index][icc_index];
206 mesh[0][1] = p_blind_table->mesh_table.blind_icc_mesh[cld_index][icc_index + 1];
207 mesh[1][0] = p_blind_table->mesh_table.blind_icc_mesh[cld_index + 1][icc_index];
208 mesh[1][1] = p_blind_table->mesh_table.blind_icc_mesh[cld_index + 1][icc_index + 1];
209
210 qtemp1 = q_icc_delta;
211 temp_1 = ixheaacd_mps_mult32(icc_delta, (mesh[0][1] - mesh[0][0]), &qtemp1, 0);
212 qtemp = 15;
213 p_aux_struct->ott_icc[0][ps][pb] =
214 ixheaacd_mps_add32((mesh[0][0] << 15), temp_1, &qtemp, qtemp1);
215 qtemp1 = 16;
216 temp_1 = ixheaacd_mps_mult32(cld_delta, (mesh[1][0] - mesh[0][0]), &qtemp1, 0);
217 p_aux_struct->ott_icc[0][ps][pb] =
218 ixheaacd_mps_add32(p_aux_struct->ott_icc[0][ps][pb], temp_1, &qtemp, qtemp1);
219 qtemp1 = q_icc_delta;
220 temp_1 = ixheaacd_mps_mult32(icc_delta, cld_delta, &qtemp1, 16);
221 temp_1 = ixheaacd_mps_mult32(temp_1, (mesh[1][1] - mesh[0][1] - mesh[1][0] + mesh[0][0]),
222 &qtemp1, 0);
223 p_aux_struct->ott_icc[0][ps][pb] =
224 ixheaacd_mps_add32(p_aux_struct->ott_icc[0][ps][pb], temp_1, &qtemp, qtemp1);
225
226 p_aux_struct->ott_icc[0][ps][pb] =
227 ixheaacd_mps_add32(p_aux_struct->ott_icc[0][ps][pb], ONE_IN_Q14, &qtemp, 15);
228 p_aux_struct->ott_icc[0][ps][pb] = dequant_icc[((p_aux_struct->ott_icc[0][ps][pb]) >> qtemp)];
229
230 mesh[0][0] = p_blind_table->mesh_table.blind_cpc_1_mesh[cld_index][icc_index] + 20;
231 mesh[0][1] = p_blind_table->mesh_table.blind_cpc_1_mesh[cld_index][icc_index + 1] + 20;
232 mesh[1][0] = p_blind_table->mesh_table.blind_cpc_1_mesh[cld_index + 1][icc_index] + 20;
233 mesh[1][1] = p_blind_table->mesh_table.blind_cpc_1_mesh[cld_index + 1][icc_index + 1] + 20;
234
235 qtemp1 = q_icc_delta;
236 temp_1 = ixheaacd_mps_mult32(icc_delta, (mesh[0][1] - mesh[0][0]), &qtemp1, 0);
237 qtemp = 15;
238 p_aux_struct->ttt_cpc_1[0][ps][pb] =
239 ixheaacd_mps_add32((mesh[0][0] << 15), temp_1, &qtemp, qtemp1);
240 qtemp1 = 16;
241 temp_1 = ixheaacd_mps_mult32(cld_delta, (mesh[1][0] - mesh[0][0]), &qtemp1, 0);
242 p_aux_struct->ttt_cpc_1[0][ps][pb] =
243 ixheaacd_mps_add32(p_aux_struct->ttt_cpc_1[0][ps][pb], temp_1, &qtemp, qtemp1);
244 qtemp1 = q_icc_delta;
245 temp_1 = ixheaacd_mps_mult32(icc_delta, cld_delta, &qtemp1, 16);
246 temp_1 = ixheaacd_mps_mult32(temp_1, (mesh[1][1] - mesh[0][1] - mesh[1][0] + mesh[0][0]),
247 &qtemp1, 0);
248 p_aux_struct->ttt_cpc_1[0][ps][pb] =
249 ixheaacd_mps_add32(p_aux_struct->ttt_cpc_1[0][ps][pb], temp_1, &qtemp, qtemp1);
250
251 p_aux_struct->ttt_cpc_1[0][ps][pb] =
252 ixheaacd_mps_add32(p_aux_struct->ttt_cpc_1[0][ps][pb], ONE_IN_Q14, &qtemp, 15);
253 p_aux_struct->ttt_cpc_1[0][ps][pb] =
254 dequant_cpc[((p_aux_struct->ttt_cpc_1[0][ps][pb]) >> qtemp)];
255
256 mesh[0][0] = p_blind_table->mesh_table.blind_cpc_2_mesh[cld_index][icc_index] + 20;
257 mesh[0][1] = p_blind_table->mesh_table.blind_cpc_2_mesh[cld_index][icc_index + 1] + 20;
258 mesh[1][0] = p_blind_table->mesh_table.blind_cpc_2_mesh[cld_index + 1][icc_index] + 20;
259 mesh[1][1] = p_blind_table->mesh_table.blind_cpc_2_mesh[cld_index + 1][icc_index + 1] + 20;
260
261 qtemp1 = q_icc_delta;
262 temp_1 = ixheaacd_mps_mult32(icc_delta, (mesh[0][1] - mesh[0][0]), &qtemp1, 0);
263 qtemp = 15;
264 p_aux_struct->ttt_cpc_2[0][ps][pb] =
265 ixheaacd_mps_add32((mesh[0][0] < 15), temp_1, &qtemp, qtemp1);
266 qtemp1 = 16;
267 temp_1 = ixheaacd_mps_mult32(cld_delta, (mesh[1][0] - mesh[0][0]), &qtemp1, 0);
268 p_aux_struct->ttt_cpc_2[0][ps][pb] =
269 ixheaacd_mps_add32(p_aux_struct->ttt_cpc_2[0][ps][pb], temp_1, &qtemp, qtemp1);
270 qtemp1 = q_icc_delta;
271 temp_1 = ixheaacd_mps_mult32(icc_delta, cld_delta, &qtemp1, 16);
272 temp_1 = ixheaacd_mps_mult32(temp_1, (mesh[1][1] - mesh[0][1] - mesh[1][0] + mesh[0][0]),
273 &qtemp1, 0);
274 p_aux_struct->ttt_cpc_2[0][ps][pb] =
275 ixheaacd_mps_add32(p_aux_struct->ttt_cpc_2[0][ps][pb], temp_1, &qtemp, qtemp1);
276
277 p_aux_struct->ttt_cpc_2[0][ps][pb] =
278 ixheaacd_mps_add32(p_aux_struct->ttt_cpc_2[0][ps][pb], ONE_IN_Q14, &qtemp, 15);
279 p_aux_struct->ttt_cpc_2[0][ps][pb] =
280 dequant_cpc[((p_aux_struct->ttt_cpc_2[0][ps][pb]) >> qtemp)];
281
282 if (cld < 0) {
283 cld = p_aux_struct->ttt_cpc_2[0][ps][pb];
284 p_aux_struct->ttt_cpc_2[0][ps][pb] = p_aux_struct->ttt_cpc_1[0][ps][pb];
285 p_aux_struct->ttt_cpc_1[0][ps][pb] = cld;
286 }
287 }
288 }
289
ixheaacd_update_down_mix_state(ia_heaac_mps_state_struct * pstr_mps_state,WORD32 offset)290 static VOID ixheaacd_update_down_mix_state(ia_heaac_mps_state_struct *pstr_mps_state,
291 WORD32 offset) {
292 ia_mps_dec_blind_decoder_struct *blind = pstr_mps_state->mps_persistent_mem.blind_decoder;
293 WORD32 ts;
294 WORD32 hb;
295 WORD32 pb;
296 WORD32 *excitation_0, *excitation_1, *excitation_2;
297 WORD16 *q_excitation_0, *q_excitation_1, *q_excitation_2;
298 WORD32 temp_1, temp_2;
299 WORD16 qtemp1, qtemp2;
300 WORD32 *p_x_real, *p_x_imag;
301 WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands;
302 WORD32 hybrid_bands = pstr_mps_state->hybrid_bands;
303 excitation_0 = pstr_mps_state->mps_scratch_mem_v;
304 q_excitation_0 = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX2;
305 excitation_1 = excitation_0 + PARAMETER_BANDSX1_5;
306 q_excitation_1 = q_excitation_0 + PARAMETER_BANDSX3;
307 excitation_2 = excitation_1 + PARAMETER_BANDSX1_5;
308 q_excitation_2 = q_excitation_1 + PARAMETER_BANDSX3;
309
310 p_x_real = &pstr_mps_state->array_struct->x_real[offset * MAX_HYBRID_BANDS];
311 p_x_imag = &pstr_mps_state->array_struct->x_imag[offset * MAX_HYBRID_BANDS];
312 for (ts = 0; ts < HOP_SLOTS; ts++) {
313 WORD32 *x_real_0 = p_x_real;
314 WORD32 *x_imag_0 = p_x_imag;
315
316 WORD32 *x_real_1 = p_x_real + TSXHB;
317 WORD32 *x_imag_1 = p_x_imag + TSXHB;
318
319 for (pb = 0; pb < num_parameter_bands; pb++) {
320 excitation_0[pb] = ABS_THR_FIX;
321 excitation_1[pb] = ABS_THR_FIX;
322 excitation_2[pb] = ABS_THR_FIX;
323
324 q_excitation_0[pb] = 15;
325 q_excitation_1[pb] = 15;
326 q_excitation_2[pb] = 15;
327 }
328
329 for (hb = 0; hb < hybrid_bands; hb++) {
330 WORD64 temp;
331 pb = (WORD32)pstr_mps_state->kernels[hb];
332
333 temp =
334 (WORD64)((WORD64)*x_real_0 * (WORD64)*x_real_0 + (WORD64)*x_imag_0 * (WORD64)*x_imag_0);
335 temp >>= 10;
336 temp_1 = (WORD32)temp;
337 qtemp1 = 10;
338 excitation_0[pb] =
339 ixheaacd_mps_add32(excitation_0[pb], temp_1, &(q_excitation_0[pb]), qtemp1);
340
341 temp =
342 (WORD64)((WORD64)*x_real_1 * (WORD64)*x_real_1 + (WORD64)*x_imag_1 * (WORD64)*x_imag_1);
343 temp >>= 10;
344 temp_1 = (WORD32)temp;
345 qtemp1 = 10;
346 excitation_1[pb] =
347 ixheaacd_mps_add32(excitation_1[pb], temp_1, &(q_excitation_1[pb]), qtemp1);
348
349 temp =
350 (WORD64)((WORD64)*x_real_0 * (WORD64)*x_real_1 + (WORD64)*x_imag_0 * (WORD64)*x_imag_1);
351 temp >>= 10;
352 temp_1 = (WORD32)temp;
353 qtemp1 = 10;
354 excitation_2[pb] =
355 ixheaacd_mps_add32(excitation_2[pb], temp_1, &(q_excitation_2[pb]), qtemp1);
356
357 x_real_0++;
358 x_imag_0++;
359 x_real_1++;
360 x_imag_1++;
361 }
362
363 for (pb = 0; pb < num_parameter_bands; pb++) {
364 blind->excitation[0][pb] =
365 ixheaacd_mps_mult32_shr_15(blind->excitation[0][pb], blind->filter_coeff);
366 blind->excitation[1][pb] =
367 ixheaacd_mps_mult32_shr_15(blind->excitation[1][pb], blind->filter_coeff);
368 blind->excitation[2][pb] =
369 ixheaacd_mps_mult32_shr_15(blind->excitation[2][pb], blind->filter_coeff);
370
371 temp_1 = ONE_IN_Q15 - blind->filter_coeff;
372
373 qtemp2 = *q_excitation_0++;
374 temp_2 = ixheaacd_mps_mult32_shr_15(temp_1, *excitation_0);
375 excitation_0++;
376
377 blind->excitation[0][pb] = ixheaacd_mps_add32(blind->excitation[0][pb], temp_2,
378 &(blind->q_excitation[0][pb]), qtemp2);
379
380 qtemp2 = *q_excitation_1++;
381 temp_2 = ixheaacd_mps_mult32_shr_15(temp_1, *excitation_1);
382 excitation_1++;
383
384 blind->excitation[1][pb] = ixheaacd_mps_add32(blind->excitation[1][pb], temp_2,
385 &(blind->q_excitation[1][pb]), qtemp2);
386
387 qtemp2 = *q_excitation_2++;
388 temp_2 = ixheaacd_mps_mult32_shr_15(temp_1, *excitation_2);
389 excitation_2++;
390
391 blind->excitation[2][pb] = ixheaacd_mps_add32(blind->excitation[2][pb], temp_2,
392 &(blind->q_excitation[2][pb]), qtemp2);
393 }
394 excitation_0[pb] -= num_parameter_bands;
395 excitation_1[pb] -= num_parameter_bands;
396 excitation_2[pb] -= num_parameter_bands;
397
398 q_excitation_0[pb] -= num_parameter_bands;
399 q_excitation_1[pb] -= num_parameter_bands;
400 q_excitation_2[pb] -= num_parameter_bands;
401
402 p_x_real += MAX_HYBRID_BANDS;
403 p_x_imag += MAX_HYBRID_BANDS;
404 }
405 }
406
ixheaacd_apply_blind(ia_heaac_mps_state_struct * pstr_mps_state)407 VOID ixheaacd_apply_blind(ia_heaac_mps_state_struct *pstr_mps_state) {
408 ia_mps_dec_spatial_bs_frame_struct *frame = pstr_mps_state->bs_frame;
409 WORD32 ts;
410 WORD32 ps;
411 WORD32 time_slots = pstr_mps_state->time_slots;
412 WORD32 *param_slot = pstr_mps_state->aux_struct->param_slot;
413
414 for (ts = 0, ps = 0; ts < time_slots; ts += HOP_SLOTS, ps++) {
415 param_slot[ps] = ts + HOP_SLOTS - 1;
416
417 ixheaacd_signal_2_parameters(pstr_mps_state, ps);
418 ixheaacd_update_down_mix_state(pstr_mps_state, ts);
419 }
420
421 pstr_mps_state->num_parameter_sets_prev = ps;
422 pstr_mps_state->num_parameter_sets = ps;
423 frame->bs_independency_flag = 0;
424 pstr_mps_state->aux_struct->num_ott_bands[0] = pstr_mps_state->num_parameter_bands;
425
426 return;
427 }
428