From 0557ff21f6afd8215d2f22007f11e7cbf67b913d Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 16 Jul 2025 17:42:25 +0200 Subject: [PATCH 1/2] Add one more bit headroom to product, to avoid assert failure in getSqrtWord32() for values larger than 0x3FFEC004. --- lib_com/options.h | 2 ++ lib_dec/jbm_pcmdsp_similarityestimation_fx.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 396d21f6c..48d8593c8 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_1824 + #endif diff --git a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c index baad5c561..f9ac53b62 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c @@ -113,9 +113,15 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, sumXX = L_shl( sumXX, normX ); normY = norm_l( sumYY ); sumYY = L_shl( sumYY, normY ); +#ifdef FIX_1824 + product = L_shr(L_mult0( extract_h( sumXX ), extract_h( sumYY ) ), 1 ); + normXY = add( normX, normY ); + normXY = sub( normXY, 32 + 1 ); +#else product = L_mult0( extract_h( sumXX ), extract_h( sumYY ) ); normXY = add( normX, normY ); normXY = sub( normXY, 32 ); +#endif /* change norm to factor of 2 */ IF( s_and( normXY, 0x1 ) != 0 ) -- GitLab From c772a10ef9cb5eb8794d5b59287dce404e964358 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 16 Jul 2025 17:49:35 +0200 Subject: [PATCH 2/2] Clang format --- lib_dec/jbm_pcmdsp_similarityestimation_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c index f9ac53b62..7015022eb 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c @@ -114,7 +114,7 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal, normY = norm_l( sumYY ); sumYY = L_shl( sumYY, normY ); #ifdef FIX_1824 - product = L_shr(L_mult0( extract_h( sumXX ), extract_h( sumYY ) ), 1 ); + product = L_shr( L_mult0( extract_h( sumXX ), extract_h( sumYY ) ), 1 ); normXY = add( normX, normY ); normXY = sub( normXY, 32 + 1 ); #else -- GitLab