From 5ae0e0f694e5b9c599b72153621fbb05a5eb9c3d Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Tue, 29 Jul 2025 11:11:22 +0200 Subject: [PATCH 1/3] Fix for computing reverb predelay in samples --- lib_com/options.h | 1 + lib_rend/ivas_reverb_fx.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 929ae2b05..4a5a53c98 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,7 @@ #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define FIX_1741_REVERB_TIMES_Q_FORMAT /* Philips: reverberation times in Q26 format instead of Q31 */ +#define FIX_1831_REVERB_REGRESSION /* Philips: fixes reverb regression issues */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index b4b9f7d1e..1be277fce 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -2426,6 +2426,10 @@ ivas_error ivas_binaural_reverb_init( Word32 t60[CLDFB_NO_CHANNELS_MAX]; Word32 ene[CLDFB_NO_CHANNELS_MAX]; Word16 preDelay; +#ifdef FIX_1831_REVERB_REGRESSION + Word16 temp16, s; + Word32 temp32; +#endif error = IVAS_ERR_OK; @@ -2442,7 +2446,14 @@ ivas_error ivas_binaural_reverb_init( return error; } +#ifdef FIX_1831_REVERB_REGRESSION + temp16 = BASOP_Util_Divide3216_Scale( sampling_rate, CLDFB_NO_CHANNELS_MAX, &s ); + temp16 = shl( temp16, s ); // Q0 + temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, temp16 ); // Q11 + preDelay = shr( add( temp32, shl( 1, 10 ) ), 11 ); // Q0 +#else preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); +#endif #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT floatToFixed_arrL( t60_temp, t60, Q26, CLDFB_NO_CHANNELS_MAX ); #else -- GitLab From 8ec96c567ad24981a9b8398477414bae7a5f3a1e Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Tue, 29 Jul 2025 12:30:44 +0200 Subject: [PATCH 2/3] To make clang happy --- lib_rend/ivas_reverb_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 1be277fce..bd1634c77 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -2448,9 +2448,9 @@ ivas_error ivas_binaural_reverb_init( #ifdef FIX_1831_REVERB_REGRESSION temp16 = BASOP_Util_Divide3216_Scale( sampling_rate, CLDFB_NO_CHANNELS_MAX, &s ); - temp16 = shl( temp16, s ); // Q0 - temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, temp16 ); // Q11 - preDelay = shr( add( temp32, shl( 1, 10 ) ), 11 ); // Q0 + temp16 = shl( temp16, s ); // Q0 + temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, temp16 ); // Q11 + preDelay = shr( add( temp32, shl( 1, 10 ) ), 11 ); // Q0 #else preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); #endif -- GitLab From 2a5a43ca6eafc846bb80c3b32f1fb3b2e561ab80 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 29 Jul 2025 22:31:07 +0200 Subject: [PATCH 3/3] fix sampling-rate dependency, BASOPs --- lib_rend/ivas_reverb_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index bd1634c77..5156911f3 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -2447,10 +2447,10 @@ ivas_error ivas_binaural_reverb_init( } #ifdef FIX_1831_REVERB_REGRESSION - temp16 = BASOP_Util_Divide3216_Scale( sampling_rate, CLDFB_NO_CHANNELS_MAX, &s ); - temp16 = shl( temp16, s ); // Q0 - temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, temp16 ); // Q11 - preDelay = shr( add( temp32, shl( 1, 10 ) ), 11 ); // Q0 + temp16 = BASOP_Util_Divide3216_Scale( 48000, CLDFB_NO_CHANNELS_MAX, &s ); + temp16 = shl( temp16, s ); // Q0 + temp32 = Mult_32_16( roomAcoustics->acousticPreDelay_fx, temp16 ); // Q11 + preDelay = extract_l( L_shr( L_add( temp32, L_shl( 1, 10 ) ), 11 ) ); // Q0 #else preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); #endif -- GitLab