Line data Source code
1 : /****************************************************************************************************** 2 : 3 : (C) 2022-2026 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_prot.h" 37 : #include "ivas_stat_dec.h" 38 : #ifdef DEBUGGING 39 : #include "debug.h" 40 : #include <assert.h> 41 : #endif 42 : #include "wmc_auto.h" 43 : 44 : 45 : /*-------------------------------------------------------------------------* 46 : * ivas_renderer_select() 47 : * 48 : * Select and configure IVAS renderer parameters 49 : *-------------------------------------------------------------------------*/ 50 : 51 21090631 : void ivas_renderer_select( 52 : Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ 53 : ) 54 : { 55 : RENDERER_TYPE *renderer_type; 56 : AUDIO_CONFIG *internal_config; 57 : AUDIO_CONFIG output_config; 58 : AUDIO_CONFIG transport_config; 59 : 60 : int16_t nchan_internal; 61 : 62 21090631 : renderer_type = &( st_ivas->renderer_type ); 63 21090631 : internal_config = &( st_ivas->intern_config ); 64 21090631 : output_config = st_ivas->hDecoderConfig->output_config; 65 21090631 : transport_config = st_ivas->transport_config; 66 : 67 : /* disabled rendering by default */ 68 21090631 : *renderer_type = RENDERER_DISABLE; 69 : 70 : /*-----------------------------------------------------------------* 71 : * Binaural rendering configurations 72 : *-----------------------------------------------------------------*/ 73 : 74 21090631 : if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData ) 75 : { 76 2779269 : st_ivas->hCombinedOrientationData->shd_rot_max_order = -1; 77 : } 78 : 79 21090631 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) 80 : { 81 7539915 : if ( st_ivas->ivas_format == MONO_FORMAT ) 82 : { 83 162 : *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; 84 : } 85 7539753 : else if ( st_ivas->ivas_format == STEREO_FORMAT ) 86 : { 87 8910 : *renderer_type = RENDERER_DISABLE; 88 : } 89 7530843 : else if ( st_ivas->ivas_format == ISM_FORMAT ) 90 : { 91 1414556 : if ( st_ivas->ism_mode == ISM_MODE_PARAM ) 92 : { 93 268580 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) 94 : { 95 182246 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC; 96 : } 97 : else 98 : { 99 86334 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; 100 : } 101 : } 102 : else /* ISM_MODE_DISC */ 103 : { 104 1145976 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) 105 : { 106 844976 : *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; 107 844976 : *internal_config = output_config; 108 : } 109 : else 110 : { 111 301000 : *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; 112 301000 : *internal_config = IVAS_AUDIO_CONFIG_7_1_4; 113 : } 114 : } 115 : } 116 6116287 : else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && st_ivas->nchan_transport <= 2 ) ) 117 : { 118 3128734 : *internal_config = output_config; 119 : 120 3128734 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) 121 : { 122 1665284 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC; 123 : } 124 : else 125 : { 126 1463450 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; 127 : } 128 : } 129 2987553 : else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) 130 : { 131 1307668 : *internal_config = IVAS_AUDIO_CONFIG_HOA3; 132 : 133 1307668 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) 134 : { 135 912836 : *renderer_type = RENDERER_BINAURAL_FASTCONV; 136 : } 137 : else 138 : { 139 394832 : *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; 140 : } 141 : 142 1307668 : if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) 143 : { 144 179483 : *internal_config = IVAS_AUDIO_CONFIG_7_1_4; 145 : } 146 : 147 1307668 : if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData ) 148 : { 149 : 150 435730 : nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); 151 435730 : if ( nchan_internal == 2 ) 152 : { 153 439 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 1; 154 : } 155 435291 : else if ( nchan_internal == 4 || nchan_internal == 3 ) 156 : { 157 347260 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 0; 158 : } 159 88031 : else if ( nchan_internal == 6 || nchan_internal == 5 ) 160 : { 161 0 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 2; 162 : } 163 88031 : else if ( nchan_internal == 8 || nchan_internal == 7 ) 164 : { 165 21296 : st_ivas->hCombinedOrientationData->shd_rot_max_order = 3; 166 : } 167 : } 168 : } 169 1679885 : else if ( st_ivas->ivas_format == MC_FORMAT ) 170 : { 171 1679885 : if ( st_ivas->mc_mode == MC_MODE_MCMASA ) 172 : { 173 307774 : *internal_config = output_config; 174 : 175 307774 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) 176 : { 177 145295 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC; 178 : } 179 : else 180 : { 181 162479 : *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; 182 : } 183 : } 184 : else 185 : { 186 1372111 : *internal_config = transport_config; 187 : 188 1372111 : if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) 189 : { 190 1057225 : if ( ( st_ivas->transport_config == IVAS_AUDIO_CONFIG_5_1 || st_ivas->transport_config == IVAS_AUDIO_CONFIG_7_1 ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData ) && st_ivas->mc_mode == MC_MODE_MCT ) 191 : { 192 226561 : *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; 193 : } 194 : else 195 : { 196 830664 : if ( st_ivas->mc_mode == MC_MODE_MCT ) 197 : { 198 503832 : *renderer_type = RENDERER_BINAURAL_MIXER_CONV; 199 : } 200 : else 201 : { 202 326832 : *renderer_type = RENDERER_BINAURAL_FASTCONV; 203 : } 204 : 205 830664 : if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData ) 206 : { 207 : /* force HOA3 domain for rotation*/ 208 250545 : *internal_config = IVAS_AUDIO_CONFIG_HOA3; 209 : } 210 : } 211 : } 212 : else 213 : { 214 314886 : if ( st_ivas->mc_mode == MC_MODE_MCT ) 215 : { 216 233273 : *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; 217 : } 218 : else 219 : { 220 81613 : *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; 221 : } 222 : } 223 : } 224 : } 225 : } 226 : 227 : /*-----------------------------------------------------------------* 228 : * Non-binaural rendering configurations 229 : *-----------------------------------------------------------------*/ 230 : 231 13550716 : else if ( st_ivas->ivas_format == MONO_FORMAT || st_ivas->ivas_format == STEREO_FORMAT ) 232 : { 233 2417636 : if ( st_ivas->ivas_format == MONO_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO ) 234 : { 235 61 : *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; 236 : } 237 2417575 : else if ( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) 238 : { 239 45657 : *renderer_type = RENDERER_MC; 240 : } 241 2371918 : else if ( st_ivas->ivas_format == STEREO_FORMAT && 242 2335111 : ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) 243 : { 244 41974 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 245 : } 246 : } 247 11133080 : else if ( st_ivas->ivas_format == ISM_FORMAT ) 248 : { 249 1637514 : if ( ( output_config == IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) ) 250 : { 251 29092 : *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; 252 : } 253 : else 254 : { 255 1608422 : if ( st_ivas->ism_mode == ISM_MODE_PARAM ) 256 : { 257 264832 : *renderer_type = RENDERER_PARAM_ISM; 258 264832 : if ( output_config == IVAS_AUDIO_CONFIG_MONO ) 259 : { 260 34179 : *renderer_type = RENDERER_MONO_DOWNMIX; 261 : } 262 230653 : else if ( output_config == IVAS_AUDIO_CONFIG_STEREO ) 263 : { 264 41942 : *renderer_type = RENDERER_DISABLE; 265 : } 266 188711 : else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) 267 : { 268 115912 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 269 115912 : *internal_config = IVAS_AUDIO_CONFIG_7_1_4; 270 : } 271 : } 272 : else /* ISM_MODE_DISC */ 273 : { 274 1343590 : *renderer_type = RENDERER_TD_PANNING; 275 1343590 : if ( output_config == IVAS_AUDIO_CONFIG_MONO ) 276 : { 277 104401 : *renderer_type = RENDERER_MONO_DOWNMIX; 278 : } 279 1239189 : else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) 280 : { 281 276684 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 282 : } 283 962505 : else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) 284 : { 285 489797 : *renderer_type = RENDERER_DISABLE; 286 : } 287 : } 288 : } 289 : } 290 9495566 : else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) 291 7573664 : { 292 : IVAS_FORMAT ivas_format; 293 7573664 : *renderer_type = RENDERER_DIRAC; 294 7573664 : ivas_format = ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_NONE ) ? SBA_FORMAT : st_ivas->ivas_format; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */ 295 : 296 7573664 : if ( ivas_format == SBA_FORMAT && ( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) ) 297 : { 298 4049953 : if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) 299 : { 300 : /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */ 301 : } 302 3763844 : else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA ) 303 : { 304 3419558 : *internal_config = output_config; 305 : } 306 : else 307 : { 308 344286 : *internal_config = IVAS_AUDIO_CONFIG_HOA3; 309 : } 310 4049953 : *renderer_type = RENDERER_SBA_LINEAR_DEC; 311 : } 312 3523711 : else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) || 313 1210573 : ( ivas_format == SBA_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_MONO ) ) ) 314 : { 315 526531 : *renderer_type = RENDERER_DISABLE; 316 : } 317 2997180 : else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) ) 318 : { 319 52856 : *renderer_type = RENDERER_DISABLE; 320 : } 321 2944324 : else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO ) 322 : { 323 187515 : *renderer_type = RENDERER_STEREO_PARAMETRIC; 324 : } 325 2756809 : else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) 326 : { 327 489280 : *renderer_type = RENDERER_DISABLE; 328 : } 329 2267529 : else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO ) 330 : { 331 78940 : *renderer_type = RENDERER_OSBA_STEREO; 332 : } 333 2188589 : else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO ) 334 : { 335 65843 : *renderer_type = RENDERER_MONO_DOWNMIX; 336 : } 337 2122746 : else if ( ivas_format == SBA_ISM_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) 338 : { 339 167014 : *renderer_type = RENDERER_OSBA_AMBI; 340 : } 341 1955732 : else if ( ivas_format == SBA_ISM_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) 342 : { 343 245206 : *renderer_type = RENDERER_OSBA_LS; 344 : } 345 1710526 : else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) 346 : { 347 109224 : *renderer_type = RENDERER_SBA_LINEAR_DEC; 348 : } 349 : } 350 1921902 : else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) 351 : { 352 901892 : *renderer_type = RENDERER_DIRAC; 353 : 354 901892 : if ( output_config == IVAS_AUDIO_CONFIG_MONO ) 355 : { 356 153315 : *renderer_type = RENDERER_MONO_DOWNMIX; 357 : } 358 748577 : else if ( output_config == IVAS_AUDIO_CONFIG_STEREO ) 359 : { 360 150264 : *renderer_type = RENDERER_STEREO_PARAMETRIC; 361 : } 362 598313 : else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) 363 : { 364 121417 : if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) 365 : { 366 14551 : *renderer_type = RENDERER_OMASA_OBJECT_EXT; 367 : } 368 106866 : else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ ) 369 : { 370 13160 : *renderer_type = RENDERER_OMASA_MIX_EXT; 371 : } 372 : else 373 : { 374 93706 : *renderer_type = RENDERER_DISABLE; 375 : } 376 : } 377 : } 378 1020010 : else if ( st_ivas->ivas_format == MC_FORMAT ) 379 : { 380 1020010 : *internal_config = transport_config; 381 1020010 : if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) 382 : { 383 286014 : if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 ) 384 : { 385 239043 : *renderer_type = RENDERER_MC; 386 : } 387 : else 388 : { 389 46971 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 390 : } 391 : } 392 733996 : else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) 393 : { 394 37316 : *internal_config = transport_config; 395 37316 : if ( *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) 396 : { 397 8566 : if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 ) 398 : { 399 4774 : *renderer_type = RENDERER_MC; 400 : } 401 : else 402 : { 403 3792 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 404 : } 405 : } 406 : } 407 696680 : else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) 408 : { 409 152111 : if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) 410 : { 411 26096 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 412 : } 413 : else 414 : { 415 126015 : *renderer_type = RENDERER_MC_PARAMMC; 416 : } 417 : } 418 544569 : else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) 419 : { 420 381910 : if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) 421 : { 422 327603 : *internal_config = output_config; 423 : } 424 : 425 : /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */ 426 381910 : if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) 427 : { 428 184102 : if ( st_ivas->nchan_transport == 1 ) 429 : { 430 93999 : *renderer_type = RENDERER_DISABLE; 431 : } 432 90103 : else if ( output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled ) 433 : { 434 3177 : *renderer_type = RENDERER_DISABLE; 435 : } 436 : else 437 : { 438 86926 : *renderer_type = RENDERER_MCMASA_MONO_STEREO; 439 : } 440 : } 441 : else 442 : { 443 197808 : *renderer_type = RENDERER_DIRAC; 444 197808 : if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) 445 : { 446 48872 : *renderer_type = RENDERER_SBA_LINEAR_ENC; 447 48872 : *internal_config = transport_config; 448 : } 449 148936 : else if ( transport_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 ) ) 450 : { 451 1884 : *internal_config = transport_config; 452 : } 453 : } 454 : } 455 : } 456 : 457 21090631 : return; 458 : } 459 : 460 : 461 : /*-------------------------------------------------------------------------* 462 : * ivas_renderer_secondary_select() 463 : * 464 : * Select IVAS secondary binaural renderer (used in combined formats) 465 : *-------------------------------------------------------------------------*/ 466 : 467 : /*! r: secondary binaural renderer type */ 468 42134784 : RENDERER_TYPE ivas_renderer_secondary_select( 469 : Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ 470 : ) 471 : { 472 : RENDERER_TYPE renderer_type; 473 : AUDIO_CONFIG output_config; 474 : 475 : /* disabled by default */ 476 42134784 : renderer_type = RENDERER_DISABLE; 477 42134784 : output_config = st_ivas->hDecoderConfig->output_config; 478 : 479 42134784 : if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && 480 1143605 : ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) 481 : { 482 255437 : renderer_type = RENDERER_BINAURAL_OBJECTS_TD; 483 : } 484 41879347 : else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) 485 : { 486 924425 : renderer_type = RENDERER_BINAURAL_OBJECTS_TD; 487 : } 488 : 489 42134784 : return renderer_type; 490 : }