Commit 915867b4 authored by vaclav's avatar vaclav
Browse files

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

Merge remote-tracking branch 'remotes/origin/main' into float-1510-wrong-ivas_cod-printout-help-for-supported-dtx-bitrates
parents 0b062b11 2eeee757
Loading
Loading
Loading
Loading
Loading
+40 −35
Original line number Diff line number Diff line
@@ -441,7 +441,6 @@ int main(

    asked_num_subframes = arg.render_num_subframes;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
    arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM;

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.roomSize, arg.non_diegetic_pan_enabled,
@@ -451,17 +450,6 @@ int main(
        goto cleanup;
    }

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( arg.render_num_subframes != asked_num_subframes )
    {
        fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" );
    }

    /*------------------------------------------------------------------------------------------*
     * Configure Split rendering
     *------------------------------------------------------------------------------------------*/
@@ -474,6 +462,7 @@ int main(
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK )
    {
@@ -483,8 +472,7 @@ int main(

    if ( !arg.renderConfigEnabled && ( arg.render_num_subframes != asked_num_subframes ) )
    {
            fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" );
        }
        fprintf( stderr, "\nChanged render framesize, only 20ms allowed!\n" );
    }

    /*------------------------------------------------------------------------------------------*
@@ -2230,6 +2218,7 @@ static ivas_error decodeG192(
#endif
#endif
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 } };
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    SplitFileReadWrite *splitRendWriter = NULL;
@@ -2417,10 +2406,8 @@ static ivas_error decodeG192(
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableHeadRotation || isSplitRend )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            if ( headRotReader == NULL )
            {
                for ( i = 0; i < (int16_t) num_subframes; i++ )
@@ -2458,7 +2445,6 @@ static ivas_error decodeG192(

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -2846,16 +2832,28 @@ static ivas_error decodeG192(
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableHeadRotation || isSplitRend )
        {
            IVAS_QUATERNION Quaternion;
            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos[0] ) ) != IVAS_ERR_OK )
            if ( headRotReader == NULL )
            {
                Quaternions[0].w = -3.0f;
                Quaternions[0].x = 0.0f;
                Quaternions[0].y = 0.0f;
                Quaternions[0].z = 0.0f;
                Pos[0].x = 0.0f;
                Pos[0].y = 0.0f;
                Pos[0].z = 0.0f;
            }
            else
            {
                if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[0], &Pos[0] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                    goto cleanup;
                }
            }

            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[0], Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
@@ -3178,6 +3176,7 @@ static ivas_error decodeVoIP(

    IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 } };
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;
@@ -3380,10 +3379,8 @@ static ivas_error decodeVoIP(
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableHeadRotation || isSplitRend )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            if ( headRotReader == NULL )
            {
                for ( i = 0; i < (int16_t) num_subframes; i++ )
@@ -3422,7 +3419,6 @@ static ivas_error decodeVoIP(

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -4332,6 +4328,15 @@ static ivas_error restartDecoder(
        goto cleanup;
    }

    if ( arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg->render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+198 −161

File changed.

Preview size limit exceeded, changes collapsed.

+33 −57
Original line number Diff line number Diff line
@@ -231,90 +231,109 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_inputFile,
        .match = "input_file",
        .matchShort = "i",
        .placeholder = "<path>",
        .description = "Path to the input file (WAV, raw PCM or scene description file)",
        .isMandatory = true,
    },
    {
        .id = CmdLnOptionId_inputFormat,
        .match = "input_format",
        .matchShort = "if",
        .placeholder = "<format>",
        .description = "Audio format of input file (e.g. 5_1 or HOA3 or META,\nuse -l for a list)",
        .isMandatory = true,
    },
    {
        .id = CmdLnOptionId_inputMetadata,
        .match = "input_metadata",
        .matchShort = "im",
        .placeholder = "<path1> [<path2>...]",
        .description = "Space-separated list of path to metadata files for ISM/MASA/OMASA/\nOSBA/BINAURAL_SPLIT_PCM inputs. \nFor OMASA, ISM files must be specified first.",
    },
    {
        .id = CmdLnOptionId_outputFile,
        .match = "output_file",
        .matchShort = "o",
        .placeholder = "<path>",
        .description = "Path to the output file",
        .isMandatory = true,
    },
    {
        .id = CmdLnOptionId_outputFormat,
        .match = "output_format",
        .matchShort = "of",
        .placeholder = "<format>",
        .description = "Output format to render.\nAlternatively, can be a custom loudspeaker layout file",
        .isMandatory = true,
    },
    {
        .id = CmdLnOptionId_sampleRate,
        .match = "sample_rate",
        .matchShort = "fs",
        .placeholder = "<fs>",
        .description = "Input sampling rate in kHz (16, 32, 48) - required only with raw\nPCM inputs",
    },
    {
        .id = CmdLnOptionId_trajFile,
        .match = "trajectory_file",
        .matchShort = "T",
        .placeholder = "<path>",
        .description = "Head rotation trajectory file for simulation of head tracking\n(only for binaural outputs)",
    },
    {
        .id = CmdLnOptionId_outputMetadata,
        .match = "output_metadata",
        .matchShort = "om",
        .placeholder = "<path>",
        .description = "coded metadata file for BINAURAL_SPLIT_PCM output mode",
    },
    {
        .id = CmdLnOptionId_refRotFile,
        .match = "reference_rotation_file",
        .matchShort = "rf",
        .placeholder = "<path>",
        .description = "Reference rotation trajectory file for simulation of head tracking\n(only for binaural outputs)",
    },
    {
        .id = CmdLnOptionId_customHrtfFile,
        .match = "custom_hrtf",
        .matchShort = "hrtf",
        .placeholder = "<path>",
        .description = "Custom HRTF file for binaural rendering\n(only for binaural outputs)",
    },
    {
        .id = CmdLnOptionId_renderConfigFile,
        .match = "render_config_parameters",
        .matchShort = "render_config",
        .placeholder = "<path>",
        .description = "Binaural renderer configuration parameters in file\n(only for binaural outputs)",
    },
    {
        .id = CmdLnOptionId_nonDiegeticPan,
        .match = "non_diegetic_panning",
        .matchShort = "non_diegetic_pan",
        .placeholder = "<value>",
        .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right,\ncenter or c or 0 ->middle",
    },
    {
        .id = CmdLnOptionId_orientationTracking,
        .match = "tracking_type",
        .matchShort = "otr",
        .placeholder = "<type>",
        .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec`\nor `ref_vec_lev` (only for binaural outputs)",
    },
    {
        .id = CmdlnOptionId_lfePosition,
        .match = "lfe_position",
        .matchShort = "lp",
        .placeholder = "<gain>,<azi>,<ele>",
        .description = "Output LFE position. Comma-delimited triplet of [gain, azimuth,\nelevation] where gain is linear (like --gain, -g) and azimuth,\nelevation are in degrees. If specified, overrides the default\nbehavior which attempts to map input to output LFE channel(s)",
    },
    {
        .id = CmdlnOptionId_lfeMatrix,
        .match = "lfe_matrix",
        .matchShort = "lm",
        .placeholder = "<path>",
        .description = "LFE panning matrix. File (CSV table) containing a matrix of\ndimensions [ num_input_lfe x num_output_channels ] with elements\nspecifying linear routing gain (like --gain, -g). If specified,\noverrides the output LFE position option and the default\nbehavior which attempts to map input to output LFE channel(s)",
    },
    {
@@ -327,6 +346,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_complexityLevel,
        .match = "complexity_level",
        .matchShort = "level",
        .placeholder = "<level>",
        .description = "Complexity level, level = (1, 2, 3), will be defined after\ncharacterisation.",
    },
    {
@@ -339,6 +359,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_inputGain,
        .match = "gain",
        .matchShort = "g",
        .placeholder = "<gain>",
        .description = "Input gain (linear, not in dB) to be applied to input audio file",
    },
    {
@@ -351,43 +372,50 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_referenceVectorFile,
        .match = "reference_vector_file",
        .matchShort = "rvf",
        .placeholder = "<path>",
        .description = "Reference vector trajectory file for simulation of head tracking\n(only for binaural outputs)",
    },
    {
        .id = CmdLnOptionId_exteriorOrientationFile,
        .match = "exterior_orientation_file",
        .matchShort = "exof",
        .placeholder = "<path>",
        .description = "External orientation trajectory file for simulation of external\norientations",
    },
    {
        .id = CmdLnOptionId_framing,
        .match = "framing",
        .matchShort = "fr",
        .description = "Set Render audio framing.",
        .placeholder = "<duration>",
        .description = "Set render audio framing in ms",
    },
    {
        .id = CmdLnOptionId_syncMdDelay,
        .match = "sync_md_delay",
        .matchShort = "smd",
        .placeholder = "<duration>",
        .description = "Metadata Synchronization Delay in ms, Default is 0. Quantized by\n5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes)",
    },
    {
        .id = CmdLnOptionId_directivityPatternId,
        .match = "ism_directivity_pattern_id",
        .matchShort = "dpid",
        .placeholder = "<id1> [<id2>...]",
        .description = "Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated\nlist of up to 4 numbers (unsigned integers) can be specified for\nBINAURAL and BINAURAL_ROOM_REVERB output.\nID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\nISMs 1,2,3 and 4 respectively. \nThis option needs to be accompanied by a render_config file,\notherwise a default directivity pattern is used.",
    },
    {
        .id = CmdLnOptionId_acousticEnvironmentId,
        .match = "acoustic_environment_id",
        .matchShort = "aeid",
        .placeholder = "<id|path>",
        .description = "Acoustic environment ID (number > 0) alternatively, it can be\na text file where each line contains \"ID duration\" for\nBINAURAL_ROOM_REVERB output.",
    },
    {
        .id = CmdLnOptionId_roomSize,
        .match = "room_size",
        .matchShort = "rsz",
        .description = "Selects default reverb based on a room size (S - small | M - medium | L - large)",
        .placeholder = "<size>",
        .description = "Selects default reverb based on a room size (S - small |\nM - medium | L - large)",
    }
};

@@ -1432,7 +1460,7 @@ int main(

        if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, outFile, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nCould not open split rend metadata file %s\n", outFile );
            fprintf( stderr, "\nError: Could not open split rend metadata file %s!\n", outFile );
            goto cleanup;
        }
    }
@@ -2578,53 +2606,6 @@ static bool parseReverbRoomSize(
    return true;
}


static bool checkRequiredArgs(
    CmdlnArgs args )
{
    const CmdLnParser_Option *tmpOption;

    /* Check required arguments */
    bool missingRequiredArg = false;
    if ( isEmptyString( args.inputFilePath ) )
    {
        tmpOption = findOptionById( CmdLnOptionId_inputFile );
        fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort );
        missingRequiredArg = true;
    }

    const bool singleInputSpecified = args.inConfig.numAudioObjects != 0 ||
                                      args.inConfig.numAmbisonicsBuses != 0 ||
                                      args.inConfig.numMultiChannelBuses != 0 ||
                                      args.inConfig.numMasaBuses != 0;

    if ( !args.sceneDescriptionInput && !singleInputSpecified )
    {
        /* Neither scene description input nor single-type input was specified on command line */
        tmpOption = findOptionById( CmdLnOptionId_inputFormat );
        fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort );
        missingRequiredArg = true;
    }
    if ( isEmptyString( args.outputFilePath ) )
    {
        tmpOption = findOptionById( CmdLnOptionId_outputFile );
        fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort );
        missingRequiredArg = true;
    }
    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_INVALID )
    {
        tmpOption = findOptionById( CmdLnOptionId_outputFormat );
        fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort );
        missingRequiredArg = true;
    }
    if ( missingRequiredArg )
    {
        CmdLnParser_printUsage( args.executableName, cliOptions, numCliOptions );
    }

    return !missingRequiredArg;
}

static CmdlnArgs defaultArgs(
    const char *executableName )
{
@@ -2713,7 +2694,7 @@ static CmdlnArgs defaultArgs(
    return args;
}

static void parseOption(
static int16_t parseOption(
    const int32_t optionId,
    char **optionValues,
    const int16_t numOptionValues,
@@ -2899,7 +2880,7 @@ static void parseOption(
            break;
    }

    return;
    return 0;
}

static CmdlnArgs parseCmdlnArgs(
@@ -2913,11 +2894,6 @@ static CmdlnArgs parseCmdlnArgs(
        exit( -1 ); /* Error printout handled by failing function */
    }

    if ( !checkRequiredArgs( args ) )
    {
        exit( -1 ); /* Error printout handled by failing function */
    }

    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        args.Opt_Headrotation = 1;
+2 −1
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2371_REMOVE_UNUSED_ISAR_FCNS                /* Dolby: basop issue 2371: remove unused ISAR-related functions */      

/* #################### End BE switches ################################## */

@@ -169,7 +170,7 @@
/* any switch which is non-be wrt. TS 26.258 V3.0 */
#define FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION         /* Dolby: issue 1465: Fix constant in create_random_vector() to allow more reliable fixed point port */
#define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG       /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching   */

#define FIX_1283_STEREO_DFT_COLLAPSE                    /* FhG: issue 1283: fix for critical issue with DFT stereo core coder */
/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */
+7 −2
Original line number Diff line number Diff line
@@ -516,6 +516,11 @@ ivas_error IVAS_DEC_Configure(
    hDecoderConfig->Opt_aeid_on = acousticEnvironmentId != 65535 ? TRUE : FALSE;
    hDecoderConfig->Opt_ObjEdit_on = (int16_t) objEditEnabled;

    if ( outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        hDecoderConfig->Opt_Headrotation = 1;
    }

    if ( render_num_subframes == IVAS_RENDER_NUM_SUBFR_UNKNOWN )
    {
        return IVAS_ERR_WRONG_PARAMS;
@@ -4439,7 +4444,7 @@ static ivas_error printConfigInfo_dec(
    const bool quietModeEnabled )
{
    ivas_error error;
    char config_str[50];
    char config_str[200];
    AUDIO_CONFIG output_config;

    /*-----------------------------------------------------------------*
Loading