diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 8b3719e98be7a8f51f368df08ec320079b658160..08c4d9f363af54bd02aab052ce6c70dfb3a4edaf 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -215,13 +215,13 @@ void Comp_and_apply_gain_ivas_fx( * y_gain = pow(10.0, (Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) * = pow(2, 3.321928*(Ener_per_bd_iQ[i_band]-Ener_per_bd_yQ[i_band])) *-----------------------------------------------------------------*/ - L16 = sub( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ - L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ - L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ - frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ - y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ - /* output of Pow2() will be: */ - /* 16384 < Pow2() <= 32767 */ + L16 = sub_sat( Ener_per_bd_iQ[i_band], Ener_per_bd_yQ[i_band] ); /*Q12 */ + L32 = L_mult( L16, 27213 ); /* 3.321928 in Q13 -> Q26 */ + L32 = L_shr( L32, 10 ); /* From Q26 to Q16 */ + frac = L_Extract_lc( L32, &exp1 ); /* Extract exponent of gcode0 */ + y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */ + /* output of Pow2() will be: */ + /* 16384 < Pow2() <= 32767 */ #ifdef BASOP_NOGLOB Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/ #else /* BASOP_NOGLOB */ diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index d0f72936d7f024fa1c31815bff0ea8315a1f0041..9f4ef981040e09c8a55dfe151589fc3e402da036 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -1338,9 +1338,9 @@ void highband_exc_dct_in_ivas_fx( { FOR( i = 0; i < last_bin; i++ ) { - Ener_per_bd_iQ[i] = s_min( Ener_per_bd_iQ[i], sub( add( lt_ener_per_band_fx[i], 1229 ), Ener_per_bd_yQ[i] ) ); + Ener_per_bd_iQ[i] = s_min( Ener_per_bd_iQ[i], sub_sat( add( lt_ener_per_band_fx[i], 1229 ), Ener_per_bd_yQ[i] ) ); move16(); - lt_ener_per_band_fx[i] = sub( lt_ener_per_band_fx[i], 77 ); + lt_ener_per_band_fx[i] = sub_sat( lt_ener_per_band_fx[i], 77 ); move16(); } FOR( ; i < MBANDS_GN; i++ )