Commit 31ec9ece authored by multrus's avatar multrus
Browse files

[cleanup] accept HARMONIZE_2595_reconfig_decoder_LPD

parent e65d31a1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@
#define FIX_1990_SANITIZER_IN_REVERB_LOAD               /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define HARMONIZE_2595_reconfig_decoder_LPD             /* FhG: Harmonize reconfig_decoder_LPD with its ivas derivate */
#define HARMONIZE_2596_SetModeIndex                     /* FhG: Harmonize SetModeIndex with its ivas derivate */
#define HARMONIZE_2597_ShapeSpectrum                    /* FhG: Harmonize ShapeSpectrum with its ivas derivate */
#define HARMONIZE_2567_init_functions                   /* FhG: harmonize derivates for evs/ivas regarding functions init_acelp*(),init_tcx_cfg*(), init_tcx*(), init_coder_ace_plus*(), init_core_sig_ana*() and init_modes*() */
+0 −13
Original line number Diff line number Diff line
@@ -7821,21 +7821,8 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
    CONTEXT_HM_CONFIG *hm_cfg /* i  : context-based harmonic model configuration*/
);

#ifndef HARMONIZE_2595_reconfig_decoder_LPD
void reconfig_decoder_LPD_fx(
    Decoder_State *st,  /* i/o: decoder state structure    */
    Word16 bits_frame,  /* i  : bit budget               Q0*/
    Word16 bwidth,      /* i  : audio bandwidth          Q0*/
    Word32 total_brate, /* i  : total bitrate            Q0*/
    Word16 L_frame_old  /* i  : frame length             Q0*/
);
#endif

#ifdef HARMONIZE_2595_reconfig_decoder_LPD
void reconfig_decoder_LPD_fx(
#else
void reconfig_decoder_LPD_ivas_fx(
#endif
    Decoder_State *st,        /* i/o: decoder state structure     */
    const Word16 bits_frame,  /* i  : bit budget               Q0*/
    const Word16 bwidth,      /* i  : audio bandwidth          Q0*/
+0 −201
Original line number Diff line number Diff line
@@ -10,11 +10,7 @@
#include "rom_com.h"


#ifdef HARMONIZE_2595_reconfig_decoder_LPD
void reconfig_decoder_LPD_fx(
#else
void reconfig_decoder_LPD_ivas_fx(
#endif
    Decoder_State *st,        /* i/o: decoder state structure     */
    const Word16 bits_frame,  /* i  : bit budget               Q0*/
    const Word16 bwidth,      /* i  : audio bandwidth          Q0*/
@@ -172,10 +168,8 @@ void reconfig_decoder_LPD_ivas_fx(
            ELSE
            {
                set16_fx( st->mem_syn_clas_estim_fx, 0, L_SYN_MEM_CLAS_ESTIM ); /* Qx */
#ifdef HARMONIZE_2595_reconfig_decoder_LPD
                st->classifier_Q_mem_syn = 0;
                move16();
#endif
            }
        }
    }
@@ -201,198 +195,3 @@ void reconfig_decoder_LPD_ivas_fx(
    return;
}
#ifndef HARMONIZE_2595_reconfig_decoder_LPD
void reconfig_decoder_LPD_fx(
    Decoder_State *st,  /* i/o: decoder state structure    */
    Word16 bits_frame,  /* i  : bit budget               Q0*/
    Word16 bwidth,      /* i  : audio bandwidth          Q0*/
    Word32 total_brate, /* i  : total bitrate            Q0*/
    Word16 L_frame_old  /* i  : frame length             Q0*/
)
{
    Word16 newLen;
    Word16 oldLen;
    Word32 lowrate_tcxlpc_max_br;

    TCX_LTP_DEC_HANDLE hTcxLtpDec;
    TCX_DEC_HANDLE hTcxDec;

    hTcxLtpDec = st->hTcxLtpDec;
    hTcxDec = st->hTcxDec;

    move16();
    st->bits_frame = bits_frame;

    IF( EQ_16( bwidth, NB ) )
    {
        move16();
        st->narrowBand = 1;
    }
    ELSE IF( GT_16( bwidth, NB ) )
    {
        move16();
        st->narrowBand = 0;
    }

    BITS_ALLOC_init_config_acelp( st->total_brate, st->narrowBand, st->nb_subfr, &( st->acelp_cfg ) );

    /*Configuration of partial copy*/
    st->acelp_cfg_rf.mode_index = 1;
    move16();
    st->acelp_cfg_rf.midLpc = 0;
    move16();
    st->acelp_cfg_rf.midLpc_enable = 0;
    move16();
    st->acelp_cfg_rf.pre_emphasis = 0;
    move16();
    st->acelp_cfg_rf.formant_enh = 1;
    move16();
    st->acelp_cfg_rf.formant_tilt = 1;
    move16();
    st->acelp_cfg_rf.voice_tilt = 1;
    move16();
    st->acelp_cfg_rf.formant_enh_num = FORMANT_SHARPENING_G1;
    move16();
    st->acelp_cfg_rf.formant_enh_den = FORMANT_SHARPENING_G2;
    move16();


    IF( NE_16( st->element_mode, IVAS_SCE ) )
    {
        st->flag_cna = (Word8) getCnaPresent_fx( st->element_mode, st->element_brate, total_brate, bwidth );
        move16();
    }

    /* TCX-LTP */
    IF( hTcxLtpDec != NULL )
    {
        hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core );
        move16();
    }

    IF( st->hTcxCfg != NULL )
    {
        Word16 i;

        /*Scale TCX for non-active frames to adjust loudness with ACELP*/
        st->hTcxCfg->na_scale = 32767 /*1.0f Q15*/;
        test();
        IF( ( LT_16( bwidth, SWB ) ) && !( st->tcxonly ) )
        {
            Word16 scaleTableSize = idiv1616( sizeof( scaleTcxTable ), sizeof( scaleTcxTable[0] ) ); /* is a constant */

            FOR( i = 0; i < scaleTableSize; i++ )
            {
                test();
                test();
                IF( ( EQ_16( bwidth, scaleTcxTable[i].bwmode ) ) &&
                    ( GE_32( total_brate, scaleTcxTable[i].bitrateFrom ) ) &&
                    ( LT_32( total_brate, scaleTcxTable[i].bitrateTo ) ) )
                {
                    IF( st->rf_flag )
                    {
                        i = i - 1;
                        move16();
                    }
                    st->hTcxCfg->na_scale = scaleTcxTable[i].scale;
                    move16();
                    BREAK;
                }
            }
        }
    }

    /*if its not the first frame resample overlap buffer to new sampling rate */
    IF( ( st->ini_frame != 0 ) )
    {
        test();
        test();
        test();
        test();
        test();
        IF( st->hTcxCfg != NULL &&
            ( NE_16( st->fscale, st->fscale_old ) &&
              !( st->element_mode == EVS_MONO && EQ_16( st->last_codec_mode, MODE1 ) &&
                 EQ_16( st->last_core, ACELP_CORE ) && st->prev_bfi != 0 ) ) )
        /* no resempling is needed here when recovering from mode 1
           acelp plc, since the buffers are already sampled with the
           correct sampling rate in open_decoder_LPD_fx() */
        {

            newLen = st->hTcxCfg->tcx_mdct_window_length;
            oldLen = st->hTcxCfg->tcx_mdct_window_length_old;
            move16();
            move16();
            test();
            test();
            IF( ( st->prev_bfi && EQ_16( st->last_core_bfi, ACELP_CORE ) ) || EQ_16( st->last_core, ACELP_CORE ) )
            {
                newLen = shr( st->L_frame, 1 );
                oldLen = shr( L_frame_old, 1 );
            }
            IF( st->hTcxDec != NULL )
            {
                lerp( hTcxDec->old_syn_Overl, hTcxDec->old_syn_Overl, newLen, oldLen );
                lerp( hTcxDec->syn_Overl, hTcxDec->syn_Overl, newLen, oldLen );

                test();
                IF( st->prev_bfi && EQ_16( st->last_core_bfi, ACELP_CORE ) )
                {
                    lerp( hTcxDec->syn_Overl_TDAC, hTcxDec->syn_Overl_TDAC, newLen, oldLen );
                }
            }
        }


        IF( LE_16( st->L_frame, L_FRAME16k ) )
        {
            IF( LE_16( st->last_L_frame, L_FRAME16k ) )
            {
                IF( NE_16( st->L_frame, st->last_L_frame ) )
                {
                    IF( GT_16( st->L_frame, st->last_L_frame ) )
                    {
                        oldLen = extract_l( L_shr( Mpy_32_16_1( L_mult0( st->last_L_frame, getInvFrameLen( st->L_frame ) /*Q21*/ ) /*Q21*/, L_SYN_MEM_CLAS_ESTIM /*Q0*/ ) /*Q6*/, 6 ) /*Q0*/ );
                        newLen = L_SYN_MEM_CLAS_ESTIM;
                        move16();
                        move16();
                    }
                    ELSE
                    {
                        oldLen = L_SYN_MEM_CLAS_ESTIM;
                        move16();
                        newLen = extract_l( L_shr( Mpy_32_16_1( L_mult0( st->L_frame, getInvFrameLen( st->last_L_frame ) /*Q21*/ ) /*Q21*/, L_SYN_MEM_CLAS_ESTIM /*Q0*/ ) /*Q6*/, 6 ) /*Q0*/ );
                    }
                    lerp( &st->mem_syn_clas_estim_fx[L_SYN_MEM_CLAS_ESTIM - oldLen], &st->mem_syn_clas_estim_fx[L_SYN_MEM_CLAS_ESTIM - newLen], newLen, oldLen );
                }
            }
            ELSE
            {
                set16_fx( st->mem_syn_clas_estim_fx, 0, L_SYN_MEM_CLAS_ESTIM );
                st->classifier_Q_mem_syn = 0;
                move16();
            }
        }
    }
    test();
    test();
    test();
    lowrate_tcxlpc_max_br = LOWRATE_TCXLPC_MAX_BR;
    move16();
    IF( GT_16( st->element_mode, IVAS_SCE ) )
    {
        lowrate_tcxlpc_max_br = LOWRATE_TCXLPC_MAX_BR_CPE;
        move16();
    }
    hTcxDec->enableTcxLpc = EQ_16( st->numlpc, 1 ) && EQ_16( st->lpcQuantization, 1 ) && ( LE_32( total_brate, lowrate_tcxlpc_max_br ) /*LOWRATE_TCXLPC_MAX_BR*/ || st->rf_flag );
    move16();
    IF( EQ_16( st->ini_frame, 0 ) )
    {
        hTcxDec->envWeighted = 0;
        move16();
    }


    return;
}
#endif
+0 −4
Original line number Diff line number Diff line
@@ -383,11 +383,7 @@ void mode_switch_decoder_LPD_ivas_fx(

    frame_size = FrameSizeConfig[frame_size_index].frame_net_bits;
    move16();
#ifdef HARMONIZE_2595_reconfig_decoder_LPD
    reconfig_decoder_LPD_fx( st, frame_size, bwidth, total_brate, st->last_L_frame );
#else
    reconfig_decoder_LPD_ivas_fx( st, frame_size, bwidth, total_brate, st->last_L_frame );
#endif

    test();
    IF( hTcxDec->envWeighted && !hTcxDec->enableTcxLpc )