Commit b51521ba authored by vaclav's avatar vaclav
Browse files

- move ivas_ism_enc_config() to ivas_ism_enc.c

- move ivas_ism_dec_config() to newly introduced file ivas_ism_dec.c
parent 0d83885b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -277,6 +277,7 @@
    <ClCompile Include="..\lib_dec\ivas_dirac_output_synthesis_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_entropy_decoder.c" />
    <ClCompile Include="..\lib_dec\ivas_init_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_ism_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_ism_dtx_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_ism_metadata_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_ism_param_dec.c" />
+3 −0
Original line number Diff line number Diff line
@@ -506,6 +506,9 @@
    <ClCompile Include="..\lib_dec\ivas_ism_dtx_dec.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_ism_dec.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\jbm_jb4_inputbuffer.h">

lib_dec/ivas_ism_dec.c

0 → 100644
+298 −0
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

#include <stdint.h>
#include <assert.h>
#include <math.h>
#include "options.h"
#include "ivas_prot.h"
#include "prot.h"
#include "ivas_rom_com.h"
#include "ivas_rom_dec.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
#include "wmc_auto.h"


/*-------------------------------------------------------------------------*
 * ivas_ism_bitrate_switching()
 *
 *
 *-------------------------------------------------------------------------*/

static ivas_error ivas_ism_bitrate_switching(
    Decoder_Struct *st_ivas,           /* i/o: IVAS decoder structure               */
    const int16_t nchan_transport_old, /* i  : last number of transport channels    */
    const ISM_MODE last_ism_mode,      /* i  : last ISM mode                        */
    const int16_t num_obj              /* i  : number of objects in the bitstream   */
)
{
    ivas_error error;
    int32_t element_brate_tmp[MAX_NUM_OBJECTS];
    int16_t nSCE_old, nCPE_old;

    error = IVAS_ERR_OK;

    nCPE_old = st_ivas->nCPE;
    nSCE_old = st_ivas->nSCE;

    ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL );
    st_ivas->nSCE = st_ivas->nchan_transport;

    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_hp20_dec_reconfig( st_ivas, nchan_transport_old );

    /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */

    /* select the renderer */
    ivas_renderer_select( st_ivas );
    ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config );
    if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->ism_mode == ISM_MODE_DISC ) )
    {
        ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
    }

    if ( st_ivas->ism_mode != last_ism_mode )
    {
        /* EFAP handle */
        efap_free_data( &st_ivas->hEFAPdata );
    }

    if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM )
    {
        /* switching from ParamISM to DiscISM */

        /* Deallocate the ParamISM struct */
        if ( st_ivas->hDirAC != NULL )
        {
            ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config );
            st_ivas->hDirAC = NULL;
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL )
        {
            /* close the parametric binaural renderer */
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );

            /* Open the TD Binaural renderer */
            ivas_td_binaural_open( st_ivas );
        }
        else
        {
            /* close the ISM renderer and reinitialize */
            if ( st_ivas->hIsmRendererData != NULL )
            {
                free( st_ivas->hIsmRendererData );
                st_ivas->hIsmRendererData = NULL;
            }
            ivas_ism_renderer_open( st_ivas );
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM )
        {
            /* close the parametric binaural renderer */
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );

            /* Open Crend Binaural renderer */
#ifdef FIX_197_CREND_INTERFACE
            if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ),
                                                getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ),
                                                getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ),
                                                st_ivas->hRenderConfig,
                                                st_ivas->hDecoderConfig->Opt_Headrotation,
                                                st_ivas->hSetOfHRTF,
                                                st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
            {
                return error;
            }
            st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
#else
            ivas_crend_open( st_ivas );
#endif
        }
    }

    if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC )
    {
        /* switching from Discrete ISM to ParamISM */

        /* Allocate and initialize the ParamISM struct */
        ivas_param_ism_dec_open( st_ivas );

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL )
        {
            /* open the parametric binaural renderer */
            ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin );
            ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin );

            /* Close the TD Binaural renderer */
            if ( st_ivas->hBinRendererTd != NULL )
            {
                ivas_td_binaural_close( &st_ivas->hBinRendererTd );
            }

            if ( st_ivas->hHrtfTD != NULL )
            {
                st_ivas->hHrtfTD = NULL;
            }
        }
        else
        {
            /* Close the ISM renderer */
            if ( st_ivas->hIsmRendererData != NULL )
            {
                free( st_ivas->hIsmRendererData );
                st_ivas->hIsmRendererData = NULL;
            }
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM )
        {
            /* open the parametric binaural renderer */
            ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin );
            ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin );

            /* close the crend binaural renderer */
#ifdef FIX_197_CREND_INTERFACE
            ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#else
            ivas_crend_close( st_ivas );

            if ( st_ivas->hHrtf != NULL )
            {
                st_ivas->hHrtf = NULL;
            }
#endif
        }
    }

    return error;
}


/*-------------------------------------------------------------------------
 * ivas_ism_dec_config()
 *
 * - select ISM format mode
 * - reconfigure the ISM format decoder
 *-------------------------------------------------------------------------*/

/*! r : ISM format mode */
ivas_error ivas_ism_dec_config(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure              */
    const int16_t num_obj    /* i  : number of objects in the bitstream  */
)
{
    int32_t ivas_total_brate;
    ISM_MODE last_ism_mode;
    ivas_error error;
    int16_t nchan_transport_old;

    error = IVAS_ERR_OK;

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;

    /* store last frame ISM mode */
    last_ism_mode = st_ivas->ism_mode;

    /* Assumes that num of input objects are constant */
    nchan_transport_old = num_obj;

    if ( last_ism_mode == ISM_MODE_PARAM )
    {
        nchan_transport_old = MAX_PARAM_ISM_WAVE;
    }

    if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA )
    {
        /* select ISM format mode */
        st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate );

        st_ivas->nchan_transport = num_obj;
        if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            st_ivas->nchan_transport = 2;
            if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL )
            {
                st_ivas->hDecoderConfig->nchan_out = num_obj;
            }
        }

        if ( st_ivas->ini_active_frame != 0 )
        {
            /* ISM bit-rate switching */
            if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA )
            {
                if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) )
                {
                    ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj );
                }
            }
        }
    }
    else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 )
    {
#ifdef PARAM_ISM_DTX_CNG
        if ( last_ism_mode == ISM_MODE_PARAM )
        {
            nchan_transport_old = MAX_PARAM_ISM_WAVE;
        }
        else
#endif
        {
            st_ivas->nchan_transport = num_obj;
        }
    }

    switch ( num_obj )
    {
        case 1:
            st_ivas->transport_config = AUDIO_CONFIG_ISM1;
            break;
        case 2:
            st_ivas->transport_config = AUDIO_CONFIG_ISM2;
            break;
        case 3:
            st_ivas->transport_config = AUDIO_CONFIG_ISM3;
            break;
        case 4:
            st_ivas->transport_config = AUDIO_CONFIG_ISM4;
            break;
        default:
            st_ivas->transport_config = AUDIO_CONFIG_INVALID;
            break;
    }

    return error;
}
+0 −253
Original line number Diff line number Diff line
@@ -1131,259 +1131,6 @@ void ivas_param_ism_params_to_masa_param_mapping(
}


/*-------------------------------------------------------------------------*
 * ivas_ism_bitrate_switching()
 *
 *
 *-------------------------------------------------------------------------*/

static ivas_error ivas_ism_bitrate_switching(
    Decoder_Struct *st_ivas,           /* i/o: IVAS decoder structure               */
    const int16_t nchan_transport_old, /* i  : last number of transport channels    */
    const ISM_MODE last_ism_mode,      /* i  : last ISM mode                        */
    const int16_t num_obj              /* i  : number of objects in the bitstream   */
)
{
    ivas_error error;
    int32_t element_brate_tmp[MAX_NUM_OBJECTS];
    int16_t nSCE_old, nCPE_old;

    error = IVAS_ERR_OK;

    nCPE_old = st_ivas->nCPE;
    nSCE_old = st_ivas->nSCE;

    ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL );
    st_ivas->nSCE = st_ivas->nchan_transport;

    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_hp20_dec_reconfig( st_ivas, nchan_transport_old );

    /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */

    /* select the renderer */
    ivas_renderer_select( st_ivas );
    ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config );
    if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->ism_mode == ISM_MODE_DISC ) )
    {
        ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
    }

    if ( st_ivas->ism_mode != last_ism_mode )
    {
        /* EFAP handle */
        efap_free_data( &st_ivas->hEFAPdata );
    }

    if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM )
    {
        /* switching from ParamISM to DiscISM */

        /* Deallocate the ParamISM struct */
        if ( st_ivas->hDirAC != NULL )
        {
            ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config );
            st_ivas->hDirAC = NULL;
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL )
        {
            /* close the parametric binaural renderer */
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );

            /* Open the TD Binaural renderer */
            ivas_td_binaural_open( st_ivas );
        }
        else
        {
            /* close the ISM renderer and reinitialize */
            if ( st_ivas->hIsmRendererData != NULL )
            {
                free( st_ivas->hIsmRendererData );
                st_ivas->hIsmRendererData = NULL;
            }
            ivas_ism_renderer_open( st_ivas );
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM )
        {
            /* close the parametric binaural renderer */
            ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );

            /* Open Crend Binaural renderer */
#ifdef FIX_197_CREND_INTERFACE
            if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ),
                                                getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ),
                                                getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ),
                                                st_ivas->hRenderConfig,
                                                st_ivas->hDecoderConfig->Opt_Headrotation,
                                                st_ivas->hSetOfHRTF,
                                                st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
            {
                return error;
            }
            st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
#else
            ivas_crend_open( st_ivas );
#endif
        }
    }

    if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC )
    {
        /* switching from Discrete ISM to ParamISM */

        /* Allocate and initialize the ParamISM struct */
        ivas_param_ism_dec_open( st_ivas );

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL )
        {
            /* open the parametric binaural renderer */
            ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin );
            ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin );

            /* Close the TD Binaural renderer */
            if ( st_ivas->hBinRendererTd != NULL )
            {
                ivas_td_binaural_close( &st_ivas->hBinRendererTd );
            }

            if ( st_ivas->hHrtfTD != NULL )
            {
                st_ivas->hHrtfTD = NULL;
            }
        }
        else
        {
            /* Close the ISM renderer */
            if ( st_ivas->hIsmRendererData != NULL )
            {
                free( st_ivas->hIsmRendererData );
                st_ivas->hIsmRendererData = NULL;
            }
        }

        if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM )
        {
            /* open the parametric binaural renderer */
            ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin );
            ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin );

            /* close the crend binaural renderer */
#ifdef FIX_197_CREND_INTERFACE
            ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#else
            ivas_crend_close( st_ivas );

            if ( st_ivas->hHrtf != NULL )
            {
                st_ivas->hHrtf = NULL;
            }
#endif
        }
    }

    return error;
}

/*-------------------------------------------------------------------------
 * ivas_ism_dec_config()
 *
 * - select ISM format mode
 * - reconfigure the ISM format decoder
 *-------------------------------------------------------------------------*/

/*! r : ISM format mode */
ivas_error ivas_ism_dec_config(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure              */
    const int16_t num_obj    /* i  : number of objects in the bitstream  */
)
{
    int32_t ivas_total_brate;
    ISM_MODE last_ism_mode;
    ivas_error error;
    int16_t nchan_transport_old;

    error = IVAS_ERR_OK;

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;

    /* store last frame ISM mode */
    last_ism_mode = st_ivas->ism_mode;

    /* Assumes that num of input objects are constant */
    nchan_transport_old = num_obj;

    if ( last_ism_mode == ISM_MODE_PARAM )
    {
        nchan_transport_old = MAX_PARAM_ISM_WAVE;
    }

    if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA )
    {
        /* select ISM format mode */
        st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate );

        st_ivas->nchan_transport = num_obj;
        if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            st_ivas->nchan_transport = 2;
            if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL )
            {
                st_ivas->hDecoderConfig->nchan_out = num_obj;
            }
        }

        if ( st_ivas->ini_active_frame != 0 )
        {
            /* ISM bit-rate switching */
            if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA )
            {
                if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) )
                {
                    ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj );
                }
            }
        }
    }
    else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 )
    {
#ifdef PARAM_ISM_DTX_CNG
        if ( last_ism_mode == ISM_MODE_PARAM )
        {
            nchan_transport_old = MAX_PARAM_ISM_WAVE;
        }
        else
#endif
        {
            st_ivas->nchan_transport = num_obj;
        }
    }

    switch ( num_obj )
    {
        case 1:
            st_ivas->transport_config = AUDIO_CONFIG_ISM1;
            break;
        case 2:
            st_ivas->transport_config = AUDIO_CONFIG_ISM2;
            break;
        case 3:
            st_ivas->transport_config = AUDIO_CONFIG_ISM3;
            break;
        case 4:
            st_ivas->transport_config = AUDIO_CONFIG_ISM4;
            break;
        default:
            st_ivas->transport_config = AUDIO_CONFIG_INVALID;
            break;
    }

    return error;
}


#ifdef PARAM_ISM_DTX_CNG
static void ivas_param_ism_dec_dequantize_DOA_dtx(
    int16_t azi_bits,
+69 −0
Original line number Diff line number Diff line
@@ -368,3 +368,72 @@ ivas_error ivas_ism_enc(

    return error;
}


/*-------------------------------------------------------------------------
 * ivas_ism_enc_config()
 *
 * - select ISM format mode
 * - reconfigure the ISM format encoder
 *-------------------------------------------------------------------------*/

/*! r : ISM format mode */
ivas_error ivas_ism_enc_config(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder structure      */
)
{
    ivas_error error;
    ISM_MODE last_ism_mode;
    int16_t nchan_transport_old;
    int16_t nSCE_old, nCPE_old;

    error = IVAS_ERR_OK;
    last_ism_mode = st_ivas->ism_mode;

    /* select ISM format mode */
    st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->hEncoderConfig->nchan_inp, st_ivas->hEncoderConfig->ivas_total_brate );

    /* ISM bit-rate switching */
    if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hEncoderConfig->ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) )
    {
        int32_t element_brate_tmp[MAX_NUM_OBJECTS];

        nchan_transport_old = st_ivas->nchan_transport;

        /* Reset and Initialize */
        if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            st_ivas->nchan_transport = 2;
        }
        else
        {
            st_ivas->nchan_transport = st_ivas->hEncoderConfig->nchan_inp;
        }

        nCPE_old = st_ivas->nCPE;
        nSCE_old = st_ivas->nSCE;
        st_ivas->nSCE = st_ivas->nchan_transport;
        st_ivas->nCPE = 0;

        ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL );
        ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE );

        if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC )
        {
            /* Allocate and Initialize the memory used by ParamISM when switch from Discrete ISM */
            if ( ( error = ivas_param_ism_enc_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM )
        {
            /* Deallocate the memory used by ParamISM when switch to Discrete ISM */
            ivas_param_ism_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs );
            st_ivas->hDirAC = NULL;
        }
    }

    return error;
}
Loading