diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 70ab9f4188f7824fbffdbbd6da6adfcfa8cd16ed..e9b9530f338fd855e4ebb3f66d018b5fceaa5361 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -2939,19 +2939,16 @@ void GenShapedSHBExcitation_ivas_fx( } Q_pow1 = shl( *Q_bwe_exc, 1 ); - test(); -#if 1 // ADD_IVAS_TBE_CODE - IF( EQ_16( flag_ACELP16k, 0 ) ) -#else - IF( ( LE_32( bitrate, ACELP_13k20 ) ) && ( GE_32( bitrate, ACELP_7k20 ) ) ) -#endif + IF( flag_ACELP16k == 0 ) { /* varEnvShape = mean_fx(voice_factors, 4); */ /* unroll the loop */ L_tmp = L_mult( voice_factors[0], 8192 ); L_tmp = L_mac( L_tmp, voice_factors[1], 8192 ); L_tmp = L_mac( L_tmp, voice_factors[2], 8192 ); - varEnvShape = mac_r( L_tmp, voice_factors[3], 8192 ); /* varEnvShape in Q15 */ + varEnvShape = mac_r_sat( L_tmp, voice_factors[3], 8192 ); /* varEnvShape in Q15 */ + /* varEnvShape is the mean value of voice_factors (Q15) + In any case, varEnvShape is not expected to exceed 32767, hence saturation is added */ } ELSE /* 16k core */ { @@ -2961,7 +2958,9 @@ void GenShapedSHBExcitation_ivas_fx( L_tmp = L_mac( L_tmp, voice_factors[1], 6554 ); L_tmp = L_mac( L_tmp, voice_factors[2], 6554 ); L_tmp = L_mac( L_tmp, voice_factors[3], 6554 ); - varEnvShape = mac_r( L_tmp, voice_factors[4], 6554 ); /* varEnvShape in Q15 */ + varEnvShape = mac_r_sat( L_tmp, voice_factors[4], 6554 ); /* varEnvShape in Q15 */ + /* varEnvShape is the mean value of voice_factors (Q15) + In any case, varEnvShape is not expected to exceed 32767, hence saturation is added */ } IF( EQ_16( extl, FB_TBE ) )