From c9539e4caf73ef33f913dec74004173a025a9205 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 27 Feb 2025 17:00:36 +0100 Subject: [PATCH 1/3] issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors; under NONBE_1118_EVS_LR_HQ_BITERROR --- lib_com/options.h | 4 ++-- lib_dec/hq_lr_dec.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be86aa6f64..a53176017f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,9 +173,9 @@ #define NONBE_1279_COUNTER_OVERFLOW /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ - - #define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ +#define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ + /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index b2389c53e6..e96b22a109 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -264,6 +264,16 @@ void hq_lr_dec( exp = sub( exp, 30 ); Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) ); /* Q -6 */ Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) ); +#ifdef NONBE_1118_EVS_LR_HQ_BITERROR + + /* safety check in case of bit errors */ + if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) + { + st->BER_detect = 1; + set_f( yout, 0, inner_frame ); + return; + } +#endif } FOR( i = 0; i < bands; i++ ) -- GitLab From 9a0b58a88f9e12aa3f439e9a52fee7d94ef4baa3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 27 Feb 2025 17:48:14 +0100 Subject: [PATCH 2/3] update --- lib_dec/hq_lr_dec.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index e96b22a109..ccb840404f 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -264,16 +264,6 @@ void hq_lr_dec( exp = sub( exp, 30 ); Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) ); /* Q -6 */ Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) ); -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR - - /* safety check in case of bit errors */ - if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) - { - st->BER_detect = 1; - set_f( yout, 0, inner_frame ); - return; - } -#endif } FOR( i = 0; i < bands; i++ ) @@ -645,10 +635,30 @@ void hq_lr_dec( IF( sub( i, highband ) >= 0 ) { +#ifdef NONBE_1118_EVS_LR_HQ_BITERROR + /* safety check in case of bit errors */ + if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) + { + st->BER_detect = 1; + set_f( yout, 0, inner_frame ); + return; + } + +#endif enerH_fx = L_add( enerH_fx, L_shl( Ep_fx[i], 2 ) ); /*Q0 */ } ELSE IF( sub( i, lowband ) >= 0 ) { +#ifdef NONBE_1118_EVS_LR_HQ_BITERROR + /* safety check in case of bit errors */ + if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) + { + st->BER_detect = 1; + set_f( yout, 0, inner_frame ); + return; + } + +#endif enerL_fx = L_add( enerL_fx, L_shl( Ep_fx[i], 2 ) ); /*Q0 */ } } -- GitLab From aac0dde63413287a980bee4b21b40b649854ac87 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 7 Apr 2025 14:51:20 +0200 Subject: [PATCH 3/3] correct merging issue --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 97b0c7fefb..407614837e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,6 @@ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */ #define NONBE_1303_GRANULARITY_OSBA_REND /* VA: issue 1303: Correctly set the granularity in OSBA, Disc mode, and BINAURAL_ROOM_REVERB output */ -#define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ #define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ /* ##################### End NON-BE switches ########################### */ -- GitLab