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 @ b5bd5e0684ad2d9250297e1e7a0ddc986cb7b37e Lines: 165 166 99.4 %
Date: 2025-10-27 07:01:45 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     5395107 : 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     5395107 :     renderer_type = &( st_ivas->renderer_type );
      63     5395107 :     internal_config = &( st_ivas->intern_config );
      64     5395107 :     output_config = st_ivas->hDecoderConfig->output_config;
      65     5395107 :     transport_config = st_ivas->transport_config;
      66             : 
      67             :     /* disabled rendering by default */
      68     5395107 :     *renderer_type = RENDERER_DISABLE;
      69             : 
      70             :     /*-----------------------------------------------------------------*
      71             :      * Binaural rendering configurations
      72             :      *-----------------------------------------------------------------*/
      73             : 
      74     5395107 :     if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
      75             :     {
      76      492110 :         st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
      77             :     }
      78             : 
      79     5395107 :     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     1920569 :         if ( st_ivas->ivas_format == ISM_FORMAT )
      82             :         {
      83      410924 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
      84             :             {
      85       57169 :                 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       30843 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
      88             :                 }
      89             :                 else
      90             :                 {
      91       26326 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
      92             :                 }
      93             :             }
      94             :             else /* ISM_MODE_DISC */
      95             :             {
      96      353755 :                 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      254854 :                     *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
      99      254854 :                     *internal_config = output_config;
     100             :                 }
     101             :                 else
     102             :                 {
     103       98901 :                     *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     104             : #ifdef DEBUGGING
     105             :                     if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV )
     106             :                     {
     107             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     108             :                     }
     109             : #endif
     110       98901 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     111             :                 }
     112             :             }
     113             :         }
     114     1509645 :         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 ) )
     115             :         {
     116      797873 :             *internal_config = output_config;
     117             : 
     118      797873 :             if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     119             :             {
     120      371058 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     121             :             }
     122             :             else
     123             :             {
     124      426815 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     125             :             }
     126             :         }
     127      711772 :         else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     128             :         {
     129      440332 :             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     130             : 
     131      440332 :             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 )
     132             :             {
     133      321031 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV;
     134             :             }
     135             :             else
     136             :             {
     137      119301 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     138             :             }
     139             : 
     140      440332 :             if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
     141             :             {
     142       79116 :                 *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     143             :             }
     144             : 
     145      440332 :             if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     146             :             {
     147             : 
     148      113384 :                 nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
     149      113384 :                 if ( nchan_internal == 2 )
     150             :                 {
     151         281 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
     152             :                 }
     153      113103 :                 else if ( nchan_internal == 4 || nchan_internal == 3 )
     154             :                 {
     155       78625 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
     156             :                 }
     157       34478 :                 else if ( nchan_internal == 6 || nchan_internal == 5 )
     158             :                 {
     159           0 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 2;
     160             :                 }
     161       34478 :                 else if ( nchan_internal == 8 || nchan_internal == 7 )
     162             :                 {
     163       10551 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
     164             :                 }
     165             :             }
     166             :         }
     167      271440 :         else if ( st_ivas->ivas_format == MC_FORMAT )
     168             :         {
     169      271440 :             if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     170             :             {
     171       55723 :                 *internal_config = output_config;
     172             : 
     173       55723 :                 if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     174             :                 {
     175       21585 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     176             :                 }
     177             :                 else
     178             :                 {
     179       34138 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     180             :                 }
     181             :             }
     182             :             else
     183             :             {
     184      215717 :                 *internal_config = transport_config;
     185             : 
     186      215717 :                 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 )
     187             :                 {
     188      171137 :                     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 )
     189             :                     {
     190       64024 :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     191             :                     }
     192             :                     else
     193             :                     {
     194      107113 :                         if ( st_ivas->mc_mode == MC_MODE_MCT )
     195             :                         {
     196       59108 :                             *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
     197             :                         }
     198             :                         else
     199             :                         {
     200       48005 :                             *renderer_type = RENDERER_BINAURAL_FASTCONV;
     201             :                         }
     202             : 
     203      107113 :                         if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     204             :                         {
     205             :                             /* force HOA3 domain for rotation*/
     206       33228 :                             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     207             :                         }
     208             :                     }
     209             :                 }
     210             :                 else
     211             :                 {
     212       44580 :                     if ( st_ivas->mc_mode == MC_MODE_MCT )
     213             :                     {
     214       30906 :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     215             :                     }
     216             :                     else
     217             :                     {
     218       13674 :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     219             :                     }
     220             : #ifdef DEBUGGING
     221             :                     if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND )
     222             :                     {
     223             :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     224             :                     }
     225             :                     else if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV )
     226             :                     {
     227             :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     228             :                     }
     229             : #endif
     230             :                 }
     231             :             }
     232             :         }
     233             :     }
     234             : 
     235             :     /*-----------------------------------------------------------------*
     236             :      * Non-binaural rendering configurations
     237             :      *-----------------------------------------------------------------*/
     238             : 
     239     3474538 :     else if ( st_ivas->ivas_format == MONO_FORMAT )
     240             :     {
     241         495 :         if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     242             :         {
     243           3 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     244             :         }
     245             :     }
     246     3474043 :     else if ( st_ivas->ivas_format == STEREO_FORMAT )
     247             :     {
     248      290195 :         if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     249             :         {
     250       45387 :             *renderer_type = RENDERER_MC;
     251             :         }
     252             :     }
     253     3183848 :     else if ( st_ivas->ivas_format == ISM_FORMAT )
     254             :     {
     255      692061 :         if ( ( output_config == IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
     256             :         {
     257        4503 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     258             :         }
     259             :         else
     260             :         {
     261      687558 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     262             :             {
     263       88983 :                 *renderer_type = RENDERER_PARAM_ISM;
     264       88983 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     265             :                 {
     266        8294 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     267             :                 }
     268       80689 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     269             :                 {
     270       14533 :                     *renderer_type = RENDERER_DISABLE;
     271             :                 }
     272       66156 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     273             :                 {
     274       31730 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     275       31730 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     276             :                 }
     277             :             }
     278             :             else /* ISM_MODE_DISC */
     279             :             {
     280      598575 :                 *renderer_type = RENDERER_TD_PANNING;
     281      598575 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     282             :                 {
     283       55678 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     284             :                 }
     285      542897 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     286             :                 {
     287      149719 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     288             :                 }
     289      393178 :                 else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     290             :                 {
     291      103349 :                     *renderer_type = RENDERER_DISABLE;
     292             :                 }
     293             :             }
     294             :         }
     295             :     }
     296     2491787 :     else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     297     1943376 :     {
     298             :         IVAS_FORMAT ivas_format;
     299     1943376 :         *renderer_type = RENDERER_DIRAC;
     300     1943376 :         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 */
     301             : 
     302     1943376 :         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 ) )
     303             :         {
     304      532333 :             if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     305             :             {
     306             :                 /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
     307             :             }
     308      421083 :             else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
     309             :             {
     310      303869 :                 *internal_config = output_config;
     311             :             }
     312             :             else
     313             :             {
     314      117214 :                 *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     315             :             }
     316      532333 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     317             :         }
     318     1411043 :         else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ||
     319      666562 :                   ( ivas_format == SBA_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_MONO ) ) )
     320             :         {
     321      214625 :             *renderer_type = RENDERER_DISABLE;
     322             :         }
     323     1196418 :         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 ) )
     324             :         {
     325        8457 :             *renderer_type = RENDERER_DISABLE;
     326             :         }
     327     1187961 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     328             :         {
     329       31597 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     330             :         }
     331     1156364 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     332             :         {
     333       35839 :             *renderer_type = RENDERER_DISABLE;
     334             :         }
     335     1120525 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     336             :         {
     337       42105 :             *renderer_type = RENDERER_OSBA_STEREO;
     338             :         }
     339     1078420 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO )
     340             :         {
     341       40911 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     342             :         }
     343     1037509 :         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 ) )
     344             :         {
     345      119559 :             *renderer_type = RENDERER_OSBA_AMBI;
     346             :         }
     347      917950 :         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 ) )
     348             :         {
     349      195546 :             *renderer_type = RENDERER_OSBA_LS;
     350             :         }
     351      722404 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     352             :         {
     353       47224 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     354             :         }
     355             :     }
     356      548411 :     else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
     357             :     {
     358      279873 :         *renderer_type = RENDERER_DIRAC;
     359             : 
     360      279873 :         if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     361             :         {
     362       27066 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     363             :         }
     364      252807 :         else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     365             :         {
     366       27807 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     367             :         }
     368      225000 :         else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     369             :         {
     370       26255 :             if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
     371             :             {
     372        3779 :                 *renderer_type = RENDERER_OMASA_OBJECT_EXT;
     373             :             }
     374       22476 :             else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ )
     375             :             {
     376        2376 :                 *renderer_type = RENDERER_OMASA_MIX_EXT;
     377             :             }
     378             :             else
     379             :             {
     380       20100 :                 *renderer_type = RENDERER_DISABLE;
     381             :             }
     382             :         }
     383             :     }
     384      268538 :     else if ( st_ivas->ivas_format == MC_FORMAT )
     385             :     {
     386      268538 :         *internal_config = transport_config;
     387      268538 :         if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     388             :         {
     389       96848 :             if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     390             :             {
     391       69974 :                 *renderer_type = RENDERER_MC;
     392             :             }
     393             :             else
     394             :             {
     395       26874 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     396             :             }
     397             :         }
     398      171690 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
     399             :         {
     400        3932 :             *internal_config = transport_config;
     401        3932 :             if ( *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     402             :             {
     403        2801 :                 if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     404             :                 {
     405        1955 :                     *renderer_type = RENDERER_MC;
     406             :                 }
     407             :                 else
     408             :                 {
     409         846 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     410             :                 }
     411             :             }
     412             :         }
     413      167758 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
     414             :         {
     415       49969 :             if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     416             :             {
     417       12938 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     418             :             }
     419             :             else
     420             :             {
     421       37031 :                 *renderer_type = RENDERER_MC_PARAMMC;
     422             :             }
     423             :         }
     424      117789 :         else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     425             :         {
     426       90439 :             if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     427             :             {
     428       81254 :                 *internal_config = output_config;
     429             :             }
     430             : 
     431             :             /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
     432       90439 :             if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO )
     433             :             {
     434       21590 :                 if ( st_ivas->nchan_transport == 1 )
     435             :                 {
     436       15585 :                     *renderer_type = RENDERER_DISABLE;
     437             :                 }
     438        6005 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled )
     439             :                 {
     440         555 :                     *renderer_type = RENDERER_DISABLE;
     441             :                 }
     442             :                 else
     443             :                 {
     444        5450 :                     *renderer_type = RENDERER_MCMASA_MONO_STEREO;
     445             :                 }
     446             :             }
     447             :             else
     448             :             {
     449       68849 :                 *renderer_type = RENDERER_DIRAC;
     450       68849 :                 if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     451             :                 {
     452       21012 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     453       21012 :                     *internal_config = transport_config;
     454             :                 }
     455       47837 :                 else if ( transport_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 ) )
     456             :                 {
     457        1884 :                     *internal_config = transport_config;
     458             :                 }
     459             :             }
     460             :         }
     461             :     }
     462             : 
     463     5395107 :     return;
     464             : }
     465             : 
     466             : 
     467             : /*-------------------------------------------------------------------------*
     468             :  * ivas_renderer_secondary_select()
     469             :  *
     470             :  * Select IVAS secondary binaural renderer (used in combined formats)
     471             :  *-------------------------------------------------------------------------*/
     472             : 
     473             : /*! r: secondary binaural renderer type */
     474    10679202 : RENDERER_TYPE ivas_renderer_secondary_select(
     475             :     Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
     476             : )
     477             : {
     478             :     RENDERER_TYPE renderer_type;
     479             :     AUDIO_CONFIG output_config;
     480             : 
     481             :     /* disabled by default */
     482    10679202 :     renderer_type = RENDERER_DISABLE;
     483    10679202 :     output_config = st_ivas->hDecoderConfig->output_config;
     484             : 
     485    10679202 :     if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC &&
     486             : #ifdef FIX_1119_SPLIT_RENDERING_VOIP
     487      569832 :          ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     488             : #else
     489             :          output_config == IVAS_AUDIO_CONFIG_BINAURAL
     490             : #endif
     491             :     )
     492             :     {
     493      115470 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     494             :     }
     495             : #ifdef FIX_1119_SPLIT_RENDERING_VOIP
     496    10563732 :     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 ) )
     497             : #else
     498             :     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 ) )
     499             : #endif
     500             :     {
     501      381071 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     502             :     }
     503             : 
     504    10679202 :     return renderer_type;
     505             : }

Generated by: LCOV version 1.14