Commit ba2973ef authored by Jan Kiene's avatar Jan Kiene
Browse files

run formatter

parent c523bb0a
Loading
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3,9 +3,11 @@
import argparse
import math
import numpy as np

# These next three lines are added as a precaution in case the gitlab runner
# needs DISPLAY to render the plots, even if they are written to file.
import matplotlib

matplotlib.use("Agg")
import matplotlib.pyplot as plt
import csv
+6 −2
Original line number Diff line number Diff line
@@ -59,11 +59,15 @@ if __name__ == "__main__":
        help="XML junit report input file, e.g. report-junit.xml",
    )
    parser.add_argument("csv_file", type=str, help="Output CSV file, e.g. report.csv")
    parser.add_argument("--evs", action="store_true", help="Parse using EVS 26.444 formats",)
    parser.add_argument(
        "--evs",
        action="store_true",
        help="Parse using EVS 26.444 formats",
    )
    args = parser.parse_args()
    xml_report = args.xml_report
    csv_file = args.csv_file
    if (args.evs):
    if args.evs:
        FORMATS = EVS_FORMATS
        CATEGORIES = EVS_CATEGORIES
    else:
+14 −6
Original line number Diff line number Diff line
@@ -138,8 +138,16 @@ def pqevalaudio_wrapper(
        tmp_file_eval = str(tmp_dir.joinpath("eval.wav"))

        # PQevalAudio neeeds 48 kHz sampling rate
        r48 = np.clip( pyaudio3dtools.audioarray.resample(ref_sig.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16)
        t48 = np.clip( pyaudio3dtools.audioarray.resample(eval_sig.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16)
        r48 = np.clip(
            pyaudio3dtools.audioarray.resample(ref_sig.astype(float), fs, 48000),
            -32768,
            32767,
        ).astype(np.int16)
        t48 = np.clip(
            pyaudio3dtools.audioarray.resample(eval_sig.astype(float), fs, 48000),
            -32768,
            32767,
        ).astype(np.int16)

        pyaudio3dtools.audiofile.writefile(tmp_file_ref, r48, 48000)
        pyaudio3dtools.audiofile.writefile(tmp_file_eval, t48, 48000)
+19 −16
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ for s in scripts:
                dec_opts = ""
                diff_opts = ""


@pytest.mark.parametrize("test_tag", list(test_dict.keys()))
def test_evs_26444(
    record_property,
@@ -111,7 +112,6 @@ def test_evs_26444(
            run_dir=TEST_DIR,
        )


    if dec_opts:
        args = dec_opts.split()[1:]
        output_config = ""  # Empty for EVS operation
@@ -131,18 +131,22 @@ def test_evs_26444(

    # Run comparison on encoder and decoder test cases
    equal = True
    for diff_opt in diff_opts.split(';'):
        pattern = r'(\$DIFF_BIN\s?-w\s?)?'
        diff_opt = re.sub(pattern, '', diff_opt).strip()
    for diff_opt in diff_opts.split(";"):
        pattern = r"(\$DIFF_BIN\s?-w\s?)?"
        diff_opt = re.sub(pattern, "", diff_opt).strip()
        [ref, test] = diff_opt.split()[:2]
        # Run audio file comparison if MLD/SSNR/PEAQ is requested and the test is either a bitstream or audio (not JBM tracefile)
        # and the ref_decoder_path is specified (otherwise ref_decoder_frontend is None)
        if (get_mld or get_ssnr or get_odg) and ("COD" in ref or "OUT" in ref) and ref_decoder_frontend:
        if (
            (get_mld or get_ssnr or get_odg)
            and ("COD" in ref or "OUT" in ref)
            and ref_decoder_frontend
        ):
            if enc_opts:
                for file in [ref, test]:
                    output_config = ""  # Empty for EVS operation
                    in_file = file
                    out_file = file + '.wav'
                    out_file = file + ".wav"
                    add_option_list = []
                    ref_decoder_frontend.run(
                        output_config,
@@ -155,7 +159,7 @@ def test_evs_26444(
                reffile = ref + ".wav"
                testfile = test + ".wav"
            else:
                fs = int(re.search(r'(\d+)kHz', ref).group(1)) * 1000
                fs = int(re.search(r"(\d+)kHz", ref).group(1)) * 1000
                # pyaudio3dtools.audiofile.readfile only handles .wav, .pcm and .raw suffixes.
                reffile = ref + ".pcm"
                testfile = test + ".pcm"
@@ -184,4 +188,3 @@ def test_evs_26444(

    if not equal:
        pytest.fail("Output differs")