Commit c5bf55f9 authored by norvell's avatar norvell Committed by Manuel Jander
Browse files

Accept switches as agreed on 2025-11-26 + clang format

parent 3b5c4dc0
Loading
Loading
Loading
Loading
+2 −476

File changed.

Preview size limit exceeded, changes collapsed.

+0 −51
Original line number Diff line number Diff line
@@ -44,10 +44,8 @@
#include "jbm_file_reader.h"
#include "masa_file_reader.h"
#include "wmc_auto.h"
#ifdef IVAS_RTPDUMP
#include "rotation_file_reader.h"
#include "ivas_rtp_file.h"
#endif

#ifdef DEBUG_FORCE_DIR
/* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do.
@@ -74,13 +72,7 @@ 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 */

@@ -167,12 +159,10 @@ typedef struct
#endif
    bool pca;
    bool ism_extended_metadata;
#ifdef IVAS_RTPDUMP
    bool rtpdumpOutput;
    uint32_t numFramesPerPacket;
    char *sceneOrientationTrajFileName;
    char *deviceOrientationTrajFileName;
#endif

} EncArguments;

@@ -216,10 +206,8 @@ int main(
    MasaFileReader *masaReader = NULL;
    IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL };
    int16_t *pcmBuf = NULL;
#ifdef IVAS_RTPDUMP
    RotFileReader *sceneOrientationFileReader = NULL;
    RotFileReader *deviceOrientationFileReader = NULL;
#endif
#ifdef DEBUGGING
    FILE *f_forcedModeProfile = NULL;
#endif
@@ -229,28 +217,15 @@ int main(
    reset_mem( USE_BYTES );
#endif

#ifdef IVAS_RTPDUMP
    uint8_t au[IVAS_MAX_BITS_PER_FRAME / 8];
    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
       application should implement this initialization seperately */
    srand( RANDOM_INITSEED_ENC );
    uint32_t ssrc = ( (uint32_t) rand() & 0x0000FFFF ) | ( (uint32_t) rand() << 16 );
    uint16_t seqNumInitVal = (uint16_t) ( rand() & 0xFFFF );
#endif
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -278,11 +253,7 @@ int main(

    const BS_WRITER_FORMAT bsWriterFormat = arg.mimeOutput ? BS_WRITER_FORMAT_MIME : BS_WRITER_FORMAT_G192;

#ifdef IVAS_RTPDUMP
    if ( !arg.rtpdumpOutput && BS_Writer_Open_filename( &hBsWriter, arg.outputBitstreamFilename, bsWriterFormat ) != IVAS_ERR_OK )
#else
    if ( BS_Writer_Open_filename( &hBsWriter, arg.outputBitstreamFilename, bsWriterFormat ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nCan't open %s\n\n", arg.outputBitstreamFilename );
        goto cleanup;
@@ -640,18 +611,13 @@ int main(
        }
    }

#ifdef IVAS_RTPDUMP
    /*------------------------------------------------------------------------------------------*
     * RTPDump
     *------------------------------------------------------------------------------------------*/

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

    /*------------------------------------------------------------------------------------------*
     * Run the encoder
@@ -853,7 +818,6 @@ int main(
        }

        /* *** Encode one frame *** */
#ifdef IVAS_RTPDUMP
        if ( ivasRtp.hPack )
        {
            bool isMono = ( arg.inputFormat == IVAS_ENC_INPUT_MONO );
@@ -901,11 +865,7 @@ int main(
                goto cleanup;
            }

#ifdef RTP_S4_251135_CR26253_0016_REV1
            if ( ( error = IVAS_RTP_WriteNextFrame( &ivasRtp, au, NULL, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_RTP_WriteNextFrame( &ivasRtp, au, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError %s while pushing audio frame to RTP pack\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
@@ -913,7 +873,6 @@ int main(
        }
        else
        {
#endif
            if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nencodeFrame failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -926,9 +885,7 @@ int main(
                fprintf( stderr, "\nBS_Writer_WriteFrame_short failed, error code %d\n\n", error );
                goto cleanup;
            }
#ifdef IVAS_RTPDUMP
        }
#endif

        frame++;
        if ( !arg.quietModeEnabled )
@@ -997,7 +954,6 @@ cleanup:
        fclose( f_bitrateProfile );
    }

#ifdef IVAS_RTPDUMP
    if ( sceneOrientationFileReader )
    {
        RotationFileReader_close( &sceneOrientationFileReader );
@@ -1009,7 +965,6 @@ cleanup:
    }

    IVAS_RTP_Term( &ivasRtp );
#endif

    IVAS_ENC_Close( &hIvasEnc );

@@ -1066,11 +1021,9 @@ static bool parseCmdlIVAS_enc(
    arg->mimeOutput = false;
    arg->ism_extended_metadata = false;
    arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE;
#ifdef IVAS_RTPDUMP
    arg->rtpdumpOutput = false;
    arg->sceneOrientationTrajFileName = NULL;
    arg->deviceOrientationTrajFileName = NULL;
#endif
#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
    arg->forcedModeFile = NULL;
@@ -1849,7 +1802,6 @@ static bool parseCmdlIVAS_enc(
            i++;
        }

#ifdef IVAS_RTPDUMP
        /*-----------------------------------------------------------------*
         * RTPDump output
         *-----------------------------------------------------------------*/
@@ -1915,7 +1867,6 @@ static bool parseCmdlIVAS_enc(
            i++;
        }

#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -2129,14 +2080,12 @@ static void usage_enc( void )
#endif
    fprintf( stdout, "-q                  : Quiet mode, no frame counters\n" );
    fprintf( stdout, "                      default is deactivated\n" );
#ifdef IVAS_RTPDUMP
    fprintf( stdout, "-rtpdump <N>        : RTPDump output, hf_only=1 by default. The encoder will packetize the \n" );
    fprintf( stdout, "                      bitstream frames into TS26.253 Annex A IVAS RTP Payload Format packets and \n" );
    fprintf( stdout, "                      writes those to the output file. In EVS mono operating mode, TS26.445 Annex A.2.2 \n" );
    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" );
#endif
    fprintf( stdout, "\n" );

    return;
+0 −67
Original line number Diff line number Diff line
@@ -44,10 +44,8 @@
#include "jbm_file_reader.h"
#include "masa_file_reader.h"
#include "wmc_auto.h"
#ifdef IVAS_RTPDUMP
#include "rotation_file_reader.h"
#include "ivas_rtp_file.h"
#endif

#ifdef DEBUG_FORCE_DIR
/* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do.
@@ -77,13 +75,7 @@ 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 */

@@ -170,12 +162,10 @@ typedef struct
#endif
    bool pca;
    bool ism_extended_metadata;
#ifdef IVAS_RTPDUMP
    bool rtpdumpOutput;
    uint32_t numFramesPerPacket;
    char *sceneOrientationTrajFileName;
    char *deviceOrientationTrajFileName;
#endif

} EncArguments;

@@ -193,11 +183,7 @@ static ivas_error readForcedMode( FILE *file, IVAS_ENC_FORCED_MODE *forcedMode,
static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar );
#endif
static void str2arg( char *str, int *argc_local, char *argv_local[] );
#ifdef IVAS_RTPDUMP
static int encoder_main( int argc, char *argv[], IVAS_RTP *ivasRtp, int init_RtpWriter );
#else
static int encoder_main( int argc, char *argv[] );
#endif

/*------------------------------------------------------------------------------------------*
 * main()
@@ -215,11 +201,9 @@ int main(
    char line[2048];
    int argc_local = 0;
    char *argv_local[MAX_ARGV] = { 0 };
#ifdef IVAS_RTPDUMP
    IVAS_RTP ivasRtp = { 0 };
    char prev_outputBitstreamFilename[2048] = { 0 };
    int rtp_term = 0;
#endif

    IVAS_ENC_PrintDisclaimer();

@@ -244,7 +228,6 @@ int main(
        printf( "Processing format switching commandline: %s\n", line );
        str2arg( line, &argc_local, argv_local );

#ifdef IVAS_RTPDUMP
        if ( strcmp( argv_local[argc_local - 1], (char *) prev_outputBitstreamFilename ) == 0 )
        {
            /* append to last Rtp file */
@@ -269,9 +252,6 @@ int main(
            rtp_term = 1;
        }
        strcpy( (char *) prev_outputBitstreamFilename, argv_local[argc_local - 1] );
#else
        encoder_main( argc_local, argv_local );
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -282,9 +262,7 @@ int main(

cleanup:

#ifdef IVAS_RTPDUMP
    IVAS_RTP_Term( &ivasRtp );
#endif
    if ( FmtSWFile )
    {
        fclose( FmtSWFile );
@@ -318,13 +296,9 @@ void str2arg(

int encoder_main(
    int argc,
#ifdef IVAS_RTPDUMP
    char *argv[],
    IVAS_RTP *ivasRtp,
    int init_RtpWriter )
#else
    char *argv[] )
#endif
{
    bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */
    EncArguments arg;
@@ -341,10 +315,8 @@ int encoder_main(
    MasaFileReader *masaReader = NULL;
    IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL };
    int16_t *pcmBuf = NULL;
#ifdef IVAS_RTPDUMP
    RotFileReader *sceneOrientationFileReader = NULL;
    RotFileReader *deviceOrientationFileReader = NULL;
#endif
#ifdef DEBUGGING
    FILE *f_forcedModeProfile = NULL;
#endif
@@ -354,28 +326,15 @@ int encoder_main(
    reset_mem( USE_BYTES );
#endif

#ifdef IVAS_RTPDUMP
    uint8_t au[IVAS_MAX_BITS_PER_FRAME / 8];
    /* 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
       application should implement this initialization seperately */
    srand( RANDOM_INITSEED_ENC );
    uint32_t ssrc = ( (uint32_t) rand() & 0x0000FFFF ) | ( (uint32_t) rand() << 16 );
    uint16_t seqNumInitVal = (uint16_t) ( rand() & 0xFFFF );
#endif
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -401,11 +360,7 @@ int encoder_main(

    const BS_WRITER_FORMAT bsWriterFormat = arg.mimeOutput ? BS_WRITER_FORMAT_MIME : BS_WRITER_FORMAT_G192;

#ifdef IVAS_RTPDUMP
    if ( !arg.rtpdumpOutput && BS_Writer_Open_filename( &hBsWriter, arg.outputBitstreamFilename, bsWriterFormat ) != IVAS_ERR_OK )
#else
    if ( BS_Writer_Open_filename( &hBsWriter, arg.outputBitstreamFilename, bsWriterFormat ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nCan't open %s\n\n", arg.outputBitstreamFilename );
        goto cleanup;
@@ -763,18 +718,13 @@ int encoder_main(
        }
    }

#ifdef IVAS_RTPDUMP
    /*------------------------------------------------------------------------------------------*
     * RTPDump
     *------------------------------------------------------------------------------------------*/

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

    /*------------------------------------------------------------------------------------------*
     * Run the encoder
@@ -976,7 +925,6 @@ int encoder_main(
        }

        /* *** Encode one frame *** */
#ifdef IVAS_RTPDUMP
        if ( ivasRtp->hPack )
        {
            bool isMono = ( arg.inputFormat == IVAS_ENC_INPUT_MONO );
@@ -1024,11 +972,7 @@ int encoder_main(
                goto cleanup;
            }

#ifdef RTP_S4_251135_CR26253_0016_REV1
            if ( ( error = IVAS_RTP_WriteNextFrame( ivasRtp, au, NULL, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_RTP_WriteNextFrame( ivasRtp, au, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError %s while pushing audio frame to RTP pack\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
@@ -1036,7 +980,6 @@ int encoder_main(
        }
        else
        {
#endif
            if ( ( error = IVAS_ENC_EncodeFrameToSerial( hIvasEnc, pcmBuf, pcmBufSize, bitStream, &numBits ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nencodeFrame failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -1049,9 +992,7 @@ int encoder_main(
                fprintf( stderr, "\nBS_Writer_WriteFrame_short failed, error code %d\n\n", error );
                goto cleanup;
            }
#ifdef IVAS_RTPDUMP
        }
#endif

        frame++;
        if ( !arg.quietModeEnabled )
@@ -1120,7 +1061,6 @@ cleanup:
        fclose( f_bitrateProfile );
    }

#ifdef IVAS_RTPDUMP
    if ( sceneOrientationFileReader )
    {
        RotationFileReader_close( &sceneOrientationFileReader );
@@ -1132,7 +1072,6 @@ cleanup:
    }

    /* IVAS_RTP_Term( &ivasRtp ); */
#endif

    IVAS_ENC_Close( &hIvasEnc );

@@ -1185,11 +1124,9 @@ static bool parseCmdlIVAS_enc(
    arg->mimeOutput = false;
    arg->ism_extended_metadata = false;
    arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE;
#ifdef IVAS_RTPDUMP
    arg->rtpdumpOutput = false;
    arg->sceneOrientationTrajFileName = NULL;
    arg->deviceOrientationTrajFileName = NULL;
#endif
#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
    arg->forcedModeFile = NULL;
@@ -1968,7 +1905,6 @@ static bool parseCmdlIVAS_enc(
            i++;
        }

#ifdef IVAS_RTPDUMP
        /*-----------------------------------------------------------------*
         * RTPDump output
         *-----------------------------------------------------------------*/
@@ -2032,7 +1968,6 @@ static bool parseCmdlIVAS_enc(
            i++;
        }

#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -2246,14 +2181,12 @@ static void usage_enc( void )
#endif
    fprintf( stdout, "-q                  : Quiet mode, no frame counters\n" );
    fprintf( stdout, "                      default is deactivated\n" );
#ifdef IVAS_RTPDUMP
    fprintf( stdout, "-rtpdump <N>        : RTPDump output, hf_only=1 by default. The encoder will packetize the \n" );
    fprintf( stdout, "                      bitstream frames into TS26.253 Annex A IVAS RTP Payload Format packets and \n" );
    fprintf( stdout, "                      writes those to the output file. In EVS mono operating mode, TS26.445 Annex A.2.2 \n" );
    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" );
#endif
    fprintf( stdout, "\n" );

    return;
+0 −105
Original line number Diff line number Diff line
@@ -47,9 +47,7 @@
#endif
#include "stl.h"
#include "wmc_auto.h"
#ifdef RTP_S4_251135_CR26253_0016_REV1
#include "ivas_rtp_file.h"
#endif


#define WMC_TOOL_SKIP
@@ -82,9 +80,7 @@ static

typedef struct
{
#ifdef RTP_S4_251135_CR26253_0016_REV1
    bool srRtp;
#endif
    IVAS_AUDIO_CONFIG audioConfig;
    int32_t inputChannelIndex;
    float gain_dB;
@@ -106,9 +102,7 @@ typedef struct
    char executableName[POST_REND_MAX_CLI_ARG_LENGTH];
    char inputFilePath[POST_REND_MAX_CLI_ARG_LENGTH];
    char outputFilePath[POST_REND_MAX_CLI_ARG_LENGTH];
#ifdef RTP_S4_251135_CR26253_0016_REV1
    char srParamsFilePath[POST_REND_MAX_CLI_ARG_LENGTH];
#endif
    int32_t sampleRate;
    InputConfig inConfig;
    OutputConfig outConfig;
@@ -138,9 +132,7 @@ typedef enum
    CmdLnOptionId_listFormats,
    CmdLnOptionId_SplitRendBFIFile,
    CmdLnOptionId_framing,
#ifdef RTP_S4_251135_CR26253_0016_REV1
    CmdLnOptionId_srParamsFile,
#endif
} CmdLnOptionId;

static const CmdLnParser_Option cliOptions[] = {
@@ -216,14 +208,12 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "fr",
        .description = "Set Render audio framing.",
    },
#ifdef RTP_S4_251135_CR26253_0016_REV1
    {
        .id = CmdLnOptionId_srParamsFile,
        .match = "sr_params",
        .matchShort = "s",
        .description = "Path to the split rendering init params file",
    },
#endif
};


@@ -235,11 +225,7 @@ static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_

static void printSupportedAudioConfigs( void );

#ifdef RTP_S4_251135_CR26253_0016_REV1
static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString, bool *srRtp );
#else
static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString );
#endif

static void convertOutputBuffer( const Word32 *fixedBuffer, Word16 q, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer );

@@ -327,20 +313,14 @@ static bool parseInConfig(
    }

    /* Check for single-format inputs. The given string should map to a member of AUDIO_CONFIG enum. */
#ifdef RTP_S4_251135_CR26253_0016_REV1
    bool srRtp = false;
    IVAS_AUDIO_CONFIG audioConfig = parseAudioConfig( inFormatStr, &srRtp );
#else
    IVAS_AUDIO_CONFIG audioConfig = parseAudioConfig( inFormatStr );
#endif
    switch ( audioConfig )
    {
        case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
        case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
            inConfig->numBinBuses = 1;
#ifdef RTP_S4_251135_CR26253_0016_REV1
            inConfig->binBuses[0].srRtp = srRtp;
#endif
            inConfig->binBuses[0].audioConfig = audioConfig;
            inConfig->binBuses[0].inputChannelIndex = 0;
            inConfig->binBuses[0].gain_dB = 0.0f;
@@ -391,19 +371,13 @@ static bool parseRenderFramesize(


static IVAS_AUDIO_CONFIG parseAudioConfig(
#ifdef RTP_S4_251135_CR26253_0016_REV1
    const char *configString,
    bool *srRtp )
#else
    const char *configString )
#endif
{
    char charBuf[25];
    charBuf[24] = '\0';

#ifdef RTP_S4_251135_CR26253_0016_REV1
    *srRtp = false;
#endif
    strncpy( charBuf, configString, sizeof( charBuf ) - 1 );
    charBuf[sizeof( charBuf ) - 1] = '\0';
    to_upper( charBuf );
@@ -420,13 +394,11 @@ static IVAS_AUDIO_CONFIG parseAudioConfig(
    {
        return IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED;
    }
#ifdef RTP_S4_251135_CR26253_0016_REV1
    if ( strcmp( charBuf, "RTPDUMP" ) == 0 )
    {
        *srRtp = true;
        return IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED;
    }
#endif
    return IVAS_AUDIO_CONFIG_INVALID;
}

@@ -483,9 +455,7 @@ static CmdlnArgs defaultArgs(
    strncpy( args.executableName, executableName, POST_REND_MAX_CLI_ARG_LENGTH );
    clearString( args.inputFilePath );
    clearString( args.outputFilePath );
#ifdef RTP_S4_251135_CR26253_0016_REV1
    clearString( args.srParamsFilePath );
#endif
    args.sampleRate = 0;

    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID;
@@ -593,12 +563,10 @@ static void parseOption(
            }

            break;
#ifdef RTP_S4_251135_CR26253_0016_REV1
        case CmdLnOptionId_srParamsFile:
            assert( numOptionValues == 1 );
            strncpy( args->srParamsFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 );
            break;
#endif
        default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
            break;
@@ -635,9 +603,7 @@ static void printSupportedAudioConfigs( void )
        "BINAURAL (output only)",
        "BINAURAL_SPLIT_PCM",
        "BINAURAL_SPLIT_CODED",
#ifdef RTP_S4_251135_CR26253_0016_REV1
        "RTPDUMP",
#endif
    };

    fprintf( stdout, "Supported audio formats:\n" );
@@ -729,7 +695,6 @@ static void convertOutputBuffer(
    return;
}

#ifdef RTP_S4_251135_CR26253_0016_REV1
static void trim( char *str )
{
    char c;
@@ -749,9 +714,7 @@ static void trim( char *str )

static ivas_error parseSRParamsFile(
    const char *srParamsFilePath,
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    const char *rtpFilePath,
#endif
    ISAR_SPLIT_REND_CODEC *codec,
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection,
    int16_t *codec_frame_size_ms,
@@ -778,7 +741,6 @@ static ivas_error parseSRParamsFile(
            trim( key );
            trim( value );

#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
            if ( 0 == strncmp( key, "DOF", 3 ) )
            {
                int val = atoi( value );
@@ -795,51 +757,11 @@ static ivas_error parseSRParamsFile(
                    *lc3plusHighRes = (int16_t) val;
                }
            }
#else
            if ( 0 == strncmp( key, "CODEC", 5 ) )
            {
                *codec = ( 0 == strncmp( value, "LCLD", 4 ) ) ? ISAR_SPLIT_REND_CODEC_LCLD : *codec;
                *codec = ( 0 == strncmp( value, "LC3PLUS", 7 ) ) ? ISAR_SPLIT_REND_CODEC_LC3PLUS : *codec;
            }
            else if ( 0 == strncmp( key, "DOF", 3 ) )
            {
                int val = atoi( value );
                if ( val == 0 || val == 1 )
                {
                    *poseCorrection = ( val == 0 ) ? ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE : ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB;
                }
            }
            else if ( 0 == strncmp( key, "FRAMESIZE", 9 ) )
            {
                int val = atoi( value );
                if ( val == 5 || val == 10 || val == 20 )
                {
                    *codec_frame_size_ms = (int16_t) val;
                }
            }
            else if ( 0 == strncmp( key, "RENDERSIZE", 9 ) )
            {
                int val = atoi( value );
                if ( val == 5 || val == 10 || val == 20 )
                {
                    *isar_frame_size_ms = (int16_t) val;
                }
            }
            else if ( 0 == strncmp( key, "LC3PLUS_HIGHRES", 15 ) )
            {
                int val = atoi( value );
                if ( val == 0 || val == 1 )
                {
                    *lc3plusHighRes = (int16_t) val;
                }
            }
#endif
        }
    }

    fclose( fParamSR );

#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    {
        /* Peek the RTP stream to ascertain the codec and codec_frame_size */
        ivas_error error = IVAS_ERR_OK;
@@ -877,11 +799,9 @@ static ivas_error parseSRParamsFile(
        }
        IVAS_RTP_Term( &srRtp );
    }
#endif

    return IVAS_ERR_OK;
}
#endif


/*------------------------------------------------------------------------------------------*
@@ -923,9 +843,7 @@ int main(
    int16_t i, numChannels;
    ivas_error error = IVAS_ERR_OK;
    bool splitBinNeedsNewFrame = true;
#ifdef RTP_S4_251135_CR26253_0016_REV1
    IVAS_RTP srRTP = { 0 };
#endif

#ifdef WMOPS
    reset_wmops();
@@ -955,9 +873,7 @@ int main(
    convert_backslash( args.inputFilePath );
    convert_backslash( args.outputFilePath );
    convert_backslash( args.headRotationFilePath );
#ifdef RTP_S4_251135_CR26253_0016_REV1
    convert_backslash( args.srParamsFilePath );
#endif

    /*------------------------------------------------------------------------------------------*
     * Open head-rotation file
@@ -1008,13 +924,10 @@ int main(
        }
    }

#ifdef RTP_S4_251135_CR26253_0016_REV1
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].srRtp ) )
    {
        error = parseSRParamsFile( args.srParamsFilePath,
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
                                   args.inputFilePath,
#endif
                                   &bitsBuffer.config.codec,
                                   &bitsBuffer.config.poseCorrection,
                                   &bitsBuffer.config.codec_frame_size_ms,
@@ -1026,28 +939,18 @@ int main(
            goto cleanup;
        }

#ifndef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
        if ( ( error = IVAS_RTP_READER_Init( &srRTP, (uint32_t) bitsBuffer.config.codec_frame_size_ms, args.inputFilePath, NULL, false, NULL ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_RTP_READER_Init( &srRTP, args.inputFilePath, NULL, false, NULL ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "error in IVAS_RTP_READER_Init(): %d\n", error );
            goto cleanup;
        }
        audioReader = NULL;

#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
        /* Force owerwrite of command line provided rendersize to align with codec frame size */
        args.render_framesize = bitsBuffer.config.isar_frame_size_ms / 5;
#endif
    }
    /*if split renderer is running in post renderer mode*/
    else if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
#else
    /*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 ) )
#endif
    {
        error = split_rend_reader_open( &hSplitRendFileReadWrite,
                                        args.inputFilePath,
@@ -1254,7 +1157,6 @@ int main(
        num_in_channels = inBuffer.config.numChannels;

        numSamplesRead = 0;
#ifdef RTP_S4_251135_CR26253_0016_REV1
        if ( srRTP.hRtpFile && splitBinNeedsNewFrame )
        {
            IVAS_RTP_SR_INFO srInfo = { 0 };
@@ -1277,9 +1179,7 @@ int main(
                    if ( error == IVAS_ERR_END_OF_FILE )
                    {
                        numSamplesRead = 0;
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
                        break;
#endif
                    }
                    else
                    {
@@ -1301,9 +1201,6 @@ int main(
            }
        }
        else if ( ( hSplitRendFileReadWrite != NULL ) && splitBinNeedsNewFrame )
#else
        if ( ( hSplitRendFileReadWrite != NULL ) && splitBinNeedsNewFrame )
#endif
        {
            ivas_error error_tmp;
            numSamplesRead = (int16_t) inBufferSize;
@@ -1416,7 +1313,6 @@ int main(
                    goto cleanup;
                }

#ifdef FIX_1119_SPLIT_RENDERING_VOIP
                /* Set BFI if frame is empty */
                int16_t frameEmpty = (int16_t) ( bitsBuffer.config.bitsWritten == 0 );
                if ( frameEmpty )
@@ -1427,7 +1323,6 @@ int main(
                        goto cleanup;
                    }
                }
#endif
            }
        }

+0 −165

File changed.

Preview size limit exceeded, changes collapsed.

Loading