Commit 79d3be2d authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'bug_fixes_high_mld_fixes_2' into 'main'

Bug in find_enr_dft_ivas_fx(), High MLD fix for SBA format

See merge request !932
parents 293f1da4 03a13ee9
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -247,8 +247,8 @@ static void find_enr_dft_ivas_fx(
    move16();

    /* One window - 40ms*12.8kHz = 512 samples */
    c_1_fx = 1073741799; // 0.99999998 in Q30, cosf( PI2 / STEREO_DFT_N_12k8_ENC )
    s_1_fx = 229974;     // 0.00021418 in Q30, sinf( PI2 / STEREO_DFT_N_12k8_ENC )
    c_1_fx = 1073660991; // 0.999924719 in Q30, cosf( PI2 / STEREO_DFT_N_12k8_ENC )
    s_1_fx = 13176464;   // 0.0122715384 in Q30, sinf( PI2 / STEREO_DFT_N_12k8_ENC )
    g_1_fx = 1570240043; // 1.4624 in Q30, ( 1.f + 0.68f * 0.68f )
    g_2_fx = 1460288880; // 1.36 in Q30, 2 * 0.68f
    move32();
@@ -290,7 +290,7 @@ static void find_enr_dft_ivas_fx(
    freq = bin_freq;
    move32();

    *q_band = add( shl( Q_inp_dmx, 1 ), sub( q_norm_val, 47 ) );
    *q_band = add( shl( Q_inp_dmx, 1 ), sub( q_norm_val, 48 ) );
    move16();
    *q_Bin_E = *q_band;
    move16();
@@ -303,7 +303,6 @@ static void find_enr_dft_ivas_fx(
    }

    min_ener = L_shl( E_MIN_FXQ31 /* 0.0035 in Q31 */, sub( *q_band, 31 ) );

    FOR( i = 0; i < NB_BANDS - 1; i++ ) /* up to maximum allowed voiced critical band */
    {
        band_ener = 0;
@@ -318,13 +317,14 @@ static void find_enr_dft_ivas_fx(

        WHILE( LE_32( freq, crit_bands_fx[i] ) )
        {
            g_fx = L_sub( g_1_fx, L_shl( Mpy_32_32( g_2_fx, c_fx ), 1 ) );            // 30
            // g_fx = L_sub( g_1_fx, L_shl( Mpy_32_32( g_2_fx, c_fx ), 1 ) );            // 30
            g_fx = L_sub( L_shr( g_1_fx, 1 ), Mpy_32_32( g_2_fx, c_fx ) );            // 29
            tmp_fx = Msub_32_32( Mpy_32_32( c_fx, c_1_fx ), s_fx, s_1_fx );           // 29
            s_fx = L_shl( Madd_32_32( Mpy_32_32( s_fx, c_1_fx ), c_fx, s_1_fx ), 1 ); // 30
            c_fx = L_shl( tmp_fx, 1 );                                                // 30

            BinE = Madd_32_32( Mpy_32_32( *ptR_fx, *ptR_fx ), *ptI_fx, *ptI_fx );   // 2*Q_inp_dmx-31
            BinE_fx[bin_cnt] = Mpy_32_32( BinE, Mpy_32_16_1( g_fx, norm_val_fx ) ); // (2*Q_inp_dmx-31)+(q_norm_val+30-15)-31 = 2*Q_inp_dmx+q_norm_val-47 = *q_Bin_E
            BinE_fx[bin_cnt] = Mpy_32_32( BinE, Mpy_32_16_1( g_fx, norm_val_fx ) ); // (2*Q_inp_dmx-31)+(q_norm_val+29-15)-31 = 2*Q_inp_dmx+q_norm_val-48 = *q_Bin_E
            move32();

            /*
@@ -378,10 +378,11 @@ static void find_enr_dft_ivas_fx(
        WHILE( LT_32( freq, 6399 ) )
        {

            g_fx = L_sub( g_1_fx, L_shl( Mpy_32_32( g_2_fx, c_fx ), 1 ) ); // 30
            // g_fx = L_sub( g_1_fx, L_shl( Mpy_32_32( g_2_fx, c_fx ), 1 ) ); // 30
            g_fx = L_sub( L_shr( g_1_fx, 1 ), Mpy_32_32( g_2_fx, c_fx ) ); // 29

            BinE = Madd_32_32( Mpy_32_32( *ptR_fx, *ptR_fx ), *ptI_fx, *ptI_fx );   // 2*Q_inp_dmx-31
            BinE_fx[bin_cnt] = Mpy_32_32( BinE, Mpy_32_16_1( g_fx, norm_val_fx ) ); // (2*Q_inp_dmx-31)+(q_norm_val+30-15)-31 = 2*Q_inp_dmx+q_norm_val-47 = *q_Bin_E
            BinE_fx[bin_cnt] = Mpy_32_32( BinE, Mpy_32_16_1( g_fx, norm_val_fx ) ); // (2*Q_inp_dmx-31)+(q_norm_val+29-15)-31 = 2*Q_inp_dmx+q_norm_val-48 = *q_Bin_E
            move32();

            /*
+9 −2
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ static Word16 find_best_pulse_fx(
    Word16 m, i;
    Word32 temp, max_val;

    max_val = MIN_32;
    max_val = EPSILLON_FX;
    move32();
    m = track;
    move16();
@@ -607,11 +607,18 @@ void acelp_fast_fx(
            dndn_fx = W_extract_h( W_shl( s64, exp1 ) ); // 2 * Q_dyn + exp1 - 31
            dndn_e = sub( 31, sub( add( shl( Q_dn, 1 ), exp ), 31 ) );

            IF( dndn_fx == 0 )
            {
                dndn_fx = 214748365 /* 0.1f in Q31 */;
                move32();
                dndn_e = 0;
                move16();
            }
            s_coef_fx = BASOP_Util_Divide3232_Scale( dndn_fx, cncn_track[track], &exp1 );
            exp1 = add( exp1, sub( dndn_e, cncn_track_e[track] ) );
            s_coef_fx = Sqrt16( s_coef_fx, &exp1 );
            exp1 = sub( exp1, shift );
            max_val_fx = MIN_16;
            max_val_fx = EPSILLON_FX;
            move16();
            m[1] = track; // Q0
            move16();