Commit f3d2893f authored by multrus's avatar multrus
Browse files

keep EVS BE

parent 9daf8e10
Loading
Loading
Loading
Loading
Loading
+67 −9
Original line number Diff line number Diff line
@@ -2723,13 +2723,41 @@ void swb_tbe_dec_fx(
        exp = 0;
        move16();
    }
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
    /*
       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
    */
    IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
    {
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            temp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
            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( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
            move16();
        }
    }
    ELSE
    {
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
            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( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
            move16();
        }
    }
#else
    FOR( ; i < L_SHB_LAHEAD + 10; i++ )
    {
        temp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
#endif
        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 );
@@ -2737,6 +2765,7 @@ void swb_tbe_dec_fx(
        shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
        move16();
    }
#endif

    /* Update SHB excitation */
    Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */
@@ -6289,13 +6318,41 @@ void ivas_swb_tbe_dec_fx(
            exp = 0;
            move16();
        }
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
        /*
           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
        */
        IF( EQ_16( st->element_mode, EVS_MONO ) )
        {
            FOR( ; i < L_SHB_LAHEAD + 10; i++ )
            {
                temp_fx = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
                L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp_fx ); /* Q31-exp */
                temp_fx = sub( 32767 /*1.0f Q15*/, temp_fx );
                Lscale = L_add( Mult_32_16( Lscale, temp_fx ), L_tmp1 );
                L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] );             /* Q_bwe_exc + (31-exp) - 15 */
                shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
                move16();
            }
        }
        ELSE
        {
            FOR( ; i < L_SHB_LAHEAD + 10; i++ )
            {
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
                temp_fx = 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_fx ); /* Q31-exp */
                temp_fx = sub( 32767 /*1.0f Q15*/, temp_fx );
                Lscale = L_add( Mult_32_16( Lscale, temp_fx ), L_tmp1 );
                L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] );             /* Q_bwe_exc + (31-exp) - 15 */
                shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
                move16();
            }
        }
#else
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            temp_fx = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );        /* Q15 */
#endif
            L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp_fx ); /* Q31-exp */
            temp_fx = sub( 32767 /*1.0f Q15*/, temp_fx );
            Lscale = L_add( Mult_32_16( Lscale, temp_fx ), L_tmp1 );
@@ -6303,6 +6360,7 @@ void ivas_swb_tbe_dec_fx(
            shaped_shb_excitation_fx[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
            move16();
        }
#endif
    }
    ELSE
    {
+68 −10
Original line number Diff line number Diff line
@@ -2535,13 +2535,41 @@ void swb_tbe_enc_fx(
        exp = 0;
        move16();
    }
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
    /*
       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
    */
    IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
    {
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            tmp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );                 /* Q15 */
            L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */
            tmp = sub( 32767 /*1.0f Q15*/, tmp );
            Lscale = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 );
            L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] );                               /* Q_bwe_exc + (31-exp) - 15 */
            shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */
            move16();
        }
    }
    ELSE
    {
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
            tmp = 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_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */
            tmp = sub( 32767 /*1.0f Q15*/, tmp );
            Lscale = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 );
            L_tmp = Mult_32_16( Lscale, shaped_shb_excitation_fx[i] );                               /* Q_bwe_exc + (31-exp) - 15 */
            shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */
            move16();
        }
    }
#else
    FOR( ; i < L_SHB_LAHEAD + 10; i++ )
    {
        tmp = i_mult_o( sub( i, 19 ), 3277 /*0.1f Q15*/, &Overflow );        /* Q15 */
#endif
        L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */
        tmp = sub( 32767 /*1.0f Q15*/, tmp );
        Lscale = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 );
@@ -2549,6 +2577,7 @@ void swb_tbe_enc_fx(
        shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */
        move16();
    }
#endif

    /* Update SHB excitation */
    Copy( shaped_shb_excitation_fx + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */
@@ -3835,13 +3864,41 @@ void swb_tbe_enc_ivas_fx(
            exp = 0;
            move16();
        }
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
        /*
           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
        */
        IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
        {
            FOR( ; i < L_SHB_LAHEAD + 10; i++ )
            {
                tmp = i_mult_sat( sub( i, 19 ), 3277 /*0.1f Q15*/ );                 /* Q15 */
                L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */
                tmp = sub( 32767 /*1.0f Q15*/, tmp );
                L_tmp = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 );
                L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] );                                /* Q_bwe_exc + (31-exp) - 15 */
                shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */
                move16();
            }
        }
        ELSE
        {
            FOR( ; i < L_SHB_LAHEAD + 10; i++ )
            {
#ifdef FIX_ISSUE_1816_IMPROVE_MPY_ZERO_DOT_1_PRECISION
                tmp = 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_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */
                tmp = sub( 32767 /*1.0f Q15*/, tmp );
                L_tmp = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 );
                L_tmp = Mult_32_16( L_tmp, shaped_shb_excitation_fx[i] );                                /* Q_bwe_exc + (31-exp) - 15 */
                shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */
                move16();
            }
        }
#else
        FOR( ; i < L_SHB_LAHEAD + 10; i++ )
        {
            tmp = i_mult_o( sub( i, 19 ), 3277 /*0.1f Q15*/, &Overflow );        /* Q15 */
#endif
            L_tmp1 = Mult_32_16( L_shl_o( 1, sub( 31, exp ), &Overflow ), tmp ); /* Q31-exp */
            tmp = sub( 32767 /*1.0f Q15*/, tmp );
            L_tmp = L_add( Mult_32_16( Lscale, tmp ), L_tmp1 );
@@ -3849,6 +3906,7 @@ void swb_tbe_enc_ivas_fx(
            shaped_shb_excitation_fx[i] = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /* Q_bwe_exc */
            move16();
        }
#endif
    }
    ELSE
    {