Commit 2bf8bfd9 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 20250131-update-diff-complexity
parents a8b2d2c7 88c706dd
Loading
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -1818,7 +1818,7 @@ ltv-usan:
    - ivas-linux-fast
  artifacts:
    name: "$CI_JOB_NAME--main--sha-$CI_COMMIT_SHORT_SHA"
    expire_in: 2 weeks
    expire_in: 4 weeks
    when: always
    paths:
      - ep_015.g192
@@ -2407,8 +2407,25 @@ coverage-test-on-main-scheduled:
  - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html
  - ls
  - public_dir="$CI_JOB_NAME-public"

  # if is needed to catch case when no artifact is there (first run), similarly as above
  - if [[ -d $public_dir ]]; then mv $public_dir/* wmops/;  fi
  - if [[ -d $public_dir ]]; then
  -   mv $public_dir/* wmops/
  # check here if we have the split-by-levels files present - if not, fake them up with the existing global one
  # this is needed for the first run with split graphs on a branch where the global version did run previously
  # NOTE: checking only for level_1 file here as this should already be sufficient
  # NOTE2: also not chechking for RAM for same reason
  -   wmops_all_global="wmops/log_wmops_all.txt"
  -   ram_all_global="wmops/log_ram_all.txt"
  -   if [ -f "${wmops_all_global}" ] && [ ! -f "wmops/log_wmops_all_level_1.txt" ]; then
  -     declare -a suffixes=("level_1" "level_2" "level_3" "rate_sw")
  -     for suffix in "${suffixes[@]}"; do
  -       cp ${wmops_all_global} wmops/log_wmops_all_${suffix}.txt
  -       cp ${ram_all_global} wmops/log_ram_all_${suffix}.txt
  -     done
  -   fi
  - fi

  - ls wmops
  - rm artifacts.zip
  - rm -rf $public_dir
@@ -2417,7 +2434,7 @@ coverage-test-on-main-scheduled:
  &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory
  - public_dir="$CI_JOB_NAME-public"
  - mkdir $public_dir
  - mv -f wmops/log_*_all.txt ./*.js ${public_dir}/
  - mv -f wmops/log_*_all*.txt ./*.js ${public_dir}/
  # move logfiles for links
  - mkdir $public_dir/logs
  # first move logs
+0 −83
Original line number Diff line number Diff line
@@ -32,9 +32,7 @@

#include "lib_dec.h"
#include <string.h>
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
#include <math.h>
#endif
#include "cmdl_tools.h"
#include "audio_file_writer.h"
#include "bitstream_reader.h"
@@ -48,9 +46,7 @@
#include "rotation_file_reader.h"
#include "aeid_file_reader.h"
#include "split_render_file_read_write.h"
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
#include "obj_edit_file_reader.h"
#endif
#ifdef VARIABLE_SPEED_DECODING
#include "tsm_scale_file_reader.h"
#include <math.h>
@@ -157,9 +153,7 @@ typedef struct
    bool dpidEnabled;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
    bool objEditEnabled;
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    char *objEditFileName;
#endif

} DecArguments;

@@ -188,24 +182,15 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#endif
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
static int16_t app_own_random( int16_t *seed );
static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar );
#endif
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );
#else
static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters );
#endif

/*------------------------------------------------------------------------------------------*
 * main()
@@ -236,9 +221,7 @@ int main(
    int16_t *pcmBuf = NULL;
    IVAS_RENDER_FRAMESIZE asked_frame_size;
    IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary;
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    ObjectEditFileReader *objectEditFileReader = NULL;
#endif
#ifdef DEBUGGING
    int32_t noClipping;
    int32_t cnt_frames_limited;
@@ -442,7 +425,6 @@ int main(
        }
    }

#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    /*------------------------------------------------------------------------------------------*
     * Open object editing instruction file
     *------------------------------------------------------------------------------------------*/
@@ -455,7 +437,6 @@ int main(
            goto cleanup;
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
@@ -775,19 +756,11 @@ int main(

    if ( arg.voipMode )
    {
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
#endif
    }
    else
    {
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -851,9 +824,7 @@ cleanup:
    RotationFileReader_close( &refRotReader );
    Vector3PairFileReader_close( &referenceVectorReader );
    RenderConfigReader_close( &renderConfigReader );
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    ObjectEditFileReader_close( &objectEditFileReader );
#endif

    if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK )
    {
@@ -1052,9 +1023,7 @@ static bool parseCmdlIVAS_dec(
    }

    arg->objEditEnabled = false;
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    arg->objEditFileName = NULL;
#endif

    /*-----------------------------------------------------------------*
     * Initialization
@@ -1512,7 +1481,6 @@ static bool parseCmdlIVAS_dec(
        {
            arg->objEditEnabled = true;
            i++;
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
            if ( argc - i <= 3 || argv[i][0] == '-' )
            {
                fprintf( stderr, "Error: Object editing instruction filename not specified!\n\n" );
@@ -1529,7 +1497,6 @@ static bool parseCmdlIVAS_dec(
                arg->objEditFileName = argv[i]; /* read edit instructions from this file */
            }
            i++;
#endif
        }

        /*-----------------------------------------------------------------*
@@ -1732,11 +1699,7 @@ static void usage_dec( void )
    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" );
#ifndef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    fprintf( stdout, "-obj_edit           : Enable objects editing\n" );
#else
    fprintf( stdout, "-obj_edit File      : Object editing instructions file or NULL for built-in example\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" );
@@ -1999,7 +1962,6 @@ static ivas_error initOnFirstGoodFrame(
            if ( numInitialBadFrames > 0 )
            {
                /* Duplicate good first frame metadata to fill the beginning of stream. */
#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM
                int16_t fullDelayNumSamplesLocal[3];
                int32_t delayTimeScaleLocal;
                float delayMs;
@@ -2012,9 +1974,6 @@ static ivas_error initOnFirstGoodFrame(
                    fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                }
                delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal );
#else
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
#endif

                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
                {
@@ -2024,9 +1983,6 @@ static ivas_error initOnFirstGoodFrame(

                for ( int16_t j = 0; j < numInitialBadFrames; ++j )
                {
#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM
                    float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale );
#endif
                    if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
@@ -2075,9 +2031,7 @@ static ivas_error decodeG192(
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    ObjectEditFileReader *objectEditFileReader,
#endif
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )
@@ -2475,7 +2429,6 @@ static ivas_error decodeG192(
                        return error;
                    }

#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                    if ( arg.objEditFileName != NULL )
                    {
                        if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK )
@@ -2484,14 +2437,9 @@ static ivas_error decodeG192(
                            return error;
                        }
                    }
#endif

                    /* Do object metadata editing here ... */
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                    do_object_editing( &editableParameters, objectEditFileReader );
#else
                    do_object_editing( &editableParameters );
#endif

                    /* set new object parameters */
                    if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK )
@@ -3014,9 +2962,7 @@ static ivas_error decodeVoIP(
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    ObjectEditFileReader *objectEditFileReader,
#endif
    IVAS_DEC_HANDLE hIvasDec )
{
    bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */
@@ -3296,12 +3242,7 @@ static ivas_error decodeVoIP(
            }
        }

#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM
        if ( arg.objEditEnabled && arg.objEditFileName != NULL && vec_pos_update == 0 )
#else
        if ( arg.objEditEnabled && ( arg.objEditFileName != NULL ) )
#endif
        {
            if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK )
            {
@@ -3309,7 +3250,6 @@ static ivas_error decodeVoIP(
                return error;
            }
        }
#endif

        /* read all packets with a receive time smaller than the system time */
        while ( nextPacketRcvTime_ms <= systemTime_ms )
@@ -3411,11 +3351,7 @@ static ivas_error decodeVoIP(
                }

                /* Do object metadata editing here ... */
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                do_object_editing( &editableParameters, objectEditFileReader );
#else
                do_object_editing( &editableParameters );
#endif

                /* set new object parameters */
                if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK )
@@ -3543,22 +3479,12 @@ static ivas_error decodeVoIP(
            }
        }

#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
#else
        if ( !arg.quietModeEnabled )
        {
            fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame );
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        frame++;
#endif
        if ( vec_pos_update == 0 )
        {
            systemTime_ms += vec_pos_len * systemTimeInc_ms;
        }

#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM
        if ( vec_pos_update == 0 )
        {
            frame++;
@@ -3567,7 +3493,6 @@ static ivas_error decodeVoIP(
                fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame );
            }
        }
#endif

#ifdef WMOPS
        update_mem();
@@ -3730,12 +3655,8 @@ cleanup:
 *---------------------------------------------------------------------*/

static void do_object_editing(
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    IVAS_EDITABLE_PARAMETERS *editableParameters,
    ObjectEditFileReader *objectEditFileReader )
#else
    IVAS_EDITABLE_PARAMETERS *editableParameters )
#endif
{
    /* put the objects equally spaced at the horizontal plane */
    /* and play a little bit with the gains... */
@@ -3751,7 +3672,6 @@ static void do_object_editing(
        }
    }

#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    if ( objectEditFileReader != NULL )
    {
        ReadObjectEditInfo *readInfo;
@@ -3810,7 +3730,6 @@ static void do_object_editing(
    }
    else
    {
#endif
        if ( num_nondiegetic_objects )
        {
            float start_angle, angle_inc;
@@ -3834,9 +3753,7 @@ static void do_object_editing(
        }

        editableParameters->gain_bed = 0.5f;
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    }
#endif

    return;
}
+29 −6
Original line number Diff line number Diff line
import argparse
from typing import List

from create_report_pages import SUBPAGE_TMPL_CSS, FORMATS

MEASURES = ["MLD","DIFF","SSNR","ODG"]

title = {
    "MLD": "Maximum MLD across channels",
    "DIFF": "Maximim absolute difference across channels",
    "SSNR": "Minimum SSNR across channels",
    "ODG": "Minimum PEAQ ODG across channels",
    "DELTA_ODG": "PEAQ ODG using binauralized input and output",
}

SUMMARY_PAGE_TMPL_HTML = """

@@ -12,12 +20,14 @@ SUMMARY_PAGE_TMPL_HTML = """

"""


def create_summary_page(
    html_out,
    id_current: int,
    job_name: str,
    measures: List[str],
):
    images = histogram_summary(job_name)
    images = histogram_summary(job_name, measures)

    new_summary_page = SUBPAGE_TMPL_CSS + SUMMARY_PAGE_TMPL_HTML.format(
        id_current=id_current,
@@ -27,13 +37,15 @@ def create_summary_page(
    with open(html_out, "w") as f:
        f.write(new_summary_page)


def histogram_summary(
    job_name: str,
    measures: List[str],
):
    images = "<hr>"
    for m in MEASURES:
    for m in measures:
        images += (
            f"<h2>{m} summary {job_name}</h2>\n"
            f"<h2>{title[m]}</h2>\n"
            + " ".join(
                [f"<img src=images_{job_name}/summary_{m}_{x}.png>" for x in FORMATS]
            )
@@ -41,15 +53,26 @@ def histogram_summary(
        )
    return images


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("html_out")
    parser.add_argument("id_current", type=int)
    parser.add_argument("job_name")
    parser.add_argument(
        "--measures",
        nargs="+",
        help=f"List of measures to include in summary. Allowed values: {' '.join(title.keys())}",
        default=["MLD", "DIFF", "SSNR", "ODG"],
    )
    args = parser.parse_args()

    if not all([m in title for m in args.measures]):
        raise ValueError(f"Invalid list of measures: {args.measures}, expected one of {' '.join(title.keys())}")

    create_summary_page(
        args.html_out,
        args.id_current,
        args.job_name,
        args.measures,
    )
+13 −10
Original line number Diff line number Diff line
@@ -4,17 +4,20 @@ import sys


THRESH = 0.01
COLS = [
    [3, 5, 7, 9],  # wmops_all
    [3, 5, 7, 8, 10, 12, 13, 15, 17],  # ram_all
    [3, 5, 7, 9, 11, 13, 15, 17, 19],  # rom_all
]
COLS_WMOPS = [3, 5, 7, 9]
COLS_RAM = [3, 5, 7, 8, 10, 12, 13, 15, 17]
COLS_ROM = [3, 5, 7, 9, 11, 13, 15, 17, 19]


def main(args):
    linewise_logfiles = [args.wmops_logfile, args.ram_logfile, args.rom_logfile]
    linewise_logfiles = [*args.wmops_logfiles, *args.ram_logfiles, args.rom_logfile]
    cols = (
        len(args.wmops_logfiles) * [COLS_WMOPS]
        + len(args.ram_logfiles) * [COLS_RAM]
        + [COLS_ROM]
    )
    changes_found_linewise = any(
        [check_linewise_logfile(f, c) for f, c in zip(linewise_logfiles, COLS)]
        [check_linewise_logfile(f, c) for f, c in zip(linewise_logfiles, cols)]
    )

    if changes_found_linewise:
@@ -59,9 +62,9 @@ def check_linewise_logfile(filepath, cols):

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("wmops_logfile")
    parser.add_argument("ram_logfile")
    parser.add_argument("rom_logfile")
    parser.add_argument("--wmops_logfiles", nargs="+")
    parser.add_argument("--ram_logfiles", nargs="+")
    parser.add_argument("--rom_logfile")
    args = parser.parse_args()

    sys.exit(main(args))
+57 −40
Original line number Diff line number Diff line
@@ -90,16 +90,16 @@ RUNS_LINE_IDX = {

DISPLAY_IDS = {
    "wmops": [
        "3xEVS",
        "6xEVS",
        "10xEVS",
        # "3xEVS",
        # "6xEVS",
        # "10xEVS",
        "worst case codec",
        "worst case enc/dec",
        "worst case enc",
        "worst case dec",
    ],
    "rom": [
        "requirementRom",
        # "requirementRom",
        "TotalRomCodecScore",
        "maxPROMEncScore",
        "maxPROMDecScore",
@@ -111,7 +111,7 @@ DISPLAY_IDS = {
        "maxTROMRendScore",
    ],
    "ram": [
        "requirementRam",
        # "requirementRam",
        "maxTotalRamCodecScore",
        "maxTotalRamEncScore",
        "maxTotalRamDecScore",
@@ -129,9 +129,12 @@ DISPLAY_IDS = {
}
# the -1's are for reference lines
DISPLAY_LINE_IDX = {
    "wmops": [-1, -1, -1, 9, 3, 5, 7],
    "rom": [-1, 3, 5, 7, 9, 11, 13, 15, 17, 19],
    "ram": [-1, 3, 5, 7, 8, 10, 12, 13, 15, 17],
    # "wmops": [-1, -1, -1, 9, 3, 5, 7],
    # "rom": [-1, 3, 5, 7, 9, 11, 13, 15, 17, 19],
    # "ram": [-1, 3, 5, 7, 8, 10, 12, 13, 15, 17],
    "wmops": [9, 3, 5, 7],
    "rom": [3, 5, 7, 9, 11, 13, 15, 17, 19],
    "ram": [3, 5, 7, 8, 10, 12, 13, 15, 17],
    "wmops_per_op": [1, 2],
}
DISPLAY_LABELS = {
@@ -144,16 +147,16 @@ REF_COLOR_FOR_COMP_BARS = dict(
)
LINE_COLORS = {
    "wmops": [
        REF_COLORS[0],
        REF_COLORS[1],
        REF_COLORS[2],
        # REF_COLORS[0],
        # REF_COLORS[1],
        # REF_COLORS[2],
        "#0080FF",
        "#FF8000",
        "#CF4B4B",
        "#008040",
    ],
    "rom": [
        REF_COLORS[0],
        # REF_COLORS[0],
        "#FF0000",
        "#FF8000",
        "#FFFF00",
@@ -165,7 +168,7 @@ LINE_COLORS = {
        "#00FF00",
    ],
    "ram": [
        REF_COLORS[0],
        # REF_COLORS[0],
        "#FF0000",
        "#FF8000",
        "#FFFF00",
@@ -185,7 +188,6 @@ LINE_COLORS = {
JS_FILE_TEMPLATE = """var {var_name} = {{
    {elem_name}: {{
        description: "{description}",
        direction: -1,
        ticks: [
            {ticks}
            ],
@@ -199,48 +201,57 @@ JS_FILE_TEMPLATE = """var {var_name} = {{
}};
"""

# static references commented out for now
FILE_DATA = {
    "wmops": {
        "var_name": "Graphs_WMOPS",
        "var_name": "Graphs_WMOPS{}",
        "elem_name": "wmops_worstcase",
        "description": "Worst Case WMOPS",
        "filename": "graphs_wmops_flc.js",
        "references": {
            "3xEVS": REF_WMOPS_3EVS,
            "6xEVS": REF_WMOPS_6EVS,
            "10xEVS": REF_WMOPS_10EVS,
        },
        "filename": "graphs_wmops_flc{}.js",
        # "references": {
        #     "3xEVS": REF_WMOPS_3EVS,
        #     "6xEVS": REF_WMOPS_6EVS,
        #     "10xEVS": REF_WMOPS_10EVS,
        # },
        "references": {},
    },
    "rom": {
        "var_name": "Graphs_ROM",
        "var_name": "Graphs_ROM{}",
        "elem_name": "rom_worstcase",
        "description": "ROM",
        "filename": "graphs_rom_flc.js",
        "references": {
            "requirementRom": 0,
        },
        "filename": "graphs_rom_flc{}.js",
        # "references": {
        #     "requirementRom": 0,
        # },
        "references": {},
    },
    "ram": {
        "var_name": "Graphs_RAM",
        "var_name": "Graphs_RAM{}",
        "elem_name": "ram_worstcase",
        "description": "Worst Case RAM",
        "filename": "graphs_ram_flc.js",
        "references": {
            "requirementRam": 0,
        },
        "filename": "graphs_ram_flc{}.js",
        # "references": {
        #     "requirementRam": 0,
        # },
        "references": {},
    },
    "wmops_per_op": {
        "var_name": "Graphs_WMOPS_perOP",
        "var_name": "Graphs_WMOPS_perOP{}",
        "elem_name": "wmops_worstcase_per_op",
        "description": "Worst Case WMOPS per OP",
        "filename": "graphs_wmops_flc_perOP.js",
        "filename": "graphs_wmops_flc_perOP{}.js",
        "references": {},
    },
}


def main(
    wmops_log, wmops_per_op_log, rom_log, ram_log, wmops_per_op_log_for_comparison
    wmops_log,
    wmops_per_op_log,
    rom_log,
    ram_log,
    wmops_per_op_log_for_comparison,
    suffix,
):
    FILE_DATA["wmops"]["log_file"] = wmops_log
    FILE_DATA["wmops_per_op"]["log_file"] = wmops_per_op_log
@@ -248,6 +259,10 @@ def main(
    FILE_DATA["ram"]["log_file"] = ram_log

    for x, data in FILE_DATA.items():
        if data["log_file"] is None:
            print(f"Skipping '{x}' because no logfile given")
            continue

        with open(data["log_file"]) as f:
            log_lines = f.readlines()

@@ -279,14 +294,14 @@ def main(
        ticks = ",\n".join(ticks)

        js_string = JS_FILE_TEMPLATE.format(
            var_name=data["var_name"],
            var_name=data["var_name"].format(suffix),
            elem_name=data["elem_name"],
            description=data["description"],
            runs=runs,
            displays=displays,
            ticks=ticks,
        )
        with open(data["filename"], "w") as f:
        with open(data["filename"].format(suffix), "w") as f:
            print(js_string, file=f)


@@ -444,11 +459,12 @@ if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Generate Javascript code for the complexity webpage"
    )
    parser.add_argument("wmops_log")
    parser.add_argument("wmops_per_op_log")
    parser.add_argument("rom_log")
    parser.add_argument("ram_log")
    parser.add_argument("--wmops_log", default=None)
    parser.add_argument("--wmops_per_op_log", default=None)
    parser.add_argument("--rom_log", default=None)
    parser.add_argument("--ram_log", default=None)
    parser.add_argument("--wmops_per_op_log_for_comparison", default=None)
    parser.add_argument("--suffix", default="")

    args = parser.parse_args()

@@ -458,4 +474,5 @@ if __name__ == "__main__":
        args.rom_log,
        args.ram_log,
        args.wmops_per_op_log_for_comparison,
        args.suffix,
    )
Loading