Commit e4cddc90 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '500-head-tracking-api-causes-extra-15ms-of-delay' of...

Merge branch '500-head-tracking-api-causes-extra-15ms-of-delay' of forge.3gpp.org:ivas-codec-pc/ivas-codec into 500-head-tracking-api-causes-extra-15ms-of-delay
parents 67e35f00 ae7a09c9
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -3611,7 +3611,12 @@ static ivas_error evs_dec_main(


#ifdef API_5MS
    if ( !st_ivas->hDecoderConfig->Opt_tsm )
    if ( !st_ivas->hDecoderConfig->Opt_tsm
#ifdef API_5MS_BASELINE
        && st_ivas->hDecoderConfig->Opt_5ms
#endif

    )
    {
        ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples );
    }
+52 −17
Original line number Diff line number Diff line
@@ -923,8 +923,10 @@ ivas_error ivas_combined_orientation_open(
#ifdef API_5MS
    ( *hCombinedOrientationData )->enableCombinedOrientation = 0;
    ( *hCombinedOrientationData )->Quaternion = identity;
#ifndef FIX_570_SF_EXT_ORIENTATION
    ( *hCombinedOrientationData )->Quaternion_prev_headRot = identity;
    ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity;
#endif
    ( *hCombinedOrientationData )->listenerPos = origo;

    for ( j = 0; j < 3; j++ )
@@ -1264,6 +1266,23 @@ ivas_error combine_external_and_head_orientations(
        /* External orientations */
#ifdef API_5MS

#ifdef FIX_570_SF_EXT_ORIENTATION
        /* Check for frozen external orientation */
        if ( hExtOrientationData->enableExternalOrientation == 2 )
        {
            if ( hCombinedOrientationData->isExtOrientationFrozen != 1 )
            {
                hCombinedOrientationData->Quaternion_frozen_ext = hExtOrientationData->Quaternion;
                hCombinedOrientationData->isExtOrientationFrozen = 1;
            }
        }
        else
        {
            hCombinedOrientationData->Quaternion_frozen_ext = identity;
            hCombinedOrientationData->isExtOrientationFrozen = 0;
        }
#endif

        if ( hExtOrientationData->enableRotationInterpolation == 1 && hExtOrientationData->enableExternalOrientation > 0 )
        {
            if ( hCombinedOrientationData->isInterpolationOngoing == TRUE && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternion ) == true )
@@ -1293,7 +1312,11 @@ ivas_error combine_external_and_head_orientations(
            /* Use the freezed external orientation */
            else if ( hExtOrientationData->enableExternalOrientation == 2 )
            {
#ifdef FIX_570_SF_EXT_ORIENTATION
                hCombinedOrientationData->Quaternion = hCombinedOrientationData->Quaternion_frozen_ext;
#else
                hCombinedOrientationData->Quaternion = hCombinedOrientationData->Quaternion_prev_extOrientation;
#endif
            }
        }
#else
@@ -1364,25 +1387,34 @@ ivas_error combine_external_and_head_orientations(
    {
        /* Combine head and external orientations */
#ifdef API_5MS
#ifdef FIX_570_SF_EXT_ORIENTATION
        /* Check for frozen head rotation */
        if ( hExtOrientationData->enableHeadRotation == 2 )
        {
            if ( hCombinedOrientationData->isHeadRotationFrozen != 1 )
            {
                hCombinedOrientationData->Quaternion_frozen_head = *headRotQuaternion;
                hCombinedOrientationData->isHeadRotationFrozen = 1;
            }
        }
        else
        {
            hCombinedOrientationData->Quaternion_frozen_head = identity;
            hCombinedOrientationData->isHeadRotationFrozen = 0;
        }
#endif


        /* Use the most recent head rotation */
        if ( hExtOrientationData->enableHeadRotation == 1 )
        {
            if ( hExtOrientationData->enableExternalOrientation > 0 )
            {
#ifdef API_5MS
                QuaternionProduct( hCombinedOrientationData->Quaternion, *headRotQuaternion, &hCombinedOrientationData->Quaternion );
#else
                QuaternionProduct( hCombinedOrientationData->Quaternion, *headRotQuaternions, &hCombinedOrientationData->Quaternion );
#endif
            }
            else
            {
#ifdef API_5MS
                hCombinedOrientationData->Quaternion = *headRotQuaternion;
#else
                hCombinedOrientationData->Quaternion = *headRotQuaternions;
#endif
            }
        }
        /* Use the freezed head rotation */
@@ -1390,11 +1422,19 @@ ivas_error combine_external_and_head_orientations(
        {
            if ( hExtOrientationData->enableExternalOrientation > 0 )
            {
#ifdef FIX_570_SF_EXT_ORIENTATION
                QuaternionProduct( hCombinedOrientationData->Quaternion, hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternion );
#else
                QuaternionProduct( hCombinedOrientationData->Quaternion, hCombinedOrientationData->Quaternion_prev_headRot, &hCombinedOrientationData->Quaternion );
#endif
            }
            else
            {
#ifdef FIX_570_SF_EXT_ORIENTATION
                hCombinedOrientationData->Quaternion = hCombinedOrientationData->Quaternion_frozen_head;
#else
                hCombinedOrientationData->Quaternion = hCombinedOrientationData->Quaternion_prev_headRot;
#endif
            }
        }

@@ -1494,7 +1534,7 @@ ivas_error combine_external_and_head_orientations(
        {
            hCombinedOrientationData->Quaternion_prev_extOrientation = identity;
        }
#elif defined FIX_570_SF_EXT_ORIENTATION /* ToDo: ensure FIX_570_SF_EXT_ORIENTATION is correctly included in API_5MS */
#elif defined FIX_570_SF_EXT_ORIENTATION
        if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 )
        {
            hCombinedOrientationData->Quaternion_prev_extOrientation = hExtOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1];
@@ -1524,15 +1564,12 @@ ivas_error combine_external_and_head_orientations(
#endif
    {
#ifdef API_5MS
#ifndef FIX_570_SF_EXT_ORIENTATION
        if ( hExtOrientationData != NULL )
        {
            if ( hExtOrientationData->enableHeadRotation > 0 )
            {
#ifdef API_5MS
                hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternion;
#else
                hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternions;
#endif
            }
            else
            {
@@ -1541,12 +1578,10 @@ ivas_error combine_external_and_head_orientations(
        }
        else
        {
#ifdef API_5MS
            hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternion;
#else
            hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternions;
#endif

        }
#endif
        hCombinedOrientationData->listenerPos = *listenerPos;

#else
+2 −0
Original line number Diff line number Diff line
@@ -905,7 +905,9 @@ typedef struct ivas_combined_orientation_struct
    bool isInterpolationOngoing;
#ifdef API_5MS
    IVAS_QUATERNION Quaternion;
#ifndef FIX_570_SF_EXT_ORIENTATION
    IVAS_QUATERNION Quaternion_prev_headRot;
#endif
    IVAS_QUATERNION Quaternion_prev_extOrientation;
#else
    IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES];