1 /******************************************************************************
2 * *
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #include <math.h>
21 #include <string.h>
22
23 #include <assert.h>
24 #include "ixheaacd_type_def.h"
25 #include "ixheaacd_bitbuffer.h"
26 #include "ixheaacd_common_rom.h"
27 #include "ixheaacd_sbrdecsettings.h"
28 #include "ixheaacd_sbr_scale.h"
29 #include "ixheaacd_env_extr_part.h"
30 #include "ixheaacd_sbr_rom.h"
31 #include "ixheaacd_hybrid.h"
32 #include "ixheaacd_ps_dec.h"
33 #include "ixheaacd_config.h"
34 #include "ixheaacd_qmf_dec.h"
35 #include "ixheaacd_mps_polyphase.h"
36 #include "ixheaacd_constants.h"
37 #include "ixheaacd_mps_struct_def.h"
38 #include "ixheaacd_mps_res_rom.h"
39 #include "ixheaacd_mps_aac_struct.h"
40 #include "ixheaacd_mps_dec.h"
41
42 #define ONE_IN_Q28 (268435456)
43 #define PI_BY_8_Q28 (105414352)
44 #define P_PI 3.1415926535897932
45 #define PI_IN_Q28 843314880
46 #define MULT(a, b) (a * b)
47 #define Q28_FLOAT_VAL ((FLOAT32)(1 << 28))
48 #define ONE_BY_Q28_FLOAT_VAL (1.0f / Q28_FLOAT_VAL)
49
50 extern const WORD32 ixheaacd_atan_table_Q28[16][8][31];
51 extern const WORD32 ixheaacd_ipd_de_quant_table_q28[16];
52
53 extern const FLOAT32 ixheaacd_im_weight[16][8][31];
54 extern const FLOAT32 ixheaacd_re_weight[16][8][31];
55 extern const FLOAT32 ixheaacd_beta[16][8][31];
56 extern const FLOAT32 ixheaacd_weight[16][8][31];
57 extern const FLOAT32 ixheaacd_c_l_table[31];
58 extern const FLOAT32 ixheaacd_sin_table[8][31];
59 extern const FLOAT32 ixheaacd_cos_table[8][31];
60
61 extern const WORD32 ixheaacd_mps_gain_set_indx[29];
62
ixheaacd_mps_phase_wraping(WORD32 phase)63 static WORD32 ixheaacd_mps_phase_wraping(WORD32 phase) {
64 const WORD32 pi_2 = 2 * PI_IN_Q28;
65
66 while (phase < 0) phase += pi_2;
67 while (phase >= pi_2) phase -= pi_2;
68 assert((phase >= 0) && (phase < pi_2));
69
70 return phase;
71 }
72
ixheaacd_mps_buffer_pre_and_mix_matrix(ia_mps_dec_state_struct * self)73 static VOID ixheaacd_mps_buffer_pre_and_mix_matrix(
74 ia_mps_dec_state_struct *self) {
75 WORD32 pb, row, col;
76
77 for (pb = 0; pb < self->bs_param_bands; pb++) {
78 for (row = 0; row < MAX_M_INPUT; row++) {
79 for (col = 0; col < MAX_M_OUTPUT; col++) {
80 self->m1_param_re_prev[pb][row][col] =
81 self->m1_param_re[self->num_parameter_sets_prev - 1][pb][row][col];
82 self->m1_param_im_prev[pb][row][col] =
83 self->m1_param_im[self->num_parameter_sets_prev - 1][pb][row][col];
84 self->m2_decor_re_prev[pb][row][col] =
85 self->m2_decor_re[self->num_parameter_sets_prev - 1][pb][row][col];
86 self->m2_decor_im_prev[pb][row][col] =
87 self->m2_decor_im[self->num_parameter_sets_prev - 1][pb][row][col];
88 self->m2_resid_re_prev[pb][row][col] =
89 self->m2_resid_re[self->num_parameter_sets_prev - 1][pb][row][col];
90 self->m2_resid_im_prev[pb][row][col] =
91 self->m2_resid_im[self->num_parameter_sets_prev - 1][pb][row][col];
92 }
93 }
94 }
95
96 for (pb = 0; pb < self->bs_param_bands; pb++) {
97 self->phase_l_prev[pb] =
98 self->phase_l[self->num_parameter_sets_prev - 1][pb];
99 self->phase_r_prev[pb] =
100 self->phase_r[self->num_parameter_sets_prev - 1][pb];
101 }
102 }
103
ixheaacd_pre_and_mix_matrix_calculation(ia_mps_dec_state_struct * self)104 VOID ixheaacd_pre_and_mix_matrix_calculation(ia_mps_dec_state_struct *self) {
105 WORD32 ps, pb;
106 ia_mps_bs_frame *curr_bit_stream = &(self->bs_frame);
107 FLOAT32 h_imag[2 * MAX_PARAMETER_BANDS];
108 FLOAT32 h_real[6 * MAX_PARAMETER_BANDS];
109
110 ixheaacd_mps_buffer_pre_and_mix_matrix(self);
111
112 for (ps = 0; ps < self->num_parameter_sets; ps++) {
113 FLOAT32 *h_im = &h_imag[0];
114 FLOAT32 *h_re = &h_real[0];
115
116 memset(h_real, 0, 6 * MAX_PARAMETER_BANDS * sizeof(FLOAT32));
117 memset(h_imag, 0, 2 * MAX_PARAMETER_BANDS * sizeof(FLOAT32));
118
119 switch (self->config->bs_phase_coding) {
120 case 0:
121 if (self->residual_coding) {
122 ixheaacd_mps_par2umx_pred(self, curr_bit_stream, h_imag, h_real, ps,
123 self->res_bands);
124 } else {
125 ixheaacd_mps_par2umx_ps(self, curr_bit_stream, h_real, ps);
126 }
127
128 break;
129 case 1:
130 ixheaacd_mps_par2umx_ps_ipd_opd(self, curr_bit_stream, h_real, ps);
131 break;
132 case 2:
133 ixheaacd_mps_par2umx_pred(self, curr_bit_stream, h_imag, h_real, ps,
134 self->res_bands);
135 break;
136 }
137
138 for (pb = 0; pb < self->bs_param_bands; pb++) {
139 self->m1_param_re[ps][pb][0][0] = 1.0f;
140 self->m1_param_re[ps][pb][1][0] = 1.0f;
141
142 self->m1_param_im[ps][pb][0][0] = 0;
143 self->m1_param_im[ps][pb][1][0] = 0;
144
145 self->m2_resid_re[ps][pb][0][0] = *h_re++;
146 self->m2_resid_im[ps][pb][0][0] = *h_im++;
147 self->m2_resid_im[ps][pb][0][1] = 0;
148
149 self->m2_resid_re[ps][pb][1][0] = *h_re++;
150 self->m2_resid_im[ps][pb][1][0] = *h_im++;
151 self->m2_resid_im[ps][pb][1][1] = 0;
152
153 self->m2_decor_re[ps][pb][0][0] = 0;
154 self->m2_decor_im[ps][pb][0][0] = 0;
155 self->m2_decor_re[ps][pb][0][1] = *h_re++;
156 self->m2_decor_im[ps][pb][0][1] = 0;
157
158 self->m2_decor_re[ps][pb][1][0] = 0;
159 self->m2_decor_im[ps][pb][1][0] = 0;
160 self->m2_decor_re[ps][pb][1][1] = *h_re++;
161 self->m2_decor_im[ps][pb][1][1] = 0;
162
163 self->m2_resid_re[ps][pb][0][1] = *h_re++;
164 self->m2_resid_re[ps][pb][1][1] = *h_re++;
165 }
166 }
167 ixheaacd_mps_smoothing_opd(self);
168 }
169
ixheaacd_mps_par2umx_ps_core(WORD32 cld[MAX_PARAMETER_BANDS],WORD32 icc[MAX_PARAMETER_BANDS],WORD32 ott_band_count,FLOAT32 * h_real)170 static VOID ixheaacd_mps_par2umx_ps_core(WORD32 cld[MAX_PARAMETER_BANDS],
171 WORD32 icc[MAX_PARAMETER_BANDS],
172 WORD32 ott_band_count,
173 FLOAT32 *h_real) {
174 WORD32 band;
175 FLOAT32 c_l_temp, c_r_temp, temp;
176 WORD32 cld_idx, icc_idx;
177
178 for (band = 0; band < ott_band_count; band++) {
179 cld_idx = *cld++ + 15;
180 icc_idx = *icc++;
181
182 icc_idx = icc_idx & 7;
183
184 c_l_temp = (ixheaacd_c_l_table[cld_idx]);
185 c_r_temp = (ixheaacd_c_l_table[30 - cld_idx]);
186
187 temp = ixheaacd_cos_table[icc_idx][cld_idx];
188 *h_real++ = MULT(temp, c_l_temp);
189
190 temp = ixheaacd_cos_table[icc_idx][30 - cld_idx];
191 *h_real++ = MULT(temp, c_r_temp);
192
193 temp = ixheaacd_sin_table[icc_idx][cld_idx];
194 *h_real++ = MULT(temp, c_l_temp);
195
196 temp = -ixheaacd_sin_table[icc_idx][30 - cld_idx];
197 *h_real++ = MULT(temp, c_r_temp);
198
199 h_real += 2;
200 }
201 }
202
ixheaacd_mps_par2umx_ps(ia_mps_dec_state_struct * self,ia_mps_bs_frame * curr_bit_stream,FLOAT32 * h_real,WORD32 param_set_idx)203 VOID ixheaacd_mps_par2umx_ps(ia_mps_dec_state_struct *self,
204 ia_mps_bs_frame *curr_bit_stream, FLOAT32 *h_real,
205 WORD32 param_set_idx) {
206 ixheaacd_mps_par2umx_ps_core(curr_bit_stream->cld_idx[param_set_idx],
207 curr_bit_stream->icc_idx[param_set_idx],
208 self->bs_param_bands, h_real);
209 }
210
ixheaacd_mps_opd_calc(ia_mps_dec_state_struct * self,ia_mps_bs_frame * curr_bit_stream,WORD32 param_set_idx,WORD32 opd[MAX_PARAMETER_BANDS])211 static VOID ixheaacd_mps_opd_calc(ia_mps_dec_state_struct *self,
212 ia_mps_bs_frame *curr_bit_stream,
213 WORD32 param_set_idx,
214 WORD32 opd[MAX_PARAMETER_BANDS]) {
215 WORD32 band;
216
217 for (band = 0; band < self->num_bands_ipd; band++) {
218 WORD32 cld_idx = curr_bit_stream->cld_idx[param_set_idx][band] + 15;
219 WORD32 ipd_idx = (curr_bit_stream->ipd_idx[param_set_idx][band]) & 15;
220 WORD32 icc_idx = curr_bit_stream->icc_idx[param_set_idx][band];
221
222 if ((cld_idx == 15) && (ipd_idx == 8))
223 opd[band] = 0;
224 else
225 opd[band] = ixheaacd_atan_table_Q28[ipd_idx][icc_idx][cld_idx];
226 }
227 }
228
ixheaacd_mps_par2umx_ps_ipd_opd(ia_mps_dec_state_struct * self,ia_mps_bs_frame * curr_bit_stream,FLOAT32 * h_real,WORD32 param_set_idx)229 VOID ixheaacd_mps_par2umx_ps_ipd_opd(ia_mps_dec_state_struct *self,
230 ia_mps_bs_frame *curr_bit_stream,
231 FLOAT32 *h_real, WORD32 param_set_idx) {
232 WORD32 opd[MAX_PARAMETER_BANDS];
233 WORD32 ott_band_count = self->bs_param_bands;
234 WORD32 num_bands_ipd = self->num_bands_ipd;
235 WORD32 band;
236
237 ixheaacd_mps_par2umx_ps_core(curr_bit_stream->cld_idx[param_set_idx],
238 curr_bit_stream->icc_idx[param_set_idx],
239 ott_band_count, h_real);
240
241 if (self->bs_phase_mode) {
242 ixheaacd_mps_opd_calc(self, curr_bit_stream, param_set_idx, opd);
243
244 for (band = 0; band < num_bands_ipd; band++) {
245 WORD32 ipd_idx = curr_bit_stream->ipd_idx[param_set_idx][band] & 15;
246 WORD32 ipd = ixheaacd_ipd_de_quant_table_q28[ipd_idx];
247
248 self->phase_l[param_set_idx][band] =
249 ixheaacd_mps_phase_wraping(opd[band]) * ONE_BY_Q28_FLOAT_VAL;
250 self->phase_r[param_set_idx][band] =
251 ixheaacd_mps_phase_wraping(opd[band] - ipd) * ONE_BY_Q28_FLOAT_VAL;
252 }
253 } else {
254 num_bands_ipd = 0;
255 }
256
257 for (band = num_bands_ipd; band < ott_band_count; band++) {
258 self->phase_l[param_set_idx][band] = 0;
259 self->phase_r[param_set_idx][band] = 0;
260 }
261 }
262
ixheaacd_mps_par2umx_pred(ia_mps_dec_state_struct * self,ia_mps_bs_frame * curr_bit_stream,FLOAT32 * h_imag,FLOAT32 * h_real,WORD32 param_set_idx,WORD32 res_bands)263 VOID ixheaacd_mps_par2umx_pred(ia_mps_dec_state_struct *self,
264 ia_mps_bs_frame *curr_bit_stream,
265 FLOAT32 *h_imag, FLOAT32 *h_real,
266 WORD32 param_set_idx, WORD32 res_bands) {
267 WORD32 band;
268
269 for (band = 0; band < self->bs_param_bands; band++) {
270 WORD32 cld_idx = curr_bit_stream->cld_idx[param_set_idx][band] + 15;
271 WORD32 icc_idx = curr_bit_stream->icc_idx[param_set_idx][band];
272 WORD32 ipd_idx = curr_bit_stream->ipd_idx[param_set_idx][band] & 15;
273
274 if ((band < self->num_bands_ipd) && (cld_idx == 15) && (icc_idx == 0) &&
275 (ipd_idx == 8)) {
276 FLOAT32 gain = 0.416666667f;
277 *h_imag++ = 0;
278 *h_imag++ = 0;
279
280 if (band < res_bands) {
281 *h_real++ = gain;
282 *h_real++ = gain;
283 h_real += 2;
284
285 *h_real++ = gain;
286 *h_real++ = -gain;
287 } else {
288 *h_real++ = gain;
289 *h_real++ = -gain;
290
291 h_real += 4;
292 }
293 } else {
294 FLOAT32 weight, re_weight, im_weight;
295
296 weight = ixheaacd_weight[ipd_idx][icc_idx][cld_idx];
297 re_weight = ixheaacd_re_weight[ipd_idx][icc_idx][cld_idx];
298 im_weight = ixheaacd_im_weight[ipd_idx][icc_idx][cld_idx];
299
300 if (band < self->num_bands_ipd) {
301 weight = ixheaacd_weight[ipd_idx][icc_idx][cld_idx];
302 re_weight = ixheaacd_re_weight[ipd_idx][icc_idx][cld_idx];
303 im_weight = ixheaacd_im_weight[ipd_idx][icc_idx][cld_idx];
304 } else {
305 weight = ixheaacd_weight[0][icc_idx][cld_idx];
306 re_weight = ixheaacd_re_weight[0][icc_idx][cld_idx];
307 im_weight = ixheaacd_im_weight[0][icc_idx][cld_idx];
308 }
309
310 *h_real++ = weight - re_weight;
311 *h_imag++ = -im_weight;
312 *h_real++ = weight + re_weight;
313 *h_imag++ = im_weight;
314
315 if (band < res_bands) {
316 h_real += 2;
317
318 *h_real++ = weight;
319 *h_real++ = -weight;
320 } else {
321 FLOAT32 beta = ixheaacd_beta[ipd_idx][icc_idx][cld_idx];
322
323 *h_real++ = beta;
324 *h_real++ = -beta;
325 h_real += 2;
326 }
327 }
328 }
329 }
330
ixheaacd_mps_apply_pre_matrix(ia_mps_dec_state_struct * self)331 VOID ixheaacd_mps_apply_pre_matrix(ia_mps_dec_state_struct *self) {
332 WORD32 ts, qs, row;
333 if (self->pre_mix_req) {
334 ixheaacd_mps_upmix_interp_type1(
335 self->m1_param_re, self->r_out_re_in_m1, self->m1_param_re_prev,
336 (self->dir_sig_count + self->decor_sig_count), 1, self, self->bs_high_rate_mode);
337
338 for (ts = 0; ts < self->time_slots; ts++) {
339 for (qs = 0; qs < 2; qs++) {
340 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
341
342 FLOAT32 real =
343 self->hyb_in[0][qs][ts].re * self->r_out_re_in_m1[ts][indx][0][0];
344 FLOAT32 imag =
345 self->hyb_in[0][qs][ts].im * self->r_out_re_in_m1[ts][indx][0][0];
346 for (row = 0; row < (self->dir_sig_count + self->decor_sig_count);
347 row++) {
348 self->v[row][ts][qs].re = real;
349 self->v[row][ts][qs].im = imag;
350 }
351 }
352 for (qs = 2; qs < self->hyb_band_count[0]; qs++) {
353 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
354 FLOAT32 real =
355 self->hyb_in[0][qs][ts].re * self->r_out_re_in_m1[ts][indx][0][0];
356 FLOAT32 imag =
357 self->hyb_in[0][qs][ts].im * self->r_out_re_in_m1[ts][indx][0][0];
358 for (row = 0; row < (self->dir_sig_count + self->decor_sig_count);
359 row++) {
360 self->v[row][ts][qs].re = real;
361 self->v[row][ts][qs].im = imag;
362 }
363 }
364 }
365 } else {
366 for (ts = 0; ts < self->time_slots; ts++) {
367 for (qs = 0; qs < self->hyb_band_count[0]; qs++) {
368 FLOAT32 real = self->hyb_in[0][qs][ts].re;
369 FLOAT32 imag = self->hyb_in[0][qs][ts].im;
370 for (row = 0; row < (self->dir_sig_count + self->decor_sig_count);
371 row++) {
372 self->v[row][ts][qs].re = real;
373 self->v[row][ts][qs].im = imag;
374 }
375 }
376 }
377 }
378 return;
379 }
380
ixheaacd_mps_apply_mix_matrix(ia_mps_dec_state_struct * self)381 VOID ixheaacd_mps_apply_mix_matrix(ia_mps_dec_state_struct *self) {
382 WORD32 ts, qs, row, col;
383 WORD32 complex_m2 = ((self->config->bs_phase_coding != 0));
384 WORD32 phase_interpolation = (self->config->bs_phase_coding == 1);
385 WORD32 num_col_iters = 0;
386
387 ixheaacd_mps_upmix_interp(self->m2_decor_re, self->r_out_diff_re_in_m2, self->m2_decor_re_prev,
388 self->out_ch_count, (self->dir_sig_count + self->decor_sig_count),
389 self, 1);
390
391 ixheaacd_mps_upmix_interp(self->m2_resid_re, self->r_out_re_in_m2, self->m2_resid_re_prev,
392 self->out_ch_count, (self->dir_sig_count + self->decor_sig_count),
393 self, 1);
394
395 if (complex_m2 && !phase_interpolation) {
396 ixheaacd_mps_upmix_interp(self->m2_decor_im, self->r_out_diff_im_in_m2,
397 self->m2_decor_im_prev, self->out_ch_count,
398 (self->dir_sig_count + self->decor_sig_count), self, 1);
399 ixheaacd_mps_upmix_interp(self->m2_resid_im, self->r_out_im_in_m2, self->m2_resid_im_prev,
400 self->out_ch_count, (self->dir_sig_count + self->decor_sig_count),
401 self, 1);
402 }
403
404 if (phase_interpolation) {
405 ixheaacd_mps_phase_interpolation(
406 self->phase_l, self->phase_r, self->phase_l_prev, self->phase_r_prev,
407 self->r_out_ph_re_in_m2, self->r_out_ph_im_in_m2, self);
408
409 for (ts = 0; ts < self->time_slots; ts++) {
410 WORD32 pb;
411 for (pb = 0; pb < self->bs_param_bands; pb++) {
412 self->r_out_im_in_m2[ts][pb][0][0] =
413 self->r_out_re_in_m2[ts][pb][0][0] *
414 self->r_out_ph_im_in_m2[ts][pb][0];
415
416 self->r_out_im_in_m2[ts][pb][0][1] =
417 self->r_out_re_in_m2[ts][pb][0][1] *
418 self->r_out_ph_im_in_m2[ts][pb][0];
419
420 self->r_out_im_in_m2[ts][pb][1][0] =
421 self->r_out_re_in_m2[ts][pb][1][0] *
422 self->r_out_ph_im_in_m2[ts][pb][1];
423
424 self->r_out_im_in_m2[ts][pb][1][1] =
425 self->r_out_re_in_m2[ts][pb][1][1] *
426 self->r_out_ph_im_in_m2[ts][pb][1];
427
428 self->r_out_re_in_m2[ts][pb][0][0] =
429 self->r_out_re_in_m2[ts][pb][0][0] *
430 self->r_out_ph_re_in_m2[ts][pb][0];
431
432 self->r_out_re_in_m2[ts][pb][0][1] =
433 self->r_out_re_in_m2[ts][pb][0][1] *
434 self->r_out_ph_re_in_m2[ts][pb][0];
435
436 self->r_out_re_in_m2[ts][pb][1][0] =
437 self->r_out_re_in_m2[ts][pb][1][0] *
438 self->r_out_ph_re_in_m2[ts][pb][1];
439
440 self->r_out_re_in_m2[ts][pb][1][1] =
441 self->r_out_re_in_m2[ts][pb][1][1] *
442 self->r_out_ph_re_in_m2[ts][pb][1];
443
444 self->r_out_diff_im_in_m2[ts][pb][0][0] = 0;
445 self->r_out_diff_im_in_m2[ts][pb][0][1] =
446 self->r_out_diff_re_in_m2[ts][pb][0][1] *
447 self->r_out_ph_im_in_m2[ts][pb][0];
448
449 self->r_out_diff_im_in_m2[ts][pb][1][0] = 0;
450 self->r_out_diff_im_in_m2[ts][pb][1][1] =
451 self->r_out_diff_re_in_m2[ts][pb][1][1] *
452 self->r_out_ph_im_in_m2[ts][pb][1];
453
454 self->r_out_diff_re_in_m2[ts][pb][0][0] = 0;
455 self->r_out_diff_re_in_m2[ts][pb][0][1] =
456 self->r_out_diff_re_in_m2[ts][pb][0][1] *
457 self->r_out_ph_re_in_m2[ts][pb][0];
458
459 self->r_out_diff_re_in_m2[ts][pb][1][0] = 0;
460 self->r_out_diff_re_in_m2[ts][pb][1][1] =
461 self->r_out_diff_re_in_m2[ts][pb][1][1] *
462 self->r_out_ph_re_in_m2[ts][pb][1];
463 }
464 }
465 }
466 if (self->res_bands == 0) {
467 num_col_iters = self->dir_sig_count;
468 }
469 else {
470 num_col_iters = (self->dir_sig_count + self->decor_sig_count);
471 }
472
473 for (ts = 0; ts < self->time_slots; ts++) {
474 for (qs = 0; qs < self->hyb_band_count_max; qs++) {
475 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
476
477 for (row = 0; row < self->out_ch_count; row++) {
478 FLOAT32 sum_re_dir = 0;
479 FLOAT32 sum_im_dir = 0;
480 for (col = 0; col < num_col_iters; col++) {
481 sum_re_dir += self->w_dir[col][ts][qs].re *
482 self->r_out_re_in_m2[ts][indx][row][col];
483 sum_im_dir += self->w_dir[col][ts][qs].im *
484 self->r_out_re_in_m2[ts][indx][row][col];
485 }
486 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
487 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
488
489 self->hyb_diff_out[row][ts][qs].re =
490 self->w_diff[1][ts][qs].re *
491 self->r_out_diff_re_in_m2[ts][indx][row][1];
492 self->hyb_diff_out[row][ts][qs].im =
493 self->w_diff[1][ts][qs].im *
494 self->r_out_diff_re_in_m2[ts][indx][row][1];
495 }
496 }
497 }
498
499 if (complex_m2) {
500 if (phase_interpolation) {
501 for (ts = 0; ts < self->time_slots; ts++) {
502 for (qs = 0; qs < 2; qs++) {
503 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
504 for (row = 0; row < self->out_ch_count; row++) {
505 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
506 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
507 for (col = 0; col < num_col_iters; col++) {
508 sum_re_dir += self->w_dir[col][ts][qs].im *
509 self->r_out_im_in_m2[ts][indx][row][col];
510 sum_im_dir -= self->w_dir[col][ts][qs].re *
511 self->r_out_im_in_m2[ts][indx][row][col];
512 }
513 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
514 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
515 self->hyb_diff_out[row][ts][qs].re +=
516 self->w_diff[1][ts][qs].im *
517 self->r_out_diff_im_in_m2[ts][indx][row][1];
518 self->hyb_diff_out[row][ts][qs].im -=
519 self->w_diff[1][ts][qs].re *
520 self->r_out_diff_im_in_m2[ts][indx][row][1];
521 }
522 }
523 for (qs = 2; qs < self->hyb_band_count_max; qs++) {
524 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
525 for (row = 0; row < self->out_ch_count; row++) {
526 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
527 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
528 for (col = 0; col < num_col_iters; col++) {
529 sum_re_dir -= self->w_dir[col][ts][qs].im *
530 self->r_out_im_in_m2[ts][indx][row][col];
531 sum_im_dir += self->w_dir[col][ts][qs].re *
532 self->r_out_im_in_m2[ts][indx][row][col];
533 }
534 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
535 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
536 self->hyb_diff_out[row][ts][qs].re -=
537 self->w_diff[1][ts][qs].im *
538 self->r_out_diff_im_in_m2[ts][indx][row][1];
539 self->hyb_diff_out[row][ts][qs].im +=
540 self->w_diff[1][ts][qs].re *
541 self->r_out_diff_im_in_m2[ts][indx][row][1];
542 }
543 }
544 }
545 }
546 else {
547 WORD32 num_cols = (self->dir_sig_count + self->decor_sig_count) > 1
548 ? 1
549 : (self->dir_sig_count + self->decor_sig_count);
550 for (ts = 0; ts < self->time_slots; ts++) {
551 for (qs = 0; qs < 2; qs++) {
552 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
553 for (row = 0; row < self->out_ch_count; row++) {
554 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
555 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
556 if (num_cols > 0) {
557 sum_re_dir += self->w_dir[0][ts][qs].im *
558 self->r_out_im_in_m2[ts][indx][row][0];
559 sum_im_dir -= self->w_dir[0][ts][qs].re *
560 self->r_out_im_in_m2[ts][indx][row][0];
561 }
562 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
563 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
564 }
565 }
566 for (qs = 2; qs < self->hyb_band_count_max; qs++) {
567 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
568 for (row = 0; row < self->out_ch_count; row++) {
569 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
570 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
571 if (num_cols > 0) {
572 sum_re_dir -= self->w_dir[0][ts][qs].im *
573 self->r_out_im_in_m2[ts][indx][row][0];
574 sum_im_dir += self->w_dir[0][ts][qs].re *
575 self->r_out_im_in_m2[ts][indx][row][0];
576 }
577 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
578 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
579 }
580 }
581 }
582 }
583 }
584 return;
585 }
586
ixheaacd_mps_apply_mix_matrix_type1(ia_mps_dec_state_struct * self)587 VOID ixheaacd_mps_apply_mix_matrix_type1(ia_mps_dec_state_struct *self) {
588 WORD32 ts, qs, row;
589
590 ixheaacd_mps_upmix_interp_type2(self->m2_decor_re, self->r_out_diff_re_in_m2,
591 self->m2_decor_re_prev, self->out_ch_count, self, 1);
592
593 ixheaacd_mps_upmix_interp_type2(self->m2_resid_re, self->r_out_re_in_m2, self->m2_resid_re_prev,
594 self->out_ch_count, self, 0);
595
596 for (qs = 0; qs < self->hyb_band_count[0]; qs++) {
597 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
598 for (ts = 0; ts < self->time_slots; ts++) {
599 for (row = 0; row < self->out_ch_count; row++) {
600 self->hyb_dir_out[row][ts][qs].re =
601 self->w_dir[0][ts][qs].re * self->r_out_re_in_m2[ts][indx][row][0];
602 self->hyb_dir_out[row][ts][qs].im =
603 self->w_dir[0][ts][qs].im * self->r_out_re_in_m2[ts][indx][row][0];
604 self->hyb_diff_out[row][ts][qs].re =
605 self->w_diff[1][ts][qs].re *
606 self->r_out_diff_re_in_m2[ts][indx][row][1];
607 self->hyb_diff_out[row][ts][qs].im =
608 self->w_diff[1][ts][qs].im *
609 self->r_out_diff_re_in_m2[ts][indx][row][1];
610 }
611 }
612 }
613 return;
614 }
615
ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct * self)616 VOID ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self) {
617 WORD32 ts, qs, row, col;
618 WORD32 complex_m2 = ((self->config->bs_phase_coding != 0));
619 WORD32 phase_interpolation = (self->config->bs_phase_coding == 1);
620 WORD32 num_col_iters = 0;
621
622 ixheaacd_mps_upmix_interp_type1(self->m2_decor_re, self->r_out_diff_re_in_m2,
623 self->m2_decor_re_prev, self->out_ch_count,
624 (self->dir_sig_count + self->decor_sig_count), self, 1);
625 ixheaacd_mps_upmix_interp_type1(self->m2_resid_re, self->r_out_re_in_m2, self->m2_resid_re_prev,
626 self->out_ch_count,
627 (self->dir_sig_count + self->decor_sig_count), self, 1);
628
629 if (complex_m2 && !phase_interpolation) {
630 ixheaacd_mps_upmix_interp_type1(self->m2_decor_im, self->r_out_diff_im_in_m2,
631 self->m2_decor_im_prev, self->out_ch_count,
632 (self->dir_sig_count + self->decor_sig_count), self, 1);
633 ixheaacd_mps_upmix_interp_type1(self->m2_resid_im, self->r_out_im_in_m2,
634 self->m2_resid_im_prev, self->out_ch_count,
635 (self->dir_sig_count + self->decor_sig_count), self, 1);
636 }
637
638 if (phase_interpolation) {
639 ixheaacd_mps_phase_interpolation(
640 self->phase_l, self->phase_r, self->phase_l_prev, self->phase_r_prev,
641 self->r_out_ph_re_in_m2, self->r_out_ph_im_in_m2, self);
642
643 for (ts = 0; ts < self->time_slots; ts++) {
644 WORD32 pb;
645 for (pb = 0; pb < self->bs_param_bands; pb++) {
646 self->r_out_im_in_m2[ts][pb][0][0] =
647 self->r_out_re_in_m2[ts][pb][0][0] *
648 self->r_out_ph_im_in_m2[ts][pb][0];
649
650 self->r_out_im_in_m2[ts][pb][0][1] =
651 self->r_out_re_in_m2[ts][pb][0][1] *
652 self->r_out_ph_im_in_m2[ts][pb][0];
653 self->r_out_im_in_m2[ts][pb][1][0] =
654 self->r_out_re_in_m2[ts][pb][1][0] *
655 self->r_out_ph_im_in_m2[ts][pb][1];
656
657 self->r_out_im_in_m2[ts][pb][1][1] =
658 self->r_out_re_in_m2[ts][pb][1][1] *
659 self->r_out_ph_im_in_m2[ts][pb][1];
660
661 self->r_out_re_in_m2[ts][pb][0][0] =
662 self->r_out_re_in_m2[ts][pb][0][0] *
663 self->r_out_ph_re_in_m2[ts][pb][0];
664
665 self->r_out_re_in_m2[ts][pb][0][1] =
666 self->r_out_re_in_m2[ts][pb][0][1] *
667 self->r_out_ph_re_in_m2[ts][pb][0];
668
669 self->r_out_re_in_m2[ts][pb][1][0] =
670 self->r_out_re_in_m2[ts][pb][1][0] *
671 self->r_out_ph_re_in_m2[ts][pb][1];
672
673 self->r_out_re_in_m2[ts][pb][1][1] =
674 self->r_out_re_in_m2[ts][pb][1][1] *
675 self->r_out_ph_re_in_m2[ts][pb][1];
676
677 self->r_out_diff_im_in_m2[ts][pb][0][0] = 0;
678 self->r_out_diff_im_in_m2[ts][pb][0][1] =
679 self->r_out_diff_re_in_m2[ts][pb][0][1] *
680 self->r_out_ph_im_in_m2[ts][pb][0];
681
682 self->r_out_diff_im_in_m2[ts][pb][1][0] = 0;
683 self->r_out_diff_im_in_m2[ts][pb][1][1] =
684 self->r_out_diff_re_in_m2[ts][pb][1][1] *
685 self->r_out_ph_im_in_m2[ts][pb][1];
686
687 self->r_out_diff_re_in_m2[ts][pb][0][0] = 0;
688 self->r_out_diff_re_in_m2[ts][pb][0][1] =
689 self->r_out_diff_re_in_m2[ts][pb][0][1] *
690 self->r_out_ph_re_in_m2[ts][pb][0];
691
692 self->r_out_diff_re_in_m2[ts][pb][1][0] = 0;
693 self->r_out_diff_re_in_m2[ts][pb][1][1] =
694 self->r_out_diff_re_in_m2[ts][pb][1][1] *
695 self->r_out_ph_re_in_m2[ts][pb][1];
696 }
697 }
698 }
699 if (self->res_bands == 0) {
700 num_col_iters = self->dir_sig_count;
701 } else {
702 num_col_iters = (self->dir_sig_count + self->decor_sig_count);
703 }
704 for (ts = 0; ts < self->time_slots; ts++) {
705 for (qs = 0; qs < self->hyb_band_count_max; qs++) {
706 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
707
708 for (row = 0; row < self->out_ch_count; row++) {
709 FLOAT32 sum_re_dir = 0;
710 FLOAT32 sum_im_dir = 0;
711 for (col = 0; col < num_col_iters; col++) {
712 sum_re_dir += self->w_dir[col][ts][qs].re *
713 self->r_out_re_in_m2[ts][indx][row][col];
714 sum_im_dir += self->w_dir[col][ts][qs].im *
715 self->r_out_re_in_m2[ts][indx][row][col];
716 }
717 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
718 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
719
720 self->hyb_diff_out[row][ts][qs].re =
721 self->w_diff[1][ts][qs].re *
722 self->r_out_diff_re_in_m2[ts][indx][row][1];
723 self->hyb_diff_out[row][ts][qs].im =
724 self->w_diff[1][ts][qs].im *
725 self->r_out_diff_re_in_m2[ts][indx][row][1];
726 }
727 }
728 }
729
730 if (complex_m2) {
731 if (phase_interpolation) {
732 for (ts = 0; ts < self->time_slots; ts++) {
733 for (qs = 0; qs < 2; qs++) {
734 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
735 for (row = 0; row < self->out_ch_count; row++) {
736 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
737 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
738 for (col = 0; col < num_col_iters; col++) {
739 sum_re_dir += self->w_dir[col][ts][qs].im *
740 self->r_out_im_in_m2[ts][indx][row][col];
741 sum_im_dir -= self->w_dir[col][ts][qs].re *
742 self->r_out_im_in_m2[ts][indx][row][col];
743 }
744 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
745 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
746 self->hyb_diff_out[row][ts][qs].re +=
747 self->w_diff[1][ts][qs].im *
748 self->r_out_diff_im_in_m2[ts][indx][row][1];
749 self->hyb_diff_out[row][ts][qs].im -=
750 self->w_diff[1][ts][qs].re *
751 self->r_out_diff_im_in_m2[ts][indx][row][1];
752 }
753 }
754 for (qs = 2; qs < self->hyb_band_count_max; qs++) {
755 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
756 for (row = 0; row < self->out_ch_count; row++) {
757 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
758 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
759 for (col = 0; col < num_col_iters; col++) {
760 sum_re_dir -= self->w_dir[col][ts][qs].im *
761 self->r_out_im_in_m2[ts][indx][row][col];
762 sum_im_dir += self->w_dir[col][ts][qs].re *
763 self->r_out_im_in_m2[ts][indx][row][col];
764 }
765 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
766 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
767 self->hyb_diff_out[row][ts][qs].re -=
768 self->w_diff[1][ts][qs].im *
769 self->r_out_diff_im_in_m2[ts][indx][row][1];
770 self->hyb_diff_out[row][ts][qs].im +=
771 self->w_diff[1][ts][qs].re *
772 self->r_out_diff_im_in_m2[ts][indx][row][1];
773 }
774 }
775 }
776 } else {
777 WORD32 num_cols = (self->dir_sig_count + self->decor_sig_count) > 1
778 ? 1
779 : (self->dir_sig_count + self->decor_sig_count);
780 for (ts = 0; ts < self->time_slots; ts++) {
781 for (qs = 0; qs < 2; qs++) {
782 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
783 for (row = 0; row < self->out_ch_count; row++) {
784 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
785 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
786 if (num_cols > 0) {
787 sum_re_dir += self->w_dir[0][ts][qs].im *
788 self->r_out_im_in_m2[ts][indx][row][0];
789 sum_im_dir -= self->w_dir[0][ts][qs].re *
790 self->r_out_im_in_m2[ts][indx][row][0];
791 }
792 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
793 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
794 }
795 }
796 for (qs = 2; qs < self->hyb_band_count_max; qs++) {
797 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
798 for (row = 0; row < self->out_ch_count; row++) {
799 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
800 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
801 if (num_cols > 0) {
802 sum_re_dir -= self->w_dir[0][ts][qs].im *
803 self->r_out_im_in_m2[ts][indx][row][0];
804 sum_im_dir += self->w_dir[0][ts][qs].re *
805 self->r_out_im_in_m2[ts][indx][row][0];
806 }
807 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
808 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
809 }
810 }
811 }
812 }
813 }
814 return;
815 }
816
ixheaacd_mps_apply_mix_matrix_type3(ia_mps_dec_state_struct * self)817 VOID ixheaacd_mps_apply_mix_matrix_type3(ia_mps_dec_state_struct *self) {
818 WORD32 ts, qs, row, col;
819 WORD32 complex_m2 = ((self->config->bs_phase_coding != 0));
820 WORD32 phase_interpolation = (self->config->bs_phase_coding == 1);
821 WORD32 num_col_iters = 0;
822
823 if (self->res_bands != 28) {
824 ixheaacd_mps_upmix_interp_type2(self->m2_decor_re, self->r_out_diff_re_in_m2,
825 self->m2_decor_re_prev, self->out_ch_count, self, 1);
826 }
827 if (self->res_bands == 0) {
828 num_col_iters = self->dir_sig_count;
829 ixheaacd_mps_upmix_interp_type2(self->m2_resid_re, self->r_out_re_in_m2,
830 self->m2_resid_re_prev, self->out_ch_count, self, 0);
831 } else {
832 num_col_iters = (self->dir_sig_count + self->decor_sig_count);
833 ixheaacd_mps_upmix_interp_type1(self->m2_resid_re, self->r_out_re_in_m2,
834 self->m2_resid_re_prev, self->out_ch_count,
835 (self->dir_sig_count + self->decor_sig_count), self, 1);
836 }
837
838 if (complex_m2 && !phase_interpolation) {
839 ixheaacd_mps_upmix_interp_type2(self->m2_resid_im, self->r_out_im_in_m2,
840 self->m2_resid_im_prev, self->out_ch_count, self, 0);
841 }
842
843 if (phase_interpolation) {
844 ixheaacd_mps_phase_interpolation(
845 self->phase_l, self->phase_r, self->phase_l_prev, self->phase_r_prev,
846 self->r_out_ph_re_in_m2, self->r_out_ph_im_in_m2, self);
847
848 if (self->res_bands == 0) {
849 for (ts = 0; ts < self->time_slots; ts++) {
850 WORD32 pb;
851 for (pb = 0; pb < self->bs_param_bands; pb++) {
852 self->r_out_im_in_m2[ts][pb][0][0] =
853 self->r_out_re_in_m2[ts][pb][0][0] *
854 self->r_out_ph_im_in_m2[ts][pb][0];
855
856 self->r_out_im_in_m2[ts][pb][1][0] =
857 self->r_out_re_in_m2[ts][pb][1][0] *
858 self->r_out_ph_im_in_m2[ts][pb][1];
859
860 self->r_out_re_in_m2[ts][pb][0][0] =
861 self->r_out_re_in_m2[ts][pb][0][0] *
862 self->r_out_ph_re_in_m2[ts][pb][0];
863
864 self->r_out_re_in_m2[ts][pb][1][0] =
865 self->r_out_re_in_m2[ts][pb][1][0] *
866 self->r_out_ph_re_in_m2[ts][pb][1];
867
868 self->r_out_diff_im_in_m2[ts][pb][0][1] =
869 self->r_out_diff_re_in_m2[ts][pb][0][1] *
870 self->r_out_ph_im_in_m2[ts][pb][0];
871
872 self->r_out_diff_im_in_m2[ts][pb][1][1] =
873 self->r_out_diff_re_in_m2[ts][pb][1][1] *
874 self->r_out_ph_im_in_m2[ts][pb][1];
875
876 self->r_out_diff_re_in_m2[ts][pb][0][1] =
877 self->r_out_diff_re_in_m2[ts][pb][0][1] *
878 self->r_out_ph_re_in_m2[ts][pb][0];
879
880 self->r_out_diff_re_in_m2[ts][pb][1][1] =
881 self->r_out_diff_re_in_m2[ts][pb][1][1] *
882 self->r_out_ph_re_in_m2[ts][pb][1];
883 }
884 }
885 } else if (self->res_bands == 28) {
886 for (ts = 0; ts < self->time_slots; ts++) {
887 WORD32 pb;
888 for (pb = 0; pb < self->bs_param_bands; pb++) {
889 self->r_out_im_in_m2[ts][pb][0][0] =
890 self->r_out_re_in_m2[ts][pb][0][0] *
891 self->r_out_ph_im_in_m2[ts][pb][0];
892
893 self->r_out_im_in_m2[ts][pb][0][1] =
894 self->r_out_re_in_m2[ts][pb][0][1] *
895 self->r_out_ph_im_in_m2[ts][pb][0];
896
897 self->r_out_im_in_m2[ts][pb][1][0] =
898 self->r_out_re_in_m2[ts][pb][1][0] *
899 self->r_out_ph_im_in_m2[ts][pb][1];
900
901 self->r_out_im_in_m2[ts][pb][1][1] =
902 self->r_out_re_in_m2[ts][pb][1][1] *
903 self->r_out_ph_im_in_m2[ts][pb][1];
904
905 self->r_out_re_in_m2[ts][pb][0][0] =
906 self->r_out_re_in_m2[ts][pb][0][0] *
907 self->r_out_ph_re_in_m2[ts][pb][0];
908
909 self->r_out_re_in_m2[ts][pb][0][1] =
910 self->r_out_re_in_m2[ts][pb][0][1] *
911 self->r_out_ph_re_in_m2[ts][pb][0];
912
913 self->r_out_re_in_m2[ts][pb][1][0] =
914 self->r_out_re_in_m2[ts][pb][1][0] *
915 self->r_out_ph_re_in_m2[ts][pb][1];
916
917 self->r_out_re_in_m2[ts][pb][1][1] =
918 self->r_out_re_in_m2[ts][pb][1][1] *
919 self->r_out_ph_re_in_m2[ts][pb][1];
920 }
921 }
922 } else {
923 for (ts = 0; ts < self->time_slots; ts++) {
924 WORD32 pb;
925 for (pb = 0; pb < self->bs_param_bands; pb++) {
926 self->r_out_im_in_m2[ts][pb][0][0] =
927 self->r_out_re_in_m2[ts][pb][0][0] *
928 self->r_out_ph_im_in_m2[ts][pb][0];
929
930 self->r_out_im_in_m2[ts][pb][0][1] =
931 self->r_out_re_in_m2[ts][pb][0][1] *
932 self->r_out_ph_im_in_m2[ts][pb][0];
933
934 self->r_out_im_in_m2[ts][pb][1][0] =
935 self->r_out_re_in_m2[ts][pb][1][0] *
936 self->r_out_ph_im_in_m2[ts][pb][1];
937
938 self->r_out_im_in_m2[ts][pb][1][1] =
939 self->r_out_re_in_m2[ts][pb][1][1] *
940 self->r_out_ph_im_in_m2[ts][pb][1];
941
942 self->r_out_re_in_m2[ts][pb][0][0] =
943 self->r_out_re_in_m2[ts][pb][0][0] *
944 self->r_out_ph_re_in_m2[ts][pb][0];
945
946 self->r_out_re_in_m2[ts][pb][0][1] =
947 self->r_out_re_in_m2[ts][pb][0][1] *
948 self->r_out_ph_re_in_m2[ts][pb][0];
949
950 self->r_out_re_in_m2[ts][pb][1][0] =
951 self->r_out_re_in_m2[ts][pb][1][0] *
952 self->r_out_ph_re_in_m2[ts][pb][1];
953
954 self->r_out_re_in_m2[ts][pb][1][1] =
955 self->r_out_re_in_m2[ts][pb][1][1] *
956 self->r_out_ph_re_in_m2[ts][pb][1];
957
958 self->r_out_diff_im_in_m2[ts][pb][0][1] =
959 self->r_out_diff_re_in_m2[ts][pb][0][1] *
960 self->r_out_ph_im_in_m2[ts][pb][0];
961
962 self->r_out_diff_im_in_m2[ts][pb][1][1] =
963 self->r_out_diff_re_in_m2[ts][pb][1][1] *
964 self->r_out_ph_im_in_m2[ts][pb][1];
965
966 self->r_out_diff_re_in_m2[ts][pb][0][1] =
967 self->r_out_diff_re_in_m2[ts][pb][0][1] *
968 self->r_out_ph_re_in_m2[ts][pb][0];
969
970 self->r_out_diff_re_in_m2[ts][pb][1][1] =
971 self->r_out_diff_re_in_m2[ts][pb][1][1] *
972 self->r_out_ph_re_in_m2[ts][pb][1];
973 }
974 }
975 }
976 }
977 if (self->res_bands == 0) {
978 for (ts = 0; ts < self->time_slots; ts++) {
979 for (qs = 0; qs < self->hyb_band_count[0]; qs++) {
980 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
981 for (row = 0; row < self->out_ch_count; row++) {
982 self->hyb_dir_out[row][ts][qs].re =
983 self->w_dir[0][ts][qs].re *
984 self->r_out_re_in_m2[ts][indx][row][0];
985 self->hyb_dir_out[row][ts][qs].im =
986 self->w_dir[0][ts][qs].im *
987 self->r_out_re_in_m2[ts][indx][row][0];
988 self->hyb_diff_out[row][ts][qs].re =
989 self->w_diff[1][ts][qs].re *
990 self->r_out_diff_re_in_m2[ts][indx][row][1];
991 self->hyb_diff_out[row][ts][qs].im =
992 self->w_diff[1][ts][qs].im *
993 self->r_out_diff_re_in_m2[ts][indx][row][1];
994 }
995 }
996 }
997 } else if (self->res_bands == 28) {
998 for (ts = 0; ts < self->time_slots; ts++) {
999 for (qs = 0; qs < self->hyb_band_count[1]; qs++) {
1000 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1001 for (row = 0; row < self->out_ch_count; row++) {
1002 FLOAT32 sum_re_dir = 0;
1003 FLOAT32 sum_im_dir = 0;
1004 for (col = 0; col < num_col_iters; col++) {
1005 sum_re_dir += self->w_dir[col][ts][qs].re *
1006 self->r_out_re_in_m2[ts][indx][row][col];
1007 sum_im_dir += self->w_dir[col][ts][qs].im *
1008 self->r_out_re_in_m2[ts][indx][row][col];
1009 }
1010 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1011 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1012 }
1013 }
1014 for (; qs < self->hyb_band_count[0]; qs++) {
1015 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1016 for (row = 0; row < self->out_ch_count; row++) {
1017 self->hyb_dir_out[row][ts][qs].re =
1018 self->w_dir[0][ts][qs].re *
1019 self->r_out_re_in_m2[ts][indx][row][0];
1020 self->hyb_dir_out[row][ts][qs].im =
1021 self->w_dir[0][ts][qs].im *
1022 self->r_out_re_in_m2[ts][indx][row][0];
1023 }
1024 }
1025 }
1026 } else {
1027 WORD32 dif_s = ixheaacd_mps_gain_set_indx[self->res_bands];
1028 for (ts = 0; ts < self->time_slots; ts++) {
1029 for (qs = 0; qs < dif_s; qs++) {
1030 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1031 for (row = 0; row < self->out_ch_count; row++) {
1032 FLOAT32 sum_re_dir = 0;
1033 FLOAT32 sum_im_dir = 0;
1034 for (col = 0; col < num_col_iters; col++) {
1035 sum_re_dir += self->w_dir[col][ts][qs].re *
1036 self->r_out_re_in_m2[ts][indx][row][col];
1037 sum_im_dir += self->w_dir[col][ts][qs].im *
1038 self->r_out_re_in_m2[ts][indx][row][col];
1039 }
1040 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1041 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1042 }
1043 }
1044 for (; qs < self->hyb_band_count[1]; qs++) {
1045 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1046 for (row = 0; row < self->out_ch_count; row++) {
1047 FLOAT32 sum_re_dir = 0;
1048 FLOAT32 sum_im_dir = 0;
1049 for (col = 0; col < num_col_iters; col++) {
1050 sum_re_dir += self->w_dir[col][ts][qs].re *
1051 self->r_out_re_in_m2[ts][indx][row][col];
1052 sum_im_dir += self->w_dir[col][ts][qs].im *
1053 self->r_out_re_in_m2[ts][indx][row][col];
1054 }
1055 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1056 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1057 self->hyb_diff_out[row][ts][qs].re =
1058 self->w_diff[1][ts][qs].re *
1059 self->r_out_diff_re_in_m2[ts][indx][row][1];
1060 self->hyb_diff_out[row][ts][qs].im =
1061 self->w_diff[1][ts][qs].im *
1062 self->r_out_diff_re_in_m2[ts][indx][row][1];
1063 }
1064 }
1065 for (; qs < self->hyb_band_count[0]; qs++) {
1066 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1067 for (row = 0; row < self->out_ch_count; row++) {
1068 self->hyb_dir_out[row][ts][qs].re =
1069 self->w_dir[0][ts][qs].re *
1070 self->r_out_re_in_m2[ts][indx][row][0];
1071 self->hyb_dir_out[row][ts][qs].im =
1072 self->w_dir[0][ts][qs].im *
1073 self->r_out_re_in_m2[ts][indx][row][0];
1074 self->hyb_diff_out[row][ts][qs].re =
1075 self->w_diff[1][ts][qs].re *
1076 self->r_out_diff_re_in_m2[ts][indx][row][1];
1077 self->hyb_diff_out[row][ts][qs].im =
1078 self->w_diff[1][ts][qs].im *
1079 self->r_out_diff_re_in_m2[ts][indx][row][1];
1080 }
1081 }
1082 }
1083 }
1084
1085 if (complex_m2) {
1086 if (phase_interpolation) {
1087 for (ts = 0; ts < self->time_slots; ts++) {
1088 for (qs = 0; qs < 2; qs++) {
1089 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1090 for (row = 0; row < self->out_ch_count; row++) {
1091 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
1092 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
1093 for (col = 0; col < num_col_iters; col++) {
1094 sum_re_dir += self->w_dir[col][ts][qs].im *
1095 self->r_out_im_in_m2[ts][indx][row][col];
1096 sum_im_dir -= self->w_dir[col][ts][qs].re *
1097 self->r_out_im_in_m2[ts][indx][row][col];
1098 }
1099 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1100 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1101 self->hyb_diff_out[row][ts][qs].re +=
1102 self->w_diff[1][ts][qs].im *
1103 self->r_out_diff_im_in_m2[ts][indx][row][1];
1104 self->hyb_diff_out[row][ts][qs].im -=
1105 self->w_diff[1][ts][qs].re *
1106 self->r_out_diff_im_in_m2[ts][indx][row][1];
1107 }
1108 }
1109 for (qs = 2; qs < self->hyb_band_count_max; qs++) {
1110 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1111 for (row = 0; row < self->out_ch_count; row++) {
1112 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
1113 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
1114 for (col = 0; col < num_col_iters; col++) {
1115 sum_re_dir -= self->w_dir[col][ts][qs].im *
1116 self->r_out_im_in_m2[ts][indx][row][col];
1117 sum_im_dir += self->w_dir[col][ts][qs].re *
1118 self->r_out_im_in_m2[ts][indx][row][col];
1119 }
1120 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1121 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1122 self->hyb_diff_out[row][ts][qs].re -=
1123 self->w_diff[1][ts][qs].im *
1124 self->r_out_diff_im_in_m2[ts][indx][row][1];
1125 self->hyb_diff_out[row][ts][qs].im +=
1126 self->w_diff[1][ts][qs].re *
1127 self->r_out_diff_im_in_m2[ts][indx][row][1];
1128 }
1129 }
1130 }
1131 } else {
1132 WORD32 num_cols = (self->dir_sig_count + self->decor_sig_count) > 1
1133 ? 1
1134 : (self->dir_sig_count + self->decor_sig_count);
1135 for (ts = 0; ts < self->time_slots; ts++) {
1136 for (qs = 0; qs < 2; qs++) {
1137 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1138 for (row = 0; row < self->out_ch_count; row++) {
1139 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
1140 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
1141 if (num_cols > 0) {
1142 sum_re_dir += self->w_dir[0][ts][qs].im *
1143 self->r_out_im_in_m2[ts][indx][row][0];
1144 sum_im_dir -= self->w_dir[0][ts][qs].re *
1145 self->r_out_im_in_m2[ts][indx][row][0];
1146 }
1147 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1148 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1149 }
1150 }
1151 for (qs = 2; qs < self->hyb_band_count_max; qs++) {
1152 WORD32 indx = self->hyb_band_to_processing_band_table[qs];
1153 for (row = 0; row < self->out_ch_count; row++) {
1154 FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
1155 FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
1156 if (num_cols > 0) {
1157 sum_re_dir -= self->w_dir[0][ts][qs].im *
1158 self->r_out_im_in_m2[ts][indx][row][0];
1159 sum_im_dir += self->w_dir[0][ts][qs].re *
1160 self->r_out_im_in_m2[ts][indx][row][0];
1161 }
1162 self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
1163 self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
1164 }
1165 }
1166 }
1167 }
1168 }
1169 return;
1170 }
1171
ixheaacd_mps_upmix_interp(FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],WORD32 num_rows,WORD32 num_cols,ia_mps_dec_state_struct * self,WORD32 bs_high_rate_mode)1172 VOID ixheaacd_mps_upmix_interp(
1173 FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
1174 FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
1175 FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT], WORD32 num_rows,
1176 WORD32 num_cols, ia_mps_dec_state_struct *self, WORD32 bs_high_rate_mode) {
1177 WORD32 ts, ps, pb, row, col, i;
1178 FLOAT32 ks, ms, ls;
1179 FLOAT32 fl_step, fl_base;
1180
1181 for (pb = 0; pb < self->bs_param_bands; pb++) {
1182 for (row = 0; row < num_rows; row++) {
1183 for (col = 0; col < num_cols; col++) {
1184 ts = 0;
1185 ps = 0;
1186 ks = self->inv_param_slot_diff[ps];
1187 ms = m_matrix[ps][pb][row][col];
1188 ls = m_matrix_prev[pb][row][col];
1189 fl_step = ks * (ms - ls);
1190 fl_base = ls + fl_step;
1191
1192 for (i = 1; i <= (WORD32)self->param_slot_diff[0]; i++) {
1193 r_matrix_float[ts][pb][row][col] = fl_base;
1194 fl_base += fl_step;
1195 ts++;
1196 }
1197 if (bs_high_rate_mode) {
1198 for (ps = 1; ps < self->num_parameter_sets; ps++) {
1199 ks = self->inv_param_slot_diff[ps];
1200 ms = m_matrix[ps][pb][row][col];
1201 ls = m_matrix[ps - 1][pb][row][col];
1202 fl_step = ks * (ms - ls);
1203 fl_base = ls + fl_step;
1204
1205 for (i = 1; i <= (WORD32)self->param_slot_diff[ps]; i++) {
1206 r_matrix_float[ts][pb][row][col] = fl_base;
1207 fl_base += fl_step;
1208 ts++;
1209 }
1210 }
1211 }
1212 }
1213 }
1214 }
1215 return;
1216 }
1217
ixheaacd_mps_upmix_interp_type1(FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],WORD32 num_rows,WORD32 num_cols,ia_mps_dec_state_struct * self,WORD32 bs_high_rate_mode)1218 VOID ixheaacd_mps_upmix_interp_type1(
1219 FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
1220 FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
1221 FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT], WORD32 num_rows,
1222 WORD32 num_cols, ia_mps_dec_state_struct *self, WORD32 bs_high_rate_mode) {
1223 WORD32 ts, ps, pb, row, col, i;
1224 FLOAT32 ks, ms, ls;
1225 FLOAT32 fl_step, fl_base;
1226
1227 for (pb = 0; pb < self->bs_param_bands; pb++) {
1228 for (row = 0; row < num_rows; row++) {
1229 for (col = 0; col < num_cols; col++) {
1230 ts = 0;
1231 ps = 0;
1232 ks = self->inv_param_slot_diff[ps];
1233 ms = m_matrix[ps][pb][row][col];
1234 ls = m_matrix_prev[pb][row][col];
1235 fl_step = ks * (ms - ls);
1236 fl_base = ls + fl_step;
1237
1238 for (i = 1; i <= (WORD32)self->param_slot_diff[0]; i++) {
1239 r_matrix_float[ts][pb][row][col] = fl_base;
1240 fl_base += fl_step;
1241 ts++;
1242 }
1243 if (bs_high_rate_mode) {
1244 for (ps = 1; ps < self->num_parameter_sets; ps++) {
1245 ks = self->inv_param_slot_diff[ps];
1246 ms = m_matrix[ps][pb][row][col];
1247 ls = m_matrix[ps - 1][pb][row][col];
1248 fl_step = ks * (ms - ls);
1249 fl_base = ls + fl_step;
1250
1251 for (i = 1; i <= self->param_slot_diff[ps]; i++) {
1252 r_matrix_float[ts][pb][row][col] = fl_base;
1253 fl_base += fl_step;
1254 ts++;
1255 }
1256 }
1257 }
1258 }
1259 }
1260 }
1261 return;
1262 }
1263
ixheaacd_mps_upmix_interp_type2(FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],WORD32 num_rows,ia_mps_dec_state_struct * self,WORD32 col)1264 VOID ixheaacd_mps_upmix_interp_type2(
1265 FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
1266 FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
1267 FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT], WORD32 num_rows,
1268 ia_mps_dec_state_struct *self, WORD32 col) {
1269 WORD32 ts, ps, pb, row, i;
1270 FLOAT32 ks, ms, ls;
1271 FLOAT32 fl_step, fl_base;
1272
1273 for (pb = 0; pb < self->bs_param_bands; pb++) {
1274 for (row = 0; row < num_rows; row++) {
1275 ts = 0;
1276 ps = 0;
1277 ks = self->inv_param_slot_diff[ps];
1278 ms = m_matrix[ps][pb][row][col];
1279 ls = m_matrix_prev[pb][row][col];
1280 fl_step = ks * (ms - ls);
1281 fl_base = ls + fl_step;
1282
1283 for (i = 1; i <= (WORD32)self->param_slot_diff[0]; i++) {
1284 r_matrix_float[ts][pb][row][col] = fl_base;
1285 fl_base += fl_step;
1286 ts++;
1287 }
1288 for (ps = 1; ps < self->num_parameter_sets; ps++) {
1289 ks = self->inv_param_slot_diff[ps];
1290 ms = m_matrix[ps][pb][row][col];
1291 ls = m_matrix[ps - 1][pb][row][col];
1292 fl_step = ks * (ms - ls);
1293 fl_base = ls + fl_step;
1294
1295 for (i = 1; i <= (WORD32)self->param_slot_diff[ps]; i++) {
1296 r_matrix_float[ts][pb][row][col] = fl_base;
1297 fl_base += fl_step;
1298 ts++;
1299 }
1300 }
1301 }
1302 }
1303 return;
1304 }
1305
ixheaacd_mps_angle_interpolation(FLOAT32 angle1,FLOAT32 angle2,FLOAT32 alpha,FLOAT32 * step)1306 static FLOAT32 ixheaacd_mps_angle_interpolation(FLOAT32 angle1, FLOAT32 angle2,
1307 FLOAT32 alpha, FLOAT32 *step) {
1308 while (angle2 - angle1 > (FLOAT32)P_PI) {
1309 angle1 = angle1 + 2.0f * (FLOAT32)P_PI;
1310 }
1311 while (angle1 - angle2 > (FLOAT32)P_PI) {
1312 angle2 = angle2 + 2.0f * (FLOAT32)P_PI;
1313 }
1314 *step = angle2 - angle1;
1315 return (1 - alpha) * angle1 + alpha * angle2;
1316 }
1317
ixheaacd_mps_phase_interpolation(FLOAT32 pl[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],FLOAT32 pr[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],FLOAT32 pl_prev[MAX_PARAMETER_BANDS],FLOAT32 pr_prev[MAX_PARAMETER_BANDS],FLOAT32 r_re[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][2],FLOAT32 r_im[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][2],ia_mps_dec_state_struct * self)1318 VOID ixheaacd_mps_phase_interpolation(
1319 FLOAT32 pl[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],
1320 FLOAT32 pr[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],
1321 FLOAT32 pl_prev[MAX_PARAMETER_BANDS], FLOAT32 pr_prev[MAX_PARAMETER_BANDS],
1322 FLOAT32 r_re[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][2],
1323 FLOAT32 r_im[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][2],
1324 ia_mps_dec_state_struct *self) {
1325 WORD32 i, ts, ps, pb;
1326 FLOAT32 step_l, step_r, alpha, tl, tr;
1327 for (pb = 0; pb < self->bs_param_bands; pb++) {
1328 ps = 0;
1329 ts = 0;
1330 alpha = (FLOAT32)self->inv_param_slot_diff[ps];
1331 tl = ixheaacd_mps_angle_interpolation(pl_prev[pb], pl[ps][pb], alpha,
1332 &step_l);
1333 tr = ixheaacd_mps_angle_interpolation(pr_prev[pb], pr[ps][pb], alpha,
1334 &step_r);
1335 step_l *= alpha;
1336 step_r *= alpha;
1337
1338 for (i = 1; i <= self->param_slot_diff[ps]; i++) {
1339 r_re[ts][pb][0] = (FLOAT32)cos(tl);
1340 r_im[ts][pb][0] = (FLOAT32)sin(tl);
1341 tl += step_l;
1342
1343 r_re[ts][pb][1] = (FLOAT32)cos(tr);
1344 r_im[ts][pb][1] = (FLOAT32)sin(tr);
1345 tr += step_r;
1346 ts++;
1347 }
1348
1349 for (ps = 1; ps < self->num_parameter_sets; ps++) {
1350 FLOAT32 alpha = self->inv_param_slot_diff[ps];
1351 tl = ixheaacd_mps_angle_interpolation(pl[ps - 1][pb], pl[ps][pb], alpha,
1352 &step_l);
1353 tr = ixheaacd_mps_angle_interpolation(pr[ps - 1][pb], pr[ps][pb], alpha,
1354 &step_r);
1355 step_l *= alpha;
1356 step_r *= alpha;
1357 for (i = 1; i <= self->param_slot_diff[ps]; i++) {
1358 if (ts < 72 && pb < 28) {
1359 r_re[ts][pb][0] = (FLOAT32)cos(tl);
1360 r_im[ts][pb][0] = (FLOAT32)sin(tl);
1361 tl += step_l;
1362
1363 r_re[ts][pb][1] = (FLOAT32)cos(tr);
1364 r_im[ts][pb][1] = (FLOAT32)sin(tr);
1365 tr += step_r;
1366 }
1367 ts++;
1368
1369 if (ts > 71) {
1370 ts = 0;
1371 break;
1372 }
1373 if (pb > 27) {
1374 pb = 0;
1375 break;
1376 }
1377 }
1378 }
1379 }
1380 }
1381
ixheaacd_mps_init_pre_and_post_matrix(ia_mps_dec_state_struct * self)1382 VOID ixheaacd_mps_init_pre_and_post_matrix(ia_mps_dec_state_struct *self) {
1383 memset(self->m1_param_re_prev, 0,
1384 MAX_PARAMETER_BANDS * MAX_M_OUTPUT * MAX_M_INPUT * sizeof(WORD32));
1385 memset(self->m1_param_im_prev, 0,
1386 MAX_PARAMETER_BANDS * MAX_M_OUTPUT * MAX_M_INPUT * sizeof(WORD32));
1387 memset(self->m1_param_re_prev, 0,
1388 MAX_PARAMETER_BANDS * MAX_M_OUTPUT * MAX_M_INPUT * sizeof(WORD32));
1389 memset(self->m2_decor_re_prev, 0,
1390 MAX_PARAMETER_BANDS * MAX_M_OUTPUT * MAX_M_INPUT * sizeof(WORD32));
1391 memset(self->m2_resid_re_prev, 0,
1392 MAX_PARAMETER_BANDS * MAX_M_OUTPUT * MAX_M_INPUT * sizeof(WORD32));
1393 memset(self->m2_resid_im_prev, 0,
1394 MAX_PARAMETER_BANDS * MAX_M_OUTPUT * MAX_M_INPUT * sizeof(WORD32));
1395 }
1396