Commit 59fa101c authored by vaclav's avatar vaclav
Browse files

harmonize wb_pre_proc_ivas_fx()

parent 67d3d01f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -418,7 +418,7 @@ ivas_error evs_enc_fx(
    IF( GE_32( st->input_Fs, 16000 ) && ( LT_16( st->bwidth, SWB ) ) )
    {
        /* Common pre-processing for WB TBE and WB BWE */
#ifdef HARMONIZE_TBE2aa
#ifdef HARMONIZE_TBE2
        wb_pre_proc_ivas_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech );
#else
        wb_pre_proc_fx( st, new_inp_resamp16k, hb_speech );
+23 −16
Original line number Diff line number Diff line
@@ -6,13 +6,10 @@
#include "options.h"
#include "cnst.h"
#include "rom_com.h"
#include "stl.h"
#include "prot_fx.h"      /* Function prototypes                    */
#include "ivas_prot_fx.h" /* Function prototypes                    */
#include "prot_fx_enc.h"  /* Function prototypes                    */
#include "basop_util.h"
#include "ivas_rom_enc.h"
#include <assert.h>


/*========================================================================*/
@@ -31,7 +28,6 @@
/* OUTPUT ARGUMENTS :                                                     */
/* _ (Word16*) new_wb_speech : original input signal at 16kHz    Q-1      */
/*------------------------------------------------------------------------*/

/* st_fx->old_wtda_wb_fx                                                  */
/*------------------------------------------------------------------------*/
/* RETURN ARGUMENTS :                                                     */
@@ -441,9 +437,9 @@ void wb_pre_proc_ivas_fx(
            }

            /* rescale the hb_speech and memories back to Q-1 to keep the downstream BWE coding unaffected */
            Scale_sig( hb_speech, L_FRAME16k / 4, -Q_wb_sp );
            Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), -Q_wb_sp );
            Scale_sig( hBWE_TD->decim_state2_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), -Q_wb_sp );
            Scale_sig( hb_speech, L_FRAME16k / 4, negate( Q_wb_sp ) );
            Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), negate( Q_wb_sp ) );
            Scale_sig( hBWE_TD->decim_state2_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), negate( Q_wb_sp ) );

            IF( NE_16( st_fx->extl, WB_TBE ) )
            {
@@ -463,7 +459,12 @@ void wb_pre_proc_ivas_fx(
        set16_fx( hBWE_TD->old_speech_wb_fx, 0, ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 );
    }

#ifdef HARMONIZE_TBE2
    test();
    if ( hBWE_FD != NULL && st_fx->element_mode != EVS_MONO )
#else
    if ( hBWE_FD != NULL )
#endif
    {
        hBWE_FD->mem_old_wtda_swb_fx = new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1];
        move16();
@@ -472,10 +473,10 @@ void wb_pre_proc_ivas_fx(
    /* st->old_input_wb and st->old_wtda_wb must be updated each frame, or there are often some clicks during WB TBE <-> WB BWE switching */
    test();
    test();
    test();
#ifdef HARMONIZE_TBE2
    IF( ( NE_16( st_fx->extl, WB_BWE ) || ( EQ_16( st_fx->extl, WB_BWE ) ) ) && !ppp_mode )
    IF( ( NE_16( st_fx->extl, WB_BWE ) || ( EQ_16( st_fx->extl, WB_BWE ) && EQ_32( st_fx->extl_brate, 0 ) ) ) && !ppp_mode )
#else
    test();
    IF( ( NE_16( st_fx->extl, WB_BWE ) || ( EQ_16( st_fx->extl, WB_BWE ) && EQ_32( st_fx->total_brate, 0 ) ) ) && !ppp_mode )
#endif
    {
@@ -488,10 +489,15 @@ void wb_pre_proc_ivas_fx(
        IF( NE_16( st_fx->extl, SWB_BWE ) && NE_16( st_fx->extl, FB_BWE ) )
        {
            Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k );
            st_fx->Q_old_wtda = -1;
#ifdef HARMONIZE_TBE2
            if ( st_fx->element_mode != EVS_MONO )
#endif
            {
                st_fx->Q_old_wtda = -Q1;
                move16();
            }
        }
    }

    return;
}
@@ -942,7 +948,7 @@ void swb_pre_proc_ivas_fx(

        dft_ovl32k = 0;
        move16();
        IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) )
        if ( EQ_16( st->element_mode, IVAS_CPE_DFT ) )
        {
            dft_ovl32k = (Word16) ( STEREO_DFT_OVL_MAX * 32000 / 48000 );
            move16();
@@ -952,7 +958,6 @@ void swb_pre_proc_ivas_fx(
        {
            IF( st->element_mode > EVS_MONO )
            {

                IF( EQ_16( st->element_mode, IVAS_CPE_TD ) )
                {
                }
@@ -1432,6 +1437,7 @@ void swb_pre_proc_ivas_fx(
            t_16 = Log2_norm_lc( t ); /* Log2_norm_lc(t) = 2^15*(log2(t/2^30)) */
            t_16 = sub( shr( t_16, 6 ), shl( add( sub( Q31 - Q30, exp_t ), exp ), 9 ) );
            t = L_mult( t_16, 9864 ); /* Q9 + Q15 + Q1 = Q25 */

            /* Three Level Decision Tree to calculate a regression value first */
            IF( LT_32( t, thr[0] ) ) /* level 1 */
            {
@@ -1583,9 +1589,10 @@ void swb_pre_proc_ivas_fx(
            /* Reset CLDFB synthesis buffer */
            set16_fx( st->cldfbSynTd->FilterStates, 0, st->cldfbSynTd->p_filter_length + st->cldfbSynTd->no_channels * st->cldfbSynTd->no_col );
        }
        ELSE
#endif
        ELSE IF( NE_16( st->element_mode, IVAS_CPE_DFT ) )
#else
        IF( NE_16( st->element_mode, IVAS_CPE_DFT ) )
#endif
        {
            /* Reset CLDFB synthesis buffer */
            set32_fx( st->cldfbSynTd->cldfb_state_fx, 0, st->cldfbSynTd->p_filter_length );