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

Generated by: LCOV version 1.14