Commit 735c8188 authored by vaclav's avatar vaclav
Browse files

update init_encoder_fx()

parent 4d511c5a
Loading
Loading
Loading
Loading
+185 −151
Original line number Diff line number Diff line
@@ -22,14 +22,13 @@

ivas_error init_encoder_fx(
    Encoder_State *st_fx,   /* i/o: Encoder static variables structure  */
    const int16_t var_SID_rate_flag, /* i  : flag for variable SID update rate   */
    const int16_t interval_SID       /* i  : interval for SID update             */
    Encoder_Struct *st_ivas /* i/o: encoder state structure             */
)
{
    Word16 i;

    Word16 idchan = 0;        /* i  : channel ID                           */
    Word16 vad_only_flag = 0; /* i  : channel ID                           */
    Word32 L_tmp;
    Word16 idchan = 0;
    Word16 vad_only_flag = 0;
    move16();
    move16();
    ISM_MODE ism_mode = ISM_MODE_NONE;
@@ -40,9 +39,77 @@ ivas_error init_encoder_fx(

    Word16 frame_length = extract_l( Mpy_32_32( st->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );

    /*-----------------------------------------------------------------*
     * General parameters
     *-----------------------------------------------------------------*/

    IF( st->Opt_AMR_WB )
    {
        st->last_core = AMR_WB_CORE;
    }
    ELSE
    {
        st->last_core = -1;
    }
    move16();

    st->L_frame = L_FRAME;
    move16();
    st->last_coder_type = GENERIC;
    move16();
    st->coder_type = GENERIC;
    move16();
    st->last_total_brate = st->total_brate;
    move32();
    st->last_bits_frame_nominal = -1;
    move16();
    st->last_total_brate_cng = -1;
    move16();
    st->last_core_brate = st->total_brate;
    move32();
    st->dtx_sce_sba = 0;
    move16();
    st->extl = -1;
    move16();
    st->last_extl = -1;
    move16();
    st->last_L_frame = L_FRAME;
    move16();
    st->rate_switching_reset = 0;
    move16();
    st->rate_switching_reset_16kHz = 0;
    move16();
    st->clas = UNVOICED_CLAS;
    move16();
    st->low_rate_mode = 0;
    move16();
    st->ini_frame = 0;
    move16();
    st->inactive_coder_type_flag = 0;
    move16();
    st->sba_br_sw_while_no_data = 0;
    move16();

    st->coder_type_raw = VOICED;
    move16();
    st->last_coder_type_raw = st->coder_type_raw;
    move16();

    st->flag_ACELP16k = set_ACELP_flag_IVAS( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 );
    move16();

    st->is_ism_format = 0;
    move16();
    if ( NE_16( ism_mode, ISM_MODE_NONE ) )
    {
        st->is_ism_format = 1;
        move16();
    }

    /*-----------------------------------------------------------------*
     * General signal buffers
     *-----------------------------------------------------------------*/

    IF( !vad_only_flag )
    {
        IF( ( st->hSignalBuf = (SIGNAL_BUFFERS_ENC_HANDLE) malloc( sizeof( SIGNAL_BUFFERS_ENC_DATA ) ) ) == NULL )
@@ -99,18 +166,20 @@ ivas_error init_encoder_fx(
        move16();
        st->q_old_inp32 = Q31;
        move16();
        st->old_input_signal_fx = st->input_buff_fx;
        st->old_input_signal32_fx = st->input_buff32_fx;

        IF( st->element_mode == EVS_MONO )
        {
            st->input32_fx = st->input_buff32_fx + add( frame_length, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ) );
            st->input_fx = st->input_buff_fx + add( frame_length, NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ) );
            st->input_fx = st->input_buff_fx + add( L_FRAME48k, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ); ///////////////////// input_Fs
            st->old_input_signal_fx = st_fx->input_fx - add( NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ), frame_length );
            st->old_input_signal32_fx = st->input_buff32_fx;
        }
        ELSE
        {
            st->input32_fx = st->input_buff32_fx + frame_length;
            st->input_fx = st->input_buff_fx + frame_length;
            st->old_input_signal_fx = st->input_buff_fx;
            st->old_input_signal32_fx = st->input_buff32_fx;
        }
    }
    ELSE
@@ -128,72 +197,6 @@ ivas_error init_encoder_fx(
        st->input_buff_fx = NULL;
    }

    /*-----------------------------------------------------------------*
     * ACELP core parameters
     *-----------------------------------------------------------------*/

    IF( st->Opt_AMR_WB )
    {
        st->last_core = AMR_WB_CORE;
    }
    ELSE
    {
        st->last_core = -1;
    }
    move16();

    st->L_frame = L_FRAME;
    move16();
    st->last_coder_type = GENERIC;
    move16();
    st->coder_type = GENERIC;
    move16();
    st->last_total_brate = st->total_brate;
    move32();
    st->last_bits_frame_nominal = -1;
    move16();
    st->last_total_brate_cng = -1;
    move16();
    st->last_core_brate = st->total_brate;
    move32();
    st->dtx_sce_sba = 0;
    move16();
    st->extl = -1;
    move16();
    st->last_extl = -1;
    move16();
    st->last_L_frame = L_FRAME;
    move16();
    st->rate_switching_reset = 0;
    move16();
    st->rate_switching_reset_16kHz = 0;
    move16();
    st->clas = UNVOICED_CLAS;
    move16();
    st->low_rate_mode = 0;
    move16();
    st->ini_frame = 0;
    move16();
    st->inactive_coder_type_flag = 0;
    move16();
    st->sba_br_sw_while_no_data = 0;
    move16();

    st->coder_type_raw = VOICED;
    move16();
    st->last_coder_type_raw = st->coder_type_raw;
    move16();

    st->flag_ACELP16k = set_ACELP_flag_IVAS( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 );
    move16();

    st->is_ism_format = 0;
    move16();
    if ( NE_16( ism_mode, ISM_MODE_NONE ) )
    {
        st->is_ism_format = 1;
        move16();
    }
    /*-----------------------------------------------------------------*
     * Bitstream
     *-----------------------------------------------------------------*/
@@ -204,33 +207,31 @@ ivas_error init_encoder_fx(
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) );
        }

        /* set pointer to the buffer of indices */
        st->hBstr->ind_list = st_ivas->ind_list;
        st->hBstr->ivas_ind_list_zero = &st_ivas->ind_list;
        st->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices;
        st->hBstr->nb_ind_tot = 0;
        move16();
        st->hBstr->nb_bits_tot = 0;
        move16();
        st->hBstr->st_ivas = st_ivas;
    }
    ELSE
    {
        st->hBstr = NULL;
    }


    Copy( GEWB_Ave_fx, st_fx->mem_AR_fx, M );
    Copy( GEWB_Ave_fx, st_fx->lsfoldbfi0_fx, M );
    Copy( GEWB_Ave_fx, st_fx->lsfoldbfi1_fx, M );
    Copy( GEWB_Ave_fx, st_fx->lsf_adaptive_mean_fx, M );
    init_lvq_fx( st_fx->offset_scale1_fx, st_fx->offset_scale2_fx, st_fx->offset_scale1_p_fx, st_fx->offset_scale2_p_fx, st_fx->no_scales_fx, st_fx->no_scales_p_fx );
    st_fx->next_force_safety_net = 0;
    move16();
    st_fx->pstreaklen = 0;
    move16();
    st_fx->streaklimit_fx = 32767;
    move16(); /*1;//Q15  */
    set16_fx( st_fx->mem_MA_fx, 0, M );

    init_gp_clip_fx( st_fx->clip_var_fx );
    pitch_ol_init_fx( &st_fx->old_thres_fx, &st_fx->old_pitch, &st_fx->delta_pit, &st_fx->old_corr_fx );
    /*-----------------------------------------------------------------*
     * Pre-processing and ACELP core parameters
     *-----------------------------------------------------------------*/

    Copy( GEWB_Ave_fx, st->mem_AR_fx, M );
    Copy( GEWB_Ave_fx, st->lsfoldbfi0_fx, M );
    Copy( GEWB_Ave_fx, st->lsfoldbfi1_fx, M );
    Copy( GEWB_Ave_fx, st->lsf_adaptive_mean_fx, M );
    init_lvq_fx( st_fx->offset_scale1_fx, st_fx->offset_scale2_fx, st_fx->offset_scale1_p_fx, st_fx->offset_scale2_p_fx, st_fx->no_scales_fx, st_fx->no_scales_p_fx );

    st->next_force_safety_net = 0;
    move16();
@@ -243,6 +244,8 @@ ivas_error init_encoder_fx(

    init_gp_clip_fx( st->clip_var_fx );
    pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit, &st->old_corr_fx );


    set16_fx( st->old_wsp_fx, 0, L_WSP_MEM );
    st->exp_old_wsp = 0;
    move16();
@@ -287,6 +290,7 @@ ivas_error init_encoder_fx(
    set32_fx( st->Bin_E_fx, 0, L_FFT );
    st->q_Bin_E = Q31;
    move16();
    set16_fx( st_fx->lgBin_E_fx, 0, L_FFT / 2 ); ////////////////////////////////////////

    st->ee_old_fx = 640; /* 10.0f in Q6 */
    move16();
@@ -298,6 +302,8 @@ ivas_error init_encoder_fx(
    /* adaptive lag window memory */
    st->old_pitch_la = 0;
    move16();
    st_fx->old_voicing_la = 0; ////////////////////////////////////////////////////
    move16();

    st->prev_Q_new = 0;
    move16();
@@ -347,6 +353,8 @@ ivas_error init_encoder_fx(
    /* TC coder type */
    st->tc_cnt = 0;
    move16();
    st_fx->mCb1_fx = 0; ///////////////////////////////////////
    move16();

    /* find_uv() parameters */
    st->old_dE1_fx = 0;
@@ -427,7 +435,6 @@ ivas_error init_encoder_fx(
    set16_fx( st->pitch, L_SUBFR, 3 );
    set16_fx( st->voicing_fx, 0, 3 );


    /*-----------------------------------------------------------------*
     * AMR-WB IO initialization
     *-----------------------------------------------------------------*/
@@ -446,7 +453,6 @@ ivas_error init_encoder_fx(
        st_fx->hAmrwb_IO = NULL;
    }


    /*-----------------------------------------------------------------*
     * parameters for AC coder type (GSC)
     *-----------------------------------------------------------------*/
@@ -528,7 +534,6 @@ ivas_error init_encoder_fx(
        st_fx->hVAD_CLDFB = NULL;
    }


    /*-----------------------------------------------------------------*
     * Noise estimator
     *-----------------------------------------------------------------*/
@@ -600,7 +605,6 @@ ivas_error init_encoder_fx(
    st_fx->last_bwidth_cng = st_fx->bwidth;
    move16();


    /*-----------------------------------------------------------------*
     * DTX
     *-----------------------------------------------------------------*/
@@ -622,7 +626,7 @@ ivas_error init_encoder_fx(
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX variables\n" ) );
        }
        dtx_enc_init_fx( st, var_SID_rate_flag, interval_SID );
        dtx_enc_init_fx( st, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID );
    }
    ELSE
    {
@@ -666,7 +670,6 @@ ivas_error init_encoder_fx(
        st->hTdCngEnc = NULL;
    }


    /*-----------------------------------------------------------------*
     * ACELP LPDmem
     *-----------------------------------------------------------------*/
@@ -694,7 +697,6 @@ ivas_error init_encoder_fx(
        st->hLPDmem = NULL;
    }


    /*-----------------------------------------------------------------*
     * CLDFB Analysis
     *-----------------------------------------------------------------*/
@@ -740,7 +742,6 @@ ivas_error init_encoder_fx(
        move16();
    }


    /*-----------------------------------------------------------------*
     * SC-VBR parameters
     *-----------------------------------------------------------------*/
@@ -770,6 +771,7 @@ ivas_error init_encoder_fx(
    {
        st_fx->hPlcExt = NULL;
    }

    /*-----------------------------------------------------------------*
     * Temporal Envelope Coding
     *-----------------------------------------------------------------*/
@@ -825,7 +827,7 @@ ivas_error init_encoder_fx(

        IF( st->element_mode == EVS_MONO )
        {
            if ( ( error = openCldfb( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000 ) ) != IVAS_ERR_OK )
            IF( ( error = openCldfb( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000 ) ) != IVAS_ERR_OK )
            {
                return error;
            }
@@ -867,22 +869,6 @@ ivas_error init_encoder_fx(
        st_fx->hRF = NULL;
    }


    /*-----------------------------------------------------------------*
     * HQ core parameters
     *-----------------------------------------------------------------*/

    st_fx->Energy_Old_fx = 0;
    move16();
    st_fx->Q_old_wtda = 15;
    move16();
    st_fx->EnergyLT_fx = 1;
    move32();
    st_fx->EnergyLT_fx_exp = 30;
    move16(); /* Set to a High Exponent so it is 1^-30 */
    st_fx->TransientHangOver = 0;
    move16();

    /*-----------------------------------------------------------------*
     * TCX core
     *-----------------------------------------------------------------*/
@@ -928,6 +914,7 @@ ivas_error init_encoder_fx(
        st->hTcxEnc = NULL;
        st->hTcxCfg = NULL;
    }

    /*-----------------------------------------------------------------*
     * HQ core parameters
     *-----------------------------------------------------------------*/
@@ -951,11 +938,26 @@ ivas_error init_encoder_fx(
    st_fx->last_enerBuffer_exp = 0;
    move16();

    /* init memory for detect_transient(), used by HQ core and swb_bwe_enc */
    st->old_hpfilt_in_fx = 0;
    move16();
    st->old_hpfilt_out_fx = 0;
    move16();
    st->EnergyLT_fx = 0;
    move32();
    st->Energy_Old_fx = 0;
    move32();
    st->TransientHangOver = 0;
    move16();
    st->EnergyLT_fx_exp = 30;
    move16();
    st->last_enerBuffer_exp = 0;
    move16();

    /*-----------------------------------------------------------------*
     * Channel-aware mode
     *-----------------------------------------------------------------*/


    test();
    test();
    test();
@@ -983,17 +985,71 @@ ivas_error init_encoder_fx(
    /* initialize RF indice buffers */
    reset_rf_indices_fx( st_fx );


    /*-----------------------------------------------------------------*
     * MODE2 initialization
     *-----------------------------------------------------------------*/

    st_fx->last_sr_core = i_mult2( st_fx->last_L_frame, 50 );
    move16();

    /*-----------------------------------------------------------------*
     * IGF
     *-----------------------------------------------------------------*/

    Word32 igf_brate = st->total_brate;
    move32();

    test();
    test();
    test();
    test();
    test();
    test();
    test();
    IF( EQ_16( st->element_mode, IVAS_SCE ) && ( EQ_16( st_ivas->hEncoderConfig->ivas_format, ISM_FORMAT ) || EQ_16( st_ivas->hEncoderConfig->ivas_format, MASA_ISM_FORMAT ) ) )
    {
        igf_brate = L_sub( st->total_brate, i_mult( ISM_NB_BITS_METADATA_NOMINAL, FRAMES_PER_SEC ) );
    }
    ELSE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st->element_mode, IVAS_SCE ) && ( EQ_16( st_ivas->hEncoderConfig->ivas_format, SBA_FORMAT ) ||
                                                                                                   EQ_16( st_ivas->hEncoderConfig->ivas_format, SBA_ISM_FORMAT ) ||
                                                                                                   EQ_16( st_ivas->hEncoderConfig->ivas_format, MC_FORMAT ) ||
                                                                                                   EQ_16( st_ivas->hEncoderConfig->ivas_format, MASA_FORMAT ) ) ) )
    {
#if 0
        /* use nominal bitrates for DFT Stereo and (O)SBA, same as in stereo_dft_config()/ivas_spar_config() */
        IF( EQ_32( element_brate, IVAS_13k2 ) )
        {
            igf_brate = ACELP_9k60;
        }
        ELSE IF( EQ_32( element_brate, IVAS_16k4 ) )
        {
            igf_brate = ACELP_13k20;
        }
        ELSE IF( EQ_32( element_brate, IVAS_24k4 ) )
        {
            igf_brate = ACELP_16k40;
        }
        ELSE IF( EQ_32( element_brate, IVAS_32k ) )
        {
            igf_brate = ACELP_24k40;
        }
#endif
    }
    ELSE IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
    {
        //   igf_brate = element_brate;
    }

    IF( EQ_16( st_fx->codec_mode, MODE2 ) )
    {
        st_fx->igf = getIgfPresent_fx( st_fx->element_mode, igf_brate, st_fx->bwidth, st_fx->rf_mode );
    }
    ELSE
    {
        st_fx->igf = 0;
        move16();
    }

    test();
    test();
@@ -1010,7 +1066,6 @@ ivas_error init_encoder_fx(
        st->hIGFEnc = NULL;
    }


    /*-----------------------------------------------------------------*
     * FD-CNG encoder
     *-----------------------------------------------------------------*/
@@ -1050,7 +1105,6 @@ ivas_error init_encoder_fx(
        st->hFdCngEnc = NULL;
    }


    st_fx->last_totalNoise_fx = 0;
    move16();
    set16_fx( st_fx->totalNoise_increase_hist_fx, 0, TOTALNOISE_HIST_SIZE );
@@ -1078,13 +1132,6 @@ ivas_error init_encoder_fx(
        init_coder_ace_plus_ivas_fx( st, st->last_total_brate, -1, 0 );
    }

    IF( st->hLPDmem != NULL )
    {
        st->hLPDmem->q_lpd_old_exc = st->prev_Q_new;
        move16();
    }


    IF( ( st_fx->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) );
@@ -1092,6 +1139,12 @@ ivas_error init_encoder_fx(

    InitTransientDetection_fx( frame_length, NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ), st_fx->hTranDet );

#if 1 //////////////////////////////////////////////////////////////////////////////////////////////


    set32_fx( st_fx->mem_hp20_in_fx, 0, 5 );


    st_fx->Q_syn2 = 0;
    move16();
    st_fx->Q_syn = 0;
@@ -1104,8 +1157,7 @@ ivas_error init_encoder_fx(
    move16();
    st_fx->old_wsp_shift = 0;
    move16();
    st_fx->sharpFlag = 0;
    move16();


    st_fx->tdm_LRTD_flag = 0; /* LRTD stereo mode flag */
    move16();
@@ -1113,29 +1165,8 @@ ivas_error init_encoder_fx(
    move16();
    st_fx->cng_sba_flag = 0; /* CNG in SBA flag */
    move16();
    st->bits_frame_channel = 0;
    move16();
    st->side_bits_frame_channel = 0;
    move16();

    st->Q_syn2 = 0;
    move16();
    st->Q_syn = 0;
    move16();
    set16_fx( st->Q_max, Q_MAX, L_Q_MEM );
    set16_fx( st->Q_max_16k, Q_MAX, L_Q_MEM );
    st->Q_old = 15;
    move16();
    st->old_wsp_max = 0;
    move16();
    st->old_wsp_shift = 0;
    move16();
    st->sharpFlag = 0;

#ifdef DEBUGGING
    st_fx->id_element = -1; /* element ID */
    move16();
#endif
#endif //////////////////////////////////////////////////////////////////////////////////////////////

    return error;
}
@@ -1192,12 +1223,14 @@ void LPDmem_enc_init_ivas_fx(
    set16_fx( hLPDmem->mem_syn2, 0, M );
    set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM );
    set16_fx( hLPDmem->mem_syn3, 0, M );

    hLPDmem->q_lpd_old_exc = Q15;
    move16();
    hLPDmem->q_lpd_syn = Q15;
    move16();
    hLPDmem->q_mem_syn = Q15;
    move16();

    hLPDmem->mem_w0 = 0;
    move16();
    hLPDmem->tilt_code = 0;
@@ -1339,6 +1372,7 @@ ivas_error init_encoder_ivas_fx(
    Copy( GEWB_Ave_fx, st->lsfoldbfi0_fx, M );
    Copy( GEWB_Ave_fx, st->lsfoldbfi1_fx, M );
    Copy( GEWB_Ave_fx, st->lsf_adaptive_mean_fx, M );
    init_lvq_fx( st->offset_scale1_fx, st->offset_scale2_fx, st->offset_scale1_p_fx, st->offset_scale2_p_fx, st->no_scales_fx, st->no_scales_p_fx );

    st->next_force_safety_net = 0;
    move16();
+0 −144
Original line number Diff line number Diff line
@@ -1188,150 +1188,6 @@ void destroy_core_enc_fx(
    return;
}

void destroy_evs_core_enc_fx(
    ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure      */
)
{
    Word16 i;

    IF( hCoreCoder->hBstr != NULL )
    {
        /* reset buffer of indices */
        FOR( i = 0; i < hCoreCoder->hBstr->nb_ind_tot; i++ )
        {
            hCoreCoder->hBstr->ind_list[i].nb_bits = -1;
            move16();
        }
        free( hCoreCoder->hBstr );
        hCoreCoder->hBstr = NULL;
    }

    IF( hCoreCoder->hLPDmem != NULL )
    {
        free( hCoreCoder->hLPDmem );
        hCoreCoder->hLPDmem = NULL;
    }

    IF( hCoreCoder->hTranDet != NULL )
    {
        free( hCoreCoder->hTranDet );
        hCoreCoder->hTranDet = NULL;
    }

    IF( hCoreCoder->hNoiseEst != NULL )
    {
        free( hCoreCoder->hNoiseEst );
        hCoreCoder->hNoiseEst = NULL;
    }

    IF( hCoreCoder->hVAD != NULL )
    {
        free( hCoreCoder->hVAD );
        hCoreCoder->hVAD = NULL;
    }

    IF( hCoreCoder->hVAD_CLDFB != NULL )
    {
        /* This is not required as we are not allocating memory dynamically */
        // free( hCoreCoder->hVAD_CLDFB );
        hCoreCoder->hVAD_CLDFB = NULL;
    }

    IF( hCoreCoder->hTdCngEnc != NULL )
    {
        free( hCoreCoder->hTdCngEnc );
        hCoreCoder->hTdCngEnc = NULL;
    }

    IF( hCoreCoder->hDtxEnc != NULL )
    {
        free( hCoreCoder->hDtxEnc );
        hCoreCoder->hDtxEnc = NULL;
    }

    IF( hCoreCoder->hSpMusClas != NULL )
    {
        free( hCoreCoder->hSpMusClas );
        hCoreCoder->hSpMusClas = NULL;
    }

    IF( hCoreCoder->hGSCEnc != NULL )
    {
        free( hCoreCoder->hGSCEnc );
        hCoreCoder->hGSCEnc = NULL;
    }

    IF( hCoreCoder->hSC_VBR != NULL )
    {
        free( hCoreCoder->hSC_VBR );
        hCoreCoder->hSC_VBR = NULL;
    }

    IF( hCoreCoder->hAmrwb_IO != NULL )
    {
        free( hCoreCoder->hAmrwb_IO );
        hCoreCoder->hAmrwb_IO = NULL;
    }

    IF( hCoreCoder->hBWE_TD != NULL )
    {
        free( hCoreCoder->hBWE_TD );
        hCoreCoder->hBWE_TD = NULL;
    }

    IF( hCoreCoder->hBWE_FD != NULL )
    {
        free( hCoreCoder->hBWE_FD );
        hCoreCoder->hBWE_FD = NULL;
    }

    IF( hCoreCoder->hRF != NULL )
    {
        free( hCoreCoder->hRF );
        hCoreCoder->hRF = NULL;
    }

    IF( hCoreCoder->hTECEnc != NULL )
    {
        free( hCoreCoder->hTECEnc );
        hCoreCoder->hTECEnc = NULL;
    }

    IF( hCoreCoder->hTcxEnc != NULL )
    {
        free( hCoreCoder->hTcxEnc );
        hCoreCoder->hTcxEnc = NULL;
    }

    IF( hCoreCoder->hTcxCfg != NULL )
    {
        free( hCoreCoder->hTcxCfg );
        hCoreCoder->hTcxCfg = NULL;
    }

    IF( hCoreCoder->hIGFEnc != NULL )
    {
        free( hCoreCoder->hIGFEnc );
        hCoreCoder->hIGFEnc = NULL;
    }

    IF( hCoreCoder->hPlcExt != NULL )
    {
        free( hCoreCoder->hPlcExt );
        hCoreCoder->hPlcExt = NULL;
    }

    IF( hCoreCoder->hHQ_core != NULL )
    {
        free( hCoreCoder->hHQ_core );
        hCoreCoder->hHQ_core = NULL;
    }

    free( hCoreCoder );

    return;
}


/*-------------------------------------------------------------------------
 * ivas_destroy_enc_fx()
+1 −11
Original line number Diff line number Diff line
@@ -476,20 +476,10 @@ ivas_error create_sce_enc_fx(

    IF( st->element_mode == EVS_MONO )
    {
        IF( NE_32( ( error = init_encoder_fx( st, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID ) ), IVAS_ERR_OK ) )
        IF( NE_32( ( error = init_encoder_fx( st, st_ivas ) ), IVAS_ERR_OK ) )
        {
            return error;
        }

        /* set pointer to the buffer of indices */
        st->hBstr->ind_list = st_ivas->ind_list;
        st->hBstr->ivas_ind_list_zero = &st_ivas->ind_list;
        st->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices;
        st->hBstr->nb_ind_tot = 0;
        move16();
        st->hBstr->nb_bits_tot = 0;
        move16();
        st->hBstr->st_ivas = st_ivas;
    }
    ELSE
    {
+2 −3
Original line number Diff line number Diff line
@@ -4589,8 +4589,7 @@ void index_lvq_ivas_fx(

ivas_error init_encoder_fx(
    Encoder_State *st_fx,   /* i/o: Encoder static variables structure  */
    const int16_t var_SID_rate_flag, /* i  : flag for variable SID update rate   */
    const int16_t interval_SID       /* i  : interval for SID update             */
    Encoder_Struct *st_ivas /* i/o: encoder state structure             */
);

void copy_encoder_config_fx(