Commit 646d7633 authored by vaclav's avatar vaclav
Browse files

formatting

parent 0ac7509a
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ int main(
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

@@ -662,8 +662,7 @@ int main(
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
               arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS &&
                 ( renderConfig.split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
@@ -1461,7 +1460,7 @@ static bool parseCmdlIVAS_dec(
            arg->outputMdFilename = argv[i + 1];
            if ( arg->outputMdFilename[0] == '\0' )
            {
                fprintf( stderr, "Error: output metadata file path not specified\n\n" );
                fprintf( stderr, "Error: Split rendering output metadata file path not specified\n\n" );
                usage_dec();
                return false;
            }
@@ -2258,6 +2257,7 @@ static ivas_error decodeG192(
        }
    }
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        ismWriters[i] = NULL;
@@ -2569,10 +2569,8 @@ static ivas_error decodeG192(
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
                if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )

#else
            if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )

#endif
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -2917,6 +2915,7 @@ static ivas_error decodeG192(
     *------------------------------------------------------------------------------------------*/

    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( afWriter != NULL )
    {
@@ -3327,12 +3326,11 @@ static ivas_error decodeVoIP(

            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                           ,
                                                           DEFAULT_AXIS
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i ) ) != IVAS_ERR_OK )
#endif
                                                           ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -3419,7 +3417,6 @@ static ivas_error decodeVoIP(


        /* decode and get samples */

#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef SUPPORT_JBM_TRACEFILE
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
+46 −10
Original line number Diff line number Diff line
@@ -229,6 +229,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 +276,6 @@ static int16_t getTotalNumInChannels(
    return totalNumInChannels;
}

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

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


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


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


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


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


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


/*------------------------------------------------------------------------------------------*
 * main()
 *
@@ -732,6 +735,9 @@ int main(
    bitsBuffer.config.poseCorrection = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
    bitsBuffer.config.codec_frame_size_ms = 20;

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

    CmdlnArgs args = parseCmdlnArgs( argc, argv );

@@ -739,6 +745,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 )
@@ -748,12 +758,20 @@ int main(
        }
    }

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

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

    /*------------------------------------------------------------------------------------------*
     * Open input files
     *------------------------------------------------------------------------------------------*/

    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 ) )
@@ -831,6 +849,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 )
@@ -839,7 +862,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 ) );
@@ -856,9 +882,7 @@ int main(
        }
    }


    ISAR_POST_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS];

    for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; i++ )
    {
        splitBinIds[i] = 0u;
@@ -874,7 +898,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" );
@@ -882,13 +905,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 ) );
@@ -941,6 +967,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;
@@ -1171,7 +1204,10 @@ int main(
    }
#endif

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

    free( inpInt16Buffer );
    free( inFloatBuffer );
    free( outInt16Buffer );
+5 −4
Original line number Diff line number Diff line
@@ -657,6 +657,7 @@ static int16_t get_cldfb_in_flag(
    return cldfb_in_flag;
}


static int16_t is_split_pre_rend_mode(
    CmdlnArgs *args )
{
@@ -827,6 +828,7 @@ int main(
        SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader );
    }
#endif

    if ( !isEmptyString( args.externalOrientationFilePath ) )
    {
        if ( RotationFileReader_open( args.externalOrientationFilePath, &externalOrientationFileReader ) != IVAS_ERR_OK )
@@ -1062,7 +1064,6 @@ int main(
        }
#endif


        if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -1778,7 +1779,7 @@ int main(
        {
            if ( ( error = IVAS_REND_GetSplitBinauralBitstream( hIvasRend, outBuffer, &bitsBuffer ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                fprintf( stderr, "Error in IVAS_REND_GetSplitBinauralBitstream(): %s\n", ivas_error_to_string( error ) );
                exit( -1 );
            }
        }
@@ -1788,7 +1789,7 @@ int main(
            if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                fprintf( stderr, "Error %s\n", ivas_error_to_string( error ) );
                fprintf( stderr, "Error inIVAS_REND_GetSamples()%s\n", ivas_error_to_string( error ) );
#else
            fprintf( stderr, "Error in getting samples\n" );
#endif
@@ -1994,7 +1995,6 @@ int main(
    }
#endif


    if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
        fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / IVAS_NUM_FRAMES_PER_SEC / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) );
@@ -2033,6 +2033,7 @@ cleanup:
        free( bitsBufferData );
    }
#endif

#ifdef FIX_1053_REVERB_RECONFIGURATION
    if ( args.aeSequence.count > 0 )
    {
+1 −0
Original line number Diff line number Diff line
@@ -335,6 +335,7 @@ typedef struct
#ifdef SPLIT_REND_WITH_HEAD_ROT
    int16_t is_cldfb;
#endif

} IVAS_REND_AudioBufferConfig;

typedef struct
+3 −3
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ int32_t get_delay(
    const IVAS_FORMAT ivas_format, /* i  : IVAS format                         */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    HANDLE_CLDFB_FILTER_BANK hCldfb,   /* i  : Handle of Cldfb analysis            */
    const AUDIO_CONFIG output_config /* i  : decoder output config              */
    const int16_t flag_split_rendering /* i  : split rendering on/off flag         */
#else
    HANDLE_CLDFB_FILTER_BANK hCldfb /* i  : Handle of Cldfb analysis            */
#endif
@@ -103,7 +103,7 @@ int32_t get_delay(
            delay = IVAS_DEC_DELAY_NS;

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
            if ( !flag_split_rendering )
            {
#endif
                if ( hCldfb != NULL )
Loading