Commit e3e976b4 authored by sagnowski's avatar sagnowski
Browse files

Update split rendering bitstream format

parent 0b93d4cf
Loading
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -1830,6 +1830,9 @@ static ivas_error initOnFirstGoodFrame(
        ISAR_SPLIT_REND_CODEC splitRendCodec;
        int16_t splitRendCodecFrameSizeMs;
        ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection;
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
        int16_t lc3plusHighRes;
#endif

        if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK )
        {
@@ -1837,11 +1840,21 @@ static ivas_error initOnFirstGoodFrame(
            return error;
        }

        IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec, &splitRendCodec, &poseCorrection, &splitRendCodecFrameSizeMs );
        IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec, &splitRendCodec, &poseCorrection, &splitRendCodecFrameSizeMs
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                              ,
                                              &lc3plusHighRes
#endif
        );

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
        {
            if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs ) ) != IVAS_ERR_OK )
            if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                                   ,
                                                   arg.output_Fs, lc3plusHighRes
#endif
                                                   ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
                return error;
@@ -1849,7 +1862,12 @@ static ivas_error initOnFirstGoodFrame(
        }
        else
        {
            if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs ) ) != IVAS_ERR_OK )
            if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                                   ,
                                                   arg.output_Fs, lc3plusHighRes
#endif
                                                   ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
                return error;
+30 −4
Original line number Diff line number Diff line
@@ -895,6 +895,9 @@ int main(
    bitsBuffer.config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
    bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
    bitsBuffer.config.codec_frame_size_ms = 20;
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
    bitsBuffer.config.lc3plusHighRes = 0;
#endif


    CmdlnArgs args = parseCmdlnArgs( argc, argv );
@@ -927,11 +930,19 @@ int main(
        }
    }

#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
    int32_t inFileSampleRate = 0;
#endif
    strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 );
    hSplitRendFileReadWrite = NULL;
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inMetadataFilePaths[0], &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms );
        error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inMetadataFilePaths[0], &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                        ,
                                        &inFileSampleRate, &bitsBuffer.config.lc3plusHighRes
#endif
        );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] );
@@ -948,7 +959,12 @@ int main(
    /*if split renderer is running in post renderer mode*/
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
    {
        error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms );
        error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                        ,
                                        &inFileSampleRate, &bitsBuffer.config.lc3plusHighRes
#endif
        );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath );
@@ -957,12 +973,17 @@ int main(
        audioReader = NULL;
    }

#ifndef SPLIT_REND_EXTEND_BITSTREAM_HEADER
    int32_t inFileSampleRate = 0;
#endif
    if ( audioReader != NULL )
    {
        error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate );
    }
    else
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
        if ( hSplitRendFileReadWrite == NULL )
#endif
    {
        inFileSampleRate = args.sampleRate;
    }
@@ -970,7 +991,7 @@ int main(
    switch ( error )
    {
        case IVAS_ERR_OK:
            /* If sampling rate not given on command line, use the one from wav file */
            /* If sampling rate not given on command line, use the one from SR file */
            if ( args.sampleRate == 0 )
            {
                args.sampleRate = inFileSampleRate;
@@ -1022,7 +1043,12 @@ int main(
    if ( args.inConfig.numBinBuses > 0 )
    {
        IVAS_REND_SetSplitRendBitstreamHeader( hIsarPostRend, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection,
                                               bitsBuffer.config.codec_frame_size_ms );
                                               bitsBuffer.config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                               ,
                                               bitsBuffer.config.lc3plusHighRes
#endif
        );
    }


+33 −4
Original line number Diff line number Diff line
@@ -649,7 +649,15 @@ static void setupWithSingleFormatInput(
        if ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            ivas_error error;
            error = split_rend_reader_open( hhSplitRendFileReadWrite, args.inMetadataFilePaths[0], &hBitsBuffer->config.codec, &hBitsBuffer->config.poseCorrection, &hBitsBuffer->config.codec_frame_size_ms );
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
            int32_t sr_fs = 0;
#endif
            error = split_rend_reader_open( hhSplitRendFileReadWrite, args.inMetadataFilePaths[0], &hBitsBuffer->config.codec, &hBitsBuffer->config.poseCorrection, &hBitsBuffer->config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                            ,
                                            &sr_fs, &hBitsBuffer->config.lc3plus_highres
#endif
            );
            if ( error != IVAS_ERR_OK )
            {
                fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] );
@@ -811,6 +819,9 @@ int main(
    bitsBuffer.config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
    bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
    bitsBuffer.config.codec_frame_size_ms = 20;
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
    bitsBuffer.config.lc3plus_highres = 0;
#endif
#endif
    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
    {
@@ -932,8 +943,16 @@ int main(
    /*if split renderer is running in post renderer mode*/
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
    {
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
        int32_t sr_fs = 0;
#endif
        error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection,
                                        &bitsBuffer.config.codec_frame_size_ms );
                                        &bitsBuffer.config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                        ,
                                        &sr_fs, &bitsBuffer.config.lc3plus_highres
#endif
        );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath );
@@ -1487,7 +1506,12 @@ int main(
            exit( -1 );
        }

        if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms ) ) != IVAS_ERR_OK )
        if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                               ,
                                               args.sampleRate, bitsBuffer.config.lc3plus_highres
#endif
                                               ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.outputFilePath );
            exit( -1 );
@@ -1507,7 +1531,12 @@ int main(
                exit( -1 );
            }

            if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms ) ) != IVAS_ERR_OK )
            if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
                                                   ,
                                                   args.sampleRate, bitsBuffer.config.lc3plus_highres
#endif
                                                   ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Could not open split rend metadata file %s\n", args.outMetadataFilePath );
                exit( -1 );
+6 −0
Original line number Diff line number Diff line
@@ -252,6 +252,9 @@ typedef struct _ISAR_SPLIT_REND_BITS_DATA
    int16_t codec_frame_size_ms;
    ISAR_SPLIT_REND_CODEC codec;
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE pose_correction;
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
    int32_t lc3plus_highres;
#endif

} ISAR_SPLIT_REND_BITS_DATA, *ISAR_SPLIT_REND_BITS_HANDLE;

@@ -271,6 +274,9 @@ typedef struct _ISAR_SPLIT_REND_CONFIG
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
    ISAR_SPLIT_REND_CODEC codec;
    ISAR_SPLIT_REND_RENDERER_SELECTION rendererSelection;
#ifdef SPLIT_REND_EXTEND_BITSTREAM_HEADER
    int16_t lc3plus_highres;
#endif

} ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE;
#endif
+7 −0
Original line number Diff line number Diff line
@@ -1586,10 +1586,17 @@ typedef enum
#define IVAS_SPLIT_REND_PITCH_G_1BYQ_STEP       (( IVAS_SPLIT_REND_PITCH_G_QUANT_PNTS - 1 )/( IVAS_SPLIT_REND_PITCH_G_MAX_VAL - IVAS_SPLIT_REND_PITCH_G_MIN_VAL )) 

#define IVAS_SPLIT_REND_MAX_NUM_BYTES           4000
#ifdef SPLIT_REND_METADATA_SECTION_SIZE
#define IVAS_SPLIT_REND_MD_SIZE_BITS            13  /* Max expected size of the MD section: 256000 kbps / 50 fps = 5120 < 2^13 = 8192 */
#endif
#define IVAS_SPLIT_REND_HEAD_POSE_BITS          9
#define IVAS_SPLIT_REND_DOF_BITS                2
#define IVAS_SPLIT_REND_HQ_MODE_BITS            1
#define ISAR_SPLIT_REND_ROT_AXIS_BITS           3

#ifdef LC3PLUS_RTP_PAYLOAD_FORMAT
#define IVAS_LC3PLUS_MAX_NUM_DECODERS 2
#endif
#endif


Loading