diff --git a/lib_com/options.h b/lib_com/options.h index ad7191a8f3604a5e353da790d674db4f22c5868c..9e9922fb4d3551ca7006c962ae0b838d75b90c59 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,7 @@ #define FIX_998_UNUSED_FUNCTION /* FhG: issue 998: delete unused funtion ivas_dirac_dec_get_response_split_order */ #define FIX_1009_ISM_NONDIEGETIC_PANNING /* FhG: issue #1009: use correct object buffer for ISM1 non-diegetic pan */ #define FIX_993_REMOVE_SBA_GET_ORDER /* VA: issue 993: remove unused function ivas_sba_get_order() */ +#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_960_SYN_OUTPUT /* VA: issue 960: unused function syn_output() is removed */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index ea604ef7052569dfdc4a37130c04c2cd95515301..7deb7db6466b25d9d5878e1069c1f1b717379886 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -973,7 +973,6 @@ static void subst_spec( float alpha_local; float beta_local; - sincos = sincos_t_ext + 128; Lprot = (int16_t) ( L_PROT32k * output_frame / 640 ); Lprot_1 = 1.0f / Lprot; @@ -1092,7 +1091,14 @@ 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 ) {