Commit dbefeaf4 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Merge branch 'main' into float-1558-add-support-for-non-be-conformance-tets-on-masa-metadata

parents 416aeceb 2a32ccea
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@
    <ClCompile Include="..\lib_util\obj_edit_file_reader.c" />
    <ClCompile Include="..\lib_util\render_config_reader.c" />
    <ClCompile Include="..\lib_util\rotation_file_reader.c" />
    <ClCompile Include="..\lib_util\requests_file_reader.c" />
    <ClCompile Include="..\lib_util\split_render_file_read_write.c" />
    <ClCompile Include="..\lib_util\split_rend_bfi_file_reader.c" />
    <ClCompile Include="..\lib_util\tsm_scale_file_reader.c" />
@@ -165,6 +166,7 @@
    <ClInclude Include="..\lib_util\masa_file_writer.h" />
    <ClInclude Include="..\lib_util\render_config_reader.h" />
    <ClInclude Include="..\lib_util\rotation_file_reader.h" />
    <ClInclude Include="..\lib_util\requests_file_reader.h" />
    <ClInclude Include="..\lib_util\split_render_file_read_write.h" />
    <ClInclude Include="..\lib_util\tinywavein_c.h" />
    <ClInclude Include="..\lib_util\tinywaveout_c.h" />
+6 −0
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@
    <ClCompile Include="..\lib_util\rotation_file_reader.c">
      <Filter>util_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_util\requests_file_reader.c">
      <Filter>util_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_util\split_rend_bfi_file_reader.c">
      <Filter>util_c</Filter>
    </ClCompile>
@@ -165,6 +168,9 @@
    <ClInclude Include="..\lib_util\rotation_file_reader.h">
      <Filter>util_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_util\requests_file_reader.h">
      <Filter>util_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_util\split_rend_bfi_file_reader.h">
      <Filter>util_h</Filter>
    </ClInclude>
+56 −0
Original line number Diff line number Diff line
@@ -175,7 +175,11 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
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 *phIvasDec, int16_t *pcmBuf );
#else
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 );
#endif
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_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, 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 );
#ifdef DEBUGGING
@@ -779,7 +783,11 @@ int main(
    }
    else
    {
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -1957,6 +1965,9 @@ static ivas_error initOnFirstGoodFrame(
        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 );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

        if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK )
        {
@@ -1993,7 +2004,11 @@ static ivas_error initOnFirstGoodFrame(


            /* Split Rendering RTPDump Output file */
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
            if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename );
                return error;
@@ -2225,7 +2240,11 @@ static ivas_error decodeG192(
    Vector3PairFileReader *referenceVectorReader,
    ObjectEditFileReader *objectEditFileReader,
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
    IVAS_DEC_HANDLE *phIvasDec,
#else
    IVAS_DEC_HANDLE hIvasDec,
#endif
    int16_t *pcmBuf )

{
@@ -2233,6 +2252,9 @@ static ivas_error decodeG192(
    uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8];
    int16_t i, num_bits;
    int16_t bfi = 0;
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
    IVAS_DEC_HANDLE hIvasDec = *phIvasDec;
#endif
#ifdef DEBUGGING
    int16_t fec_seed = 12558; /* FEC_SEED */
#endif
@@ -2263,6 +2285,9 @@ static ivas_error decodeG192(
    int16_t vec_pos_update, vec_pos_len;
    SplitFileReadWrite *splitRendWriter = NULL;
    int16_t isSplitRend, isSplitCoded;
#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
    bool restartNeeded;
#endif

#ifdef VARIABLE_SPEED_DECODING
    if ( arg.tsmEnabled )
@@ -2594,6 +2619,37 @@ static ivas_error decodeG192(
                    return error;
                }

#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH
                if ( ( error = IVAS_DEC_isRestartNeeded( hIvasDec, &restartNeeded ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                if ( restartNeeded )
                {
                    IVAS_DEC_BS_FORMAT tempFormat;
                    if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != 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(
                        &hIvasDec,
                        codecMode,
                        &arg,
                        NULL, /* ToDo : Provide rendererConfig */
                        NULL  /* ToDo : Provide LS Custom Data */
                    );
                    if ( error != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nFailed to restart decoder\n" );
                        goto cleanup;
                    }
                    *phIvasDec = hIvasDec; /* Update for main()' s free */
                }
#endif

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

+70 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@
#include "masa_file_reader.h"
#include "rotation_file_reader.h"
#include "ivas_rtp_file.h"
#ifdef FIX_1527_CMR_BITRATE_IDX
#include "requests_file_reader.h"
#endif
#ifdef DEBUGGING
#include "debug.h"
#endif
@@ -157,6 +160,9 @@ typedef struct
    char *sceneOrientationTrajFileName;
    char *deviceOrientationTrajFileName;

#ifdef FIX_1527_CMR_BITRATE_IDX
    char *requestsFileName;
#endif
} EncArguments;


@@ -224,12 +230,18 @@ int main(
    uint8_t au[IVAS_MAX_BITS_PER_FRAME / 8];
    IVAS_RTP ivasRtp = { 0 };

#ifdef FIX_1527_CMR_BITRATE_IDX
    ReqFileReader *requestsFileReader = NULL;
#endif
    /* 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 );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
    uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -623,7 +635,11 @@ int main(

    if ( arg.rtpdumpOutput )
    {
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename );
            goto cleanup;
@@ -656,6 +672,20 @@ int main(
        }
    }

#ifdef FIX_1527_CMR_BITRATE_IDX
    /*------------------------------------------------------------------------------------------*
     * Open remote requests file for rtp packing (E-bytes)
     *------------------------------------------------------------------------------------------*/
    if ( arg.requestsFileName != NULL )
    {
        if ( ( error = RequestsFileReader_open( arg.requestsFileName, &requestsFileReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Can't open requests file %s \n\n", arg.requestsFileName );
            goto cleanup;
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Run the encoder
     *------------------------------------------------------------------------------------------*/
@@ -865,6 +895,17 @@ int main(
                }
            }

#ifdef FIX_1527_CMR_BITRATE_IDX
            if ( requestsFileReader )
            {
                if ( ( error = ReadNextRequests( requestsFileReader, ivasRtp.remoteRequests, &ivasRtp.remoteRequestBitmap ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError %s while reading requests from %s\n", IVAS_ENC_GetErrorMessage( error ), RequestsFileReader_getFilePath( requestsFileReader ) );
                    goto cleanup;
                }
            }
#endif

            if ( ( error = IVAS_ENC_EncodeFrameToCompact( hIvasEnc, pcmBuf, pcmBufSize, au, &numBits ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nencodeFrame failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -969,6 +1010,13 @@ cleanup:
        fclose( f_bitrateProfile );
    }

#ifdef FIX_1527_CMR_BITRATE_IDX
    if ( requestsFileReader )
    {
        RequestsFileReader_close( &requestsFileReader );
    }
#endif

    if ( sceneOrientationFileReader )
    {
        RotationFileReader_close( &sceneOrientationFileReader );
@@ -1030,6 +1078,10 @@ static bool parseCmdlIVAS_enc(
    /*-----------------------------------------------------------------*
     * Set default values
     *-----------------------------------------------------------------*/
#ifdef FIX_1527_CMR_BITRATE_IDX
    // Need less usan/msan or new arg addition
    memset( arg, 0, sizeof( *arg ) );
#endif

    arg->inputWavFilename = NULL;
    arg->outputBitstreamFilename = NULL;
@@ -1910,6 +1962,20 @@ static bool parseCmdlIVAS_enc(
            arg->deviceOrientationTrajFileName = argv[i];
            i++;
        }
#ifdef FIX_1527_CMR_BITRATE_IDX
        else if ( strcmp( argv_to_upper, "-REQUESTS" ) == 0 )
        {
            i++;
            if ( argc - i <= 4 || argv[i][0] == '-' )
            {
                fprintf( stderr, "Error: Remote requests file name not specified!\n\n" );
                usage_enc();
                return false;
            }
            arg->requestsFileName = argv[i];
            i++;
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -2148,6 +2214,10 @@ static void usage_enc( void )
    fprintf( stdout, "                      EVS RTP Payload Format is used. Optional N represents number of frames per RTP packet\n" );
    fprintf( stdout, "-scene_orientation  : Scene orientation trajectory file. Only used with rtpdump output.\n" );
    fprintf( stdout, "-device_orientation : Device orientation trajectory file. Only used with rtpdump output.\n" );
#ifdef FIX_1527_CMR_BITRATE_IDX
    fprintf( stdout, "-requests           : Remote requests file, Only used with rtpdump output.\n" );
#endif

    fprintf( stdout, "\n" );

    return;
+7 −0
Original line number Diff line number Diff line
@@ -340,6 +340,9 @@ int encoder_main(
    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 );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
    uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -731,7 +734,11 @@ int encoder_main(

    if ( arg.rtpdumpOutput && init_RtpWriter )
    {
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        if ( ( error = IVAS_RTP_WRITER_Init( ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_RTP_WRITER_Init( ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename );
            goto cleanup;
Loading