From 3ba8b1fcc6c1101d82b262d823fa4a16a1f1c6df Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 22 May 2025 12:26:25 +0900 Subject: [PATCH 1/2] Add FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE --- lib_com/options.h | 1 + lib_dec/FEC_HQ_phase_ecu.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 23bacc0d5..13644bda5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -219,6 +219,7 @@ #define FIX_ACCESS_WITHIN_NULL_STRUCT_MC_BW_SWITCHING /* FhG: fix usan error in MCT with bw swicthing */ #define NONBE_FIX_986_MC_BW_SWITCHING /* FhG: fix crash in bw and br switching with MC */ +#define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 9f1a928e2..e6b9f83bd 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -1092,7 +1092,13 @@ static void subst_spec( } Xph = corr_phase[m]; + +#ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE + /* extract fractional phase integer index in the range [0...1023] */ + Xph_short = (int16_t) ( 0x000003ff & (int32_t) ( ( Xph * 512 ) / EVS_PI ) ); +#else Xph_short = (int16_t) ( ( (int32_t) ( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff; +#endif if ( Xph_short >= 512 ) { sin_F = -sincos_t_ext[Xph_short - 512]; @@ -1136,7 +1142,11 @@ static void subst_spec( mag_chg_local *= 0.5f + ( 1.0f - ( 1.0f / PHASE_DITH ) * ph_dith ) * 0.5f; } +#ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE + Xph_short = (int16_t) ( ( (int32_t) ( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff ); +#else Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff; +#endif if ( Xph_short >= 512 ) { -- GitLab From 673c593f96730319aed5f3dcc389e5d67221ec86 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Mon, 16 Jun 2025 19:43:12 +0200 Subject: [PATCH 2/2] Fix syntax error --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0cdd7c70b..a5e89debb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -202,7 +202,6 @@ #define FIX_INV_DIFFUSE_WEIGHT /* Orange : Fix error in energy compensation in late binaural */ #endif -<<<<<<< HEAD #define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions */ //#define FIX_777_COMBI_RENDER_CONFIG_FILE /* Philips: Fix for combined renderer config file support */ #define NONBE_FIX_1004_USAN_DTX_MASA_NO_DIRS /* Nokia: fix USAN error caused by non-setting of correctly the number of MASA directions in DTX */ -- GitLab