From aa585e139d4c750701b26de3fca5e8b96c304aed Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 10 Aug 2025 21:32:06 +0200 Subject: [PATCH] port float MR1585 to BASOP --- lib_com/options.h | 1 + lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 81f280e9c..05c491a4f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -119,6 +119,7 @@ #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ +#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ #define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */ #define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */ #define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index e20e2df9a..d68571c1f 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -622,6 +622,10 @@ static void map_params_dirac_to_stereo( move32(); } } +#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO + /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */ + /* In Q31, this clamping happens implicitly */ +#endif q_sqrt = 0; move16(); side_gain[b] = Mpy_32_32( side_gain[b], Sqrt32( L_sub( MAX_32, diffuseness[b] ), &q_sqrt ) ); /*Q31 - q_sqrt*/ @@ -640,10 +644,18 @@ static void map_params_dirac_to_stereo( q_sqrt = 0; move16(); } +#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO + /* for residual prediction gain, allowed range is [0, 1]*/ + res_pred_gain[b] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/ + move32(); + res_pred_gain[b + STEREO_DFT_BAND_MAX] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/ + move32(); +#else res_pred_gain[b] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/ move32(); res_pred_gain[b + STEREO_DFT_BAND_MAX] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/ move32(); +#endif } } -- GitLab