diff --git a/lib_com/ivas_rotation_com.c b/lib_com/ivas_rotation_com.c index 9ce3c3b246a72f80c373a2d3f57571c25652cc22..f522d9312fc7414fc04637d2520cde3bfad16139 100644 --- a/lib_com/ivas_rotation_com.c +++ b/lib_com/ivas_rotation_com.c @@ -56,6 +56,20 @@ void Euler2Quat( IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ) { +#ifdef FIX_FLOAT_1607_SINF_ROT_COM + /* use double precision to avoid platform divergence + BOTH the trig functions and the multiplications need to be in double */ + double cr = cos( (double) roll * 0.5 ); + double sr = sin( (double) roll * 0.5 ); + double cp = cos( (double) pitch * 0.5 ); + double sp = sin( (double) pitch * 0.5 ); + double cy = cos( (double) yaw * 0.5 ); + double sy = sin( (double) yaw * 0.5 ); + quat->w = (float) ( cr * cp * cy + sr * sp * sy ); + quat->x = (float) ( sr * cp * cy - cr * sp * sy ); + quat->y = (float) ( sr * cp * sy + cr * sp * cy ); + quat->z = (float) ( cr * cp * sy - sr * sp * cy ); +#else float cr = cosf( roll * 0.5f ); float sr = sinf( roll * 0.5f ); float cp = cosf( pitch * 0.5f ); @@ -66,6 +80,7 @@ void Euler2Quat( quat->x = sr * cp * cy - cr * sp * sy; quat->y = sr * cp * sy + cr * sp * cy; quat->z = cr * cp * sy - sr * sp * cy; +#endif return; } diff --git a/lib_com/options.h b/lib_com/options.h index a33f3986fc5c6b8e1cc732e2da8cbe9e8e4c131d..bdec3416879348fc9cdfd4dded3e623e1f3ff819 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,7 @@ #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_1607_SINF_ROT_COM /* FhG: float issue 1607: MLD sensitive to usage of sinf in Euler2Quat() */ /* ##################### End NON-BE switches ########################### */