Commit 59f89885 authored by multrus's avatar multrus
Browse files

Merge branch 'main' into 1429-fixes-to-delivery-scripts

parents d2244cb8 1f0bb580
Loading
Loading
Loading
Loading
+123 −50
Original line number Diff line number Diff line
@@ -41,10 +41,6 @@
#ifdef IVAS_RTPDUMP
#include "ivas_rtp_file.h"
#endif
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
#include "ivas_cnst.h"
#endif

#include "jbm_file_writer.h"
#include "hrtf_file_reader.h"
#include "ls_custom_file_reader.h"
@@ -67,9 +63,6 @@
#include "flp_debug.h"
#endif

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

#define WMC_TOOL_SKIP

@@ -85,8 +78,15 @@ static
#ifdef DEBUGGING
#define MIN_NUM_BITS_ACTIVE_FRAME 56
#define NUM_BITS_SID_IVAS_5K2     104
#endif

#endif
#ifdef NONBE_FIX_BASOP_2233_RTPDUMP_DIFFERING_BITSTREAMS
#define RANDOM_INITSEED_DEC ( 0xFADE )
#else
#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_DEC ( 0xFEEDFADE )
#endif
#endif

/*------------------------------------------------------------------------------------------*
 * Local structure for storing cmdln arguments
@@ -217,6 +217,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
@@ -229,10 +232,11 @@ static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBs
static int16_t app_own_random( int16_t *seed );
#endif
static void do_object_editing( 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()
 *
@@ -267,6 +271,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 DEBUGGING
    int32_t noClipping;
    int32_t cnt_frames_limited;
@@ -543,7 +550,6 @@ int main(
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

#ifndef IVAS_RTPDUMP
        arg.enableHeadRotation = true;
#endif
@@ -655,7 +661,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 &&
@@ -682,6 +690,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 )
@@ -854,6 +863,9 @@ int main(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
                            &splitRendBits,
#endif
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
                            &renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
                            &hIvasDec,
#else
@@ -917,6 +929,7 @@ cleanup:
        free( pAE );
    }
#endif

    if ( arg.aeSequence.count > 0 )
    {
        free( arg.aeSequence.pID );
@@ -1910,6 +1923,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" );
@@ -1933,10 +1950,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" );
#ifdef DEBUG_MODE_INFO
@@ -2040,6 +2053,15 @@ static ivas_error initOnFirstGoodFrame(
        ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection;
        int16_t splitRendIsarFrameSizeMs;
        int16_t lc3plusHighRes;

#ifdef NONBE_FIX_BASOP_2233_RTPDUMP_DIFFERING_BITSTREAMS
        /* 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
           application should implement this initialization seperately */
        uint16_t rtpDecSeed = RANDOM_INITSEED_DEC;
        uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 );
        uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed );
#else
#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
@@ -2047,6 +2069,7 @@ static ivas_error initOnFirstGoodFrame(
        srand( RANDOM_INITSEED_DEC );
        uint32_t ssrc = ( (uint32_t) rand() & 0x0000FFFF ) | ( (uint32_t) rand() << 16 );
        uint16_t seqNumInitVal = (uint16_t) ( rand() & 0xFFFF );
#endif
#endif

        if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK )
@@ -2074,12 +2097,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;
            }
@@ -2623,7 +2650,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 )
        {
@@ -3278,8 +3305,10 @@ static ivas_error printBitstreamInfoVoip(
        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
@@ -3400,6 +3429,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
@@ -3438,11 +3470,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;
@@ -3522,8 +3559,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
@@ -3636,21 +3675,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;
        }
@@ -3689,6 +3733,7 @@ static ivas_error decodeVoIP(
                goto cleanup;
            }
        }

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

        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
@@ -3838,12 +3882,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 )
        {
@@ -3860,7 +3909,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;
@@ -3908,26 +3957,30 @@ 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;
@@ -3936,6 +3989,9 @@ static ivas_error decodeVoIP(
                }
#endif

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

                /* Load HRTF binary file data */
                if ( arg.hrtfReaderEnabled )
                {
@@ -4125,6 +4181,7 @@ 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;
            srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms;
            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 ) );
@@ -4135,7 +4192,6 @@ static ivas_error decodeVoIP(
        }
#endif


        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        if ( vec_pos_update == 0 )
        {
@@ -4655,9 +4711,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 )
@@ -4675,19 +4737,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,
@@ -4708,6 +4770,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 )
@@ -4724,6 +4787,7 @@ ivas_error restartDecoder(

        arg->enableHeadRotation = true;
    }
#endif

    if ( arg->voipMode )
    {
@@ -4740,6 +4804,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 )
+26 −7
Original line number Diff line number Diff line
@@ -50,10 +50,6 @@
#include "flp_debug.h"
#endif

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

#define WMC_TOOL_SKIP

/*------------------------------------------------------------------------------------------*
@@ -65,6 +61,14 @@ static
#endif
    int32_t frame = 0; /* Counter of frames */

#ifdef NONBE_FIX_BASOP_2233_RTPDUMP_DIFFERING_BITSTREAMS
#define RANDOM_INITSEED_ENC ( 0xDEAF )
#else
#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_ENC ( 0xFEEDDEAF )
#endif
#endif

#define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */

/* Additional config info for each input format */
@@ -234,6 +238,14 @@ int main(
    IVAS_RTP ivasRtp = { 0 };
#endif

#ifdef NONBE_FIX_BASOP_2233_RTPDUMP_DIFFERING_BITSTREAMS
    /* 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
       application should implement this initialization seperately */
    uint16_t rtpEncSeed = RANDOM_INITSEED_ENC;
    uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) << 16 );
    uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpEncSeed );
#else
#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
@@ -241,6 +253,7 @@ int main(
    srand( RANDOM_INITSEED_ENC );
    uint32_t ssrc = ( (uint32_t) rand() & 0x0000FFFF ) | ( (uint32_t) rand() << 16 );
    uint16_t seqNumInitVal = (uint16_t) ( rand() & 0xFFFF );
#endif
#endif

    /*------------------------------------------------------------------------------------------*
@@ -474,14 +487,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:
@@ -678,6 +691,10 @@ int main(
    }
#endif

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

    int16_t numSamplesRead = 0;
    uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME];
    uint16_t numBits = 0;
@@ -1084,7 +1101,6 @@ static bool parseCmdlIVAS_enc(
    arg->sceneOrientationTrajFileName = NULL;
    arg->deviceOrientationTrajFileName = NULL;
#endif

#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
    arg->forcedModeFile = NULL;
@@ -1887,6 +1903,7 @@ static bool parseCmdlIVAS_enc(
        {
            i++;
            arg->rtpdumpOutput = true;

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

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

@@ -1961,6 +1979,7 @@ static bool parseCmdlIVAS_enc(
        usage_enc();
        return false;
    }

    if ( arg->deviceOrientationTrajFileName != NULL && arg->rtpdumpOutput == false )
    {
        fprintf( stderr, "Error: Device orientations are only enabled with rtpdump output!\n\n" );
+52 −14

File changed.

Preview size limit exceeded, changes collapsed.

+77 −0

File changed.

Preview size limit exceeded, changes collapsed.

+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@
#define IVAS_ROOM_ABS_COEFF              6
#define IVAS_REVERB_PREDELAY_MAX         20 /* Max input delay for reverb module */
#define IVAS_ER_LIST_HEIGHT              1.6f
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
#define IVAS_DEFAULT_AEID 65535
#endif

/* JBM constants for adaptive-playout */
#define IVAS_TIME_SCALE_MIN 50  /* min. time-scaling [%] */
Loading