Skip to content

Difference in swb_tbe_enc_fx float and fixed-point code in EVS

Difference in floating point code and fixed-point code of EVS (File: swb_tbe_enc_fx.c/swb_tbe_enc.c).

In the function swb_tbe_enc, below code is present in float version:

for ( ; i < L_SHB_LAHEAD + 10; i++ ) {
            temp = ( i - 19 ) / 10.0f;
            shaped_shb_excitation[i] *= ( temp * 1.0f + ( 1.0f - temp ) * scale );
        }

In fixed version of EVS, below code is present:

FOR( ; i < L_SHB_LAHEAD + 10; i++ )
    {
        tmp = i_mult_o( sub( i, 19 ), 3277 /*0.1f Q15*/, &Overflow );        /* 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();
    }

The value of scale remains same throughout the loop in float code, whereas in fixed-point code, Lscale gets updated every iteration. The deviation observed in IVAS for a test case is occurring because of variation of scale value.

Is this a bug in EVS code?