LCOV - code coverage report
Current view: top level - lib_dec - ivas_output_config_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main @ da9cc8ead0679b4682d329fdff98cf1616159273 Lines: 320 326 98.2 %
Date: 2025-10-13 22:24:20 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_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      409289 : 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      409289 :     renderer_type = &( st_ivas->renderer_type );
      58      409289 :     internal_config = &( st_ivas->intern_config );
      59      409289 :     output_config = st_ivas->hDecoderConfig->output_config;
      60      409289 :     move16();
      61      409289 :     transport_config = st_ivas->transport_config;
      62      409289 :     move16();
      63             : 
      64             :     /* disabled rendering by default */
      65      409289 :     *renderer_type = RENDERER_DISABLE;
      66      409289 :     move16();
      67             : 
      68             :     /*-----------------------------------------------------------------*
      69             :      * Binaural rendering configurations
      70             :      *-----------------------------------------------------------------*/
      71             : 
      72      409289 :     test();
      73      409289 :     IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
      74             :     {
      75       69438 :         st_ivas->hCombinedOrientationData->shd_rot_max_order = -1;
      76       69438 :         move16();
      77             :     }
      78             : 
      79      409289 :     test();
      80      409289 :     test();
      81      409289 :     test();
      82      409289 :     test();
      83      409289 :     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 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
      84             :     {
      85      161177 :         test();
      86      161177 :         test();
      87      161177 :         test();
      88      161177 :         test();
      89      161177 :         test();
      90      161177 :         IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
      91             :         {
      92       47429 :             IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
      93             :             {
      94        8028 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
      95             :                 {
      96        5576 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
      97        5576 :                     move16();
      98             :                 }
      99             :                 ELSE
     100             :                 {
     101        2452 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     102        2452 :                     move16();
     103             :                 }
     104             :             }
     105             :             ELSE /* ISM_MODE_DISC */
     106             :             {
     107       39401 :                 test();
     108       39401 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
     109             :                 {
     110       29235 :                     *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     111       29235 :                     move16();
     112       29235 :                     *internal_config = output_config;
     113       29235 :                     move16();
     114             :                 }
     115             :                 ELSE
     116             :                 {
     117       10166 :                     *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     118       10166 :                     move16();
     119       10166 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     120       10166 :                     move16();
     121             :                 }
     122             :             }
     123             :         }
     124      113748 :         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       50523 :             *internal_config = output_config;
     127       50523 :             move16();
     128       50523 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
     129             :             {
     130       26800 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     131       26800 :                 move16();
     132             :             }
     133             :             ELSE
     134             :             {
     135       23723 :                 *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     136       23723 :                 move16();
     137             :             }
     138             :         }
     139       63225 :         ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
     140             :         {
     141       30103 :             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     142       30103 :             move16();
     143             : 
     144       30103 :             test();
     145       30103 :             test();
     146       30103 :             test();
     147       30103 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
     148             :             {
     149       20122 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV;
     150       20122 :                 move16();
     151             :             }
     152             :             ELSE
     153             :             {
     154        9981 :                 *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     155        9981 :                 move16();
     156             :             }
     157             : 
     158       30103 :             test();
     159       30103 :             IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( *renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
     160             :             {
     161        3003 :                 *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     162        3003 :                 move16();
     163             :             }
     164             : 
     165       30103 :             test();
     166       30103 :             IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     167             :             {
     168       10367 :                 nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
     169       10367 :                 test();
     170       10367 :                 test();
     171       10367 :                 test();
     172       10367 :                 IF( EQ_16( nchan_internal, 2 ) )
     173             :                 {
     174           9 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 1;
     175           9 :                     move16();
     176             :                 }
     177       10358 :                 ELSE IF( EQ_16( nchan_internal, 4 ) || EQ_16( nchan_internal, 3 ) )
     178             :                 {
     179        9207 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 0;
     180        9207 :                     move16();
     181             :                 }
     182        1151 :                 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        1151 :                 ELSE IF( EQ_16( nchan_internal, 8 ) || EQ_16( nchan_internal, 7 ) )
     188             :                 {
     189         100 :                     st_ivas->hCombinedOrientationData->shd_rot_max_order = 3;
     190         100 :                     move16();
     191             :                 }
     192             :             }
     193             :         }
     194       33122 :         ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
     195             :         {
     196       33122 :             IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
     197             :             {
     198        7251 :                 *internal_config = output_config;
     199        7251 :                 move16();
     200             : 
     201        7251 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
     202             :                 {
     203        3413 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC;
     204        3413 :                     move16();
     205             :                 }
     206             :                 ELSE
     207             :                 {
     208        3838 :                     *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM;
     209        3838 :                     move16();
     210             :                 }
     211             :             }
     212             :             ELSE
     213             :             {
     214       25871 :                 *internal_config = transport_config;
     215       25871 :                 move16();
     216       25871 :                 test();
     217       25871 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
     218             :                 {
     219       17504 :                     test();
     220       17504 :                     test();
     221       17504 :                     test();
     222       17504 :                     test();
     223       17504 :                     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 ) )
     224             :                     {
     225        3133 :                         *renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     226        3133 :                         move16();
     227             :                     }
     228             :                     ELSE
     229             :                     {
     230       14371 :                         IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
     231             :                         {
     232        7778 :                             *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
     233        7778 :                             move16();
     234             :                         }
     235             :                         ELSE
     236             :                         {
     237        6593 :                             *renderer_type = RENDERER_BINAURAL_FASTCONV;
     238        6593 :                             move16();
     239             :                         }
     240             : 
     241       14371 :                         test();
     242       14371 :                         IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
     243             :                         {
     244             :                             /* force HOA3 domain for rotation*/
     245        3835 :                             *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     246        3835 :                             move16();
     247             :                         }
     248             :                     }
     249             :                 }
     250             :                 ELSE
     251             :                 {
     252        8367 :                     IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
     253             :                     {
     254        5924 :                         *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
     255        5924 :                         move16();
     256             :                     }
     257             :                     ELSE
     258             :                     {
     259        2443 :                         *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
     260        2443 :                         move16();
     261             :                     }
     262             :                 }
     263             :             }
     264             :         }
     265             :     }
     266             : 
     267             :     /*-----------------------------------------------------------------*
     268             :      * Non-binaural rendering configurations
     269             :      *-----------------------------------------------------------------*/
     270             : 
     271      248112 :     ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
     272             :     {
     273           3 :         IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     274             :         {
     275           1 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     276           1 :             move16();
     277             :         }
     278             :     }
     279      248109 :     ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
     280             :     {
     281       70918 :         test();
     282       70918 :         test();
     283       70918 :         IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     284             :         {
     285           0 :             *renderer_type = RENDERER_MC;
     286           0 :             move16();
     287             :         }
     288             :     }
     289      177191 :     ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
     290             :     {
     291       47606 :         test();
     292       47606 :         IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
     293             :         {
     294        1501 :             *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
     295        1501 :             move16();
     296             :         }
     297             :         ELSE
     298             :         {
     299       46105 :             IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
     300             :             {
     301        8197 :                 *renderer_type = RENDERER_PARAM_ISM;
     302        8197 :                 test();
     303        8197 :                 test();
     304        8197 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     305             :                 {
     306        1458 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     307        1458 :                     move16();
     308             :                 }
     309        6739 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     310             :                 {
     311        1501 :                     *renderer_type = RENDERER_DISABLE;
     312        1501 :                     move16();
     313             :                 }
     314        5238 :                 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        3141 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     317        3141 :                     move16();
     318        3141 :                     *internal_config = IVAS_AUDIO_CONFIG_7_1_4;
     319        3141 :                     move16();
     320             :                 }
     321             :             }
     322             :             ELSE /* ISM_MODE_DISC */
     323             :             {
     324       37908 :                 *renderer_type = RENDERER_TD_PANNING;
     325       37908 :                 test();
     326       37908 :                 test();
     327       37908 :                 IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     328             :                 {
     329        2472 :                     *renderer_type = RENDERER_MONO_DOWNMIX;
     330        2472 :                     move16();
     331             :                 }
     332       35436 :                 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        4931 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     335        4931 :                     move16();
     336             :                 }
     337       30505 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     338             :                 {
     339       20396 :                     *renderer_type = RENDERER_DISABLE;
     340       20396 :                     move16();
     341             :                 }
     342             :             }
     343             :         }
     344             :     }
     345      129585 :     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      106075 :     {
     347             :         IVAS_FORMAT ivas_format;
     348      106075 :         *renderer_type = RENDERER_DIRAC;
     349      106075 :         move16();
     350             : 
     351      106075 :         test();
     352      106075 :         IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MODE_NONE ) )
     353             :         {
     354        6295 :             ivas_format = SBA_FORMAT; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */
     355             :         }
     356             :         ELSE
     357             :         {
     358       99780 :             ivas_format = st_ivas->ivas_format;
     359             :         }
     360      106075 :         move16();
     361             : 
     362      106075 :         test();
     363      106075 :         test();
     364      106075 :         test();
     365      106075 :         test();
     366      106075 :         test();
     367      106075 :         test();
     368      106075 :         test();
     369      106075 :         test();
     370      106075 :         test();
     371      106075 :         test();
     372      106075 :         test();
     373      106075 :         test();
     374      106075 :         test();
     375      106075 :         test();
     376      106075 :         test();
     377      106075 :         test();
     378      106075 :         test();
     379      106075 :         test();
     380      106075 :         test();
     381      106075 :         test();
     382      106075 :         test();
     383      106075 :         test();
     384      106075 :         test();
     385      106075 :         test();
     386      106075 :         test();
     387      106075 :         test();
     388      106075 :         test();
     389      106075 :         test();
     390      106075 :         test();
     391      106075 :         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 ) ) )
     392             :         {
     393       54670 :             test();
     394       54670 :             test();
     395       54670 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     396             :             {
     397             :                 /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
     398             :             }
     399       49976 :             ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) )
     400             :             {
     401       40660 :                 *internal_config = output_config;
     402       40660 :                 move16();
     403             :             }
     404             :             ELSE
     405             :             {
     406        9316 :                 *internal_config = IVAS_AUDIO_CONFIG_HOA3;
     407        9316 :                 move16();
     408             :             }
     409       54670 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     410       54670 :             move16();
     411             :         }
     412       51405 :         ELSE IF( ( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ||
     413             :                  ( EQ_32( ivas_format, SBA_FORMAT ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) ) ) )
     414             :         {
     415       11199 :             *renderer_type = RENDERER_DISABLE;
     416       11199 :             move16();
     417             :         }
     418       40206 :         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 ) ) )
     419             :         {
     420         745 :             *renderer_type = RENDERER_DISABLE;
     421         745 :             move16();
     422             :         }
     423       39461 :         ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     424             :         {
     425        3492 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     426        3492 :             move16();
     427             :         }
     428       35969 :         ELSE IF( EQ_32( ivas_format, MASA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     429             :         {
     430        4711 :             *renderer_type = RENDERER_DISABLE;
     431        4711 :             move16();
     432             :         }
     433       31258 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     434             :         {
     435        1430 :             *renderer_type = RENDERER_OSBA_STEREO;
     436        1430 :             move16();
     437             :         }
     438       29828 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     439             :         {
     440        1001 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     441        1001 :             move16();
     442             :         }
     443       28827 :         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 ) ) )
     444             :         {
     445        1001 :             *renderer_type = RENDERER_OSBA_AMBI;
     446        1001 :             move16();
     447             :         }
     448       27826 :         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 ) ) )
     449             :         {
     450        2002 :             *renderer_type = RENDERER_OSBA_LS;
     451        2002 :             move16();
     452             :         }
     453       25824 :         ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     454             :         {
     455        2438 :             *renderer_type = RENDERER_SBA_LINEAR_DEC;
     456        2438 :             move16();
     457             :         }
     458             :     }
     459       23510 :     ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
     460             :     {
     461        6759 :         *renderer_type = RENDERER_DIRAC;
     462        6759 :         move16();
     463             : 
     464        6759 :         IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
     465             :         {
     466        1194 :             *renderer_type = RENDERER_MONO_DOWNMIX;
     467        1194 :             move16();
     468             :         }
     469        5565 :         ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     470             :         {
     471        1457 :             *renderer_type = RENDERER_STEREO_PARAMETRIC;
     472        1457 :             move16();
     473             :         }
     474        4108 :         ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     475             :         {
     476         823 :             IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
     477             :             {
     478          79 :                 *renderer_type = RENDERER_OMASA_OBJECT_EXT;
     479          79 :                 move32();
     480             :             }
     481         744 :             ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) )
     482             :             {
     483          72 :                 *renderer_type = RENDERER_OMASA_MIX_EXT;
     484          72 :                 move32();
     485             :             }
     486             :             ELSE
     487             :             {
     488         672 :                 *renderer_type = RENDERER_DISABLE;
     489         672 :                 move32();
     490             :             }
     491             :         }
     492             :     }
     493       16751 :     ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
     494             :     {
     495       16751 :         *internal_config = transport_config;
     496       16751 :         move16();
     497             : 
     498       16751 :         test();
     499       16751 :         test();
     500       16751 :         IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     501             :         {
     502        7092 :             test();
     503        7092 :             test();
     504        7092 :             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 ) )
     505             :             {
     506        6504 :                 *renderer_type = RENDERER_MC;
     507        6504 :                 move16();
     508             :             }
     509             :             ELSE
     510             :             {
     511         588 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     512         588 :                 move16();
     513             :             }
     514             :         }
     515        9659 :         ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
     516             :         {
     517         186 :             *internal_config = transport_config;
     518         186 :             move16();
     519             : 
     520         186 :             test();
     521         186 :             IF( NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     522             :             {
     523          23 :                 test();
     524          23 :                 test();
     525          23 :                 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 ) )
     526             :                 {
     527          11 :                     *renderer_type = RENDERER_MC;
     528          11 :                     move16();
     529             :                 }
     530             :                 ELSE
     531             :                 {
     532          12 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     533          12 :                     move16();
     534             :                 }
     535             :             }
     536             :         }
     537        9473 :         ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) )
     538             :         {
     539        2140 :             test();
     540        2140 :             test();
     541        2140 :             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 ) )
     542             :             {
     543         432 :                 *renderer_type = RENDERER_SBA_LINEAR_ENC;
     544         432 :                 move16();
     545             :             }
     546             :             ELSE
     547             :             {
     548        1708 :                 *renderer_type = RENDERER_MC_PARAMMC;
     549             :             }
     550             :         }
     551        7333 :         ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
     552             :         {
     553        4828 :             if ( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
     554             :             {
     555        4526 :                 *internal_config = output_config;
     556        4526 :                 move16();
     557             :             }
     558             : 
     559             :             /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
     560        4828 :             test();
     561        4828 :             IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
     562             :             {
     563        2697 :                 test();
     564        2697 :                 test();
     565        2697 :                 IF( EQ_16( st_ivas->nchan_transport, 1 ) )
     566             :                 {
     567        2176 :                     *renderer_type = RENDERER_DISABLE;
     568        2176 :                     move16();
     569             :                 }
     570         521 :                 ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && EQ_16( st_ivas->nchan_transport, 2 ) && !st_ivas->hOutSetup.separateChannelEnabled )
     571             :                 {
     572          10 :                     *renderer_type = RENDERER_DISABLE;
     573          10 :                     move16();
     574             :                 }
     575             :                 ELSE
     576             :                 {
     577         511 :                     *renderer_type = RENDERER_MCMASA_MONO_STEREO;
     578         511 :                     move16();
     579             :                 }
     580             :             }
     581             :             ELSE
     582             :             {
     583        2131 :                 *renderer_type = RENDERER_DIRAC;
     584        2131 :                 test();
     585        2131 :                 test();
     586        2131 :                 test();
     587        2131 :                 test();
     588        2131 :                 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 ) )
     589             :                 {
     590         404 :                     *renderer_type = RENDERER_SBA_LINEAR_ENC;
     591         404 :                     *internal_config = transport_config;
     592         404 :                     move16();
     593             :                 }
     594        1727 :                 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 ) ) )
     595             :                 {
     596           0 :                     *internal_config = transport_config;
     597           0 :                     move16();
     598             :                 }
     599             :             }
     600             :         }
     601             :     }
     602             : 
     603      409289 :     return;
     604             : }
     605             : 
     606             : #ifdef FIX_CREND_SIMPLIFY_CODE
     607             : /*-------------------------------------------------------------------------*
     608             :  * ivas_renderer_secondary_select()
     609             :  *
     610             :  * Select IVAS secondary binaural renderer (used in combined formats)
     611             :  *-------------------------------------------------------------------------*/
     612             : 
     613             : /*! r: secondary binaural renderer type */
     614      400398 : RENDERER_TYPE ivas_renderer_secondary_select(
     615             :     Decoder_Struct *st_ivas /* i/o: IVAS decoder structure  */
     616             : )
     617             : {
     618             :     RENDERER_TYPE renderer_type;
     619             :     AUDIO_CONFIG output_config;
     620             : 
     621             :     /* disabled by default */
     622      400398 :     renderer_type = RENDERER_DISABLE;
     623      400398 :     output_config = st_ivas->hDecoderConfig->output_config;
     624      400398 :     move32();
     625      400398 :     move32();
     626             : 
     627      400398 :     test();
     628      400398 :     test();
     629      400398 :     IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) )
     630             :     {
     631         108 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     632         108 :         move32();
     633             :     }
     634      400290 :     ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
     635             :     {
     636        8840 :         renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
     637        8840 :         move32();
     638             :     }
     639             : 
     640      400398 :     return renderer_type;
     641             : }
     642             : #endif

Generated by: LCOV version 1.14