Commit a945b39f authored by Vidhya V P's avatar Vidhya V P
Browse files

Merge branch 'main' into 137-sid-5-2-kbps-todos-in-qmetadata

parents f35a6797 96ad022e
Loading
Loading
Loading
Loading
Loading
+0 −155
Original line number Diff line number Diff line
@@ -42,11 +42,7 @@
#include "ism_file_writer.h"
#include "ls_custom_file_reader.h"
#include "hrtf_file_reader.h"
#ifdef EXTERNAL_ORIENTATIONS
#include "rotation_file_reader.h"
#else
#include "head_rotation_file_reader.h"
#endif
#include "vector3_pair_file_reader.h"
#include "jbm_file_writer.h"
#include "evs_rtp_payload.h"
@@ -105,10 +101,8 @@ typedef struct
    char *refrotTrajFileName;
    bool enableReferenceVectorTracking;
    char *referenceVectorTrajFileName;
#ifdef EXTERNAL_ORIENTATIONS
    bool enableExternalOrientation;
    char *externalOrientationTrajFileName;
#endif
#ifdef SUPPORT_JBM_TRACEFILE
    char *jbmTraceFilename;
#endif
@@ -157,19 +151,11 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef EXTERNAL_ORIENTATIONS
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
#ifdef EXTERNAL_ORIENTATIONS
static ivas_error decodeVariableSpeed( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#else
static ivas_error decodeVariableSpeed( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#endif
#endif
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
static int16_t app_own_random( int16_t *seed );
@@ -193,14 +179,9 @@ int main(
    BS_READER_HANDLE hBsReader = NULL;
    LsCustomFileReader *hLsCustomReader = NULL;
    hrtfFileReader *hrtfReader = NULL;
#ifdef EXTERNAL_ORIENTATIONS
    RotFileReader *headRotReader = NULL;
    RotFileReader *externalOrientationFileReader = NULL;
    RotFileReader *refRotReader = NULL;
#else
    HeadRotFileReader *headRotReader = NULL;
    HeadRotFileReader *refRotReader = NULL;
#endif
    Vector3PairFileReader *referenceVectorReader = NULL;
    ivas_error error = IVAS_ERR_UNKNOWN;
    int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE];
@@ -276,11 +257,7 @@ int main(
    if ( arg.hrtfReaderEnabled )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
@@ -302,21 +279,13 @@ int main(
    if ( arg.enableHeadRotation )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }

#ifdef EXTERNAL_ORIENTATIONS
        if ( ( error = RotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK )
#else
        if ( ( error = HeadRotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nError: Can't open head-rotation file %s \n\n", arg.headrotTrajFileName );
            goto cleanup;
@@ -330,11 +299,7 @@ int main(
    if ( arg.enableReferenceRotation )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -347,11 +312,7 @@ int main(
            goto cleanup;
        }

#ifdef EXTERNAL_ORIENTATIONS
        if ( ( error = RotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK )
#else
        if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName );
            goto cleanup;
@@ -365,11 +326,7 @@ int main(
    if ( arg.enableReferenceVectorTracking )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -389,7 +346,6 @@ int main(
        }
    }

#ifdef EXTERNAL_ORIENTATIONS
    /*------------------------------------------------------------------------------------------*
     * Open external orientation file
     *------------------------------------------------------------------------------------------*/
@@ -402,7 +358,6 @@ int main(
            goto cleanup;
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Open custom loudspeaker layout file
@@ -424,11 +379,7 @@ int main(
    if ( arg.renderConfigEnabled )
    {
        /* sanity check */
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -444,11 +395,7 @@ int main(
    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/
#ifdef EXTERNAL_ORIENTATIONS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif

    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -596,17 +543,9 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

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

@@ -657,11 +596,7 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
#endif

        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );

@@ -672,11 +607,7 @@ int main(
        }


#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );

        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
@@ -684,22 +615,14 @@ int main(
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfCRendFileName );
            goto cleanup;
        }
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL;
#else
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
#endif
        IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv );

        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfCRendFileName );
        }
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL;
#else
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin;
#endif
        IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin );

        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
@@ -720,18 +643,14 @@ int main(
    else if ( arg.variableSpeedMode )
    {
        error = decodeVariableSpeed( arg, hBsReader, headRotReader,
#ifdef EXTERNAL_ORIENTATIONS
                                     externalOrientationFileReader,
#endif
                                     refRotReader, referenceVectorReader, hIvasDec );
    }
#endif
    else
    {
        error = decodeG192( arg, hBsReader, headRotReader,
#ifdef EXTERNAL_ORIENTATIONS
                            externalOrientationFileReader,
#endif
                            refRotReader, referenceVectorReader, hIvasDec, pcmBuf );
    }

@@ -777,32 +696,19 @@ cleanup:

    if ( arg.hrtfReaderEnabled )
    {
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
#endif
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
    }
    IVAS_DEC_Close( &hIvasDec );
    CustomLsReader_close( &hLsCustomReader );
    hrtfFileReader_close( &hrtfReader );
#ifdef EXTERNAL_ORIENTATIONS
    RotationFileReader_close( &headRotReader );
    RotationFileReader_close( &externalOrientationFileReader );
    RotationFileReader_close( &refRotReader );
#else
    HeadRotationFileReader_close( &headRotReader );
    HeadRotationFileReader_close( &refRotReader );
#endif
    Vector3PairFileReader_close( &referenceVectorReader );
    RenderConfigReader_close( &renderConfigReader );

@@ -893,7 +799,6 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config(
    {
        output_config = IVAS_DEC_OUTPUT_HOA3;
    }
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    else if ( strcmp( argv_to_upper, "BINAURAL" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL;
@@ -906,16 +811,6 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config(
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB;
    }
#else
    else if ( strcmp( argv_to_upper, "BINAURAL" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL;
    }
    else if ( strcmp( argv_to_upper, "BINAURAL_ROOM" ) == 0 )
    {
        output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM;
    }
#endif
    else
    {
        output_config = IVAS_DEC_OUTPUT_LS_CUSTOM;
@@ -961,10 +856,8 @@ static bool parseCmdlIVAS_dec(
    arg->headrotTrajFileName = NULL;
    arg->enableReferenceVectorTracking = false;
    arg->referenceVectorTrajFileName = NULL;
#ifdef EXTERNAL_ORIENTATIONS
    arg->enableExternalOrientation = false;
    arg->externalOrientationTrajFileName = NULL;
#endif

#ifdef SUPPORT_JBM_TRACEFILE
    arg->jbmTraceFilename = NULL;
@@ -1275,7 +1168,6 @@ static bool parseCmdlIVAS_dec(
            arg->referenceVectorTrajFileName = argv[i];
            i++;
        }
#ifdef EXTERNAL_ORIENTATIONS
        else if ( strcmp( argv_to_upper, "-EXOF" ) == 0 )
        {
            arg->enableExternalOrientation = true;
@@ -1291,7 +1183,6 @@ static bool parseCmdlIVAS_dec(
            arg->externalOrientationTrajFileName = argv[i];
            i++;
        }
#endif
        else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 )
        {
            arg->renderConfigEnabled = true;
@@ -1465,11 +1356,7 @@ static void usage_dec( void )
    fprintf( stdout, "Mandatory parameters:\n" );
    fprintf( stdout, "---------------------\n" );
    fprintf( stdout, "OutputConf           : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" );
#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    fprintf( stdout, "                       HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT\n" );
#else
    fprintf( stdout, "                       HOA2, HOA3, BINAURAL, BINAURAL_ROOM, EXT\n" );
#endif
    fprintf( stdout, "                       By default, channel order and loudspeaker positions are equal to the\n" );
    fprintf( stdout, "                       encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker\n" );
    fprintf( stdout, "                       layout file. See readme.txt for details.\n" );
@@ -1534,9 +1421,7 @@ static void usage_dec( void )
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
#endif
#ifdef EXTERNAL_ORIENTATIONS
    fprintf( stdout, "-exof File          : External orientation file for external orientation trajectory\n" );
#endif
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
    fprintf( stdout, "-info <folder>      : specify subfolder name for debug output\n" );
@@ -1724,14 +1609,9 @@ static ivas_error initOnFirstGoodFrame(
static ivas_error decodeG192(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
#ifdef EXTERNAL_ORIENTATIONS
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
#else
    HeadRotFileReader *headRotReader,
    HeadRotFileReader *refRotReader,
#endif
    Vector3PairFileReader *referenceVectorReader,
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )
@@ -1847,11 +1727,7 @@ static ivas_error decodeG192(
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ),
#ifdef EXTERNAL_ORIENTATIONS
                         RotationFileReader_getFilePath( refRotReader ) );
#else
                         HeadRotationFileReader_getFilePath( refRotReader ) );
#endif
                goto cleanup;
            }

@@ -1871,11 +1747,7 @@ static ivas_error decodeG192(
                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 ),
#ifdef EXTERNAL_ORIENTATIONS
                             RotationFileReader_getFilePath( headRotReader ) );
#else
                             HeadRotationFileReader_getFilePath( headRotReader ) );
#endif
                    goto cleanup;
                }
            }
@@ -1887,7 +1759,6 @@ static ivas_error decodeG192(
            }
        }

#ifdef EXTERNAL_ORIENTATIONS
        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -1913,7 +1784,6 @@ static ivas_error decodeG192(
                goto cleanup;
            }
        }
#endif

        /* Run decoder for one frame (get rendered output) */
        if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK )
@@ -2647,14 +2517,9 @@ cleanup:
static ivas_error decodeVariableSpeed(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
#ifdef EXTERNAL_ORIENTATIONS
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
#else
    HeadRotFileReader *headRotReader,
    HeadRotFileReader *refRotReader,
#endif
    Vector3PairFileReader *referenceVectorReader,
    IVAS_DEC_HANDLE hIvasDec )

@@ -2759,11 +2624,7 @@ static ivas_error decodeVariableSpeed(
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ),
#ifdef EXTERNAL_ORIENTATIONS
                         RotationFileReader_getFilePath( refRotReader ) );
#else
                         HeadRotationFileReader_getFilePath( refRotReader ) );
#endif
                goto cleanup;
            }

@@ -2784,11 +2645,7 @@ static ivas_error decodeVariableSpeed(
                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 ),
#ifdef EXTERNAL_ORIENTATIONS
                             RotationFileReader_getFilePath( headRotReader ) );
#else
                             HeadRotationFileReader_getFilePath( headRotReader ) );
#endif
                    goto cleanup;
                }
            }
@@ -2800,7 +2657,6 @@ static ivas_error decodeVariableSpeed(
            }
        }

#ifdef EXTERNAL_ORIENTATIONS
        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -2826,7 +2682,6 @@ static ivas_error decodeVariableSpeed(
                goto cleanup;
            }
        }
#endif

        /* decode and get samples */
        do
@@ -3050,11 +2905,7 @@ static ivas_error decodeVariableSpeed(
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ),
#ifdef EXTERNAL_ORIENTATIONS
                         RotationFileReader_getFilePath( refRotReader ) );
#else
                         HeadRotationFileReader_getFilePath( refRotReader ) );
#endif
                goto cleanup;
            }

@@ -3074,11 +2925,7 @@ static ivas_error decodeVariableSpeed(
                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 ),
#ifdef EXTERNAL_ORIENTATIONS
                             RotationFileReader_getFilePath( headRotReader ) );
#else
                             HeadRotationFileReader_getFilePath( headRotReader ) );
#endif
                    goto cleanup;
                }
            }
@@ -3090,7 +2937,6 @@ static ivas_error decodeVariableSpeed(
            }
        }

#ifdef EXTERNAL_ORIENTATIONS
        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -3116,7 +2962,6 @@ static ivas_error decodeVariableSpeed(
                goto cleanup;
            }
        }
#endif

        /* decode and get samples */
        if ( ( error = IVAS_DEC_VoIP_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesAvailableNext, &nSamplesFlushed ) ) != IVAS_ERR_OK )
+6 −29
Original line number Diff line number Diff line
@@ -98,9 +98,7 @@ typedef struct
    char *outputBitstreamFilename;
    int32_t inputFs;
    IVAS_ENC_INPUT_FORMAT inputFormat;
#ifdef BINAURAL_AUDIO_CMDLINE
    bool is_binaural;
#endif
    EncInputFormatConfig inputFormatConfig;
    bool max_bwidth_user;
    IVAS_ENC_BANDWIDTH maxBandwidth;
@@ -365,29 +363,17 @@ int main(
    switch ( arg.inputFormat )
    {
        case IVAS_ENC_INPUT_MONO:
#ifdef BINAURAL_AUDIO_CMDLINE
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix, arg.is_binaural ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForMono failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
            }
            break;
        case IVAS_ENC_INPUT_STEREO:
#ifdef BINAURAL_AUDIO_CMDLINE
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -880,9 +866,7 @@ static void initArgStruct( EncArguments *arg )
    arg->outputBitstreamFilename = NULL;
    arg->inputFs = 0;
    arg->inputFormat = IVAS_ENC_INPUT_MONO;
#ifdef BINAURAL_AUDIO_CMDLINE
    arg->is_binaural = false;
#endif
    arg->inputFormatConfig.stereoToMonoDownmix = false;
    arg->max_bwidth_user = false;
    arg->maxBandwidth = IVAS_ENC_BANDWIDTH_UNDEFINED;
@@ -1225,16 +1209,6 @@ static bool parseCmdlIVAS_enc(
         * IVAS Formats
         *-----------------------------------------------------------------*/

#ifdef BINAURAL_AUDIO_CMDLINE
        else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
        {
            i++;
            if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
            {
                arg->is_binaural = true;
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-STEREO" ) == 0 )
        {
            i++;
@@ -1312,6 +1286,11 @@ static bool parseCmdlIVAS_enc(
            }
#endif /* DEBUGGING */
        }
        else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
        {
            arg->is_binaural = true;
            i++;
        }
        else if ( strcmp( argv_to_upper, "-ISM" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_ISM;
@@ -1703,9 +1682,6 @@ static void usage_enc( void )
    fprintf( stdout, "Options:\n" );
    fprintf( stdout, "--------\n" );
    fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" );
#ifdef BINAURAL_AUDIO_CMDLINE
    fprintf( stdout, "-binaural           : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" );
#endif
    fprintf( stdout, "-stereo             : Stereo format \n" );
    fprintf( stdout, "-ism (+)Ch Files    : ISM format \n" );
    fprintf( stdout, "                      where Ch specifies the number of ISMs (1-4)\n" );
@@ -1737,6 +1713,7 @@ static void usage_enc( void )
    fprintf( stdout, "                      alternatively, B can be a text file where each line contains \"nb_frames B\"\n" );
    fprintf( stdout, "-no_delay_cmp       : Turn off delay compensation\n" );
    fprintf( stdout, "-stereo_dmx_evs     : Activate stereo downmix function for EVS.\n" );
    fprintf( stdout, "-binaural           : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" );
    fprintf( stdout, "-mime               : Mime output bitstream file format\n" );
    fprintf( stdout, "                      The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" );
    fprintf( stdout, "                      default output bitstream file format is G.192\n" );
+0 −221

File changed.

Preview size limit exceeded, changes collapsed.

+0 −4
Original line number Diff line number Diff line
@@ -133,10 +133,6 @@ typedef struct
typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
{
    int16_t override;
#ifndef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG
    int16_t use_brir;
    int16_t late_reverb_on;
#endif
    int16_t nBands;                                   /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
    float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX];      /* Center frequencies for which following values are provided: */
    float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /*  - The room's T60 per center frequency */
+1 −15
Original line number Diff line number Diff line
@@ -166,11 +166,8 @@ int16_t getTcxonly(
    const int16_t element_mode, /* i  : IVAS element mode                   */
    const int32_t total_brate,  /* i  : total bitrate                       */
    const int16_t MCT_flag      /* i  : hMCT handle allocated (1) or not (0)*/
#ifdef ISM_25k6_HZ_CORE
    ,
    const int16_t is_ism_format
#endif
)
    const int16_t is_ism_format )
{
    int16_t tcxonly = 0;

@@ -183,7 +180,6 @@ int16_t getTcxonly(
            }
            break;
        case IVAS_SCE:
#ifdef ISM_25k6_HZ_CORE
            if ( is_ism_format )
            {
                if ( total_brate > MAX_ACELP_BRATE_ISM )
@@ -200,7 +196,6 @@ int16_t getTcxonly(
            }
            break;

#endif
        case IVAS_CPE_DFT:
        case IVAS_CPE_TD:
            if ( total_brate > MAX_ACELP_BRATE )
@@ -363,10 +358,8 @@ int32_t getCoreSamplerateMode2(
    const int16_t bwidth,        /* i  : audio bandwidth                */
    const int16_t flag_ACELP16k, /* i  : ACELP@16kHz flag               */
    const int16_t rf_mode        /* i  : flag to signal the RF mode     */
#ifdef ISM_25k6_HZ_CORE
    ,
    const IVAS_FORMAT is_ism_format /* i  : flag indicating ISM format     */
#endif
)
{
    int32_t sr_core = 0;
@@ -387,7 +380,6 @@ int32_t getCoreSamplerateMode2(
    {
        sr_core = INT_FS_16k;
    }
#ifdef ISM_25k6_HZ_CORE
    else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format )
    {
        sr_core = INT_FS_16k;
@@ -400,12 +392,6 @@ int32_t getCoreSamplerateMode2(
    {
        sr_core = 25600;
    }
#else
    else if ( ( bwidth == SWB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) || ( bwidth == FB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) )
    {
        sr_core = INT_FS_16k;
    }
#endif
    else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) )
    {
        sr_core = 25600;
Loading