From 89812809bebc8e1dbd5c87502203ff08e13b797d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 13 Feb 2025 15:27:40 -0500 Subject: [PATCH] fix for possible assert in guas_enc (1298) --- lib_com/options.h | 1 + lib_enc/gaus_enc_fx.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2d359665c..e7c3f2ce5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,4 +169,5 @@ #define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ #define FIX_1320_LOWRATE_ACELP #define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ +#define FIX_1298 /* VA: fix possible assert in gaus_enc */ #endif diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index a9add7ea8..a7d60642b 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -980,9 +980,13 @@ void gauss2v_ivas_fx( /* eneri = round_fx(ener[i]) + round_fx(ener[j]) + 2*round_fx(dotprod) */ /* Use ScalingShift to stay aligned with ener[] */ eneri = L_shl( dotprod, 1 ); /* One left shift added for factor of 2 */ +#ifndef FIX_1298 eneri = L_add( ener[i], eneri ); eneri = L_add( ener[j], eneri ); /* Q31 */ - +#else + eneri = L_add_sat( ener[i], eneri ); + eneri = L_add_sat( ener[j], eneri ); /* Q31 */ +#endif lo1 = L_Extract_lc( cor32, &hi1 ); cor2 = Sad_32( 0, hi1, lo1 ); /* Square + Add */ -- GitLab