diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c index 1586bc252a2fec277b72b75bd4c19eb1257c7159..26cc777940b510fd64b2289ad1743540febf0197 100644 --- a/lib_com/hp50_fx.c +++ b/lib_com/hp50_fx.c @@ -316,8 +316,12 @@ void hp20_fx_32_opt( prescale = s_min( prescale, diff ); prescale = sub( 1 + HP20_FX_COEFF_SCALE, prescale ); - +#ifdef FIX_2086_ENABLE_HP20_OPT_FOR_ENC + if ( EQ_16( prescale_current_frame, 1 + HP20_FX_COEFF_SCALE - 31 ) || // signal_fx buffer contains only zeros, so use the mem_fx scale_factor instead + LT_16( prescale_current_frame, prescale ) ) // To avoid overflow in the subsequent shr() scaling for W_y1, W_y2, x2, and x1 calculations before the for loop. +#else if ( EQ_16( prescale_current_frame, 1 + HP20_FX_COEFF_SCALE - 31 ) ) // signal_fx buffer contains only zeros, so use the mem_fx scale_factor instead +#endif { prescale_current_frame = prescale; } diff --git a/lib_com/options.h b/lib_com/options.h index af3166f5398bd140dab73a185741aba9ac80eb93..f6e4deb5be0a64aacaca5bb6baaab0c1e70738c3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,7 +85,7 @@ #define FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC /* FhG: fix for issue 2165 - using saturating addition in tonal MDCT PLC function */ #define OPT_2146_BASOP_UTIL_ADD_MANT32EXP /* Dlb: optimized version of BASOP_Util_Add_Mant32Exp() */ #define FIX_2166_ASSERT_OSBA_PLC_STEREO_OUT /* FhG: fix for issue 2166 - add missing averaging factor 0.5 in for the sum of energies in function stereo_dft_dmx_swb_nrg_fx()*/ - +#define FIX_2086_ENABLE_HP20_OPT_FOR_ENC /* FhG: Enable hp20_fx_32_opt() for Encoder */ #define FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE /* FhG: Use dynamic Q factor for synth_fx and synthFB_fx to prevent overflow */ #define FIX_2170_ASSERT_IN_FFT3 /* Eri: Assert in fft3_fx from EVS, adding _sat */ #define FIX_2082_FP_LEFTOVERS_OMASA_DEC /* Nokia: fix for issue 2082, cleaning remaining floating point code */ diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c index 095d4c2cf4e1c4ebfc579ce37ee4297db16f2c9b..4d8f99650b8292e5de06f50139200af66827b22c 100644 --- a/lib_enc/ivas_enc_fx.c +++ b/lib_enc/ivas_enc_fx.c @@ -158,11 +158,19 @@ ivas_error ivas_enc_fx( test(); IF( ( EQ_32( ivas_format, SBA_FORMAT ) ) && !( GT_16( st_ivas->sba_analysis_order, 1 ) ) ) { +#ifdef FIX_2086_ENABLE_HP20_OPT_FOR_ENC + hp20_fx_32_opt( data_fx[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); +#else hp20_fx_32( data_fx[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); +#endif } ELSE IF( !( EQ_32( ivas_format, MC_FORMAT ) && EQ_16( i, LFE_CHANNEL ) ) ) { +#ifdef FIX_2086_ENABLE_HP20_OPT_FOR_ENC + hp20_fx_32_opt( data_fx[i], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); +#else hp20_fx_32( data_fx[i], input_frame, st_ivas->mem_hp20_in_fx[i], input_Fs ); +#endif } }