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 : #include "ivas_prot.h"
37 : #include "isar_rom_post_rend.h"
38 : #include "lib_isar_post_rend.h"
39 : #include "isar_prot.h"
40 : #ifdef DEBUGGING
41 : #include "debug.h"
42 : #endif
43 : #include "wmc_auto.h"
44 :
45 :
46 : /*-------------------------------------------------------------------------
47 : * Function isar_mat_mult_2by2_complex()
48 : *
49 : *
50 : *------------------------------------------------------------------------*/
51 :
52 0 : void isar_mat_mult_2by2_complex(
53 : float in_re1[2][2],
54 : float in_im1[2][2],
55 : float in_re2[2][2],
56 : float in_im2[2][2],
57 : float out_re2[2][2],
58 : float out_im2[2][2] )
59 : {
60 : int16_t i, j;
61 : float tmp_re, tmp_im;
62 :
63 0 : for ( i = 0; i < 2; i++ )
64 : {
65 0 : for ( j = 0; j < 2; j++ )
66 : {
67 0 : IVAS_CMULT_FLOAT( in_re1[i][0], in_im1[i][0], in_re2[0][j], in_im2[0][j], tmp_re, tmp_im );
68 0 : out_re2[i][j] = tmp_re;
69 0 : out_im2[i][j] = tmp_im;
70 :
71 0 : IVAS_CMULT_FLOAT( in_re1[i][1], in_im1[i][1], in_re2[1][j], in_im2[1][j], tmp_re, tmp_im );
72 0 : out_re2[i][j] += tmp_re;
73 0 : out_im2[i][j] += tmp_im;
74 : }
75 : }
76 :
77 0 : return;
78 : }
79 :
80 :
81 : /*-------------------------------------------------------------------------
82 : * Function isar_split_rend_huffman_dec_init_min_max_len()
83 : *
84 : *
85 : *------------------------------------------------------------------------*/
86 :
87 0 : static void isar_split_rend_huffman_dec_init_min_max_len(
88 : isar_split_rend_huffman_cfg_t *p_huff_cfg )
89 : {
90 : int16_t i, code_len;
91 : const int32_t *codebook;
92 :
93 0 : codebook = p_huff_cfg->codebook;
94 :
95 0 : p_huff_cfg->min_len = p_huff_cfg->sym_len;
96 0 : p_huff_cfg->max_len = 0;
97 :
98 0 : for ( i = 0; i < p_huff_cfg->sym_len; i++ )
99 : {
100 0 : code_len = (int16_t) codebook[1];
101 0 : if ( p_huff_cfg->min_len > code_len )
102 : {
103 0 : p_huff_cfg->min_len = code_len;
104 : }
105 0 : if ( p_huff_cfg->max_len < code_len )
106 : {
107 0 : p_huff_cfg->max_len = code_len;
108 : }
109 0 : codebook = codebook + 3;
110 : }
111 :
112 0 : return;
113 : }
114 :
115 :
116 : /*-------------------------------------------------------------------------
117 : * Function is_idx_present()
118 : *
119 : *
120 : *------------------------------------------------------------------------*/
121 :
122 0 : static int16_t is_idx_present(
123 : int16_t *idx_list,
124 : const int16_t idx,
125 : const int16_t len )
126 : {
127 : int16_t i;
128 :
129 0 : for ( i = 0; i < len; i++ )
130 : {
131 0 : if ( idx_list[i] == idx )
132 : {
133 0 : return 1;
134 : }
135 : }
136 :
137 0 : return 0;
138 : }
139 :
140 :
141 : /*-------------------------------------------------------------------------
142 : * Function isar_split_huff_get_idx_trav_list()
143 : *
144 : *
145 : *------------------------------------------------------------------------*/
146 :
147 0 : static void isar_split_huff_get_idx_trav_list(
148 : int16_t *idx_list,
149 : isar_split_rend_huffman_cfg_t *p_huff_cfg )
150 : {
151 : int16_t i, j, min_idx;
152 : int32_t min_bits;
153 : const int32_t *codebook;
154 :
155 0 : for ( i = 0; i < p_huff_cfg->sym_len; i++ )
156 : {
157 0 : idx_list[i] = -1;
158 : }
159 :
160 0 : for ( i = 0; i < p_huff_cfg->sym_len; i++ )
161 : {
162 0 : codebook = p_huff_cfg->codebook;
163 0 : min_bits = p_huff_cfg->max_len;
164 0 : min_idx = -1;
165 0 : for ( j = 0; j < p_huff_cfg->sym_len; j++ )
166 : {
167 0 : if ( ( min_bits >= codebook[1] ) && ( is_idx_present( idx_list, j, i + 1 ) == 0 ) )
168 : {
169 0 : min_bits = codebook[1];
170 0 : min_idx = j;
171 : }
172 0 : codebook += 3;
173 : }
174 0 : idx_list[i] = min_idx;
175 : }
176 :
177 0 : return;
178 : }
179 :
180 :
181 : /*-------------------------------------------------------------------------
182 : * Function isar_split_rend_init_huff_cfg()
183 : *
184 : *
185 : *------------------------------------------------------------------------*/
186 :
187 0 : void isar_split_rend_init_huff_cfg(
188 : ISAR_BIN_HR_SPLIT_REND_HUFF_HANDLE pHuff_cfg )
189 : {
190 0 : pHuff_cfg->pred[0].codebook = &isar_split_rend_huff_pred31_consts[0][0];
191 0 : pHuff_cfg->pred[0].sym_len = ISAR_SPLIT_REND_PRED_31QUANT_PNTS;
192 0 : isar_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred[0] );
193 0 : isar_split_huff_get_idx_trav_list( pHuff_cfg->pred_idx_trav[0], &pHuff_cfg->pred[0] );
194 0 : pHuff_cfg->pred_base2_code_len[0] = (int16_t) ceilf( log2f( pHuff_cfg->pred[0].sym_len ) );
195 :
196 0 : pHuff_cfg->pred[1].codebook = &isar_split_rend_huff_pred63_consts[0][0];
197 0 : pHuff_cfg->pred[1].sym_len = ISAR_SPLIT_REND_PRED_63QUANT_PNTS;
198 0 : isar_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred[1] );
199 0 : isar_split_huff_get_idx_trav_list( pHuff_cfg->pred_idx_trav[1], &pHuff_cfg->pred[1] );
200 0 : pHuff_cfg->pred_base2_code_len[1] = (int16_t) ceilf( log2f( pHuff_cfg->pred[1].sym_len ) );
201 :
202 :
203 0 : pHuff_cfg->pred_roll.codebook = &isar_split_rend_huff_roll_pred_consts[0][0];
204 0 : pHuff_cfg->pred_roll.sym_len = ISAR_SPLIT_REND_ROLL_PRED_QUANT_PNTS;
205 0 : isar_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->pred_roll );
206 0 : isar_split_huff_get_idx_trav_list( pHuff_cfg->pred_roll_idx_trav, &pHuff_cfg->pred_roll );
207 0 : pHuff_cfg->pred_roll_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->pred_roll.sym_len ) );
208 :
209 0 : pHuff_cfg->gd.codebook = &isar_split_rend_huff_d_consts[0][0];
210 0 : pHuff_cfg->gd.sym_len = ISAR_SPLIT_REND_D_QUANT_PNTS;
211 0 : isar_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->gd );
212 0 : isar_split_huff_get_idx_trav_list( pHuff_cfg->gd_idx_trav, &pHuff_cfg->gd );
213 0 : pHuff_cfg->gd_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->gd.sym_len ) );
214 :
215 0 : pHuff_cfg->p_gd.codebook = &isar_split_rend_huff_p_d_consts[0][0];
216 0 : pHuff_cfg->p_gd.sym_len = ISAR_SPLIT_REND_D_QUANT_PNTS;
217 0 : isar_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->p_gd );
218 0 : isar_split_huff_get_idx_trav_list( pHuff_cfg->p_gd_idx_trav, &pHuff_cfg->p_gd );
219 0 : pHuff_cfg->p_gd_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->p_gd.sym_len ) );
220 :
221 0 : pHuff_cfg->p_gd_diff.codebook = &isar_split_rend_huff_p_d_diff_consts[0][0];
222 0 : pHuff_cfg->p_gd_diff.sym_len = ISAR_SPLIT_REND_D_QUANT_PNTS;
223 0 : isar_split_rend_huffman_dec_init_min_max_len( &pHuff_cfg->p_gd_diff );
224 0 : isar_split_huff_get_idx_trav_list( pHuff_cfg->p_gd_diff_idx_trav, &pHuff_cfg->p_gd_diff );
225 0 : pHuff_cfg->p_gd_diff_base2_code_len = (int16_t) ceilf( log2f( pHuff_cfg->p_gd_diff.sym_len ) );
226 :
227 0 : return;
228 : }
229 :
230 :
231 : /*-------------------------------------------------------------------------
232 : * Function set_fix_rotation_mat()
233 : *
234 : *
235 : *------------------------------------------------------------------------*/
236 :
237 0 : void set_fix_rotation_mat(
238 : float fix_pos_rot_mat[][BINAURAL_CHANNELS][BINAURAL_CHANNELS],
239 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData /* i/o: pose correction data handle */
240 : )
241 : {
242 : float yaw_a, cos_yaw, sin_yaw;
243 : int16_t pos_idx;
244 0 : yaw_a = 0.0f;
245 :
246 0 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
247 : {
248 0 : yaw_a = pMultiBinPoseData->relative_head_poses[pos_idx + 1][0];
249 0 : cos_yaw = cosf( EVS_PI * yaw_a / 180.0f );
250 0 : sin_yaw = sinf( EVS_PI * yaw_a / 180.0f );
251 0 : sin_yaw = 0.0f;
252 0 : fix_pos_rot_mat[pos_idx][0][0] = cos_yaw;
253 0 : fix_pos_rot_mat[pos_idx][1][1] = cos_yaw;
254 0 : fix_pos_rot_mat[pos_idx][0][1] = sin_yaw;
255 0 : fix_pos_rot_mat[pos_idx][1][0] = -1.0f * sin_yaw;
256 : }
257 :
258 0 : return;
259 : }
260 :
261 :
262 : /*-------------------------------------------------------------------------
263 : * Function set_pose_types()
264 : *
265 : *
266 : *------------------------------------------------------------------------*/
267 :
268 0 : void set_pose_types(
269 : ISAR_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1], /* o : ISAR pose type */
270 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData /* i : pose correction data handle */
271 : )
272 : {
273 : int16_t pos_idx;
274 :
275 0 : for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses - 1; pos_idx++ )
276 : {
277 0 : if ( fabs( pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] ) > EPSILON )
278 : {
279 0 : pose_type[pos_idx] = ANY_YAW;
280 : }
281 0 : else if ( fabs( pMultiBinPoseData->relative_head_poses[pos_idx + 1][2] ) > EPSILON )
282 : {
283 0 : pose_type[pos_idx] = ANY_ROLL;
284 : }
285 : else
286 : {
287 0 : pose_type[pos_idx] = PITCH_ONLY;
288 : }
289 : }
290 :
291 0 : return;
292 : }
293 :
294 :
295 : /*-------------------------------------------------------------------------
296 : * Function wrap_a()
297 : *
298 : *
299 : *------------------------------------------------------------------------*/
300 :
301 0 : static int16_t wrap_a(
302 : int16_t val,
303 : const int16_t min_val,
304 : const int16_t max_val )
305 : {
306 0 : if ( val < min_val )
307 : {
308 0 : val = max_val - min_val + val + 1;
309 : }
310 :
311 0 : if ( val > max_val )
312 : {
313 0 : val = min_val + val - max_val - 1;
314 : }
315 :
316 0 : return val;
317 : }
318 :
319 :
320 : /*-------------------------------------------------------------------------
321 : * Function isar_SplitRenderer_getdiagdiff()
322 : *
323 : *
324 : *------------------------------------------------------------------------*/
325 :
326 0 : void isar_SplitRenderer_getdiagdiff(
327 : int16_t in_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
328 : int16_t out_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS],
329 : const int16_t sign,
330 : const int16_t min_val,
331 : const int16_t max_val )
332 : {
333 0 : out_idx[0][0] = in_idx[0][0];
334 0 : out_idx[0][1] = in_idx[0][1];
335 0 : out_idx[1][1] = in_idx[1][1] + sign * out_idx[0][0];
336 0 : out_idx[1][1] = wrap_a( out_idx[1][1], min_val, max_val );
337 0 : out_idx[1][0] = in_idx[1][0] + sign * out_idx[0][1];
338 0 : out_idx[1][0] = wrap_a( out_idx[1][0], min_val, max_val );
339 :
340 0 : return;
341 : }
342 :
343 :
344 : /*-------------------------------------------------------------------------
345 : * Function ISAR_SPLIT_REND_BITStream_read_int32()
346 : *
347 : *
348 : *------------------------------------------------------------------------*/
349 :
350 : /*! r: parameter value */
351 0 : int32_t ISAR_SPLIT_REND_BITStream_read_int32(
352 : ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */
353 : const int32_t bits /* i : number of bits to be read */
354 : )
355 : {
356 : int32_t val, k, bit_val;
357 :
358 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
359 : assert( ( pBits->bits_written - pBits->bits_read ) >= bits );
360 : assert( bits <= 32 );
361 :
362 : #endif
363 : /* write bit by bit */
364 0 : val = 0;
365 0 : for ( k = bits - 1; k >= 0; k-- )
366 : {
367 0 : bit_val = ( pBits->bits_buf[pBits->bits_read >> 3] & ( 1 << ( pBits->bits_read & 7 ) ) ) != 0;
368 0 : val |= bit_val << k;
369 0 : pBits->bits_read++;
370 : }
371 :
372 0 : return val;
373 : }
374 :
375 :
376 : /*-------------------------------------------------------------------------
377 : * Function ISAR_SPLIT_REND_BITStream_write_int32()
378 : *
379 : *
380 : *------------------------------------------------------------------------*/
381 :
382 0 : void ISAR_SPLIT_REND_BITStream_write_int32(
383 : ISAR_SPLIT_REND_BITS_HANDLE pBits, /* i/o: ISAR bits handle */
384 : const int32_t val, /* i : parameter value */
385 : const int32_t bits /* i : number of bits to be written */
386 : )
387 : {
388 : int32_t mask, k;
389 :
390 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
391 : /*protection check*/
392 : if ( ( pBits->buf_len << 3 ) < ( pBits->bits_written + bits ) )
393 : {
394 : assert( 0 );
395 : }
396 : #endif
397 :
398 0 : mask = 1 << ( bits - 1 );
399 : /* write bit by bit */
400 0 : for ( k = 0; k < bits; k++ )
401 : {
402 0 : if ( val & mask )
403 : {
404 0 : pBits->bits_buf[pBits->bits_written >> 3] |= ( 1 << ( pBits->bits_written & 7 ) );
405 : }
406 : else
407 : {
408 0 : pBits->bits_buf[pBits->bits_written >> 3] &= ~( 1 << ( pBits->bits_written & 7 ) );
409 : }
410 0 : pBits->bits_written++;
411 0 : mask >>= 1;
412 : }
413 :
414 0 : return;
415 : }
416 :
417 :
418 : #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
419 : /*-------------------------------------------------------------------------
420 : * isar_log_cldfb2wav_data()
421 : *
422 : *
423 : *------------------------------------------------------------------------*/
424 :
425 : void isar_log_cldfb2wav_data(
426 : float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
427 : float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
428 : HANDLE_CLDFB_FILTER_BANK *cldfbSyn,
429 : const int16_t num_chs,
430 : const int16_t num_freq_bands,
431 : const int32_t output_Fs,
432 : const int16_t num_slots,
433 : const int16_t start_slot_idx,
434 : const char *filename )
435 : {
436 : float *RealBuffer[CLDFB_NO_COL_MAX];
437 : float *ImagBuffer[CLDFB_NO_COL_MAX];
438 : float pcm_out[BINAURAL_CHANNELS][L_FRAME48k];
439 : float *pPcm[BINAURAL_CHANNELS];
440 : float Cldfb_local_Real[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
441 : float Cldfb_local_Imag[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
442 : int16_t sf, ch;
443 :
444 : assert( num_chs <= BINAURAL_CHANNELS );
445 : for ( ch = 0; ch < num_chs; ch++ )
446 : {
447 : for ( sf = start_slot_idx; sf < start_slot_idx + num_slots; sf++ )
448 : {
449 : mvr2r( Cldfb_In_Real[ch][sf], Cldfb_local_Real[ch][sf], num_freq_bands );
450 : mvr2r( Cldfb_In_Imag[ch][sf], Cldfb_local_Imag[ch][sf], num_freq_bands );
451 : RealBuffer[sf - start_slot_idx] = Cldfb_local_Real[ch][sf];
452 : ImagBuffer[sf - start_slot_idx] = Cldfb_local_Imag[ch][sf];
453 : }
454 : cldfbSynthesis( RealBuffer, ImagBuffer, &( pcm_out[ch][0] ), num_freq_bands * num_slots, cldfbSyn[ch] );
455 : pPcm[ch] = pcm_out[ch];
456 : }
457 : dbgwrite_wav( pPcm, num_freq_bands * num_slots, filename, output_Fs, num_chs );
458 :
459 : return;
460 : }
461 : #endif
462 :
463 :
464 : /*-------------------------------------------------------------------------
465 : * Function isar_get_split_rend_md_target_brate()
466 : *
467 : *
468 : *------------------------------------------------------------------------*/
469 :
470 : /*! r: ISAR MD bitrate */
471 0 : int32_t isar_get_split_rend_md_target_brate(
472 : const int32_t SplitRendBitRate, /* i : ISAR bitrate */
473 : const int16_t pcm_out_flag /* i : flag to indicate PCM output */
474 : )
475 : {
476 : int32_t md_bitrate;
477 :
478 0 : if ( pcm_out_flag == 1 )
479 : {
480 0 : md_bitrate = SplitRendBitRate;
481 : }
482 : else
483 : {
484 0 : switch ( SplitRendBitRate )
485 : {
486 0 : case SPLIT_REND_768k:
487 : {
488 0 : md_bitrate = 256000;
489 0 : break;
490 : }
491 0 : case SPLIT_REND_512k:
492 : {
493 0 : md_bitrate = 128000;
494 0 : break;
495 : }
496 0 : case SPLIT_REND_384k:
497 : {
498 0 : md_bitrate = 128000;
499 0 : break;
500 : }
501 0 : default:
502 : {
503 0 : return -1;
504 : }
505 : }
506 : }
507 :
508 0 : return md_bitrate;
509 : }
510 :
511 :
512 : /*-------------------------------------------------------------------------
513 : * Function isar_get_lcld_bitrate()
514 : *
515 : *
516 : *------------------------------------------------------------------------*/
517 :
518 : /*! r: LCLD codec bitrate */
519 0 : int32_t isar_get_lcld_bitrate(
520 : const int32_t SplitRendBitRate, /* i : ISAR bitrate */
521 : const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode /* i : ISAR pose correction mode */
522 : )
523 : {
524 0 : if ( poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
525 : {
526 0 : switch ( SplitRendBitRate )
527 : {
528 0 : case SPLIT_REND_768k:
529 : {
530 0 : return IVAS_512k;
531 : }
532 0 : case SPLIT_REND_512k:
533 : {
534 0 : return IVAS_384k;
535 : }
536 0 : case SPLIT_REND_384k:
537 : {
538 0 : return IVAS_256k;
539 : }
540 0 : default:
541 : {
542 0 : assert( 0 );
543 : }
544 : }
545 : }
546 : else
547 : {
548 0 : return SplitRendBitRate;
549 : }
550 :
551 : return -1;
552 : }
553 :
554 :
555 : /*-------------------------------------------------------------------------
556 : * Function isar_get_lc3plus_bitrate()
557 : *
558 : *
559 : *------------------------------------------------------------------------*/
560 :
561 0 : int32_t isar_get_lc3plus_bitrate(
562 : const int32_t SplitRendBitRate, /* i : ISAR bitrate */
563 : const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, /* i : ISAR pose correction mode */
564 : const int32_t nChannels, /* i : number of channels */
565 : const int32_t codecFrameDurationUs /* i : ISAR frame length in us */
566 : )
567 : {
568 : int32_t bitrate;
569 :
570 0 : bitrate = isar_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode );
571 :
572 : /* Check for LC3plus LEA 48_6 LC3 compatibility mode signalling */
573 0 : if ( ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE == poseCorrectionMode && bitrate == 256000 && nChannels == 2 && codecFrameDurationUs == 10000 )
574 : {
575 0 : bitrate = 2 * 126000;
576 : }
577 :
578 0 : return bitrate;
579 : }
580 :
581 :
582 : /*-------------------------------------------------------------------------
583 : * Function isar_split_rend_validate_config()
584 : *
585 : *
586 : *------------------------------------------------------------------------*/
587 :
588 0 : ivas_error isar_split_rend_validate_config(
589 : const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renderer config */
590 : const int16_t pcm_out_flag /* i : flag to indicate PCM output */
591 : )
592 : {
593 : /* Valid DOF range is 0-3 */
594 0 : if ( pSplitRendConfig->dof < 0 || pSplitRendConfig->dof > 3 )
595 : {
596 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Valid DOF range is 0-3" );
597 : }
598 :
599 : /* Only CLDFB pose correction supports HQ mode */
600 0 : if ( pSplitRendConfig->poseCorrectionMode != ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB && pSplitRendConfig->hq_mode != 0 )
601 : {
602 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Only CLDFB pose correction supports HQ mode" );
603 : }
604 :
605 : /* Split rendering with no pose correction - 0 DOF and pose correction NONE must only ever be set together */
606 0 : if ( ( pSplitRendConfig->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE && pSplitRendConfig->dof != 0 ) ||
607 0 : ( pSplitRendConfig->poseCorrectionMode != ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE && pSplitRendConfig->dof == 0 ) )
608 : {
609 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "0 DOF and pose correction NONE must only ever be set together" );
610 : }
611 :
612 0 : if ( pSplitRendConfig->codec_frame_size_ms != 0 ) /* 0 means "default for current codec", will be set to actual value at a later stage */
613 : {
614 0 : if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LCLD && pSplitRendConfig->codec_frame_size_ms != 5 && pSplitRendConfig->codec_frame_size_ms != 10 && pSplitRendConfig->codec_frame_size_ms != 20 )
615 : {
616 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Invalid framing for LCLD codec" );
617 : }
618 :
619 0 : if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && ( pSplitRendConfig->codec_frame_size_ms != 5 && pSplitRendConfig->codec_frame_size_ms != 10 ) )
620 : {
621 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Invalid framing for LC3plus codec" );
622 : }
623 : }
624 :
625 : /* Validate bitrate */
626 0 : if ( pcm_out_flag == 0 )
627 : {
628 0 : switch ( pSplitRendConfig->splitRendBitRate )
629 : {
630 0 : case SPLIT_REND_256k:
631 0 : if ( pSplitRendConfig->dof != 0 )
632 : {
633 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrates of 320 kbps and lower are only valid with 0 DOF" );
634 : }
635 0 : break;
636 0 : case SPLIT_REND_320k:
637 : /* Only valid with 0 DOF */
638 0 : if ( pSplitRendConfig->dof != 0 )
639 : {
640 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrates of 320 kbps and lower are only valid with 0 DOF" );
641 : }
642 0 : break;
643 0 : case SPLIT_REND_384k:
644 : case SPLIT_REND_512k:
645 : case SPLIT_REND_768k:
646 : /* Always valid */
647 0 : break;
648 0 : default:
649 0 : return IVAS_ERR_LC3PLUS_INVALID_BITRATE;
650 : }
651 : }
652 : else
653 : {
654 0 : if ( pSplitRendConfig->dof == 1 )
655 : {
656 0 : if ( pSplitRendConfig->splitRendBitRate < 34000 )
657 : {
658 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "1DOF metadata needs atleast 34 kbps" );
659 : }
660 : }
661 0 : else if ( pSplitRendConfig->dof == 2 )
662 : {
663 0 : if ( pSplitRendConfig->splitRendBitRate < 50000 )
664 : {
665 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "2DOF metadata needs atleast 50 kbps" );
666 : }
667 : }
668 0 : else if ( pSplitRendConfig->dof == 3 )
669 : {
670 0 : if ( pSplitRendConfig->splitRendBitRate < 82000 )
671 : {
672 0 : return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "3DOF metadata needs atleast 82 kbps" );
673 : }
674 : }
675 : }
676 :
677 0 : return IVAS_ERR_OK;
678 : }
679 :
680 :
681 : /*-------------------------------------------------------------------------
682 : * Function isar_split_rend_get_quant_params()
683 : *
684 : *
685 : *------------------------------------------------------------------------*/
686 :
687 0 : void isar_split_rend_get_quant_params(
688 : const int16_t num_md_bands,
689 : int16_t pred_real_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
690 : int16_t pred_imag_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
691 : int16_t pred_quant_pnts_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
692 : float pred_quantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
693 : float pred_1byquantstep_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
694 : int16_t d_bands_yaw[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
695 : int16_t bands_pitch[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
696 : int16_t pred_real_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
697 : int16_t pred_imag_bands_roll[ISAR_SPLIT_REND_NUM_QUANT_STRATS],
698 : const int16_t ro_flag,
699 : int16_t *num_quant_strats )
700 : {
701 : int16_t q;
702 :
703 0 : *num_quant_strats = ISAR_SPLIT_REND_NUM_QUANT_STRATS;
704 :
705 0 : pred_quant_pnts_yaw[0] = ISAR_SPLIT_REND_PRED_63QUANT_PNTS;
706 0 : pred_quantstep_yaw[0] = ISAR_SPLIT_REND_PRED63_Q_STEP;
707 0 : pred_1byquantstep_yaw[0] = ISAR_SPLIT_REND_PRED63_1BYQ_STEP;
708 0 : for ( q = 1; q < *num_quant_strats; q++ )
709 : {
710 0 : pred_quant_pnts_yaw[q] = ISAR_SPLIT_REND_PRED_31QUANT_PNTS;
711 0 : pred_quantstep_yaw[q] = ISAR_SPLIT_REND_PRED31_Q_STEP;
712 0 : pred_1byquantstep_yaw[q] = ISAR_SPLIT_REND_PRED31_1BYQ_STEP;
713 : }
714 :
715 0 : for ( q = 0; q < *num_quant_strats; q++ )
716 : {
717 0 : pred_real_bands_yaw[q] = num_md_bands;
718 0 : pred_real_bands_roll[q] = num_md_bands;
719 : }
720 :
721 0 : if ( ro_flag )
722 : {
723 0 : for ( q = 0; q < *num_quant_strats; q++ )
724 : {
725 0 : pred_imag_bands_yaw[q] = SPLIT_REND_RO_MD_BAND_THRESH;
726 : }
727 : }
728 : else
729 : {
730 0 : for ( q = 0; q < *num_quant_strats - 2; q++ )
731 : {
732 0 : pred_imag_bands_yaw[q] = num_md_bands;
733 : }
734 0 : pred_imag_bands_yaw[( *num_quant_strats - 2 )] = COMPLEX_MD_BAND_THRESH_HIGH;
735 0 : pred_imag_bands_yaw[( *num_quant_strats - 1 )] = COMPLEX_MD_BAND_THRESH_LOW;
736 : }
737 :
738 0 : for ( q = 0; q < *num_quant_strats; q++ )
739 : {
740 0 : pred_imag_bands_roll[q] = SPLIT_REND_RO_MD_BAND_THRESH;
741 : }
742 :
743 0 : for ( q = 0; q < *num_quant_strats; q++ )
744 : {
745 0 : d_bands_yaw[q] = 0;
746 0 : bands_pitch[q] = num_md_bands;
747 : }
748 :
749 0 : return;
750 : }
751 :
752 :
753 : /*-------------------------------------------------------------------------
754 : * Function isar_renderSplitGetRot_axisNumBits()
755 : *
756 : *
757 : *------------------------------------------------------------------------*/
758 :
759 0 : int16_t isar_renderSplitGetRot_axisNumBits(
760 : const int16_t dof )
761 : {
762 : int16_t num_bits;
763 0 : if ( dof < 3 )
764 : {
765 0 : num_bits = 2;
766 : }
767 : else
768 : {
769 0 : num_bits = 0;
770 : }
771 :
772 0 : return num_bits;
773 : }
774 :
775 :
776 : /*-------------------------------------------------------------------------
777 : * Function isar_renderSplitGetRot_axisFromCode()
778 : *
779 : *
780 : *------------------------------------------------------------------------*/
781 :
782 0 : ISAR_SPLIT_REND_ROT_AXIS isar_renderSplitGetRot_axisFromCode(
783 : const int16_t dof,
784 : const int16_t code )
785 : {
786 : ISAR_SPLIT_REND_ROT_AXIS rot_axis;
787 :
788 0 : if ( dof == 1 )
789 : {
790 0 : rot_axis = (ISAR_SPLIT_REND_ROT_AXIS) code;
791 : }
792 0 : else if ( dof == 2 )
793 : {
794 0 : if ( code == 0 )
795 : {
796 0 : rot_axis = (ISAR_SPLIT_REND_ROT_AXIS) code;
797 : }
798 : else
799 : {
800 0 : rot_axis = (ISAR_SPLIT_REND_ROT_AXIS) ( code - 1 ) + YAW_PITCH;
801 : }
802 : }
803 : else
804 : {
805 0 : rot_axis = (ISAR_SPLIT_REND_ROT_AXIS) DEFAULT_AXIS;
806 : }
807 :
808 0 : return rot_axis;
809 : }
810 :
811 :
812 : /*-------------------------------------------------------------------------
813 : * Function isar_renderSplitGetCodeFromRot_axis()
814 : *
815 : *
816 : *------------------------------------------------------------------------*/
817 :
818 0 : int16_t isar_renderSplitGetCodeFromRot_axis(
819 : const int16_t dof,
820 : const ISAR_SPLIT_REND_ROT_AXIS rot_axis,
821 : int16_t *num_bits )
822 : {
823 0 : int16_t code = 0;
824 :
825 0 : if ( dof == 1 )
826 : {
827 0 : code = (int16_t) rot_axis;
828 : }
829 0 : else if ( dof == 2 )
830 : {
831 0 : if ( rot_axis == DEFAULT_AXIS )
832 : {
833 0 : code = (int16_t) rot_axis;
834 : }
835 : else
836 : {
837 0 : code = (int16_t) ( rot_axis - YAW_PITCH ) + 1;
838 : }
839 : }
840 : else
841 : {
842 0 : code = (int16_t) DEFAULT_AXIS;
843 : }
844 0 : *num_bits = isar_renderSplitGetRot_axisNumBits( dof );
845 :
846 0 : return code;
847 : }
848 :
849 :
850 : /*-------------------------------------------------------------------------
851 : * Function isar_renderSplitGetMultiBinPoseData()
852 : *
853 : *
854 : *------------------------------------------------------------------------*/
855 :
856 0 : void isar_renderSplitGetMultiBinPoseData(
857 : const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, /* i : Split renderer pre-renderer config */
858 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
859 : const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */
860 : )
861 : {
862 : int16_t pos_idx, num_yaw_poses, num_pitch_poses, num_roll_poses;
863 : const float *relative_yaw_angles;
864 : const float *relative_pitch_angles;
865 : const float *relative_roll_angles;
866 :
867 0 : for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
868 : {
869 0 : pMultiBinPoseData->relative_head_poses[pos_idx][0] = 0.0f;
870 0 : pMultiBinPoseData->relative_head_poses[pos_idx][1] = 0.0f;
871 0 : pMultiBinPoseData->relative_head_poses[pos_idx][2] = 0.0f;
872 : }
873 :
874 : /* 0 DOF defaults */
875 0 : num_yaw_poses = 0;
876 0 : num_pitch_poses = 0;
877 0 : num_roll_poses = 0;
878 :
879 : /* defaults for all DOF except 3DOF HQ */
880 0 : relative_yaw_angles = isar_split_rend_relative_yaw_pos_angles_hq;
881 0 : relative_pitch_angles = isar_split_rend_relative_pitch_pos_angles_hq;
882 0 : relative_roll_angles = isar_split_rend_relative_roll_pos_angles_hq;
883 :
884 0 : if ( pSplit_rend_config->dof == 1 )
885 : {
886 0 : switch ( rot_axis )
887 : {
888 0 : case DEFAULT_AXIS:
889 : case YAW:
890 : {
891 0 : num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
892 0 : break;
893 : }
894 0 : case PITCH:
895 : {
896 0 : num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES;
897 0 : break;
898 : }
899 0 : case ROLL:
900 : {
901 0 : num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES;
902 0 : break;
903 : }
904 0 : default:
905 : {
906 0 : assert( 0 && "unsupported rotation axis value" );
907 : }
908 : }
909 : }
910 0 : else if ( pSplit_rend_config->dof == 2 )
911 : {
912 0 : switch ( rot_axis )
913 : {
914 0 : case DEFAULT_AXIS:
915 : case YAW_PITCH:
916 : {
917 0 : num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
918 0 : num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES;
919 0 : break;
920 : }
921 0 : case YAW_ROLL:
922 : {
923 0 : num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
924 0 : num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES;
925 0 : break;
926 : }
927 0 : case PITCH_ROLL:
928 : {
929 0 : num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES;
930 0 : num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES;
931 0 : break;
932 : }
933 0 : default:
934 : {
935 0 : assert( 0 && "unsupported rotation axis value" );
936 : }
937 : }
938 : }
939 0 : else if ( pSplit_rend_config->dof == 3 )
940 : {
941 0 : if ( pSplit_rend_config->hq_mode == 1 )
942 : {
943 0 : relative_yaw_angles = isar_split_rend_relative_yaw_pos_angles_hq;
944 0 : relative_pitch_angles = isar_split_rend_relative_pitch_pos_angles_hq;
945 0 : relative_roll_angles = isar_split_rend_relative_roll_pos_angles_hq;
946 0 : num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
947 0 : num_pitch_poses = SPLIT_REND_MAX_PITCH_ONLY_POSES;
948 0 : num_roll_poses = SPLIT_REND_MAX_ROLL_ONLY_POSES;
949 : }
950 : else
951 : {
952 0 : relative_yaw_angles = isar_split_rend_relative_yaw_pos_angles;
953 0 : relative_pitch_angles = isar_split_rend_relative_pitch_pos_angles;
954 0 : relative_roll_angles = isar_split_rend_relative_roll_pos_angles;
955 0 : num_yaw_poses = SPLIT_REND_MAX_YAW_ONLY_POSES;
956 0 : num_pitch_poses = 1;
957 0 : num_roll_poses = 1;
958 : }
959 : }
960 :
961 0 : pMultiBinPoseData->num_poses = num_yaw_poses + num_pitch_poses + num_roll_poses + 1;
962 0 : assert( pMultiBinPoseData->num_poses <= MAX_HEAD_ROT_POSES );
963 :
964 0 : for ( pos_idx = 0; pos_idx < num_yaw_poses; pos_idx++ )
965 : {
966 0 : pMultiBinPoseData->relative_head_poses[pos_idx + 1][0] = relative_yaw_angles[pos_idx];
967 : }
968 :
969 0 : for ( pos_idx = 0; pos_idx < num_pitch_poses; pos_idx++ )
970 : {
971 0 : pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + 1][1] = relative_pitch_angles[pos_idx];
972 : }
973 :
974 0 : for ( pos_idx = 0; pos_idx < num_roll_poses; pos_idx++ )
975 : {
976 0 : pMultiBinPoseData->relative_head_poses[pos_idx + num_yaw_poses + num_pitch_poses + 1][2] = relative_roll_angles[pos_idx];
977 : }
978 0 : pMultiBinPoseData->dof = pSplit_rend_config->dof;
979 0 : pMultiBinPoseData->hq_mode = pSplit_rend_config->hq_mode;
980 0 : pMultiBinPoseData->rot_axis = rot_axis;
981 0 : pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode;
982 :
983 0 : return;
984 : }
985 :
986 :
987 : /*-------------------------------------------------------------------------
988 : * Function isar_renderSplitUpdateNoCorrectionPoseData()
989 : *
990 : *
991 : *------------------------------------------------------------------------*/
992 :
993 0 : void isar_renderSplitUpdateNoCorrectionPoseData(
994 : const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, /* i : Split renderer pre-renderer config */
995 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData /* i/o: pose correction data handle */
996 : )
997 : {
998 0 : pMultiBinPoseData->num_poses = 1;
999 0 : assert( pSplit_rend_config->dof == 0 );
1000 0 : pMultiBinPoseData->dof = pSplit_rend_config->dof;
1001 0 : assert( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE );
1002 0 : pMultiBinPoseData->poseCorrectionMode = pSplit_rend_config->poseCorrectionMode;
1003 :
1004 0 : return;
1005 : }
1006 :
1007 :
1008 : /*-------------------------------------------------------------------------
1009 : * Function isar_init_multi_bin_pose_data()
1010 : *
1011 : *
1012 : *------------------------------------------------------------------------*/
1013 :
1014 0 : void isar_init_multi_bin_pose_data(
1015 : MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData /* i/o: pose correction data handle */
1016 : )
1017 : {
1018 : int16_t pos_idx;
1019 :
1020 0 : for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
1021 : {
1022 0 : pMultiBinPoseData->relative_head_poses[pos_idx][0] = 0.0f;
1023 0 : pMultiBinPoseData->relative_head_poses[pos_idx][1] = 0.0f;
1024 0 : pMultiBinPoseData->relative_head_poses[pos_idx][2] = 0.0f;
1025 : }
1026 0 : pMultiBinPoseData->num_poses = 1;
1027 0 : pMultiBinPoseData->dof = 3;
1028 0 : pMultiBinPoseData->hq_mode = 0;
1029 0 : pMultiBinPoseData->rot_axis = DEFAULT_AXIS;
1030 :
1031 0 : return;
1032 : }
1033 :
1034 :
1035 : /*-------------------------------------------------------------------------
1036 : * Function isar_framesize_to_ms()
1037 : *
1038 : *
1039 : *------------------------------------------------------------------------*/
1040 :
1041 0 : ivas_error isar_framesize_to_ms(
1042 : const IVAS_RENDER_FRAMESIZE frame_size, /* i : frame size enum */
1043 : int16_t *ms /* o : frame size in ms */
1044 : )
1045 : {
1046 0 : switch ( frame_size )
1047 : {
1048 0 : case IVAS_RENDER_FRAMESIZE_5MS:
1049 0 : *ms = 5;
1050 0 : break;
1051 0 : case IVAS_RENDER_FRAMESIZE_10MS:
1052 0 : *ms = 10;
1053 0 : break;
1054 0 : case IVAS_RENDER_FRAMESIZE_20MS:
1055 0 : *ms = 20;
1056 0 : break;
1057 0 : default:
1058 0 : return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported ISAR frame size" );
1059 : }
1060 :
1061 0 : return IVAS_ERR_OK;
1062 : }
1063 :
1064 :
1065 : /*-------------------------------------------------------------------------
1066 : * Function isar_split_rend_choose_default_codec()
1067 : *
1068 : *
1069 : *------------------------------------------------------------------------*/
1070 :
1071 0 : ivas_error isar_split_rend_choose_default_codec(
1072 : ISAR_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */
1073 : int16_t *pIsar_frame_size_ms, /* i/o: pointer to ISAR frame size setting */
1074 : int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */
1075 : const int16_t cldfb_in_flag, /* i : flag indicating rendering in TD */
1076 : const int16_t pcm_out_flag, /* i : flag to indicate PCM output */
1077 : const int16_t num_subframes /* i : number of subframes */
1078 : )
1079 : {
1080 0 : if ( pcm_out_flag == 0 )
1081 : {
1082 0 : if ( *pCodec == ISAR_SPLIT_REND_CODEC_DEFAULT )
1083 : {
1084 0 : *pCodec = cldfb_in_flag ? ISAR_SPLIT_REND_CODEC_LCLD : ISAR_SPLIT_REND_CODEC_LC3PLUS;
1085 : }
1086 : }
1087 : else
1088 : {
1089 0 : *pCodec = ISAR_SPLIT_REND_CODEC_NONE;
1090 : }
1091 :
1092 0 : if ( *pCodec_frame_size_ms == 0 ) /* codec frame size hasn't been set yet - use default for current configuration */
1093 : {
1094 0 : switch ( *pCodec )
1095 : {
1096 0 : case ISAR_SPLIT_REND_CODEC_LCLD:
1097 0 : *pCodec_frame_size_ms = num_subframes * 5;
1098 0 : break;
1099 0 : case ISAR_SPLIT_REND_CODEC_LC3PLUS:
1100 : case ISAR_SPLIT_REND_CODEC_NONE:
1101 0 : *pCodec_frame_size_ms = 5;
1102 0 : break;
1103 0 : default:
1104 0 : return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unknown split codec value" );
1105 : }
1106 0 : }
1107 :
1108 0 : if ( *pIsar_frame_size_ms == 0 ) /* ISAR frame size hasn't been set yet - use default for current configuration */
1109 : {
1110 0 : *pIsar_frame_size_ms = 20;
1111 : }
1112 :
1113 0 : return IVAS_ERR_OK;
1114 : }
1115 :
1116 :
1117 : /*-------------------------------------------------------------------*
1118 : * Function get_bit()
1119 : *
1120 : *
1121 : *-------------------------------------------------------------------*/
1122 :
1123 0 : int32_t get_bit(
1124 : const int32_t state,
1125 : const int32_t bit_id )
1126 : {
1127 0 : return ( state & ( 1 << bit_id ) );
1128 : }
|