diff --git a/lib_com/options.h b/lib_com/options.h index 59daf40a861b119e176179d27d553536838fa14d..6449c39074df1ce18436107b89fb3c52cff286fc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,6 +162,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #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 FIX_1477_OOB_INDEX_IN_D_ACELP_INDEXING /* FhG: fix oob indexing */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/dec_acelp.c b/lib_dec/dec_acelp.c index 6c2c1ba6c8358de2a7803da91d4695f51b539773..effde604f830cc7d1aad4abc562ca3ef80e91746 100644 --- a/lib_dec/dec_acelp.c +++ b/lib_dec/dec_acelp.c @@ -171,6 +171,7 @@ void D_ACELP_indexing( } s = index_n[0]; pulses = pulsestrack[0]; +#ifndef FIX_1477_OOB_INDEX_IN_D_ACELP_INDEXING /* safety check in case of bit errors */ if ( s >= pulsestostates[16][pulses - 1] ) { @@ -178,8 +179,18 @@ void D_ACELP_indexing( *BER_detect = 1; return; } +#endif if ( pulses ) { +#ifdef FIX_1477_OOB_INDEX_IN_D_ACELP_INDEXING + /* safety check in case of bit errors */ + if ( s >= pulsestostates[16][pulses - 1] ) + { + set_f( code, 0.0f, L_SUBFR ); + *BER_detect = 1; + return; + } +#endif D_ACELP_decode_arithtrack( code, s, pulses, num_tracks, 16 ); } else