Commit 0fff1f91 authored by Jan Brouwer's avatar Jan Brouwer
Browse files

add acoustic environment ID command line options (-aeID) to decoder and renderer

parent 63246d1a
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -80,10 +80,6 @@ static
#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC     ( 3 )
#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 )

#ifdef CONTROL_METADATA_REVERB
#define ACOUSTIC_ENVIRONMENT_ID ( 0 )
#endif

#ifdef VARIABLE_SPEED_DECODING
#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20
#endif
@@ -146,6 +142,10 @@ typedef struct
#endif
#endif

#ifdef CONTROL_METADATA_REVERB
    uint16_t acousticEnvironmentId;
#endif

} DecArguments;


@@ -572,7 +572,7 @@ int main(
#ifdef CONTROL_METADATA_REVERB
        if ( arg.outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
        {
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, ACOUSTIC_ENVIRONMENT_ID, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -580,9 +580,9 @@ int main(
                    goto cleanup;
                }
            }
            else if ( error != IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING )
            else
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", ACOUSTIC_ENVIRONMENT_ID );
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId );
                goto cleanup;
            }
            renderConfig.room_acoustics.override = true;
@@ -928,6 +928,10 @@ static bool parseCmdlIVAS_dec(
#endif
#endif

#ifdef CONTROL_METADATA_REVERB
    arg->acousticEnvironmentId = 0;
#endif

    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1275,7 +1279,13 @@ static bool parseCmdlIVAS_dec(
                fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" );
            }
        }

#ifdef CONTROL_METADATA_REVERB
        else if ( strcmp( argv_to_upper, "-AEID" ) == 0 )
        {
            ++i;
            arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] );
        }
#endif
        /*-----------------------------------------------------------------*
         * Option not recognized
         *-----------------------------------------------------------------*/
@@ -1452,6 +1462,7 @@ static void usage_dec( void )
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
#endif
    fprintf( stdout, "-exof File          : External orientation file for external orientation trajectory\n" );
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
    fprintf( stdout, "-info <folder>      : specify subfolder name for debug output\n" );
+28 −7
Original line number Diff line number Diff line
@@ -61,10 +61,6 @@
#define RENDERER_MAX_METADATA_LENGTH      8192
#define RENDERER_MAX_METADATA_LINE_LENGTH 1024

#ifdef CONTROL_METADATA_REVERB
#define ACOUSTIC_ENVIRONMENT_ID 0
#endif

#if !defined( DEBUGGING ) && !defined( WMOPS )
static
#endif
@@ -161,6 +157,9 @@ typedef struct
    float lfeConfigElevation;
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef CONTROL_METADATA_REVERB
    uint16_t acousticEnvironmentId;
#endif
} CmdlnArgs;

typedef enum
@@ -185,6 +184,9 @@ typedef enum
    CmdLnOptionId_inputGain,
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
#ifdef CONTROL_METADATA_REVERB
    CmdLnOptionId_acousticEnvironmentId
#endif
} CmdLnOptionId;

static const CmdLnParser_Option cliOptions[] = {
@@ -306,6 +308,14 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "exof",
        .description = "External orientation trajectory file for simulation of external orientations",
    },
#ifdef CONTROL_METADATA_REVERB
    {
        .id = CmdLnOptionId_acousticEnvironmentId,
        .match = "acoustic_environment_id",
        .matchShort = "aeid",
        .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration",
    },
#endif
};


@@ -787,7 +797,7 @@ int main(
        if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef CONTROL_METADATA_REVERB
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, ACOUSTIC_ENVIRONMENT_ID, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -795,9 +805,9 @@ int main(
                    exit( -1 );
                }
            }
            else if ( error != IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING )
            else
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", ACOUSTIC_ENVIRONMENT_ID );
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId );
                exit( -1 );
            }
#endif
@@ -1923,6 +1933,11 @@ static CmdlnArgs defaultArgs(

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );

#ifdef CONTROL_METADATA_REVERB
    args.acousticEnvironmentId = 0;
#endif

    return args;
}

@@ -2052,6 +2067,12 @@ static void parseOption(
                exit( -1 );
            }
            break;
#ifdef CONTROL_METADATA_REVERB
        case CmdLnOptionId_acousticEnvironmentId:
            assert( numOptionValues == 1 );
            args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 );
            break;
#endif
        default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
            break;