LCOV - code coverage report
Current view: top level - lib_dec - ivas_output_config.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ fec202a8f89be4a2f278a9fc377bfb58b58fab11 Lines: 162 165 98.2 %
Date: 2025-09-11 08:49:07 Functions: 2 2 100.0 %

          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_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     1261359 : 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     1261359 :     renderer_type = &( st_ivas->renderer_type );
      63     1261359 :     internal_config = &( st_ivas->intern_config );
      64     1261359 :     output_config = st_ivas->hDecoderConfig->output_config;
      65     1261359 :     transport_config = st_ivas->transport_config;
      66             : 
      67             :     /* disabled rendering by default */
      68     1261359 :     *renderer_type = RENDERER_DISABLE;
      69             : 
      70             :     /*-----------------------------------------------------------------*
      71             :      * Binaural rendering configurations
      72             :      *-----------------------------------------------------------------*/
      73             : 
      74     1261359 :     if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
      75             :     {
      76      208050 :         st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
      77             :     }
      78             : 
      79     1261359 :     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      508905 :         if ( st_ivas->ivas_format == ISM_FORMAT )
      82             :         {
      83      159732 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
      84             :             {
      85       33312 :                 if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
      86             :                 {
      87       23577 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
      88             :                 }
      89             :                 else
      90             :                 {
      91        9735 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
      92             :                 }
      93             :             }
      94             :             else /* ISM_MODE_DISC */
      95             :             {
      96      126420 :                 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 )
      97             :                 {
      98             : #ifdef DEBUGGING
      99             :                     if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER )
     100             :                     {
     101             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV;
     102             :                         *internal_config = IVAS_AUDIO_CONFIG_HOA3; /* Render ISM to HOA3 before binauralization*/
     103             :                     }
     104             :                     else
     105             :                     {
     106             :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     107             :                         *internal_config = output_config;
     108             :                     }
     109             : #else
     110       93711 :                     *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     111       93711 :                     *internal_config = output_config;
     112             : #endif
     113             :                 }
     114             :                 else
     115             :                 {
     116       32709 :                     *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     117             : #ifdef DEBUGGING
     118             :                     if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV )
     119             :                     {
     120             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     121             :                     }
     122             : #endif
     123       32709 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     124             :                 }
     125             :             }
     126             :         }
     127      349173 :         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 ) )
     128             :         {
     129      154824 :             *internal_config = output_config;
     130             : 
     131      154824 :             if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     132             :             {
     133       83655 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     134             :             }
     135             :             else
     136             :             {
     137       71169 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     138             :             }
     139             :         }
     140      194349 :         else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     141             :         {
     142       94755 :             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     143             : 
     144       94755 :             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 )
     145             :             {
     146       61872 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV;
     147             :             }
     148             :             else
     149             :             {
     150       32883 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     151             :             }
     152             : 
     153       94755 :             if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
     154             :             {
     155       12012 :                 *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     156             :             }
     157             : 
     158       94755 :             if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     159             :             {
     160             : 
     161       31101 :                 nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
     162       31101 :                 if ( nchan_internal == 2 )
     163             :                 {
     164          27 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
     165             :                 }
     166       31074 :                 else if ( nchan_internal == 4 || nchan_internal == 3 )
     167             :                 {
     168       27621 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
     169             :                 }
     170        3453 :                 else if ( nchan_internal == 6 || nchan_internal == 5 )
     171             :                 {
     172           0 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 2;
     173             :                 }
     174        3453 :                 else if ( nchan_internal == 8 || nchan_internal == 7 )
     175             :                 {
     176         300 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
     177             :                 }
     178             :             }
     179             :         }
     180       99594 :         else if ( st_ivas->ivas_format == MC_FORMAT )
     181             :         {
     182       99594 :             if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     183             :             {
     184       21951 :                 *internal_config = output_config;
     185             : 
     186       21951 :                 if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     187             :                 {
     188       10437 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     189             :                 }
     190             :                 else
     191             :                 {
     192       11514 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     193             :                 }
     194             :             }
     195             :             else
     196             :             {
     197       77643 :                 *internal_config = transport_config;
     198             : 
     199       77643 :                 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 )
     200             :                 {
     201             : #ifdef DEBUGGING
     202             :                     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->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && st_ivas->mc_mode == MC_MODE_MCT && st_ivas->hDecoderConfig->force_rend != FORCE_CLDFB_RENDERER )
     203             : #else
     204       52542 :                     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->mc_mode == MC_MODE_MCT )
     205             : #endif
     206             :                     {
     207        9399 :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     208             :                     }
     209             :                     else
     210             :                     {
     211       43143 :                         if ( st_ivas->mc_mode == MC_MODE_MCT )
     212             :                         {
     213       23430 :                             *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
     214             :                         }
     215             :                         else
     216             :                         {
     217       19713 :                             *renderer_type = RENDERER_BINAURAL_FASTCONV;
     218             :                         }
     219             : 
     220       43143 :                         if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     221             :                         {
     222             :                             /* force HOA3 domain for rotation*/
     223       11700 :                             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     224             :                         }
     225             :                     }
     226             :                 }
     227             :                 else
     228             :                 {
     229       25101 :                     if ( st_ivas->mc_mode == MC_MODE_MCT )
     230             :                     {
     231       17772 :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     232             :                     }
     233             :                     else
     234             :                     {
     235        7329 :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     236             :                     }
     237             : #ifdef DEBUGGING
     238             :                     if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND )
     239             :                     {
     240             :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     241             :                     }
     242             :                     else if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV )
     243             :                     {
     244             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     245             :                     }
     246             : #endif
     247             :                 }
     248             :             }
     249             :         }
     250             :     }
     251             : 
     252             :     /*-----------------------------------------------------------------*
     253             :      * Non-binaural rendering configurations
     254             :      *-----------------------------------------------------------------*/
     255             : 
     256      752454 :     else if ( st_ivas->ivas_format == MONO_FORMAT )
     257             :     {
     258           9 :         if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     259             :         {
     260           3 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     261             :         }
     262             :     }
     263      752445 :     else if ( st_ivas->ivas_format == STEREO_FORMAT )
     264             :     {
     265      210099 :         if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     266             :         {
     267           0 :             *renderer_type = RENDERER_MC;
     268             :         }
     269             :     }
     270      542346 :     else if ( st_ivas->ivas_format == ISM_FORMAT )
     271             :     {
     272      151038 :         if ( ( output_config == IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
     273             :         {
     274        4503 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     275             :         }
     276             :         else
     277             :         {
     278      146535 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     279             :             {
     280       28740 :                 *renderer_type = RENDERER_PARAM_ISM;
     281       28740 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     282             :                 {
     283        4278 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     284             :                 }
     285       24462 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     286             :                 {
     287        4503 :                     *renderer_type = RENDERER_DISABLE;
     288             :                 }
     289       19959 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     290             :                 {
     291       13668 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     292       13668 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     293             :                 }
     294             :             }
     295             :             else /* ISM_MODE_DISC */
     296             :             {
     297      117795 :                 *renderer_type = RENDERER_TD_PANNING;
     298      117795 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     299             :                 {
     300        7416 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     301             :                 }
     302      110379 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     303             :                 {
     304       18951 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     305             :                 }
     306       91428 :                 else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     307             :                 {
     308       61101 :                     *renderer_type = RENDERER_DISABLE;
     309             :                 }
     310             :             }
     311             :         }
     312             :     }
     313      391308 :     else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     314      320601 :     {
     315             :         IVAS_FORMAT ivas_format;
     316      320601 :         *renderer_type = RENDERER_DIRAC;
     317      320601 :         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 */
     318             : 
     319      320601 :         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 ) )
     320             :         {
     321      164025 :             if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     322             :             {
     323             :                 /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
     324             :             }
     325      150009 :             else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
     326             :             {
     327      122061 :                 *internal_config = output_config;
     328             :             }
     329             :             else
     330             :             {
     331       27948 :                 *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     332             :             }
     333      164025 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     334             :         }
     335      156576 :         else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ||
     336       60855 :                   ( ivas_format == SBA_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_MONO ) ) )
     337             :         {
     338       33414 :             *renderer_type = RENDERER_DISABLE;
     339             :         }
     340      123162 :         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 ) )
     341             :         {
     342        2235 :             *renderer_type = RENDERER_DISABLE;
     343             :         }
     344      120927 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     345             :         {
     346       10461 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     347             :         }
     348      110466 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     349             :         {
     350       14103 :             *renderer_type = RENDERER_DISABLE;
     351             :         }
     352       96363 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     353             :         {
     354        4197 :             *renderer_type = RENDERER_OSBA_STEREO;
     355             :         }
     356       92166 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO )
     357             :         {
     358        3003 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     359             :         }
     360       89163 :         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 ) )
     361             :         {
     362        5835 :             *renderer_type = RENDERER_OSBA_AMBI;
     363             :         }
     364       83328 :         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 ) )
     365             :         {
     366        6006 :             *renderer_type = RENDERER_OSBA_LS;
     367             :         }
     368       77322 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     369             :         {
     370        7314 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     371             :         }
     372             :     }
     373       70707 :     else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
     374             :     {
     375       20643 :         *renderer_type = RENDERER_DIRAC;
     376             : 
     377       20643 :         if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     378             :         {
     379        3582 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     380             :         }
     381       17061 :         else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     382             :         {
     383        4323 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     384             :         }
     385       12738 :         else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     386             :         {
     387        2469 :             if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
     388             :             {
     389         237 :                 *renderer_type = RENDERER_OMASA_OBJECT_EXT;
     390             :             }
     391        2232 :             else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ )
     392             :             {
     393         216 :                 *renderer_type = RENDERER_OMASA_MIX_EXT;
     394             :             }
     395             :             else
     396             :             {
     397        2016 :                 *renderer_type = RENDERER_DISABLE;
     398             :             }
     399             :         }
     400             :     }
     401       50064 :     else if ( st_ivas->ivas_format == MC_FORMAT )
     402             :     {
     403       50064 :         *internal_config = transport_config;
     404       50064 :         if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     405             :         {
     406       21216 :             if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     407             :             {
     408       19452 :                 *renderer_type = RENDERER_MC;
     409             :             }
     410             :             else
     411             :             {
     412        1764 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     413             :             }
     414             :         }
     415       28848 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
     416             :         {
     417         558 :             *internal_config = transport_config;
     418         558 :             if ( *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     419             :             {
     420          69 :                 if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     421             :                 {
     422          33 :                     *renderer_type = RENDERER_MC;
     423             :                 }
     424             :                 else
     425             :                 {
     426          36 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     427             :                 }
     428             :             }
     429             :         }
     430       28290 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
     431             :         {
     432        6357 :             if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     433             :             {
     434        1296 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     435             :             }
     436             :             else
     437             :             {
     438        5061 :                 *renderer_type = RENDERER_MC_PARAMMC;
     439             :             }
     440             :         }
     441       21933 :         else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     442             :         {
     443       14481 :             if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     444             :             {
     445       13575 :                 *internal_config = output_config;
     446             :             }
     447             : 
     448             :             /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
     449       14481 :             if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO )
     450             :             {
     451        8088 :                 if ( st_ivas->nchan_transport == 1 )
     452             :                 {
     453        6525 :                     *renderer_type = RENDERER_DISABLE;
     454             :                 }
     455        1563 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled )
     456             :                 {
     457          27 :                     *renderer_type = RENDERER_DISABLE;
     458             :                 }
     459             :                 else
     460             :                 {
     461        1536 :                     *renderer_type = RENDERER_MCMASA_MONO_STEREO;
     462             :                 }
     463             :             }
     464             :             else
     465             :             {
     466        6393 :                 *renderer_type = RENDERER_DIRAC;
     467        6393 :                 if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     468             :                 {
     469        1212 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     470        1212 :                     *internal_config = transport_config;
     471             :                 }
     472        5181 :                 else if ( transport_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 ) )
     473             :                 {
     474           0 :                     *internal_config = transport_config;
     475             :                 }
     476             :             }
     477             :         }
     478             :     }
     479             : 
     480     1261359 :     return;
     481             : }
     482             : 
     483             : 
     484             : /*-------------------------------------------------------------------------*
     485             :  * ivas_renderer_secondary_select()
     486             :  *
     487             :  * Select IVAS secondary binaural renderer (used in combined formats)
     488             :  *-------------------------------------------------------------------------*/
     489             : 
     490             : /*! r: secondary binaural renderer type */
     491     2515953 : RENDERER_TYPE ivas_renderer_secondary_select(
     492             :     Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
     493             : )
     494             : {
     495             :     RENDERER_TYPE renderer_type;
     496             :     AUDIO_CONFIG output_config;
     497             : 
     498             :     /* disabled by default */
     499     2515953 :     renderer_type = RENDERER_DISABLE;
     500     2515953 :     output_config = st_ivas->hDecoderConfig->output_config;
     501             : 
     502     2515953 :     if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL )
     503             :     {
     504        2073 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     505             :     }
     506     2513880 :     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 ) )
     507             :     {
     508       55998 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     509             :     }
     510             : 
     511     2515953 :     return renderer_type;
     512             : }

Generated by: LCOV version 1.14