From 4045a1998829472c27dc53cd1ed26fe7bd2e11a6 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 8 May 2026 16:03:07 +0300 Subject: [PATCH 1/2] Fix BASOP issue 2442: float counterpart changes to match BASOP algorithm change. --- lib_com/options.h | 1 + lib_rend/ivas_dirac_output_synthesis_dec.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index a24b82b9a..8a6cb2eb7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -182,6 +182,7 @@ #define FIX_FMSW_DEC_2 /* float issue 1575: fix crash for format switching when bitsream starts with EVS */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ +#define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI /* Nokia: BASOP issue 2442: Aligns float with identical diffuse gain limitation to minimize diff */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index f25047762..3c9535bd5 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -56,6 +56,10 @@ #define DIRAC_AVG_LENGTH_SYNTH_MS_FAST 10 #define DIRAC_ALPHA_MAX_FAST 0.12f #define DIRECTION_SMOOTHNESS_ALPHA 0.01f +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI +#define DIRAC_SMALL_DIFF_POW_LIM 65536.0f +#define DIRAC_SMALL_DIFF_POW_MAX_GAIN 2.0f +#endif /*------------------------------------------------------------------------- @@ -1250,6 +1254,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float *alpha_synthesis_fast; int16_t alphaMaxBin; int16_t alphaMaxBinFast; +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI + float diff_gain_limit; +#endif push_wmops( "dirac_out_synth_sfr" ); @@ -1434,17 +1441,26 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*diffuse*/ *p_power_diff_smooth_prev = g1 * ( *p_power_smooth_diff++ ) + g2 * ( *p_power_diff_smooth_prev ) + EPSILON; *( p_cy_auto_diff_smooth_prev ) = g1 * ( *( p_cy_auto_diff_smooth++ ) ) + g2 * ( *( p_cy_auto_diff_smooth_prev ) ); - +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI + diff_gain_limit = *p_power_diff_smooth_prev < DIRAC_SMALL_DIFF_POW_LIM ? DIRAC_SMALL_DIFF_POW_MAX_GAIN : DIRAC_GAIN_LIMIT; +#endif *( p_gains_diff ) = sqrtf( *( p_cy_auto_diff_smooth_prev++ ) / ( *( p_power_diff_smooth_prev++ ) ) ); if ( *( p_gains_diff ) < 0.f ) { *( p_gains_diff ) = 0.f; } +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI + else if ( *( p_gains_diff ) > diff_gain_limit ) + { + *( p_gains_diff ) = diff_gain_limit; + } +#else else if ( *( p_gains_diff ) > DIRAC_GAIN_LIMIT ) { *( p_gains_diff ) = DIRAC_GAIN_LIMIT; } +#endif p_gains_diff++; } -- GitLab From a5d887fe488c1aeaee27156813639c03ca662c61 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 15 May 2026 09:20:20 +0300 Subject: [PATCH 2/2] Clang format --- lib_rend/ivas_dirac_output_synthesis_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 3c9535bd5..3a79313fb 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -57,8 +57,8 @@ #define DIRAC_ALPHA_MAX_FAST 0.12f #define DIRECTION_SMOOTHNESS_ALPHA 0.01f #ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI -#define DIRAC_SMALL_DIFF_POW_LIM 65536.0f -#define DIRAC_SMALL_DIFF_POW_MAX_GAIN 2.0f +#define DIRAC_SMALL_DIFF_POW_LIM 65536.0f +#define DIRAC_SMALL_DIFF_POW_MAX_GAIN 2.0f #endif -- GitLab