diff --git a/lib_com/options.h b/lib_com/options.h index 92a2e7a0f8f71e7bc3e6088d6c5b4c34bc83c480..407614837e04745d61938600c955880a086bf850 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #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_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index b2389c53e698b09a6b255b92ed5b5510613c126a..ccb840404f9e58408cf21593892029e5ae5bfa31 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -635,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 */ } }