Commit dabc3381 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

try to restore BE with EVS - just temp. fix

parent 712b648b
Loading
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -2728,19 +2728,19 @@ void swb_tbe_dec_fx(
        move16();
    }

#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE
    /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */
    FOR( ; i < L_SHB_LAHEAD + 10; i++ )
    {
        temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) );
        L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */
        temp = sub( 32767 /*1.0f Q15*/, temp );
        Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 );
        L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] );             /* Q_bwe_exc + (31-exp) - 15 */
        shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
        move16();
    }
#else
//#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE
//    /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */
//    FOR( ; i < L_SHB_LAHEAD + 10; i++ )
//    {
//        temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) );
//        L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */
//        temp = sub( 32767 /*1.0f Q15*/, temp );
//        Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 );
//        L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] );             /* Q_bwe_exc + (31-exp) - 15 */
//        shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
//        move16();
//    }
//#else
    /*
       code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues
       thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations
@@ -2771,7 +2771,7 @@ void swb_tbe_dec_fx(
            move16();
        }
    }
#endif
//#endif

    /* Update SHB excitation */
    Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */