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 "ivas_cnst.h"
36 : #include "ivas_stat_dec.h"
37 : #include "wmc_auto.h"
38 : #include "ivas_prot_fx.h"
39 :
40 :
41 : /*-------------------------------------------------------------------------*
42 : * ivas_renderer_select()
43 : *
44 : * Select and configure IVAS renderer parameters
45 : *-------------------------------------------------------------------------*/
46 8917 : void ivas_renderer_select(
47 : Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
48 : )
49 : {
50 : RENDERER_TYPE *renderer_type;
51 : AUDIO_CONFIG *internal_config;
52 : AUDIO_CONFIG output_config;
53 : AUDIO_CONFIG transport_config;
54 :
55 : Word16 nchan_internal;
56 :
57 8917 : renderer_type = &( st_ivas->renderer_type );
58 8917 : internal_config = &( st_ivas->intern_config );
59 8917 : output_config = st_ivas->hDecoderConfig->output_config;
60 8917 : move16();
61 8917 : transport_config = st_ivas->transport_config;
62 8917 : move16();
63 :
64 : /* disabled rendering by default */
65 8917 : *renderer_type = RENDERER_DISABLE;
66 8917 : move16();
67 :
68 : /*-----------------------------------------------------------------*
69 : * Binaural rendering configurations
70 : *-----------------------------------------------------------------*/
71 :
72 8917 : test();
73 8917 : IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
74 : {
75 135 : st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
76 135 : move16();
77 : }
78 :
79 8917 : test();
80 8917 : test();
81 8917 : test();
82 8917 : test();
83 8917 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
84 : {
85 2966 : test();
86 2966 : test();
87 2966 : test();
88 2966 : test();
89 2966 : test();
90 2966 : IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
91 : {
92 481 : IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
93 : {
94 186 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
95 : {
96 89 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
97 89 : move16();
98 : }
99 : ELSE
100 : {
101 97 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
102 97 : move16();
103 : }
104 : }
105 : ELSE /* ISM_MODE_DISC */
106 : {
107 295 : test();
108 295 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
109 : {
110 36 : *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
111 36 : move16();
112 36 : *internal_config = output_config;
113 36 : move16();
114 : }
115 : ELSE
116 : {
117 259 : *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
118 259 : move16();
119 259 : *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
120 259 : move16();
121 : }
122 : }
123 : }
124 2485 : ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && LE_16( st_ivas->nchan_transport, 2 ) ) )
125 : {
126 1503 : *internal_config = output_config;
127 1503 : move16();
128 1503 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
129 : {
130 1074 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
131 1074 : move16();
132 : }
133 : ELSE
134 : {
135 429 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
136 429 : move16();
137 : }
138 : }
139 982 : ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
140 : {
141 249 : *internal_config = IVAS_AUDIO_CONFIG_HOA3;
142 249 : move16();
143 :
144 249 : test();
145 249 : test();
146 249 : test();
147 : #ifdef FIX_1158_FASTCONV_REVERB_HRTF
148 249 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
149 : #else
150 : test();
151 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
152 : #endif
153 : {
154 239 : *renderer_type = RENDERER_BINAURAL_FASTCONV;
155 239 : move16();
156 : }
157 : ELSE
158 : {
159 10 : *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
160 10 : move16();
161 : }
162 :
163 249 : test();
164 249 : IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( *renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
165 : {
166 3 : *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
167 3 : move16();
168 : }
169 :
170 249 : test();
171 249 : IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
172 : {
173 17 : nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
174 17 : test();
175 17 : test();
176 17 : test();
177 17 : IF( EQ_16( nchan_internal, 2 ) )
178 : {
179 0 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
180 0 : move16();
181 : }
182 17 : ELSE IF( EQ_16( nchan_internal, 4 ) || EQ_16( nchan_internal, 3 ) )
183 : {
184 13 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
185 13 : move16();
186 : }
187 4 : ELSE IF( EQ_16( nchan_internal, 6 ) || EQ_16( nchan_internal, 5 ) )
188 : {
189 0 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 2;
190 0 : move16();
191 : }
192 4 : ELSE IF( EQ_16( nchan_internal, 8 ) || EQ_16( nchan_internal, 7 ) )
193 : {
194 2 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
195 2 : move16();
196 : }
197 : }
198 : }
199 733 : ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
200 : {
201 733 : IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
202 : {
203 268 : *internal_config = output_config;
204 268 : move16();
205 :
206 268 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
207 : {
208 88 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
209 88 : move16();
210 : }
211 : ELSE
212 : {
213 180 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
214 180 : move16();
215 : }
216 : }
217 : ELSE
218 : {
219 465 : *internal_config = transport_config;
220 465 : move16();
221 465 : test();
222 465 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
223 : {
224 288 : test();
225 288 : test();
226 288 : test();
227 288 : test();
228 288 : IF( ( EQ_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_7_1 ) ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
229 : {
230 14 : *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
231 14 : move16();
232 : }
233 : ELSE
234 : {
235 274 : IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
236 : {
237 157 : *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
238 157 : move16();
239 : }
240 : ELSE
241 : {
242 117 : *renderer_type = RENDERER_BINAURAL_FASTCONV;
243 117 : move16();
244 : }
245 :
246 274 : test();
247 274 : IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
248 : {
249 : /* force HOA3 domain for rotation*/
250 15 : *internal_config = IVAS_AUDIO_CONFIG_HOA3;
251 15 : move16();
252 : }
253 : }
254 : }
255 : ELSE
256 : {
257 177 : IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
258 : {
259 104 : *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
260 104 : move16();
261 : }
262 : ELSE
263 : {
264 73 : *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
265 73 : move16();
266 : }
267 : }
268 : }
269 : }
270 : }
271 :
272 : /*-----------------------------------------------------------------*
273 : * Non-binaural rendering configurations
274 : *-----------------------------------------------------------------*/
275 :
276 5951 : ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
277 : {
278 3 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
279 : {
280 1 : *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
281 1 : move16();
282 : }
283 : }
284 5948 : ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
285 : {
286 68 : test();
287 : #ifdef FIX_1052_EXT_OUTPUT
288 68 : test();
289 68 : IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
290 : #else
291 : IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
292 : #endif
293 : {
294 0 : *renderer_type = RENDERER_MC;
295 0 : move16();
296 : }
297 : }
298 5880 : ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
299 : {
300 600 : test();
301 600 : IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
302 : {
303 1 : *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
304 1 : move16();
305 : }
306 : ELSE
307 : {
308 599 : IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
309 : {
310 79 : *renderer_type = RENDERER_PARAM_ISM;
311 79 : test();
312 79 : test();
313 79 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
314 : {
315 1 : *renderer_type = RENDERER_MONO_DOWNMIX;
316 1 : move16();
317 : }
318 78 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
319 : {
320 1 : *renderer_type = RENDERER_DISABLE;
321 1 : move16();
322 : }
323 77 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
324 : {
325 23 : *renderer_type = RENDERER_SBA_LINEAR_ENC;
326 23 : move16();
327 23 : *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
328 23 : move16();
329 : }
330 : }
331 : ELSE /* ISM_MODE_DISC */
332 : {
333 520 : *renderer_type = RENDERER_TD_PANNING;
334 520 : test();
335 520 : test();
336 520 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
337 : {
338 2 : *renderer_type = RENDERER_MONO_DOWNMIX;
339 2 : move16();
340 : }
341 518 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
342 : {
343 81 : *renderer_type = RENDERER_SBA_LINEAR_ENC;
344 81 : move16();
345 : }
346 437 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
347 : {
348 428 : *renderer_type = RENDERER_DISABLE;
349 428 : move16();
350 : }
351 : }
352 : }
353 : }
354 5280 : ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
355 2855 : {
356 : IVAS_FORMAT ivas_format;
357 2855 : *renderer_type = RENDERER_DIRAC;
358 2855 : move16();
359 :
360 2855 : test();
361 2855 : IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MODE_NONE ) )
362 : {
363 117 : ivas_format = SBA_FORMAT; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */
364 : }
365 : ELSE
366 : {
367 2738 : ivas_format = st_ivas->ivas_format;
368 : }
369 2855 : move16();
370 :
371 2855 : test();
372 2855 : test();
373 2855 : test();
374 2855 : test();
375 2855 : test();
376 2855 : test();
377 2855 : test();
378 2855 : test();
379 2855 : test();
380 2855 : test();
381 2855 : test();
382 2855 : test();
383 2855 : test();
384 2855 : test();
385 2855 : test();
386 2855 : test();
387 2855 : test();
388 2855 : test();
389 2855 : test();
390 2855 : test();
391 2855 : test();
392 2855 : test();
393 2855 : test();
394 2855 : test();
395 2855 : test();
396 2855 : test();
397 2855 : test();
398 2855 : test();
399 2855 : test();
400 : #ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
401 : test();
402 : test();
403 : #endif
404 2855 : IF( EQ_32( ivas_format, SBA_FORMAT ) && ( NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) )
405 : {
406 864 : test();
407 864 : test();
408 : #ifdef NONBE_FIX_1052_SBA_EXT_FIX
409 864 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
410 : {
411 : /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
412 : }
413 481 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) )
414 : #else
415 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) )
416 : #endif
417 : {
418 359 : *internal_config = output_config;
419 359 : move16();
420 : }
421 : #ifdef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
422 : ELSE
423 : {
424 122 : *internal_config = IVAS_AUDIO_CONFIG_HOA3;
425 122 : move16();
426 : }
427 : #else
428 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
429 : {
430 : *internal_config = IVAS_AUDIO_CONFIG_FOA;
431 : move16();
432 : }
433 : #ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
434 : ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
435 : #else
436 : IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
437 : #endif
438 : {
439 : *internal_config = IVAS_AUDIO_CONFIG_HOA3;
440 : move16();
441 : }
442 : #endif
443 864 : *renderer_type = RENDERER_SBA_LINEAR_DEC;
444 864 : move16();
445 : }
446 1991 : ELSE IF( ( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ||
447 : ( EQ_32( ivas_format, SBA_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) ) ) )
448 : {
449 250 : *renderer_type = RENDERER_DISABLE;
450 250 : move16();
451 : }
452 1741 : ELSE IF( ( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && LT_32( st_ivas->hDecoderConfig->ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && GT_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) )
453 : {
454 97 : *renderer_type = RENDERER_DISABLE;
455 97 : move16();
456 : }
457 1644 : ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
458 : {
459 345 : *renderer_type = RENDERER_STEREO_PARAMETRIC;
460 345 : move16();
461 : }
462 1299 : ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
463 : {
464 79 : *renderer_type = RENDERER_DISABLE;
465 79 : move16();
466 : }
467 : #ifndef FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX
468 : ELSE IF( EQ_32( ivas_format, SBA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
469 : {
470 : *renderer_type = RENDERER_SBA_LINEAR_DEC;
471 : move16();
472 : }
473 : #endif
474 1220 : ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
475 : {
476 37 : *renderer_type = RENDERER_OSBA_STEREO;
477 37 : move16();
478 : }
479 1183 : ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
480 : {
481 1 : *renderer_type = RENDERER_MONO_DOWNMIX;
482 1 : move16();
483 : }
484 1182 : ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) )
485 : {
486 1 : *renderer_type = RENDERER_OSBA_AMBI;
487 1 : move16();
488 : }
489 1181 : ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) )
490 : {
491 2 : *renderer_type = RENDERER_OSBA_LS;
492 2 : move16();
493 : }
494 1179 : ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
495 : {
496 38 : *renderer_type = RENDERER_SBA_LINEAR_DEC;
497 38 : move16();
498 : }
499 : }
500 2425 : ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
501 : {
502 1753 : *renderer_type = RENDERER_DIRAC;
503 1753 : move16();
504 :
505 1753 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
506 : {
507 223 : *renderer_type = RENDERER_MONO_DOWNMIX;
508 223 : move16();
509 : }
510 1530 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
511 : {
512 437 : *renderer_type = RENDERER_STEREO_PARAMETRIC;
513 437 : move16();
514 : }
515 1093 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
516 : {
517 : #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
518 114 : IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
519 : {
520 39 : *renderer_type = RENDERER_OMASA_OBJECT_EXT;
521 39 : move32();
522 : }
523 75 : ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) )
524 : {
525 36 : *renderer_type = RENDERER_OMASA_MIX_EXT;
526 36 : move32();
527 : }
528 : ELSE
529 : {
530 39 : *renderer_type = RENDERER_DISABLE;
531 39 : move32();
532 : }
533 : #else
534 : *renderer_type = RENDERER_DISABLE;
535 : move16();
536 : #endif
537 : }
538 : }
539 672 : ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
540 : {
541 672 : *internal_config = transport_config;
542 672 : move16();
543 :
544 672 : test();
545 : #ifdef FIX_1052_EXT_OUTPUT
546 672 : test();
547 672 : IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
548 : #else
549 : IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) )
550 : #endif
551 : {
552 199 : test();
553 199 : test();
554 199 : IF( NE_32( output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
555 : {
556 101 : *renderer_type = RENDERER_MC;
557 101 : move16();
558 : }
559 : ELSE
560 : {
561 98 : *renderer_type = RENDERER_SBA_LINEAR_ENC;
562 98 : move16();
563 : }
564 : }
565 473 : ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
566 : {
567 6 : *internal_config = transport_config;
568 6 : move16();
569 :
570 : #ifdef FIX_1052_EXT_OUTPUT
571 6 : test();
572 6 : IF( NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
573 : #else
574 : IF( NE_32( *internal_config, output_config ) )
575 : #endif
576 : {
577 3 : test();
578 3 : test();
579 3 : IF( NE_32( output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
580 : {
581 1 : *renderer_type = RENDERER_MC;
582 1 : move16();
583 : }
584 : ELSE
585 : {
586 2 : *renderer_type = RENDERER_SBA_LINEAR_ENC;
587 2 : move16();
588 : }
589 : }
590 : }
591 467 : ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) )
592 : {
593 160 : test();
594 160 : test();
595 160 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
596 : {
597 72 : *renderer_type = RENDERER_SBA_LINEAR_ENC;
598 72 : move16();
599 : }
600 : ELSE
601 : {
602 88 : *renderer_type = RENDERER_MC_PARAMMC;
603 : }
604 : }
605 307 : ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
606 : {
607 : #ifdef FIX_1052_EXT_OUTPUT
608 280 : if ( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
609 : {
610 218 : *internal_config = output_config;
611 218 : move16();
612 : }
613 : #else
614 : *internal_config = output_config;
615 : move16();
616 : #endif
617 :
618 : /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
619 280 : test();
620 280 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
621 : {
622 23 : test();
623 23 : test();
624 23 : IF( EQ_16( st_ivas->nchan_transport, 1 ) )
625 : {
626 8 : *renderer_type = RENDERER_DISABLE;
627 8 : move16();
628 : }
629 15 : ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && EQ_16( st_ivas->nchan_transport, 2 ) && !st_ivas->hOutSetup.separateChannelEnabled )
630 : {
631 1 : *renderer_type = RENDERER_DISABLE;
632 1 : move16();
633 : }
634 : ELSE
635 : {
636 14 : *renderer_type = RENDERER_MCMASA_MONO_STEREO;
637 14 : move16();
638 : }
639 : }
640 : ELSE
641 : {
642 257 : *renderer_type = RENDERER_DIRAC;
643 257 : test();
644 257 : test();
645 257 : test();
646 257 : test();
647 257 : IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
648 : {
649 114 : *renderer_type = RENDERER_SBA_LINEAR_ENC;
650 114 : *internal_config = transport_config;
651 114 : move16();
652 : }
653 143 : ELSE IF( EQ_32( transport_config, IVAS_AUDIO_CONFIG_5_1 ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) ) )
654 : {
655 0 : *internal_config = transport_config;
656 0 : move16();
657 : }
658 : }
659 : }
660 : }
661 :
662 8917 : return;
663 : }
|