Commit 30c08b58 authored by Jan Kiene's avatar Jan Kiene
Browse files

skip ISM paramBin cases and remove tolerance from comparison

parent b76f7894
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -34,7 +34,12 @@ import itertools

from tests.hrtf_binary_loading.utils import *

from .constants import HRTF_TAGS, MC_BITRATE_FOR_FORMAT, HRTF_TAG_DIFF_FROM_ROM
from .constants import (
    HRTF_TAGS,
    MC_BITRATE_FOR_FORMAT,
    HRTF_TAG_DIFF_FROM_ROM,
    HRTF_TAG_SAME_AS_ROM,
)

""" Binary file """

@@ -237,6 +242,9 @@ def test_masa_binaural_headrotation(
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("hrtf_tag", HRTF_TAGS)
def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag):
    if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM:
        pytest.skip("Skipping ParamBin until binary and ROM contain same data")

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
@@ -269,6 +277,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag):
def test_ism_binaural_headrotation(
    test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_tag
):
    if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM:
        pytest.skip("Skipping ParamBin until binary and ROM contain same data")

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
@@ -302,6 +313,9 @@ def test_ism_binaural_headrotation(
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("hrtf_tag", HRTF_TAGS)
def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag):
    if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM:
        pytest.skip("Skipping ParamBin until binary and ROM contain same data")

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
@@ -334,6 +348,9 @@ def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf
def test_ism_binaural_roomreverb_headrotation(
    test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_tag
):
    if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM:
        pytest.skip("Skipping ParamBin until binary and ROM contain same data")

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,9 @@ def test_multichannel_binaural_headrotation_with_binary_hrir(
def test_ism_binaural_static_with_binary_hrir(
    test_info, in_fmt, out_fmt, frame_size, hrtf_tag
):
    if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM:
        pytest.skip("Skipping ParamBin until binary and ROM contain same data")

    try:
        in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt]
    except:
@@ -150,6 +153,9 @@ def test_ism_binaural_static_with_binary_hrir(
def test_ism_binaural_headrotation_with_binary_hrir(
    test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_tag
):
    if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM:
        pytest.skip("Skipping ParamBin until binary and ROM contain same data")

    try:
        in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt]
    except:
+2 −2
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ def compare_rom_vs_binary(
    )
    out_bin, out_bin_fs = pyaudio3dtools.audiofile.readfile(out_bin_path)

    check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail)
    check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail, 0)
    if keep_file == False:
        os.remove(bitstream_path)
        os.remove(out_rom_path)
@@ -393,7 +393,7 @@ def compare_renderer_vs_renderer_with_binary_hrir(
    ref, ref_fs = pyaudio3dtools.audiofile.readfile(ref_out)
    cut, cut_fs = pyaudio3dtools.audiofile.readfile(cut_out)

    check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail)
    check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail, 0)
    if keep_file == False:
        os.remove(ref_out)
        os.remove(cut_out)
+2 −1
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ def check_BE(
    cut: np.ndarray,
    cut_fs: int,
    xfail: bool = False,
    atol: int = 2
):
    if ref is None or np.array_equal(ref, np.zeros_like(ref)):
        pytest.fail("REF signal does not exist or is zero!")
@@ -89,7 +90,7 @@ def check_BE(
        cut = np.pad(cut, [(0, ref.shape[0] - cut.shape[0]), (0, 0)])

    # check max_diff as well, since compare_audio_arrays will try to adjust for small delay differences
    diff_found = not np.allclose(ref, cut, rtol=0, atol=2) and max_diff > 2
    diff_found = not np.allclose(ref, cut, rtol=0, atol=atol)
    if diff_found and not xfail:
        pytest.fail(
            f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}"