LCOV - code coverage report
Current view: top level - lib_dec - ivas_output_config.c (source / functions) Hit Total Coverage
Test: Coverage on main -- conformance test test_26252.py @ a21f94bc6bac334fe001a5bad2f7b32b79038097 Lines: 163 166 98.2 %
Date: 2025-11-01 05:07:43 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      628531 : 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      628531 :     renderer_type = &( st_ivas->renderer_type );
      63      628531 :     internal_config = &( st_ivas->intern_config );
      64      628531 :     output_config = st_ivas->hDecoderConfig->output_config;
      65      628531 :     transport_config = st_ivas->transport_config;
      66             : 
      67             :     /* disabled rendering by default */
      68      628531 :     *renderer_type = RENDERER_DISABLE;
      69             : 
      70             :     /*-----------------------------------------------------------------*
      71             :      * Binaural rendering configurations
      72             :      *-----------------------------------------------------------------*/
      73             : 
      74             : #ifdef IVAS_RTPDUMP
      75      628531 :     if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData )
      76             : #else
      77             :     if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
      78             : #endif
      79             :     {
      80      270848 :         st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
      81             :     }
      82             : 
      83      628531 :     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 )
      84             :     {
      85      375568 :         if ( st_ivas->ivas_format == ISM_FORMAT )
      86             :         {
      87       63651 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
      88             :             {
      89       11434 :                 if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
      90             :                 {
      91        8189 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
      92             :                 }
      93             :                 else
      94             :                 {
      95        3245 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
      96             :                 }
      97             :             }
      98             :             else /* ISM_MODE_DISC */
      99             :             {
     100       52217 :                 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 )
     101             :                 {
     102       41314 :                     *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     103       41314 :                     *internal_config = output_config;
     104             :                 }
     105             :                 else
     106             :                 {
     107       10903 :                     *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     108             : #ifdef DEBUGGING
     109             :                     if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV )
     110             :                     {
     111             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     112             :                     }
     113             : #endif
     114       10903 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     115             :                 }
     116             :             }
     117             :         }
     118      311917 :         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 ) )
     119             :         {
     120      129773 :             *internal_config = output_config;
     121             : 
     122      129773 :             if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     123             :             {
     124      106050 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     125             :             }
     126             :             else
     127             :             {
     128       23723 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     129             :             }
     130             :         }
     131      182144 :         else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     132             :         {
     133       94920 :             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     134             : 
     135       94920 :             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 )
     136             :             {
     137       83959 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV;
     138             :             }
     139             :             else
     140             :             {
     141       10961 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     142             :             }
     143             : 
     144       94920 :             if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
     145             :             {
     146        4004 :                 *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     147             :             }
     148             : 
     149             : #ifdef IVAS_RTPDUMP
     150       94920 :             if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData )
     151             : #else
     152             :             if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     153             : #endif
     154             :             {
     155             : 
     156       73190 :                 nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
     157       73190 :                 if ( nchan_internal == 2 )
     158             :                 {
     159         131 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
     160             :                 }
     161       73059 :                 else if ( nchan_internal == 4 || nchan_internal == 3 )
     162             :                 {
     163       47037 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
     164             :                 }
     165       26022 :                 else if ( nchan_internal == 6 || nchan_internal == 5 )
     166             :                 {
     167           0 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 2;
     168             :                 }
     169       26022 :                 else if ( nchan_internal == 8 || nchan_internal == 7 )
     170             :                 {
     171        8345 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
     172             :                 }
     173             :             }
     174             :         }
     175       87224 :         else if ( st_ivas->ivas_format == MC_FORMAT )
     176             :         {
     177       87224 :             if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     178             :             {
     179        7596 :                 *internal_config = output_config;
     180             : 
     181        7596 :                 if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     182             :                 {
     183        3758 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     184             :                 }
     185             :                 else
     186             :                 {
     187        3838 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     188             :                 }
     189             :             }
     190             :             else
     191             :             {
     192       79628 :                 *internal_config = transport_config;
     193             : 
     194       79628 :                 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 )
     195             :                 {
     196             : #ifdef IVAS_RTPDUMP
     197       71261 :                     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 )
     198             : #else
     199             :                     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 )
     200             : #endif
     201             :                     {
     202       40632 :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     203             :                     }
     204             :                     else
     205             :                     {
     206       30629 :                         if ( st_ivas->mc_mode == MC_MODE_MCT )
     207             :                         {
     208       13654 :                             *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
     209             :                         }
     210             :                         else
     211             :                         {
     212       16975 :                             *renderer_type = RENDERER_BINAURAL_FASTCONV;
     213             :                         }
     214             : 
     215             : #ifdef IVAS_RTPDUMP
     216       30629 :                         if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation || st_ivas->hCombinedOrientationData )
     217             : #else
     218             :                         if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     219             : #endif
     220             :                         {
     221             :                             /* force HOA3 domain for rotation*/
     222       19188 :                             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     223             :                         }
     224             :                     }
     225             :                 }
     226             :                 else
     227             :                 {
     228        8367 :                     if ( st_ivas->mc_mode == MC_MODE_MCT )
     229             :                     {
     230        5924 :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     231             :                     }
     232             :                     else
     233             :                     {
     234        2443 :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     235             :                     }
     236             : #ifdef DEBUGGING
     237             :                     if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND )
     238             :                     {
     239             :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     240             :                     }
     241             :                     else if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV )
     242             :                     {
     243             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     244             :                     }
     245             : #endif
     246             :                 }
     247             :             }
     248             :         }
     249             :     }
     250             : 
     251             :     /*-----------------------------------------------------------------*
     252             :      * Non-binaural rendering configurations
     253             :      *-----------------------------------------------------------------*/
     254             : 
     255      252963 :     else if ( st_ivas->ivas_format == MONO_FORMAT )
     256             :     {
     257           5 :         if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     258             :         {
     259           1 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     260             :         }
     261             :     }
     262      252958 :     else if ( st_ivas->ivas_format == STEREO_FORMAT )
     263             :     {
     264       71084 :         if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     265             :         {
     266           0 :             *renderer_type = RENDERER_MC;
     267             :         }
     268             :     }
     269      181874 :     else if ( st_ivas->ivas_format == ISM_FORMAT )
     270             :     {
     271       50346 :         if ( ( output_config == IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
     272             :         {
     273        1501 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     274             :         }
     275             :         else
     276             :         {
     277       48845 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     278             :             {
     279        9580 :                 *renderer_type = RENDERER_PARAM_ISM;
     280        9580 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     281             :                 {
     282        1426 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     283             :                 }
     284        8154 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     285             :                 {
     286        1501 :                     *renderer_type = RENDERER_DISABLE;
     287             :                 }
     288        6653 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     289             :                 {
     290        4556 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     291        4556 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     292             :                 }
     293             :             }
     294             :             else /* ISM_MODE_DISC */
     295             :             {
     296       39265 :                 *renderer_type = RENDERER_TD_PANNING;
     297       39265 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     298             :                 {
     299        2472 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     300             :                 }
     301       36793 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     302             :                 {
     303        6317 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     304             :                 }
     305       30476 :                 else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     306             :                 {
     307       20367 :                     *renderer_type = RENDERER_DISABLE;
     308             :                 }
     309             :             }
     310             :         }
     311             :     }
     312      131528 :     else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     313      107959 :     {
     314             :         IVAS_FORMAT ivas_format;
     315      107959 :         *renderer_type = RENDERER_DIRAC;
     316      107959 :         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 */
     317             : 
     318      107959 :         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 ) )
     319             :         {
     320       55767 :             if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     321             :             {
     322             :                 /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
     323             :             }
     324       51095 :             else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
     325             :             {
     326       41779 :                 *internal_config = output_config;
     327             :             }
     328             :             else
     329             :             {
     330        9316 :                 *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     331             :             }
     332       55767 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     333             :         }
     334       52192 :         else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ||
     335       20285 :                   ( ivas_format == SBA_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_MONO ) ) )
     336             :         {
     337       11138 :             *renderer_type = RENDERER_DISABLE;
     338             :         }
     339       41054 :         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 ) )
     340             :         {
     341         745 :             *renderer_type = RENDERER_DISABLE;
     342             :         }
     343       40309 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     344             :         {
     345        3487 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     346             :         }
     347       36822 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     348             :         {
     349        4701 :             *renderer_type = RENDERER_DISABLE;
     350             :         }
     351       32121 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     352             :         {
     353        1399 :             *renderer_type = RENDERER_OSBA_STEREO;
     354             :         }
     355       30722 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO )
     356             :         {
     357        1001 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     358             :         }
     359       29721 :         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 ) )
     360             :         {
     361        1945 :             *renderer_type = RENDERER_OSBA_AMBI;
     362             :         }
     363       27776 :         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 ) )
     364             :         {
     365        2002 :             *renderer_type = RENDERER_OSBA_LS;
     366             :         }
     367       25774 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     368             :         {
     369        2438 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     370             :         }
     371             :     }
     372       23569 :     else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
     373             :     {
     374        6881 :         *renderer_type = RENDERER_DIRAC;
     375             : 
     376        6881 :         if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     377             :         {
     378        1194 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     379             :         }
     380        5687 :         else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     381             :         {
     382        1441 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     383             :         }
     384        4246 :         else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     385             :         {
     386         823 :             if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
     387             :             {
     388          79 :                 *renderer_type = RENDERER_OMASA_OBJECT_EXT;
     389             :             }
     390         744 :             else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ )
     391             :             {
     392          72 :                 *renderer_type = RENDERER_OMASA_MIX_EXT;
     393             :             }
     394             :             else
     395             :             {
     396         672 :                 *renderer_type = RENDERER_DISABLE;
     397             :             }
     398             :         }
     399             :     }
     400       16688 :     else if ( st_ivas->ivas_format == MC_FORMAT )
     401             :     {
     402       16688 :         *internal_config = transport_config;
     403       16688 :         if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     404             :         {
     405        7072 :             if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     406             :             {
     407        6484 :                 *renderer_type = RENDERER_MC;
     408             :             }
     409             :             else
     410             :             {
     411         588 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     412             :             }
     413             :         }
     414        9616 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
     415             :         {
     416         186 :             *internal_config = transport_config;
     417         186 :             if ( *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     418             :             {
     419          23 :                 if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     420             :                 {
     421          11 :                     *renderer_type = RENDERER_MC;
     422             :                 }
     423             :                 else
     424             :                 {
     425          12 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     426             :                 }
     427             :             }
     428             :         }
     429        9430 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
     430             :         {
     431        2119 :             if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     432             :             {
     433         432 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     434             :             }
     435             :             else
     436             :             {
     437        1687 :                 *renderer_type = RENDERER_MC_PARAMMC;
     438             :             }
     439             :         }
     440        7311 :         else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     441             :         {
     442        4827 :             if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     443             :             {
     444        4525 :                 *internal_config = output_config;
     445             :             }
     446             : 
     447             :             /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
     448        4827 :             if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO )
     449             :             {
     450        2696 :                 if ( st_ivas->nchan_transport == 1 )
     451             :                 {
     452        2175 :                     *renderer_type = RENDERER_DISABLE;
     453             :                 }
     454         521 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled )
     455             :                 {
     456           9 :                     *renderer_type = RENDERER_DISABLE;
     457             :                 }
     458             :                 else
     459             :                 {
     460         512 :                     *renderer_type = RENDERER_MCMASA_MONO_STEREO;
     461             :                 }
     462             :             }
     463             :             else
     464             :             {
     465        2131 :                 *renderer_type = RENDERER_DIRAC;
     466        2131 :                 if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     467             :                 {
     468         404 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     469         404 :                     *internal_config = transport_config;
     470             :                 }
     471        1727 :                 else if ( transport_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 ) )
     472             :                 {
     473           0 :                     *internal_config = transport_config;
     474             :                 }
     475             :             }
     476             :         }
     477             :     }
     478             : 
     479      628531 :     return;
     480             : }
     481             : 
     482             : 
     483             : /*-------------------------------------------------------------------------*
     484             :  * ivas_renderer_secondary_select()
     485             :  *
     486             :  * Select IVAS secondary binaural renderer (used in combined formats)
     487             :  *-------------------------------------------------------------------------*/
     488             : 
     489             : /*! r: secondary binaural renderer type */
     490     1254483 : RENDERER_TYPE ivas_renderer_secondary_select(
     491             :     Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
     492             : )
     493             : {
     494             :     RENDERER_TYPE renderer_type;
     495             :     AUDIO_CONFIG output_config;
     496             : 
     497             :     /* disabled by default */
     498     1254483 :     renderer_type = RENDERER_DISABLE;
     499     1254483 :     output_config = st_ivas->hDecoderConfig->output_config;
     500             : 
     501     1254483 :     if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC &&
     502             : #ifdef FIX_1119_SPLIT_RENDERING_VOIP
     503       46232 :          ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     504             : #else
     505             :          output_config == IVAS_AUDIO_CONFIG_BINAURAL
     506             : #endif
     507             :     )
     508             :     {
     509       41086 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     510             :     }
     511             : #ifdef FIX_1119_SPLIT_RENDERING_VOIP
     512     1213397 :     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 ) )
     513             : #else
     514             :     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 ) )
     515             : #endif
     516             :     {
     517       85461 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     518             :     }
     519             : 
     520     1254483 :     return renderer_type;
     521             : }

Generated by: LCOV version 1.14