Commit 4cfa5c7d authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 1382: High MLD > 20, obvious audible differences between...

 Fix for 3GPP issue 1382: High MLD > 20, obvious audible differences between float and fixed, SBA 24.4 kbps, 32 khz - 1

 Link #1382
parent 339e804c
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -769,6 +769,8 @@ Word16 ivas_acelp_tcx20_switching_fx(
    Word32 tcx_snr;
    Flag Overflow;
    Word32 gain, noise;
    Word16 noise_e = 0;
    move16();
    Word32 *pt_ener_sfr, ener_sfr[NB_SUBFR16k];

    /* Initialization */
@@ -1214,12 +1216,15 @@ Word16 ivas_acelp_tcx20_switching_fx(
        gain = get_gain2( wsp + i, wsp + sub( i, T0 ), L_SUBFR );

        noise = L_deposit_l( 1 );

        noise_e = 0;
        move16();
        FOR( j = 0; j < L_SUBFR; j++ )
        {
            tmp16 = round_fx_o( L_shl_o( Mpy_32_16_r( gain, wsp[i + j - T0] ), 15, &Overflow ), &Overflow ); // q_in
            tmp16 = sub_o( wsp[i + j], tmp16, &Overflow );                                                   // q_in
            noise = L_mac0_o( noise, tmp16, tmp16, &Overflow );                                              // 2*q_in//
            tmp32 = Mpy_32_16_1( gain, wsp[i + j - T0] );   // Q16 + q_inp - 15
            tmp32 = L_sub( wsp[i + j], L_shr( tmp32, 1 ) ); // q_inp
            tmp16 = norm_l( tmp32 );
            tmp32 = L_shl( tmp32, tmp16 );                                                                                                     // q_inp +tmp16
            noise = BASOP_Util_Add_Mant32Exp( noise, noise_e, Mpy_32_32( tmp32, tmp32 ), shl( sub( 31, add( q_inp, tmp16 ) ), 1 ), &noise_e ); // noise_e
        }
        test();
        IF( noise == 0 || EQ_32( noise, 1 ) )
@@ -1238,7 +1243,7 @@ Word16 ivas_acelp_tcx20_switching_fx(
        ELSE
        {
            noise = Mpy_32_16_1( noise, scale );
            tmp32 = L_add( BASOP_Util_Log2( noise ), L_shl( sub( 31, add( q_inp, q_inp ) ), 25 ) ); // Q25
            tmp32 = L_add( BASOP_Util_Log2( noise ), L_shl( noise_e, 25 ) ); // Q25
        }
        tmp32 = L_sub( *pt_ener_sfr, tmp32 ); // Q25
        temp_energy = BASOP_Util_Add_Mant32Exp( tmp32, 6, temp_energy, ener_e, &ener_e );