diff --git a/lib_com/options.h b/lib_com/options.h index dfd1fbd838a7d1c826363fd4a994b42648e22ea0..25a7fd515b429bffebb0ab1c2e952f52d74a12d6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,6 +99,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_1543_MID_LSF_BITS /* VA: float issue 1543: Resolve "MSAN: use-of-uninitialized-value in lib_enc/lsf_enc.c:262:5 for EVS encoder" */ +#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 438c646dd094c0201e151e4d76b63973940b4ce9..b8098a62fee4ae8ee86aa054d61837f0814af121 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 {