Commit cca26043 authored by multrus's avatar multrus
Browse files

clean up init_tcx_ivas_fx()

parent c6a01fe5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3794,12 +3794,14 @@ void tcx_get_gain(
    Word16 *en_y_e  /* o: energy of y exponent (optional) */
);

#ifndef HARMONIZE_2567_init_functions
void init_TCX_config(
    TCX_CONFIG_HANDLE hTcxCfg,
    Word16 L_frame,
    Word16 fscale,
    Word16 L_frameTCX,
    Word16 fscaleFB );
#endif

void resetTecDec_Fx(
    TEC_DEC_HANDLE hTecDec );
+2 −0
Original line number Diff line number Diff line
@@ -2157,6 +2157,7 @@ void tcx_get_gain(
}


#ifndef HARMONIZE_2567_init_functions
void init_TCX_config(
    TCX_CONFIG_HANDLE hTcxCfg,
    Word16 L_frame,    /*Q0*/
@@ -2207,3 +2208,4 @@ void init_TCX_config(

    return;
}
#endif
+15 −113
Original line number Diff line number Diff line
@@ -1330,39 +1330,11 @@ static void init_tcx_ivas_fx(
{
    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
#ifdef HARMONIZE_2567_init_functions
    Word16 i;
    Word16 fscaleFB;

    fscaleFB = div_l( L_shl( st->input_Fs, LD_FSCALE_DENOM + 1 ), 12800 );

    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        init_TCX_config( st->hTcxCfg, st->L_frame, st->fscale, hTcxEnc->L_frameTCX, fscaleFB );

        st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length;
        move16();

        /* TCX Offset */
        st->hTcxCfg->tcx_offset = shr( st->hTcxCfg->tcx_mdct_window_delay, 1 );
        move16();
        st->hTcxCfg->tcx_offsetFB = shr( st->hTcxCfg->tcx_mdct_window_delayFB, 1 );
        move16();

        /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/
        st->hTcxCfg->lfacNext = sub( st->hTcxCfg->tcx_offset, shr( st->L_frame, 2 ) );
        move16();
        st->hTcxCfg->lfacNextFB = sub( st->hTcxCfg->tcx_offsetFB, shr( hTcxEnc->L_frameTCX, 2 ) );
        move16();
        IF( st->ini_frame == 0 )
        {
            st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
            move16();
            move16();
        }
    }
    ELSE
#endif
    {

    /* Share the memories for 2xTCX10/4xTCX5 and for TCX20 */
    hTcxEnc->spectrum_fx[0] = hTcxEnc->spectrum_long_fx;
    hTcxEnc->spectrum_fx[1] = hTcxEnc->spectrum_long_fx + N_TCX10_MAX;
@@ -1378,7 +1350,6 @@ static void init_tcx_ivas_fx(
                          st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf,
                          st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag );
#endif
    }

    /* Init TCX target bits correction factor */
    hTcxEnc->tcx_target_bits_fac = 0x4000; /*1.0f in 1Q14*/
@@ -1389,59 +1360,8 @@ static void init_tcx_ivas_fx(
    move16();
    hTcxEnc->noiseLevelMemory_cnt = 0;
    move16();
#ifdef HARMONIZE_2567_init_functions
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        /*SQ deadzone & memory quantization*/

        /*0.375f: deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/
        st->hTcxCfg->sq_rounding = 12288 /*0.375f Q15*/;
        move16();

        FOR( i = 0; i < L_FRAME_PLUS; i++ )
        {
            hTcxEnc->memQuantZeros[i] = 0;
            move16();
        }

        /* TCX rate loop */
        st->hTcxCfg->tcxRateLoopOpt = 0;
        move16();

        if ( st->tcxonly != 0 )
        {
            st->hTcxCfg->tcxRateLoopOpt = 2;
            move16();
        }

        /* TCX bandwidth */
        move16();
        st->hTcxCfg->bandwidth = getTcxBandwidth( st->bwidth );


        /* set number of coded lines */
        st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( st->bwidth );

        /* TNS in TCX */
        move16();
        move16();
        st->hTcxCfg->fIsTNSAllowed = (Word8) getTnsAllowed( st->total_brate, st->igf, st->element_mode );

        st->hTcxCfg->pCurrentTnsConfig = NULL;

        IF( st->hTcxCfg->fIsTNSAllowed != 0 )
        {
            InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, 0 /*is_mct*/ );
        }
    }
    ELSE
    {
#endif
    set16_fx( hTcxEnc->ltpGainMemory_fx, 0, N_LTP_GAIN_MEMS );
    set8_fx( hTcxEnc->memQuantZeros, 0, L_FRAME_PLUS );
#ifdef HARMONIZE_2567_init_functions
    }
#endif

    /* TCX-LTP */
    hTcxEnc->tcxltp = getTcxLtp( st->sr_core );
@@ -1517,24 +1437,6 @@ static void init_tcx_ivas_fx(
        move16();
    }

#ifdef HARMONIZE_2567_init_functions
    IF( EQ_16( st->element_mode, EVS_MONO ) )
    {
        /* Residual Coding*/
        st->hTcxCfg->resq = getResq( st->total_brate );
        move16();

        test();
        if ( st->hTcxCfg->resq != 0 && st->tcxonly == 0 )
        {
            st->hTcxCfg->tcxRateLoopOpt = 1;
            move16();
        }

        st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->total_brate, st->rf_mode );
        move16();
    }
#endif
    hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode );
    move16();