Commit d574fef8 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_293_EXT_RENDERER_CLI

parent 1cf10e89
Loading
Loading
Loading
Loading
+0 −47
Original line number Diff line number Diff line
@@ -1073,7 +1073,6 @@ static IVAS_REND_AudioConfig ambisonicsOrderToEnum(
    return IVAS_REND_AUDIO_CONFIG_UNKNOWN;
}

#ifdef FIX_293_EXT_RENDERER_CLI
static const CmdLnParser_Option *findOptionById(
    const int32_t id )
{
@@ -1087,7 +1086,6 @@ static const CmdLnParser_Option *findOptionById(

    return NULL;
}
#endif

static bool parseInConfig(
    const char *inFormatStr,
@@ -1176,13 +1174,9 @@ static bool parseInConfig(

                if ( error == IVAS_ERR_FAILED_FILE_OPEN )
                {
#ifdef FIX_293_EXT_RENDERER_CLI
                    /* Failed to open with given string - most likely wasn't a file path */
                    const CmdLnParser_Option *listOption = findOptionById( CmdLnOptionId_listFormats );
                    fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match );
#else
                    fprintf( stderr, "Unsupported input format: %s\n", inFormatStr );
#endif
                    return false;
                }
                if ( error != IVAS_ERR_OK )
@@ -1197,7 +1191,6 @@ static bool parseInConfig(
            }
            break;
        default:
#ifdef FIX_293_EXT_RENDERER_CLI
        {
            /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum,
             * but cannot be used at input, e.g. BINAURAL */
@@ -1205,12 +1198,6 @@ static bool parseInConfig(
            fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match );
            return false;
        }
#else
            /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum,
             * but cannot be used at input, e.g. BINAURAL */
            fprintf( stderr, "Unsupported input format: %s\n", inFormatStr );
            return false;
#endif
    }

    return true;
@@ -1344,7 +1331,6 @@ static IVAS_REND_AudioConfig parseAudioConfig(
    }
    if ( strncmp( charBuf, "ISM", 3 ) == 0 )
    {
#ifdef FIX_293_EXT_RENDERER_CLI
        /* Accept input config as ISM only if the 4th character is a number from 1 to 4.
         * Otherwise, do nothing. Unknown audio config will be returned. */
        switch ( charBuf[3] )
@@ -1355,9 +1341,6 @@ static IVAS_REND_AudioConfig parseAudioConfig(
            case '4':
                return IVAS_REND_AUDIO_CONFIG_OBJECT;
        }
#else
        return IVAS_REND_AUDIO_CONFIG_OBJECT;
#endif
    }
    if ( strncmp( charBuf, "MASA", 4 ) == 0 )
    {
@@ -1431,21 +1414,6 @@ static bool parseLfePositionConfig(
    return true;
}

#ifndef FIX_293_EXT_RENDERER_CLI
static const CmdLnParser_Option *findOptionById(
    const int32_t id )
{
    for ( int32_t i = 0; i < numCliOptions; ++i )
    {
        if ( cliOptions[i].id == id )
        {
            return &cliOptions[i];
        }
    }

    return NULL;
}
#endif

static bool checkRequiredArgs(
    CmdlnArgs args )
@@ -1758,7 +1726,6 @@ void IsmPositionProvider_getNextFrame(

    for ( objIdx = 0; objIdx < positionProvider->numObjects; ++objIdx )
    {
#ifdef FIX_293_EXT_RENDERER_CLI
        /* If ISM metadata reader is open, read from metadata file */
        if ( positionProvider->ismReaders[objIdx] != NULL )
        {
@@ -1775,16 +1742,6 @@ void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].azimuth = 0.0f;
            objectMetadataBuffer->positions[objIdx].elevation = 0.0f;
        }
#else
        if ( positionProvider->ismReaders[objIdx] != NULL )
        {
            getMetadataFromFileReader( positionProvider->ismReaders[objIdx], objectMetadataBuffer, objIdx );
        }
        else
        {
            readFromShorthandMetadata( positionProvider, objectMetadataBuffer, objIdx );
        }
#endif

        /* Wrap azimuth to lie within (-180, 180] range */
        while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f )
@@ -2172,11 +2129,7 @@ static void parseMasa(
    if ( strncmp( line, "MASA", 4 ) != 0 )
    {
        char numTcs = *line;
#ifdef FIX_293_EXT_RENDERER_CLI
        snprintf( line, 6 /* write at most 6 characters: MASAx + null termination */, "MASA%c", numTcs );
#else
        sprintf( line, "MASA%c", numTcs );
#endif
    }

    inConfig->masaBuses[idx].audioConfig = parseAudioConfig( line );
+0 −1
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@
#endif
#define FIX_I59_DELAY_ROUNDING                          /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */
#define FIX_FIX_I59                                     /* Issue 59:  small fix concerning LFE delay rounding */
#define FIX_293_EXT_RENDERER_CLI                        /* FhG: Fix bugs in external renderer CLI */
#define FIX_268                                         /* Issue 268: Add low cost dry-run of memory analysis */
#define LOW_RATE_TRANS_FIX                              /* Eri: Fix for critical item during transitions */

+0 −4
Original line number Diff line number Diff line
@@ -2842,11 +2842,7 @@ static IVAS_REND_InputId makeInputId(
    /* Put config type in second byte (from LSB), put index + 1 in first byte
     *
     * Index is incremented here so that a valid ID can never be 0. */
#ifdef FIX_293_EXT_RENDERER_CLI
    return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) );
#else
    return (IVAS_REND_InputId) ( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) );
#endif
}

static ivas_error getInputById(
+0 −8
Original line number Diff line number Diff line
@@ -64,11 +64,7 @@ ivas_error IsmFileWriter_open(
    FILE *file;

    strncpy( metadata_filename_loc, filePathWav, sizeof( metadata_filename_loc ) - 1 );
#ifdef FIX_293_EXT_RENDERER_CLI
    snprintf( ext_meta, sizeof( ext_meta ), ".%d.csv", obj_num );
#else
    sprintf( ext_meta, ".%d.csv", obj_num );
#endif
    const int32_t maxNumCharactersToAppend = (int32_t) sizeof( metadata_filename_loc ) - strlen( metadata_filename_loc ) - 1;
    strncat( metadata_filename_loc, ext_meta, maxNumCharactersToAppend );

@@ -120,11 +116,7 @@ ivas_error IsmFileWriter_writeFrame(
    file = ismWriter->file;

    /* IVAS_fmToDo: work in progress; currently position_azimuth, position_elevation, position_radius, spread, gain_factor */
#ifdef FIX_293_EXT_RENDERER_CLI
    snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor );
#else
    sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor );
#endif

    if ( file )
    {
+0 −4
Original line number Diff line number Diff line
@@ -66,11 +66,7 @@ static void getExtMasaMetadataFileName(
    /* sizeof( ext_meta ) accounts for terminating NULL, don't subtract extra 1 */
    const int32_t maxNameLenWithoutExt = sizeof( metadata_filename[0] ) - sizeof( ext_meta );
    strncpy( metadata_filename[0], outputWavFilename, maxNameLenWithoutExt );
#ifdef FIX_293_EXT_RENDERER_CLI
    snprintf( ext_meta, sizeof( ext_meta ), ".met" );
#else
    sprintf( ext_meta, ".met" );
#endif

    /* strlen( metadata_filename[0] ) doesn't account for terminating NULL, subtract extra 1 */
    const int32_t maxNumCharactersToAppend = (int32_t) ( sizeof( metadata_filename[0] ) - strlen( metadata_filename[0] ) - 1 );