From c5855562758c7ad1c56b35e094e21939ddfc8fad Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 3 May 2023 15:54:53 +1000 Subject: [PATCH] fix for issue 430, euler to quat fix --- lib_com/options.h | 2 ++ lib_rend/ivas_rotation.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5b1e9df092..1f67d52630 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -178,6 +178,8 @@ /*#define LBR_SBA_PLANAR*/ /* Converting low bitrate SBA modes to Planar */ #define LBR_ADAP_SMOOTHING #endif +#define EUALER2QUAT_FIX /*Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted*/ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index ddfdcb6763..4d9eeef3d5 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -165,14 +165,24 @@ void Euler2Quat( float cr = cosf( roll * 0.5f ); float sr = sinf( roll * 0.5f ); float cp = cosf( pitch * 0.5f ); +#ifdef EUALER2QUAT_FIX + float sp = sinf( pitch * 0.5f ); +#else float sp = sinf( -pitch * 0.5f ); +#endif float cy = cosf( yaw * 0.5f ); float sy = sinf( yaw * 0.5f ); - +#ifdef EUALER2QUAT_FIX + quat->w = cr * cp * cy + sr * sp * sy; + quat->x = sr * cp * cy - cr * sp * sy; + quat->y = sr * cp * sy + cr * sp * cy; + quat->z = cr * cp * sy - sr * sp * cy; +#else quat->w = cr * cp * cy - sr * sp * sy; quat->x = sr * cp * cy + cr * sp * sy; quat->y = cr * sp * cy - sr * cp * sy; quat->z = cr * cp * sy + sr * sp * cy; +#endif return; } -- GitLab