Commit 8814aa8a authored by Malenovsky, Vladimir's avatar Malenovsky, Vladimir
Browse files

set default head pose in case -T head_rot_file is not provided

parent 3db57156
Loading
Loading
Loading
Loading
Loading
+24 −14
Original line number Diff line number Diff line
@@ -1299,35 +1299,45 @@ int main(
        /* Convert from int to float and from interleaved to packed */
        convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, num_in_channels, inFloatBuffer );

        int16_t num_subframes, sf_idx;
        int16_t num_subframes;
        num_subframes = (int16_t) args.render_framesize;

        /* Read from head rotation trajectory file if specified */
        IVAS_QUATERNION headRot[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
        IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
        if ( headRotReader != NULL )
        {
            for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
            for ( i = 0; i < num_subframes; i++ )
            {
                IVAS_QUATERNION headRot;
                IVAS_VECTOR3 Pos;

                if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK )
                if ( ( error = HeadRotationFileReading( headRotReader, &headRot[i], &Pos[i] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }

                if ( ( error = ISAR_POST_REND_SetHeadRotation( hIsarPostRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }
            }
        }
        else
        {
            fprintf( stderr, "\nHead Rotation should be enabled in post renderer\n" );
            for ( i = 0; i < num_subframes; i++ )
            {
                headRot[i].w = -3.0f;
                headRot[i].x = 0.0f;
                headRot[i].y = 0.0f;
                headRot[i].z = 0.0f;
                Pos[i].x = 0.0f;
                Pos[i].y = 0.0f;
                Pos[i].z = 0.0f;
            }
        }

        for ( i = 0; i < num_subframes; i++ )
        {
            if ( ( error = ISAR_POST_REND_SetHeadRotation( hIsarPostRend, headRot[i], Pos[i], DEFAULT_AXIS, i ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
        }
    
        /* Read from split renderer bfi file if specified */
        if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame )