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 @ fec202a8f89be4a2f278a9fc377bfb58b58fab11 Lines: 113 138 81.9 %
Date: 2025-09-11 08:49:07 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             : #ifdef NONBE_1321_JBM_ASSERT_BITRATE_SWITCHING
     125             :     /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
     126             :         render what still fits in the new granularity */
     127        3933 :     tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
     128             : 
     129        3933 :     if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
     130             :     {
     131             :         /* flush already done in IVAS_DEC_ReadFormat() */
     132             :     }
     133             :     /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
     134        3210 :     else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity )
     135             :     {
     136         723 :         if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK )
     137             :         {
     138           0 :             return error;
     139             :         }
     140             :     }
     141             : 
     142             : #endif
     143        3933 :     if ( st_ivas->ism_mode != last_ism_mode )
     144             :     {
     145             :         /* EFAP handle */
     146        1827 :         efap_free_data( &st_ivas->hEFAPdata );
     147             :     }
     148             : 
     149             :     /*-----------------------------------------------------------------*
     150             :      * Switching between ParamISM and DiscISM
     151             :      *-----------------------------------------------------------------*/
     152             : 
     153             :     /* switching from ParamISM to DiscISM */
     154        3933 :     if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM )
     155             :     {
     156             :         /* Deallocate the ParamISM struct */
     157         918 :         ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config );
     158             : 
     159         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 )
     160             :         {
     161             :             /* close the parametric binaural renderer */
     162         222 :             ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
     163             : 
     164             :             /* Close omasa data struct (used for object editing) */
     165         222 :             ivas_omasa_data_close( &st_ivas->hMasaIsmData );
     166             : 
     167             :             /* Open the TD Binaural renderer */
     168         222 :             if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL )
     169             :             {
     170         222 :                 if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK )
     171             :                 {
     172           0 :                     return error;
     173             :                 }
     174         222 :                 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
     175             :                 {
     176           0 :                     if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
     177             :                     {
     178           0 :                         return error;
     179             :                     }
     180             :                 }
     181             :             }
     182             :         }
     183             :         else
     184             :         {
     185             :             /* close the ISM renderer and reinitialize */
     186         696 :             ivas_ism_renderer_close( &st_ivas->hIsmRendererData );
     187             : 
     188         696 :             if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
     189             :             {
     190           0 :                 return error;
     191             :             }
     192             :         }
     193             : 
     194         918 :         if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     195             :         {
     196             :             /* close the parametric binaural renderer */
     197         501 :             ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
     198             : 
     199             :             /* Close omasa data struct (used for object editing) */
     200         501 :             ivas_omasa_data_close( &st_ivas->hMasaIsmData );
     201             : 
     202             :             /* Open Crend Binaural renderer */
     203         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 )
     204             :             {
     205           0 :                 return error;
     206             :             }
     207             : 
     208         501 :             st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
     209             :         }
     210             :     }
     211             : 
     212             :     /* switching from Discrete ISM to ParamISM */
     213        3933 :     if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC )
     214             :     {
     215             :         /* Allocate and initialize the ParamISM struct */
     216         909 :         if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK )
     217             :         {
     218           0 :             return error;
     219             :         }
     220             : 
     221         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 )
     222             :         {
     223             :             /* open the parametric binaural renderer */
     224         225 :             if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
     225             :             {
     226           0 :                 return error;
     227             :             }
     228             : 
     229         225 :             if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK )
     230             :             {
     231           0 :                 return error;
     232             :             }
     233             : 
     234             :             /* Open omasa data struct (used for object editing) */
     235         225 :             if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
     236             :             {
     237           0 :                 return error;
     238             :             }
     239             : 
     240             :             /* Close the TD Binaural renderer */
     241         225 :             ivas_td_binaural_close( &st_ivas->hBinRendererTd );
     242             : 
     243         225 :             if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
     244             :             {
     245           0 :                 ivas_reverb_close( &st_ivas->hReverb );
     246             :             }
     247             :         }
     248             :         else
     249             :         {
     250             :             /* Close the ISM renderer */
     251         684 :             ivas_ism_renderer_close( &st_ivas->hIsmRendererData );
     252             :         }
     253             : 
     254         909 :         if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     255             :         {
     256             :             /* open the parametric binaural renderer */
     257         498 :             if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
     258             :             {
     259           0 :                 return error;
     260             :             }
     261             : 
     262         498 :             if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK )
     263             :             {
     264           0 :                 return error;
     265             :             }
     266             : 
     267             :             /* Open omasa data struct (used for object editing) */
     268         498 :             if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
     269             :             {
     270           0 :                 return error;
     271             :             }
     272             : 
     273             :             /* close the crend binaural renderer */
     274         498 :             ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
     275             :         }
     276             :     }
     277             : 
     278             :     /*-----------------------------------------------------------------*
     279             :      * CLDFB instances
     280             :      *-----------------------------------------------------------------*/
     281             : 
     282        3933 :     if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
     283             :     {
     284           0 :         return error;
     285             :     }
     286             : 
     287             :     /*-----------------------------------------------------------------*
     288             :      * JBM TC buffers
     289             :      *-----------------------------------------------------------------*/
     290             : 
     291             :     int16_t tc_nchan_full_new;
     292             :     DECODER_TC_BUFFER_HANDLE hTcBuffer;
     293             : 
     294        3933 :     hTcBuffer = st_ivas->hTcBuffer;
     295        3933 :     tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas );
     296        3933 :     tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas );
     297        3933 :     tc_nchan_allocate_new = tc_nchan_tc_new;
     298        3933 :     tc_nchan_full_new = tc_nchan_tc_new;
     299             : #ifndef NONBE_1321_JBM_ASSERT_BITRATE_SWITCHING
     300             :     tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
     301             : #endif
     302             : 
     303        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 ) )
     304             :     {
     305         213 :         tc_nchan_full_new = 0;
     306             :     }
     307             : 
     308             :     /* reconfigure buffer */
     309        3933 :     if ( hTcBuffer->tc_buffer_mode != tc_buffer_mode_new || hTcBuffer->nchan_transport_jbm != tc_nchan_tc_new ||
     310        2106 :          hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new )
     311             :     {
     312        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 )
     313             :         {
     314           0 :             return error;
     315             :         }
     316             :     }
     317             : 
     318             :     /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */
     319        3933 :     if ( st_ivas->hSpatParamRendCom != NULL )
     320             :     {
     321        1200 :         st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
     322        1200 :         st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
     323        1200 :         st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots;
     324        1200 :         st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
     325             : 
     326        1200 :         mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
     327             :     }
     328             : 
     329             :     /*-----------------------------------------------------------------*
     330             :      * floating-point output audio buffers
     331             :      *-----------------------------------------------------------------*/
     332             : 
     333        3933 :     nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
     334        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 )
     335             :     {
     336           0 :         return error;
     337             :     }
     338             : 
     339        3933 :     return IVAS_ERR_OK;
     340             : }
     341             : 
     342             : 
     343             : /*-------------------------------------------------------------------------
     344             :  * ivas_ism_dec_config()
     345             :  *
     346             :  * - select ISM format mode
     347             :  * - reconfigure the ISM format decoder
     348             :  *-------------------------------------------------------------------------*/
     349             : 
     350      302229 : ivas_error ivas_ism_dec_config(
     351             :     Decoder_Struct *st_ivas,     /* i/o: IVAS decoder structure              */
     352             :     const ISM_MODE last_ism_mode /* i/o: last ISM mode                       */
     353             : )
     354             : {
     355             :     int32_t ivas_total_brate;
     356             :     ivas_error error;
     357             :     int16_t nchan_transport_old;
     358             : 
     359      302229 :     ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
     360             : 
     361             :     /* Assumes that num of input objects are constant */
     362      302229 :     nchan_transport_old = st_ivas->nchan_ism;
     363             : 
     364      302229 :     if ( last_ism_mode == ISM_MODE_PARAM )
     365             :     {
     366       60108 :         nchan_transport_old = MAX_PARAM_ISM_WAVE;
     367             :     }
     368             : 
     369      302229 :     if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA )
     370             :     {
     371             :         /* select ISM format mode */
     372      300603 :         st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate );
     373             : 
     374      300603 :         st_ivas->nchan_transport = st_ivas->nchan_ism;
     375      300603 :         if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     376             :         {
     377       59829 :             st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
     378       59829 :             if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     379             :             {
     380        1539 :                 st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism;
     381             :             }
     382             :         }
     383             : 
     384      300603 :         if ( st_ivas->ini_active_frame != 0 )
     385             :         {
     386             :             /* ISM bit-rate switching */
     387      300381 :             if ( ( st_ivas->ism_mode != last_ism_mode ) || ( ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) )
     388             :             {
     389        3915 :                 if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
     390             :                 {
     391           0 :                     return error;
     392             :                 }
     393             :             }
     394             :         }
     395             :     }
     396        1626 :     else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 )
     397             :     {
     398        1626 :         st_ivas->nchan_transport = st_ivas->nchan_ism;
     399        1626 :         if ( st_ivas->ism_mode == ISM_MODE_PARAM )
     400             :         {
     401         321 :             st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
     402         321 :             if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
     403             :             {
     404          21 :                 st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism;
     405             :             }
     406             :         }
     407             : 
     408             :         /* ISM mode switching */
     409        1626 :         if ( st_ivas->ism_mode != last_ism_mode )
     410             :         {
     411             : 
     412          18 :             if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK )
     413             :             {
     414           0 :                 return error;
     415             :             }
     416             :         }
     417             :     }
     418             : 
     419      302229 :     switch ( st_ivas->nchan_ism )
     420             :     {
     421       56403 :         case 1:
     422       56403 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM1;
     423       56403 :             break;
     424       48195 :         case 2:
     425       48195 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM2;
     426       48195 :             break;
     427       57051 :         case 3:
     428       57051 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM3;
     429       57051 :             break;
     430      140580 :         case 4:
     431      140580 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM4;
     432      140580 :             break;
     433           0 :         default:
     434           0 :             st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID;
     435           0 :             break;
     436             :     }
     437             : 
     438      302229 :     return IVAS_ERR_OK;
     439             : }

Generated by: LCOV version 1.14