Commit 363a8903 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[cleanup] accept SPLIT_REND_WITH_HEAD_ROT

parent a3804b2d
Loading
Loading
Loading
Loading
+0 −128
Original line number Diff line number Diff line
@@ -43,9 +43,7 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "split_render_file_read_write.h"
#endif
#include "vector3_pair_file_reader.h"
#include "wmc_auto.h"
#include "options.h"
@@ -117,9 +115,7 @@ typedef struct
    Word16 non_diegetic_pan_gain_fx; /* Q15 */
    bool renderConfigEnabled;
    char *renderConfigFilename;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    char *outputMdFilename;
#endif
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
    bool tsmEnabled;
    IVAS_RENDER_FRAMESIZE renderFramesize;
@@ -136,11 +132,7 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );


@@ -157,10 +149,8 @@ int main(
    bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */
    DecArguments arg;
    ivas_error error = IVAS_ERR_UNKNOWN;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_BITS_DATA splitRendBits;
    uint8_t splitRendBitsBuf[ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES];
#endif

    /* Any handles that require cleanup must be declared here and initialized to NULL */
    IVAS_DEC_HANDLE hIvasDec = NULL;
@@ -185,9 +175,7 @@ int main(
    reset_mem( USE_BYTES );
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    splitRendBits.bits_buf = splitRendBitsBuf;
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -235,7 +223,6 @@ int main(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
    {
        fprintf( stdout, "Output metadata file:   %s\n", arg.outputWavFilename );
@@ -246,7 +233,6 @@ int main(
        fprintf( stdout, "Output metadata file:   %s\n", arg.outputMdFilename );
    }
    else
#endif
    {
        fprintf( stdout, "Output synthesis file:  %s\n", arg.outputWavFilename );
    }
@@ -281,9 +267,7 @@ int main(
    {
        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#ifdef SPLIT_REND_WITH_HEAD_ROT
             && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM
#endif
        )
        {
            fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" );
@@ -385,10 +369,8 @@ int main(
    {
        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#ifdef SPLIT_REND_WITH_HEAD_ROT
             && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
             arg.Opt_non_diegetic_pan == 0
#endif
        )
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
@@ -425,7 +407,6 @@ int main(
        fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" );
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /*------------------------------------------------------------------------------------------*
     * Configure Split rendering
     *------------------------------------------------------------------------------------------*/
@@ -447,7 +428,6 @@ int main(

        arg.enableHeadRotation = true;
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Configure VoIP mode
@@ -473,7 +453,6 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

        /* sanity check */
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
             arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
             arg.Opt_non_diegetic_pan == 0 )
@@ -481,13 +460,6 @@ int main(
            fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" );
            goto cleanup;
        }
#else
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            fprintf( stderr, "\nExternal Renderer Config is supported only for binaural output configurations. Exiting. \n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK )
        {
@@ -513,7 +485,6 @@ int main(
            renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( ( 1u << 15 ) - 1 ) );
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
               arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
@@ -538,7 +509,6 @@ int main(
                fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" );
            }
        }
#endif

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
@@ -557,11 +527,9 @@ int main(
            }
            renderConfig.roomAcoustics.override = true;
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        /* 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;
#endif

        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
        {
@@ -791,11 +759,7 @@ int main(
    }
    else
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -933,7 +897,6 @@ static IVAS_AUDIO_CONFIG cmdline2config(
    {
        output_config = IVAS_AUDIO_CONFIG_BINAURAL;
    }
#ifdef SPLIT_REND_WITH_HEAD_ROT
    else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CODED" ) == 0 )
    {
        output_config = IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED;
@@ -942,7 +905,6 @@ static IVAS_AUDIO_CONFIG cmdline2config(
    {
        output_config = IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM;
    }
#endif
    else if ( strcmp( argv_to_upper, "BINAURAL_ROOM_IR" ) == 0 )
    {
        output_config = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;
@@ -1010,9 +972,7 @@ static bool parseCmdlIVAS_dec(
    arg->renderConfigFilename = NULL;
    arg->Opt_dpid_on = 0;

#ifdef SPLIT_REND_WITH_HEAD_ROT
    arg->outputMdFilename = NULL;
#endif

    arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
    arg->Opt_non_diegetic_pan = 0;
@@ -1260,7 +1220,6 @@ static bool parseCmdlIVAS_dec(
            }
            i += 2;
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        else if ( strcmp( argv_to_upper, "-OM" ) == 0 )
        {
            arg->outputMdFilename = argv[i + 1];
@@ -1272,7 +1231,6 @@ static bool parseCmdlIVAS_dec(
            }
            i += 2;
        }
#endif
        else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
        {
            i++;
@@ -1439,14 +1397,12 @@ static bool parseCmdlIVAS_dec(
            usage_dec();
            return false;
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( arg->outputMdFilename != NULL && arg->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            fprintf( stderr, "Error: Output split rendering metadata file is supported for BINAURAL_SPLIT_PCM output config. only\n\n" );
            usage_dec();
            return false;
        }
#endif
    }
    else
    {
@@ -1523,13 +1479,8 @@ static void usage_dec( void )

    fprintf( stdout, "Mandatory parameters:\n" );
    fprintf( stdout, "---------------------\n" );
#ifdef SPLIT_REND_WITH_HEAD_ROT
    fprintf( stdout, "OutputConf           : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" );
    fprintf( stdout, "                       HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, BINAURAL_SPLIT_CODED, BINAURAL_SPLIT_PCM, EXT\n" );
#else
    fprintf( stdout, "OutputConf           : Output configuration: MONO, STEREO, 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4, FOA,\n" );
    fprintf( stdout, "                       HOA2, HOA3, BINAURAL, BINAURAL_ROOM_IR, BINAURAL_ROOM_REVERB, EXT\n" );
#endif
    fprintf( stdout, "                       By default, channel order and loudspeaker positions are equal to the\n" );
    fprintf( stdout, "                       encoder. For loudspeaker outputs, OutputConf can be a custom loudspeaker\n" );
    fprintf( stdout, "                       layout file. See readme.txt for details.\n" );
@@ -1569,9 +1520,7 @@ static void usage_dec( void )
    fprintf( stdout, "-rvf File           : Reference vector specified by external trajectory File\n" );
    fprintf( stdout, "                      works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" );
    fprintf( stdout, "-render_config File : Renderer configuration File\n" );
#ifdef SPLIT_REND_WITH_HEAD_ROT
    fprintf( stdout, "-om File            : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" );
#endif
    fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" );
    fprintf( stdout, "                      left or l or 90->left, right or r or -90->right, center or c or  0->middle\n" );
    fprintf( stdout, "-exof File          : External orientation File for external orientation trajectory\n" );
@@ -1601,12 +1550,8 @@ static ivas_error initOnFirstGoodFrame(
    IVAS_DEC_HANDLE hIvasDec,          /* i/o: */
    const DecArguments arg,            /* i  : */
    const int16_t numInitialBadFrames, /* i  : */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    int16_t *numOutSamples, /* i/o: */
    int16_t *vec_pos_len,   /* i/o: */
#else
    const uint16_t numOutSamples, /* i  : */
#endif
    int16_t *pFullDelayNumSamples,                   /* o  : */
    int16_t *pRemainingDelayNumSamples,              /* o  : */
    int32_t *delayTimeScale,                         /* o  : */
@@ -1615,12 +1560,8 @@ static ivas_error initOnFirstGoodFrame(
    MasaFileWriter **ppMasaWriter,                   /* o  : */
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS], /* o  : */
    int16_t *pNumOutChannels,                        /* o  : */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    uint16_t *pNumObj, /* o  : */
    SplitFileReadWrite **splitRendWriter
#else
    uint16_t *pNumObj             /* o  : */
#endif
)
{
    ivas_error error = IVAS_ERR_UNKNOWN;
@@ -1632,12 +1573,10 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
    {
        pFullDelayNumSamples[0] = 0;
    }
#endif

    if ( !arg.delayCompensationEnabled )
    {
@@ -1659,7 +1598,6 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
    {
        /* Open split rendering metadata writer */
@@ -1738,23 +1676,19 @@ static ivas_error initOnFirstGoodFrame(

    if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
    {
#endif
        /* Open audio writer and write all previously skipped bad frames now that frame size is known */
        if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename );
            return error;
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
    }
#endif

    int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
    memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );

    for ( int16_t i = 0; i < numInitialBadFrames; ++i )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( *splitRendWriter != NULL )
        {
            ISAR_SPLIT_REND_BITS_DATA splitRendBitsZero;
@@ -1775,19 +1709,10 @@ static ivas_error initOnFirstGoodFrame(
        }
        else
        {
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( *pRemainingDelayNumSamples < *numOutSamples )
#else
        if ( *pRemainingDelayNumSamples < numOutSamples )
#endif
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
#else
            if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nOutput audio file writer error\n" );
                    return error;
@@ -1796,15 +1721,9 @@ static ivas_error initOnFirstGoodFrame(
            }
            else
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                *pRemainingDelayNumSamples -= *numOutSamples;
#else
            *pRemainingDelayNumSamples -= numOutSamples;
#endif
            }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        }
#endif
    }

    free( zeroBuf );
@@ -1890,7 +1809,6 @@ static ivas_error initOnFirstGoodFrame(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( *splitRendWriter != NULL )
    {
        if ( numOutSamples == NULL || vec_pos_len == NULL )
@@ -1910,7 +1828,6 @@ static ivas_error initOnFirstGoodFrame(
            return error;
        }
    }
#endif

    return IVAS_ERR_OK;
}
@@ -1929,9 +1846,7 @@ static ivas_error decodeG192(
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#endif
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )

@@ -1958,9 +1873,7 @@ static ivas_error decodeG192(
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    SplitFileReadWrite *splitRendWriter = NULL;
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
@@ -2058,7 +1971,6 @@ static ivas_error decodeG192(
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( headRotReader == NULL )
            {
                for ( i = 0; i < num_subframes; i++ )
@@ -2076,7 +1988,6 @@ static ivas_error decodeG192(
            }
            else
            {
#endif
                for ( i = 0; i < num_subframes; i++ )
                {
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
@@ -2085,17 +1996,11 @@ static ivas_error decodeG192(
                        goto cleanup;
                    }
                }
#ifdef SPLIT_REND_WITH_HEAD_ROT
            }
#endif

            for ( i = 0; i < num_subframes; i++ )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                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
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -2154,7 +2059,6 @@ static ivas_error decodeG192(
                }
            }

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
            {
                if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (Word16 *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
@@ -2168,7 +2072,6 @@ static ivas_error decodeG192(
            }
            else
            {
#endif
                if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -2176,9 +2079,7 @@ static ivas_error decodeG192(
                }
                nSamplesRendered += nSamplesRendered_loop;
                nSamplesToRender -= nSamplesRendered_loop;
#ifdef SPLIT_REND_WITH_HEAD_ROT
            }
#endif
            if ( needNewFrame )
            {

@@ -2209,11 +2110,7 @@ static ivas_error decodeG192(
            /* Once good frame decoded, catch up */
            if ( decodedGoodFrame )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
#else
                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj ) ) != IVAS_ERR_OK )
#endif
                {
                    goto cleanup;
                }
@@ -2227,7 +2124,6 @@ static ivas_error decodeG192(
        /* Write current frame */
        if ( decodedGoodFrame )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
            {
                if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits->bits_buf, &splitRendBits->bits_read, &splitRendBits->bits_written ) != IVAS_ERR_OK )
@@ -2239,7 +2135,6 @@ static ivas_error decodeG192(

            if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
            {
#endif
                if ( delayNumSamples < nOutSamples )
                {
                    if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK )
@@ -2253,9 +2148,7 @@ static ivas_error decodeG192(
                {
                    delayNumSamples -= nOutSamples;
                }
#ifdef SPLIT_REND_WITH_HEAD_ROT
            }
#endif
        }

        /* Write ISm metadata to external file(s) */
@@ -2369,11 +2262,7 @@ static ivas_error decodeG192(
                goto cleanup;
            }

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0 ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
@@ -2493,18 +2382,14 @@ static ivas_error decodeG192(
     *------------------------------------------------------------------------------------------*/

    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( afWriter != NULL )
    {
#endif
        if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Close files and deallocate resources
@@ -2514,9 +2399,7 @@ static ivas_error decodeG192(

cleanup:

#ifdef SPLIT_REND_WITH_HEAD_ROT
    split_rend_reader_writer_close( &splitRendWriter );
#endif
    AudioFileWriter_close( &afWriter );
    MasaFileWriter_close( &masaWriter );
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
@@ -2763,7 +2646,6 @@ static ivas_error decodeVoIP(
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( headRotReader == NULL )
            {
                for ( i = 0; i < num_subframes; i++ )
@@ -2781,7 +2663,6 @@ static ivas_error decodeVoIP(
            }
            else
            {
#endif
                for ( i = 0; i < num_subframes; i++ )
                {
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
@@ -2791,17 +2672,13 @@ static ivas_error decodeVoIP(
                        goto cleanup;
                    }
                }
#ifdef SPLIT_REND_WITH_HEAD_ROT
            }
#endif

            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
#endif
                                                           ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -2929,15 +2806,10 @@ static ivas_error decodeVoIP(
            /* Once good frame decoded, catch up */
            if ( decodedGoodFrame )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                SplitFileReadWrite *splitRendWriter = NULL;

                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
                                                     &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
#else
                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
                                                     &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj ) ) != IVAS_ERR_OK )
#endif
                {
                    goto cleanup;
                }
+0 −12
Original line number Diff line number Diff line
@@ -33,17 +33,6 @@
#include "lib_isar_post_rend.h"
//#undef IVAS_FLOAT_FIXED

#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>
@@ -1242,4 +1231,3 @@ int main(

#undef WMC_TOOL_SKIP
#endif /* SPLIT_REND_WITH_HEAD_ROT */
+0 −150

File changed.

Preview size limit exceeded, changes collapsed.

+0 −5
Original line number Diff line number Diff line
@@ -3077,13 +3077,8 @@ enum
#define SYNC_BAD_FRAME                        (UWord16) 0x6B20         /* synchronization word of a "bad" frame */
#define G192_BIN0                             (UWord16) 0x007F         /* binary "0" according to ITU-T G.192 */
#define G192_BIN1                             (UWord16) 0x0081         /* binary "1" according to ITU-T G.192 */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#define DEGREE_180                            (Word32)(180.0 *ONE_IN_Q22)
#define DEGREE_360                            (Word32)(360.0 *ONE_IN_Q22)
#else
#define DEGREE_180                            (Word32)(180.0 *ONE_IN_Q23)
#define DEGREE_360                            (Word32)(360.0 *ONE_IN_Q23)
#endif
extern const Word16 Idx2Freq_Tbl[];

#define chk_fs(fs)
+0 −6
Original line number Diff line number Diff line
@@ -219,7 +219,6 @@ typedef struct _IVAS_JBM_TRACE_DATA
} IVAS_JBM_TRACE_DATA;


#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------------------*
 * Split rendering API constants, structures, and enums
 *----------------------------------------------------------------------------------*/
@@ -301,7 +300,6 @@ typedef struct _ISAR_SPLIT_REND_CONFIG
    int16_t lc3plus_highres;

} ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE;
#endif

/*----------------------------------------------------------------------------------*
 * Renderer API structures and enums
@@ -348,9 +346,7 @@ typedef struct _IVAS_RENDER_CONFIG
    IVAS_RENDER_TYPE_OVERRIDE renderer_type_override;
#endif
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcoustics;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ISAR_SPLIT_REND_CONFIG_DATA split_rend_config;
#endif
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];
    Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3]; // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15}
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;
@@ -359,9 +355,7 @@ typedef struct
{
    int16_t numSamplesPerChannel;
    int16_t numChannels;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    int16_t is_cldfb;
#endif
} IVAS_REND_AudioBufferConfig;

typedef struct
Loading