From b2ae92b3aae6f25cd73aa76150815c412628c90e Mon Sep 17 00:00:00 2001 From: naghibza Date: Fri, 12 Sep 2025 15:15:41 +0200 Subject: [PATCH] corrected bwe_exc_fx[] scaling in the prep_tbe_exc_fx() --- lib_com/options.h | 2 +- lib_com/swb_tbe_com_fx.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d2ffa2ca1..044845b8f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,7 +98,7 @@ #define FIX_2009_HIGH_NOISE_FLOOR_FOR_FX_DEC /* FhG: Corrected the q_input in the input of generate_masking_noise_dirac_ivas_fx() */ #define FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for dtx discontinuities */ #define FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for FER discontinuities */ - +#define FIX_2010_HF_ENERGY_LOSS /* FhG: corrected bwe_exc_fx[] scaling in the prep_tbe_exc_fx() */ /* #################### Start BASOP porting switches ############################ */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 6f5d2a4f0..ea4b428a7 100755 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -7288,8 +7288,18 @@ void prep_tbe_exc_fx( } ELSE { +#ifdef FIX_2010_HF_ENERGY_LOSS + Word16 shift = 0; + move16(); + IF( LT_32( MIN_BRATE_AVQ_EXC, core_brate ) ) + { + shift = 1; + move16(); + } +#else Word16 shift = 4; move16(); +#endif IF( gain_preQ_fx != 0 ) { FOR( i = 0; i < L_subfr; i++ ) @@ -7299,9 +7309,13 @@ void prep_tbe_exc_fx( Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */ #ifdef ISSUE_1836_replace_overflow_libcom +#ifdef FIX_2010_HF_ENERGY_LOSS + Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, add( 6, shift ) ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ + Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, add( 4, shift ) ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ +#else Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */ Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */ - +#endif tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */ #else Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */ -- GitLab