From cca71c3eb3d6bfda49ce921354155b9e2b04a6fd Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 2 Oct 2025 13:45:28 +0200 Subject: [PATCH 1/9] fix saturations in SWB TBE re-scaling function --- lib_com/options.h | 2 +- lib_dec/swb_tbe_dec_fx.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3271222de..ce9736e9e 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: 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..f7837e100 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2706,7 +2706,11 @@ 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 */ +#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 ) -- GitLab From d5291a66982035defd4b8ab9edaeda07bd442c64 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 2 Oct 2025 13:52:09 +0200 Subject: [PATCH 2/9] clang format --- lib_dec/swb_tbe_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index f7837e100..edc914a2c 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2705,7 +2705,7 @@ 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 */ + 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 -- GitLab From 788c17482c297c395e1dbbc0279a02c06db9654e Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 2 Oct 2025 14:18:34 +0200 Subject: [PATCH 3/9] re-factoring of the fix to keep EVS bit-exactness --- lib_dec/swb_tbe_dec_fx.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index edc914a2c..23cc6f71f 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2703,26 +2703,46 @@ void swb_tbe_dec_fx( Lscale = root_a_over_b_fx( curr_pow, shl( Q_bwe_exc, 1 ), prev_pow, shl( Q_bwe_exc, 1 ), &exp ); - FOR( i = 0; i < L_SHB_LAHEAD; i++ ) - { - 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 */ + /* Note, that the code below is identical for both EVS and IVAS codecs. The only difference is the addition of _sat in IVAS functions to avoid the saturation problem. Thus, it's BE for EVS test sequences and legacy implementations. */ + IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + { + 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 */ + move16(); + } + } + ELSE + { #endif - move16(); + 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_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ + move16(); + } +#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE } +#endif + IF( exp < 0 ) { Lscale = L_shl( Lscale, exp ); exp = 0; move16(); } + +#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + /* Note, that the code below is identical for both EVS and IVAS codecs. The only differences are the replacement of i_mult_sat() which has precision issues and the addition of _sat in IVAS functions to avoid the saturation problem. Thus, it's BE for EVS test sequences and legacy implementations. */ +#else /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations */ +#endif IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { FOR( ; i < L_SHB_LAHEAD + 10; i++ ) @@ -2745,7 +2765,11 @@ void swb_tbe_dec_fx( 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 */ +#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 From a4d0f0649064a0d7844c47908fcca17fab2ef98a Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 2 Oct 2025 15:36:04 +0200 Subject: [PATCH 4/9] reconsidered the fix ->apply also for EVS even though it might break the bit-exactness --- lib_dec/swb_tbe_dec_fx.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 23cc6f71f..97f12b1f6 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2705,26 +2705,19 @@ void swb_tbe_dec_fx( #ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE - /* Note, that the code below is identical for both EVS and IVAS codecs. The only difference is the addition of _sat in IVAS functions to avoid the saturation problem. Thus, it's BE for EVS test sequences and legacy implementations. */ - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + /* Note, that the code below comes from the legacy EVS decoder but it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions. However, this might break the bit-exactness with EVS for some corner case-signals. */ + FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { - 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 */ - move16(); - } + L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */ + shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ + move16(); } - ELSE +#else + FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { -#endif - 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_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ - move16(); - } -#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + 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 */ + move16(); } #endif -- GitLab From c88289999b762705236343ad196928645a7aac5a Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 2 Oct 2025 15:38:49 +0200 Subject: [PATCH 5/9] reconsidered the fix ->apply also for EVS even though it might break the bit-exactness --- lib_dec/swb_tbe_dec_fx.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 97f12b1f6..0ab62bc4c 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2729,13 +2729,22 @@ void swb_tbe_dec_fx( } #ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE - /* Note, that the code below is identical for both EVS and IVAS codecs. The only differences are the replacement of i_mult_sat() which has precision issues and the addition of _sat in IVAS functions to avoid the saturation problem. Thus, it's BE for EVS test sequences and legacy implementations. */ + /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */ + FOR( ; i < L_SHB_LAHEAD + 10; i++ ) + { + temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); + 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 */ + shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ + move16(); + } #else /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations */ -#endif IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { FOR( ; i < L_SHB_LAHEAD + 10; i++ ) @@ -2758,14 +2767,11 @@ void swb_tbe_dec_fx( 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 */ -#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(); } } +#endif /* Update SHB excitation */ Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */ -- GitLab From 712b648b2b05a1edbc217bcf12d131884f203c4d Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Thu, 2 Oct 2025 16:14:01 +0200 Subject: [PATCH 6/9] clang format --- lib_dec/swb_tbe_dec_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 0ab62bc4c..1e35b0038 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2708,14 +2708,14 @@ void swb_tbe_dec_fx( /* Note, that the code below comes from the legacy EVS decoder but it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions. However, this might break the bit-exactness with EVS for some corner case-signals. */ FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { - 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 */ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ move16(); } #else FOR( i = 0; i < L_SHB_LAHEAD; i++ ) { - 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 */ shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */ move16(); } @@ -2736,7 +2736,7 @@ 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 */ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ move16(); } -- GitLab From dabc33814f4a943e15422cb8b851d0174a172b0c Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 6 Oct 2025 11:06:15 +0200 Subject: [PATCH 7/9] try to restore BE with EVS - just temp. fix --- lib_dec/swb_tbe_dec_fx.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 1e35b0038..43d15beb1 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2728,19 +2728,19 @@ void swb_tbe_dec_fx( move16(); } -#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE - /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */ - FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - { - temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); - 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 */ - shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ - move16(); - } -#else +//#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE +// /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */ +// FOR( ; i < L_SHB_LAHEAD + 10; i++ ) +// { +// temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); +// 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 */ +// shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ +// move16(); +// } +//#else /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations @@ -2771,7 +2771,7 @@ void swb_tbe_dec_fx( move16(); } } -#endif +//#endif /* Update SHB excitation */ Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */ -- GitLab From 2d6e5046455444c56ab7eb091481fb3fde41731a Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 6 Oct 2025 14:36:06 +0200 Subject: [PATCH 8/9] clang format --- lib_dec/swb_tbe_dec_fx.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 43d15beb1..f4e252742 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2728,19 +2728,19 @@ void swb_tbe_dec_fx( move16(); } -//#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE -// /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */ -// FOR( ; i < L_SHB_LAHEAD + 10; i++ ) -// { -// temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); -// 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 */ -// shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ -// move16(); -// } -//#else + //#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE + // /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */ + // FOR( ; i < L_SHB_LAHEAD + 10; i++ ) + // { + // temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); + // 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 */ + // shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ + // move16(); + // } + //#else /* code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations @@ -2771,7 +2771,7 @@ void swb_tbe_dec_fx( move16(); } } -//#endif + //#endif /* Update SHB excitation */ Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */ -- GitLab From 2cca6b2ba4bb756e25b7819f31cdde93400c7431 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Tue, 7 Oct 2025 08:05:01 +0200 Subject: [PATCH 9/9] cleanup of temp code --- lib_dec/swb_tbe_dec_fx.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index f4e252742..0a8113c1d 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -2728,23 +2728,6 @@ void swb_tbe_dec_fx( move16(); } - //#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE - // /* Note, that the code below comes from the legacy EVS decoder but it has precision issues in i_mult_sat() and it leads to saturation issues in L_shl(). Thus, it's been fixed by adding _sat to L_shl() and round_fx() functions and replacing i_mult_sat() with round_fx_sat(). However, this might break the bit-exactness with EVS for some corner case-signals. */ - // FOR( ; i < L_SHB_LAHEAD + 10; i++ ) - // { - // temp = round_fx_sat( L_shl( L_mult( 0x6666 /* 0.1 in Q12 */, shl( sub( i, 19 ), 11 ) ), 1 ) ); - // 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 */ - // shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */ - // move16(); - // } - //#else - /* - code for EVS and IVAS are basically identical with the exception of i_mult_sat() which has precision issues - thus is was replaced for IVAS and kept for EVS, in order to keep EVS BE to test sequences and legacy implementations - */ IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { FOR( ; i < L_SHB_LAHEAD + 10; i++ ) @@ -2771,7 +2754,6 @@ void swb_tbe_dec_fx( move16(); } } - //#endif /* Update SHB excitation */ Copy( shaped_shb_excitation + L_FRAME16k, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD ); /* Q_bwe_exc */ -- GitLab