Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : #include <stdint.h>
34 : #include "options.h"
35 : #include <math.h>
36 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
37 : #include <string.h>
38 : #endif
39 : #include "ivas_prot.h"
40 : #include "prot.h"
41 : #include "isar_rom_post_rend.h"
42 : #include "isar_prot.h"
43 : #ifdef DEBUGGING
44 : #include "debug.h"
45 : #endif
46 : #include "wmc_auto.h"
47 :
48 :
49 : /*---------------------------------------------------------------------*
50 : * Local function declarations
51 : *---------------------------------------------------------------------*/
52 :
53 : static void isar_SplitRenderer_PostRenderer( ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_RealBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const IVAS_QUATERNION Quaternion_act );
54 :
55 :
56 : /*-------------------------------------------------------------------------
57 : * isar_splitBinPostRendOpen()
58 : *
59 : *
60 : *------------------------------------------------------------------------*/
61 :
62 3584 : ivas_error isar_splitBinPostRendOpen(
63 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend, /* i/o: binaural post-renderer handle */
64 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
65 : const int32_t output_Fs /* i : output sampling rate */
66 : )
67 : {
68 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinRend;
69 : ivas_error error;
70 : int16_t ch;
71 :
72 3584 : if ( ( hBinRend = (ISAR_BIN_HR_SPLIT_POST_REND_HANDLE) malloc( sizeof( ISAR_BIN_HR_SPLIT_POST_REND ) ) ) == NULL )
73 : {
74 0 : return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for bin split post renderer Module \n" ) );
75 : }
76 :
77 10752 : for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
78 : {
79 7168 : hBinRend->cldfbSyn[ch] = NULL;
80 7168 : hBinRend->cldfbAna[ch] = NULL;
81 : }
82 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
83 : for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ )
84 : {
85 : for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
86 : {
87 : hBinRend->cldfbSynReconsBinDec[i][ch] = NULL;
88 : }
89 : }
90 : #endif
91 :
92 10752 : for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
93 : {
94 7168 : if ( ( error = openCldfb( &( hBinRend->cldfbSyn[ch] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
95 : {
96 0 : return error;
97 : }
98 7168 : if ( ( error = openCldfb( &( hBinRend->cldfbAna[ch] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
99 : {
100 0 : return error;
101 : }
102 : }
103 :
104 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
105 : for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ )
106 : {
107 : for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
108 : {
109 : if ( ( error = openCldfb( &( hBinRend->cldfbSynReconsBinDec[i][ch] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
110 : {
111 : return error;
112 : }
113 : }
114 : }
115 : #endif
116 3584 : hBinRend->cf_flag = 0;
117 3584 : set_fix_rotation_mat( hBinRend->fix_pos_rot_mat, pMultiBinPoseData );
118 3584 : set_pose_types( hBinRend->pose_type, pMultiBinPoseData );
119 3584 : isar_split_rend_init_huff_cfg( &hBinRend->huff_cfg );
120 3584 : *hBinHrSplitPostRend = hBinRend;
121 :
122 3584 : return IVAS_ERR_OK;
123 : }
124 :
125 :
126 : /*-------------------------------------------------------------------------
127 : * isar_splitBinPostRendClose()
128 : *
129 : *
130 : *------------------------------------------------------------------------*/
131 :
132 3584 : void isar_splitBinPostRendClose(
133 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend /* i/o: binaural post-renderer handle */
134 : )
135 : {
136 : int16_t ch;
137 :
138 3584 : if ( ( *hBinHrSplitPostRend ) != NULL )
139 : {
140 10752 : for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
141 : {
142 7168 : if ( ( *hBinHrSplitPostRend )->cldfbSyn[ch] != NULL )
143 : {
144 7168 : deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbSyn[ch] ) );
145 7168 : ( *hBinHrSplitPostRend )->cldfbSyn[ch] = NULL;
146 : }
147 7168 : if ( ( *hBinHrSplitPostRend )->cldfbAna[ch] != NULL )
148 : {
149 7168 : deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbAna[ch] ) );
150 7168 : ( *hBinHrSplitPostRend )->cldfbAna[ch] = NULL;
151 : }
152 : }
153 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
154 : for ( int16_t i = 0; i < MAX_HEAD_ROT_POSES; i++ )
155 : {
156 : for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
157 : {
158 : if ( ( *hBinHrSplitPostRend )->cldfbSynReconsBinDec[i][ch] != NULL )
159 : {
160 : deleteCldfb( &( ( *hBinHrSplitPostRend )->cldfbSynReconsBinDec[i][ch] ) );
161 : ( *hBinHrSplitPostRend )->cldfbSynReconsBinDec[i][ch] = NULL;
162 : }
163 : }
164 : }
165 : #endif
166 :
167 3584 : free( ( *hBinHrSplitPostRend ) );
168 3584 : ( *hBinHrSplitPostRend ) = NULL;
169 : }
170 :
171 3584 : return;
172 : }
173 :
174 :
175 : /*-----------------------------------------------------------------------------------------*
176 : * Function isar_split_rend_huffman_decode_opt()
177 : *
178 : *
179 : *-----------------------------------------------------------------------------------------*/
180 :
181 131487032 : static int16_t isar_split_rend_huffman_decode_opt(
182 : isar_split_rend_huffman_cfg_t *huff_cfg,
183 : ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */
184 : const int16_t *idx_trav_list )
185 : {
186 : int32_t i, ind, code, num_bits, code_b, num_bits_read;
187 : const int32_t *codebook;
188 :
189 131487032 : codebook = huff_cfg->codebook;
190 131487032 : num_bits_read = 0;
191 131487032 : ind = huff_cfg->codebook[0] - 1;
192 131487032 : code = 0;
193 633865395 : for ( i = 0; i < huff_cfg->sym_len; i++ )
194 : {
195 633865395 : codebook = codebook + idx_trav_list[i] * 3;
196 633865395 : num_bits = codebook[1];
197 633865395 : code_b = codebook[2];
198 633865395 : num_bits_read = num_bits - num_bits_read;
199 633865395 : code = code << num_bits_read;
200 633865395 : if ( num_bits_read > 0 )
201 : {
202 255160656 : code |= ISAR_SPLIT_REND_BITStream_read_int32( pBits, num_bits_read );
203 : }
204 :
205 633865395 : if ( code == code_b )
206 : {
207 131487032 : ind = codebook[0];
208 131487032 : break;
209 : }
210 :
211 502378363 : num_bits_read = num_bits;
212 502378363 : codebook = huff_cfg->codebook;
213 : }
214 :
215 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
216 : assert( ind >= huff_cfg->codebook[0] );
217 : #endif
218 131487032 : return (int16_t) ind;
219 : }
220 :
221 :
222 : /*-----------------------------------------------------------------------------------------*
223 : * Function isar_split_rend_unquant_md()
224 : *
225 : *
226 : *-----------------------------------------------------------------------------------------*/
227 :
228 32394760 : static void isar_split_rend_unquant_md(
229 : ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd,
230 : ISAR_SPLIT_REND_POSE_TYPE pose_type,
231 : const int16_t real_only,
232 : float fix_pos_rot_mat[][BINAURAL_CHANNELS],
233 : const float pred_quant_step )
234 : {
235 : int16_t ch1, ch2;
236 : int16_t gd_idx_min;
237 :
238 32394760 : if ( pose_type == PRED_ONLY || pose_type == PRED_ROLL_ONLY )
239 23155120 : {
240 : float quantstep;
241 :
242 23155120 : quantstep = pred_quant_step;
243 23155120 : if ( real_only )
244 : {
245 35592336 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
246 : {
247 71184672 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
248 : {
249 47456448 : hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * quantstep;
250 47456448 : hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + ( ( ch1 == ch2 ) ? 1.0f : 0.0f );
251 : }
252 : }
253 :
254 35592336 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
255 : {
256 71184672 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
257 : {
258 47456448 : hMd->pred_mat_im[ch1][ch2] = 0.0f;
259 : }
260 : }
261 : }
262 : else
263 : {
264 33873024 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
265 : {
266 67746048 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
267 : {
268 45164032 : hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re_idx[ch1][ch2] * quantstep;
269 45164032 : hMd->pred_mat_re[ch1][ch2] = hMd->pred_mat_re[ch1][ch2] + fix_pos_rot_mat[ch1][ch2];
270 : }
271 : }
272 :
273 33873024 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
274 : {
275 67746048 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
276 : {
277 45164032 : hMd->pred_mat_im[ch1][ch2] = hMd->pred_mat_im_idx[ch1][ch2] * quantstep;
278 : }
279 : }
280 : }
281 : }
282 9239640 : else if ( pose_type == COM_GAIN_ONLY )
283 : {
284 0 : gd_idx_min = (int16_t) roundf( ISAR_SPLIT_REND_D_1BYQ_STEP * ISAR_SPLIT_REND_D_MIN_VAL );
285 0 : hMd->gd_idx += gd_idx_min;
286 0 : hMd->gd = hMd->gd_idx * ISAR_SPLIT_REND_D_Q_STEP;
287 : }
288 9239640 : else if ( pose_type == LR_GAIN_ONLY )
289 : {
290 9239640 : gd_idx_min = (int16_t) roundf( ISAR_SPLIT_REND_PITCH_G_1BYQ_STEP * ISAR_SPLIT_REND_PITCH_G_MIN_VAL );
291 9239640 : hMd->gd_idx += gd_idx_min;
292 9239640 : hMd->gd = hMd->gd_idx * ISAR_SPLIT_REND_PITCH_G_Q_STEP;
293 :
294 9239640 : hMd->gd2_idx += gd_idx_min;
295 9239640 : hMd->gd2 = hMd->gd2_idx * ISAR_SPLIT_REND_PITCH_G_Q_STEP;
296 : }
297 : else
298 : {
299 0 : hMd->gd = 0.0f;
300 : }
301 :
302 32394760 : return;
303 : }
304 :
305 :
306 : /*-----------------------------------------------------------------------------------------*
307 : * Function isar_splitBinPostRendMdBase2Dec()
308 : *
309 : *
310 : *-----------------------------------------------------------------------------------------*/
311 :
312 4052 : static void isar_splitBinPostRendMdBase2Dec(
313 : ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */
314 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, /* i/o: binaural post-renderer handle */
315 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
316 : const int16_t num_subframes,
317 : const int16_t pred_real_bands_yaw,
318 : const int16_t pred_imag_bands_yaw,
319 : const int16_t pred_quant_pnts_yaw,
320 : const int16_t d_bands_yaw,
321 : const int16_t bands_pitch,
322 : const int16_t pred_real_bands_roll,
323 : const int16_t pred_imag_bands_roll )
324 : {
325 : int16_t sf_idx, pos_idx, b, ch1, ch2;
326 : int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len;
327 : int16_t min_pred_roll_idx, pred_roll_code_len;
328 : int16_t pred_cb_idx;
329 : int16_t code;
330 : ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd;
331 : ISAR_BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg;
332 :
333 4052 : pHuff_cfg = &hBinHrSplitPostRend->huff_cfg;
334 :
335 4052 : if ( pred_quant_pnts_yaw == ISAR_SPLIT_REND_PRED_63QUANT_PNTS )
336 : {
337 4018 : pred_cb_idx = 1;
338 : }
339 : else
340 : {
341 34 : pred_cb_idx = 0;
342 : }
343 4052 : min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0];
344 4052 : min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0];
345 4052 : min_gd_idx = (int16_t) pHuff_cfg->gd.codebook[0];
346 4052 : min_p_gd_idx = (int16_t) pHuff_cfg->p_gd.codebook[0];
347 4052 : pred_code_len = pHuff_cfg->pred_base2_code_len[pred_cb_idx];
348 4052 : pred_roll_code_len = pHuff_cfg->pred_roll_base2_code_len;
349 4052 : gd_code_len = pHuff_cfg->gd_base2_code_len;
350 4052 : p_gd_code_len = pHuff_cfg->p_gd_base2_code_len;
351 :
352 8104 : for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
353 : {
354 19340 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
355 : {
356 15288 : if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
357 : {
358 70016 : for ( b = 0; b < pred_imag_bands_yaw; b++ )
359 : {
360 61912 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
361 185736 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
362 : {
363 371472 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
364 : {
365 247648 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len );
366 247648 : hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_idx;
367 : }
368 : }
369 185736 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
370 : {
371 371472 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
372 : {
373 247648 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len );
374 247648 : hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_idx;
375 : }
376 : }
377 : }
378 :
379 108272 : for ( ; b < pred_real_bands_yaw; b++ )
380 : {
381 100168 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
382 300504 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
383 : {
384 200336 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_code_len );
385 200336 : hMd->pred_mat_re_idx[ch1][ch1] = code + min_pred_idx;
386 : }
387 100168 : hMd->pred_mat_re_idx[0][1] = 0;
388 100168 : hMd->pred_mat_re_idx[1][0] = 0;
389 : }
390 8104 : for ( b = 0; b < d_bands_yaw; b++ )
391 : {
392 0 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
393 0 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, gd_code_len );
394 0 : hMd->gd_idx = code + min_gd_idx;
395 : }
396 : }
397 7184 : else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY )
398 : {
399 93513 : for ( b = 0; b < bands_pitch; b++ )
400 : {
401 89060 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
402 89060 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, p_gd_code_len );
403 89060 : hMd->gd_idx = code + min_p_gd_idx;
404 89060 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, p_gd_code_len );
405 89060 : hMd->gd2_idx = code + min_p_gd_idx;
406 : }
407 : }
408 : else
409 : {
410 13655 : for ( b = 0; b < pred_imag_bands_roll; b++ )
411 : {
412 10924 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
413 32772 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
414 : {
415 65544 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
416 : {
417 43696 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len );
418 43696 : hMd->pred_mat_re_idx[ch1][ch2] = code + min_pred_roll_idx;
419 : }
420 : }
421 32772 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
422 : {
423 65544 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
424 : {
425 43696 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len );
426 43696 : hMd->pred_mat_im_idx[ch1][ch2] = code + min_pred_roll_idx;
427 : }
428 : }
429 : }
430 :
431 46427 : for ( ; b < pred_real_bands_roll; b++ )
432 : {
433 43696 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
434 131088 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
435 : {
436 87392 : code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, pred_roll_code_len );
437 87392 : hMd->pred_mat_re_idx[ch1][ch1] = code + min_pred_roll_idx;
438 : }
439 43696 : hMd->pred_mat_re_idx[0][1] = 0;
440 43696 : hMd->pred_mat_re_idx[1][0] = 0;
441 : }
442 : }
443 : }
444 : }
445 :
446 4052 : return;
447 : }
448 :
449 :
450 : /*-----------------------------------------------------------------------------------------*
451 : * Function isar_splitBinPostRendMdHuffDec()
452 : *
453 : *
454 : *-----------------------------------------------------------------------------------------*/
455 :
456 399676 : static void isar_splitBinPostRendMdHuffDec(
457 : ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */
458 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, /* i/o: binaural post-renderer handle */
459 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
460 : const int16_t num_subframes,
461 : const int16_t pred_real_bands_yaw,
462 : const int16_t pred_imag_bands_yaw,
463 : const int16_t pred_quant_pnts_yaw,
464 : const int16_t d_bands_yaw,
465 : const int16_t bands_pitch,
466 : const int16_t pred_real_bands_roll,
467 : const int16_t pred_imag_bands_roll )
468 : {
469 : int16_t pos_idx, b, sf_idx;
470 : int16_t ch1, ch2;
471 : int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
472 : int16_t min_pred_idx, max_pred_idx;
473 : int16_t min_pred_roll_idx, max_pred_roll_idx, pred_cb_idx;
474 : ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd;
475 : ISAR_BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg;
476 :
477 399676 : pHuff_cfg = &hBinHrSplitPostRend->huff_cfg;
478 :
479 399676 : if ( pred_quant_pnts_yaw == ISAR_SPLIT_REND_PRED_63QUANT_PNTS )
480 : {
481 399476 : pred_cb_idx = 1;
482 : }
483 : else
484 : {
485 200 : pred_cb_idx = 0;
486 : }
487 399676 : min_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[0];
488 399676 : max_pred_idx = (int16_t) pHuff_cfg->pred[pred_cb_idx].codebook[( pred_quant_pnts_yaw - 1 ) * 3];
489 :
490 399676 : min_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[0];
491 399676 : max_pred_roll_idx = (int16_t) pHuff_cfg->pred_roll.codebook[( ISAR_SPLIT_REND_ROLL_PRED_QUANT_PNTS - 1 ) * 3];
492 :
493 799352 : for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
494 : {
495 2004126 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
496 : {
497 1604450 : if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
498 : {
499 10627248 : for ( b = 0; b < pred_imag_bands_yaw; b++ )
500 : {
501 9827896 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
502 29483688 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
503 : {
504 58967376 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
505 : {
506 39311584 : sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] );
507 : }
508 : }
509 9827896 : isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_idx, max_pred_idx );
510 29483688 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
511 : {
512 58967376 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
513 : {
514 39311584 : sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] );
515 : }
516 : }
517 9827896 : isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_idx, max_pred_idx );
518 : }
519 6958496 : for ( ; b < pred_real_bands_yaw; b++ )
520 : {
521 6159144 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
522 18477432 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
523 : {
524 12318288 : sym_adj_idx[ch1][ch1] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred[pred_cb_idx], pBits, pHuff_cfg->pred_idx_trav[pred_cb_idx] );
525 : }
526 6159144 : sym_adj_idx[1][0] = 0;
527 6159144 : sym_adj_idx[0][1] = 0;
528 6159144 : isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, -1, min_pred_idx, max_pred_idx );
529 : }
530 799352 : for ( b = 0; b < d_bands_yaw; b++ )
531 : {
532 0 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
533 0 : hMd->gd_idx = isar_split_rend_huffman_decode_opt( &pHuff_cfg->gd, pBits, pHuff_cfg->gd_idx_trav );
534 : }
535 : }
536 805098 : else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY )
537 : {
538 9608109 : for ( b = 0; b < bands_pitch; b++ )
539 : {
540 9150580 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
541 9150580 : hMd->gd_idx = isar_split_rend_huffman_decode_opt( &pHuff_cfg->p_gd, pBits, pHuff_cfg->p_gd_idx_trav );
542 :
543 9150580 : hMd->gd2_idx = isar_split_rend_huffman_decode_opt( &pHuff_cfg->p_gd, pBits, pHuff_cfg->p_gd_idx_trav );
544 : }
545 : }
546 : else
547 : {
548 1737845 : for ( b = 0; b < pred_imag_bands_roll; b++ )
549 : {
550 1390276 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
551 :
552 4170828 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
553 : {
554 8341656 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
555 : {
556 5561104 : sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav );
557 : }
558 : }
559 1390276 : isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, 1, min_pred_roll_idx, max_pred_roll_idx );
560 4170828 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
561 : {
562 8341656 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
563 : {
564 5561104 : sym_adj_idx[ch1][ch2] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav );
565 : }
566 : }
567 1390276 : isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_im_idx, -1, min_pred_roll_idx, max_pred_roll_idx );
568 : }
569 :
570 5908673 : for ( ; b < pred_real_bands_roll; b++ )
571 : {
572 5561104 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
573 :
574 16683312 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
575 : {
576 11122208 : sym_adj_idx[ch1][ch1] = isar_split_rend_huffman_decode_opt( &pHuff_cfg->pred_roll, pBits, pHuff_cfg->pred_roll_idx_trav );
577 : }
578 5561104 : sym_adj_idx[1][0] = 0;
579 5561104 : sym_adj_idx[0][1] = 0;
580 5561104 : isar_SplitRenderer_getdiagdiff( sym_adj_idx, hMd->pred_mat_re_idx, -1, min_pred_roll_idx, max_pred_roll_idx );
581 : }
582 : }
583 : }
584 : }
585 :
586 399676 : return;
587 : }
588 :
589 :
590 : /*-----------------------------------------------------------------------------------------*
591 : * Function isar_splitBinPostRendMdDec()
592 : *
593 : *
594 : *-----------------------------------------------------------------------------------------*/
595 :
596 403728 : void isar_splitBinPostRendMdDec(
597 : ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */
598 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, /* i/o: binaural post-renderer handle */
599 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData /* i/o: pose correction data handle */
600 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
601 : ,
602 : BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend
603 : #endif
604 : )
605 : {
606 : int16_t pos_idx, b, sf_idx, num_subframes, ch1;
607 : int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
608 : int16_t pred_imag_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
609 : int16_t d_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS], bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
610 : int16_t num_quant_strats;
611 : int32_t quant_strat_bits, is_huff_coding, quant_strat;
612 : int16_t pred_quant_pnts_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
613 : float pred_1byquantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
614 : float pred_quantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS];
615 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
616 : int16_t ch1, ch2;
617 : #endif
618 : ISAR_BIN_HR_SPLIT_REND_MD_HANDLE hMd;
619 : ISAR_SPLIT_REND_CONFIG_DATA split_rend_config;
620 : ISAR_SPLIT_REND_ROT_AXIS rot_axis;
621 : int16_t ro_md_flag, num_bits, axis_code;
622 :
623 403728 : hBinHrSplitPostRend->low_Res = 1;
624 :
625 403728 : split_rend_config.dof = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_DOF_BITS );
626 403728 : split_rend_config.hq_mode = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HQ_MODE_BITS );
627 :
628 403728 : num_bits = isar_renderSplitGetRot_axisNumBits( split_rend_config.dof );
629 403728 : if ( num_bits > 0 )
630 : {
631 165858 : axis_code = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, (int32_t) num_bits );
632 : }
633 : else
634 : {
635 237870 : axis_code = 0;
636 : }
637 403728 : rot_axis = isar_renderSplitGetRot_axisFromCode( split_rend_config.dof, axis_code );
638 403728 : ro_md_flag = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_RO_FLAG_BITS );
639 :
640 403728 : isar_renderSplitGetMultiBinPoseData( &split_rend_config, pMultiBinPoseData, rot_axis );
641 :
642 403728 : set_fix_rotation_mat( hBinHrSplitPostRend->fix_pos_rot_mat, pMultiBinPoseData );
643 403728 : set_pose_types( hBinHrSplitPostRend->pose_type, pMultiBinPoseData );
644 :
645 403728 : num_subframes = ( hBinHrSplitPostRend->low_Res == 0 ) ? MAX_PARAM_SPATIAL_SUBFRAMES : 1;
646 807456 : for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
647 : {
648 : int16_t angle;
649 :
650 403728 : hBinHrSplitPostRend->QuaternionsPre[sf_idx].w = -3.0f;
651 :
652 403728 : angle = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS );
653 403728 : angle -= 180;
654 403728 : hBinHrSplitPostRend->QuaternionsPre[sf_idx].x = (float) angle;
655 :
656 403728 : angle = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS );
657 403728 : angle -= 180;
658 403728 : hBinHrSplitPostRend->QuaternionsPre[sf_idx].y = (float) angle;
659 :
660 403728 : angle = (int16_t) ISAR_SPLIT_REND_BITStream_read_int32( pBits, ISAR_SPLIT_REND_HEAD_POSE_BITS );
661 403728 : angle -= 180;
662 403728 : hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = (float) angle;
663 : }
664 :
665 403728 : isar_split_rend_get_quant_params(
666 : MAX_SPLIT_REND_MD_BANDS,
667 : pred_real_bands_yaw,
668 : pred_imag_bands_yaw,
669 : pred_quant_pnts_yaw,
670 : pred_quantstep_yaw,
671 : pred_1byquantstep_yaw,
672 : d_bands_yaw,
673 : bands_pitch,
674 : pred_real_bands_roll,
675 : pred_imag_bands_roll,
676 : ro_md_flag,
677 : &num_quant_strats );
678 :
679 403728 : quant_strat_bits = (int32_t) ceilf( log2f( num_quant_strats ) );
680 403728 : is_huff_coding = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 );
681 403728 : quant_strat = ISAR_SPLIT_REND_BITStream_read_int32( pBits, quant_strat_bits );
682 :
683 403728 : if ( is_huff_coding == 0 )
684 : {
685 4052 : isar_splitBinPostRendMdBase2Dec(
686 : pBits, hBinHrSplitPostRend,
687 : pMultiBinPoseData,
688 : num_subframes,
689 4052 : pred_real_bands_yaw[quant_strat],
690 4052 : pred_imag_bands_yaw[quant_strat],
691 4052 : pred_quant_pnts_yaw[quant_strat],
692 4052 : d_bands_yaw[quant_strat],
693 4052 : bands_pitch[quant_strat],
694 4052 : pred_real_bands_roll[quant_strat],
695 4052 : pred_imag_bands_roll[quant_strat] );
696 : }
697 : else
698 : {
699 399676 : isar_splitBinPostRendMdHuffDec(
700 : pBits, hBinHrSplitPostRend,
701 : pMultiBinPoseData,
702 : num_subframes,
703 399676 : pred_real_bands_yaw[quant_strat],
704 399676 : pred_imag_bands_yaw[quant_strat],
705 399676 : pred_quant_pnts_yaw[quant_strat],
706 399676 : d_bands_yaw[quant_strat],
707 399676 : bands_pitch[quant_strat],
708 399676 : pred_real_bands_roll[quant_strat],
709 399676 : pred_imag_bands_roll[quant_strat] );
710 : }
711 : #ifdef SPLIT_MD_CODING_DEBUG
712 : for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
713 : {
714 : int16_t val, ch2, val_ref;
715 : char filename[200] = "split_md_debug_indices.bin";
716 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
717 : {
718 : if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
719 : {
720 : for ( b = 0; b < pred_real_bands_yaw[quant_strat]; b++ )
721 : {
722 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
723 : {
724 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
725 : {
726 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2];
727 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
728 : if ( abs( val_ref - val ) > 0 )
729 : {
730 : assert( 0 );
731 : }
732 : }
733 : }
734 : }
735 : for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ )
736 : {
737 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
738 : {
739 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
740 : {
741 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2];
742 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
743 : if ( abs( val_ref - val ) > 0 )
744 : {
745 : assert( 0 );
746 : }
747 : }
748 : }
749 : }
750 : for ( b = 0; b < d_bands_yaw[quant_strat]; b++ )
751 : {
752 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].gd_idx;
753 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
754 : if ( abs( val_ref - val ) > 0 )
755 : {
756 : assert( 0 );
757 : }
758 : }
759 : }
760 : else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY )
761 : {
762 : for ( b = 0; b < bands_pitch[quant_strat]; b++ )
763 : {
764 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].gd_idx;
765 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
766 : if ( abs( val_ref - val ) > 0 )
767 : {
768 : assert( 0 );
769 : }
770 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].gd2_idx;
771 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
772 : if ( abs( val_ref - val ) > 0 )
773 : {
774 : assert( 0 );
775 : }
776 : }
777 : }
778 : else
779 : {
780 : for ( b = 0; b < pred_real_bands_roll[quant_strat]; b++ )
781 : {
782 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
783 : {
784 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
785 : {
786 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2];
787 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
788 : if ( abs( val_ref - val ) > 0 )
789 : {
790 : assert( 0 );
791 : }
792 : }
793 : }
794 : }
795 : for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ )
796 : {
797 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
798 : {
799 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
800 : {
801 : val = hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2];
802 : dbgread( &val_ref, sizeof( int16_t ), 1, filename );
803 : if ( abs( val_ref - val ) > 0 )
804 : {
805 : assert( 0 );
806 : }
807 : }
808 : }
809 : }
810 : }
811 : }
812 : }
813 : #endif
814 :
815 807456 : for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
816 : {
817 2023466 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
818 : {
819 1619738 : if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
820 : {
821 10697264 : for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ )
822 : {
823 9889808 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
824 9889808 : isar_split_rend_unquant_md( hMd, PRED_ONLY, 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx], pred_quantstep_yaw[quant_strat] );
825 : }
826 7066768 : for ( ; b < pred_real_bands_yaw[quant_strat]; b++ )
827 : {
828 6259312 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
829 6259312 : isar_split_rend_unquant_md( hMd, PRED_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx], pred_quantstep_yaw[quant_strat] );
830 : }
831 807456 : for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ )
832 : {
833 0 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
834 0 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
835 : {
836 0 : set_zero( hMd->pred_mat_re[ch1], BINAURAL_CHANNELS );
837 0 : set_zero( hMd->pred_mat_im[ch1], BINAURAL_CHANNELS );
838 0 : hMd->pred_mat_re[ch1][ch1] = 1.0f;
839 : }
840 : }
841 807456 : for ( b = 0; b < d_bands_yaw[quant_strat]; b++ )
842 : {
843 0 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
844 0 : isar_split_rend_unquant_md( hMd, COM_GAIN_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx], 0 );
845 : }
846 16956576 : for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ )
847 : {
848 16149120 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
849 16149120 : hMd->gd = 0.0f;
850 : }
851 : }
852 812282 : else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY )
853 : {
854 9701622 : for ( b = 0; b < bands_pitch[quant_strat]; b++ )
855 : {
856 9239640 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
857 9239640 : isar_split_rend_unquant_md( hMd, LR_GAIN_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx], 0 );
858 : }
859 461982 : for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ )
860 : {
861 0 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
862 0 : hMd->gd = 1.0f;
863 0 : hMd->gd2 = 1.0f;
864 : }
865 : }
866 : else
867 : {
868 1751500 : for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ )
869 : {
870 1401200 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
871 1401200 : isar_split_rend_unquant_md( hMd, PRED_ROLL_ONLY, 0, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx], ISAR_SPLIT_REND_PRED_ROLL_Q_STEP );
872 : }
873 5955100 : for ( ; b < pred_real_bands_roll[quant_strat]; b++ )
874 : {
875 5604800 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
876 5604800 : isar_split_rend_unquant_md( hMd, PRED_ROLL_ONLY, 1, hBinHrSplitPostRend->fix_pos_rot_mat[pos_idx], ISAR_SPLIT_REND_PRED_ROLL_Q_STEP );
877 : }
878 350300 : for ( ; b < MAX_SPLIT_REND_MD_BANDS; b++ )
879 : {
880 0 : hMd = &hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
881 0 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
882 : {
883 0 : set_zero( hMd->pred_mat_re[ch1], BINAURAL_CHANNELS );
884 0 : set_zero( hMd->pred_mat_im[ch1], BINAURAL_CHANNELS );
885 0 : hMd->pred_mat_re[ch1][ch1] = 1.0f;
886 : }
887 : }
888 : }
889 : }
890 : }
891 :
892 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
893 : for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
894 : {
895 : float val;
896 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
897 : {
898 : if ( hBinHrSplitPostRend->pose_type[pos_idx] == ANY_YAW )
899 : {
900 : for ( b = 0; b < pred_real_bands_yaw[quant_strat]; b++ )
901 : {
902 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
903 : {
904 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
905 : {
906 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2];
907 : if ( fabsf( hMd->pred_mat_re_idx[ch1][ch2] - val ) > 1e-20 )
908 : {
909 : assert( 0 );
910 : }
911 : }
912 : }
913 : }
914 : for ( b = 0; b < pred_imag_bands_yaw[quant_strat]; b++ )
915 : {
916 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
917 : {
918 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
919 : {
920 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2];
921 : if ( fabsf( hMd->pred_mat_im_idx[ch1][ch2] - val ) > 1e-20 )
922 : {
923 : assert( 0 );
924 : }
925 : }
926 : }
927 : }
928 : for ( b = 0; b < d_bands_yaw[quant_strat]; b++ )
929 : {
930 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx;
931 : if ( fabsf( hMd->gd_idx - val ) > 1e-20 )
932 : {
933 : assert( 0 );
934 : }
935 : }
936 : }
937 : else if ( hBinHrSplitPostRend->pose_type[pos_idx] == PITCH_ONLY )
938 : {
939 : for ( b = 0; b < bands_pitch[quant_strat]; b++ )
940 : {
941 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd_idx;
942 : if ( fabsf( hMd->gd_idx - val ) > 1e-20 )
943 : {
944 : assert( 0 );
945 : }
946 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].gd2_idx;
947 : if ( fabsf( hMd->gd2_idx - val ) > 1e-20 )
948 : {
949 : assert( 0 );
950 : }
951 : }
952 : }
953 : else
954 : {
955 : for ( b = 0; b < pred_real_bands_roll[quant_strat]; b++ )
956 : {
957 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
958 : {
959 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
960 : {
961 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_re_idx[ch1][ch2];
962 : if ( fabsf( hMd->pred_mat_re_idx[ch1][ch2] - val ) > 1e-20 )
963 : {
964 : assert( 0 );
965 : }
966 : }
967 : }
968 : }
969 : for ( b = 0; b < pred_imag_bands_roll[quant_strat]; b++ )
970 : {
971 : for ( ch1 = 0; ch1 < BINAURAL_CHANNELS; ch1++ )
972 : {
973 : for ( ch2 = 0; ch2 < BINAURAL_CHANNELS; ch2++ )
974 : {
975 : val = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b].pred_mat_im_idx[ch1][ch2];
976 : if ( fabsf( hMd->pred_mat_im_idx[ch1][ch2] - val ) > 1e-20 )
977 : {
978 : assert( 0 );
979 : }
980 : }
981 : }
982 : }
983 : }
984 : }
985 : }
986 : #endif
987 :
988 403728 : return;
989 : }
990 :
991 :
992 : /*-----------------------------------------------------------------------------------------*
993 : * Function wrap_around_angle()
994 : *
995 : *
996 : *-----------------------------------------------------------------------------------------*/
997 :
998 4490856 : static void wrap_around_angle(
999 : float *a )
1000 : {
1001 4490856 : if ( ( *a ) > 180.0f )
1002 : {
1003 46704 : ( *a ) = ( *a ) - 360;
1004 : }
1005 4444152 : else if ( ( *a ) < -180.0f )
1006 : {
1007 16100 : ( *a ) = ( *a ) + 360;
1008 : }
1009 :
1010 4490856 : return;
1011 : }
1012 :
1013 :
1014 : /*-----------------------------------------------------------------------------------------*
1015 : * Function wrap_around_angle()
1016 : *
1017 : *
1018 : *-----------------------------------------------------------------------------------------*/
1019 :
1020 1496952 : static void wrap_around_ypr(
1021 : IVAS_QUATERNION *Quaternions )
1022 : {
1023 : /*only if quat is actually yaw, pitch , roll angles*/
1024 1496952 : if ( Quaternions->w == -3.0f )
1025 : {
1026 1496952 : wrap_around_angle( &Quaternions->x );
1027 1496952 : wrap_around_angle( &Quaternions->y );
1028 1496952 : wrap_around_angle( &Quaternions->z );
1029 : }
1030 :
1031 1496952 : return;
1032 : }
1033 :
1034 :
1035 : /*-----------------------------------------------------------------------------------------*
1036 : * Function wrap_around_angle()
1037 : *
1038 : *
1039 : *-----------------------------------------------------------------------------------------*/
1040 :
1041 4490856 : static float get_interp_fact(
1042 : float p[MAX_HEAD_ROT_POSES],
1043 : const float p_t,
1044 : const int16_t ind[2] )
1045 : {
1046 : float n, d, interp_fact;
1047 :
1048 4490856 : if ( ind[0] != ind[1] )
1049 : {
1050 2231591 : n = p[ind[0]] - p[ind[1]];
1051 2231591 : d = p[ind[0]] - p_t;
1052 2231591 : interp_fact = d / n;
1053 2231591 : if ( interp_fact < 0.0f )
1054 : {
1055 1771227 : d = max( -1.0f * MAX_EXTRAPOLATION_ANGLE, ( min( MAX_EXTRAPOLATION_ANGLE, d ) ) );
1056 1771227 : n = sinf( n * ( EVS_PI / 180.0f ) );
1057 1771227 : d = sinf( d * ( EVS_PI / 180.0f ) );
1058 1771227 : interp_fact = d / n;
1059 : }
1060 : }
1061 : else
1062 : {
1063 2259265 : interp_fact = 0.0f;
1064 : }
1065 :
1066 4490856 : return interp_fact;
1067 : }
1068 :
1069 :
1070 : /*-----------------------------------------------------------------------------------------*
1071 : * Function get_nearest_pose_ind()
1072 : *
1073 : *
1074 : *-----------------------------------------------------------------------------------------*/
1075 :
1076 2510419 : static void get_nearest_pose_ind(
1077 : float p[MAX_HEAD_ROT_POSES],
1078 : const float p_t,
1079 : int16_t ind[2],
1080 : const int16_t num_poses )
1081 : {
1082 : float min_diff, diff;
1083 : int16_t pos_idx;
1084 :
1085 2510419 : ind[0] = 0;
1086 2510419 : ind[1] = 0;
1087 2510419 : min_diff = 360.0f;
1088 :
1089 : /*find the closest pose from assumed poses*/
1090 15507816 : for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
1091 : {
1092 12997397 : diff = fabsf( p_t - p[pos_idx] );
1093 12997397 : if ( diff < min_diff )
1094 : {
1095 4463459 : ind[0] = pos_idx;
1096 4463459 : min_diff = (float) diff;
1097 : }
1098 : }
1099 :
1100 2510419 : min_diff = 360.0;
1101 15507816 : for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
1102 : {
1103 12997397 : diff = fabsf( p_t - p[pos_idx] );
1104 12997397 : if ( ( diff < min_diff ) &&
1105 6322002 : ( fabs( p[pos_idx] - p[ind[0]] ) > EPSILON ) )
1106 : {
1107 2274465 : ind[1] = pos_idx;
1108 2274465 : min_diff = (float) diff;
1109 : }
1110 : }
1111 :
1112 2510419 : return;
1113 : }
1114 :
1115 :
1116 : /*-----------------------------------------------------------------------------------------*
1117 : * Function get_interpolation_vars()
1118 : *
1119 : *
1120 : *-----------------------------------------------------------------------------------------*/
1121 :
1122 1496952 : static void get_interpolation_vars(
1123 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
1124 : const IVAS_QUATERNION *Quaternions_ref,
1125 : const IVAS_QUATERNION *Quaternions_act,
1126 : int16_t interp_yaw_pose_idx[2],
1127 : int16_t interp_pitch_pose_idx[2],
1128 : int16_t interp_roll_pose_idx[2],
1129 : float *interp_yaw_fact,
1130 : float *interp_pitch_fact,
1131 : float *interp_roll_fact )
1132 : {
1133 : IVAS_QUATERNION quaternions_diff, quaternions_ref_euler, quaternions_act_euler;
1134 : float y[MAX_HEAD_ROT_POSES], p[MAX_HEAD_ROT_POSES], r[MAX_HEAD_ROT_POSES];
1135 : int16_t pos_idx, num_poses;
1136 :
1137 1496952 : quaternions_diff.x = 0.0f;
1138 1496952 : quaternions_diff.y = 0.0f;
1139 1496952 : quaternions_diff.z = 0.0f;
1140 :
1141 1496952 : num_poses = pMultiBinPoseData->num_poses;
1142 9251336 : for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
1143 : {
1144 7754384 : quaternions_diff.x = pMultiBinPoseData->relative_head_poses[pos_idx][0];
1145 7754384 : quaternions_diff.y = pMultiBinPoseData->relative_head_poses[pos_idx][1];
1146 7754384 : quaternions_diff.z = pMultiBinPoseData->relative_head_poses[pos_idx][2];
1147 7754384 : y[pos_idx] = quaternions_diff.x;
1148 7754384 : p[pos_idx] = quaternions_diff.y;
1149 7754384 : r[pos_idx] = quaternions_diff.z;
1150 : }
1151 :
1152 : /*interpolation if actual pose is not same as one of assumed poses*/
1153 : /*get the deviation*/
1154 1496952 : Quat2EulerDegree( *Quaternions_ref, &quaternions_ref_euler.z, &quaternions_ref_euler.y, &quaternions_ref_euler.x ); /*order in Quat2Euler seems to be reversed ?*/
1155 1496952 : Quat2EulerDegree( *Quaternions_act, &quaternions_act_euler.z, &quaternions_act_euler.y, &quaternions_act_euler.x ); /*order in Quat2Euler seems to be reversed ?*/
1156 1496952 : quaternions_diff.w = -3.0f; /*euler*/
1157 1496952 : quaternions_diff.x = quaternions_act_euler.x - quaternions_ref_euler.x;
1158 1496952 : quaternions_diff.y = quaternions_act_euler.y - quaternions_ref_euler.y;
1159 1496952 : quaternions_diff.z = quaternions_act_euler.z - quaternions_ref_euler.z;
1160 1496952 : wrap_around_ypr( &quaternions_diff );
1161 :
1162 1496952 : interp_yaw_pose_idx[0] = 0;
1163 1496952 : interp_yaw_pose_idx[1] = 0;
1164 1496952 : if ( fabs( quaternions_diff.x ) > EPSILON )
1165 : {
1166 1495577 : get_nearest_pose_ind( y, quaternions_diff.x, interp_yaw_pose_idx, num_poses );
1167 : }
1168 1496952 : *interp_yaw_fact = get_interp_fact( y, quaternions_diff.x, interp_yaw_pose_idx );
1169 :
1170 1496952 : interp_pitch_pose_idx[0] = 0;
1171 1496952 : interp_pitch_pose_idx[1] = 0;
1172 1496952 : if ( fabs( quaternions_diff.y ) > EPSILON )
1173 : {
1174 594058 : get_nearest_pose_ind( p, quaternions_diff.y, interp_pitch_pose_idx, num_poses );
1175 : }
1176 1496952 : *interp_pitch_fact = get_interp_fact( p, quaternions_diff.y, interp_pitch_pose_idx );
1177 :
1178 1496952 : interp_roll_pose_idx[0] = 0;
1179 1496952 : interp_roll_pose_idx[1] = 0;
1180 1496952 : if ( fabs( quaternions_diff.z ) > EPSILON )
1181 : {
1182 420784 : get_nearest_pose_ind( r, quaternions_diff.z, interp_roll_pose_idx, num_poses );
1183 : }
1184 1496952 : *interp_roll_fact = get_interp_fact( r, quaternions_diff.z, interp_roll_pose_idx );
1185 :
1186 1496952 : return;
1187 : }
1188 :
1189 :
1190 : /*-----------------------------------------------------------------------------------------*
1191 : * Function interpolate_pred_matrix()
1192 : *
1193 : *
1194 : *-----------------------------------------------------------------------------------------*/
1195 :
1196 35286940 : static void interpolate_pred_matrix(
1197 : ISAR_BIN_HR_SPLIT_REND_MD rot_md[][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS],
1198 : const int16_t sf_idx,
1199 : const int16_t band_idx,
1200 : const int16_t ind[2],
1201 : const float interp_fact,
1202 : float mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
1203 : float mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS] )
1204 : {
1205 : int16_t ch_idx1, ch_idx2;
1206 : float diff;
1207 : ISAR_BIN_HR_SPLIT_REND_MD *pRot_md;
1208 : float mix_mat_re1[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1209 : float mix_mat_im1[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1210 : float mix_mat_re2[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1211 : float mix_mat_im2[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1212 :
1213 105860820 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1214 : {
1215 70573880 : set_zero( mix_mat_re1[ch_idx1], BINAURAL_CHANNELS );
1216 70573880 : set_zero( mix_mat_im1[ch_idx1], BINAURAL_CHANNELS );
1217 70573880 : mix_mat_re1[ch_idx1][ch_idx1] = 1.0f;
1218 :
1219 70573880 : set_zero( mix_mat_re2[ch_idx1], BINAURAL_CHANNELS );
1220 70573880 : set_zero( mix_mat_im2[ch_idx1], BINAURAL_CHANNELS );
1221 70573880 : mix_mat_re2[ch_idx1][ch_idx1] = 1.0f;
1222 : }
1223 :
1224 35286940 : if ( ind[0] != 0 )
1225 : {
1226 31779020 : pRot_md = &rot_md[ind[0] - 1][sf_idx][band_idx];
1227 :
1228 95337060 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1229 : {
1230 190674120 : for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ )
1231 : {
1232 127116080 : mix_mat_re1[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2];
1233 127116080 : mix_mat_im1[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2];
1234 : }
1235 : }
1236 : }
1237 :
1238 35286940 : if ( ind[1] != 0 )
1239 : {
1240 3507920 : pRot_md = &rot_md[ind[1] - 1][sf_idx][band_idx];
1241 :
1242 10523760 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1243 : {
1244 21047520 : for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ )
1245 : {
1246 14031680 : mix_mat_re2[ch_idx1][ch_idx2] = pRot_md->pred_mat_re[ch_idx1][ch_idx2];
1247 14031680 : mix_mat_im2[ch_idx1][ch_idx2] = pRot_md->pred_mat_im[ch_idx1][ch_idx2];
1248 : }
1249 : }
1250 : }
1251 :
1252 105860820 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1253 : {
1254 211721640 : for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ )
1255 : {
1256 141147760 : diff = mix_mat_re1[ch_idx1][ch_idx2] - mix_mat_re2[ch_idx1][ch_idx2];
1257 141147760 : mat_re[ch_idx1][ch_idx2] = mix_mat_re1[ch_idx1][ch_idx2] - ( diff * interp_fact );
1258 :
1259 141147760 : diff = mix_mat_im1[ch_idx1][ch_idx2] - mix_mat_im2[ch_idx1][ch_idx2];
1260 141147760 : mat_im[ch_idx1][ch_idx2] = mix_mat_im1[ch_idx1][ch_idx2] - ( diff * interp_fact );
1261 : }
1262 : }
1263 :
1264 35286940 : return;
1265 : }
1266 :
1267 :
1268 : /*-----------------------------------------------------------------------------------------*
1269 : * Function interpolate_rend_md()
1270 : *
1271 : *
1272 : *-----------------------------------------------------------------------------------------*/
1273 :
1274 29939040 : static void interpolate_rend_md(
1275 : ISAR_BIN_HR_SPLIT_REND_MD rot_md[][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS],
1276 : float mix_mat_re[][BINAURAL_CHANNELS],
1277 : float mix_mat_im[][BINAURAL_CHANNELS],
1278 : float *gd_int,
1279 : const int16_t sf_idx,
1280 : const int16_t band_idx,
1281 : const int16_t interp_yaw_pose_idx[2],
1282 : const int16_t interp_pitch_pose_idx[2],
1283 : const int16_t interp_roll_pose_idx[2],
1284 : const float interp_yaw_fact,
1285 : const float interp_pitch_fact,
1286 : const float interp_roll_fact )
1287 : {
1288 : int16_t ch_idx1, idx1, idx2;
1289 : float mix_mat_re1[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1290 : float mix_mat_im1[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1291 : float mix_mat_re3[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1292 : float mix_mat_im3[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1293 : int16_t ch_idx2;
1294 : float gd1, gd2, gd3, gd4, diff, pitch_gain_r, pitch_gain_l;
1295 :
1296 29939040 : gd1 = 0.0f;
1297 29939040 : gd2 = 0.0f;
1298 :
1299 29939040 : idx1 = interp_yaw_pose_idx[0];
1300 29939040 : idx2 = interp_yaw_pose_idx[1];
1301 29939040 : if ( ( idx1 != 0 ) || ( idx2 != 0 ) )
1302 : {
1303 29911540 : interpolate_pred_matrix( rot_md, sf_idx, band_idx, interp_yaw_pose_idx, interp_yaw_fact, mix_mat_re, mix_mat_im );
1304 :
1305 29911540 : if ( idx1 != 0 )
1306 : {
1307 29253120 : gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd;
1308 : }
1309 :
1310 29911540 : if ( idx2 != 0 )
1311 : {
1312 658420 : gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd;
1313 : }
1314 :
1315 29911540 : diff = gd1 - gd2;
1316 29911540 : *gd_int = gd1 - ( diff * interp_yaw_fact );
1317 : }
1318 : else
1319 : {
1320 : /*P = P'*/
1321 82500 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1322 : {
1323 55000 : set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS );
1324 55000 : set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS );
1325 55000 : mix_mat_re[ch_idx1][ch_idx1] = 1.0f;
1326 : }
1327 27500 : *gd_int = 0.0f;
1328 : }
1329 :
1330 29939040 : idx1 = interp_pitch_pose_idx[0];
1331 29939040 : idx2 = interp_pitch_pose_idx[1];
1332 29939040 : if ( ( idx1 != 0 ) || ( idx2 != 0 ) )
1333 : {
1334 9344880 : gd1 = 1.0f;
1335 9344880 : gd2 = 1.0f;
1336 :
1337 9344880 : gd3 = 1.0f;
1338 9344880 : gd4 = 1.0f;
1339 :
1340 9344880 : if ( idx1 != 0 )
1341 : {
1342 7281780 : gd1 = rot_md[idx1 - 1][sf_idx][band_idx].gd;
1343 7281780 : gd3 = rot_md[idx1 - 1][sf_idx][band_idx].gd2;
1344 : }
1345 9344880 : if ( idx2 != 0 )
1346 : {
1347 2063100 : gd2 = rot_md[idx2 - 1][sf_idx][band_idx].gd;
1348 2063100 : gd4 = rot_md[idx2 - 1][sf_idx][band_idx].gd2;
1349 : }
1350 9344880 : diff = gd1 - gd2;
1351 9344880 : pitch_gain_l = gd1 - ( diff * interp_pitch_fact );
1352 9344880 : pitch_gain_l = max( 0.0f, pitch_gain_l );
1353 :
1354 9344880 : diff = gd3 - gd4;
1355 9344880 : pitch_gain_r = gd3 - ( diff * interp_pitch_fact );
1356 9344880 : pitch_gain_r = max( 0.0f, pitch_gain_r );
1357 :
1358 28034640 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1359 : {
1360 18689760 : mix_mat_re[ch_idx1][0] *= pitch_gain_l;
1361 18689760 : mix_mat_re[ch_idx1][1] *= pitch_gain_r;
1362 18689760 : mix_mat_im[ch_idx1][0] *= pitch_gain_l;
1363 18689760 : mix_mat_im[ch_idx1][1] *= pitch_gain_r;
1364 : }
1365 : }
1366 : else
1367 : {
1368 20594160 : pitch_gain_l = 1.0f;
1369 20594160 : pitch_gain_r = 1.0f;
1370 : }
1371 :
1372 29939040 : idx1 = interp_roll_pose_idx[0];
1373 29939040 : idx2 = interp_roll_pose_idx[1];
1374 29939040 : if ( ( idx1 != 0 ) || ( idx2 != 0 ) )
1375 : {
1376 5375400 : interpolate_pred_matrix( rot_md, sf_idx, band_idx, interp_roll_pose_idx, interp_roll_fact, mix_mat_re3, mix_mat_im3 );
1377 :
1378 5375400 : isar_mat_mult_2by2_complex( mix_mat_re, mix_mat_im, mix_mat_re3, mix_mat_im3, mix_mat_re1, mix_mat_im1 );
1379 :
1380 16126200 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1381 : {
1382 32252400 : for ( ch_idx2 = 0; ch_idx2 < BINAURAL_CHANNELS; ch_idx2++ )
1383 : {
1384 21501600 : mix_mat_re[ch_idx1][ch_idx2] = mix_mat_re1[ch_idx1][ch_idx2];
1385 21501600 : mix_mat_im[ch_idx1][ch_idx2] = mix_mat_im1[ch_idx1][ch_idx2];
1386 : }
1387 : }
1388 : }
1389 :
1390 29939040 : return;
1391 : }
1392 :
1393 :
1394 : /*-----------------------------------------------------------------------------------------*
1395 : * Function isar_SplitRenderer_PostRenderer()
1396 : *
1397 : *
1398 : *-----------------------------------------------------------------------------------------*/
1399 :
1400 1496952 : static void isar_SplitRenderer_PostRenderer(
1401 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */
1402 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
1403 : float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */
1404 : float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */
1405 : const IVAS_QUATERNION Quaternion_act )
1406 : {
1407 : int16_t pos_idx, b, brange[2], ch_idx1;
1408 : int16_t num_md_bands, slot_idx, b2, num_slots, sf_idx_md;
1409 : float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int;
1410 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1411 : ISAR_BIN_HR_SPLIT_REND_MD rot_md_act[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS];
1412 : #else
1413 : ISAR_BIN_HR_SPLIT_REND_MD rot_md_act[1][MAX_SPLIT_REND_MD_BANDS];
1414 : #endif
1415 : int16_t interp_yaw_pose_idx[2], interp_pitch_pose_idx[2], interp_roll_pose_idx[2];
1416 : float interp_yaw_fact, interp_pitch_fact, interp_roll_fact;
1417 : float mix_mat_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1418 : float mix_mat_im[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
1419 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1420 : float Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
1421 : float Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
1422 : #endif
1423 : float fade;
1424 : float *pMix_mat_re_prev[BINAURAL_CHANNELS];
1425 : float *pMix_mat_im_prev[BINAURAL_CHANNELS];
1426 1496952 : const int16_t *pBand_grouping = isar_split_rend_band_grouping;
1427 :
1428 1496952 : num_md_bands = MAX_SPLIT_REND_MD_BANDS;
1429 :
1430 1496952 : push_wmops( "isar_SplitRenderer_PostRenderer" );
1431 :
1432 1496952 : num_slots = MAX_PARAM_SPATIAL_SUBFRAMES;
1433 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1434 : pos_idx = MAX_HEAD_ROT_POSES - 1;
1435 : #else
1436 1496952 : pos_idx = 0;
1437 : #endif
1438 :
1439 1496952 : sf_idx_md = 0;
1440 1496952 : get_interpolation_vars( pMultiBinPoseData, &hBinPostRenderer->QuaternionsPre[sf_idx_md], &Quaternion_act, interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, &interp_yaw_fact, &interp_pitch_fact, &interp_roll_fact );
1441 :
1442 31435992 : for ( b = 0; b < num_md_bands; b++ )
1443 : {
1444 89817120 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1445 : {
1446 59878080 : set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS );
1447 59878080 : set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS );
1448 59878080 : mix_mat_re[ch_idx1][ch_idx1] = 1.0f;
1449 : }
1450 29939040 : gd_int = 0.0f;
1451 29939040 : interpolate_rend_md( hBinPostRenderer->rot_md, mix_mat_re, mix_mat_im, &gd_int, sf_idx_md, b, interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, interp_yaw_fact, interp_pitch_fact, interp_roll_fact );
1452 :
1453 89817120 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1454 : {
1455 : /*update the prediction matrix with interpolated matrix*/
1456 59878080 : rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0];
1457 59878080 : rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1];
1458 59878080 : rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0];
1459 59878080 : rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1];
1460 59878080 : rot_md_act[pos_idx][b].gd = gd_int;
1461 : }
1462 : }
1463 :
1464 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1465 : for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ )
1466 : {
1467 : for ( b = 0; b < num_md_bands; b++ )
1468 : {
1469 : if ( hBinPostRenderer->pose_type[pos_idx] == PITCH_ONLY )
1470 : {
1471 :
1472 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1473 : {
1474 : set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1], BINAURAL_CHANNELS );
1475 : set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1], BINAURAL_CHANNELS );
1476 : hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][ch_idx1] = 1.0f;
1477 : }
1478 : hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[0][0] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd;
1479 : hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[1][1] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd2;
1480 : hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f;
1481 : }
1482 : else if ( hBinPostRenderer->pose_type[pos_idx] == ANY_ROLL )
1483 : {
1484 : hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f;
1485 : }
1486 :
1487 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1488 : {
1489 :
1490 : /*update the prediction matrix with interpolated matrix*/
1491 : rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0];
1492 : rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1];
1493 : rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0];
1494 : rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1];
1495 : rot_md_act[pos_idx][b].gd = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd;
1496 : }
1497 : }
1498 : }
1499 :
1500 : for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
1501 : #else
1502 1496952 : pos_idx = 0;
1503 : #endif
1504 : {
1505 7484760 : for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ )
1506 : {
1507 5987808 : fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES;
1508 5987808 : fade = min( fade, 1.0f );
1509 125743968 : for ( b = 0; b < num_md_bands; b++ )
1510 : {
1511 359268480 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1512 : {
1513 239512320 : if ( hBinPostRenderer->cf_flag )
1514 : {
1515 239124160 : pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1];
1516 239124160 : pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1];
1517 239124160 : mix_mat_re[ch_idx1][0] = fade * ( rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] ) +
1518 239124160 : ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0];
1519 239124160 : mix_mat_re[ch_idx1][1] = fade * ( rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] ) +
1520 239124160 : ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1];
1521 :
1522 239124160 : mix_mat_im[ch_idx1][0] = fade * ( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] ) +
1523 239124160 : ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0];
1524 239124160 : mix_mat_im[ch_idx1][1] = fade * ( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] ) +
1525 239124160 : ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1];
1526 : }
1527 : else
1528 : {
1529 388160 : mix_mat_re[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0];
1530 388160 : mix_mat_re[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1];
1531 388160 : mix_mat_im[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0];
1532 388160 : mix_mat_im[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1];
1533 : }
1534 : }
1535 :
1536 119756160 : brange[0] = pBand_grouping[b];
1537 119756160 : brange[1] = pBand_grouping[b + 1];
1538 479024640 : for ( b2 = brange[0]; b2 < brange[1]; b2++ )
1539 : {
1540 1077805440 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1541 : {
1542 : /* Apply prediction matrix */
1543 718536960 : IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][slot_idx][b2],
1544 : Cldfb_ImagBuffer_Ref_Binaural[0][slot_idx][b2],
1545 : mix_mat_re[0][ch_idx1],
1546 : mix_mat_im[0][ch_idx1],
1547 : tmp_re,
1548 : tmp_im );
1549 718536960 : pred_out_re[ch_idx1] = tmp_re;
1550 718536960 : pred_out_im[ch_idx1] = tmp_im;
1551 :
1552 718536960 : IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][slot_idx][b2],
1553 : Cldfb_ImagBuffer_Ref_Binaural[1][slot_idx][b2],
1554 : mix_mat_re[1][ch_idx1],
1555 : mix_mat_im[1][ch_idx1],
1556 : tmp_re,
1557 : tmp_im );
1558 718536960 : pred_out_re[ch_idx1] += tmp_re;
1559 718536960 : pred_out_im[ch_idx1] += tmp_im;
1560 : }
1561 :
1562 :
1563 1077805440 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1564 : {
1565 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1566 : Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1];
1567 : Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1];
1568 : #else
1569 718536960 : Cldfb_RealBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1];
1570 718536960 : Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1];
1571 : #endif
1572 : }
1573 : }
1574 : }
1575 : }
1576 : }
1577 :
1578 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1579 : for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
1580 : #else
1581 1496952 : pos_idx = 0;
1582 : #endif
1583 : {
1584 31435992 : for ( b = 0; b < num_md_bands; b++ )
1585 : {
1586 89817120 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1587 : {
1588 59878080 : hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0];
1589 59878080 : hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1];
1590 59878080 : hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0];
1591 59878080 : hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1];
1592 : }
1593 29939040 : hBinPostRenderer->gd_mem[pos_idx][b] = rot_md_act[pos_idx][b].gd;
1594 : }
1595 : }
1596 1496952 : hBinPostRenderer->cf_flag = 1;
1597 :
1598 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
1599 : {
1600 : int16_t num_cldfb_bands;
1601 : num_cldfb_bands = CLDFB_NO_CHANNELS_MAX;
1602 : for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ )
1603 : {
1604 : index_slot = sf_idx * num_slots + slot_idx;
1605 : for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
1606 : {
1607 : mvr2r( Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands );
1608 : mvr2r( Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands );
1609 : }
1610 : }
1611 :
1612 : for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
1613 : {
1614 : char fname[200] = "recons_out_pos";
1615 : char tag[2];
1616 : tag[0] = (char) ( '0' + pos_idx );
1617 : tag[1] = '\0';
1618 : strcat( fname, tag );
1619 : strcat( fname, ".wav" );
1620 : isar_log_cldfb2wav_data(
1621 : Cldfb_RealBuffer_Recons_Binaural[pos_idx],
1622 : Cldfb_ImagBuffer_Recons_Binaural[pos_idx],
1623 : hBinPostRenderer->cldfbSynReconsBinDec[pos_idx],
1624 : BINAURAL_CHANNELS,
1625 : num_cldfb_bands,
1626 : 48000,
1627 : num_slots,
1628 : sf_idx * num_slots,
1629 : fname );
1630 : }
1631 : }
1632 :
1633 : #endif
1634 1496952 : pop_wmops();
1635 1496952 : return;
1636 : }
1637 :
1638 :
1639 : /*-----------------------------------------------------------------------------------------*
1640 : * Function isar_rend_CldfbSplitPostRendProcessTdIn()
1641 : *
1642 : *
1643 : *-----------------------------------------------------------------------------------------*/
1644 :
1645 702740 : static void isar_rend_CldfbSplitPostRendProcessTdIn(
1646 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, /* i/o: binaural post-renderer handle */
1647 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
1648 : const IVAS_QUATERNION QuaternionPost,
1649 : float output[][L_FRAME48k] )
1650 : {
1651 : int16_t ch_idx, slot_idx, num_cldfb_bands;
1652 : float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
1653 : float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
1654 702740 : num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels;
1655 :
1656 : /* Implement CLDFB analysis */
1657 2108220 : for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
1658 : {
1659 7027400 : for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
1660 : {
1661 5621920 : cldfbAnalysis_ts( &( output[ch_idx][num_cldfb_bands * slot_idx] ),
1662 5621920 : Cldfb_RealBuffer_Binaural[ch_idx][slot_idx],
1663 5621920 : Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx],
1664 : num_cldfb_bands,
1665 : hBinHrSplitPostRend->cldfbAna[ch_idx] );
1666 : }
1667 : }
1668 :
1669 702740 : isar_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, QuaternionPost );
1670 :
1671 : /* Implement CLDFB synthesis */
1672 2108220 : for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
1673 : {
1674 : float *RealBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES];
1675 : float *ImagBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES];
1676 :
1677 7027400 : for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
1678 : {
1679 5621920 : RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx];
1680 5621920 : ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx];
1681 : }
1682 :
1683 1405480 : cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] );
1684 : }
1685 :
1686 702740 : return;
1687 : }
1688 :
1689 :
1690 : /*-----------------------------------------------------------------------------------------*
1691 : * Function isar_rend_CldfbSplitPostRendProcess()
1692 : *
1693 : *
1694 : *-----------------------------------------------------------------------------------------*/
1695 :
1696 1496952 : void isar_rend_CldfbSplitPostRendProcess(
1697 : ISAR_BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, /* i/o: binaural post-renderer handle */
1698 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
1699 : const IVAS_QUATERNION QuaternionPost,
1700 : float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],
1701 : float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],
1702 : float output[][L_FRAME48k],
1703 : const int16_t cldfb_in_flag )
1704 : {
1705 : int16_t ch_idx, slot_idx, num_cldfb_bands;
1706 :
1707 1496952 : push_wmops( "isar_rend_CldfbSplitPostRendProcess" );
1708 :
1709 1496952 : num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels;
1710 :
1711 1496952 : if ( cldfb_in_flag == 0 )
1712 : {
1713 702740 : isar_rend_CldfbSplitPostRendProcessTdIn( hBinHrSplitPostRend, pMultiBinPoseData, QuaternionPost, output );
1714 702740 : pop_wmops();
1715 702740 : return;
1716 : }
1717 :
1718 794212 : isar_SplitRenderer_PostRenderer( hBinHrSplitPostRend, pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, QuaternionPost );
1719 :
1720 : /* Implement CLDFB synthesis */
1721 2382636 : for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ )
1722 : {
1723 : float *RealBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES];
1724 : float *ImagBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES];
1725 :
1726 7942120 : for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
1727 : {
1728 6353696 : RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx];
1729 6353696 : ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx];
1730 : }
1731 :
1732 1588424 : cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] );
1733 : }
1734 :
1735 794212 : pop_wmops();
1736 794212 : return;
1737 : }
1738 :
1739 :
1740 : /*-----------------------------------------------------------------------------------------*
1741 : * Function isar_init_split_post_rend_handles()
1742 : *
1743 : *
1744 : *-----------------------------------------------------------------------------------------*/
1745 :
1746 3584 : void isar_init_split_post_rend_handles(
1747 : ISAR_SPLIT_POST_REND_WRAPPER *hSplitRendWrapper /* i/o: Split renderer post-renderer handle */
1748 : )
1749 : {
1750 3584 : hSplitRendWrapper->hBinHrSplitPostRend = NULL;
1751 3584 : hSplitRendWrapper->hSplitBinLCLDDec = NULL;
1752 3584 : hSplitRendWrapper->hLc3plusDec = NULL;
1753 3584 : isar_init_multi_bin_pose_data( &hSplitRendWrapper->multiBinPoseData );
1754 3584 : hSplitRendWrapper->first_good_frame_received = 0;
1755 :
1756 3584 : return;
1757 : }
|