From 032e1cfce9ba499615dfdf5b82b1ae1a0d9a3acb Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 14 Jan 2026 09:41:39 +0100 Subject: [PATCH 1/3] fix FIX_2302_LSF_CDBK_THRESHOLD --- lib_com/options.h | 1 + lib_enc/lsf_enc_fx.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4a272cf24..302890e14 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,6 +145,7 @@ #define FIX_2315_AGC_MEMORY_RESET /* VA: basop issue 2315: fix reset of the AGC memory */ #define FIX_2312_CONDITION_MISSING_GSC_DEC_LR /* VA: basop issue 2297: addition of condition missing in the GSC gain decoder at low-rate */ #define FIX_2313_HF_RESET_16KHZ /* VA: basop issue 2313: Call hf_synth_reset_fx() also for 16 kHz output_Fs */ +#define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index 4fc0777c7..bd9ae96d4 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -1585,10 +1585,12 @@ void lsf_end_enc_ivas_fx( #else abs_threshold = SFNETLOWLIMIT_NB / 2; #endif - move32(); } ELSE { +#ifdef FIX_2302_LSF_CDBK_THRESHOLD + abs_threshold = L_add( SFNETLOWLIMIT_WB, 0 ); +#else abs_threshold = SFNETLOWLIMIT_WB / 2; move32(); #ifdef HARM_LSF_ENC @@ -1596,6 +1598,7 @@ void lsf_end_enc_ivas_fx( { abs_threshold = L_add( SFNETLOWLIMIT_WB, 0 ); } +#endif #endif } @@ -2638,12 +2641,12 @@ static Word32 vq_lvq_lsf_enc( diff[j] = shl_sat( diff[j], 4 ); move16(); } - 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 */ + 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 + Q4 */ 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 */ + 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 + Q4 */ } - e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */ + e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q4 */ move32(); } @@ -2757,10 +2760,10 @@ static Word32 vq_lvq_lsf_enc_ivas_fx( diff[j] = shl_sat( diff[j], 4 ); move16(); } - 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 */ + 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 + Q4 */ FOR( j = 1; j < M; j++ ) { - 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 */ + 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 + Q4 */ } e[i] = L_tmp; move32(); -- GitLab From cf722b50460be034a5bc403fb49e24321678ea82 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 14 Jan 2026 15:17:20 +0100 Subject: [PATCH 2/3] addition --- lib_enc/lsf_enc_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index bd9ae96d4..946330614 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -1580,10 +1580,14 @@ void lsf_end_enc_ivas_fx( IF( st->bwidth == NB ) { +#ifdef FIX_2302_LSF_CDBK_THRESHOLD + abs_threshold = L_add( SFNETLOWLIMIT_NB, 0 ); +#else #ifdef HARM_LSF_ENC abs_threshold = L_add( SFNETLOWLIMIT_NB, 0 ); #else abs_threshold = SFNETLOWLIMIT_NB / 2; +#endif #endif } ELSE -- GitLab From ff92cefe6df29156becdb6e43b1be099410929d0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 14 Jan 2026 18:39:31 +0100 Subject: [PATCH 3/3] comment --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 302890e14..934347a54 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -145,7 +145,7 @@ #define FIX_2315_AGC_MEMORY_RESET /* VA: basop issue 2315: fix reset of the AGC memory */ #define FIX_2312_CONDITION_MISSING_GSC_DEC_LR /* VA: basop issue 2297: addition of condition missing in the GSC gain decoder at low-rate */ #define FIX_2313_HF_RESET_16KHZ /* VA: basop issue 2313: Call hf_synth_reset_fx() also for 16 kHz output_Fs */ -#define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ +#define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ /* ##################### End NON-BE switches ########################### */ -- GitLab