LCOV - code coverage report
Current view: top level - lib_dec - ivas_output_config_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 296 308 96.1 %
Date: 2025-05-03 01:55:50 Functions: 1 1 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_stat_dec.h"
      37             : #include "wmc_auto.h"
      38             : #include "ivas_prot_fx.h"
      39             : 
      40             : 
      41             : /*-------------------------------------------------------------------------*
      42             :  * ivas_renderer_select()
      43             :  *
      44             :  * Select and configure IVAS renderer parameters
      45             :  *-------------------------------------------------------------------------*/
      46        8437 : void ivas_renderer_select(
      47             :     Decoder_Struct *st_ivas /* i/o: IVAS decoder structure                */
      48             : )
      49             : {
      50             :     RENDERER_TYPE *renderer_type;
      51             :     AUDIO_CONFIG *internal_config;
      52             :     AUDIO_CONFIG output_config;
      53             :     AUDIO_CONFIG transport_config;
      54             : 
      55             :     Word16 nchan_internal;
      56             : 
      57        8437 :     renderer_type = &( st_ivas->renderer_type );
      58        8437 :     internal_config = &( st_ivas->intern_config );
      59        8437 :     output_config = st_ivas->hDecoderConfig->output_config;
      60        8437 :     move16();
      61        8437 :     transport_config = st_ivas->transport_config;
      62        8437 :     move16();
      63             : 
      64             :     /* disabled rendering by default */
      65        8437 :     *renderer_type = RENDERER_DISABLE;
      66        8437 :     move16();
      67             : 
      68             :     /*-----------------------------------------------------------------*
      69             :      * Binaural rendering configurations
      70             :      *-----------------------------------------------------------------*/
      71             : 
      72        8437 :     test();
      73        8437 :     IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
      74             :     {
      75         117 :         st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
      76         117 :         move16();
      77             :     }
      78             : 
      79        8437 :     test();
      80        8437 :     test();
      81        8437 :     test();
      82        8437 :     test();
      83        8437 :     IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
      84             :     {
      85        2740 :         test();
      86        2740 :         test();
      87        2740 :         test();
      88        2740 :         test();
      89        2740 :         test();
      90        2740 :         IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
      91             :         {
      92         480 :             IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
      93             :             {
      94         186 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) )
      95             :                 {
      96          89 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
      97          89 :                     move16();
      98             :                 }
      99             :                 ELSE
     100             :                 {
     101          97 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     102          97 :                     move16();
     103             :                 }
     104             :             }
     105             :             ELSE /* ISM_MODE_DISC */
     106             :             {
     107         294 :                 test();
     108         294 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
     109             :                 {
     110          35 :                     *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     111          35 :                     move16();
     112          35 :                     *internal_config = output_config;
     113          35 :                     move16();
     114             :                 }
     115             :                 ELSE
     116             :                 {
     117         259 :                     *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     118         259 :                     move16();
     119         259 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     120         259 :                     move16();
     121             :                 }
     122             :             }
     123             :         }
     124        2260 :         ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && LE_16( st_ivas->nchan_transport, 2 ) ) )
     125             :         {
     126        1451 :             *internal_config = output_config;
     127        1451 :             move16();
     128             : 
     129        1451 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) )
     130             :             {
     131        1024 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     132        1024 :                 move16();
     133             :             }
     134             :             ELSE
     135             :             {
     136         427 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     137         427 :                 move16();
     138             :             }
     139             :         }
     140         809 :         ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
     141             :         {
     142         204 :             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     143         204 :             move16();
     144             : 
     145         204 :             test();
     146         204 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
     147             :             {
     148         194 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV;
     149         194 :                 move16();
     150             :             }
     151             :             ELSE
     152             :             {
     153          10 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     154          10 :                 move16();
     155             :             }
     156             : 
     157         204 :             test();
     158         204 :             IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( *renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
     159             :             {
     160           3 :                 *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     161           3 :                 move16();
     162             :             }
     163             : 
     164         204 :             test();
     165         204 :             IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     166             :             {
     167             : 
     168          17 :                 nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
     169          17 :                 test();
     170          17 :                 test();
     171          17 :                 test();
     172          17 :                 IF( EQ_16( nchan_internal, 2 ) )
     173             :                 {
     174           0 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
     175           0 :                     move16();
     176             :                 }
     177          17 :                 ELSE IF( EQ_16( nchan_internal, 4 ) || EQ_16( nchan_internal, 3 ) )
     178             :                 {
     179          13 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
     180          13 :                     move16();
     181             :                 }
     182           4 :                 ELSE IF( EQ_16( nchan_internal, 6 ) || EQ_16( nchan_internal, 5 ) )
     183             :                 {
     184           0 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 2;
     185           0 :                     move16();
     186             :                 }
     187           4 :                 ELSE IF( EQ_16( nchan_internal, 8 ) || EQ_16( nchan_internal, 7 ) )
     188             :                 {
     189           2 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
     190           2 :                     move16();
     191             :                 }
     192             :             }
     193             :         }
     194         605 :         ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
     195             :         {
     196         605 :             IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
     197             :             {
     198         221 :                 *internal_config = output_config;
     199         221 :                 move16();
     200             : 
     201         221 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) )
     202             :                 {
     203          49 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     204          49 :                     move16();
     205             :                 }
     206             :                 ELSE
     207             :                 {
     208         172 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     209         172 :                     move16();
     210             :                 }
     211             :             }
     212             :             ELSE
     213             :             {
     214         384 :                 *internal_config = transport_config;
     215         384 :                 move16();
     216         384 :                 test();
     217         384 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
     218             :                 {
     219         207 :                     test();
     220         207 :                     test();
     221         207 :                     test();
     222         207 :                     test();
     223         207 :                     test();
     224         207 :                     IF( ( EQ_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_7_1 ) ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && ( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) )
     225             :                     {
     226           8 :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     227           8 :                         move16();
     228             :                     }
     229             :                     ELSE
     230             :                     {
     231         199 :                         IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
     232             :                         {
     233         113 :                             *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
     234         113 :                             move16();
     235             :                         }
     236             :                         ELSE
     237             :                         {
     238          86 :                             *renderer_type = RENDERER_BINAURAL_FASTCONV;
     239          86 :                             move16();
     240             :                         }
     241             : 
     242         199 :                         test();
     243         199 :                         IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     244             :                         {
     245             :                             /* force HOA3 domain for rotation*/
     246          11 :                             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     247          11 :                             move16();
     248             :                         }
     249             :                     }
     250             :                 }
     251             :                 ELSE
     252             :                 {
     253         177 :                     IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
     254             :                     {
     255         104 :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     256         104 :                         move16();
     257             :                     }
     258             :                     ELSE
     259             :                     {
     260          73 :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     261          73 :                         move16();
     262             :                     }
     263             :                 }
     264             :             }
     265             :         }
     266             :     }
     267             : 
     268             :     /*-----------------------------------------------------------------*
     269             :      * Non-binaural rendering configurations
     270             :      *-----------------------------------------------------------------*/
     271             : 
     272        5697 :     ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
     273             :     {
     274           3 :         IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     275             :         {
     276           1 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     277           1 :             move16();
     278             :         }
     279             :     }
     280        5694 :     ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
     281             :     {
     282          67 :         test();
     283          67 :         IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     284             :         {
     285           0 :             *renderer_type = RENDERER_MC;
     286           0 :             move16();
     287             :         }
     288             :     }
     289        5627 :     ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
     290             :     {
     291         600 :         test();
     292         600 :         IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
     293             :         {
     294           1 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     295           1 :             move16();
     296             :         }
     297             :         ELSE
     298             :         {
     299         599 :             IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
     300             :             {
     301          79 :                 *renderer_type = RENDERER_PARAM_ISM;
     302          79 :                 test();
     303          79 :                 test();
     304          79 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     305             :                 {
     306           1 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     307           1 :                     move16();
     308             :                 }
     309          78 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     310             :                 {
     311           1 :                     *renderer_type = RENDERER_DISABLE;
     312           1 :                     move16();
     313             :                 }
     314          77 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
     315             :                 {
     316          23 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     317          23 :                     move16();
     318          23 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     319          23 :                     move16();
     320             :                 }
     321             :             }
     322             :             ELSE /* ISM_MODE_DISC */
     323             :             {
     324         520 :                 *renderer_type = RENDERER_TD_PANNING;
     325         520 :                 test();
     326         520 :                 test();
     327         520 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     328             :                 {
     329           2 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     330           2 :                     move16();
     331             :                 }
     332         518 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
     333             :                 {
     334          81 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     335          81 :                     move16();
     336             :                 }
     337         437 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     338             :                 {
     339         428 :                     *renderer_type = RENDERER_DISABLE;
     340         428 :                     move16();
     341             :                 }
     342             :             }
     343             :         }
     344             :     }
     345        5027 :     ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
     346        2816 :     {
     347             :         IVAS_FORMAT ivas_format;
     348        2816 :         *renderer_type = RENDERER_DIRAC;
     349        2816 :         move16();
     350             : 
     351        2816 :         test();
     352        2816 :         IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MODE_NONE ) )
     353             :         {
     354         153 :             ivas_format = SBA_FORMAT; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */
     355             :         }
     356             :         ELSE
     357             :         {
     358        2663 :             ivas_format = st_ivas->ivas_format;
     359             :         }
     360        2816 :         move16();
     361             : 
     362        2816 :         test();
     363        2816 :         test();
     364        2816 :         test();
     365        2816 :         test();
     366        2816 :         test();
     367        2816 :         test();
     368        2816 :         test();
     369        2816 :         test();
     370        2816 :         test();
     371        2816 :         test();
     372        2816 :         test();
     373        2816 :         test();
     374        2816 :         test();
     375        2816 :         test();
     376        2816 :         test();
     377        2816 :         test();
     378        2816 :         test();
     379        2816 :         test();
     380        2816 :         test();
     381        2816 :         test();
     382        2816 :         test();
     383        2816 :         test();
     384        2816 :         test();
     385        2816 :         test();
     386        2816 :         test();
     387        2816 :         test();
     388        2816 :         test();
     389        2816 :         test();
     390        2816 :         test();
     391        2816 :         test();
     392        2816 :         test();
     393        2816 :         IF( EQ_32( ivas_format, SBA_FORMAT ) && ( NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) )
     394             :         {
     395         881 :             test();
     396         881 :             test();
     397         881 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) )
     398             :             {
     399         359 :                 *internal_config = output_config;
     400         359 :                 move16();
     401             :             }
     402         522 :             ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     403             :             {
     404           0 :                 *internal_config = IVAS_AUDIO_CONFIG_FOA;
     405           0 :                 move16();
     406             :             }
     407             :             ELSE
     408             :             {
     409         522 :                 *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     410         522 :                 move16();
     411             :             }
     412         881 :             st_ivas->renderer_type = RENDERER_SBA_LINEAR_DEC;
     413         881 :             move16();
     414             :         }
     415        1935 :         ELSE IF( ( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ||
     416             :                  ( EQ_32( ivas_format, SBA_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) ) ) )
     417             :         {
     418         268 :             *renderer_type = RENDERER_DISABLE;
     419         268 :             move16();
     420             :         }
     421        1667 :         ELSE IF( ( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && LT_32( st_ivas->hDecoderConfig->ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && GT_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) )
     422             :         {
     423          97 :             *renderer_type = RENDERER_DISABLE;
     424          97 :             move16();
     425             :         }
     426        1570 :         ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     427             :         {
     428         345 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     429         345 :             move16();
     430             :         }
     431        1225 :         ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     432             :         {
     433          41 :             *renderer_type = RENDERER_DISABLE;
     434          41 :             move16();
     435             :         }
     436        1184 :         ELSE IF( EQ_32( ivas_format, SBA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     437             :         {
     438           0 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     439           0 :             move16();
     440             :         }
     441        1184 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     442             :         {
     443          19 :             *renderer_type = RENDERER_OSBA_STEREO;
     444          19 :             move16();
     445             :         }
     446        1165 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     447             :         {
     448           1 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     449           1 :             move16();
     450             :         }
     451        1164 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) )
     452             :         {
     453           1 :             *renderer_type = RENDERER_OSBA_AMBI;
     454           1 :             move16();
     455             :         }
     456        1163 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) )
     457             :         {
     458           1 :             *renderer_type = RENDERER_OSBA_LS;
     459           1 :             move16();
     460             :         }
     461        1162 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     462             :         {
     463          20 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     464          20 :             move16();
     465             :         }
     466             :     }
     467        2211 :     ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
     468             :     {
     469        1642 :         *renderer_type = RENDERER_DIRAC;
     470        1642 :         move16();
     471             : 
     472        1642 :         IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     473             :         {
     474         223 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     475         223 :             move16();
     476             :         }
     477        1419 :         ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     478             :         {
     479         437 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     480         437 :             move16();
     481             :         }
     482         982 :         ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     483             :         {
     484           3 :             *renderer_type = RENDERER_DISABLE;
     485           3 :             move16();
     486             :         }
     487             :     }
     488         569 :     ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
     489             :     {
     490         569 :         *internal_config = transport_config;
     491         569 :         move16();
     492         569 :         test();
     493         569 :         IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) )
     494             :         {
     495         199 :             test();
     496         199 :             test();
     497         199 :             IF( NE_32( output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
     498             :             {
     499         101 :                 *renderer_type = RENDERER_MC;
     500         101 :                 move16();
     501             :             }
     502             :             ELSE
     503             :             {
     504          98 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     505          98 :                 move16();
     506             :             }
     507             :         }
     508         370 :         ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
     509             :         {
     510           4 :             *internal_config = transport_config;
     511           4 :             move16();
     512           4 :             IF( NE_32( *internal_config, output_config ) )
     513             :             {
     514           3 :                 test();
     515           3 :                 test();
     516           3 :                 IF( NE_32( output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
     517             :                 {
     518           1 :                     *renderer_type = RENDERER_MC;
     519           1 :                     move16();
     520             :                 }
     521             :                 ELSE
     522             :                 {
     523           2 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     524           2 :                     move16();
     525             :                 }
     526             :             }
     527             :         }
     528         366 :         ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) )
     529             :         {
     530         144 :             test();
     531         144 :             test();
     532         144 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
     533             :             {
     534          72 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     535          72 :                 move16();
     536             :             }
     537             :             ELSE
     538             :             {
     539          72 :                 *renderer_type = RENDERER_MC_PARAMMC;
     540             :             }
     541             :         }
     542         222 :         ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
     543             :         {
     544         218 :             *internal_config = output_config;
     545         218 :             move16();
     546             : 
     547             :             /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
     548         218 :             test();
     549         218 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     550             :             {
     551          23 :                 test();
     552          23 :                 test();
     553          23 :                 IF( EQ_16( st_ivas->nchan_transport, 1 ) )
     554             :                 {
     555           8 :                     *renderer_type = RENDERER_DISABLE;
     556           8 :                     move16();
     557             :                 }
     558          15 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && EQ_16( st_ivas->nchan_transport, 2 ) && !st_ivas->hOutSetup.separateChannelEnabled )
     559             :                 {
     560           1 :                     *renderer_type = RENDERER_DISABLE;
     561           1 :                     move16();
     562             :                 }
     563             :                 ELSE
     564             :                 {
     565          14 :                     *renderer_type = RENDERER_MCMASA_MONO_STEREO;
     566          14 :                     move16();
     567             :                 }
     568             :             }
     569             :             ELSE
     570             :             {
     571         195 :                 *renderer_type = RENDERER_DIRAC;
     572         195 :                 test();
     573         195 :                 test();
     574         195 :                 test();
     575         195 :                 test();
     576         195 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) )
     577             :                 {
     578         114 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     579         114 :                     *internal_config = transport_config;
     580         114 :                     move16();
     581             :                 }
     582          81 :                 ELSE IF( EQ_32( transport_config, IVAS_AUDIO_CONFIG_5_1 ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) ) )
     583             :                 {
     584           0 :                     *internal_config = transport_config;
     585           0 :                     move16();
     586             :                 }
     587             :             }
     588             :         }
     589             :     }
     590             : 
     591        8437 :     return;
     592             : }

Generated by: LCOV version 1.14