From 3c94555ac2cdd2cd399883622a4ccb31a68172cd Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 21 Aug 2025 11:32:26 +0200 Subject: [PATCH] port fix from float MR 2217 --- lib_com/options.h | 1 + lib_enc/hq_lr_enc.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 0283dc7b2..757a4c24f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -214,6 +214,7 @@ #define NONBE_1214_PLC_LSF_MEMORY /* VA: issue 1224: reset ACELP PLC FEC memory in case of switching from MDCT stereo to TD/DFT stereo */ #define NONBE_1293_SR_HRTF /* VA: issue 1293: add support of external HRTFs in split rendering */ #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 */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index acafddc16..c0b43f779 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -334,7 +334,15 @@ void hq_lr_enc( frac1 = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */ L_tmp = Pow2( 30, frac1 ); exp = sub( exp, 30 ); +#ifdef FIX_1369_HQ_LR_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 ) ); } -- GitLab