Commit 76404281 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into 2231_basop_DisableTmpFixOmasaSrBe
parents 8658c427 e3e92204
Loading
Loading
Loading
Loading
Loading
+131 −66
Original line number Diff line number Diff line
@@ -55,13 +55,7 @@
#ifdef IVAS_RTPDUMP
#include "ivas_rtp_file.h"
#endif
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
#include "ivas_cnst.h"
#endif

#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_DEC ( 0xFEEDFADE )
#endif

#define WMC_TOOL_SKIP

@@ -74,6 +68,10 @@ static
#endif
    int32_t frame = 0; /* Counter of frames */

#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_DEC ( 0xFEEDFADE )
#endif

#ifdef DEBUGGING
#define MIN_NUM_BITS_ACTIVE_FRAME 56
#define NUM_BITS_SID_IVAS_5K2     104
@@ -178,26 +176,34 @@ typedef struct
static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
    IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf,
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
    ObjectEditFileReader *objectEditFileReader,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef DECODER_FORMAT_SWITCHING
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#endif
#else
#ifdef DDECODER_FORMAT_SWITCHING
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    IVAS_RENDER_CONFIG_DATA *renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE *phIvasDec,
#else
    IVAS_DEC_HANDLE hIvasDec,
#endif
    int16_t *pcmBuf );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );

#ifdef DECODER_FORMAT_SWITCHING
static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, IVAS_DEC_MODE codec, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData );
static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData );
#endif


/*------------------------------------------------------------------------------------------*
 * main()
 *
@@ -232,6 +238,9 @@ int main(
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA **pAE = NULL;
    uint32_t aeCount = 0;
#endif
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    IVAS_RENDER_CONFIG_DATA renderConfig = { 0 };
#endif
#ifdef WMOPS
    reset_wmops();
    reset_mem( USE_BYTES );
@@ -495,7 +504,6 @@ int main(
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

#ifndef IVAS_RTPDUMP
        arg.enableHeadRotation = true;
#endif
@@ -530,7 +538,9 @@ int main(

    if ( arg.renderConfigEnabled )
    {
#ifndef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
        IVAS_RENDER_CONFIG_DATA renderConfig;
#endif

        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
@@ -558,6 +568,7 @@ int main(
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }

#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
        aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader );
        if ( aeCount > 0 )
@@ -730,19 +741,19 @@ int main(

    if ( arg.voipMode )
    {
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef DECODER_FORMAT_SWITCHING
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
                            &splitRendBits,
#endif
#else
#ifdef DDECODER_FORMAT_SWITCHING
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &hIvasDec, pcmBuf );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf );
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
                            &renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
                            &hIvasDec,
#else
                            hIvasDec,
#endif
                            pcmBuf );
    }
    else
    {
@@ -1772,6 +1783,10 @@ static void usage_dec( void )
    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" );
    fprintf( stdout, "-render_config File : Renderer configuration File\n" );
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    fprintf( stdout, "-room_size (S|M|L)  : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration,\n" );
#endif
    fprintf( stdout, "-om File            : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" );
    fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with panning P, -90<= P <=90,\n" );
    fprintf( stdout, "                      left or l or 90->left, right or r or -90->right, center or c or  0->middle\n" );
@@ -1789,10 +1804,6 @@ static void usage_dec( void )
    fprintf( stdout, "-obj_edit File      : Object editing instructions file or NULL for built-in example\n" );
    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" );
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    fprintf( stdout, "-room_size (S|M|L)  : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration\n" );
#endif
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
    fprintf( stdout, "                      default is deactivated\n" );
    fprintf( stdout, "\n" );
@@ -1876,6 +1887,7 @@ static ivas_error initOnFirstGoodFrame(
        ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection;
        int16_t splitRendIsarFrameSizeMs;
        int16_t lc3plusHighRes;

#ifdef FIXED_RTP_SEQUENCE_NUM
        /* Ideally ssrc is negotiated via SDP and sequence number is radomized but we
        use fixed seed for random num generator for regression based tests. Any realtime
@@ -1910,12 +1922,16 @@ static ivas_error initOnFirstGoodFrame(
            fParamsSR = fopen( srParamsFile, "w" );
            if ( NULL != fParamsSR )
            {
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
                fprintf( fParamsSR, "DOF = %d;\nLC3PLUS_HIGHRES = %d;\n", poseCorrection, lc3plusHighRes );
#else
                fprintf( fParamsSR, "CODEC = %s;\nDOF = %d;\nFRAMESIZE = %d;\nRENDERSIZE = %d;\nLC3PLUS_HIGHRES = %d;\n",
                         splitRendCodec == ISAR_SPLIT_REND_CODEC_LC3PLUS ? "LC3PLUS" : "LCLD",
                         poseCorrection,
                         splitRendCodecFrameSizeMs,
                         splitRendIsarFrameSizeMs,
                         lc3plusHighRes );
#endif
                fclose( fParamsSR );
                fParamsSR = NULL;
            }
@@ -2410,7 +2426,7 @@ static ivas_error decodeG192(
            fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" );
            goto cleanup;
        }
        /* Head-tracking input simulation */

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
@@ -3008,6 +3024,9 @@ static ivas_error decodeVoIP(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#endif
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    IVAS_RENDER_CONFIG_DATA *renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE *phIvasDec,
#else
@@ -3046,11 +3065,16 @@ static ivas_error decodeVoIP(
    int16_t i;
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE hIvasDec = *phIvasDec;
    bool restartNeeded;
#endif
#ifdef IVAS_RTPDUMP
    IVAS_RTP ivasRtp = { 0 };
    IVAS_RTP srRtp = { 0 };
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    IVAS_RTP_SR_INFO srInfo = { true, false, 0, 20, IVAS_SR_TRANSPORT_LCLD };
#else
    IVAS_RTP_SR_INFO srInfo = { true, false, 0, IVAS_SR_TRANSPORT_LCLD };
#endif
    int32_t initialTsOffsetSystemAndRTP = 0;
#else
    FILE *f_rtpstream = NULL;
@@ -3128,8 +3152,10 @@ static ivas_error decodeVoIP(
        case IVAS_DEC_INPUT_FORMAT_RTPDUMP:
        case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF:
#ifdef IVAS_RTPDUMP
#ifndef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
#ifdef RTP_S4_251135_CR26253_0016_REV1
            if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, 0, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK )
#endif
#else
            if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK )
#endif
@@ -3242,21 +3268,26 @@ static ivas_error decodeVoIP(
        nSamplesRendered = 0;

#ifdef DECODER_FORMAT_SWITCHING
        /* restart decoder in case of format switching */
        if ( ivasRtp.restartNeeded )
        {
            IVAS_DEC_MODE newCodecInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
            error = restartDecoder(
            IVAS_DEC_MODE newDecModeInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
            if ( ( error = restartDecoder(
                       &hIvasDec,
                newCodecInPacket,
                       newDecModeInPacket,
                       &arg,
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
                       renderConfig,
#else
                       NULL, /* ToDo : Provide rendererConfig */
#endif
                       NULL /* ToDo : Provide LS Custom Data */
            );
            if ( error != IVAS_ERR_OK )
                       ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newCodecInPacket );
                fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newDecModeInPacket );
                goto cleanup;
            }

            *phIvasDec = hIvasDec; /* Update for main()' s free */
            ivasRtp.restartNeeded = false;
        }
@@ -3295,6 +3326,7 @@ static ivas_error decodeVoIP(
                goto cleanup;
            }
        }

        int16_t num_subframes;
        if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK )
        {
@@ -3302,7 +3334,6 @@ static ivas_error decodeVoIP(
            goto cleanup;
        }

        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
@@ -3445,12 +3476,17 @@ static ivas_error decodeVoIP(
        /* we are finished when all packets have been received and jitter buffer is empty */
        /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */
        /* last clause should make sure that for BE tests we end up with the same number of samples...*/
        if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) )
        bool isEmpty;
        if ( ( error = IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples, &isEmpty ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
        if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( isEmpty || nFramesFed < 2 ) )
        {
            break;
        }


        /* decode and get samples */
        while ( nSamplesRendered < nOutSamples )
        {
@@ -3467,7 +3503,7 @@ static ivas_error decodeVoIP(
                    numPiData++;
                }

                if ( ( error = IVAS_RTP_FeedPiDataToDecoder( hIvasDec, &ivasRtp.piData[ivasRtp.nProcPiData], numPiData ) ) != IVAS_ERR_OK )
                if ( ( error = IVAS_DEC_FeedPiDataToDecoder( hIvasDec, &ivasRtp.piData[ivasRtp.nProcPiData], numPiData ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -3476,6 +3512,7 @@ static ivas_error decodeVoIP(
                ivasRtp.nProcPiData += numPiData;
            }
#endif

#ifdef FIX_1119_SPLIT_RENDERING_VOIP
            if ( isSplitRend )
            {
@@ -3515,34 +3552,42 @@ static ivas_error decodeVoIP(
                    return error;
                }

                /* Placeholder for memory reallocation */
                /* ... */
#ifdef DECODER_FORMAT_SWITCHING
                if ( IVAS_DEC_isRestartNeeded( hIvasDec ) )
                /* restart decoder in case of format switching */
                if ( ( error = IVAS_DEC_isRestartNeeded( hIvasDec, &restartNeeded ) ) != IVAS_ERR_OK )
                {
                    IVAS_DEC_BS_FORMAT tempFormat;
                    if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK )
                    return error;
                }

                if ( restartNeeded )
                {
                    IVAS_DEC_BS_FORMAT tempBsFormat;
                    if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempBsFormat ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error );
                        goto cleanup;
                    }
                    IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
                    error = restartDecoder(

                    IVAS_DEC_MODE newDecModeInPacket = ( tempBsFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
                    if ( ( error = restartDecoder(
                               &hIvasDec,
                        codecMode,
                               newDecModeInPacket,
                               &arg,
                               NULL, /* ToDo : Provide rendererConfig */
                               NULL  /* ToDo : Provide LS Custom Data */
                    );
                    if ( error != IVAS_ERR_OK )
                               ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nFailed to restart decoder\n" );
                        goto cleanup;
                    }

                    *phIvasDec = hIvasDec; /* Update for main()' s free */
                }
#endif

                /* Placeholder for memory reallocation */
                /* ... */

                /* Load HRTF binary file data */
                if ( arg.hrtfReaderEnabled )
                {
@@ -3745,6 +3790,9 @@ static ivas_error decodeVoIP(
        {
            srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms;
            srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD;
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
            srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms;
#endif
            if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while pushing SR audio bitstream to RTP pack\n", ivas_error_to_string( error ) );
@@ -3858,7 +3906,6 @@ static ivas_error decodeVoIP(
        }
    }


    /*------------------------------------------------------------------------------------------*
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/
@@ -4321,9 +4368,15 @@ static ivas_error load_hrtf_from_file(

#ifdef DECODER_FORMAT_SWITCHING

ivas_error restartDecoder(
/*---------------------------------------------------------------------*
 * restartDecoder()
 *
 * Restart decoder in case of IVAS format switching
 *---------------------------------------------------------------------*/

static ivas_error restartDecoder(
    IVAS_DEC_HANDLE *phIvasDec,
    IVAS_DEC_MODE codec,
    const IVAS_DEC_MODE decMode,
    DecArguments *arg,
    IVAS_RENDER_CONFIG_DATA *renderConfig,
    IVAS_CUSTOM_LS_DATA *hLsCustomData )
@@ -4341,19 +4394,19 @@ ivas_error restartDecoder(
        IVAS_DEC_Close( phIvasDec );
    }

    if ( ( error = IVAS_DEC_Open( phIvasDec, codec ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Open( phIvasDec, decMode ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    arg->decMode = codec;
    arg->decMode = decMode;

    hIvasDec = *phIvasDec;

    uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : 65535;

    IVAS_AUDIO_CONFIG outputConfig = ( codec == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO;
    IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO;
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->renderFramesize, arg->customLsOutputEnabled, arg->hrtfReaderEnabled,
                                       arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->roomSize, arg->non_diegetic_pan_enabled,
@@ -4374,6 +4427,7 @@ ivas_error restartDecoder(
        goto cleanup;
    }

#ifndef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    if ( arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
@@ -4390,6 +4444,7 @@ ivas_error restartDecoder(

        arg->enableHeadRotation = true;
    }
#endif

    if ( arg->voipMode )
    {
@@ -4406,6 +4461,15 @@ ivas_error restartDecoder(
        goto cleanup;
    }

#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    /* ISAR frame size is set from command line, not renderer config file.
     * This will be ignored if output format is not split rendering. */
    if ( renderConfig != NULL )
    {
        renderConfig->split_rend_config.isar_frame_size_ms = (int16_t) arg->renderFramesize /* given in number of 5ms subframes */ * 5;
    }
#endif

    if ( arg->renderConfigEnabled && renderConfig != NULL )
    {
        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, *renderConfig ) ) != IVAS_ERR_OK )
@@ -4428,6 +4492,7 @@ ivas_error restartDecoder(

cleanup:
    IVAS_DEC_Close( phIvasDec );

    return error;
}

+12 −6
Original line number Diff line number Diff line
@@ -63,10 +63,6 @@
#endif
#endif

#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_ENC ( 0xFEEDDEAF )
#endif

#define WMC_TOOL_SKIP

/*------------------------------------------------------------------------------------------*
@@ -78,6 +74,10 @@ static
#endif
    int32_t frame = 0; /* Counter of frames */

#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_ENC ( 0xFEEDDEAF )
#endif

#define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */

/* Additional config info for each input format */
@@ -468,14 +468,14 @@ int main(
            if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                exit( -1 );
                goto cleanup;
            }
            break;
        case IVAS_ENC_INPUT_MASA_ISM:
            if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForMASAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                exit( -1 );
                goto cleanup;
            }
            break;
        default:
@@ -672,6 +672,10 @@ int main(
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Run the encoder
     *------------------------------------------------------------------------------------------*/

    int16_t numSamplesRead = 0;
    uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME];
    uint16_t numBits = 0;
@@ -1841,6 +1845,7 @@ static bool parseCmdlIVAS_enc(
        {
            i++;
            arg->rtpdumpOutput = true;

            if ( i < argc - 4 )
            {
                if ( !is_digits_only( argv[i] ) )
@@ -1857,6 +1862,7 @@ static bool parseCmdlIVAS_enc(
                    }
                }
            }

            fprintf( stdout, "Output format: RTPDump using %d frames/packet \n", arg->numFramesPerPacket );
        }

+41 −14

File changed.

Preview size limit exceeded, changes collapsed.

+78 −0

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -3860,6 +3860,7 @@ void convertSerialToBytestream_fx(
    UWord8 bitinbyte2, bytestream_tmp;
    assert( num_bits <= MAX_16 ); /* 512 kbps = 10240 bits, num_bits should always fits Word16 */
#endif

    FOR( i = 0; i < num_bits; ++i )
    {
        IF( EQ_32( serial[i], 0x0001 ) )
Loading