LCOV - code coverage report
Current view: top level - lib_dec - ivas_ism_dec.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ 32c65a1d087e768493373e1ef03f43c4739b6bba Lines: 113 138 81.9 %
Date: 2025-09-18 07:58:56 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 "prot.h"
      36             : #include "ivas_prot.h"
      37             : #include "ivas_prot_rend.h"
      38             : #ifdef DEBUGGING
      39             : #include "debug.h"
      40             : #endif
      41             : #include "wmc_auto.h"
      42             : 
      43             : /*-------------------------------------------------------------------------*
      44             :  * ivas_ism_bitrate_switching_dec()
      45             :  *
      46             :  *
      47             :  *-------------------------------------------------------------------------*/
      48             : 
      49        3933 : static ivas_error ivas_ism_bitrate_switching_dec(
      50             :     Decoder_Struct *st_ivas,           /* i/o: IVAS decoder structure               */
      51             :     const int16_t nchan_transport_old, /* i  : last number of transport channels    */
      52             :     const ISM_MODE last_ism_mode       /* i  : last ISM mode                        */
      53             : )
      54             : {
      55             :     ivas_error error;
      56             :     int32_t element_brate_tmp[MAX_NUM_OBJECTS];
      57             :     int16_t nSCE_old, nCPE_old;
      58             :     int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode;
      59             :     TC_BUFFER_MODE tc_buffer_mode_new;
      60             :     int16_t tc_nchan_tc_new;
      61             :     int16_t tc_nchan_allocate_new;
      62             :     int16_t tc_granularity_new;
      63             :     int16_t nchan_out_buff;
      64             : 
      65        3933 :     nCPE_old = st_ivas->nCPE;
      66        3933 :     nSCE_old = st_ivas->nSCE;
      67             : 
      68             :     /* temporarily set the ism mode back to the old one, otherwise this can give wrong results*/
      69        3933 :     ism_mode = st_ivas->ism_mode;
      70        3933 :     st_ivas->ism_mode = last_ism_mode;
      71        3933 :     ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
      72        3933 :     st_ivas->ism_mode = ism_mode;
      73             : 
      74        3933 :     if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK )
      75             :     {
      76           0 :         return error;
      77             :     }
      78             : 
      79        3933 :     st_ivas->nSCE = st_ivas->nchan_transport;
      80             : 
      81             :     /*-----------------------------------------------------------------*
      82             :      * Allocate, initialize, and configure SCE/CPE/MCT handles
      83             :      *-----------------------------------------------------------------*/
      84             : 
      85        3933 :     if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK )
      86             :     {
      87           0 :         return error;
      88             :     }
      89             : 
      90             :     /*-----------------------------------------------------------------*
      91             :      * HP20 memories
      92             :      *-----------------------------------------------------------------*/
      93             : 
      94        3933 :     if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK )
      95             :     {
      96           0 :         return error;
      97             :     }
      98             : 
      99             :     /*-----------------------------------------------------------------*
     100             :      * Initialize the needed renderer struct and destroy the unnecessary renderer struct
     101             :      *-----------------------------------------------------------------*/
     102             : 
     103             :     /* select the renderer */
     104        3933 :     ivas_renderer_select( st_ivas );
     105             : 
     106        3933 :     ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config );
     107             : 
     108        3933 :     if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->ism_mode == ISM_MODE_DISC ) )
     109             :     {
     110         234 :         ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
     111             :     }
     112             : 
     113             :     /* transfer subframe info from DirAC or ParamMC to central tc buffer */
     114             :     /* only do this if we are not having done everything already in the TC decoding part and having only played out from the TC buffer */
     115        3933 :     if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER )
     116             :     {
     117        1209 :         st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes;
     118        1209 :         st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered;
     119        1209 :         st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots;
     120        1209 :         st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered;
     121        1209 :         mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
     122             :     }
     123             : 
     124             :     /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
     125             :         render what still fits in the new granularity */
     126        3933 :     tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
     127             : 
     128        3933 :     if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
     129             :     {
     130             :         /* flush already done in IVAS_DEC_ReadFormat() */
     131             :     }
     132             :     /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
     133        3210 :     else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity )
     134             :     {
     135         723 :         if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK )
     136             :         {
     137           0 :             return error;
     138             :         }
     139             :     }
     140             : 
     141        3933 :     if ( st_ivas->ism_mode != last_ism_mode )
     142             :     {
     143             :         /* EFAP handle */
     144        1827 :         efap_free_data( &st_ivas->hEFAPdata );
     145             :     }
     146             : 
     147             :     /*-----------------------------------------------------------------*
     148             :      * Switching between ParamISM and DiscISM
     149             :      *-----------------------------------------------------------------*/
     150             : 
     151             :     /* switching from ParamISM to DiscISM */
     152        3933 :     if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM )
     153             :     {
     154             :         /* Deallocate the ParamISM struct */
     155         918 :         ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config );
     156             : 
     157         918 :         if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     158             :         {
     159             :             /* close the parametric binaural renderer */
     160         222 :             ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
     161             : 
     162             :             /* Close omasa data struct (used for object editing) */
     163         222 :             ivas_omasa_data_close( &st_ivas->hMasaIsmData );
     164             : 
     165             :             /* Open the TD Binaural renderer */
     166         222 :             if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL )
     167             :             {
     168         222 :                 if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK )
     169             :                 {
     170           0 :                     return error;
     171             :                 }
     172         222 :                 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
     173             :                 {
     174           0 :                     if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
     175             :                     {
     176           0 :                         return error;
     177             :                     }
     178             :                 }
     179             :             }
     180             :         }
     181             :         else
     182             :         {
     183             :             /* close the ISM renderer and reinitialize */
     184         696 :             ivas_ism_renderer_close( &st_ivas->hIsmRendererData );
     185             : 
     186         696 :             if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
     187             :             {
     188           0 :                 return error;
     189             :             }
     190             :         }
     191             : 
     192         918 :         if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     193             :         {
     194             :             /* close the parametric binaural renderer */
     195         501 :             ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
     196             : 
     197             :             /* Close omasa data struct (used for object editing) */
     198         501 :             ivas_omasa_data_close( &st_ivas->hMasaIsmData );
     199             : 
     200             :             /* Open Crend Binaural renderer */
     201         501 :             if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
     202             :             {
     203           0 :                 return error;
     204             :             }
     205             : 
     206         501 :             st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
     207             :         }
     208             :     }
     209             : 
     210             :     /* switching from Discrete ISM to ParamISM */
     211        3933 :     if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC )
     212             :     {
     213             :         /* Allocate and initialize the ParamISM struct */
     214         909 :         if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK )
     215             :         {
     216           0 :             return error;
     217             :         }
     218             : 
     219         909 :         if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     220             :         {
     221             :             /* open the parametric binaural renderer */
     222         225 :             if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
     223             :             {
     224           0 :                 return error;
     225             :             }
     226             : 
     227         225 :             if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK )
     228             :             {
     229           0 :                 return error;
     230             :             }
     231             : 
     232             :             /* Open omasa data struct (used for object editing) */
     233         225 :             if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
     234             :             {
     235           0 :                 return error;
     236             :             }
     237             : 
     238             :             /* Close the TD Binaural renderer */
     239         225 :             ivas_td_binaural_close( &st_ivas->hBinRendererTd );
     240             : 
     241         225 :             if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
     242             :             {
     243           0 :                 ivas_reverb_close( &st_ivas->hReverb );
     244             :             }
     245             :         }
     246             :         else
     247             :         {
     248             :             /* Close the ISM renderer */
     249         684 :             ivas_ism_renderer_close( &st_ivas->hIsmRendererData );
     250             :         }
     251             : 
     252         909 :         if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     253             :         {
     254             :             /* open the parametric binaural renderer */
     255         498 :             if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
     256             :             {
     257           0 :                 return error;
     258             :             }
     259             : 
     260         498 :             if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK )
     261             :             {
     262           0 :                 return error;
     263             :             }
     264             : 
     265             :             /* Open omasa data struct (used for object editing) */
     266         498 :             if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
     267             :             {
     268           0 :                 return error;
     269             :             }
     270             : 
     271             :             /* close the crend binaural renderer */
     272         498 :             ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
     273             :         }
     274             :     }
     275             : 
     276             :     /*-----------------------------------------------------------------*
     277             :      * CLDFB instances
     278             :      *-----------------------------------------------------------------*/
     279             : 
     280        3933 :     if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
     281             :     {
     282           0 :         return error;
     283             :     }
     284             : 
     285             :     /*-----------------------------------------------------------------*
     286             :      * JBM TC buffers
     287             :      *-----------------------------------------------------------------*/
     288             : 
     289             :     int16_t tc_nchan_full_new;
     290             :     DECODER_TC_BUFFER_HANDLE hTcBuffer;
     291             : 
     292        3933 :     hTcBuffer = st_ivas->hTcBuffer;
     293        3933 :     tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas );
     294        3933 :     tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas );
     295        3933 :     tc_nchan_allocate_new = tc_nchan_tc_new;
     296        3933 :     tc_nchan_full_new = tc_nchan_tc_new;
     297             : 
     298        3933 :     if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
     299             :     {
     300         213 :         tc_nchan_full_new = 0;
     301             :     }
     302             : 
     303             :     /* reconfigure buffer */
     304        3933 :     if ( hTcBuffer->tc_buffer_mode != tc_buffer_mode_new || hTcBuffer->nchan_transport_jbm != tc_nchan_tc_new ||
     305        2106 :          hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new )
     306             :     {
     307        1827 :         if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK )
     308             :         {
     309           0 :             return error;
     310             :         }
     311             :     }
     312             : 
     313             :     /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */
     314        3933 :     if ( st_ivas->hSpatParamRendCom != NULL )
     315             :     {
     316        1200 :         st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
     317        1200 :         st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
     318        1200 :         st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots;
     319        1200 :         st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
     320             : 
     321        1200 :         mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
     322             :     }
     323             : 
     324             :     /*-----------------------------------------------------------------*
     325             :      * floating-point output audio buffers
     326             :      *-----------------------------------------------------------------*/
     327             : 
     328        3933 :     nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
     329        3933 :     if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
     330             :     {
     331           0 :         return error;
     332             :     }
     333             : 
     334        3933 :     return IVAS_ERR_OK;
     335             : }
     336             : 
     337             : 
     338             : /*-------------------------------------------------------------------------
     339             :  * ivas_ism_dec_config()
     340             :  *
     341             :  * - select ISM format mode
     342             :  * - reconfigure the ISM format decoder
     343             :  *-------------------------------------------------------------------------*/
     344             : 
     345      302229 : ivas_error ivas_ism_dec_config(
     346             :     Decoder_Struct *st_ivas,     /* i/o: IVAS decoder structure              */
     347             :     const ISM_MODE last_ism_mode /* i/o: last ISM mode                       */
     348             : )
     349             : {
     350             :     int32_t ivas_total_brate;
     351             :     ivas_error error;
     352             :     int16_t nchan_transport_old;
     353             : 
     354      302229 :     ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
     355             : 
     356             :     /* Assumes that num of input objects are constant */
     357      302229 :     nchan_transport_old = st_ivas->nchan_ism;
     358             : 
     359      302229 :     if ( last_ism_mode == ISM_MODE_PARAM )
     360             :     {
     361       60108 :         nchan_transport_old = MAX_PARAM_ISM_WAVE;
     362             :     }
     363             : 
     364      302229 :     if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA )
     365             :     {
     366             :         /* select ISM format mode */
     367      300603 :         st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate );
     368             : 
     369      300603 :         st_ivas->nchan_transport = st_ivas->nchan_ism;
     370      300603 :         if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     371             :         {
     372       59829 :             st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
     373       59829 :             if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     374             :             {
     375        1539 :                 st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism;
     376             :             }
     377             :         }
     378             : 
     379      300603 :         if ( st_ivas->ini_active_frame != 0 )
     380             :         {
     381             :             /* ISM bit-rate switching */
     382      300381 :             if ( ( st_ivas->ism_mode != last_ism_mode ) || ( ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) )
     383             :             {
     384        3915 :                 if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
     385             :                 {
     386           0 :                     return error;
     387             :                 }
     388             :             }
     389             :         }
     390             :     }
     391        1626 :     else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 )
     392             :     {
     393        1626 :         st_ivas->nchan_transport = st_ivas->nchan_ism;
     394        1626 :         if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     395             :         {
     396         321 :             st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
     397         321 :             if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     398             :             {
     399          21 :                 st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism;
     400             :             }
     401             :         }
     402             : 
     403             :         /* ISM mode switching */
     404        1626 :         if ( st_ivas->ism_mode != last_ism_mode )
     405             :         {
     406             : 
     407          18 :             if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
     408             :             {
     409           0 :                 return error;
     410             :             }
     411             :         }
     412             :     }
     413             : 
     414      302229 :     switch ( st_ivas->nchan_ism )
     415             :     {
     416       56403 :         case 1:
     417       56403 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM1;
     418       56403 :             break;
     419       48195 :         case 2:
     420       48195 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM2;
     421       48195 :             break;
     422       57051 :         case 3:
     423       57051 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM3;
     424       57051 :             break;
     425      140580 :         case 4:
     426      140580 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM4;
     427      140580 :             break;
     428           0 :         default:
     429           0 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID;
     430           0 :             break;
     431             :     }
     432             : 
     433      302229 :     return IVAS_ERR_OK;
     434             : }

Generated by: LCOV version 1.14