From d576f6e07089ffa379df62ba8213e9c60b8142c6 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 27 Aug 2025 10:26:20 -0400 Subject: [PATCH 1/2] possible fix for 1979, addition of _sat in lsf_enc --- lib_com/options.h | 2 +- lib_enc/lsf_enc_fx.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 452039c96..91f2d8cfc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,7 +77,7 @@ #define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */ #define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */ #define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */ - +#define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */ /* #################### 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_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 505114459..eeb2e1aa6 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -2541,7 +2541,11 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ FOR( j = 1; j < M; j++ ) { - L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#ifdef FIX_1979_SAT_MISSING_IN_LSF_ENC + L_tmp = L_mac_sat( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#else + L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ +#endif } e[i] = L_tmp; move32(); -- GitLab From 46ab1031d5e38cd497d5a45e1bc9872074a4f067 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 27 Aug 2025 10:42:25 -0400 Subject: [PATCH 2/2] fix clang --- lib_enc/lsf_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index eeb2e1aa6..1e9a2a511 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -2544,7 +2544,7 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( #ifdef FIX_1979_SAT_MISSING_IN_LSF_ENC L_tmp = L_mac_sat( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ #else - L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ + L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ #endif } e[i] = L_tmp; -- GitLab