Commit db73846b authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into...

- Merge remote-tracking branch 'remotes/origin/main' into 1101-obosolete-call-of-ivas_jbm_dec_tc_buffer_open
parents 29208e80 e433c88c
Loading
Loading
Loading
Loading
+95 −119

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@
    </Lib>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="..\lib_util\aeid_file_reader.c" />
    <ClCompile Include="..\lib_util\audio_file_reader.c" />
    <ClCompile Include="..\lib_util\audio_file_writer.c" />
    <ClCompile Include="..\lib_util\bitstream_reader.c" />
@@ -126,6 +127,7 @@
    <ClCompile Include="..\lib_util\tsm_scale_file_reader.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_util\aeid_file_reader.h" />
    <ClInclude Include="..\lib_util\audio_file_reader.h" />
    <ClInclude Include="..\lib_util\audio_file_writer.h" />
    <ClInclude Include="..\lib_util\bitstream_reader.h" />
+64 −326

File changed.

Preview size limit exceeded, changes collapsed.

+53 −54
Original line number Diff line number Diff line
@@ -32,17 +32,6 @@

#include "lib_isar_post_rend.h"

#ifndef SPLIT_REND_WITH_HEAD_ROT

int main( int argc, char **argv )
{
    (void) argc;
    (void) argv;
    ISAR_POST_REND_void_func();
    return 0;
}

#else

#include <assert.h>
#include <math.h>
@@ -229,6 +218,7 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString );

static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer );


/*------------------------------------------------------------------------------------------*
 * Local functions
 *------------------------------------------------------------------------------------------*/
@@ -275,10 +265,6 @@ static int16_t getTotalNumInChannels(
    return totalNumInChannels;
}

/*------------------------------------------------------------------------------------------*
 * Local functions
 *------------------------------------------------------------------------------------------*/

static const CmdLnParser_Option *findOptionById(
    const int32_t id )
{
@@ -440,6 +426,7 @@ static bool checkRequiredArgs(
    return !missingRequiredArg;
}


static CmdlnArgs defaultArgs(
    const char *executableName )
{
@@ -470,6 +457,7 @@ static CmdlnArgs defaultArgs(
    return args;
}


static void parseOption(
    const int32_t optionId,
    char **optionValues,
@@ -562,6 +550,7 @@ static void parseOption(
    return;
}


static CmdlnArgs parseCmdlnArgs(
    const int argc,
    char **argv )
@@ -600,6 +589,7 @@ static void printSupportedAudioConfigs( void )
    return;
}


/*--------------------------------------------------------------------------*
 * convertInputBuffer()
 *
@@ -638,6 +628,7 @@ static void convertInputBuffer(
    return;
}


/*--------------------------------------------------------------------------*
 * convertOutputBuffer()
 *
@@ -679,6 +670,7 @@ static void convertOutputBuffer(
    return;
}


/*------------------------------------------------------------------------------------------*
 * main()
 *
@@ -730,14 +722,13 @@ int main(
    bitsBuffer.config.bufLenInBytes = 0;
    bitsBuffer.config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
    bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    bitsBuffer.config.codec_frame_size_ms = 5;
    bitsBuffer.config.isar_frame_size_ms = 20;
    bitsBuffer.config.lc3plusHighRes = 0;
#else
    bitsBuffer.config.codec_frame_size_ms = 20;
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
     *------------------------------------------------------------------------------------------*/

    CmdlnArgs args = parseCmdlnArgs( argc, argv );

@@ -745,6 +736,10 @@ int main(
    convert_backslash( args.outputFilePath );
    convert_backslash( args.headRotationFilePath );

    /*------------------------------------------------------------------------------------------*
     * Open head-rotation file
     *------------------------------------------------------------------------------------------*/

    if ( !isEmptyString( args.headRotationFilePath ) )
    {
        if ( RotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK )
@@ -754,15 +749,21 @@ int main(
        }
    }

    /*------------------------------------------------------------------------------------------*
     * Open BFI file
     *------------------------------------------------------------------------------------------*/

    if ( !isEmptyString( args.splitRendBFIFilePath ) )
    {
        convert_backslash( args.splitRendBFIFilePath );
        SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader );
    }

#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
    /*------------------------------------------------------------------------------------------*
     * Open input files
     *------------------------------------------------------------------------------------------*/

    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 ) )
@@ -771,14 +772,10 @@ int main(
                                        args.inMetadataFilePaths[0],
                                        &bitsBuffer.config.codec,
                                        &bitsBuffer.config.poseCorrection,
                                        &bitsBuffer.config.codec_frame_size_ms
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
                                        ,
                                        &bitsBuffer.config.codec_frame_size_ms,
                                        &bitsBuffer.config.isar_frame_size_ms,
                                        &inFileSampleRate,
                                        &bitsBuffer.config.lc3plusHighRes
#endif
        );
                                        &bitsBuffer.config.lc3plusHighRes );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] );
@@ -799,14 +796,10 @@ int main(
                                        args.inputFilePath,
                                        &bitsBuffer.config.codec,
                                        &bitsBuffer.config.poseCorrection,
                                        &bitsBuffer.config.codec_frame_size_ms
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
                                        ,
                                        &bitsBuffer.config.codec_frame_size_ms,
                                        &bitsBuffer.config.isar_frame_size_ms,
                                        &inFileSampleRate,
                                        &bitsBuffer.config.lc3plusHighRes
#endif
        );
                                        &bitsBuffer.config.lc3plusHighRes );
        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath );
@@ -815,17 +808,11 @@ int main(
        audioReader = NULL;
    }

#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS
    int32_t inFileSampleRate = 0;
#endif
    if ( audioReader != NULL )
    {
        error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate );
    }
    else
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
        if ( hSplitRendFileReadWrite == NULL )
#endif
    else if ( hSplitRendFileReadWrite == NULL )
    {
        inFileSampleRate = args.sampleRate;
    }
@@ -867,6 +854,11 @@ int main(
            exit( -1 );
        }
    }

    /*------------------------------------------------------------------------------------------*
     * Open ISAR handle
     *------------------------------------------------------------------------------------------*/

    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL;
    if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
@@ -875,7 +867,10 @@ int main(
        exit( -1 );
    }

    /* === Configure === */
    /*------------------------------------------------------------------------------------------*
     * Configuration
     *------------------------------------------------------------------------------------------*/

    if ( ( error = ISAR_POST_REND_InitConfig( hIsarPostRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
@@ -887,22 +882,16 @@ int main(
        if ( ( error = ISAR_REND_SetSplitRendBitstreamHeader( hIsarPostRend,
                                                              bitsBuffer.config.codec,
                                                              bitsBuffer.config.poseCorrection,
                                                              bitsBuffer.config.codec_frame_size_ms
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
                                                              ,
                                                              bitsBuffer.config.codec_frame_size_ms,
                                                              bitsBuffer.config.isar_frame_size_ms,
                                                              bitsBuffer.config.lc3plusHighRes
#endif
                                                              ) ) != IVAS_ERR_OK )
                                                              bitsBuffer.config.lc3plusHighRes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error in getting split renderer bitstream header: %s\n", ivas_error_to_string( error ) );
            exit( -1 );
        }
    }


    ISAR_POST_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS];

    for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; i++ )
    {
        splitBinIds[i] = 0u;
@@ -918,7 +907,6 @@ int main(
    }

    const int16_t totalNumInChannels = getTotalNumInChannels( hIsarPostRend, splitBinIds );

    if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels )
    {
        fprintf( stderr, "Number of channels in input file does not match selected configuration\n" );
@@ -926,13 +914,16 @@ int main(
    }

    int16_t numOutChannels = 2;

    if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath );
        exit( -1 );
    }

    /*------------------------------------------------------------------------------------------*
     * Allocate processing buffers
     *------------------------------------------------------------------------------------------*/

    inBufferSize = frameSize_smpls * totalNumInChannels;
    outBufferSize = frameSize_smpls * numOutChannels;
    inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) );
@@ -985,6 +976,13 @@ int main(
        fprintf( stdout, "\n\n-- Start the ISAR post renderer (quiet mode) --\n\n" );
    }

    /*------------------------------------------------------------------------------------------*
     * Loop for every frame of data
     * - Read the input data
     * - Run the post-rendering
     * - Write the data into output file
     *------------------------------------------------------------------------------------------*/

    while ( 1 )
    {
        int16_t num_in_channels;
@@ -1215,7 +1213,10 @@ int main(
    }
#endif

    /* === Close === */
    /*------------------------------------------------------------------------------------------*
     * Close files and deallocate resources
     *------------------------------------------------------------------------------------------*/

    free( inpInt16Buffer );
    free( inFloatBuffer );
    free( outInt16Buffer );
@@ -1249,5 +1250,3 @@ int main(


#undef WMC_TOOL_SKIP

#endif /* SPLIT_REND_WITH_HEAD_ROT */
+30 −291

File changed.

Preview size limit exceeded, changes collapsed.

Loading