Commit a459093b authored by multrus's avatar multrus
Browse files

[cleanup] accept CONTROL_METADATA_REVERB, EARLY_REFLECTIONS, CONTROL_METADATA_DIRECTIVITY

parent 125f882d
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -161,12 +161,8 @@ typedef struct
#endif
#endif

#ifdef CONTROL_METADATA_REVERB
    uint16_t acousticEnvironmentId;
#ifdef CONTROL_METADATA_DIRECTIVITY
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
#endif
#endif

} DecArguments;

@@ -613,24 +609,17 @@ int main(
            goto cleanup;
        }

#ifdef CONTROL_METADATA_REVERB
        if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK )
#else
        if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }
#ifdef CONTROL_METADATA_DIRECTIVITY
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get directivity for objects: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
            goto cleanup;
        }
#endif

#ifdef CONTROL_METADATA_REVERB
        if ( arg.outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
        {
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
@@ -648,7 +637,6 @@ int main(
            }
            renderConfig.room_acoustics.override = true;
        }
#endif
        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -1008,15 +996,11 @@ static bool parseCmdlIVAS_dec(
#endif
#endif

#ifdef CONTROL_METADATA_REVERB
    arg->acousticEnvironmentId = 0;
#ifdef CONTROL_METADATA_DIRECTIVITY
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        arg->directivityPatternId[i] = 0;
    }
#endif
#endif
    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1377,13 +1361,11 @@ 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++] );
        }
#ifdef CONTROL_METADATA_DIRECTIVITY
        else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
        {
            ++i;
@@ -1396,8 +1378,6 @@ static bool parseCmdlIVAS_dec(
            }
            i += tmp;
        }
#endif
#endif
        /*-----------------------------------------------------------------*
         * Option not recognized
         *-----------------------------------------------------------------*/
@@ -1582,12 +1562,8 @@ 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" );
#ifdef CONTROL_METADATA_DIRECTIVITY
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" );
#endif
#ifdef CONTROL_METADATA_REVERB
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
#endif
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
    fprintf( stdout, "-info <folder>      : specify subfolder name for debug output\n" );
+0 −26
Original line number Diff line number Diff line
@@ -178,12 +178,8 @@ typedef struct
#ifdef FIX_488_SYNC_DELAY
    float syncMdDelay;
#endif
#ifdef CONTROL_METADATA_DIRECTIVITY
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
#endif
#ifdef CONTROL_METADATA_REVERB
    uint16_t acousticEnvironmentId;
#endif
} CmdlnArgs;

typedef enum
@@ -215,12 +211,8 @@ typedef enum
#ifdef FIX_488_SYNC_DELAY
    CmdLnOptionId_syncMdDelay,
#endif
#ifdef CONTROL_METADATA_DIRECTIVITY
    CmdLnOptionId_directivityPatternId,
#endif
#ifdef CONTROL_METADATA_REVERB
    CmdLnOptionId_acousticEnvironmentId
#endif
} CmdLnOptionId;

static const CmdLnParser_Option cliOptions[] = {
@@ -368,22 +360,18 @@ static const CmdLnParser_Option cliOptions[] = {
        .description = "Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes)",
    },
#endif
#ifdef CONTROL_METADATA_DIRECTIVITY
    {
        .id = CmdLnOptionId_directivityPatternId,
        .match = "ism_directivity_pattern_id",
        .matchShort = "dpid",
        .description = "Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration",
    },
#endif
#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
};


@@ -1095,11 +1083,7 @@ int main(
            exit( -1 );
        }

#ifdef CONTROL_METADATA_REVERB
        if ( RenderConfigReader_read( renderConfigReader, args.renderConfigFilePath, &renderConfig ) != IVAS_ERR_OK )
#else
        if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "Failed to read renderer configuration from file %s\n", args.renderConfigFilePath );
            exit( -1 );
@@ -1107,7 +1091,6 @@ int main(

        if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef CONTROL_METADATA_REVERB
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -1121,7 +1104,6 @@ int main(
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId );
                exit( -1 );
            }
#endif
            renderConfig.room_acoustics.override = TRUE;
        }

@@ -2559,16 +2541,12 @@ static CmdlnArgs defaultArgs(
    args.syncMdDelay = 0;
#endif

#ifdef CONTROL_METADATA_DIRECTIVITY
    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
        args.directivityPatternId[i] = 0;
    }
#endif

#ifdef CONTROL_METADATA_REVERB
    args.acousticEnvironmentId = 0;
#endif
    return args;
}

@@ -2709,7 +2687,6 @@ static void parseOption(
            }
            break;

#ifdef CONTROL_METADATA_DIRECTIVITY
        case CmdLnOptionId_directivityPatternId:
            assert( numOptionValues <= RENDERER_MAX_ISM_INPUTS );
            for ( int16_t i = 0; i < numOptionValues; ++i )
@@ -2717,14 +2694,11 @@ static void parseOption(
                args->directivityPatternId[i] = (int16_t) strtol( optionValues[i], NULL, 10 );
            }
            break;
#endif

#ifdef CONTROL_METADATA_REVERB
        case CmdLnOptionId_acousticEnvironmentId:
            assert( numOptionValues == 1 );
            args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 );
            break;
#endif
#ifdef FIX_488_SYNC_DELAY
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
+0 −8
Original line number Diff line number Diff line
@@ -52,9 +52,7 @@

#define RENDERER_HEAD_POSITIONS_PER_FRAME 4

#ifdef EARLY_REFLECTIONS
#define QC_ABS_COEFF 6
#endif

/*----------------------------------------------------------------------------------*
 * Common API structures
@@ -187,13 +185,11 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
    float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX];  /*  - The room's Diffuse to Source Ratio per center frequency */
    float acousticPreDelay;                           /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
    float inputPreDelay;                              /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
#ifdef EARLY_REFLECTIONS
    int16_t use_er;               /* ER activation flag */
    int32_t lowComplexity;        /* Low complexity ER flag */
    IVAS_VECTOR3 dimensions;      /* Room dimensions [m] */
    float AbsCoeff[QC_ABS_COEFF]; /* Absorption coeffs */
    IVAS_VECTOR3 ListenerOrigin;  /* Listener origin */
#endif
} IVAS_ROOM_ACOUSTICS_CONFIG_DATA;

#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -225,11 +221,7 @@ typedef struct _IVAS_RENDER_CONFIG
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_SPLIT_REND_CONFIG_DATA split_rend_config;
#endif
#ifdef CONTROL_METADATA_DIRECTIVITY
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];
#else
    float directivity[3];
#endif
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

typedef struct _IVAS_LS_CUSTOM_LAYOUT
+0 −2
Original line number Diff line number Diff line
@@ -1917,7 +1917,6 @@ typedef enum
#define IVAS_LIMITER_ATTACK_SECONDS             0.005f


#ifdef EARLY_REFLECTIONS
/*----------------------------------------------------------------------------------*
 * Early Reflection constants
 *----------------------------------------------------------------------------------*/
@@ -1944,7 +1943,6 @@ typedef enum
#define ER_MIN_ABS_COEFF                        (0.0f)
#define ER_MAX_ABS_COEFF                        (1.0f)

#endif

/*----------------------------------------------------------------------------------*
 * Stereo downmix EVS constants
+0 −6
Original line number Diff line number Diff line
@@ -135,16 +135,10 @@ typedef enum
    IVAS_ERR_INVALID_INPUT_ID,
    IVAS_ERR_WRONG_NUM_CHANNELS,
    IVAS_ERR_INVALID_BUFFER_SIZE,
#ifdef CONTROL_METADATA_REVERB
    IVAS_ERR_INVALID_RENDER_CONFIG,
    IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING,
#ifdef EARLY_REFLECTIONS
    IVAS_ERR_INVALID_ER_PARAM,
#endif
#ifdef CONTROL_METADATA_DIRECTIVITY
    IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING,
#endif
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_ERR_LC3PLUS_INVALID_BITRATE,
    IVAS_ERR_INVALID_SPLIT_REND_CONFIG,
Loading