diff --git a/lib_com/options.h b/lib_com/options.h index 428ddbb053a196a0dda7b4f0bc68b50afcc50260..f1c0040e2948f134e39f4b3e37f3cbd41dba17f9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,6 +169,7 @@ #define NONBE_1293_SR_HRTF /* VA: issue 1293: add support of external HRTFs in split rendering */ #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 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_fx.c b/lib_dec/hq_lr_dec_fx.c index 7d5d6a34b907255f65e9d83ee0e0224c686ba7aa..f7fc6440d1296078bb7a36ab911a29b32abfbf60 100644 --- a/lib_dec/hq_lr_dec_fx.c +++ b/lib_dec/hq_lr_dec_fx.c @@ -629,10 +629,33 @@ void hq_lr_dec_fx( IF( GE_16( i, highband ) ) { + +#ifdef NONBE_1118_EVS_LR_HQ_BITERROR + /* safety check in case of bit errors */ + IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) ) + { + st_fx->BER_detect = 1; + move16(); + set32_fx( L_yout, 0, inner_frame ); + return; + } + +#endif enerH_fx = L_add_sat( enerH_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */ } ELSE IF( GE_16( i, lowband ) ) { +#ifdef NONBE_1118_EVS_LR_HQ_BITERROR + /* safety check in case of bit errors */ + IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) ) + { + st_fx->BER_detect = 1; + move16(); + set32_fx( L_yout, 0, inner_frame ); + return; + } + +#endif enerL_fx = L_add_sat( enerL_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */ } }