diff --git a/lib_com/ivas_agc_com.c b/lib_com/ivas_agc_com.c index 12b098869d45928bfd04c3f6dc58f441f4827251..cd4441b74a9fec3836b71eed6151d8db215e6be9 100644 --- a/lib_com/ivas_agc_com.c +++ b/lib_com/ivas_agc_com.c @@ -71,7 +71,11 @@ void ivas_agc_initWindowFunc( for ( i = 0; i < length; i++ ) { +#ifdef FIX_ISSUE_1603_SINF_COSF_PRECISION_XTENSA + pWinFunc[i] = 1.f + a * ( (float) cos( (double) ( EVS_PI * i / N ) ) - 1.f ); +#else pWinFunc[i] = 1.f + a * ( cosf( EVS_PI * i / N ) - 1.f ); +#endif } return; diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 1e9fe1eb3ca19425a335e4c3db3ace58d20a34d2..4dcf1499300d366d963e41a9bd5a33dc7908ee3a 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -1220,7 +1220,11 @@ static void ivas_get_hanning_win( for ( i = 0; i < len; i++ ) { +#ifdef FIX_ISSUE_1603_SINF_COSF_PRECISION_XTENSA + pH_win[i] = 0.5f * ( 1.0f - (float) cos( (double) ( PI2 * ( i + 1 ) ) / (double) ( ( 2 * len ) + 1 ) ) ); +#else pH_win[i] = 0.5f * ( 1.0f - cosf( ( PI2 * ( i + 1 ) ) / ( ( 2 * len ) + 1 ) ) ); +#endif } return; @@ -1320,12 +1324,20 @@ static void ivas_get_ld_fb_resp( /* apply final window*/ for ( s = 0; s < delay; s++ ) { +#ifdef FIX_ISSUE_1603_SINF_COSF_PRECISION_XTENSA + scratch1[s] = scratch1[s] * (float) sin( (double) ( EVS_PI * ( s + 1 ) ) / (double) ( 2 * delay ) ); +#else scratch1[s] = scratch1[s] * sinf( ( EVS_PI * ( s + 1 ) ) / ( 2 * delay ) ); +#endif } for ( s = 2 * delay; s < frame_len + 1; s++ ) { +#ifdef FIX_ISSUE_1603_SINF_COSF_PRECISION_XTENSA + scratch1[s] = scratch1[s] * (float) sin( (double) ( EVS_PI * ( frame_len - s ) ) / (double) ( 2 * ( frame_len + 1 - ( 2 * delay ) ) ) ); +#else scratch1[s] = scratch1[s] * sinf( ( EVS_PI * ( frame_len - s ) ) / ( 2 * ( frame_len + 1 - ( 2 * delay ) ) ) ); +#endif } for ( ; s < 2 * frame_len; s++ ) diff --git a/lib_com/options.h b/lib_com/options.h index a33f3986fc5c6b8e1cc732e2da8cbe9e8e4c131d..422d0a8b44148c717043373aa84ecb0c8e1081a5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,8 @@ /* any switch which is non-be wrt. TS 26.258 V3.0 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_FLOAT_1600_OMASA_WRONG_RENDER_PATH /* Nokia: float issue 1600: fix initialization condition of stereo type detection for OMASA */ +#define FIX_FLOAT_1600_OMASA_WRONG_RENDER_PATH /* Nokia: float issue 1600: fix initialization condition of stereo type detection for OMASA */ +#define FIX_ISSUE_1603_SINF_COSF_PRECISION_XTENSA /* Dolby: use double-precision cos()/sin() in place of cosf()/sinf() in fb_mixer and agc_com to eliminate 1-2 ULP variance */ /* ##################### End NON-BE switches ########################### */