Commit c01b2c44 authored by vaillancour's avatar vaillancour
Browse files

Use target energy instead of lt_ener, adapt variable name accordingly

parent 3e51b45c
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ void Comp_and_apply_gain_fx(
    Word16 Mbands_gn,        /* i  : number of bands                       */
    const Word16 ReUseGain,  /* i  : Reuse the gain in Ener_per_bd_yQ      */
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    const Word16 max_lt_ener, /* i  : max_lt_ener of lt_ener_per_band_fx   */
    const Word16 max_target_ener, /* i  : max_target_ener of Ener_per_bd_iQ   */
#endif
    Word16 Qexc_diff,
    Word16 Q_exc )
@@ -107,7 +107,7 @@ void Comp_and_apply_gain_fx(
    move16();
    test();
    test();
    IF( GT_16( Q_exc, 3 ) && EQ_16( ReUseGain, 0 ) && GT_16( max_lt_ener, 8192 /* 13 bits */ ) ) /* When lt_energy is high, Q_exc shouldn't be high too, addresses cases when switching from CNG */
    IF( GT_16( Q_exc, 3 ) && EQ_16( ReUseGain, 0 ) && GT_16( max_target_ener, 12 ) ) /* When target energy is high, Q_exc shouldn't be high too, addresses cases when switching from CNG or from almos*/
    {
        Q_adapt = sub( 3 - 1, Q_exc ); /* add extra 1 bit headroom */
    }
+7 −6
Original line number Diff line number Diff line
@@ -1082,7 +1082,7 @@ void highband_exc_dct_in_ivas_fx(
    Word16 tmp2;
    Word16 *end, Q_hb_exc;
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    Word16 max_lt_ener, old_Q_exc;
    Word16 max_target_ener, old_Q_exc;
#endif

    FOR( j = 10; j < MBANDS_GN; j++ )
@@ -1408,23 +1408,24 @@ void highband_exc_dct_in_ivas_fx(
        }
    }
#elif defined FIX_2380_HARM_GSC_GAIN_COMP_FX
    max_lt_ener = 0;
    max_target_ener = 0;
    move16();
    IF( NE_16( element_mode, EVS_MONO ) && lt_ener_per_band_fx != NULL ) /* to keep EVS BE */
    {
        FOR( i = 0; i < MBANDS_GN; i++ )
        FOR( i = 0; i < MBANDS_GN/2; i++ )
        {
            max_lt_ener = s_max( max_lt_ener, lt_ener_per_band_fx[i] );
            max_target_ener = s_max( max_target_ener, Ener_per_bd_iQ[i] );
        }
        max_target_ener = sub( 15, norm_s( max_target_ener ) );
    }
    old_Q_exc = *Q_exc;
    move16();
    *Q_exc = Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, max_lt_ener, Qexc_diffQ, *Q_exc );
    *Q_exc = Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, max_target_ener, Qexc_diffQ, *Q_exc );
    Scale_sig( exc_dct_in, L_frame, sub( *Q_exc, old_Q_exc ) );

    IF( exc_wo_nf != NULL )
    {
        Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, max_lt_ener, Qexc_diffQ, *Q_exc );
        Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, max_target_ener, Qexc_diffQ, *Q_exc );
        Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
    }
#else /* #if defined FIX_2338_HARM_GSC_GAIN_COMP */
+1 −1
Original line number Diff line number Diff line
@@ -1714,7 +1714,7 @@ void Comp_and_apply_gain_fx(
    Word16 Mbands_gn,        /* i  : number of bands                       */
    const Word16 ReUseGain,  /* i  : Reuse the gain in Ener_per_bd_yQ      */
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    const Word16 max_lt_ener, /* i  : max_lt_ener of lt_ener_per_band_fx   */
    const Word16 max_target_ener, /* i  : Ener_per_bd_iQ of lt_ener_per_band_fx   */
#endif
    Word16 Qexc_diff,
    Word16 Q_exc );