diff --git a/lib_com/options.h b/lib_com/options.h index e6e5cea86a99db9c185a9f84027a6f4e7b8bd84d..8267482f977df056b0f429329db77cc277c4aa6b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define CODE_IMPROVEMENTS /* FhG: Small code improvements that do not change the functionality */ +#define FIX_1348_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_dec(), brings floating-point code inline with FX */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index f9ab923be7a3d6631b70d0af15e719b3bd3e9d5f..b2febc4956579c776195f9119a10a0bc38ef0164 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -262,7 +262,15 @@ void hq_lr_dec( frac1 = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ L_tmp = Pow2( 30, frac1 ); exp = sub( exp, 30 ); - Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) ); /* Q -6 */ +#ifdef FIX_1348_OVERFLOW +#ifdef BASOP_NOGLOB + Ep_fx[i] = L_shl_o( L_tmp, s_max( sub( exp, 6 ), -31 ), &Overflow ); /* Q -6 */ +#else + Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */ +#endif +#else + Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) ); /* Q -6 */ +#endif Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) ); }