diff --git a/lib_com/options.h b/lib_com/options.h index 94f06101010eea882eef2871a6dbb1a03567591c..a5e89debb5c5ee22a06ffe2dffeab37221948a2d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -202,6 +202,7 @@ #define FIX_INV_DIFFUSE_WEIGHT /* Orange : Fix error in energy compensation in late binaural */ #endif +#define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions */ //#define FIX_777_COMBI_RENDER_CONFIG_FILE /* Philips: Fix for combined renderer config file support */ #define NONBE_FIX_1004_USAN_DTX_MASA_NO_DIRS /* Nokia: fix USAN error caused by non-setting of correctly the number of MASA directions in DTX */ /* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF */ /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to actiate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on )*/ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 9f1a928e27e0cd20d0c3c6661a5e5e30fdb11ae1..e6b9f83bdf329d133e3ecc719025e4f1e8ab0341 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -1092,7 +1092,13 @@ static void subst_spec( } Xph = corr_phase[m]; + +#ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE + /* extract fractional phase integer index in the range [0...1023] */ + Xph_short = (int16_t) ( 0x000003ff & (int32_t) ( ( Xph * 512 ) / EVS_PI ) ); +#else Xph_short = (int16_t) ( ( (int32_t) ( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff; +#endif if ( Xph_short >= 512 ) { sin_F = -sincos_t_ext[Xph_short - 512]; @@ -1136,7 +1142,11 @@ static void subst_spec( mag_chg_local *= 0.5f + ( 1.0f - ( 1.0f / PHASE_DITH ) * ph_dith ) * 0.5f; } +#ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE + Xph_short = (int16_t) ( ( (int32_t) ( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff ); +#else Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff; +#endif if ( Xph_short >= 512 ) {