Commit acc9b3ed authored by Manuel Jander's avatar Manuel Jander
Browse files

Correct EVS regressions.

parent 1d4871cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ ivas_error evs_enc_fx(
        /* Common pre-processing for WB TBE and WB BWE */
#ifdef HARMONIZE_TBE2
#ifdef NONBE_FIX_ISSUE_2206
        wb_pre_proc_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech, 0 );
        wb_pre_proc_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech, -1 );
#else
        wb_pre_proc_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech );
#endif
+5 −1
Original line number Diff line number Diff line
@@ -280,9 +280,9 @@ void wb_bwe_enc_ivas_fx(

#ifdef NONBE_FIX_ISSUE_2206
        new_input_fx_exp = new_wb_speech_q;
        move16();
#else
        new_input_fx_exp = -Q1;
#endif
        move16();
#ifdef HARM_FD_BWE
        if ( st_fx->element_mode == EVS_MONO )
@@ -290,6 +290,7 @@ void wb_bwe_enc_ivas_fx(
            new_input_fx_exp = 0;
            move16();
        }
#endif
#endif

        wtda_fx( old_input_fx, &new_input_fx_exp, L_wtda_synth_fx, hBWE_FD->L_old_wtda_swb_fx,
@@ -2692,6 +2693,9 @@ static Word16 WB_BWE_encoding_ivas_fx(

    IF( st_fx->element_mode == EVS_MONO )
    {
#ifdef NONBE_FIX_ISSUE_2206
        Q_synth = add( Q_synth, 1 );
#endif
        Word16 new_input_fx_exp = Q_synth;

        /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */
+16 −35
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ void wb_pre_proc_ivas_fx(
    const Word16 last_element_mode, /* i  : last element mode                         */
#ifdef NONBE_FIX_ISSUE_2206
    const Word16 *new_inp_resamp16k, /* i  : original input signal in new_inp_resamp16k_q */
    Word16 *hb_speech,               /* o  : HB target signal (6-8kHz) at 16kHz in Q-1 */
    Word16 *hb_speech,               /* o  : HB target signal (6-8kHz) at 16kHz in new_inp_resamp16k_q */
    const Word16 new_inp_resamp16k_q /* i  : Q of new_inp_resamp16k                    */
#else
    const Word16 *new_inp_resamp16k, /* i  : original input signal in Q-1              */
@@ -308,13 +308,14 @@ void wb_pre_proc_ivas_fx(
    }

    Copy_Scale_sig( new_inp_resamp16k, temp_buf, L_FRAME16k, Q_wb_sp );
#ifdef NONBE_FIX_ISSUE_2206
    Q_wb_sp = add( Q_wb_sp, new_inp_resamp16k_q );
#endif
    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 );
    /* temp_buf, and the memory states are in Q_wb_sp */

#ifdef NONBE_FIX_ISSUE_2206
    Q_wb_sp = add( Q_wb_sp, new_inp_resamp16k_q );
#endif

    test();
    test();
    IF( EQ_16( st_fx->extl, WB_BWE ) || EQ_16( st_fx->extl, WB_TBE ) || st_fx->igf )
@@ -482,14 +483,21 @@ void wb_pre_proc_ivas_fx(
                flip_spectrum_and_decimby4_fx( temp_buf, hb_speech, L_FRAME16k, hBWE_TD->decim_state1_fx, hBWE_TD->decim_state2_fx, ramp_flag );
            }

            /* rescale the hb_speech and memories back to Q-1 to keep the downstream BWE coding unaffected */
#ifdef NONBE_FIX_ISSUE_2206
            /* rescale the hb_speech and memories back to Q-1 to keep the downstream BWE coding unaffected */
            Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), sub( new_inp_resamp16k_q, Q_wb_sp ) );
            Scale_sig( hBWE_TD->decim_state2_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), sub( new_inp_resamp16k_q, Q_wb_sp ) );
            IF( st_fx->element_mode == EVS_MONO ) {
                Scale_sig( hb_speech, L_FRAME16k / 4, sub( new_inp_resamp16k_q, Q_wb_sp ) );
                Q_wb_sp = 0;
                move16();
            }
#else
            /* rescale the hb_speech and memories back to Q-1 to keep the downstream BWE coding unaffected */
            Scale_sig( hb_speech, L_FRAME16k / 4, negate( Q_wb_sp ) );
#endif
            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 ) );
#endif

            IF( NE_16( st_fx->extl, WB_TBE ) )
            {
@@ -497,13 +505,8 @@ void wb_pre_proc_ivas_fx(
                Sample_Delay_WB_BWE = ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16;

                highband_new_speech = highband_old_speech + Sample_Delay_WB_BWE;
#ifdef NONBE_FIX_ISSUE_2206
                Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 );
                Copy_Scale_sig( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE, sub( -1, Q_wb_sp ) );
#else
                Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 );
                Copy( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE );
#endif
            }
        }
    }
@@ -543,7 +546,7 @@ void wb_pre_proc_ivas_fx(

#ifdef NONBE_FIX_ISSUE_2206
        Copy_Scale_sig( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k, sub( Q_wb_sp, new_inp_resamp16k_q ) );
        Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE, sub( -1, Q_wb_sp ) );
        Copy( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE );
        Copy_Scale_sig( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE, sub( -1, new_inp_resamp16k_q ) );
#else
        Copy( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k );
@@ -553,27 +556,6 @@ void wb_pre_proc_ivas_fx(
        test();
        IF( NE_16( st_fx->extl, SWB_BWE ) && NE_16( st_fx->extl, FB_BWE ) )
        {
#ifdef NONBE_FIX_ISSUE_2206
#ifdef HARMONIZE_TBE2
            IF( st_fx->element_mode == EVS_MONO )
            {
#if 0
                assert( st_fx->Q_old_wtda == -Q1 );
                Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k );
#else
                st_fx->Q_old_wtda = -Q1;
                move16();
                Copy_Scale_sig( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k, sub( st_fx->Q_old_wtda, Q_wb_sp ) );
#endif
            }
#endif
            ELSE
            {
                Copy_Scale_sig( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k, sub( st_fx->Q_old_wtda, Q_wb_sp ) );
                // st_fx->Q_old_wtda = Q_wb_sp;
                // move16();
            }
#else
            Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k );
#ifdef HARMONIZE_TBE2
            if ( st_fx->element_mode != EVS_MONO )
@@ -582,7 +564,6 @@ void wb_pre_proc_ivas_fx(
                st_fx->Q_old_wtda = -Q1;
                move16();
            }
#endif
        }
    }