Commit 3d9a3ebf authored by bayers's avatar bayers
Browse files

move orientation reading if the JBM flush part to the correct place, unset #DISABLE_LIMITER

parent 78c3bc7c
Loading
Loading
Loading
Loading
Loading
+122 −58
Original line number Diff line number Diff line
@@ -3497,64 +3497,6 @@ static ivas_error decodeVoIP(
    do
    {


        /* Feed into decoder */

        /* reference vector */
        if ( arg.enableReferenceVectorTracking )
        {
            IVAS_VECTOR3 listenerPosition, referencePosition;
            if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) );
                goto cleanup;
            }

            if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* Reference rotation */
        if ( arg.enableReferenceRotation )
        {
            IVAS_QUATERNION quaternion;
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
            }

            if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
            IVAS_QUATERNION Quaternion;
            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos[0] ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                goto cleanup;
            }

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0 ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* decode and get samples */
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
@@ -3633,6 +3575,128 @@ static ivas_error decodeVoIP(
            }
#endif
        }

#ifdef NONBE_UNIFIED_DECODING_PATHS
        /* reference vector */
        if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 )
        {
            IVAS_VECTOR3 listenerPosition, referencePosition;
            if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) );
                goto cleanup;
            }

            if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* Reference rotation */
        if ( arg.enableReferenceRotation && vec_pos_update == 0 )
        {
            IVAS_QUATERNION quaternion;
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
            }

            if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }
        int16_t num_subframes;
        if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" );
            goto cleanup;
        }

        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( headRotReader == NULL )
            {
                for ( i = 0; i < num_subframes; i++ )
                {
                    Quaternions[i].w = -3.0f;
                    Quaternions[i].x = 0.0f;
                    Quaternions[i].y = 0.0f;
                    Quaternions[i].z = 0.0f;
                    Pos[i].x = 0.0f;
                    Pos[i].y = 0.0f;
                    Pos[i].z = 0.0f;
                }
            }
            else
            {
#endif
                for ( i = 0; i < num_subframes; i++ )
                {
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                                 RotationFileReader_getFilePath( headRotReader ) );
                        goto cleanup;
                    }
                }
#ifdef SPLIT_REND_WITH_HEAD_ROT
            }
#endif

            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                           ,
                                                           DEFAULT_AXIS
#endif
                                                           ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }
            }
        }

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            for ( i = 0; i < num_subframes; i++ )
            {

                if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                             RotationFileReader_getFilePath( externalOrientationFileReader ) );
                    goto cleanup;
                }
            }
            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }
            }
        }
#endif

    } while ( nSamplesFlushed > 0 );
#endif

+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@
/*#define DEBUG_AGC_ENCODER_CMD_OPTION*/        /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */
/*#define DEBUG_JBM_CMD_OPTION*/                /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */
/*#define VARIABLE_SPEED_DECODING*/             /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */
#define DISABLE_LIMITER                         /* disable the limiter */
/*#define DISABLE_LIMITER*/                     /* disable the limiter */

/*Split Rendering Debug switches*/
/*#define DBG_WAV_WRITER*/                      /* add debugging function dbgwrite_wav() */