Commit 32356edf authored by vaclav's avatar vaclav
Browse files

update

parent 4ce9cb08
Loading
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -216,7 +216,9 @@ int main(
#ifdef DEBUG_SBA_AUDIO_DUMP
    int16_t numOutChannels, numTransportChannels, pca_ingest_channels;
#endif
#endif

#ifdef DEBUGGING
    dbgargs( &argc, argv );
#endif
#ifdef WMOPS
@@ -690,7 +692,8 @@ int main(
            }
        }

        /* ISAR frame size is set from command line, not renderer config file. This will be ignored if output format is not split rendering. */
        /* ISAR frame size is set from command line, not renderer config file.
         * This will be ignored if output format is not split rendering. */
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.renderFramesize /* given in number of 5ms subframes */ * 5;

        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
@@ -1025,7 +1028,6 @@ static bool parseCmdlIVAS_dec(
    arg->aeSequence.pValidity = NULL;
    arg->aeSequence.selected = 0;
    arg->aeSequence.frameCounter = 0;

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        arg->directivityPatternId[i] = 65535;
@@ -2237,6 +2239,7 @@ static ivas_error decodeG192(
    }
#endif
#endif

    /*------------------------------------------------------------------------------------------*
     * Loop for every packet (frame) of bitstream data
     * - Read the bitstream packet
@@ -2334,7 +2337,6 @@ static ivas_error decodeG192(
                    goto cleanup;
                }
            }

            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK )
@@ -2361,9 +2363,7 @@ static ivas_error decodeG192(
                        {
                            arg.aeSequence.selected = 0;
                        }

                        arg.aeSequence.frameCounter = 0;

                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                        {
                            if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -2377,7 +2377,6 @@ static ivas_error decodeG192(
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }

                        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -2394,7 +2393,6 @@ static ivas_error decodeG192(
                        fprintf( stderr, "\nError (%s) when reading TSM data from %s \n\n", arg.inputBitstreamFilename, TsmScaleFileReader_getFilePath( tsmScaleFileReader ) );
                        goto cleanup;
                    }

                    int16_t maxScaling;
                    /* max scaling as abs diff to the normal frame size in samples */
                    maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) );
@@ -2459,7 +2457,7 @@ static ivas_error decodeG192(
                    }
                }

                /* Decode transport channels, do TSM and feed to renderer */
                /* decode transport channels, do TSM and feed to renderer */
                if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, isSplitRend, splitRendBits ) ) != IVAS_ERR_OK )
                {
                    return error;
@@ -2657,7 +2655,6 @@ static ivas_error decodeG192(
        }

        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;

#ifdef WMOPS
        if ( vec_pos_update == 0 )
        {
@@ -3277,7 +3274,6 @@ static ivas_error decodeVoIP(
                    goto cleanup;
                }
            }

            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK )
@@ -3525,8 +3521,6 @@ static ivas_error decodeVoIP(
            }
        }

        frame++;

        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        if ( vec_pos_update == 0 )
        {
+1 −1
Original line number Diff line number Diff line
@@ -555,8 +555,8 @@ int main(
            goto cleanup;
        }
    }

#endif

    /*------------------------------------------------------------------------------------------*
     * Allocate input data buffer
     *------------------------------------------------------------------------------------------*/
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
*******************************************************************************************************/

#include "lib_isar_post_rend.h"


#include <assert.h>
#include <math.h>
#include <string.h>
+14 −25
Original line number Diff line number Diff line
@@ -1396,6 +1396,7 @@ int main(
                goto cleanup;
            }
        }

        if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nFailed to open file: %s\n", args.outputFilePath );
@@ -1476,9 +1477,8 @@ int main(
    while ( 1 )
    {
        int16_t num_in_channels;
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;

        num_in_channels = inBuffer.config.numChannels;
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;

        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
             args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 )
@@ -1489,9 +1489,7 @@ int main(
                {
                    args.aeSequence.selected = 0;
                }

                args.aeSequence.frameCounter = 0;

                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                {
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -1505,7 +1503,6 @@ int main(
                    fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }

                if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) );
@@ -1546,14 +1543,12 @@ int main(
                    fprintf( stderr, "\nVector3PairFileReader_read failed: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }

                if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_REND_SetReferenceVector failed: %s\n", ivas_error_to_string( error ) );
                    goto cleanup;
                }
            }

            /* Read from reference rotation trajectory file if specified */
            if ( referenceRotReader != NULL )
            {
@@ -1613,7 +1608,6 @@ int main(
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
            {
                if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quatBuffer[sf_idx], &enableHeadRotation[sf_idx], &enableExternalOrientation[sf_idx], &enableRotationInterpolation[sf_idx], &numFramesToTargetOrientation[sf_idx] ) ) != IVAS_ERR_OK )
@@ -1622,7 +1616,6 @@ int main(
                    goto cleanup;
                }
            }

            for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
            {
                if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quatBuffer[sf_idx], enableHeadRotation[sf_idx], enableExternalOrientation[sf_idx], enableRotationInterpolation[sf_idx], numFramesToTargetOrientation[sf_idx], sf_idx ) ) != IVAS_ERR_OK )
@@ -1634,14 +1627,13 @@ int main(
        }

        /* Combine external orientations and head rotation */

        if ( ( error = IVAS_REND_CombineHeadAndExternalOrientation( hIvasRend ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError combining external and head orientations: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

        IVAS_REND_ReadOnlyAudioBuffer tmpBuffer;

        for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i )
        {
            if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK )
@@ -1649,8 +1641,7 @@ int main(
                fprintf( stderr, "\nIVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.multiChannelBuses[i].inputChannelIndex, numChannels );
            IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.multiChannelBuses[i].inputChannelIndex, numChannels );

            if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
            {
@@ -1665,7 +1656,7 @@ int main(
            {
                if ( i == 0 )
                {
                    tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, args.inConfig.numAudioObjects );
                    IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, args.inConfig.numAudioObjects );

                    if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
                    {
@@ -1682,7 +1673,7 @@ int main(
            }
            else
            {
                tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, 1 );
                IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, 1 );

                if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
                {
@@ -1705,8 +1696,7 @@ int main(
                fprintf( stderr, "\nIVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.ambisonicsBuses[i].inputChannelIndex, numChannels );
            IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.ambisonicsBuses[i].inputChannelIndex, numChannels );

            if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
            {
@@ -1722,8 +1712,7 @@ int main(
                fprintf( stderr, "IVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.masaBuses[i].inputChannelIndex, numChannels );
            IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.masaBuses[i].inputChannelIndex, numChannels );

            if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
            {
@@ -1796,7 +1785,8 @@ int main(

        if ( is_split_pre_rend_mode( &args ) )
        {
            if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ) != IVAS_ERR_OK )
            if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead,
                                                     &bitsBuffer.config.bitsWritten ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nUnable to write to bitstream file!\n" );
                goto cleanup;
@@ -1841,7 +1831,6 @@ int main(
                numInputFormats++;
                inputType1 = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS;
            }

            if ( args.inConfig.numMultiChannelBuses > 0 )
            {
                numInputFormats++;
@@ -1850,7 +1839,6 @@ int main(
                    inputType1 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED;
                }
            }

            if ( args.inConfig.numMasaBuses > 0 )
            {
                numInputFormats++;
@@ -1859,7 +1847,6 @@ int main(
                    inputType1 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA;
                }
            }

            if ( args.inConfig.numAudioObjects > 0 )
            {
                numInputFormats++;
@@ -2248,6 +2235,7 @@ static bool parseDiegeticPan(
    return true;
}


static bool parseRenderFramesize(
    char *value,
    IVAS_RENDER_FRAMESIZE *render_framesize )
@@ -2277,6 +2265,7 @@ static bool parseRenderFramesize(

    return true;
}

static bool parseOrientationTracking(
    char *value,
    IVAS_HEAD_ORIENT_TRK_T *orientation_tracking )
@@ -3273,6 +3262,7 @@ static void parseObjectPosition(
    int16_t read_values;
    float meta_prm[8] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };


    readNextMetadataChunk( line, "," );
    *positionDuration = (uint16_t) strtol( line, &endptr, 10 );
    readNextMetadataChunk( line, "\n" );
@@ -3708,8 +3698,7 @@ static void parseSceneDescriptionFile(
    return;
}

static void printSupportedAudioConfigs(
    void )
static void printSupportedAudioConfigs( void )
{
    uint16_t i;
    const char *supportedFormats[] = {
+11 −9
Original line number Diff line number Diff line
@@ -1114,6 +1114,7 @@ enum
    TOTAL_DECD_QUANT_STRATS
 };


/*----------------------------------------------------------------------------------*
 * MASA constants
 *----------------------------------------------------------------------------------*/
@@ -1271,6 +1272,7 @@ typedef enum

#define MCMASA_MIN_SPEAKERS_SEPARATE_CENTER     4


/*----------------------------------------------------------------------------------*
 * MCT constants
 *----------------------------------------------------------------------------------*/
@@ -1394,6 +1396,7 @@ typedef enum
#define PARAM_MC_MDFT_NO_SLOTS                  8
#define PARAM_MC_CLDFB_TO_MDFT_FAC              2


/*----------------------------------------------------------------------------------*
 * LFE Coding Constants
 *----------------------------------------------------------------------------------*/
@@ -1551,7 +1554,6 @@ typedef enum
} SFX_OpMode_t;



/*----------------------------------------------------------------------------------*
 * Reverberator constants
 *----------------------------------------------------------------------------------*/
Loading