Commit 572379c1 authored by bayers's avatar bayers
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 37-contribution-jitter-fhg

parents 5a0ea5bc 1bfc64ea
Loading
Loading
Loading
Loading
Loading
+93 −9
Original line number Diff line number Diff line
@@ -117,9 +117,17 @@ 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;
@@ -218,7 +226,11 @@ int main(
     * Open decoder handle
     *------------------------------------------------------------------------------------------*/

#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.no_diegetic_pan ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -383,7 +395,11 @@ 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 )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -803,6 +819,9 @@ 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;
@@ -833,7 +852,12 @@ 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;
@@ -1129,44 +1153,86 @@ static bool parseCmdlIVAS_dec(
            }
            i += 2;
        }
        else if ( strcmp( argv_to_upper, "-NO_DIEGETIC_PAN" ) == 0 )
        else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
        {
            i++;

            if ( argc - i <= 4 || argv[i][0] == '-' )
#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 ) )
            {
                arg->no_diegetic_pan = -1.f;
#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 ) )
            {
                arg->no_diegetic_pan = 1.f;
#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 option argument specified: %s\n\n", argv[i] );
                    fprintf( stderr, "Error: Incorrect value for panning gain value specified: %s\n\n", argv[i] );
                    usage_dec();
                    return false;
                }
            }
            i++;
        }
#ifdef COMPLEXITY_LEVEL_INDICATION
        else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 )
        {
            int16_t level;

            ++i;
            level = (int16_t) atoi( argv[i++] );
            if ( level < IVAS_DEC_COMPLEXITY_LEVEL_ONE || level > IVAS_DEC_COMPLEXITY_LEVEL_THREE )
            {
                fprintf( stdout, "Invalid complexity level specified.\n" );
                usage_dec();
                return false;
            }
            else if ( level == IVAS_DEC_COMPLEXITY_LEVEL_ONE || level == IVAS_DEC_COMPLEXITY_LEVEL_TWO )
            {
                fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" );
            }
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1195,11 +1261,25 @@ 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
    }

    /*-----------------------------------------------------------------*
@@ -1319,8 +1399,8 @@ static void usage_dec( void )
    fprintf( stdout, "-rvf File           : Reference vector specified by external trajectory file\n" );
    fprintf( stdout, "                      works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" );
    fprintf( stdout, "-render_config File : Renderer configuration File\n" );
    fprintf( stdout, "-no_diegetic_pan    : panning mono non-diegetic sound to stereo -1<= pan <=1,\n" );
    fprintf( stdout, "                      left or l or 1->left, right or r or -1->right, center or c or  0->middle\n" );
    fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" );
    fprintf( stdout, "                      left or l or 90->left, right or r or -90->right, center or c or  0->middle\n" );
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
    fprintf( stdout, "                      default is deactivated\n" );
#ifdef DEBUGGING
@@ -1330,6 +1410,10 @@ 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
+34 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ 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;
@@ -878,6 +881,9 @@ 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;
@@ -1190,6 +1196,32 @@ static bool parseCmdlIVAS_enc(
            ++i;
        }


#ifdef COMPLEXITY_LEVEL_INDICATION
        /*-----------------------------------------------------------------*
         * Complexity Level
         *-----------------------------------------------------------------*/

        /* actual parsing of level will be implemented after characterization */
        else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 )
        {
            int16_t level;

            ++i;
            level = (int16_t) atoi( argv[i++] );
            if ( level < IVAS_ENC_COMPLEXITY_LEVEL_ONE || level > IVAS_ENC_COMPLEXITY_LEVEL_THREE )
            {
                fprintf( stdout, "Invalid complexity level specified.\n" );
                usage_enc();
                return false;
            }
            else if ( level == IVAS_ENC_COMPLEXITY_LEVEL_ONE || level == IVAS_ENC_COMPLEXITY_LEVEL_TWO )
            {
                fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" );
            }
        }
#endif

        /*-----------------------------------------------------------------*
         * IVAS Formats
         *-----------------------------------------------------------------*/
@@ -1697,6 +1729,8 @@ static void usage_enc( void )
    fprintf( stdout, "                      default output bitstream file format is G.192\n" );

    fprintf( stdout, "-bypass mode        : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" );
    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" );
#ifdef DEBUGGING
    fprintf( stdout, "-force T            : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" );
    fprintf( stdout, "                      alternatively, T can be a text file where each line contains \"nb_frames T\"\n" );
+92 −5
Original line number Diff line number Diff line
@@ -136,7 +136,12 @@ typedef struct
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    int8_t orientationTracking;
#ifdef NON_DIEGETIC_PAN
    int16_t nonDiegeticPan;
    float nonDiegeticPanGain;
#else
    float noDiegeticPan;
#endif
    bool delayCompensationEnabled;
    bool quietModeEnabled;
    bool sceneDescriptionInput;
@@ -160,7 +165,7 @@ typedef enum
    CmdLnOptionId_refRotFile,
    CmdLnOptionId_customHrtfFile,
    CmdLnOptionId_renderConfigFile,
    CmdLnOptionId_noDiegeticPan,
    CmdLnOptionId_nonDiegeticPan,
    CmdLnOptionId_orientationTracking,
    CmdlnOptionId_lfePosition,
    CmdlnOptionId_lfeMatrix,
@@ -234,10 +239,10 @@ static const CmdLnParser_Option cliOptions[] = {
        .description = "Binaural renderer configuration file (only for BINAURAL and BINAURAL_ROOM outputs)",
    },
    {
        .id = CmdLnOptionId_noDiegeticPan,
        .match = "no_diegetic_pan",
        .id = CmdLnOptionId_nonDiegeticPan,
        .match = "non_diegetic_pan",
        .matchShort = "ndp",
        .description = "Panning mono no diegetic sound to stereo -1<= pan <= 1\nleft or l or 1->left, right or r or -1->right, center or c or 0 ->middle\n(todo: implementation)",
        .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n(todo: implementation)",
    },
    {
        .id = CmdLnOptionId_orientationTracking,
@@ -551,6 +556,21 @@ 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 ) ) )
    {
        fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires mono or ISM1 input\n" );
        exit( -1 );
    }

    if ( args.nonDiegeticPan && args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_STEREO )
    {
        fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires stereo output\n" );
        exit( -1 );
    }
#endif

    positionProvider = IsmPositionProvider_open();

    convert_backslash( args.inputFilePath );
@@ -665,7 +685,11 @@ 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 );
@@ -1334,6 +1358,38 @@ static bool parseOutConfig(
    return true;
}

#ifdef NON_DIEGETIC_PAN
static bool parseDiegeticPan(
    char *value,
    float *nonDiegeticPan )
{
    to_upper( value );

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

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

#else
static bool parseDiegeticPan(
    char *value,
    float *noDiegeticPan )
@@ -1363,6 +1419,7 @@ static bool parseDiegeticPan(
        }
    }
    return false;
#endif
}

static bool parseOrientationTracking(
@@ -1615,7 +1672,12 @@ static CmdlnArgs defaultArgs(
    clearString( args.renderConfigFilePath );

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

    args.delayCompensationEnabled = true;
    args.quietModeEnabled = false;
@@ -1705,13 +1767,20 @@ static void parseOption(
            assert( numOptionValues == 1 );
            strncpy( args->renderConfigFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            break;
        case CmdLnOptionId_noDiegeticPan:
        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 );
@@ -1822,6 +1891,9 @@ 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;
}
@@ -1879,6 +1951,9 @@ 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 */
@@ -2140,13 +2215,22 @@ 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 )
    {
@@ -2159,6 +2243,9 @@ 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;
}

+6 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ typedef struct _IVAS_ISM_METADATA
    float gainFactor;
    float yaw;
    float pitch;
#ifdef ISM_NON_DIEGETIC_PAN
    int16_t non_diegetic_flag;
#endif
} IVAS_ISM_METADATA;

typedef struct
@@ -118,6 +121,9 @@ typedef struct
    float radius;
    float yaw;
    float pitch;
#ifdef ISM_NON_DIEGETIC_PAN
    int16_t non_diegetic_flag;
#endif
} IVAS_REND_AudioObjectPosition;

typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
+0 −1
Original line number Diff line number Diff line
@@ -1290,7 +1290,6 @@ int16_t calc_nor_delta_hf(
                ynrm[i] += delta;
                add_bits_denv += bitsforDelta;


                temp_num++;
            }
        }
Loading