From 9b4a1492d0f198f4efff7d51e2f313a6f3cc6ded Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 16 Jul 2025 11:56:12 -0400 Subject: [PATCH 1/4] possible fix for 1803 --- lib_com/options.h | 2 ++ lib_com/pred_lt4_fx.c | 24 ++++++++++++++++++++---- lib_com/rom_com.c | 20 ++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 396d21f6c..bd7f2f34c 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 465138bde..cd91b109d 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -51,27 +51,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_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; diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index b10f5cc52..46406efe1 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -1311,6 +1311,7 @@ const Word16 inter4_2_fx[] = /* 1/4 resolution interpolation filter (-3 dB at 0.856*fs/2) */ const Word32 L_pitch_inter4_2[PIT_FIR_SIZE2] = { /* Q31 */ +#ifndef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT 2018634624, 1839083520, 1357785216, 724904576, 126856152, -281447072, -428193216, -340524320, -121030032, 102233104, 229241728, 222704784, 111802296, -32603096, -136805440, -158183648, -99851544, -2110976, @@ -1321,6 +1322,25 @@ const Word32 L_pitch_inter4_2[PIT_FIR_SIZE2] = { /* Q31 */ -6833293, 5003637, 12101070, 11944304, 6107443, -1346472, -6427418, -7219840, -4389456, -249108, 2823941, 3633542, 2471753, 556198, -895500, -1327144, -932007, -285615, 135291, 210453, 103079, 15032, 0 +#else + 2018634629, + 1839083521, 1357785191, 724904580, 126856154, + -281447059, -428193207, -340524335, -121030031, + 102233107, 229241732, 222704792, 111802294, + -32603097, -136805446, -158183646, -99851547, + -2110976, 82091857, 114123724, 86026047, + 19988778, -46544561, -81104015, -71266392, + -27977417, 22982370, 55621974, 56517475, + 29680371, -7827578, -36105643, -42638288, + -27414776, -1138166, 21646635, 30326764, + 22885733, 5570573, -11516955, -20066087, + -17396765, -6833293, 5003637, 12101070, + 11944304, 6107443, -1346472, -6427419, + -7219840, -4389457, -249108, 2823941, + 3633542, 2471754, 556198, -895501, + -1327145, -932008, -285615, 135291, + 210453, 103079, 15032, 0 +#endif }; const Word16 pitch_inter4_2[PIT_FIR_SIZE2] = { -- GitLab From aaab451345dc5db7d94636a5ef24000efb9d15c9 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 16 Jul 2025 12:05:51 -0400 Subject: [PATCH 2/4] fix clang --- lib_com/pred_lt4_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index cd91b109d..9fb193c52 100644 --- a/lib_com/pred_lt4_fx.c +++ b/lib_com/pred_lt4_fx.c @@ -60,7 +60,7 @@ void pred_lt4_ivas_fx( c1 = ( &win[frac] ); /* Q14 */ c2 = ( &win[up_sample - frac] ); /* Q14 */ #ifndef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT - { + { Word64 s64 = 0; move64(); #endif @@ -73,9 +73,9 @@ void pred_lt4_ivas_fx( 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 */ + /*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; -- GitLab From 88885a58d485ab78e4590383b5d3aea9f87c370f Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 16 Jul 2025 12:11:35 -0400 Subject: [PATCH 3/4] fix linux compiler --- lib_com/pred_lt4_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c index 9fb193c52..77876ff62 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 -- GitLab From 270959e78fc6d0f11bf9802058ebca15c3ebc179 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 16 Jul 2025 13:09:29 -0400 Subject: [PATCH 4/4] go back to old coef to limit changes --- lib_com/rom_com.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 46406efe1..b10f5cc52 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -1311,7 +1311,6 @@ const Word16 inter4_2_fx[] = /* 1/4 resolution interpolation filter (-3 dB at 0.856*fs/2) */ const Word32 L_pitch_inter4_2[PIT_FIR_SIZE2] = { /* Q31 */ -#ifndef FIX_1803_PRED_CAUSING_BWE_OVERSHOOT 2018634624, 1839083520, 1357785216, 724904576, 126856152, -281447072, -428193216, -340524320, -121030032, 102233104, 229241728, 222704784, 111802296, -32603096, -136805440, -158183648, -99851544, -2110976, @@ -1322,25 +1321,6 @@ const Word32 L_pitch_inter4_2[PIT_FIR_SIZE2] = { /* Q31 */ -6833293, 5003637, 12101070, 11944304, 6107443, -1346472, -6427418, -7219840, -4389456, -249108, 2823941, 3633542, 2471753, 556198, -895500, -1327144, -932007, -285615, 135291, 210453, 103079, 15032, 0 -#else - 2018634629, - 1839083521, 1357785191, 724904580, 126856154, - -281447059, -428193207, -340524335, -121030031, - 102233107, 229241732, 222704792, 111802294, - -32603097, -136805446, -158183646, -99851547, - -2110976, 82091857, 114123724, 86026047, - 19988778, -46544561, -81104015, -71266392, - -27977417, 22982370, 55621974, 56517475, - 29680371, -7827578, -36105643, -42638288, - -27414776, -1138166, 21646635, 30326764, - 22885733, 5570573, -11516955, -20066087, - -17396765, -6833293, 5003637, 12101070, - 11944304, 6107443, -1346472, -6427419, - -7219840, -4389457, -249108, 2823941, - 3633542, 2471754, 556198, -895501, - -1327145, -932008, -285615, 135291, - 210453, 103079, 15032, 0 -#endif }; const Word16 pitch_inter4_2[PIT_FIR_SIZE2] = { -- GitLab