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

Generated by: LCOV version 1.14