Commit 7d66ae40 authored by Jouni Paulus's avatar Jouni Paulus
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 482-uninitialized-members-in-decdummy-breaking-external-renderer-masa-binaural-output

# Conflicts:
#	lib_com/options.h
parents 28ced4cc efb96ffc
Loading
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -72,3 +72,15 @@ Externals/

# coan output files that are created when cleaning out switches
coan_out_*
/COMPLEXITY
/res
/tv
/wmops
/Workspace_msvc/renderer.args.json
/Workspace_msvc/encoder.args.json
/Workspace_msvc/decoder.args.json
/scripts/mem_analysis_enc_VBR_5k9.csv
/scripts/mem_analysis_enc_STEREO_sw.png
/scripts/mem_analysis_enc_STEREO_sw.csv
/scripts/mem_analysis_enc_STEREO_16k4_DTX.csv
*.pwv
+6 −55
Original line number Diff line number Diff line
@@ -117,17 +117,11 @@ typedef struct
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
    int16_t orientation_tracking;
#ifdef NON_DIEGETIC_PAN
    int16_t Opt_non_diegetic_pan;
    float non_diegetic_pan_gain;
#else
    float no_diegetic_pan;
#endif
    bool renderConfigEnabled;
    char *renderConfigFilename;
#ifdef COMPLEXITY_LEVEL_INDICATION
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
#endif

#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
@@ -226,10 +220,10 @@ int main(
     * Open decoder handle
     *------------------------------------------------------------------------------------------*/

#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK )
#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.no_diegetic_pan ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -395,10 +389,10 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -819,9 +813,7 @@ static bool parseCmdlIVAS_dec(
    arg->quietModeEnabled = false;
    arg->delayCompensationEnabled = true;
    arg->voipMode = false;
#ifdef COMPLEXITY_LEVEL_INDICATION
    arg->complexityLevel = IVAS_DEC_COMPLEXITY_LEVEL_THREE;
#endif

    arg->enableHeadRotation = false;
    arg->headrotTrajFileName = NULL;
@@ -852,12 +844,8 @@ static bool parseCmdlIVAS_dec(
    arg->renderConfigFilename = NULL;

    arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
#ifdef NON_DIEGETIC_PAN
    arg->Opt_non_diegetic_pan = 0;
    arg->non_diegetic_pan_gain = 0.f;
#else
    arg->no_diegetic_pan = 0.f;
#endif
#ifdef VARIABLE_SPEED_DECODING
    arg->variableSpeedMode = 0;
    arg->tsmScale = 100;
@@ -1156,56 +1144,27 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
        {
            i++;
#ifdef NON_DIEGETIC_PAN
            arg->Opt_non_diegetic_pan = 1;
#else
            if ( argc - i <= 4 || ( argv[i][0] == '-' ) )
            {
                fprintf( stderr, "Error: Argument for panning option not specified!\n\n" );
                usage_dec();
                return false;
            }
#endif
            strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#ifdef NON_DIEGETIC_PAN
            to_upper( argv_to_upper );
#endif
            if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) )
            {
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = 0.f;
#else
                arg->no_diegetic_pan = 0.f;
#endif
            }
            else if ( ( strcmp( argv_to_upper, "LEFT" ) == 0 ) || ( strchr( argv_to_upper, 'L' ) != NULL ) )
            {
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = 1.f;
#else
                arg->no_diegetic_pan = 1.f;
#endif
            }
            else if ( ( strcmp( argv_to_upper, "RIGHT" ) == 0 ) || ( strchr( argv_to_upper, 'R' ) != NULL ) )
            {
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = -1.f;
#else
                arg->no_diegetic_pan = -1.f;
#endif
            }
            else
            {
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = (float) atof( argv_to_upper ) / 90.f;

                if ( arg->non_diegetic_pan_gain > 1.0f || arg->non_diegetic_pan_gain < -1.0f )
#else
                arg->no_diegetic_pan = (float) atof( argv_to_upper );

                if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f )
#endif
                {
                    fprintf( stderr, "Error: Incorrect value for panning gain value specified: %s\n\n", argv[i] );
                    usage_dec();
@@ -1214,7 +1173,6 @@ static bool parseCmdlIVAS_dec(
            }
            i++;
        }
#ifdef COMPLEXITY_LEVEL_INDICATION
        else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 )
        {
            int16_t level;
@@ -1232,7 +1190,6 @@ static bool parseCmdlIVAS_dec(
                fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" );
            }
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1261,25 +1218,21 @@ static bool parseCmdlIVAS_dec(
            arg->customLsSetupFilename = argv[i];
        }
        i++;
#ifdef NON_DIEGETIC_PAN
        if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != IVAS_DEC_OUTPUT_STEREO ) )
        {
            fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" );
            usage_dec();
            return false;
        }
#endif
    }
    else
    {
        arg->outputFormat = IVAS_DEC_OUTPUT_MONO;
        arg->decMode = IVAS_DEC_MODE_EVS;
#ifdef NON_DIEGETIC_PAN
        if ( ( arg->Opt_non_diegetic_pan ) )
        {
            arg->outputFormat = IVAS_DEC_OUTPUT_STEREO;
        }
#endif
    }

    /*-----------------------------------------------------------------*
@@ -1410,11 +1363,9 @@ static void usage_dec( void )
    fprintf( stdout, "                      containing FEC pattern (short values of 0 (good) or 1 (bad))\n" );
    fprintf( stdout, "                      default is OFF, if this option is not used\n" );
    fprintf( stdout, "-force R            : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" );
#ifdef COMPLEXITY_LEVEL_INDICATION
    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" );
#endif
#endif
#ifdef DEBUG_MODE_INFO
#ifdef DEBUG_MODE_INFO_TWEAK
    fprintf( stdout, "-info <folder>      : specify subfolder name for debug output\n" );
+0 −19
Original line number Diff line number Diff line
@@ -111,9 +111,7 @@ typedef struct
    IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig;
    const char *ca_config_file;
    bool mimeOutput;
#ifdef COMPLEXITY_LEVEL_INDICATION
    IVAS_ENC_COMPLEXITY_LEVEL complexityLevel;
#endif

#ifdef DEBUGGING
    IVAS_ENC_FORCED_MODE forcedMode;
@@ -881,9 +879,7 @@ static void initArgStruct( EncArguments *arg )
    arg->ca_config_file = NULL;
    arg->mimeOutput = false;
    arg->ism_extended_metadata = false;
#ifdef COMPLEXITY_LEVEL_INDICATION
    arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE;
#endif

#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
@@ -1136,31 +1132,18 @@ static bool parseCmdlIVAS_enc(
            {
                strncpy( stmp, argv[i], sizeof( stmp ) );
                stmp[sizeof( stmp ) - 1] = '\0';
#ifdef FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING
                to_upper( stmp );
                if ( strcmp( stmp, "LO" ) == 0 )
#else
                to_upper( argv[i] );
                if ( strcmp( argv[i], "LO" ) == 0 )
#endif
                {
                    arg->caConfig.fec_indicator = IVAS_ENC_FEC_LO;
                }
#ifdef FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING
                else if ( strcmp( stmp, "HI" ) == 0 )
#else
                else if ( strcmp( argv[i], "HI" ) == 0 )
#endif
                {
                    arg->caConfig.fec_indicator = IVAS_ENC_FEC_HI;
                }
                else
                {
#ifdef FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING
                    arg->ca_config_file = argv[i];
#else
                    arg->ca_config_file = stmp;
#endif
                }
                i++;

@@ -1197,7 +1180,6 @@ static bool parseCmdlIVAS_enc(
        }


#ifdef COMPLEXITY_LEVEL_INDICATION
        /*-----------------------------------------------------------------*
         * Complexity Level
         *-----------------------------------------------------------------*/
@@ -1220,7 +1202,6 @@ static bool parseCmdlIVAS_enc(
                fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" );
            }
        }
#endif

        /*-----------------------------------------------------------------*
         * IVAS Formats
+42 −69
Original line number Diff line number Diff line
@@ -135,13 +135,13 @@ typedef struct
    char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef FIX_439_OTR_PARAMS
    int8_t orientation_tracking;
#else
    int8_t orientationTracking;
#ifdef NON_DIEGETIC_PAN
#endif
    int16_t nonDiegeticPan;
    float nonDiegeticPanGain;
#else
    float noDiegeticPan;
#endif
    bool delayCompensationEnabled;
    bool quietModeEnabled;
    bool sceneDescriptionInput;
@@ -556,7 +556,6 @@ int main(

    CmdlnArgs args = parseCmdlnArgs( argc, argv );

#ifdef NON_DIEGETIC_PAN
    if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_MONO ) ||
                                   ( args.inConfig.numAudioObjects > 0 && args.inConfig.audioObjects[0].audioConfig == IVAS_REND_AUDIO_CONFIG_OBJECT && args.inConfig.numAudioObjects == 1 ) ) )
    {
@@ -569,7 +568,6 @@ int main(
        fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires stereo output\n" );
        exit( -1 );
    }
#endif

    positionProvider = IsmPositionProvider_open();

@@ -685,11 +683,7 @@ int main(
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] = { 0 };
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 };

#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
@@ -732,7 +726,11 @@ int main(
        }
    }

#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
@@ -1358,7 +1356,6 @@ static bool parseOutConfig(
    return true;
}

#ifdef NON_DIEGETIC_PAN
static bool parseDiegeticPan(
    char *value,
    float *nonDiegeticPan )
@@ -1388,66 +1385,58 @@ static bool parseDiegeticPan(
        }
    }
    return true;

#else
static bool parseDiegeticPan(
    char *value,
    float *noDiegeticPan )
{
    to_upper( value );

    if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) )
    {
        *noDiegeticPan = 0.f;
    }
    else if ( ( strcmp( value, "LEFT" ) == 0 ) || ( strchr( value, 'L' ) != NULL ) )
    {
        *noDiegeticPan = -1.f;
    }
    else if ( ( strcmp( value, "RIGHT" ) == 0 ) || ( strchr( value, 'R' ) != NULL ) )
    {
        *noDiegeticPan = 1.f;
    }
    else
    {
        *noDiegeticPan = (float) atof( value );

        if ( *noDiegeticPan > 1.0f || *noDiegeticPan < -1.0f )
        {
            fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" );
            return false;
        }
    }
    return false;
#endif
}

static bool parseOrientationTracking(
    char *value,
    int8_t *tracking_type )
#ifdef FIX_439_OTR_PARAMS
    int8_t *orientation_tracking
#else
    int8_t *tracking_type
#endif
)
{

    to_upper( value );

    if ( strcmp( value, "NONE" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_NONE;
#else
        *tracking_type = IVAS_ORIENT_TRK_NONE;
#endif
    }
    else if ( strcmp( value, "REF" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF;
#endif
    }
    else if ( strcmp( value, "AVG" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_AVG;
#else
        *tracking_type = IVAS_ORIENT_TRK_AVG;
#endif
    }
    else if ( strcmp( value, "REF_VEC" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF_VEC;
#endif
    }
    else if ( strcmp( value, "REF_VEC_LEV" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC_LEV;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV;
#endif
    }
    else
    {
@@ -1671,13 +1660,13 @@ static CmdlnArgs defaultArgs(
    clearString( args.customHrtfFilePath );
    clearString( args.renderConfigFilePath );

#ifdef FIX_439_OTR_PARAMS
    args.orientation_tracking = HEAD_ORIENT_TRK_NONE;
#else
    args.orientationTracking = IVAS_ORIENT_TRK_NONE;
#ifdef NON_DIEGETIC_PAN
#endif
    args.nonDiegeticPan = 0;
    args.nonDiegeticPanGain = 0.f;
#else
    args.noDiegeticPan = 0.0f;
#endif

    args.delayCompensationEnabled = true;
    args.quietModeEnabled = false;
@@ -1769,22 +1758,20 @@ static void parseOption(
            break;
        case CmdLnOptionId_nonDiegeticPan:
            assert( numOptionValues == 1 );
#ifdef NON_DIEGETIC_PAN
            if ( !parseDiegeticPan( optionValues[0], &args->nonDiegeticPanGain ) )
#else
            if ( !parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) )
#endif
            {
                fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] );
                exit( -1 );
            }
#ifdef NON_DIEGETIC_PAN
            args->nonDiegeticPan = 1;
#endif
            break;
        case CmdLnOptionId_orientationTracking:
            assert( numOptionValues == 1 );
#ifdef FIX_439_OTR_PARAMS
            if ( !parseOrientationTracking( optionValues[0], &args->orientation_tracking ) )
#else
            if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) )
#endif
            {
                fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] );
                exit( -1 );
@@ -1891,9 +1878,7 @@ void getMetadataFromFileReader(
    objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius;
    objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw;
    objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch;
#ifdef ISM_NON_DIEGETIC_PAN
    objectMetadataBuffer->positions[objIdx].non_diegetic_flag = ismMetadata.non_diegetic_flag;
#endif

    return;
}
@@ -1951,9 +1936,7 @@ static void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].radius = 1.0f;
            objectMetadataBuffer->positions[objIdx].yaw = 0.0f;
            objectMetadataBuffer->positions[objIdx].pitch = 0.0f;
#ifdef ISM_NON_DIEGETIC_PAN
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#endif
        }

        /* Wrap azimuth to lie within (-180, 180] range */
@@ -2215,22 +2198,14 @@ static void parseObjectPosition(
{
    char *endptr;
    int16_t read_values;
#ifdef ISM_NON_DIEGETIC_PAN
    float meta_prm[8] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };
#else
    float meta_prm[7] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f };
#endif


    readNextMetadataChunk( line, "," );
    *positionDuration = (uint16_t) strtol( line, &endptr, 10 );
    readNextMetadataChunk( line, "\n" );

#ifdef ISM_NON_DIEGETIC_PAN
    read_values = (int16_t) sscanf( line, "%f,%f,%f,%f,%f,%f,%f,%f", &meta_prm[0], &meta_prm[1], &meta_prm[2], &meta_prm[3], &meta_prm[4], &meta_prm[5], &meta_prm[6], &meta_prm[7] );
#else
    read_values = (int16_t) sscanf( line, "%f,%f,%f,%f,%f,%f,%f", &meta_prm[0], &meta_prm[1], &meta_prm[2], &meta_prm[3], &meta_prm[4], &meta_prm[5], &meta_prm[6] );
#endif

    if ( read_values < 2 )
    {
@@ -2243,9 +2218,7 @@ static void parseObjectPosition(
    position->radius = meta_prm[2];
    position->yaw = meta_prm[5];
    position->pitch = meta_prm[6];
#ifdef ISM_NON_DIEGETIC_PAN
    position->non_diegetic_flag = (int16_t) meta_prm[7];
#endif
    return;
}

+1096 −92

File changed.

Preview size limit exceeded, changes collapsed.

Loading