Commit 6b052e95 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 1417: Audible artifact at SBA 13.2 kbps, 48KHz

Link #1417
parent d167f295
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -53,9 +53,10 @@ Word16 signal_clas_fx( /* o : classification for current
{
    Word32 Ltmp;
    Word16 mean_voi2, een, corn, zcn, relEn, pcn, fmerit1;
    Word16 i, clas, pc, zc, lo, lo2, hi, hi2, exp_ee, frac_ee;
    Word16 i, clas, pc, zc, exp_ee;
    Word16 tmp16, tmpS;
    const Word16 *pt1;
    Word64 tmp64;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
@@ -73,34 +74,34 @@ Word16 signal_clas_fx( /* o : classification for current
    mean_voi2 = mac_r( Ltmp, st->voicing_fx[2], 16384 );

    /* average spectral tilt in dB */
    lo = L_Extract_lc( ee[0], &hi );
    lo2 = L_Extract_lc( ee[1], &hi2 );
    Ltmp = L_mult( lo, lo2 ); /* Q5*Q5->Q11 */

    test();
    test();
    IF( LT_32( Ltmp, 2048 ) )
    tmp64 = W_mult0_32_32( ee[0], ee[1] );
    exp_ee = W_norm( tmp64 );
    Ltmp = W_extract_h( W_shl( tmp64, exp_ee ) ); // Q = Q6+Q6 + exp_ee - 32
    exp_ee = sub( 31, sub( add( Q12, exp_ee ), 32 ) );
    IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( Ltmp, exp_ee, ONE_IN_Q31, 0 ), -1 ) )
    {
        een = 0;
        move16();
    }
    ELSE IF( GT_32( Ltmp, THRES_EEN ) || hi > 0 || hi2 > 0 )
    ELSE
    {
        /* mean_ee2 = 0.5f * 20.0f * (float)log10( tmp ); */
        /* een = K_EE_ENC * mean_ee2 + C_EE_ENC; */
        Ltmp = BASOP_Util_Log10( Ltmp, exp_ee );                            // Q25
        Ltmp = Mpy_32_32( Ltmp, 671088640 /*20.f in Q25*/ );                // Q25 + Q25 -Q31 = Q19 * 0.5 = Q20
        een = extract_l( L_shl( Mpy_32_16_1( Ltmp, K_EE_FX ), Q9 - Q20 ) ); // Q9

        IF( GT_16( een, 512 ) )
        {
            een = 512;
            move16();
        }
    ELSE
        ELSE IF( een < 0 )
        {
        /* mean_ee2 = 0.5f * 20.0f * (float)log10( tmp ); */
        /* een = K_EE_ENC * mean_ee2 + C_EE_ENC; */
        exp_ee = norm_l( Ltmp );
        frac_ee = Log2_norm_lc( L_shl( Ltmp, exp_ee ) );
        exp_ee = sub( 30 - 11, exp_ee );
        Ltmp = Mpy_32_16( exp_ee, frac_ee, LG10 ); /* Ltmp Q14 */
        een = round_fx( L_shl( Ltmp, 16 - 5 ) );   /* Q14 -> Q9 */
        een = mac_r( C_EE_FX, een, K_EE_FX );
            een = 0;
            move16();
        }
    }

    /* compute zero crossing rate */
    pt1 = speech + sub( L_look, 1 );
    tmpS = shr( *pt1, 15 ); /* sets 'tmpS to -1 if *pt1 < 0 */