Commit ca9d15b2 authored by norvell's avatar norvell
Browse files

Merge branch 'ci/update-basop-ci-branch' into 'basop-ci-branch'

[BASOP CI] Update histogram summary

See merge request !1995
parents c517b735 d685256d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -466,6 +466,7 @@ branch-is-up-to-date-with-main-post:
  before_script:
    - python3 ci/remove_unsupported_testcases.py $PARAM_FILE
    - python3 tests/create_short_testvectors.py
    - python3 scripts/prepare_combined_format_inputs.py

    - *update-ltv-repo
    - *copy-ltv-files-to-testv-dir
+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","DELTA_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,
    )
+24 −21
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.

set -euxo pipefail

function usage {
    echo
    echo "Usage:"
@@ -42,9 +44,9 @@ if [ ! -d "lib_com" ]; then
    exit 1
fi

if [ -z "$1" ] || [ "$1" == "test" ]; then
if [ -z "${1:-}" ] || [ "${1:-}" == "test" ]; then
    BUILD=1
elif [ "$1" == "coverage" ]; then
elif [ "${1:-}" == "coverage" ]; then
    BUILD=0
else
    usage
@@ -76,37 +78,38 @@ if [ $BUILD -eq 1 ];then
fi

# prepare combined format test signals
echo "\n======================= 0. preparing combined format test inputs =======================\n\n"
echo -e "\n======================= 0. preparing combined format test inputs =======================\n\n"
./scripts/prepare_combined_format_inputs.py

# run all modes vanilla-fashion
# treat ISM modes separately because passing the metadata files to MASA modes causes crashes
ism_modes=$(./scripts/runIvasCodec.py -l | grep ISM)
non_ism_modes=$(./scripts/runIvasCodec.py -l | grep -v ISM)
echo "\n======================= 1. non-ism modes no FEC =======================\n\n"
./scripts/runIvasCodec.py $verbosity_cmd -m $non_ism_modes -p $cfg $duration_arg $timeout_cmd | tee smoke_test_output.txt
echo "\n======================= 2. ism modes no FEC =======================\n\n"
./scripts/runIvasCodec.py $verbosity_cmd -m $ism_modes -p $cfg $duration_arg $ism_md_cmd $timeout_cmd | tee smoke_test_output.txt
readarray -t ism_modes < <(./scripts/runIvasCodec.py -l | grep ISM)
readarray -t non_ism_modes < <(./scripts/runIvasCodec.py -l | grep -v ISM)

echo -e "\n======================= 1. non-ism modes no FEC =======================\n\n"
./scripts/runIvasCodec.py $verbosity_cmd -m "${non_ism_modes[@]}" -p $cfg $duration_arg $timeout_cmd | tee smoke_test_output.txt
echo -e "\n======================= 2. ism modes no FEC =======================\n\n"
./scripts/runIvasCodec.py $verbosity_cmd -m "${ism_modes[@]}" -p $cfg $duration_arg $ism_md_cmd $timeout_cmd | tee smoke_test_output.txt

# all modes with simulated network delay - this includes JBM TSM and lost frames
echo "\n======================= 3. JBM =======================\n\n"
echo -e "\n======================= 3. JBM =======================\n\n"
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg $duration_arg --decoder_only --jbm_file $dly_profile $timeout_cmd | tee smoke_test_output_jbm.txt

# run all modes with binaural output using external files
formats_with_bin_out=$(./scripts/runIvasCodec.py -L | grep -v "mono\|tereo")
bin_out_modes="BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB"
readarray -t formats_with_bin_out < <(./scripts/runIvasCodec.py -L | grep -v "mono\|tereo")
bin_out_modes=(BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB)

echo "\n======================= 4. binaural out with HRTF files - WB =======================\n\n"
wb_modes=$(./scripts/runIvasCodec.py -l -C $formats_with_bin_out | grep _wb_)
echo -e "\n======================= 4. binaural out with HRTF files - WB =======================\n\n"
readarray -t wb_modes < <(./scripts/runIvasCodec.py -l -C "${formats_with_bin_out[@]}" | grep _wb_)
hrtf_wb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin"
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg -m $wb_modes $duration_arg -D="-hrtf ${hrtf_wb}" --decoder_only --oc $bin_out_modes $timeout_cmd | tee -a smoke_test_output_hrtf.txt
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg -m "${wb_modes[@]}" $duration_arg -D="-hrtf ${hrtf_wb}" --decoder_only --oc "${bin_out_modes[@]}" $timeout_cmd | tee -a smoke_test_output_hrtf.txt

echo "\n======================= 5. binaural out with HRTF files - SWB =======================\n\n"
swb_modes=$(./scripts/runIvasCodec.py -l -C $formats_with_bin_out | grep _swb_)
echo -e "\n======================= 5. binaural out with HRTF files - SWB =======================\n\n"
readarray -t swb_modes < <(./scripts/runIvasCodec.py -l -C "${formats_with_bin_out[@]}" | grep _swb_)
hrtf_swb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin"
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg -m $swb_modes $duration_arg -D="-hrtf ${hrtf_swb}" --decoder_only --oc $bin_out_modes $timeout_cmd | tee -a smoke_test_output_hrtf.txt
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg -m "${swb_modes[@]}" $duration_arg -D="-hrtf ${hrtf_swb}" --decoder_only --oc "${bin_out_modes[@]}" $timeout_cmd | tee -a smoke_test_output_hrtf.txt

echo "\n======================= 6. binaural out with HRTF files - FB =======================\n\n"
fb_modes=$(./scripts/runIvasCodec.py -l -C $formats_with_bin_out | grep _fb_)
echo -e "\n======================= 6. binaural out with HRTF files - FB =======================\n\n"
readarray -t fb_modes < <(./scripts/runIvasCodec.py -l -C "${formats_with_bin_out[@]}" | grep _fb_)
hrtf_fb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin"
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg -m $fb_modes $duration_arg -D="-hrtf ${hrtf_fb}" --decoder_only --oc $bin_out_modes $timeout_cmd | tee -a smoke_test_output_hrtf.txt
./scripts/runIvasCodec.py $verbosity_cmd -p $cfg -m "${fb_modes[@]}" $duration_arg -D="-hrtf ${hrtf_fb}" --decoder_only --oc "${bin_out_modes[@]}" $timeout_cmd | tee -a smoke_test_output_hrtf.txt
+3 −8
Original line number Diff line number Diff line
@@ -676,9 +676,7 @@ def get_wav_file_info(filename: str) -> dict:

    """

    fid = open(filename, "rb")

    try:
    with open(filename, "rb") as fid:
        riff = fid.read(4)

        if riff == b"RIFF":
@@ -686,13 +684,13 @@ def get_wav_file_info(filename: str) -> dict:
        elif riff == b"RIFX":
            binary_format = ">"
        else:
            raise ValueError("No RIFF!")
            raise ValueError(f"Not a RIFF file: {filename}")

        wav_size = struct.unpack(f"{binary_format}I", fid.read(4))[0]

        wav_identifier = fid.read(4)
        if wav_identifier != b"WAVE":
            raise ValueError("No WAVE!")
            raise ValueError(f"Not a WAVE file: {filename}")

        fmt_chunk_id = fid.read(4)

@@ -715,9 +713,6 @@ def get_wav_file_info(filename: str) -> dict:
        else:
            raise ValueError("No or corrupt fmt chunk!")

    finally:
        fid.close()

    return {
        "size": wav_size,
        "format_tag": wav_format,
+8 −9
Original line number Diff line number Diff line
@@ -296,9 +296,8 @@ class IvasModeAnalyzer(IvasModeCollector):
            keywords = [keywords]

        if os.path.exists(filename):
            fp = open(filename)
            with open(filename) as fp:
                loglines = fp.readlines()
            fp.close()
            matching_lines = [
                line
                for line in loglines
@@ -571,7 +570,7 @@ class IvasModeAnalyzer(IvasModeCollector):
        """
        loglines = []
        if os.path.exists(filename):
            fp = open(filename)
            with open(filename) as fp:
                loglines = fp.readlines()
        vg_errors = {"errors": 0, "contexts": 0, "heap_bytes": 0, "heap_blocks": 0}
        for line in loglines:
@@ -602,7 +601,7 @@ class IvasModeAnalyzer(IvasModeCollector):
        """
        loglines = []
        if os.path.exists(filename):
            fp = open(filename)
            with open(filename) as fp:
                loglines = fp.readlines()
        build_errors = 0
        for line in loglines:
@@ -1053,7 +1052,7 @@ class IvasModeAnalyzer(IvasModeCollector):
    def get_snr_report(file_name):
        SNR_report = {}
        if os.path.exists(file_name):
            fp = open(file_name, "r")
            with open(file_name) as fp:
                lines = fp.readlines()
            for line in lines:
                line = line.rstrip("\n")
Loading