From f699c0d45ef190a7813805a160752c226963031f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 6 Oct 2025 20:20:51 +0200 Subject: [PATCH] alternative fix for issue 2602 --- lib_com/options.h | 2 +- lib_dec/swb_tbe_dec_fx.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a72b234fc..464fc3e9e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,7 +107,7 @@ #define FIX_1962_FORMAT_CONV_SPECTRAL_DIFF /* FhG: Improved precision of targetEnergy in ivas_ls_setup_conversion_process_mdct_fx() */ #define FIX_2003_CON_TCX_OVERFLOW /* FhG: Use a dynamic scaling factor for the synth buffer at the output of con_tcx_ivas_fx() */ #define OPT_TCXLTP_FILTER_LOOP /* FhG: optimize loop in tcx_ltp_synth_filter */ - +#define FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE /* Dolby/FhG: fix for issue 2026: Saturation in SWB TBE re-scaling function preventing StereoDownmix complexity job to complete */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 0de93c937..c3291bde2 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2705,8 +2705,12 @@ void swb_tbe_dec_fx( FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ - shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ +#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ +#else + shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ +#endif move16(); } IF( exp < 0 ) @@ -2727,8 +2731,12 @@ void swb_tbe_dec_fx( L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */ temp = sub( 32767 /*1.0f Q15*/, temp ); Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ +#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ +#else shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ +#endif move16(); } } @@ -2740,8 +2748,12 @@ void swb_tbe_dec_fx( L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */ temp = sub( 32767 /*1.0f Q15*/, temp ); Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 ); - L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ +#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ +#else shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ +#endif move16(); } } -- GitLab