diff --git a/lib_com/ivas_transient_det_fx.c b/lib_com/ivas_transient_det_fx.c index fb8679ebc8e218ddcf1ce12ad0bcc59dcc899a35..02f8713a821a2a766840ec564567c474183eddba 100644 --- a/lib_com/ivas_transient_det_fx.c +++ b/lib_com/ivas_transient_det_fx.c @@ -43,8 +43,12 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define IVAS_TDET_PARM_ENV_EPS ( 1e-5f ) -#define IVAS_TDET_PARM_ENV_EPS_fx 21474 // Q31 +#define IVAS_TDET_PARM_ENV_EPS ( 1e-5f ) +#ifndef OPT_SBA_DEC_PATH +#define IVAS_TDET_PARM_ENV_EPS_fx 21474 // Q31 +#else /* OPT_SBA_DEC_PATH */ +#define IVAS_TDET_PARM_ENV_EPS_fx ( 1407374884 ) // Q47 +#endif /* OPT_SBA_DEC_PATH */ #define IVAS_TDET_DUCK_MULT_FAC ( 590558003 ) // Q29 #define IVAS_TDET_PARM_TRANS_THR ( 107374182 ) // Q30 @@ -403,8 +407,19 @@ void ivas_td_decorr_get_ducking_gains_fx( FOR( i = 0; i < frame_len; i++ ) { // e_fast_fx[i] = L_add( L_abs( e_fast_fx[i] ), L_shr( IVAS_TDET_PARM_ENV_EPS_fx, q_factor_diff ) ); /*Q14*/ +#ifndef OPT_SBA_DEC_PATH e_fast_fx[i] = BASOP_Util_Add_Mant32Exp( L_abs( e_fast_fx[i] ), e_fast_e[i], IVAS_TDET_PARM_ENV_EPS_fx, 0, &e_fast_e[i] ); move32(); +#else /* OPT_SBA_DEC_PATH */ + Word32 tmp = L_abs( e_fast_fx[i] ); + Word16 nrm = norm_l( tmp ); + Word16 max_e = s_max( sub( e_fast_e[i], nrm ), 31 - 47 ); + max_e = add( max_e, 1 ); // 1 for headroom + e_fast_fx[i] = L_add( L_shr( tmp, sub( max_e, e_fast_e[i] ) ), L_shr( IVAS_TDET_PARM_ENV_EPS_fx, sub( max_e, 31 - 47 ) ) ); + move32(); + e_fast_e[i] = max_e; + move16(); +#endif /* OPT_SBA_DEC_PATH */ e_slow_fx[i] = e_fast_fx[i]; move32(); e_slow_e[i] = e_fast_e[i]; diff --git a/lib_com/options.h b/lib_com/options.h index a5d5a4846c8ca6a0005aa7ef7bd9e2c4e3582dbd..f685c5541e6927fac9c1a050190a8d621a2cd732 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,4 +106,6 @@ #define FIX_1713_EXP /* VA: proposed correction to exp in ic-BWE*/ +#define OPT_SBA_DEC_PATH + #endif