Commit 4b040b1f authored by multrus's avatar multrus
Browse files

Merge branch '20240604_cleanup' into 'main'

20240604 cleanup

See merge request !1619
parents 6f966b7e 241e7c47
Loading
Loading
Loading
Loading
Loading
+0 −49
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 FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "split_render_file_read_write.h"
#endif
@@ -93,7 +91,6 @@ static
 * Local structure for storing cmdln arguments
 *------------------------------------------------------------------------------------------*/

#ifdef FIX_1053_REVERB_RECONFIGURATION
typedef struct
{
    uint16_t *pID;
@@ -102,7 +99,6 @@ typedef struct
    uint16_t selected;
    uint16_t frameCounter;
} AcousticEnvironmentSequence;
#endif

typedef struct
{
@@ -155,11 +151,7 @@ typedef struct
    uint16_t tsmScale;
#endif
#endif
#ifdef FIX_1053_REVERB_RECONFIGURATION
    AcousticEnvironmentSequence aeSequence;
#else
    uint16_t acousticEnvironmentId;
#endif
    int16_t Opt_dpid_on;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];

@@ -456,14 +448,9 @@ int main(
     *------------------------------------------------------------------------------------------*/

    asked_frame_size = arg.renderFramesize;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
                                       arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
                                       arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -663,13 +650,11 @@ int main(
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
            goto cleanup;
        }
#ifdef CONF_DISTATT
        if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get Distance Attenuation \n\n" );
            goto cleanup;
        }
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
@@ -698,11 +683,7 @@ int main(

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef FIX_1053_REVERB_RECONFIGURATION
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#endif
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -712,11 +693,7 @@ int main(
            }
            else
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
#else
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId );
#endif
                goto cleanup;
            }
            renderConfig.roomAcoustics.override = true;
@@ -931,13 +908,11 @@ cleanup:

    free( pcmBuf );

#ifdef FIX_1053_REVERB_RECONFIGURATION
    if ( arg.aeSequence.count > 0 )
    {
        free( arg.aeSequence.pID );
        free( arg.aeSequence.pValidity );
    }
#endif
#ifdef DEBUG_SBA_AUDIO_DUMP
    IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels );

@@ -1153,15 +1128,11 @@ static bool parseCmdlIVAS_dec(
    arg->tsmScaleFileName = NULL;
#endif
#endif
#ifdef FIX_1053_REVERB_RECONFIGURATION
    arg->aeSequence.count = 0;
    arg->aeSequence.pID = NULL;
    arg->aeSequence.pValidity = NULL;
    arg->aeSequence.selected = 0;
    arg->aeSequence.frameCounter = 0;
#else
    arg->acousticEnvironmentId = 65535;
#endif
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        arg->directivityPatternId[i] = 65535;
@@ -1545,7 +1516,6 @@ static bool parseCmdlIVAS_dec(

            if ( !is_digits_only( argv[i] ) )
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                aeidFileReader *aeidReader = NULL;

                if ( aeidFileReader_open( argv[i], &aeidReader ) != IVAS_ERR_OK )
@@ -1565,13 +1535,7 @@ static bool parseCmdlIVAS_dec(
                aeidFileReader_close( &aeidReader );

                i++;
#else
                fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] );
                usage_dec();
                return false;
#endif
            }
#ifdef FIX_1053_REVERB_RECONFIGURATION
            else
            {
                /* A single acoustic environment */
@@ -1586,9 +1550,6 @@ static bool parseCmdlIVAS_dec(
                arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] );
                arg->aeSequence.pValidity[0] = 0;
            }
#else
            arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] );
#endif
        }
        else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
        {
@@ -1834,13 +1795,9 @@ static void usage_dec( void )
    fprintf( stdout, "                      output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" );
    fprintf( stdout, "                      ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" );
    fprintf( stdout, "                      otherwise a default directivity pattern is used.\n" );
#ifdef FIX_1053_REVERB_RECONFIGURATION
    fprintf( stdout, "-aeid ID | File     : Acoustic environment ID (number > 0)\n" );
    fprintf( stdout, "                      alternatively, it can be a text file where each line contains \"ID duration\"\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration.\n" );
#else
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
#endif
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
@@ -2269,7 +2226,6 @@ static ivas_error decodeG192(
    }
#endif

#ifdef FIX_1053_REVERB_RECONFIGURATION
    IVAS_RENDER_CONFIG_DATA renderConfig;
    RenderConfigReader *renderConfigReader = NULL;

@@ -2293,7 +2249,6 @@ static ivas_error decodeG192(
            goto cleanup;
        }
    }
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
@@ -2504,7 +2459,6 @@ static ivas_error decodeG192(
        {
            if ( needNewFrame )
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
                     arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 )
                {
@@ -2535,7 +2489,6 @@ static ivas_error decodeG192(
                        }
                    }
                }
#endif
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
                if ( arg.tsmScaleFileEnabled )
@@ -2974,9 +2927,7 @@ static ivas_error decodeG192(

cleanup:

#ifdef FIX_1053_REVERB_RECONFIGURATION
    RenderConfigReader_close( &renderConfigReader );
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    split_rend_reader_writer_close( &splitRendWriter );
#endif
+0 −48
Original line number Diff line number Diff line
@@ -45,9 +45,7 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "split_render_file_read_write.h"
#include "split_rend_bfi_file_reader.h"
@@ -145,7 +143,6 @@ typedef struct
    IVAS_CUSTOM_LS_DATA outSetupCustom;
} OutputConfig;

#ifdef FIX_1053_REVERB_RECONFIGURATION
typedef struct
{
    uint16_t *pID;
@@ -154,7 +151,6 @@ typedef struct
    uint16_t selected;
    uint16_t frameCounter;
} AcousticEnvironmentSequence;
#endif

typedef struct
{
@@ -195,11 +191,7 @@ typedef struct
    float syncMdDelay;
    IVAS_RENDER_FRAMESIZE render_framesize;
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
#ifdef FIX_1053_REVERB_RECONFIGURATION
    AcousticEnvironmentSequence aeSequence;
#else
    uint16_t acousticEnvironmentId;
#endif
} CmdlnArgs;

typedef enum
@@ -402,11 +394,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_acousticEnvironmentId,
        .match = "acoustic_environment_id",
        .matchShort = "aeid",
#ifdef FIX_1053_REVERB_RECONFIGURATION
        .description = "Acoustic environment ID (number > 0) alternatively, it can be a text file where each line contains \"ID duration\" for BINAURAL_ROOM_REVERB output configuration.",
#else
        .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration",
#endif
    },
};

@@ -740,10 +728,8 @@ int main(
    int16_t zeroPadToWrite = 0;
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    IVAS_RENDER_CONFIG_DATA renderConfig;
    uint16_t aeID;
#endif
    ivas_error error = IVAS_ERR_OK;

#ifdef WMOPS
@@ -1058,9 +1044,6 @@ int main(

    if ( args.renderConfigFilePath[0] != '\0' )
    {
#ifndef FIX_1053_REVERB_RECONFIGURATION
        IVAS_RENDER_CONFIG_DATA renderConfig;
#endif

        /* sanity check */
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -1095,12 +1078,8 @@ int main(

        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef FIX_1053_REVERB_RECONFIGURATION
            aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535;
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#endif
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -1110,11 +1089,7 @@ int main(
            }
            else
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
#else
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId );
#endif
                exit( -1 );
            }
            renderConfig.roomAcoustics.override = 1;
@@ -1545,16 +1520,11 @@ int main(
        num_in_channels = inBuffer.config.numChannels;
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;

#ifdef FIX_1053_REVERB_RECONFIGURATION
        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
             args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 )
        {
            if ( ++args.aeSequence.frameCounter >= args.aeSequence.pValidity[args.aeSequence.selected] )
            {
#ifndef FIX_1053_REVERB_RECONFIGURATION
                IVAS_RENDER_CONFIG_DATA renderConfig;

#endif
                if ( ++args.aeSequence.selected >= args.aeSequence.count )
                {
                    args.aeSequence.selected = 0;
@@ -1580,7 +1550,6 @@ int main(
                }
            }
        }
#endif

        numSamplesRead = 0;
        /* Read the input data */
@@ -2079,13 +2048,11 @@ cleanup:
    }
#endif

#ifdef FIX_1053_REVERB_RECONFIGURATION
    if ( args.aeSequence.count > 0 )
    {
        free( args.aeSequence.pID );
        free( args.aeSequence.pValidity );
    }
#endif
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        MasaFileReader_close( &masaReaders[i] );
@@ -2554,7 +2521,6 @@ static bool parseLfePositionConfig(
}


#ifdef FIX_1053_REVERB_RECONFIGURATION
static bool parseAcousticEnvironmentIds(
    const char *value,
    AcousticEnvironmentSequence *aeSequence )
@@ -2597,7 +2563,6 @@ static bool parseAcousticEnvironmentIds(

    return true;
}
#endif


static bool checkRequiredArgs(
@@ -2708,15 +2673,11 @@ static CmdlnArgs defaultArgs(
        args.directivityPatternId[i] = 65535;
    }

#ifdef FIX_1053_REVERB_RECONFIGURATION
    args.aeSequence.count = 0;
    args.aeSequence.pID = NULL;
    args.aeSequence.pValidity = NULL;
    args.aeSequence.selected = 0;
    args.aeSequence.frameCounter = 0;
#else
    args.acousticEnvironmentId = 65535;
#endif

    return args;
}
@@ -2888,19 +2849,10 @@ static void parseOption(
            break;
        case CmdLnOptionId_acousticEnvironmentId:
            assert( numOptionValues == 1 );
#ifdef FIX_1053_REVERB_RECONFIGURATION
            if ( !parseAcousticEnvironmentIds( optionValues[0], &args->aeSequence ) )
            {
                fprintf( stderr, "Invalid acoustic environment ID specified: %s\n", optionValues[0] );
            }
#else
            if ( !is_digits_only( optionValues[0] ) )
            {
                fprintf( stderr, "Invalid acousting environment ID specified: %s\n", optionValues[0] );
                exit( -1 );
            }
            args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 );
#endif
            break;
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
+0 −2
Original line number Diff line number Diff line
@@ -335,9 +335,7 @@ typedef struct _IVAS_RENDER_CONFIG
    ISAR_SPLIT_REND_CONFIG_DATA split_rend_config;
#endif
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];
#ifdef CONF_DISTATT
    float distAtt[3];
#endif

} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

+0 −11
Original line number Diff line number Diff line
@@ -1424,9 +1424,6 @@ typedef enum
typedef enum
{
    IVAS_FILTER_ORDER_1 = 1,
#ifndef NONBE_FIX_MC_LFE_LPF
    IVAS_FILTER_ORDER_2 = 2,
#endif
    IVAS_FILTER_ORDER_4 = 4,
} ivas_filter_order;

@@ -1458,17 +1455,9 @@ typedef enum
/*----------------------------------------------------------------------------------*
 * Amplitude Panning (EFAP, VBAP) constants
 *----------------------------------------------------------------------------------*/
#ifndef FIX_1050_EFAP_ALLOC
#define PANNING_AZI_RESOLUTION                  2
#define PANNING_ELE_RESOLUTION                  5
#endif

#define EFAP_MAX_CHAN_NUM                       5                           /* Maximum number of channels that constitute a polygon, 4 or 5 */
#ifdef FIX_1050_EFAP_ALLOC
#define EFAP_MAX_POLY_SET                       54                          /* Upper bound on number of polygons; found to be 54 in the worst case for a speaker setup of 16.0 */
#else
#define EFAP_MAX_POLY_SET                       50                          /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */
#endif

#define EFAP_MODE_EFAP                          0                           /* EFAP Panning */
#define EFAP_MODE_EFIP                          1                           /* EFIP Panning */
+0 −7
Original line number Diff line number Diff line
@@ -62,11 +62,7 @@ void ivas_filters_init(
    int16_t i;
    filter_state->order = order;

#ifdef NONBE_FIX_MC_LFE_LPF
    if ( order == IVAS_FILTER_ORDER_1 )
#else
    if ( order == IVAS_FILTER_ORDER_2 || order == IVAS_FILTER_ORDER_1 )
#endif
    {
        filter_state->filt_len = order + 1;

@@ -120,9 +116,6 @@ void ivas_filter_process(
    switch ( filter_state->order )
    {
        case IVAS_FILTER_ORDER_1:
#ifndef NONBE_FIX_MC_LFE_LPF
        case IVAS_FILTER_ORDER_2:
#endif
            ivas_iir_2_filter( filter_state, pIn_Out, length, IVAS_FILTER_STAGE_0 );
            break;
        case IVAS_FILTER_ORDER_4:
Loading