diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 0bd0bb8b79f287afeb4a78a83a9d58fcde5c1352..870b656fa7873fdd35116806a659e63631f2327f 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -1972,8 +1972,11 @@ void ivas_swb_tbe_dec_fx( #endif } } - ener_fx = s_max( 1, round_fx( L_shl( L_ener, sub( 18, shl( Q_bwe_exc, 1 ) ) ) ) ); /* Q2: 2*Q_bwe_exc+18-2*Q_bwe_exc-16 */ - +#ifdef BASOP_NOGLOB /* Saturation fix taken from EVS*/ + ener_fx = s_max( 1, round_fx_sat( L_shl_sat( L_ener, sub( 18, shl( Q_bwe_exc, 1 ) ) ) ) ); /* Q2: 2*Q_bwe_exc+18-2*Q_bwe_exc-16 */ +#else + ener_fx = s_max( 1, round_fx( L_shl( L_ener, sub( 18, shl( Q_bwe_exc, 1 ) ) ) ) ); /* Q2: 2*Q_bwe_exc+18-2*Q_bwe_exc-16 */ +#endif /* WB/SWB bandwidth switching */ IF( st->bws_cnt > 0 ) { @@ -2653,7 +2656,11 @@ void ivas_swb_tbe_dec_fx( tmp = div_s( 16384, tmp ); L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &exp ); +#ifdef BASOP_NOGLOB /* Saturation fix taken from EVS*/ + st->prev_ener_shb_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /* Q1 */ +#else st->prev_ener_shb_fx = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /* Q1 */ +#endif move16(); } @@ -2671,7 +2678,11 @@ void ivas_swb_tbe_dec_fx( tmp = div_s( 16384, tmp ); L_tmp = L_deposit_h( tmp ); L_tmp = Isqrt_lc( L_tmp, &exp ); - tmp = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /* Q1 */ +#ifdef BASOP_NOGLOB /* Saturation fix taken from EVS*/ + tmp = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /* Q1 */ +#else + tmp = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /* Q1 */ +#endif } set16_fx( st->prev_SWB_fenv_fx, tmp, SWB_FENV ); /* Q1 */ }