Commit 89e55c68 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Manuel Jander
Browse files

Fix for 3GPP issue 1307: Missing signal in BASOP enc-dec path compared to...

Fix for 3GPP issue 1307: Missing signal in BASOP enc-dec path compared to float enc-dec path using selection test MASA at 24.4 kbps with DTX enabled

Link #1307
parent 723e7ccd
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -326,6 +326,10 @@ void noise_est_init_ivas_fx(
    hNoiseEst->Etot_sq_st_est_fx = 1600; /* 400 in Q2 */
    move16();
    move16();
    hNoiseEst->L_Etot_st_est_fx = 167772160;   /* 20.0f in Q23 */
    hNoiseEst->L_Etot_sq_st_est_fx = 26214400; /* 400 in Q16 */
    move32();
    move32();
    hNoiseEst->epsP_0_2_lp_fx = 4096; /*1.0 Q12*/
    move16();
    hNoiseEst->epsP_0_2_ad_lp_fx = 0;
@@ -2196,8 +2200,8 @@ void noise_est_ivas_fx(
    /* for DTX operation */

    Word16 lim_Etot_fx;    /* Q8 */
    Word16 lim_Etot_sq_fx;  /* Q2 */
    Word16 st_E_var_est_fx; /* Q2 */
    Word32 lim_Etot_sq_fx; /* Q16 */
    Word32 st_E_var_est_fx;
    NOISE_EST_HANDLE hNoiseEst;
    SP_MUS_CLAS_HANDLE hSpMusClas;
    Word32 Le_min_scaled;
@@ -2721,31 +2725,30 @@ void noise_est_ivas_fx(
    }

    lim_Etot_fx = s_max( 5120, Etot );                    /* 20.0f Q8 */
    lim_Etot_sq_fx = extract_h( L_shl_r( L_mult( lim_Etot_fx, lim_Etot_fx ), 1 ) ); /* Q2 */
    lim_Etot_sq_fx = L_mult0( lim_Etot_fx, lim_Etot_fx ); /* Q16 */

    IF( LT_16( ini_frame, 150 ) )
    {
        /* Allow use of quicker filter during init - if needed */
        /* st->Etot_st_est = 0.25f * lim_Etot + (1.0f-0.25F) * st->Etot_st_est; */
        hNoiseEst->Etot_st_est_fx = mac_r( L_mult( 8192, lim_Etot_fx ), 24576, hNoiseEst->Etot_st_est_fx ); // Q8
        move16();
        hNoiseEst->L_Etot_st_est_fx = Madd_32_16_r( L_mult0( 8192, lim_Etot_fx ), hNoiseEst->L_Etot_st_est_fx, 24576 ); // Q23
        move32();
        /* st->Etot_sq_st_est = 0.25f * lim_Etot * lim_Etot + (1.0f-0.25f) * st->Etot_sq_st_est; */
        hNoiseEst->Etot_sq_st_est_fx = mac_r( L_mult( 8192, lim_Etot_sq_fx ), 24576, hNoiseEst->Etot_sq_st_est_fx ); // Q2
        move16();
        hNoiseEst->L_Etot_sq_st_est_fx = Madd_32_16_r( Mult_32_16( lim_Etot_sq_fx, 8192 ), hNoiseEst->L_Etot_sq_st_est_fx, 24576 ); // Q16
        move32();
    }
    ELSE
    {
        /* st->Etot_st_est = 0.25f * lim_Etot + (1.0f-0.25F) * st->Etot_st_est; */
        hNoiseEst->Etot_st_est_fx = mac_r( L_mult( 8192, lim_Etot_fx ), 24576, hNoiseEst->Etot_st_est_fx ); // Q8
        move16();
        hNoiseEst->L_Etot_st_est_fx = Madd_32_16_r( L_mult0( 8192, lim_Etot_fx ), hNoiseEst->L_Etot_st_est_fx, 24576 ); // Q23
        move32();
        /* st->Etot_sq_st_est = 0.25f * lim_Etot * lim_Etot + (1.0f-0.25f) * st->Etot_sq_st_est; */
        hNoiseEst->Etot_sq_st_est_fx = mac_r( L_mult( 8192, lim_Etot_sq_fx ), 24576, hNoiseEst->Etot_sq_st_est_fx ); // Q2
        move16();
        hNoiseEst->L_Etot_sq_st_est_fx = Madd_32_16_r( Mult_32_16( lim_Etot_sq_fx, 8192 ), hNoiseEst->L_Etot_sq_st_est_fx, 24576 ); // Q16
        move32();
    }

    st_E_var_est_fx = sub( hNoiseEst->Etot_sq_st_est_fx, extract_h( L_shl_r( L_mult( hNoiseEst->Etot_st_est_fx, hNoiseEst->Etot_st_est_fx ), 1 ) ) ); // Q2


    Word16 exp_tmp;
    st_E_var_est_fx = BASOP_Util_Add_Mant32Exp( hNoiseEst->L_Etot_sq_st_est_fx, Q15, L_negate( Mpy_32_32( hNoiseEst->L_Etot_st_est_fx, hNoiseEst->L_Etot_st_est_fx ) ), Q16, &exp_tmp ); // exp(exp_tmp)
    /*-----------------------------------------------------------------*
     * Count frames since last correlation or harmonic event
     *-----------------------------------------------------------------*/
@@ -2775,7 +2778,7 @@ void noise_est_ivas_fx(
    }
    test();
    test();
    IF( GT_16( *st_harm_cor_cnt, 1 ) && GT_16( Etot, 7680 /* 30.0f in Q8 */ ) && GT_16( st_E_var_est_fx, 32 /* 8.0f in Q2 */ ) )
    IF( GT_16( *st_harm_cor_cnt, 1 ) && GT_16( Etot, 7680 /* 30.0f in Q8 */ ) && EQ_16( BASOP_Util_Cmp_Mant32Exp( st_E_var_est_fx, exp_tmp, 524288 /* 8.0f in Q16 */, Q15 ), 1 ) )
    {
        /* st->harm_cor_cnt = max(1, (short) round_f( (float) st->harm_cor_cnt / 4.0f )) ; */
        *st_harm_cor_cnt = s_max( 1, shr( add( *st_harm_cor_cnt, 2 ), 2 ) );
+3 −0
Original line number Diff line number Diff line
@@ -566,6 +566,9 @@ typedef struct noise_estimation_structure
    Word16 Etot_st_est_fx;    /* Q8 Noise estimation - short term estimate of E{ Etot } */
    Word16 Etot_sq_st_est_fx; /* Q2 Noise estimation - short term estimate of E{ Etot^2 } */

    Word32 L_Etot_st_est_fx;    /* Q23 Noise estimation - short term estimate of E{ Etot } */
    Word32 L_Etot_sq_st_est_fx; /* Q16 Noise estimation - short term estimate of E{ Etot^2 } */

    Word16 aEn_inac_cnt;
} NOISE_EST_DATA, *NOISE_EST_HANDLE;