Commit e0e56caf authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Fix for orientation tracking in Crend

parent 7ae1c8fb
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4516,6 +4516,15 @@ void Quat2Euler(
    float *roll                                                 /* o  : roll                                                    */
);

#ifdef FIX_I109_ORIENTATION_TRACKING
void Euler2Quat(
    const float yaw,                                            /* i  : yaw                                                     */
    const float pitch,                                          /* i  : pitch                                                   */
    const float roll,                                           /* i  : roll                                                    */
    Quaternion *quat                                            /* o  : quaternion describing the rotation                      */
);
#endif

void rotateAziEle(
    float azi_in,                                               /* i  : output elevation                                        */
    float ele_in,                                               /* i  : input elevation                                         */
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@
#define SPAR_SCALING_HARMONIZATION                      /* Issue 80: Changes to harmonize scaling in spar */
#define FIX_I98_HANDLES_TO_NULL                         /* Issue 98: do the setting of all handles to NULL in one place */
#define FIX_I102_SWB_TBE_SWITCH                         /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */
#define FIX_I109_ORIENTATION_TRACKING                   /* Issue 109: Harmonize head and orientation tracking */
#define FIX_DIRAC_CHANNELS                              /* Issue 71: lower number of DirAC analysis channels */
#define HARMONIZE_SBA_NCHAN_TRANSPORT                   /* harmonize setting of number of transport channels in SBA */
#define FIX_I13_TCX_TNS_ISSUE                           /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */
+3 −0
Original line number Diff line number Diff line
@@ -1065,6 +1065,9 @@ ivas_error ivas_crend_process(
                ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hCrend->hTrack, st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll );
                ivas_orient_trk_Process( st_ivas->hCrend->hTrack );
                ivas_orient_trk_GetTrackedOrientation( st_ivas->hCrend->hTrack, &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) );
#ifdef FIX_I109_ORIENTATION_TRACKING
                Euler2Quat( st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll, &st_ivas->hHeadTrackData->Quaternions[subframe_idx] );
#endif
            }

            /* Rotation in SHD for:
+5 −0
Original line number Diff line number Diff line
@@ -50,8 +50,13 @@
#define MAX_TRACKED_ANGLE_AVG_ORIENT PI_OVER_2
#define MAX_TRACKED_ANGLE_REF_ORIENT EVS_PI

#ifdef FIX_I109_ORIENTATION_TRACKING
/* TODO relate to frame rate - assumed here 200Hz, i.e. 5ms frame length */
#define OTR_UPDATE_RATE ( 200.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */
#else
/* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */
#define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */
#endif


/*------------------------------------------------------------------------------------------*
+31 −0
Original line number Diff line number Diff line
@@ -201,6 +201,37 @@ void Quat2Euler(
    return;
}

#ifdef FIX_I109_ORIENTATION_TRACKING
/*-------------------------------------------------------------------------
 * Quat2Euler()
 *
 * Euler handling: calculate corresponding Quaternions
 *------------------------------------------------------------------------*/

void Euler2Quat(
    const float yaw,   /* i  : yaw                                                     */
    const float pitch, /* i  : pitch                                                   */
    const float roll,  /* i  : roll                                                    */
    Quaternion *quat   /* o  : quaternion describing the rotation                      */
)
{
    float cos_y_2, sin_y_2, cos_p_2, sin_p_2, cos_r_2, sin_r_2;
    cos_y_2 = cosf( yaw * 0.5f );
    sin_y_2 = sinf( yaw * 0.5f );
    cos_p_2 = cosf( pitch * 0.5f );
    sin_p_2 = sinf( pitch * 0.5f );
    cos_r_2 = cosf( roll * 0.5f );
    sin_r_2 = sinf( roll * 0.5f );

    quat->w = cos_y_2 * cos_p_2 * cos_r_2 + sin_y_2 * sin_p_2 * sin_r_2;
    quat->x = cos_y_2 * cos_p_2 * sin_r_2 - sin_y_2 * sin_p_2 * cos_r_2;
    quat->y = cos_y_2 * sin_p_2 * cos_r_2 + sin_y_2 * cos_p_2 * sin_r_2;
    quat->z = sin_y_2 * cos_p_2 * cos_r_2 - cos_y_2 * sin_p_2 * sin_r_2;

    return;
}

#endif

/*-------------------------------------------------------------------------
 * rotateAziEle()