Commit 9cb1618c authored by stoutjesdijk's avatar stoutjesdijk 🎧
Browse files

Merge branch 'FINGERSOFF' into 109-harmonize-head-and-orientation-tracking-tmpmerge

parents 8631ede8 c49a7399
Loading
Loading
Loading
Loading
Loading
+32 −7
Original line number Diff line number Diff line
@@ -654,6 +654,7 @@ int main(
    /* === Configure === */
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error in Renderer Config Init\n" );
        exit( -1 );
    }

@@ -861,7 +862,7 @@ int main(

    if ( !args.quietModeEnabled )
    {
        fprintf( stdout, "\n------ Running the renderer ------\n\n" );
        fprintf( stdout, "\n------ Running the rondoror ------\n\n" );
        fprintf( stdout, "Frames processed:       " );
    }
    else
@@ -901,16 +902,28 @@ int main(
#ifdef FIX_I109_ORIENTATION_TRACKING
            for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ )
            {
                HeadRotationFileReading( headRotReader, &quatBuffer[i] );
                if ( HeadRotationFileReading( headRotReader, &quatBuffer[i] ) != IVAS_ERR_OK )
                {
                    fprintf(stderr, "Error in Head Rotation File Reading.\r\n");
                    exit(-1);
                }
            }
#else
            HeadRotationFileReading( headRotReader, quatBuffer, frame );
#endif
            IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer );
            if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error setting Head Rotation\n" );
                exit(-1);
            }
        }
        else
        {
            IVAS_REND_SetHeadRotation( hIvasRend, NULL );
            if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT) )
            {
                fprintf( stderr, "Error setting Head Rotation\n" );
                exit(-1);
            }
        }

#ifdef FIX_I109_ORIENTATION_TRACKING
@@ -918,8 +931,16 @@ int main(
        if ( referenceRotReader != NULL )
        {
            IVAS_QUATERNION quaternion;
            HeadRotationFileReading( referenceRotReader, &quaternion );
            IVAS_REND_SetReferenceRotation( hIvasRend, quaternion );
            if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK )
            {
                    fprintf(stderr, "Error in Head Rotation File Reading.\r\n");
                    exit(-1);
            }
            if ( IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) != IVAS_ERR_OK )
            {
                    fprintf(stderr, "Error setting Reference Rotation.\r\n");
                    exit(-1);
            }
        }
#endif

@@ -1000,7 +1021,11 @@ int main(
            }
        }

        IVAS_REND_GetSamples( hIvasRend, outBuffer );
        if ( IVAS_REND_GetSamples( hIvasRend, outBuffer ) != IVAS_ERR_OK )
        {
            fprintf(stderr, "Error in getting samples\n");
            exit( -1 );
        }

        int16_t num_out_channels;
        num_out_channels = outBuffer.config.numChannels;
+0 −36
Original line number Diff line number Diff line
@@ -203,39 +203,3 @@ void ivas_HRTF_parambin_binary_close(
    return;
}

#ifndef FIX_I109_ORIENTATION_TRACKING
/*-----------------------------------------------------------------------*
 * ivas_headTrack_open()
 *
 * Allocate and initialize Head-Tracking handle
 *-----------------------------------------------------------------------*/

ivas_error ivas_headTrack_open(
    HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o  : head track handle    */
)
{
    int16_t i;

    /* Allocate Head-Tracking handle */
    if ( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for head-tracking memory\n" ) );
    }

    /* Initialization */
    ( *hHeadTrackData )->num_quaternions = 0;
    ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f;
    ( *hHeadTrackData )->lrSwitchedCurrent = 0;
    ( *hHeadTrackData )->lrSwitchedNext = 0;

    /* Initialise Rmat_prev to I, Rmat will be computed later */
    for ( i = 0; i < 3; i++ )
    {
        set_zero( ( *hHeadTrackData )->Rmat_prev[i], 3 );
        ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f;
    }

    return IVAS_ERR_OK;
}
#endif
+0 −30
Original line number Diff line number Diff line
@@ -410,36 +410,6 @@ typedef struct ivas_reverb_state_t

} REVERB_DATA, *REVERB_HANDLE;

#ifndef FIX_I109_ORIENTATION_TRACKING

typedef struct ivas_orient_trk_state_t
{
    OTR_TRACKING_T trackingType;
    float centerAdaptationRate;
    float offCenterAdaptationRate;
    float adaptationAngle;

    float alpha;

    float absYaw; /* absolute orientation */
    float absPitch;
    float absRoll;

    float absAvgYaw; /* average absolute orientation */
    float absAvgPitch;
    float absAvgRoll;

    float refYaw; /* reference orientation */
    float refPitch;
    float refRoll;

    float trkYaw; /* tracked orientation */
    float trkPitch;
    float trkRoll;

} ivas_orient_trk_state_t;
#endif


/*----------------------------------------------------------------------------------*
 * TD ISm Object Renderer structure
+1 −1
Original line number Diff line number Diff line
@@ -3912,7 +3912,7 @@ ivas_error IVAS_REND_SetHeadRotation(
    if ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL )
    {
        /* Head rotation can be set only with binaural output */
        return IVAS_ERR_METADATA_NOT_EXPECTED;
        return IVAS_ERR_INVALID_OUTPUT_FORMAT;
    }

    if ( headRot == NULL )