From ca93b26539a541f704b376f474e3055daec986e2 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 23 Mar 2026 11:55:44 -0400 Subject: [PATCH] fix proposal for 2488 --- lib_com/options.h | 1 + lib_enc/ivas_mdct_core_enc_fx.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index eb5d8a66e..e8563f080 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,6 +98,7 @@ #define FIX_BASOP_2451_HQ_FEC_SELECTOR /* Eri: Resolve basop issue 2451, wrong condition on env_stab_plc_fx */ #define FIX_2398_PRECISSION_ORIENTATION_TRACKING /* FhG: use refinement of Sqrt32 within certain functions*/ +#define FIX_2488_PREVENT_NEG_PITCH /* VA: Fix for 2488, use saturation to prevent possible wrap-around, thus negative pitch values */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 438c646dd..b8098a62f 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -2462,7 +2462,11 @@ void ivas_mdct_core_whitening_enc_fx( } IF( param_core[ch][1 + NOISE_FILL_RANGES] != 0 ) { +#ifdef FIX_2488_PREVENT_NEG_PITCH + set16_fx( pitch_buf_fx[ch], extract_h( L_shl_sat( Mult_32_32( L_add( L_deposit_h( st->hTcxEnc->tcxltp_pitch_int ), L_mult( st->hTcxEnc->tcxltp_pitch_fr, div_s( 1, st->pit_res_max ) ) ), Mult_32_32( L_shl( st->sr_core, Q10 ), ONE_BY_INT_FS_12k8_Q42 ) ), 16 ) ), NB_SUBFR16k ); +#else set16_fx( pitch_buf_fx[ch], extract_l( Mult_32_32( L_add( L_deposit_h( st->hTcxEnc->tcxltp_pitch_int ), L_mult( st->hTcxEnc->tcxltp_pitch_fr, div_s( 1, st->pit_res_max ) ) ), Mult_32_32( L_shl( st->sr_core, Q10 ), ONE_BY_INT_FS_12k8_Q42 ) ) ), NB_SUBFR16k ); +#endif } ELSE { -- GitLab