Commit f6dc3dd3 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Remaining functions in ivas_orient_trk.c converted to fxd

parent d52004cd
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -53,6 +53,13 @@
#define Q31_0_99                                 2126008811
#define Q31_0_01                                 21474836
#endif
#define PI_OVER_4_Q29                            421657440
#define PI_OVER_Q29                              1686629760
#define PI2_C_ADP_RATE_Q31                       449767936 //(2.0f * EVS_PI * pOTR->centerAdaptationRate)//
#define PI2_C_Q28                                1686629760
#define OFF_C_ADP_RATE_Q31                       268435456
#define C_ADP_RATE_Q31                           71582792


#define SQRT2                                   1.414213562373095f
#define SQRT2_FIXED                             1518500250 // Q30
+9 −1
Original line number Diff line number Diff line
@@ -1441,10 +1441,17 @@ ivas_error IVAS_DEC_FeedHeadTrackData(
        Euler2Quat( deg2rad( orientation.x ), deg2rad( orientation.y ), deg2rad( orientation.z ), &orientation );
    }

#ifdef IVAS_FLOAT_FIXED
    IF((error = ivas_orient_trk_Process_fx(hHeadTrackData->OrientationTracker, orientation, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[subframe_idx])) != IVAS_ERR_OK)
    {
      return error;
    }
#else
    IF( ( error = ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[subframe_idx] ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#endif 

    hHeadTrackData->Pos[subframe_idx].x = Pos.x;
    hHeadTrackData->Pos[subframe_idx].y = Pos.y;
@@ -1524,12 +1531,13 @@ ivas_error IVAS_DEC_FeedRefVectorData(
    refPos_fx.y_fx = float_to_fix( refPos.y, refPos_fx.y_qfact );
    refPos_fx.z_fx = float_to_fix( refPos.z, refPos_fx.z_qfact );
    pOTR_fx->orientation_tracking_fx = pOtr->orientation_tracking;
    ivas_orient_trk_SetReferenceVector_fx( pOTR_fx, listenerPos_fx, refPos_fx );
    ivas_error error_fx = ivas_orient_trk_SetReferenceVector_fx( pOTR_fx, listenerPos_fx, refPos_fx );
    pOtr->refRot.w = me2f( pOTR_fx->refRot_fx.w_fx, 31- pOTR_fx->refRot_fx.w_qfact );
    pOtr->refRot.x = me2f( pOTR_fx->refRot_fx.x_fx, 31 -pOTR_fx->refRot_fx.x_qfact );
    pOtr->refRot.y = me2f( pOTR_fx->refRot_fx.y_fx, 31- pOTR_fx->refRot_fx.y_qfact );
    pOtr->refRot.z = me2f( pOTR_fx->refRot_fx.z_fx, 31 -pOTR_fx->refRot_fx.z_qfact );
    free(pOTR_fx);
    return error_fx;
#else
    return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos );
#endif
+292 −143

File changed.

Preview size limit exceeded, changes collapsed.

+23 −0
Original line number Diff line number Diff line
@@ -1791,6 +1791,13 @@ void QuaternionInverse_fx(
  const IVAS_QUATERNION_FX q,
  IVAS_QUATERNION_FX *const r
);

void QuaternionSlerp_fx(
  const IVAS_QUATERNION_FX q1,
  const IVAS_QUATERNION_FX q2,
  const Word32 t,
  IVAS_QUATERNION_FX *const r
);
#endif

/*----------------------------------------------------------------------------------*
@@ -1836,6 +1843,15 @@ ivas_error ivas_orient_trk_Process(

#ifdef IVAS_FLOAT_FIXED

ivas_error ivas_orient_trk_Init_fx(
  ivas_orient_trk_state_t *pOTR                               /* i/o: orientation tracker handle              */
);

ivas_error ivas_orient_trk_SetReferenceRotation_fx(
  ivas_orient_trk_state_t_fx *pOTR_fx,                              /* i/o: orientatoin trakcer handle              */
  const IVAS_QUATERNION_FX refRot                                /* i  : reference rotation                      */
);

ivas_error ivas_orient_trk_SetReferenceVector_fx(
  ivas_orient_trk_state_t_fx *pOTR,                              /* i/o: orientation tracker handle              */
  const IVAS_VECTOR3_FX listenerPos,                             /* i  : Listener position                       */
@@ -1856,6 +1872,13 @@ ivas_error ivas_orient_trk_GetTrackedRotation_fx(
  ivas_orient_trk_state_t_fx *pOTR,                              /* i/o: orientation tracker handle              */
  IVAS_QUATERNION_FX *pRotation                                  /* i/o: processed rotation                      */
);

ivas_error ivas_orient_trk_Process_fx(
  ivas_orient_trk_state_t *pOTR,                              /* i/o: orientation tracker handle              */
  IVAS_QUATERNION absRot,                                     /* i  : absolute head rotation                  */
  float updateRate,                                           /* i  : rotation update rate [Hz]               */
  IVAS_QUATERNION *pTrkRot                                    /* o  : tracked rotation                        */
);
#endif

/*----------------------------------------------------------------------------------*
+7 −1
Original line number Diff line number Diff line
@@ -136,12 +136,18 @@ ivas_error ivas_headTrack_open(
    {
      return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking");
    }
#endif

    if ((error = ivas_orient_trk_Init_fx((*hHeadTrackData)->OrientationTracker)) != IVAS_ERR_OK)
    {
      return error;
    }

#else
    if ( ( error = ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#endif

    /* Initialise Rmat_prev to I, Rmat will be computed later */
    for ( i = 0; i < 3; i++ )
Loading