From 60bbeeff8babaad203eccb9361ccb82636687e88 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 11 Jul 2025 08:25:34 -0400 Subject: [PATCH 1/2] Fix to correct wrong initialization, small expected impact --- lib_com/options.h | 3 +++ lib_enc/core_switching_enc_fx.c | 15 ++++++++++++--- lib_enc/rst_enc_fx.c | 8 ++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 21d976fac..2c65d182f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -126,4 +126,7 @@ #define NONBE_FIX_1748_SPAR_DIV_OPT /*Dlb: issue 1748: SPAR common div optimizations*/ #define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION /* FhG: Fixed getScalefactor usage */ + +#define FIX_1818_WRONG_PIT_INIT /* VA: Fix wrong pitch initialization */ + #endif diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index 5290509cd..5867eb362 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -282,8 +282,11 @@ void core_switching_pre_enc_fx( tmp16 = shr( st_fx->L_frame, 6 ); Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); /*Q6*/ +#ifdef FIX_1818_WRONG_PIT_INIT + set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); +#else set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); - +#endif /* Reset old TD BWE buffers */ IF( hBWE_TD != NULL ) { @@ -851,8 +854,11 @@ void core_switching_pre_enc_ivas_fx( } Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); +#ifdef FIX_1818_WRONG_PIT_INIT + set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); +#else set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); - +#endif /* Reset old ACELP buffers */ test(); IF( ( st_fx->element_mode == EVS_MONO ) && hLPDmem != NULL ) @@ -902,8 +908,11 @@ void core_switching_pre_enc_ivas_fx( tmp16 = shr( st_fx->L_frame, 6 ); Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); +#ifdef FIX_1818_WRONG_PIT_INIT + set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); +#else set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); - +#endif /* Reset old TD BWE buffers */ IF( hBWE_TD != NULL ) { diff --git a/lib_enc/rst_enc_fx.c b/lib_enc/rst_enc_fx.c index d519bc12f..9880084e1 100644 --- a/lib_enc/rst_enc_fx.c +++ b/lib_enc/rst_enc_fx.c @@ -53,11 +53,19 @@ void CNG_reset_enc_fx( /* reset the pitch buffer in case of FRAME_NO_DATA or SID frames */ IF( EQ_16( st_fx->L_frame, L_FRAME ) ) { +#ifdef FIX_1818_WRONG_PIT_INIT + set16_fx( pitch_buf, L_SUBFR << 6, NB_SUBFR ); +#else set16_fx( pitch_buf, L_SUBFR, NB_SUBFR ); +#endif } ELSE /* st->L_frame == L_FRAME16k */ { +#ifdef FIX_1818_WRONG_PIT_INIT + set16_fx( pitch_buf, L_SUBFR16k << 6, NB_SUBFR16k ); +#else set16_fx( pitch_buf, L_SUBFR16k, NB_SUBFR16k ); +#endif } set16_fx( voice_factors, 1, NB_SUBFR16k ); -- GitLab From 8bc8881a5cbfcb5cd086dd15f9a62112bffa1735 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 11 Jul 2025 08:34:10 -0400 Subject: [PATCH 2/2] fix clang --- lib_enc/core_switching_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index 5867eb362..4c0b843e9 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -854,7 +854,7 @@ void core_switching_pre_enc_ivas_fx( } Copy( st_fx->old_pitch_buf_fx + tmp16, st_fx->old_pitch_buf_fx, tmp16 ); -#ifdef FIX_1818_WRONG_PIT_INIT +#ifdef FIX_1818_WRONG_PIT_INIT set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR << 6, tmp16 ); #else set16_fx( st_fx->old_pitch_buf_fx + tmp16, L_SUBFR, tmp16 ); -- GitLab