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 "ixheaacd_type_def.h"
21 #include "ixheaacd_mps_struct_def.h"
22 #include "ixheaacd_mps_res_rom.h"
23 #include "ixheaacd_mps_aac_struct.h"
24 #include "ixheaacd_constants.h"
25 #include "ixheaacd_basic_ops32.h"
26 #include "ixheaacd_basic_ops16.h"
27 #include "ixheaacd_basic_ops40.h"
28 #include "ixheaacd_bitbuffer.h"
29 #include "ixheaacd_common_rom.h"
30 #include "ixheaacd_sbrdecsettings.h"
31 #include "ixheaacd_sbr_scale.h"
32 #include "ixheaacd_env_extr_part.h"
33 #include "ixheaacd_sbr_rom.h"
34 #include "ixheaacd_hybrid.h"
35 #include "ixheaacd_ps_dec.h"
36 #include "ixheaacd_error_standards.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_macro_def.h"
42 #include "ixheaacd_mps_basic_op.h"
43 #include "ixheaacd_mps_calc_m1m2_common.h"
44
ixheaacd_calc_m1m2_5151(ia_heaac_mps_state_struct * pstr_mps_state)45 VOID ixheaacd_calc_m1m2_5151(ia_heaac_mps_state_struct *pstr_mps_state) {
46 ia_mps_dec_auxilary_struct *p_aux_struct = pstr_mps_state->aux_struct;
47 ia_mps_dec_m2_param_struct *m2_param = p_aux_struct->m2_param;
48 ia_mps_dec_m1_param_struct *m1_param = pstr_mps_state->array_struct->m1_param;
49 ia_heaac_mps_state_struct *curr_state = pstr_mps_state;
50 WORD32 ps, pb;
51 WORD32 *h11_fs, *h11_c;
52 WORD32 *h12_fs, *h12_c;
53 WORD32 *h21_fs, *h21_c;
54 WORD32 *h22_fs, *h22_c;
55 WORD32 *h12_res_fs, *h12_res_c;
56 WORD32 *h22_res_fs, *h22_res_c;
57 WORD16 *c_l_fs, *c_l_c;
58 WORD16 *c_r_fs, *c_r_c;
59
60 WORD32 *h11_f, *h11_s;
61 WORD32 *h12_f, *h12_s;
62 WORD32 *h21_f, *h21_s;
63 WORD32 *h22_f, *h22_s;
64 WORD32 *h12_res_f, *h12_res_s, *c_r_clfe;
65 WORD32 *h22_res_f, *h22_res_s, *c_l_clfe;
66 WORD16 *c_l_f, *c_l_s;
67 WORD16 *c_r_f, *c_r_s;
68
69 WORD32 idx;
70 WORD32 residual_coding = pstr_mps_state->residual_coding;
71 WORD32 num_parameter_sets = pstr_mps_state->num_parameter_sets;
72 WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands;
73 WORD32 arbitrary_downmix = pstr_mps_state->arbitrary_downmix;
74 WORD32 *res_bands = pstr_mps_state->res_bands;
75
76 h11_fs = pstr_mps_state->mps_scratch_mem_v;
77 h11_c = h11_fs + MAX_PARAMETER_BANDS;
78 h12_fs = h11_c + MAX_PARAMETER_BANDS;
79 h12_c = h12_fs + MAX_PARAMETER_BANDS;
80 h21_fs = h12_c + MAX_PARAMETER_BANDS;
81 h21_c = h21_fs + MAX_PARAMETER_BANDS;
82 h22_fs = h21_c + MAX_PARAMETER_BANDS;
83 h22_c = h22_fs + MAX_PARAMETER_BANDS;
84 h12_res_fs = h22_c + MAX_PARAMETER_BANDS;
85 h12_res_c = h12_res_fs + MAX_PARAMETER_BANDS;
86 h22_res_fs = h12_res_c + MAX_PARAMETER_BANDS;
87 h22_res_c = h22_res_fs + MAX_PARAMETER_BANDS;
88 h11_f = h22_res_c + MAX_PARAMETER_BANDS;
89 h11_s = h11_f + MAX_PARAMETER_BANDS;
90 h12_f = h11_s + MAX_PARAMETER_BANDS;
91 h12_s = h12_f + MAX_PARAMETER_BANDS;
92 h21_f = h12_s + MAX_PARAMETER_BANDS;
93 h21_s = h21_f + MAX_PARAMETER_BANDS;
94 h22_f = h21_s + MAX_PARAMETER_BANDS;
95 h22_s = h22_f + MAX_PARAMETER_BANDS;
96 h12_res_f = h22_s + MAX_PARAMETER_BANDS;
97 h12_res_s = h12_res_f + MAX_PARAMETER_BANDS;
98 h22_res_f = h12_res_s + MAX_PARAMETER_BANDS;
99 h22_res_s = h22_res_f + MAX_PARAMETER_BANDS;
100 c_r_clfe = h22_res_s + MAX_PARAMETER_BANDS;
101 c_l_clfe = c_r_clfe + MAX_PARAMETER_BANDS;
102
103 c_l_fs = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX52;
104 c_l_c = c_l_fs + MAX_PARAMETER_BANDS;
105 c_r_fs = c_l_c + MAX_PARAMETER_BANDS;
106 c_r_c = c_r_fs + MAX_PARAMETER_BANDS;
107 c_l_f = c_r_c + MAX_PARAMETER_BANDS;
108 c_l_s = c_l_f + MAX_PARAMETER_BANDS;
109 c_r_f = c_l_s + MAX_PARAMETER_BANDS;
110 c_r_s = c_r_f + MAX_PARAMETER_BANDS;
111
112 for (ps = 0; ps < num_parameter_sets; ps++) {
113 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_fs, h12_fs, h21_fs, h22_fs, h12_res_fs,
114 h22_res_fs, c_l_fs, c_r_fs, 0, ps, res_bands[0]);
115 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_c, h12_c, h21_c, h22_c, h12_res_c, h22_res_c,
116 c_l_c, c_r_c, 1, ps, res_bands[1]);
117 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_s, h12_s, h21_s, h22_s, h12_res_s, h22_res_s,
118 c_l_s, c_r_s, 2, ps, res_bands[2]);
119 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_f, h12_f, h21_f, h22_f, h12_res_f, h22_res_f,
120 c_l_f, c_r_f, 3, ps, res_bands[3]);
121
122 for (pb = 0; pb < p_aux_struct->num_ott_bands[4]; pb++) {
123 ia_mps_dec_spatial_bs_frame_struct *p_cur_bs = pstr_mps_state->bs_frame;
124 c_l_clfe[pb] = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr
125 ->r1_matrix_l[p_cur_bs->ott_cld_idx[4][ps][pb] + 15];
126 c_r_clfe[pb] = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr
127 ->r1_matrix_l[15 - p_cur_bs->ott_cld_idx[4][ps][pb]];
128 }
129
130 for (pb = p_aux_struct->num_ott_bands[4]; pb < num_parameter_bands; pb++) {
131 c_l_clfe[pb] = ONE_IN_Q15;
132 c_r_clfe[pb] = 0;
133 }
134
135 for (pb = 0; pb < num_parameter_bands; pb++) {
136 m1_param->m1_param_real[0][0][ps][pb] = ONE_IN_Q15;
137 m1_param->m1_param_real[1][0][ps][pb] = ONE_IN_Q15;
138 m1_param->m1_param_real[2][0][ps][pb] = c_l_fs[pb];
139 m1_param->m1_param_real[3][0][ps][pb] = ixheaacd_mult16_shl(c_l_fs[pb], c_l_c[pb]);
140 m1_param->m1_param_real[4][0][ps][pb] = c_r_fs[pb];
141 }
142
143 for (pb = 0; pb < num_parameter_bands; pb++) {
144 m2_param->m2_decor_real[0][ps][pb] = ixheaacd_mps_mult32_shr_15(
145 h11_f[pb], ixheaacd_mps_mult32_shr_15(h11_c[pb], h12_fs[pb]));
146 m2_param->m2_decor_real[1][ps][pb] = ixheaacd_mps_mult32_shr_15(h11_f[pb], h12_c[pb]);
147 m2_param->m2_decor_real[2][ps][pb] = h12_f[pb];
148
149 m2_param->m2_decor_real[3][ps][pb] = ixheaacd_mps_mult32_shr_15(
150 h21_f[pb], ixheaacd_mps_mult32_shr_15(h11_c[pb], h12_fs[pb]));
151 m2_param->m2_decor_real[4][ps][pb] = ixheaacd_mps_mult32_shr_15(h21_f[pb], h12_c[pb]);
152 m2_param->m2_decor_real[5][ps][pb] = h22_f[pb];
153
154 m2_param->m2_decor_real[6][ps][pb] = ixheaacd_mps_mult32_shr_15(
155 c_l_clfe[pb], ixheaacd_mps_mult32_shr_15(h21_c[pb], h12_fs[pb]));
156 m2_param->m2_decor_real[7][ps][pb] = ixheaacd_mps_mult32_shr_15(c_l_clfe[pb], h22_c[pb]);
157
158 m2_param->m2_decor_real[8][ps][pb] = ixheaacd_mps_mult32_shr_15(h11_s[pb], h22_fs[pb]);
159 m2_param->m2_decor_real[9][ps][pb] = h12_s[pb];
160
161 m2_param->m2_decor_real[10][ps][pb] = ixheaacd_mps_mult32_shr_15(h21_s[pb], h22_fs[pb]);
162 m2_param->m2_decor_real[11][ps][pb] = h22_s[pb];
163 }
164
165 for (pb = 0; pb < num_parameter_bands; pb++) {
166 idx = 0;
167
168 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
169 h11_f[pb], ixheaacd_mps_mult32_shr_15(h11_c[pb], h11_fs[pb]));
170
171 if (residual_coding) {
172 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
173 h11_f[pb], ixheaacd_mps_mult32_shr_15(h11_c[pb], h12_res_fs[pb]));
174 m2_param->m2_resid_real[idx++][ps][pb] =
175 ixheaacd_mps_mult32_shr_15(h11_f[pb], h12_res_c[pb]);
176 m2_param->m2_resid_real[idx++][ps][pb] = h12_res_f[pb];
177 }
178
179 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
180 h21_f[pb], ixheaacd_mps_mult32_shr_15(h11_c[pb], h11_fs[pb]));
181
182 if (residual_coding) {
183 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
184 h21_f[pb], ixheaacd_mps_mult32_shr_15(h11_c[pb], h12_res_fs[pb]));
185 m2_param->m2_resid_real[idx++][ps][pb] =
186 ixheaacd_mps_mult32_shr_15(h21_f[pb], h12_res_c[pb]);
187 m2_param->m2_resid_real[idx++][ps][pb] = h22_res_f[pb];
188 }
189
190 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
191 c_l_clfe[pb], ixheaacd_mps_mult32_shr_15(h21_c[pb], h11_fs[pb]));
192
193 if (residual_coding) {
194 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
195 c_l_clfe[pb], ixheaacd_mps_mult32_shr_15(h21_c[pb], h12_res_fs[pb]));
196 m2_param->m2_resid_real[idx++][ps][pb] =
197 ixheaacd_mps_mult32_shr_15(c_l_clfe[pb], h22_res_c[pb]);
198 }
199
200 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
201 c_r_clfe[pb], ixheaacd_mps_mult32_shr_15(c_r_c[pb], c_l_fs[pb]));
202
203 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(h11_s[pb], h21_fs[pb]);
204
205 if (residual_coding) {
206 m2_param->m2_resid_real[idx++][ps][pb] =
207 ixheaacd_mps_mult32_shr_15(h11_s[pb], h22_res_fs[pb]);
208 m2_param->m2_resid_real[idx++][ps][pb] = h12_res_s[pb];
209 }
210
211 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(h21_s[pb], h21_fs[pb]);
212
213 if (residual_coding) {
214 m2_param->m2_resid_real[idx++][ps][pb] =
215 ixheaacd_mps_mult32_shr_15(h21_s[pb], h22_res_fs[pb]);
216 m2_param->m2_resid_real[idx++][ps][pb] = h22_res_s[pb];
217 }
218 }
219 }
220
221 if (arbitrary_downmix > 0) {
222 for (ps = 0; ps < num_parameter_sets; ps++) {
223 for (pb = 0; pb < num_parameter_bands; pb++) {
224 WORD32 g_real[1];
225 ixheaacd_calculate_arb_dmx_mtx(pstr_mps_state, ps, pb, g_real);
226
227 if (arbitrary_downmix == 2) {
228 m1_param->m1_param_real[0][1][ps][pb] = m1_param->m1_param_real[0][0][ps][pb];
229 m1_param->m1_param_real[1][1][ps][pb] = m1_param->m1_param_real[1][0][ps][pb];
230 m1_param->m1_param_real[2][1][ps][pb] = m1_param->m1_param_real[2][0][ps][pb];
231 m1_param->m1_param_real[3][1][ps][pb] = m1_param->m1_param_real[3][0][ps][pb];
232 m1_param->m1_param_real[4][1][ps][pb] = m1_param->m1_param_real[4][0][ps][pb];
233
234 curr_state->m1_param_present[0][1] = 1;
235 curr_state->m1_param_present[1][1] = 1;
236 curr_state->m1_param_present[2][1] = 1;
237 curr_state->m1_param_present[3][1] = 1;
238 curr_state->m1_param_present[4][1] = 1;
239 }
240
241 m1_param->m1_param_real[0][0][ps][pb] =
242 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[0][0][ps][pb], g_real[0]);
243 m1_param->m1_param_real[1][0][ps][pb] =
244 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[1][0][ps][pb], g_real[0]);
245 m1_param->m1_param_real[2][0][ps][pb] =
246 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[2][0][ps][pb], g_real[0]);
247 m1_param->m1_param_real[3][0][ps][pb] =
248 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[3][0][ps][pb], g_real[0]);
249 m1_param->m1_param_real[4][0][ps][pb] =
250 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[4][0][ps][pb], g_real[0]);
251 }
252 }
253 }
254 return;
255 }
256
ixheaacd_calc_m1m2_5152(ia_heaac_mps_state_struct * pstr_mps_state)257 VOID ixheaacd_calc_m1m2_5152(ia_heaac_mps_state_struct *pstr_mps_state) {
258 ia_mps_dec_auxilary_struct *p_aux_struct = pstr_mps_state->aux_struct;
259 ia_mps_dec_m2_param_struct *m2_param = p_aux_struct->m2_param;
260 ia_mps_dec_m1_param_struct *m1_param = pstr_mps_state->array_struct->m1_param;
261 ia_heaac_mps_state_struct *curr_state = pstr_mps_state;
262 WORD32 ps, pb;
263
264 WORD32 *h11_lr, *h11_c, *h12_lr, *h12_c, *h21_lr, *h21_c, *h22_lr, *h22_c, *h12_res_lr,
265 *h12_res_c, *h22_res_lr, *h22_res_c;
266 WORD16 *c_l_lr, *c_l_c, *c_r_lr, *c_r_c;
267
268 WORD32 *h11_l, *h11_r, *h12_l, *h12_r, *h21_l, *h21_r, *h22_l, *h22_r, *h12_res_l, *h12_res_r,
269 *h22_res_l, *h22_res_r, *c_l_clfe, *c_r_clfe;
270 WORD16 *c_l_l, *c_l_r, *c_r_l, *c_r_r;
271
272 WORD32 idx;
273 WORD32 num_parameter_sets = pstr_mps_state->num_parameter_sets;
274 WORD32 residual_coding = pstr_mps_state->residual_coding;
275 WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands;
276 WORD32 arbitrary_downmix = pstr_mps_state->arbitrary_downmix;
277 WORD32 *res_bands = pstr_mps_state->res_bands;
278
279 h11_lr = pstr_mps_state->mps_scratch_mem_v;
280 h11_c = h11_lr + MAX_PARAMETER_BANDS;
281 h12_lr = h11_c + MAX_PARAMETER_BANDS;
282 h12_c = h12_lr + MAX_PARAMETER_BANDS;
283 h21_lr = h12_c + MAX_PARAMETER_BANDS;
284 h21_c = h21_lr + MAX_PARAMETER_BANDS;
285 h22_lr = h21_c + MAX_PARAMETER_BANDS;
286 h22_c = h22_lr + MAX_PARAMETER_BANDS;
287 h12_res_lr = h22_c + MAX_PARAMETER_BANDS;
288 h12_res_c = h12_res_lr + MAX_PARAMETER_BANDS;
289 h22_res_lr = h12_res_c + MAX_PARAMETER_BANDS;
290 h22_res_c = h22_res_lr + MAX_PARAMETER_BANDS;
291 h11_l = h22_res_c + MAX_PARAMETER_BANDS;
292 h11_r = h11_l + MAX_PARAMETER_BANDS;
293 h12_l = h11_r + MAX_PARAMETER_BANDS;
294 h12_r = h12_l + MAX_PARAMETER_BANDS;
295 h21_l = h12_r + MAX_PARAMETER_BANDS;
296 h21_r = h21_l + MAX_PARAMETER_BANDS;
297 h22_l = h21_r + MAX_PARAMETER_BANDS;
298 h22_r = h22_l + MAX_PARAMETER_BANDS;
299 h12_res_l = h22_r + MAX_PARAMETER_BANDS;
300 h12_res_r = h12_res_l + MAX_PARAMETER_BANDS;
301 h22_res_l = h12_res_r + MAX_PARAMETER_BANDS;
302 h22_res_r = h22_res_l + MAX_PARAMETER_BANDS;
303 c_r_clfe = h22_res_r + MAX_PARAMETER_BANDS;
304 c_l_clfe = c_r_clfe + MAX_PARAMETER_BANDS;
305
306 c_l_lr = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX52;
307 c_l_c = c_l_lr + MAX_PARAMETER_BANDS;
308 c_r_lr = c_l_c + MAX_PARAMETER_BANDS;
309 c_r_c = c_r_lr + MAX_PARAMETER_BANDS;
310 c_l_l = c_r_c + MAX_PARAMETER_BANDS;
311 c_l_r = c_l_l + MAX_PARAMETER_BANDS;
312 c_r_l = c_l_r + MAX_PARAMETER_BANDS;
313 c_r_r = c_r_l + MAX_PARAMETER_BANDS;
314
315 for (ps = 0; ps < num_parameter_sets; ps++) {
316 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_c, h12_c, h21_c, h22_c, h12_res_c, h22_res_c,
317 c_l_c, c_r_c, 0, ps, res_bands[0]);
318 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_lr, h12_lr, h21_lr, h22_lr, h12_res_lr,
319 h22_res_lr, c_l_lr, c_r_lr, 1, ps, res_bands[1]);
320 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_l, h12_l, h21_l, h22_l, h12_res_l, h22_res_l,
321 c_l_l, c_r_l, 3, ps, res_bands[3]);
322 ixheaacd_param_2_umx_ps(pstr_mps_state, h11_r, h12_r, h21_r, h22_r, h12_res_r, h22_res_r,
323 c_l_r, c_r_r, 4, ps, res_bands[4]);
324
325 for (pb = 0; pb < p_aux_struct->num_ott_bands[2]; pb++) {
326 ia_mps_dec_spatial_bs_frame_struct *p_cur_bs = pstr_mps_state->bs_frame;
327 c_l_clfe[pb] = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr
328 ->r1_matrix_l[p_cur_bs->ott_cld_idx[2][ps][pb] + 15];
329 c_r_clfe[pb] = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr
330 ->r1_matrix_l[15 - p_cur_bs->ott_cld_idx[2][ps][pb]];
331 }
332
333 for (pb = p_aux_struct->num_ott_bands[2]; pb < num_parameter_bands; pb++) {
334 c_l_clfe[pb] = ONE_IN_Q15;
335 c_r_clfe[pb] = 0;
336 }
337
338 for (pb = 0; pb < num_parameter_bands; pb++) {
339 m1_param->m1_param_real[0][0][ps][pb] = ONE_IN_Q15;
340 m1_param->m1_param_real[1][0][ps][pb] = ONE_IN_Q15;
341 m1_param->m1_param_real[2][0][ps][pb] = c_l_c[pb];
342 m1_param->m1_param_real[3][0][ps][pb] = ixheaacd_mult16_shl(c_l_c[pb], c_l_lr[pb]);
343 m1_param->m1_param_real[4][0][ps][pb] = ixheaacd_mult16_shl(c_l_c[pb], c_r_lr[pb]);
344 }
345
346 for (pb = 0; pb < num_parameter_bands; pb++) {
347 m2_param->m2_decor_real[0][ps][pb] = ixheaacd_mps_mult32_shr_15(
348 h11_l[pb], ixheaacd_mps_mult32_shr_15(h11_lr[pb], h12_c[pb]));
349 m2_param->m2_decor_real[1][ps][pb] = ixheaacd_mps_mult32_shr_15(h11_l[pb], h12_lr[pb]);
350 m2_param->m2_decor_real[2][ps][pb] = h12_l[pb];
351
352 m2_param->m2_decor_real[3][ps][pb] = ixheaacd_mps_mult32_shr_15(
353 h21_l[pb], ixheaacd_mps_mult32_shr_15(h11_lr[pb], h12_c[pb]));
354 m2_param->m2_decor_real[4][ps][pb] = ixheaacd_mps_mult32_shr_15(h21_l[pb], h12_lr[pb]);
355 m2_param->m2_decor_real[5][ps][pb] = h22_l[pb];
356
357 m2_param->m2_decor_real[6][ps][pb] = ixheaacd_mps_mult32_shr_15(
358 h11_r[pb], ixheaacd_mps_mult32_shr_15(h21_lr[pb], h12_c[pb]));
359 m2_param->m2_decor_real[7][ps][pb] = ixheaacd_mps_mult32_shr_15(h11_r[pb], h22_lr[pb]);
360 m2_param->m2_decor_real[8][ps][pb] = h12_r[pb];
361
362 m2_param->m2_decor_real[9][ps][pb] = ixheaacd_mps_mult32_shr_15(
363 h21_r[pb], ixheaacd_mps_mult32_shr_15(h21_lr[pb], h12_c[pb]));
364 m2_param->m2_decor_real[10][ps][pb] = ixheaacd_mps_mult32_shr_15(h21_r[pb], h22_lr[pb]);
365 m2_param->m2_decor_real[11][ps][pb] = h22_r[pb];
366
367 m2_param->m2_decor_real[12][ps][pb] = ixheaacd_mps_mult32_shr_15(c_l_clfe[pb], h22_c[pb]);
368 }
369
370 for (pb = 0; pb < num_parameter_bands; pb++) {
371 idx = 0;
372
373 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
374 h11_l[pb], ixheaacd_mps_mult32_shr_15(h11_lr[pb], h11_c[pb]));
375
376 if (residual_coding) {
377 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
378 h11_l[pb], ixheaacd_mps_mult32_shr_15(h11_lr[pb], h12_res_c[pb]));
379 m2_param->m2_resid_real[idx++][ps][pb] =
380 ixheaacd_mps_mult32_shr_15(h11_l[pb], h12_res_lr[pb]);
381 m2_param->m2_resid_real[idx++][ps][pb] = h12_res_l[pb];
382 }
383
384 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
385 h21_l[pb], ixheaacd_mps_mult32_shr_15(h11_lr[pb], h11_c[pb]));
386
387 if (residual_coding) {
388 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
389 h21_l[pb], ixheaacd_mps_mult32_shr_15(h11_lr[pb], h12_res_c[pb]));
390 m2_param->m2_resid_real[idx++][ps][pb] =
391 ixheaacd_mps_mult32_shr_15(h21_l[pb], h12_res_lr[pb]);
392 m2_param->m2_resid_real[idx++][ps][pb] = h22_res_l[pb];
393 }
394
395 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
396 h11_r[pb], ixheaacd_mps_mult32_shr_15(h21_lr[pb], h11_c[pb]));
397
398 if (residual_coding) {
399 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
400 h11_r[pb], ixheaacd_mps_mult32_shr_15(h21_lr[pb], h12_res_c[pb]));
401 m2_param->m2_resid_real[idx++][ps][pb] =
402 ixheaacd_mps_mult32_shr_15(h11_r[pb], h22_res_lr[pb]);
403 m2_param->m2_resid_real[idx++][ps][pb] = h12_res_r[pb];
404 }
405
406 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
407 h21_r[pb], ixheaacd_mps_mult32_shr_15(h21_lr[pb], h11_c[pb]));
408
409 if (residual_coding) {
410 m2_param->m2_resid_real[idx++][ps][pb] = ixheaacd_mps_mult32_shr_15(
411 h21_r[pb], ixheaacd_mps_mult32_shr_15(h21_lr[pb], h12_res_c[pb]));
412 m2_param->m2_resid_real[idx++][ps][pb] =
413 ixheaacd_mps_mult32_shr_15(h21_r[pb], h22_res_lr[pb]);
414 m2_param->m2_resid_real[idx++][ps][pb] = h22_res_r[pb];
415 }
416
417 m2_param->m2_resid_real[idx++][ps][pb] =
418 ixheaacd_mps_mult32_shr_15(c_l_clfe[pb], h21_c[pb]);
419
420 if (residual_coding)
421 m2_param->m2_resid_real[idx++][ps][pb] =
422 ixheaacd_mps_mult32_shr_15(c_l_clfe[pb], h22_res_c[pb]);
423
424 m2_param->m2_resid_real[idx++][ps][pb] =
425 ixheaacd_mps_mult32_shr_15(c_r_c[pb], c_r_clfe[pb]);
426 }
427 }
428
429 if (arbitrary_downmix > 0) {
430 for (ps = 0; ps < num_parameter_sets; ps++) {
431 for (pb = 0; pb < num_parameter_bands; pb++) {
432 WORD32 g_real[1];
433 ixheaacd_calculate_arb_dmx_mtx(pstr_mps_state, ps, pb, g_real);
434
435 if (arbitrary_downmix == 2) {
436 m1_param->m1_param_real[0][1][ps][pb] = m1_param->m1_param_real[0][0][ps][pb];
437 m1_param->m1_param_real[1][1][ps][pb] = m1_param->m1_param_real[1][0][ps][pb];
438 m1_param->m1_param_real[2][1][ps][pb] = m1_param->m1_param_real[2][0][ps][pb];
439 m1_param->m1_param_real[3][1][ps][pb] = m1_param->m1_param_real[3][0][ps][pb];
440 m1_param->m1_param_real[4][1][ps][pb] = m1_param->m1_param_real[4][0][ps][pb];
441
442 curr_state->m1_param_present[0][1] = 1;
443 curr_state->m1_param_present[1][1] = 1;
444 curr_state->m1_param_present[2][1] = 1;
445 curr_state->m1_param_present[3][1] = 1;
446 curr_state->m1_param_present[4][1] = 1;
447 }
448
449 m1_param->m1_param_real[0][0][ps][pb] =
450 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[0][0][ps][pb], g_real[0]);
451 m1_param->m1_param_real[1][0][ps][pb] =
452 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[1][0][ps][pb], g_real[0]);
453 m1_param->m1_param_real[2][0][ps][pb] =
454 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[2][0][ps][pb], g_real[0]);
455 m1_param->m1_param_real[3][0][ps][pb] =
456 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[3][0][ps][pb], g_real[0]);
457 m1_param->m1_param_real[4][0][ps][pb] =
458 ixheaacd_mps_mult32_shr_15(m1_param->m1_param_real[4][0][ps][pb], g_real[0]);
459 }
460 }
461 }
462 return;
463 }
464