Commit cad37be1 authored by Lauros Pajunen's avatar Lauros Pajunen
Browse files

Remove ext orientation reset function, set ext orientations to identity at the end of combination

parent 9f398b7c
Loading
Loading
Loading
Loading
Loading
+10 −44
Original line number Diff line number Diff line
@@ -56,9 +56,6 @@ static void external_target_interpolation( EXTERNAL_ORIENTATION_HANDLE hExtOrien

static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 );

#ifdef IVAS_RTPDUMP
static void ivas_external_orientation_reset( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData );
#endif

/*-----------------------------------------------------------------------*
 * ivas_headTrack_open()
@@ -696,7 +693,6 @@ ivas_error ivas_external_orientation_open(
    const int16_t num_subframes                       /* i  : number of subframes            */
)
{
#ifndef IVAS_RTPDUMP

    int16_t i;
    IVAS_QUATERNION identity;
@@ -704,50 +700,13 @@ ivas_error ivas_external_orientation_open(
    identity.w = 1.0f;
    identity.x = identity.y = identity.z = 0.0f;

#endif
    /* Allocate handle */
    if ( ( *hExtOrientationData = (EXTERNAL_ORIENTATION_HANDLE) malloc( sizeof( EXTERNAL_ORIENTATION_DATA ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for external orientation memory\n" ) );
    }
    ( *hExtOrientationData )->num_subframes = num_subframes;
#ifdef IVAS_RTPDUMP
    ivas_external_orientation_reset( hExtOrientationData );
#else
    /* Enable head rotation and disable external orientation as default */
    for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
    {
        ( *hExtOrientationData )->enableHeadRotation[i] = 1;
        ( *hExtOrientationData )->enableExternalOrientation[i] = 0;
        ( *hExtOrientationData )->enableRotationInterpolation[i] = 0;
        ( *hExtOrientationData )->numFramesToTargetOrientation[i] = 0;
        ( *hExtOrientationData )->Quaternions[i] = identity;
    }
#endif
    return IVAS_ERR_OK;
}


#ifdef IVAS_RTPDUMP
/*-----------------------------------------------------------------------*
 * ivas_external_orientation_reset()
 *
 * Reset external orientation values
 *-----------------------------------------------------------------------*/

static void ivas_external_orientation_reset(
    EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* i/o  : external orientation handle    */
)
{
    if ( *hExtOrientationData != NULL )
    {
        int16_t i;
        IVAS_QUATERNION identity;

        identity.w = 1.0f;
        identity.x = 0.0f;
        identity.y = 0.0f;
        identity.z = 0.0f;
    /* Enable head rotation and disable external orientation as default */
    for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
    {
@@ -757,11 +716,11 @@ static void ivas_external_orientation_reset(
        ( *hExtOrientationData )->numFramesToTargetOrientation[i] = 0;
        ( *hExtOrientationData )->Quaternions[i] = identity;
    }
    }

    return IVAS_ERR_OK;
}


#endif
/*-----------------------------------------------------------------------*
 * ivas_external_orientation_close()
 *
@@ -1288,7 +1247,14 @@ ivas_error combine_external_and_head_orientations(
    hCombinedOrientationData->cur_subframe_samples_rendered_start = 0;

#ifdef IVAS_RTPDUMP
    ivas_external_orientation_reset( &hExtOrientationData );
    /* Reset external orientations */
    if ( hExtOrientationData != NULL )
    {
        for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ )
        {
            hExtOrientationData->Quaternions[i] = identity;
        }
    }
#endif
    return IVAS_ERR_OK;
}