Commit 4c50cdde authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] promote math in Euler2Quat() to double to reduce platform dependent differences

parent 1cf94238
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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;
}
+1 −0
Original line number Diff line number Diff line
@@ -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 ########################### */