diff --git a/lib_com/options.h b/lib_com/options.h index b3b1d5383f4c6c4cf3ba35c2a1f8ec605826ef5a..d8e6dbc66241c87a34ac63f6e896030cf8c1cc7e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -218,6 +218,7 @@ #define FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX /* VA: issue 1249: remove obsolete code around ALLRAD decoder matrix */ #define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */ #define FIX_1369_HQ_LR_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_enc(), brings floating-point code inline with FX */ +#define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ #define FIX_1139_REV_COLORATION_SHORT_T60 /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 85583cffd5e7e6200c5081235f182014adbf8a60..c338f238cdb73026c4de48096d14fc1480781448 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -616,10 +616,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 */ } }