Commit 788123e0 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Further merge-related fixes

parent 0bcb8dd2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5731,7 +5731,7 @@ ivas_error ivas_orient_trk_GetTrackedRotation(
#ifdef FIX_I109_ORIENTATION_TRACKING
ivas_error ivas_orient_trk_Process(
    ivas_orient_trk_state_t *pOTR,      /* i/o  : orientation tracker handle    */
    const IVAS_QUATERNION *absRot,      /* i    : absolute head rotation        */
    const IVAS_QUATERNION *pAbsRot,     /* i    : absolute head rotation        */
    float updateRate,                   /* i    : rotation update rate [Hz]     */
    IVAS_QUATERNION *pTrkRot            /* o    : tracked rotation              */
);
+7 −7
Original line number Diff line number Diff line
@@ -482,7 +482,7 @@ void ObjRenderIVASFrame(
#else
        if ( st_ivas->hHeadTrackData != NULL )
        {
            if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK )
            if ( ivas_orient_trk_Process( st_ivas->hHeadTrackData->OrientationTracker, &st_ivas->hHeadTrackData->Quaternions[subframe_idx], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &trackedHeadOrientation ) != IVAS_ERR_OK )
            {
                exit( -1 );
            }
@@ -956,10 +956,10 @@ ivas_error ivas_rend_TDObjRenderFrame(
#ifdef FIX_198_TDREND_INTERFACE
    AUDIO_CONFIG transport_config;
    int32_t output_Fs;
#endif

#else
#ifdef FIX_I109_ORIENTATION_TRACKING
    IVAS_QUATERNION trackedHeadOrientation;
#endif
#endif

    push_wmops( "ivas_rend_TDObjRenderFrame" );
@@ -1009,7 +1009,7 @@ ivas_error ivas_rend_TDObjRenderFrame(
                               output, output_frame
#ifdef FIX_I109_ORIENTATION_TRACKING
                               ,
                               NULL // TODO @Philips check if orientation tracking already done before renderer calls this function
                               headRotData->hOrientationTracker // TODO @Philips check if orientation tracking already done before renderer calls this function
#endif
                                );

@@ -1040,7 +1040,7 @@ ivas_error ivas_rend_TDObjRenderFrame(
        if ( headRotData->headRotEnabled )
        {
            ivas_orient_trk_Process( headRotData->hOrientationTracker,
                                     headRotData->headPositions[subframe_idx],
                                     &headRotData->headPositions[subframe_idx],
                                     FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES,
                                     &trackedHeadOrientation );
        }
+10 −10
Original line number Diff line number Diff line
@@ -442,7 +442,7 @@ ivas_error ivas_orient_trk_SetAbsoluteOrientation(
#ifdef FIX_I109_ORIENTATION_TRACKING
ivas_error ivas_orient_trk_Process(
    ivas_orient_trk_state_t *pOTR,  /* i/o  : orientation tracker handle    */
    const IVAS_QUATERNION *absRot,        /* i    : absolute head rotation        */
    const IVAS_QUATERNION *pAbsRot, /* i    : absolute head rotation        */
    float updateRate,               /* i    : rotation update rate [Hz]     */
    IVAS_QUATERNION *pTrkRot )      /* o    : tracked rotation              */
{
@@ -464,34 +464,34 @@ ivas_error ivas_orient_trk_Process(
    switch ( pOTR->trackingType )
    {
        case OTR_TRACKING_NONE:
            *pTrkRot = *absRot;
            *pTrkRot = *pAbsRot;
            break;

        case OTR_TRACKING_REF_ORIENT:
            /* Reset average orientation   */
            pOTR->absAvgRot = *absRot;
            pOTR->absAvgRot = *pAbsRot;

            /* Reset adaptation filter - start adaptation at center rate */
            pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate );

            /* Compute relative orientation = (absolute orientation) - (reference orientation) */
            QuaternionInverse( pOTR->refRot, pTrkRot );
            QuaternionProduct( *pTrkRot, *absRot, pTrkRot );
            QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot );
            break;

        case OTR_TRACKING_AVG_ORIENT:
            /* Compute average (low-pass filtered) absolute orientation */
            QuaternionSlerp( pOTR->absAvgRot, *absRot, alpha, &pOTR->absAvgRot );
            QuaternionSlerp( pOTR->absAvgRot, *pAbsRot, alpha, &pOTR->absAvgRot );

            /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */
            QuaternionInverse( pOTR->absAvgRot, pTrkRot );
            QuaternionProduct( *pTrkRot, *absRot, pTrkRot );
            QuaternionProduct( *pTrkRot, *pAbsRot, pTrkRot );

            /* Adapt LPF constant based on orientation excursion relative to current mean:
            - low  cutoff (slow adaptation) for small excursions (around center)
            - high cutoff (fast adaptation) for large excursions (off-center)
            */
            ang = QuaternionAngle( *absRot, *pTrkRot );
            ang = QuaternionAngle( *pAbsRot, *pTrkRot );
            normalizedOrientation = ang * ang;

            relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle;