Commit 8bc970c9 authored by norvell's avatar norvell
Browse files

Add back old channel-wise PEAQ comparison

parent a56fb9b1
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ def cmp_pcm(
    abs_tol=0,
    get_ssnr=False,
    get_odg=False,
    get_odg_bin=False,
    odg_input=None,
    odg_test=None,
    odg_ref=None,
@@ -133,6 +134,16 @@ def cmp_pcm(
            reason += msg + " - "

    if get_odg:
        for n in range(nchannels):
            pqeval_output = pqevalaudio_wrapper(s1[:, n], s2[:, n], fs)

            match_odg = re.search(ODG_PATTERN_PQEVALAUDIO, pqeval_output)
            odg = float(match_odg.groups()[0])
            msg = f"Channel {n} ODG: {odg}"
            reason += " - " + msg
            print(msg)

    if get_odg_bin:
        odg_files = {}
        for f in [odg_input, odg_test, odg_ref]:
            # Load PEAQ test files and ensure 48 kHz sampling rate
@@ -165,7 +176,7 @@ def cmp_pcm(

        odg = odg_test - odg_ref  # Todo: store both rather than difference?

        msg = f"ODG: {odg}"
        msg = f"Delta-ODG: {odg}"
        reason += " - " + msg
        print(msg, file=output_target)

+5 −1
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ def test_param_file_tests(
    get_ssnr,
    get_enc_stats,
    get_odg,
    get_odg_bin,
    compare_to_input,
    compare_enc_dmx,
):
@@ -248,6 +249,7 @@ def test_param_file_tests(
        get_ssnr,
        get_enc_stats,
        get_odg,
        get_odg_bin,
        compare_to_input,
        compare_enc_dmx,
    )
@@ -279,6 +281,7 @@ def run_test(
    get_ssnr,
    get_enc_stats,
    get_odg,
    get_odg_bin,
    compare_to_input,
    compare_enc_dmx,
):
@@ -526,7 +529,7 @@ def run_test(
        odg_input = None
        odg_test = None
        odg_ref = None
        if get_odg:
        if get_odg_bin:
            # Find input format
            in_fmt = [(a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts)][0][1]

@@ -595,6 +598,7 @@ def run_test(
            allow_differing_lengths=allow_differing_lengths,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            odg_input=odg_input,
            odg_test=odg_test,
            odg_ref=odg_ref,
+15 −1
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ def test_pca_enc(
    abs_tol,
    get_ssnr,
    get_odg,
    get_odg_bin,
    get_enc_stats,
    compare_to_input,
    compare_enc_dmx,
@@ -195,6 +196,7 @@ def test_pca_enc(
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            compare_to_input=compare_to_input,
        )

@@ -231,6 +233,7 @@ def test_sba_enc_system(
    abs_tol,
    get_ssnr,
    get_odg,
    get_odg_bin,
    get_enc_stats,
    compare_to_input,
    compare_enc_dmx,
@@ -372,6 +375,7 @@ def test_sba_enc_system(
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            compare_to_input=compare_to_input,
        )

@@ -400,6 +404,7 @@ def test_spar_hoa2_enc_system(
    abs_tol,
    get_ssnr,
    get_odg,
    get_odg_bin,
    get_enc_stats,
    compare_to_input,
    compare_enc_dmx,
@@ -516,6 +521,7 @@ def test_spar_hoa2_enc_system(
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            compare_to_input=compare_to_input,
        )

@@ -544,6 +550,7 @@ def test_spar_hoa3_enc_system(
    abs_tol,
    get_ssnr,
    get_odg,
    get_odg_bin,
    get_enc_stats,
    compare_to_input,
    compare_enc_dmx,
@@ -654,6 +661,7 @@ def test_spar_hoa3_enc_system(
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            compare_to_input=compare_to_input,
        )

@@ -686,6 +694,7 @@ def test_sba_enc_BWforce_system(
    abs_tol,
    get_ssnr,
    get_odg,
    get_odg_bin,
    get_enc_stats,
    compare_to_input,
    compare_enc_dmx,
@@ -812,6 +821,7 @@ def test_sba_enc_BWforce_system(
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            compare_to_input=compare_to_input,
        )

@@ -848,6 +858,7 @@ def test_sba_plc_system(
    abs_tol,
    get_ssnr,
    get_odg,
    get_odg_bin,
    get_enc_stats,
    compare_to_input,
    compare_enc_dmx,
@@ -951,6 +962,7 @@ def test_sba_plc_system(
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            compare_to_input=compare_to_input,
        )

@@ -1126,6 +1138,7 @@ def sba_dec(
    abs_tol=0,
    get_ssnr=False,
    get_odg=False,
    get_odg_bin=False,
    compare_to_input=False,
):
    dut_pkt_dir = f"{dut_base_path}/sba_bs/pkt"
@@ -1198,7 +1211,7 @@ def sba_dec(
        odg_input = None
        odg_test = None
        odg_ref = None
        if get_odg:
        if get_odg_bin:
            enc_opts = ""
            dec_opts = ""
            input_file = f"{test_vector_path}/{tag}.wav"
@@ -1249,6 +1262,7 @@ def sba_dec(
            allow_differing_lengths=allow_differing_lengths,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            get_odg_bin=get_odg_bin,
            odg_input=odg_input,
            odg_test=odg_test,
            odg_ref=odg_ref,
+20 −1
Original line number Diff line number Diff line
@@ -59,10 +59,12 @@ from .constants import (
    SSNR_PATTERN,
    ENC_AUX_FILES,
    ODG_PATTERN,
    DELTA_ODG_PATTERN,
    MLD,
    MAX_ABS_DIFF,
    SSNR,
    ODG,
    DELTA_ODG,
    MAX_ENC_DIFF,
    MAX_ENC_DIFF_PATTERN,
    ENC_CORE_OVL,
@@ -222,6 +224,12 @@ def pytest_addoption(parser):
        help="Get Objective Difference Grade for both conditions during comparison and report difference",
    )

    parser.addoption(
        "--odg_bin",
        action="store_true",
        help="Get Objective Difference Grade for both conditions during comparison and report Delta ODG for binauralized signals",
    )

    parser.addoption(
        "--create_ref",
        action="store_true",
@@ -350,6 +358,13 @@ def get_odg(request):
    """
    return request.config.option.odg

@pytest.fixture(scope="session", autouse=True)
def get_odg_bin(request):
    """
    Return indication to compute Delta PEAQ ODG during ref/dut comparison. Uses binauralization of input and output signals.
    """
    return request.config.option.odg_bin


@pytest.fixture(scope="session")
def abs_tol(request) -> int:
@@ -1110,7 +1125,7 @@ def pytest_configure(config):

@pytest.fixture(scope="session")
def props_to_record(
    request, get_mld, get_ssnr, get_odg, get_enc_stats, encoder_only
    request, get_mld, get_ssnr, get_odg, get_odg_bin, get_enc_stats, encoder_only
) -> str:
    props = []

@@ -1170,6 +1185,10 @@ def parse_properties(text_to_parse: str, output_differs: bool, props_to_record:
                max_enc_diff_param_name, _, max_enc_diff_ratio = search_result.groups(0)
            props[MAX_ENC_DIFF] = float(max_enc_diff_ratio)
            props[MAX_ENC_DIFF_PARAM_NAME] = max_enc_diff_param_name
        elif prop == DELTA_ODG:
            delta_odg = re.search(DELTA_ODG_PATTERN, text_to_parse)
            if delta_odg:
                props["DELTA_ODG"] = delta_odg.groups(0)
    return props


+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ MLD = "MLD"
MAX_ABS_DIFF = "MAXIMUM ABS DIFF"
SSNR = "SSNR"
ODG = "ODG"
DELTA_ODG = "Delta-ODG"
MAX_ENC_DIFF = "MAXIMUM ENC DIFF"
MAX_ENC_DIFF_PARAM_NAME = "MAXIMUM ENC DIFF PARAM"
ENC_CORE_OVL = "ENC_CORE_OVL"
@@ -25,6 +26,7 @@ MLD_PATTERN = r"MLD: ([\d\.]*)"
MAX_DIFF_PATTERN = r"MAXIMUM ABS DIFF: (\d*)"
ODG_PATTERN_PQEVALAUDIO = r"Objective Difference Grade: (-*\d*\.\d*)"
ODG_PATTERN = r"ODG: (-*\d*\.\d*)"
DELTA_ODG_PATTERN = r"Delta-ODG: (-*\d*\.\d*)"
SSNR_PATTERN = r"Channel \d* SSNR: (nan|[+-]*inf|[-*\d\.]*)"
MAX_ENC_DIFF_PATTERN = r"MAXIMUM ENC DIFF: ([^ ]*) (\d+) \((\d+\.\d+)%\)"
ENC_CORE_OVL_PATTERN = r"Core input overload detected: (\d+)"
Loading