diff --git a/lib_com/options.h b/lib_com/options.h index 396d21f6c5d590a5d54dd45eecd6344858e022b5..bd7f2f34cf7608109dd97ab96c5b1954b524d2a7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,4 +144,6 @@ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ +#define FIX_1803_PRED_CAUSING_BWE_OVERSHOOT /* VA: Reduces complexity and improve precision of pred_ivas, solve 1803 */ + #endif diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 465138bde1fd083c8ed2a0beade5da3fa290ea2f..77876ff623ba072b157bb0413fd9d3eb11c6a8a5 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -32,7 +32,9 @@ void pred_lt4_ivas_fx( ) { Word16 i, j; +#ifndef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT Word32 s; +#endif const Word16 *x0, *x1, *x2; const Word32 *c1, *c2; #ifdef BASOP_NOGLOB_DECLARE_LOCAL @@ -51,27 +53,43 @@ void pred_lt4_ivas_fx( FOR( j = 0; j < L_subfr; j++ ) { +#ifdef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT + Word64 s64 = 0; + move64(); +#endif x1 = x0++; /* Q_exc */ x2 = x1 + 1; /* Q_exc */ c1 = ( &win[frac] ); /* Q14 */ c2 = ( &win[up_sample - frac] ); /* Q14 */ - +#ifndef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT { Word64 s64 = 0; move64(); +#endif FOR( i = 0; i < nb_coef; i++ ) { +#ifdef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT /*s += (*x1--) * (*c1) + (*x2++) * (*c2);*/ - s64 = W_mac_32_32( s64, L_deposit_l( *x1-- ), ( *c1 ) ); /* Q_exc + Q32 */ - s64 = W_mac_32_32( s64, L_deposit_l( *x2++ ), ( *c2 ) ); /* Q_exc + Q32 */ - + s64 = W_mac_32_16( s64, *c1, *x1 ); /* Q_exc + Q32 */ + s64 = W_mac_32_16( s64, *c2, *x2 ); /* Q_exc + Q32 */ + x1--; + x2++; +#else + /*s += (*x1--) * (*c1) + (*x2++) * (*c2);*/ + s64 = W_mac_32_32( s64, L_deposit_l( *x1-- ), ( *c1 ) ); /* Q_exc + Q32 */ + s64 = W_mac_32_32( s64, L_deposit_l( *x2++ ), ( *c2 ) ); /* Q_exc + Q32 */ +#endif c1 += up_sample; c2 += up_sample; } +#ifndef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */ } - excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */ +#else + excO[j] = extract_h( W_round48_L_o( s64, &Overflow ) ); /*W_round48_L_o is saturating if needed, the Overflow is sent out is case specific implementation has a different W_round48_L_o*/ +#endif + move16(); } return;