From ba0c14705c36f21c82e8769300c708c1bccc9f4b Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 15 May 2026 12:23:51 +0200 Subject: [PATCH 1/3] changed L_shl by L_shl_sat to solve issue 2592 --- lib_dec/TonalComponentDetection_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index b5718956c..181fbb627 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -473,7 +473,7 @@ static void GetF0( { Word16 tmp_32 = 0; Word32 F0_32 = BASOP_Util_Divide3232_Scale_newton( L_shl( nSamplesCore, Q16 ), tmpPitchLag, &tmp_32 ); - F0_32 = L_shl( F0_32, tmp_32 - Q16 ); + F0_32 = L_shl_sat( F0_32, tmp_32 - Q16 ); /* saturation needed to allow 0x40000000 << 1 */ *pF0_32 = F0_32; move32(); *pOrigF0_32 = *pF0_32; /*Q26*/ -- GitLab From 0319a4be3d07daf61c8e4d130802cc87663981aa Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 15 May 2026 12:29:00 +0200 Subject: [PATCH 2/3] fix clang format --- lib_dec/TonalComponentDetection_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 181fbb627..feca5afc4 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -473,7 +473,7 @@ static void GetF0( { Word16 tmp_32 = 0; Word32 F0_32 = BASOP_Util_Divide3232_Scale_newton( L_shl( nSamplesCore, Q16 ), tmpPitchLag, &tmp_32 ); - F0_32 = L_shl_sat( F0_32, tmp_32 - Q16 ); /* saturation needed to allow 0x40000000 << 1 */ + F0_32 = L_shl_sat( F0_32, tmp_32 - Q16 ); /* saturation needed to allow 0x40000000 << 1 */ *pF0_32 = F0_32; move32(); *pOrigF0_32 = *pF0_32; /*Q26*/ -- GitLab From 2917b88397c86fe8c743020bd07b9ddd62187bf7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 15 May 2026 12:04:48 -0400 Subject: [PATCH 3/3] wrap changes in macro --- lib_com/options.h | 1 + lib_dec/TonalComponentDetection_fx.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 09025f757..09300d64f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ #define FIX_ISSUE_1966_F0_32BIT /* FhG: Basop issue 1966: use 32-bit variables for F0 and thresholdModification */ #define FIX_BASOP_2519_TCA_LA_ZERO_EXP /* FhG: BASOP #2519: Exclude zero samples from exp_com calculation in tcaTargetCh_LA_fx */ #define FIX_BASOP_2519_ICBWE_DEC_Q_TRACK /* FhG: BASOP #2519: Track Q-format of dec_2over3_mem_fx across frames in stereo_icBWE_preproc_fx */ +#define FIX_BASOP_2592_OVERFLOW /* FhG: BASOP #2592: fix overflow in GetF0() */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index feca5afc4..900a09825 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -473,7 +473,11 @@ static void GetF0( { Word16 tmp_32 = 0; Word32 F0_32 = BASOP_Util_Divide3232_Scale_newton( L_shl( nSamplesCore, Q16 ), tmpPitchLag, &tmp_32 ); +#ifdef FIX_BASOP_2592_OVERFLOW F0_32 = L_shl_sat( F0_32, tmp_32 - Q16 ); /* saturation needed to allow 0x40000000 << 1 */ +#else + F0_32 = L_shl( F0_32, tmp_32 - Q16 ); +#endif *pF0_32 = F0_32; move32(); *pOrigF0_32 = *pF0_32; /*Q26*/ -- GitLab