LCOV - code coverage report
Current view: top level - lib_dec - ivas_output_config.c (source / functions) Hit Total Coverage
Test: Coverage on main @ fec202a8f89be4a2f278a9fc377bfb58b58fab11 Lines: 164 165 99.4 %
Date: 2025-09-14 08:49:17 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    11888078 : 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    11888078 :     renderer_type = &( st_ivas->renderer_type );
      63    11888078 :     internal_config = &( st_ivas->intern_config );
      64    11888078 :     output_config = st_ivas->hDecoderConfig->output_config;
      65    11888078 :     transport_config = st_ivas->transport_config;
      66             : 
      67             :     /* disabled rendering by default */
      68    11888078 :     *renderer_type = RENDERER_DISABLE;
      69             : 
      70             :     /*-----------------------------------------------------------------*
      71             :      * Binaural rendering configurations
      72             :      *-----------------------------------------------------------------*/
      73             : 
      74    11888078 :     if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
      75             :     {
      76      867487 :         st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
      77             :     }
      78             : 
      79    11888078 :     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     3318986 :         if ( st_ivas->ivas_format == ISM_FORMAT )
      82             :         {
      83      700516 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
      84             :             {
      85      122838 :                 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       77591 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
      88             :                 }
      89             :                 else
      90             :                 {
      91       45247 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
      92             :                 }
      93             :             }
      94             :             else /* ISM_MODE_DISC */
      95             :             {
      96      577678 :                 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      415045 :                     *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     111      415045 :                     *internal_config = output_config;
     112             : #endif
     113             :                 }
     114             :                 else
     115             :                 {
     116      162633 :                     *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      162633 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     124             :                 }
     125             :             }
     126             :         }
     127     2618470 :         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     1372508 :             *internal_config = output_config;
     130             : 
     131     1372508 :             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      632753 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     134             :             }
     135             :             else
     136             :             {
     137      739755 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     138             :             }
     139             :         }
     140     1245962 :         else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     141             :         {
     142      613985 :             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     143             : 
     144      613985 :             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      406494 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV;
     147             :             }
     148             :             else
     149             :             {
     150      207491 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     151             :             }
     152             : 
     153      613985 :             if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
     154             :             {
     155      111237 :                 *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     156             :             }
     157             : 
     158      613985 :             if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     159             :             {
     160             : 
     161      114153 :                 nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
     162      114153 :                 if ( nchan_internal == 2 )
     163             :                 {
     164          36 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
     165             :                 }
     166      114117 :                 else if ( nchan_internal == 4 || nchan_internal == 3 )
     167             :                 {
     168      101487 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
     169             :                 }
     170       12630 :                 else if ( nchan_internal == 6 || nchan_internal == 5 )
     171             :                 {
     172           0 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 2;
     173             :                 }
     174       12630 :                 else if ( nchan_internal == 8 || nchan_internal == 7 )
     175             :                 {
     176        1100 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
     177             :                 }
     178             :             }
     179             :         }
     180      631977 :         else if ( st_ivas->ivas_format == MC_FORMAT )
     181             :         {
     182      631977 :             if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     183             :             {
     184      136371 :                 *internal_config = output_config;
     185             : 
     186      136371 :                 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       60732 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     189             :                 }
     190             :                 else
     191             :                 {
     192       75639 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     193             :                 }
     194             :             }
     195             :             else
     196             :             {
     197      495606 :                 *internal_config = transport_config;
     198             : 
     199      495606 :                 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      363713 :                     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       50034 :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     208             :                     }
     209             :                     else
     210             :                     {
     211      313679 :                         if ( st_ivas->mc_mode == MC_MODE_MCT )
     212             :                         {
     213      193690 :                             *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
     214             :                         }
     215             :                         else
     216             :                         {
     217      119989 :                             *renderer_type = RENDERER_BINAURAL_FASTCONV;
     218             :                         }
     219             : 
     220      313679 :                         if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     221             :                         {
     222             :                             /* force HOA3 domain for rotation*/
     223       77743 :                             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     224             :                         }
     225             :                     }
     226             :                 }
     227             :                 else
     228             :                 {
     229      131893 :                     if ( st_ivas->mc_mode == MC_MODE_MCT )
     230             :                     {
     231       96387 :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     232             :                     }
     233             :                     else
     234             :                     {
     235       35506 :                         *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     8569092 :     else if ( st_ivas->ivas_format == MONO_FORMAT )
     257             :     {
     258         547 :         if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     259             :         {
     260           4 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     261             :         }
     262             :     }
     263     8568545 :     else if ( st_ivas->ivas_format == STEREO_FORMAT )
     264             :     {
     265      956911 :         if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     266             :         {
     267       45387 :             *renderer_type = RENDERER_MC;
     268             :         }
     269             :     }
     270     7611634 :     else if ( st_ivas->ivas_format == ISM_FORMAT )
     271             :     {
     272      990430 :         if ( ( output_config == IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
     273             :         {
     274       12199 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     275             :         }
     276             :         else
     277             :         {
     278      978231 :             if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     279             :             {
     280      144406 :                 *renderer_type = RENDERER_PARAM_ISM;
     281      144406 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     282             :                 {
     283       16447 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     284             :                 }
     285      127959 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     286             :                 {
     287       23169 :                     *renderer_type = RENDERER_DISABLE;
     288             :                 }
     289      104790 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     290             :                 {
     291       58272 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     292       58272 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     293             :                 }
     294             :             }
     295             :             else /* ISM_MODE_DISC */
     296             :             {
     297      833825 :                 *renderer_type = RENDERER_TD_PANNING;
     298      833825 :                 if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     299             :                 {
     300       71095 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     301             :                 }
     302      762730 :                 else if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     303             :                 {
     304      189935 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     305             :                 }
     306      572795 :                 else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     307             :                 {
     308      225376 :                     *renderer_type = RENDERER_DISABLE;
     309             :                 }
     310             :             }
     311             :         }
     312             :     }
     313     6621204 :     else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
     314     5655227 :     {
     315             :         IVAS_FORMAT ivas_format;
     316     5655227 :         *renderer_type = RENDERER_DIRAC;
     317     5655227 :         ivas_format = ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_NONE ) ? SBA_FORMAT : st_ivas->ivas_format; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */
     318             : 
     319     5655227 :         if ( ivas_format == SBA_FORMAT && ( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) )
     320             :         {
     321     3595040 :             if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     322             :             {
     323             :                 /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
     324             :             }
     325     3438147 :             else if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
     326             :             {
     327     3204073 :                 *internal_config = output_config;
     328             :             }
     329             :             else
     330             :             {
     331      234074 :                 *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     332             :             }
     333     3595040 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     334             :         }
     335     2060187 :         else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ||
     336      841004 :                   ( ivas_format == SBA_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_MONO ) ) )
     337             :         {
     338      313681 :             *renderer_type = RENDERER_DISABLE;
     339             :         }
     340     1746506 :         else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) )
     341             :         {
     342       21155 :             *renderer_type = RENDERER_DISABLE;
     343             :         }
     344     1725351 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     345             :         {
     346       78558 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     347             :         }
     348     1646793 :         else if ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     349             :         {
     350      170747 :             *renderer_type = RENDERER_DISABLE;
     351             :         }
     352     1476046 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_STEREO )
     353             :         {
     354       53917 :             *renderer_type = RENDERER_OSBA_STEREO;
     355             :         }
     356     1422129 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO )
     357             :         {
     358       48888 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     359             :         }
     360     1373241 :         else if ( ivas_format == SBA_ISM_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 ) )
     361             :         {
     362      134729 :             *renderer_type = RENDERER_OSBA_AMBI;
     363             :         }
     364     1238512 :         else if ( ivas_format == SBA_ISM_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
     365             :         {
     366      211432 :             *renderer_type = RENDERER_OSBA_LS;
     367             :         }
     368     1027080 :         else if ( ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     369             :         {
     370       67078 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     371             :         }
     372             :     }
     373      965977 :     else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
     374             :     {
     375      459651 :         *renderer_type = RENDERER_DIRAC;
     376             : 
     377      459651 :         if ( output_config == IVAS_AUDIO_CONFIG_MONO )
     378             :         {
     379       62447 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     380             :         }
     381      397204 :         else if ( output_config == IVAS_AUDIO_CONFIG_STEREO )
     382             :         {
     383       62367 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     384             :         }
     385      334837 :         else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     386             :         {
     387       52872 :             if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
     388             :             {
     389        6778 :                 *renderer_type = RENDERER_OMASA_OBJECT_EXT;
     390             :             }
     391       46094 :             else if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ )
     392             :             {
     393        5376 :                 *renderer_type = RENDERER_OMASA_MIX_EXT;
     394             :             }
     395             :             else
     396             :             {
     397       40718 :                 *renderer_type = RENDERER_DISABLE;
     398             :             }
     399             :         }
     400             :     }
     401      506326 :     else if ( st_ivas->ivas_format == MC_FORMAT )
     402             :     {
     403      506326 :         *internal_config = transport_config;
     404      506326 :         if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     405             :         {
     406      157546 :             if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     407             :             {
     408      124169 :                 *renderer_type = RENDERER_MC;
     409             :             }
     410             :             else
     411             :             {
     412       33377 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     413             :             }
     414             :         }
     415      348780 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
     416             :         {
     417       14896 :             *internal_config = transport_config;
     418       14896 :             if ( *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     419             :             {
     420        4715 :                 if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
     421             :                 {
     422        2891 :                     *renderer_type = RENDERER_MC;
     423             :                 }
     424             :                 else
     425             :                 {
     426        1824 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     427             :                 }
     428             :             }
     429             :         }
     430      333884 :         else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
     431             :         {
     432       81882 :             if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     433             :             {
     434       17180 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     435             :             }
     436             :             else
     437             :             {
     438       64702 :                 *renderer_type = RENDERER_MC_PARAMMC;
     439             :             }
     440             :         }
     441      252002 :         else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
     442             :         {
     443      183233 :             if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
     444             :             {
     445      160485 :                 *internal_config = output_config;
     446             :             }
     447             : 
     448             :             /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
     449      183233 :             if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO )
     450             :             {
     451       74862 :                 if ( st_ivas->nchan_transport == 1 )
     452             :                 {
     453       40998 :                     *renderer_type = RENDERER_DISABLE;
     454             :                 }
     455       33864 :                 else if ( output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled )
     456             :                 {
     457        1426 :                     *renderer_type = RENDERER_DISABLE;
     458             :                 }
     459             :                 else
     460             :                 {
     461       32438 :                     *renderer_type = RENDERER_MCMASA_MONO_STEREO;
     462             :                 }
     463             :             }
     464             :             else
     465             :             {
     466      108371 :                 *renderer_type = RENDERER_DIRAC;
     467      108371 :                 if ( output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_HOA3 )
     468             :                 {
     469       30164 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     470       30164 :                     *internal_config = transport_config;
     471             :                 }
     472       78207 :                 else if ( transport_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_7_1 || output_config == IVAS_AUDIO_CONFIG_5_1_4 ) )
     473             :                 {
     474        1884 :                     *internal_config = transport_config;
     475             :                 }
     476             :             }
     477             :         }
     478             :     }
     479             : 
     480    11888078 :     return;
     481             : }
     482             : 
     483             : 
     484             : /*-------------------------------------------------------------------------*
     485             :  * ivas_renderer_secondary_select()
     486             :  *
     487             :  * Select IVAS secondary binaural renderer (used in combined formats)
     488             :  *-------------------------------------------------------------------------*/
     489             : 
     490             : /*! r: secondary binaural renderer type */
     491    24111136 : RENDERER_TYPE ivas_renderer_secondary_select(
     492             :     Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
     493             : )
     494             : {
     495             :     RENDERER_TYPE renderer_type;
     496             :     AUDIO_CONFIG output_config;
     497             : 
     498             :     /* disabled by default */
     499    24111136 :     renderer_type = RENDERER_DISABLE;
     500    24111136 :     output_config = st_ivas->hDecoderConfig->output_config;
     501             : 
     502    24111136 :     if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL )
     503             :     {
     504       85128 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     505             :     }
     506    24026008 :     else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
     507             :     {
     508      445189 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     509             :     }
     510             : 
     511    24111136 :     return renderer_type;
     512             : }

Generated by: LCOV version 1.14