diff --git a/lib_com/options.h b/lib_com/options.h index e7c3f2ce5b7c999e7d44b701108bc4ea95d48818..2788649c87cfb3b1487d9af78ca59a4c8678d2c6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,4 +170,5 @@ #define FIX_1320_LOWRATE_ACELP #define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ +#define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ #endif diff --git a/lib_enc/ivas_stereo_ica_enc.c b/lib_enc/ivas_stereo_ica_enc.c index 9d06a5523c8ce03a109f8aa85c19c67008243b3d..5b79f416a075dad4578e6832e72b814e6d46c630 100644 --- a/lib_enc/ivas_stereo_ica_enc.c +++ b/lib_enc/ivas_stereo_ica_enc.c @@ -1965,6 +1965,8 @@ void stereo_tca_enc_fx( Word16 temp_exp, tempF_16fx; Word16 scalar_value = BASOP_Util_Divide1616_Scale( currentNCShift, dsFactor, &temp_exp ); /* Q15-temp_exp */ + +#ifndef FIX_1300_ICA_SHIFT_QUANT_IMPROV IF( temp_exp < 0 ) { scalar_value = shl( scalar_value, sub( temp_exp, Q3 ) ); // Q12 @@ -1976,6 +1978,11 @@ void stereo_tca_enc_fx( hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, shl( 1, sub( 14, temp_exp ) ), ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ move16(); } +#else + scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ + hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ +#endif + tempF_fx = tempF_16fx; move32(); }