Commit c1229fde authored by multrus's avatar multrus
Browse files

Merge branch '20230329_cleanup' into 'main'

20230329 cleanup

See merge request !519
parents 11c50c98 1b51d02b
Loading
Loading
Loading
Loading
Loading
+4 −189
Original line number Diff line number Diff line
@@ -42,9 +42,7 @@
#include "ls_custom_file_reader.h"
#include "hrtf_file_reader.h"
#include "head_rotation_file_reader.h"
#ifdef OTR_REFERENCE_VECTOR_TRACKING
#include "vector3_pair_file_reader.h"
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
#include "jbm_file_writer.h"
#include "evs_rtp_payload.h"
#ifdef DEBUGGING
@@ -72,18 +70,11 @@ static
#define MAX_NUM_OUTPUT_CHANNELS    16
#define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE )

#ifdef FIX_I109_ORIENTATION_TRACKING
#define IVAS_PUBLIC_ORIENT_TRK_NONE        ( 0 )
#define IVAS_PUBLIC_ORIENT_TRK_REF         ( 1 )
#define IVAS_PUBLIC_ORIENT_TRK_AVG         ( 2 )
#ifdef OTR_REFERENCE_VECTOR_TRACKING
#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC     ( 3 )
#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 )
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
#else
#define IVAS_PUBLIC_ORIENT_TRK_REF 0
#define IVAS_PUBLIC_ORIENT_TRK_AVG 1
#endif

typedef struct
{
@@ -97,14 +88,10 @@ typedef struct
    bool voipMode;
    bool enableHeadRotation;
    char *headrotTrajFileName;
#ifdef FIX_I109_ORIENTATION_TRACKING
    bool enableReferenceRotation;
    char *refrotTrajFileName;
#endif
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    bool enableReferenceVectorTracking;
    char *referenceVectorTrajFileName;
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
#ifdef SUPPORT_JBM_TRACEFILE
    char *jbmTraceFilename;
#endif
@@ -140,15 +127,7 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef FIX_I109_ORIENTATION_TRACKING
#ifdef OTR_REFERENCE_VECTOR_TRACKING
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#else /* OTR_REFERENCE_VECTOR_TRACKING */
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
@@ -174,12 +153,8 @@ int main(
    LsCustomFileReader *hLsCustomReader = NULL;
    hrtfFileReader *hrtfReader = NULL;
    HeadRotFileReader *headRotReader = NULL;
#ifdef FIX_I109_ORIENTATION_TRACKING
    HeadRotFileReader *refRotReader = NULL;
#endif
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    Vector3PairFileReader *referenceVectorReader = NULL;
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
    ivas_error error = IVAS_ERR_UNKNOWN;
    int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE];
    RenderConfigReader *renderConfigReader = NULL;
@@ -289,7 +264,6 @@ int main(
        }
    }

#ifdef FIX_I109_ORIENTATION_TRACKING
    /*------------------------------------------------------------------------------------------*
     * Open reference rotation file
     *------------------------------------------------------------------------------------------*/
@@ -301,8 +275,6 @@ int main(
            goto cleanup;
        }
    }
#endif
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    /*------------------------------------------------------------------------------------------*
     * Open reference vector trajectory file
     *------------------------------------------------------------------------------------------*/
@@ -314,7 +286,6 @@ int main(
            goto cleanup;
        }
    }
#endif /* OTR_REFERENCE_VECTOR_TRACKING */

    /*------------------------------------------------------------------------------------------*
     * Open custom loudspeaker layout file
@@ -459,17 +430,9 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

        /* sanity check */
#ifdef TD5
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
#ifdef TD5
            fprintf( stderr, "\nExternal Renderer Config is supported only for BINAURAL and BINAURAL_ROOM. Exiting. \n\n" );
#else
            fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n\n" );
#endif
            goto cleanup;
        }

@@ -572,15 +535,7 @@ int main(
    }
    else
    {
#ifdef FIX_I109_ORIENTATION_TRACKING
#ifdef OTR_REFERENCE_VECTOR_TRACKING
        error = decodeG192( arg, hBsReader, headRotReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf );
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
#else
        error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -636,12 +591,8 @@ cleanup:
    CustomLsReader_close( &hLsCustomReader );
    hrtfFileReader_close( &hrtfReader );
    HeadRotationFileReader_close( &headRotReader );
#ifdef FIX_I109_ORIENTATION_TRACKING
    HeadRotationFileReader_close( &refRotReader );
#endif
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    Vector3PairFileReader_close( &referenceVectorReader );
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
    RenderConfigReader_close( &renderConfigReader );

    if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK )
@@ -778,17 +729,11 @@ static bool parseCmdlIVAS_dec(

    arg->enableHeadRotation = false;
    arg->headrotTrajFileName = NULL;
#ifdef FIX_I109_ORIENTATION_TRACKING
    arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE;
    arg->enableReferenceRotation = false;
    arg->headrotTrajFileName = NULL;
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    arg->enableReferenceVectorTracking = false;
    arg->referenceVectorTrajFileName = NULL;
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
#else
    arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF;
#endif

#ifdef SUPPORT_JBM_TRACEFILE
    arg->jbmTraceFilename = NULL;
@@ -963,27 +908,16 @@ static bool parseCmdlIVAS_dec(
        }
        else if ( strcmp( argv_to_upper, "-OTR" ) == 0 )
        {
#ifndef FIX_I109_ORIENTATION_TRACKING
            if ( strlen( argv[i + 1] ) > 3 )
            {
                fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] );
                usage_dec();
                return false;
            }
#endif

            strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            to_upper( argv_to_upper );

#ifdef FIX_I109_ORIENTATION_TRACKING
            if ( strcmp( argv_to_upper, "NONE" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE;
            }
            else
#endif
                if ( strcmp( argv_to_upper, "REF" ) == 0 )
            else if ( strcmp( argv_to_upper, "REF" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF;
            }
@@ -991,7 +925,6 @@ static bool parseCmdlIVAS_dec(
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG;
            }
#ifdef OTR_REFERENCE_VECTOR_TRACKING
            else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC;
@@ -1000,7 +933,6 @@ static bool parseCmdlIVAS_dec(
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV;
            }
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
            else
            {
                fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] );
@@ -1009,7 +941,6 @@ static bool parseCmdlIVAS_dec(
            }
            i += 2;
        }
#ifdef FIX_I109_ORIENTATION_TRACKING
        else if ( strcmp( argv_to_upper, "-RF" ) == 0 )
        {
            arg->enableReferenceRotation = true;
@@ -1025,8 +956,6 @@ static bool parseCmdlIVAS_dec(
            arg->refrotTrajFileName = argv[i];
            i++;
        }
#endif
#ifdef OTR_REFERENCE_VECTOR_TRACKING
        else if ( strcmp( argv_to_upper, "-RVF" ) == 0 )
        {
            arg->enableReferenceVectorTracking = true;
@@ -1042,7 +971,6 @@ static bool parseCmdlIVAS_dec(
            arg->referenceVectorTrajFileName = argv[i];
            i++;
        }
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
        else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 )
        {
            arg->renderConfigEnabled = true;
@@ -1235,17 +1163,11 @@ static void usage_dec( void )
    fprintf( stdout, "                      default is OFF, if this option is not used\n" );
    fprintf( stdout, "-force R            : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" );
#endif
#ifdef FIX_I109_ORIENTATION_TRACKING
    fprintf( stdout, "-otr tracking_type  : head orientation tracking type: 'none', 'ref' or 'avg'  (only for binaural rendering)\n" );
    fprintf( stdout, "-rf File            : Reference rotation specified by external trajectory file\n" );
    fprintf( stdout, "                      works only in combination with -otr ref mode\n" );
#else
    fprintf( stdout, "-otr tracking_type  : head orientation tracking type: 'ref' or 'avg'  (only for binaural rendering)\n" );
#endif
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    fprintf( stdout, "-rvf File           : Reference vector specified by external trajectory file\n" );
    fprintf( stdout, "                      works only in combination with -otr ref_vec and ref_vec_lev modes\n" );
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
    fprintf( stdout, "-render_config file : Renderer configuration file\n" );
    fprintf( stdout, "-no_diegetic_pan    : panning mono no dietic sound to stereo -1<= pan <=1,\n" );
    fprintf( stdout, "                      left or l or 1->left, right or r or -1->right, center or c or  0->middle\n" );
@@ -1295,7 +1217,6 @@ static ivas_error initOnFirstGoodFrame(
    ivas_error error = IVAS_ERR_UNKNOWN;

    /* Now delay, number of output channels and frame size are known */
#ifdef FIX_371_DELAY_REPORT
    if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
@@ -1304,35 +1225,9 @@ static ivas_error initOnFirstGoodFrame(

    if ( !arg.delayCompensationEnabled )
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        pFullDelayNumSamples[0] = 0;
#else
        *pFullDelayNumSamples = 0;
#endif
    }
#else
    if ( arg.delayCompensationEnabled )
    {
        if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
            return error;
        }
    }
    else
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        pFullDelayNumSamples[0] = 0;
#else
        *pFullDelayNumSamples = 0;
#endif
    }
#endif
#ifdef BINAURALIZATION_DELAY_REPORT
    *pRemainingDelayNumSamples = pFullDelayNumSamples[0];
#else
    *pRemainingDelayNumSamples = *pFullDelayNumSamples;
#endif

    if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK )
    {
@@ -1479,12 +1374,8 @@ static ivas_error decodeG192(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
    HeadRotFileReader *headRotReader,
#ifdef FIX_I109_ORIENTATION_TRACKING
    HeadRotFileReader *refRotReader,
#ifdef OTR_REFERENCE_VECTOR_TRACKING
    Vector3PairFileReader *referenceVectorReader,
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
#endif
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )

@@ -1502,19 +1393,13 @@ static ivas_error decodeG192(
    int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */
    int16_t nOutChannels = 0;
    int16_t delayNumSamples = -1;
#ifdef BINAURALIZATION_DELAY_REPORT
    int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */
#else
    int16_t delayNumSamples_orig = 0;
#endif
    int16_t nOutSamples = 0;
    int32_t delayTimeScale = 0;
    ivas_error error = IVAS_ERR_UNKNOWN;
    uint16_t numObj = 0;
    IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
#ifdef TD5
    IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
#endif

    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -1532,9 +1417,7 @@ static ivas_error decodeG192(
        fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" );
    }

#ifdef BINAURALIZATION_DELAY_REPORT
    delayNumSamples_orig[0] = -1;
#endif

#ifdef WMOPS
    reset_stack();
@@ -1584,8 +1467,6 @@ static ivas_error decodeG192(
            goto cleanup;
        }

#ifdef FIX_I109_ORIENTATION_TRACKING
#ifdef OTR_REFERENCE_VECTOR_TRACKING
        /* reference vector */
        if ( arg.enableReferenceVectorTracking )
        {
@@ -1602,16 +1483,11 @@ static ivas_error decodeG192(
                goto cleanup;
            }
        }
#endif /* OTR_REFERENCE_VECTOR_TRACKING */
        /* Reference rotation */
        if ( arg.enableReferenceRotation )
        {
            IVAS_QUATERNION quaternion;
#ifdef TD5
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
#else
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
@@ -1623,42 +1499,21 @@ static ivas_error decodeG192(
                goto cleanup;
            }
        }
#endif
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef FIX_I109_ORIENTATION_TRACKING
            for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
            {
#ifdef TD5
                if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
#else
                if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i] ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) );
                    goto cleanup;
                }
            }
#else
#ifdef TD5
            if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, Pos ) ) != IVAS_ERR_OK )
#else
            if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) );
                goto cleanup;
            }
#endif

#ifdef TD5
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
@@ -1688,11 +1543,7 @@ static ivas_error decodeG192(
                    arg,
                    numInitialBadFrames,
                    nOutSamples,
#ifdef BINAURALIZATION_DELAY_REPORT
                    delayNumSamples_orig,
#else
                    &delayNumSamples_orig,
#endif
                    &delayNumSamples,
                    &delayTimeScale,
                    &bsFormat,
@@ -1806,13 +1657,8 @@ static ivas_error decodeG192(
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/

#ifdef BINAURALIZATION_DELAY_REPORT
    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
#else
    memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
@@ -1824,21 +1670,13 @@ static ivas_error decodeG192(

    if ( !arg.quietModeEnabled )
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        printf( "\n\nDecoder+renderer delay: %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale );

        if ( delayNumSamples_orig[2] > 0 )
        {
            printf( "HRIR/BRIR delay:        %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale );
#ifdef FIX_371_DELAY_REPORT
            printf( "Total delay:            %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale );
#else
            printf( "Total delay:            %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale );
#endif
        }
#else
        fprintf( stdout, "\nDecoder delay:          %-5u [samples]  - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale );
#endif
    }

    /* Print output metadata file name(s) */
@@ -2027,11 +1865,7 @@ static ivas_error decodeVoIP(
#endif
    JbmOffsetFileWriter *jbmOffsetWriter = NULL;

#ifdef BINAURALIZATION_DELAY_REPORT
    int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */
#else
    int16_t delayNumSamples_orig = -1;
#endif
    int16_t delayNumSamples = -1;
    int32_t delayTimeScale = -1;

@@ -2051,9 +1885,7 @@ static ivas_error decodeVoIP(
        ismWriters[i] = NULL;
    }

#ifdef BINAURALIZATION_DELAY_REPORT
    delayNumSamples_orig[0] = -1;
#endif

    rtpdumpDepacker.rtpdump = NULL;
    switch ( arg.inputFormat )
@@ -2250,11 +2082,7 @@ static ivas_error decodeVoIP(
                    arg,
                    numInitialBadFrames,
                    nOutSamples,
#ifdef BINAURALIZATION_DELAY_REPORT
                    delayNumSamples_orig,
#else
                    &delayNumSamples_orig,
#endif
                    &delayNumSamples,
                    &delayTimeScale,
                    &bsFormat,
@@ -2311,13 +2139,8 @@ static ivas_error decodeVoIP(
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/

#ifdef BINAURALIZATION_DELAY_REPORT
    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
#else
    memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
@@ -2329,21 +2152,13 @@ static ivas_error decodeVoIP(

    if ( !arg.quietModeEnabled )
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        printf( "\n\nDecoder+renderer delay: %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale );

        if ( delayNumSamples_orig[2] > 0 )
        {
            printf( "HRIR/BRIR delay:        %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale );
#ifdef FIX_371_DELAY_REPORT
            printf( "Total delay:            %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale );
#else
            printf( "Total delay:            %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale );
#endif
        }
#else
        printf( "\nDecoder delay:       %5u [samples]  - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale );
#endif
    }

    /*------------------------------------------------------------------------------------------*
+0 −15
Original line number Diff line number Diff line
@@ -126,9 +126,7 @@ typedef struct
#endif
#endif
    bool pca;
#ifdef TD5
    bool ism_extended_metadata;
#endif

} EncArguments;

@@ -381,11 +379,7 @@ int main(
            }
            break;
        case IVAS_ENC_INPUT_ISM:
#ifdef TD5
            if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects, arg.ism_extended_metadata ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
@@ -883,9 +877,7 @@ static void initArgStruct( EncArguments *arg )
    arg->caConfig = IVAS_ENC_GetDefaultChannelAwareConfig();
    arg->ca_config_file = NULL;
    arg->mimeOutput = false;
#ifdef TD5
    arg->ism_extended_metadata = false;
#endif

#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
@@ -1273,13 +1265,11 @@ static bool parseCmdlIVAS_enc(

            if ( i < argc - 4 )
            {
#ifdef TD5
                if ( argv[i][0] == '+' )
                {
                    argv[i]++;
                    arg->ism_extended_metadata = true;
                }
#endif
                if ( !is_digits_only( argv[i] ) )
                {
                    fprintf( stderr, "Error: Number of ISM channels must be an integer number!\n\n" );
@@ -1660,14 +1650,9 @@ static void usage_enc( void )
    fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" );
    fprintf( stdout, "-stereo [Mode]      : Stereo format, default is unified stereo \n" );
    fprintf( stdout, "                      optional for Mode: 1: DFT Stereo, 2: TD Stereo, 3: MDCT Stereo\n" );
#ifdef TD5
    fprintf( stdout, "-ism (+)Ch Files    : ISM format \n" );
    fprintf( stdout, "                      where Ch specifies the number of ISMs (1-4)\n" );
    fprintf( stdout, "                      where positive (+) means extended metadata format is used (including orientation and radius) \n" );
#else
    fprintf( stdout, "-ism Channels Files : ISM format \n" );
    fprintf( stdout, "                      where Channels specifies the number of ISMs (1-4)\n" );
#endif
    fprintf( stdout, "                      and Files specify input files containing metadata, one file per object\n" );
    fprintf( stdout, "                      (use NULL for no input metadata)\n" );
    fprintf( stdout, "-sba +/-Order       : Scene Based Audio input format (Ambisonics ACN/SN3D),\n" );
+0 −140

File changed.

Preview size limit exceeded, changes collapsed.

+0 −10
Original line number Diff line number Diff line
@@ -78,10 +78,8 @@ typedef struct _IVAS_ISM_METADATA
    float radius;
    float spread;
    float gainFactor;
#ifdef TD5
    float yaw;
    float pitch;
#endif
} IVAS_ISM_METADATA;

typedef struct
@@ -90,20 +88,16 @@ typedef struct

} IVAS_QUATERNION;

#ifdef OTR_REFERENCE_VECTOR_TRACKING
typedef struct
{
    float x, y, z;
} IVAS_VECTOR3;
#endif /* OTR_REFERENCE_VECTOR_TRACKING */

#ifdef TD5
typedef struct
{
    float x, y, z;

} IVAS_POSITION;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
#ifdef FIX_350_MASA_DELAY_COMP
@@ -130,11 +124,9 @@ typedef struct
{
    float azimuth;
    float elevation;
#ifdef TD5
    float radius;
    float yaw;
    float pitch;
#endif
} IVAS_REND_AudioObjectPosition;

typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
@@ -156,9 +148,7 @@ typedef struct _IVAS_RENDER_CONFIG
    IVAS_RENDER_TYPE_OVERRIDE renderer_type_override;
#endif
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics;
#ifdef TD5
    float directivity[3];
#endif
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

typedef struct _IVAS_LS_CUSTOM_LAYOUT
+0 −8
Original line number Diff line number Diff line
@@ -55,10 +55,6 @@ int32_t get_delay(
    const int32_t io_fs,            /* i  : input/output sampling frequency     */
    const IVAS_FORMAT ivas_format,  /* i  : IVAS format                         */
    HANDLE_CLDFB_FILTER_BANK hCldfb /* i  : Handle of Cldfb analysis            */
#ifndef BINAURALIZATION_DELAY_REPORT
    ,
    const int32_t binaural_latency_ns /* i  : binaural renderer HRTF delay in ns  */
#endif
)
{
    int32_t delay = 0;
@@ -110,10 +106,6 @@ int32_t get_delay(
                delay += IVAS_FB_DEC_DELAY_NS;
            }

#ifndef BINAURALIZATION_DELAY_REPORT
            /* compensate for binauralization delay */
            delay += binaural_latency_ns;
#endif

#ifdef FIX_350_MASA_DELAY_COMP
            if ( ivas_format == MASA_FORMAT )
Loading