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

add format and category properties for EVS test

parent e6d2a6ac
Loading
Loading
Loading
Loading
+34 −3
Original line number Diff line number Diff line
@@ -40,11 +40,12 @@ import shutil

from tests.cmp_pcm import cmp_pcm
from tests.conftest import DecoderFrontend, EncoderFrontend, parse_properties
from tests.constants import CAT_BITRATE_SWITCHING, CAT_DTX, CAT_JBM, CAT_NORMAL, CAT_PLC


test_dict = {}
TEST_DIR = "evs_be_test"
scripts = [
SCRIPTS = [
    "Readme_AMRWB_IO_dec.txt",
    "Readme_AMRWB_IO_enc.txt",
    "Readme_EVS_dec.txt",
@@ -52,7 +53,16 @@ scripts = [
    "Readme_JBM_dec.txt",
]

for s in scripts:
FORMATS_4_SCRIPTS = dict(
    zip(
        [s.replace(".txt", "") for s in SCRIPTS],
        ["AMRWBIO_dec", "AMRWBIO_enc", "EVS_dec", "EVS_enc", "EVS_JBM_dec"],
    )
)

PATTERN_EVS_FORMAT = re.compile(r"-(" + r"|".join(FORMATS_4_SCRIPTS.keys()) + ")")

for s in SCRIPTS:
    with open(os.path.join(TEST_DIR, s), "r", encoding="UTF-8") as fp:
        tag = ""
        enc_opts = ""
@@ -88,11 +98,33 @@ def test_evs_26444(
    abs_tol,
    get_ssnr,
    get_odg,
    record_property,
):
    enc_opts, dec_opts, diff_opts = test_dict[test_tag]
    testcase_props = {}

    # get format prop from test_tag
    m = re.search(PATTERN_EVS_FORMAT, test_tag)
    assert m is not None
    testcase_props["format"] = FORMATS_4_SCRIPTS[m.groups()[0]]

    diff_opts = diff_opts.replace("./", TEST_DIR + "/")

    category = CAT_NORMAL
    if "JBM" in test_tag:
        category = CAT_JBM
    elif "br sw" in test_tag or "bitrate switching" in test_tag:
        category = CAT_BITRATE_SWITCHING
    elif "%" in test_tag:
        category = CAT_PLC
    elif "DTX" in test_tag:
        category = CAT_DTX

    testcase_props["category"] = category

    for k, v in testcase_props.items():
        record_property(k, v)

    if enc_opts:
        args = enc_opts.split()[1:]

@@ -180,7 +212,6 @@ def test_evs_26444(
            reason = reason[0]

            props = parse_properties(reason, output_differs, props_to_record)
            props["format"] = "EVS"
            for k, v in props.items():
                ref_decoder_frontend.record_property(k, v)
            equal &= not output_differs