Commit 1cbaae5c authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files
Merge branch 'main' of ssh://forge.3gpp.org:29419/ivas-codec-pc/ivas-codec into ci/renderer-tests-with-sampling-rates
parents dff8f272 ea0d9cd2
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -569,6 +569,7 @@ renderer-smoke-test:
    - mv IVAS_cod IVAS_cod_ref
    - mv IVAS_dec IVAS_dec_ref
    - mv IVAS_rend IVAS_rend_ref
    - mv ISAR_post_rend ISAR_post_rend_ref
    - testcase_timeout=180

# test renderer executable with cmake + asan
@@ -724,6 +725,7 @@ split-rendering-pytest-on-merge-request:
    - mv IVAS_cod IVAS_cod_ref
    - mv IVAS_dec IVAS_dec_ref
    - mv IVAS_rend IVAS_rend_ref
    - mv ISAR_post_rend ISAR_post_rend_ref

    ### If ref_using_main is not set, checkout the source branch to use scripts and input from there
    - if [ $ref_using_main == 0 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts
@@ -1249,6 +1251,7 @@ ivas-conformance:
    - cp -force IVAS_cod.exe IVAS_cod_ref.exe
    - cp -force IVAS_dec.exe IVAS_dec_ref.exe
    - cp -force IVAS_rend.exe IVAS_rend_ref.exe 
    - cp -force ISAR_post_rend.exe ISAR_post_rend_ref.exe
    
    # Reference creation
    - python scripts/prepare_combined_format_inputs.py
@@ -1314,6 +1317,7 @@ ivas-conformance:
    expire_in: 1 week
    when: always
    paths:
      - report_cmd.html
      - report-junit.xml
      - report.html
      - Readme_IVAS_dec.txt  
@@ -1342,6 +1346,7 @@ ivas-conformance-linux:
    - cp IVAS_cod IVAS_cod_ref
    - cp IVAS_dec IVAS_dec_ref
    - cp IVAS_rend IVAS_rend_ref
    - cp ISAR_post_rend ISAR_post_rend_ref
    
    # Reference creation
    - python3 scripts/prepare_combined_format_inputs.py
+2 −3
Original line number Diff line number Diff line
@@ -1858,13 +1858,13 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

    int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
    /* Write zeros to the output audio buffer */
    int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) );
    if ( zeroBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        return IVAS_ERR_FAILED_ALLOC;
    }
    memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );

    for ( int16_t i = 0; i < numInitialBadFrames; ++i )
    {
@@ -1888,7 +1888,6 @@ static ivas_error initOnFirstGoodFrame(
        }
        else
        {

            if ( *pRemainingDelayNumSamples < *numOutSamples )
            {
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
+29 −0
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@
#define IVAS_MAX16B_FLT 32767.0f
#define IVAS_MIN16B_FLT ( -32768.0f )

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
#define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f )
#endif

#if !defined( DEBUGGING ) && !defined( WMOPS )
static
#endif
@@ -1153,20 +1157,39 @@ int main(
        }
    }

#ifndef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
    /* Set the total number of objects */
#endif
    if ( args.inConfig.numAudioObjects > 0 )
    {
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the total number of objects */
#endif
        if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the metadata delay for objects */
#endif
        if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS

        /* For OMASA input and BINAURAL output, apply a gain to objects to match the loudness with MASA part */
        if ( args.inConfig.numMasaBuses > 0 && args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL )
        {
            for ( i = 0; i < args.inConfig.numAudioObjects; ++i )
            {
                args.inConfig.audioObjects[i].gain_dB += OMASA_TDREND_MATCHING_GAIN_DB;
            }
        }
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
@@ -3491,14 +3514,20 @@ static void parseCombinedFormatInput(
        inConfig->numAmbisonicsBuses = 1;
        inConfig->ambisonicsBuses[0].audioConfig = audioConfig;
        inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects;
#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS
        inConfig->ambisonicsBuses[0].gain_dB = 0.f;
#else
        inConfig->ambisonicsBuses[0].gain_dB = -6.f;
#endif
        *configString += 4;

#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS
        /* Modify input gain for objects too */
        for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i )
        {
            inConfig->audioObjects[i].gain_dB = -6.f;
        }
#endif
    }
    else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 )
    {
+180 −0
Original line number Diff line number Diff line
import os
import pandas as pd
import argparse
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots


def read_csv_files(root_dir):
    """Read csv files as dictionary of panda dataframes."""
    csv_data = {}
    for subdir, dirs, files in os.walk(root_dir):
        for file in files:
            if file.endswith(".csv"):
                file_path = os.path.join(subdir, file)
                try:
                    df = pd.read_csv(file_path)
                    csv_data[file_path] = df
                except Exception as e:
                    print(f"Failed to read {file_path}: {e}")
                    exit(-1)
    return csv_data


def parse_csv_data(csv_data):
    """keep 'testcase', 'format', 'MLD', 'MAX_ABS_DIFF'  and add
    'date' column."""
    cols_to_keep = ["testcase", "format", "MLD", "MAX_ABS_DIFF"]
    parsed_data = {}
    for key, df in csv_data.items():
        cols = [col for col in cols_to_keep if col in df.columns]
        date = os.path.basename(os.path.dirname(key))
        new_df = df[cols].copy()
        new_df["date"] = date
        parsed_data[key] = new_df

    # concatenate all dataframe in the dictionary
    concat_df = pd.concat(parsed_data.values(), ignore_index=True)
    return concat_df


def plot_data(df, output_filename):
    """plot max values for 'MLD' and 'MAX_ABS_DIFF' data and save
    to html file."""
    # Convert 'date' to datetime
    df["date"] = pd.to_datetime(df["date"], errors="coerce")
    df["MLD"] = pd.to_numeric(df["MLD"], errors="coerce")
    df["MAX_ABS_DIFF"] = pd.to_numeric(df["MAX_ABS_DIFF"], errors="coerce")

    # Drop rows with NaT and NaN
    clean_df = df.dropna(subset=["date", "MLD", "MAX_ABS_DIFF"])

    # Group by 'format' and 'date' to get rows with max 'MLD' per group
    max_mld = (
        clean_df.groupby(["format", "date"])
        .apply(lambda x: x.loc[x["MLD"].idxmax()])
        .reset_index(drop=True)
    )

    # Group by 'format' and 'date' to get rows with max 'MAX_ABS_DIFF' per
    # group
    max_abs_diff = (
        clean_df.groupby(["format", "date"])
        .apply(lambda x: x.loc[x["MAX_ABS_DIFF"].idxmax()])
        .reset_index(drop=True)
    )

    formats = sorted(clean_df["format"].unique())

    fig = make_subplots(
        rows=5,
        cols=2,
        specs=[[{"secondary_y": True}] * 2] * 5,
        subplot_titles=[f"{i}" for i in formats],
        shared_xaxes="columns",
    )

    for i, fmt in enumerate(formats):
        row = i // 2 + 1
        col = i % 2 + 1

        data_mld = max_mld[max_mld["format"] == fmt].sort_values("date")
        data_diff = max_abs_diff[max_abs_diff["format"]
                                 == fmt].sort_values("date")

        # Add max 'MLD' to primary y-axis
        fig.add_trace(
            go.Scatter(
                x=data_mld["date"],
                y=data_mld["MLD"],
                mode="lines+markers",
                name=f" {fmt} - Max MLD",
                hovertext=[
                    f"Testcase: {tc}<br>MLD: {mld:.4f}<br>MAX_ABS_DIFF:"
                    f"{abs_diff}<br>Format:"
                    f" {format}<br>Date: {date.date()}"
                    for tc, mld, abs_diff, format, date in zip(
                        data_mld["testcase"],
                        data_mld["MLD"],
                        data_mld["MAX_ABS_DIFF"],
                        data_mld["format"],
                        data_mld["date"],
                    )
                ],
                hoverinfo="text",
            ),
            row=row,
            col=col,
            secondary_y=False,
        )

        # Add max 'MAX_ABS_DIFF' to secondary y-axis
        fig.add_trace(
            go.Scatter(
                x=data_diff["date"],
                y=data_diff["MAX_ABS_DIFF"],
                mode="lines+markers",
                name=f"{fmt} - Max MAX_ABS_DIFF",
                hovertext=[
                    f"Testcase: {tc}<br>MLD: {mld:.4f}<br>MAX_ABS_DIFF:"
                    f" {abs_diff:.4f}<br>Format:"
                    f" {format}<br>Date: {date.date()}"
                    for tc, mld, abs_diff, format, date in zip(
                        data_diff["testcase"],
                        data_diff["MLD"],
                        data_diff["MAX_ABS_DIFF"],
                        data_diff["format"],
                        data_diff["date"],
                    )
                ],
                hoverinfo="text",
            ),
            row=row,
            col=col,
            secondary_y=True,
        )

    fig.update_layout(
        title_text="Long-term regression: max MLD and max MAX_ABS_DIFF",
        legend=dict(x=1, y=1, orientation="v"),
        hovermode="x unified",
    )

    fig.update_xaxes(automargin=True)
    fig.update_yaxes(automargin=True)

    # Update y-axes titles per subplot
    for i in range(10):
        yaxis_num = i * 2 + 1
        yaxis2_num = yaxis_num + 1
        fig["layout"][f"yaxis{yaxis_num}"].update(
            title="Max MLD", titlefont=dict(color="blue"), tickfont=dict(color="blue")
        )
        fig["layout"][f"yaxis{yaxis2_num}"].update(
            title="Max MAX_ABS_DIFF",
            titlefont=dict(color="green"),
            tickfont=dict(color="green"),
        )

    # Save to html
    fig.write_html(output_filename)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Plot long term logs")
    parser.add_argument(
        "root_dir",
        type=str,
        help="Root directory containing subdirectories" " with CSV log files",
    )
    parser.add_argument(
        "output_filename",
        type=str,
        help="Filename of the generated plot. e.g" ". long_term_regression.html",
    )
    args = parser.parse_args()

    csv_data = read_csv_files(args.root_dir)
    data = parse_csv_data(csv_data)
    plot_data(data, args.output_filename)
+4 −0
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_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
/*#define CODE_IMPROVEMENTS*/                               /* FhG: Small code improvements that do not change the functionality */

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

@@ -174,6 +175,9 @@
#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 NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */
#define NONBE_1339_FIXOSBA_EXT_LOUDNESS                 /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */
#define NONBE_1352_HARMONIZE_OSBA_LOUDNESS             /* FhG: do not scale OSBA inputs by 0.5 any more */
#define NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Nokia: issue 1339: Apply scaling to the object-part of OMASA for binaural rendering in IVAS_rend. */
#define NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING         /* Nokia: Fix OMASA to MASA1 rendering in IVAS_rend */

/* ##################### End NON-BE switches ########################### */

Loading