Commit 23eebe18 authored by Jan Kiene's avatar Jan Kiene
Browse files

use reference output as uncodec input for PEAQ

parent 11ac0cdf
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../scripts"))
import numpy as np
import pyaudio3dtools
import pyivastest
from .constants import ODG_PATTERN
from .constants import ODG_PATTERN_PQEVALAUDIO


def cmp_pcm(
@@ -29,7 +29,6 @@ def cmp_pcm(
    abs_tol=0,
    get_ssnr=False,
    get_odg=False,
    orig_file: Optional[Path]=None
) -> (int, str):
    """
    Compare 2 PCM files for bitexactness
@@ -116,18 +115,12 @@ def cmp_pcm(
            print(msg)

    if get_odg:
        orig_sig, _ = pyaudio3dtools.audiofile.readfile(orig_file)
        for n in range(nchannels):
            pqeval_output_ref = pqevalaudio_wrapper(s1[:, n], orig_sig[:, n], fs)
            pqeval_output_cmp = pqevalaudio_wrapper(s2[:, n], orig_sig[:, n], fs)
            pqeval_output = pqevalaudio_wrapper(s1[:, n], s2[:, n], fs)

            match_ref = re.search(ODG_PATTERN, pqeval_output_ref)
            match_cmp = re.search(ODG_PATTERN, pqeval_output_cmp)

            odg_ref = float(match_ref.groups()[0])
            odg_cmp = float(match_cmp.groups()[0])
            odg_diff = odg_cmp - odg_ref
            msg = f"Channel {n} ODG diff: {odg_diff}"
            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)

+0 −1
Original line number Diff line number Diff line
@@ -352,7 +352,6 @@ def test_param_file_tests(
            allow_differing_lengths=allow_differing_lengths,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
            orig_file=Path(reference_path).joinpath(testv_file)
        )
        md_out_files = get_expected_md_files(ref_output_file, enc_split, output_config)

+4 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ def test_sba_plc_system(
    get_mld_lim,
    abs_tol,
    get_ssnr,
    get_odg
):
    SID = 0
    if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]:
@@ -135,6 +136,7 @@ def test_sba_plc_system(
        get_mld_lim=get_mld_lim,
        abs_tol=abs_tol,
        get_ssnr=get_ssnr,
        get_odg=get_odg,
    )


@@ -161,6 +163,7 @@ def sba_dec_plc(
    get_mld_lim=0,
    abs_tol=0,
    get_ssnr=False,
    get_odg=False,
):
    # ------------  run cmd  ------------

@@ -219,6 +222,7 @@ def sba_dec_plc(
            mld_lim=get_mld_lim,
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
        )

        props = parse_properties(reason, cmp_result!=0, props_to_record)
+12 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ def test_pca_enc(
    decoder_only,
    abs_tol,
    get_ssnr,
    get_odg,
):
    pca = True
    tag = tag + fs + "c"
@@ -165,6 +166,7 @@ def test_pca_enc(
        pca=pca,
        abs_tol=abs_tol,
        get_ssnr=get_ssnr,
        get_odg=get_odg,
    )


@@ -199,6 +201,7 @@ def test_sba_enc_system(
    decoder_only,
    abs_tol,
    get_ssnr,
    get_odg,
):
    if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]:
        # skip high bitrates for DTX until DTX issue is resolved
@@ -276,6 +279,7 @@ def test_sba_enc_system(
        get_mld_lim=get_mld_lim,
        abs_tol=abs_tol,
        get_ssnr=get_ssnr,
        get_odg=get_odg,
    )


@@ -301,6 +305,7 @@ def test_spar_hoa2_enc_system(
    decoder_only,
    abs_tol,
    get_ssnr,
    get_odg,
):
    fs = "48"
    dtx = "0"
@@ -355,6 +360,7 @@ def test_spar_hoa2_enc_system(
        get_mld_lim=get_mld_lim,
        abs_tol=abs_tol,
        get_ssnr=get_ssnr,
        get_odg=get_odg,
    )


@@ -380,6 +386,7 @@ def test_spar_hoa3_enc_system(
    decoder_only,
    abs_tol,
    get_ssnr,
    get_odg,
):
    fs = "48"
    dtx = "0"
@@ -434,6 +441,7 @@ def test_spar_hoa3_enc_system(
        get_mld_lim=get_mld_lim,
        abs_tol=abs_tol,
        get_ssnr=get_ssnr,
        get_odg=get_odg,
    )


@@ -463,6 +471,7 @@ def test_sba_enc_BWforce_system(
    decoder_only,
    abs_tol,
    get_ssnr,
    get_odg,
):
    if dtx == "1" and ivas_br not in ["32000", "64000"]:
        # skip high bitrates for DTX until DTX issue is resolved
@@ -523,6 +532,7 @@ def test_sba_enc_BWforce_system(
        get_mld_lim=get_mld_lim,
        abs_tol=abs_tol,
        get_ssnr=get_ssnr,
        get_odg=get_odg,
    )


@@ -686,6 +696,7 @@ def sba_dec(
    pca=False,
    abs_tol=0,
    get_ssnr=False,
    get_odg=False,
):
    # --------  run cmd  ------------
    # sampling rate to BW mapping
@@ -751,6 +762,7 @@ def sba_dec(
            mld_lim=get_mld_lim,
            abs_tol=abs_tol,
            get_ssnr=get_ssnr,
            get_odg=get_odg,
        )

        props = parse_properties(reason, cmp_result!=0, props_to_record)
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import textwrap
from pathlib import Path
from subprocess import TimeoutExpired, run
from typing import Optional, Union
from .constants import MLD_PATTERN, MAX_DIFF_PATTERN, SSNR_PATTERN, ODG_DIFF_PATTERN
from .constants import MLD_PATTERN, MAX_DIFF_PATTERN, SSNR_PATTERN, ODG_PATTERN

logger = logging.getLogger(__name__)
USE_LOGGER_FOR_DBG = False  # current tests do not make use of the logger feature
@@ -862,7 +862,7 @@ def parse_properties(text_to_parse: str, output_differs: bool, props_to_record:
            props["MIN_SSNR"] = min_ssnr
            props["MIN_SSNR_CHANNEL"] = min_ssnr_channel
        elif prop == "ODG":
            odg_diffs = re.findall(ODG_DIFF_PATTERN, text_to_parse)
            odg_diffs = re.findall(ODG_PATTERN, text_to_parse)
            max_odg_diff = max(odg_diffs)
            max_odg_diff_channel = odg_diffs.index(max_odg_diff)
            props[
Loading