Commit 9a1a4b1c authored by Jan Kiene's avatar Jan Kiene
Browse files

add new parametrization for having XPASS'es fail

parent 7c075640
Loading
Loading
Loading
Loading
Loading
+137 −86
Original line number Diff line number Diff line
@@ -30,10 +30,11 @@
   the United Nations Convention on Contracts on the International Sales of Goods.
"""
import pytest
import itertools

from tests.hrtf_binary_loading.utils import *

from .constants import HRTF_FILES
from .constants import HRTF_FILES, HRTF_BINARY_FILE_DIFF_FROM_ROM

""" Binary file """

@@ -47,17 +48,18 @@ def test_binary_file(test_info, hrtf_file, out_fs):
""" Multichannel """


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[:-1])
@pytest.mark.parametrize("out_fs", SAMPLE_RATE)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("out_fmt", "out_fs", "in_fmt", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            OUTPUT_FORMATS_BINAURAL[:-1], SAMPLE_RATE, INPUT_FORMATS_MC, HRTF_FILES
        )
    ],
)
def test_multichannel_binaural_static(test_info, in_fmt, out_fmt, out_fs, hrtf_file):
    # if in_fmt in ["MONO", "STEREO"]:
    #    pytest.skip("MONO or STEREO to Binaural rendering unsupported")

    # -mc InputConf : Multi-channel format
    #                 where InputConf specifies the channel configuration (5_1, 7_1, 5_1_2, 5_1_4, 7_1_4)

    bitrate = 512000
    in_fs = 48
    option_list = ["-mc", in_fmt]
@@ -75,20 +77,24 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt, out_fs, hrtf_f
    )


@pytest.mark.parametrize("trj_file", [HR_TRAJECTORIES_TO_TEST[0]])
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[:-1])
@pytest.mark.parametrize("out_fs", SAMPLE_RATE)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("trj_file", "out_fmt", "out_fs", "in_fmt", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            [HR_TRAJECTORIES_TO_TEST[0]],
            OUTPUT_FORMATS_BINAURAL[:-1],
            SAMPLE_RATE,
            INPUT_FORMATS_MC,
            HRTF_FILES,
        )
    ],
)
def test_multichannel_binaural_headrotation(
    test_info, in_fmt, out_fmt, out_fs, trj_file, hrtf_file
):
    # if in_fmt in ["MONO", "STEREO"]:
    #    pytest.skip("MONO or STEREO to Binaural rendering unsupported")

    # -mc InputConf : Multi-channel format
    #                 where InputConf specifies the channel configuration (5_1, 7_1, 5_1_2, 5_1_4, 7_1_4)

    bitrate = 512000
    in_fs = 48
    option_list = ["-mc", in_fmt]
@@ -110,14 +116,18 @@ def test_multichannel_binaural_headrotation(
""" Ambisonics """


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[:-1])
@pytest.mark.parametrize("fs", SAMPLE_RATE[1:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_SBA)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_fmt", "fs", "out_fmt", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_SBA, SAMPLE_RATE[1:], OUTPUT_FORMATS_BINAURAL[:-1], HRTF_FILES
        )
    ],
)
def test_sba_binaural_static(test_info, in_fmt, fs, out_fmt, hrtf_file):
    # -sba +/-Order : Scene Based Audio input format (Ambisonics ACN/SN3D)
    #                 where Order specifies the Ambisionics order (1-3)

    bitrate = 256000
    option_list = ["-sba", in_fmt]
    in_file = FORMAT_TO_FILE_SBA_WOEXT[in_fmt].format(fs)
@@ -134,15 +144,22 @@ def test_sba_binaural_static(test_info, in_fmt, fs, out_fmt, hrtf_file):
    )


@pytest.mark.parametrize("trj_file", [HR_TRAJECTORIES_TO_TEST[0]])
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[:-1])
@pytest.mark.parametrize("fs", SAMPLE_RATE[1:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_SBA)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_fmt", "fs", "out_fmt", "trj_file", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_SBA,
            SAMPLE_RATE[1:],
            OUTPUT_FORMATS_BINAURAL[:-1],
            [HR_TRAJECTORIES_TO_TEST[0]],
            HRTF_FILES,
        )
    ],
)
def test_sba_binaural_headrotation(test_info, in_fmt, fs, out_fmt, trj_file, hrtf_file):
    # -sba +/-Order : Scene Based Audio input format (Ambisonics ACN/SN3D)
    #                 where Order specifies the Ambisionics order (1-3)

    bitrate = 256000
    option_list = ["-sba", in_fmt]
    in_file = FORMAT_TO_FILE_SBA_WOEXT[in_fmt].format(fs)
@@ -163,16 +180,22 @@ def test_sba_binaural_headrotation(test_info, in_fmt, fs, out_fmt, trj_file, hrt
""" MASA """


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[:-1])
@pytest.mark.parametrize("fs", SAMPLE_RATE[-1:])
@pytest.mark.parametrize("in_dir", INPUT_FORMATS_MASA["dir"])
@pytest.mark.parametrize("in_tc", INPUT_FORMATS_MASA["tc"])
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("out_fmt", "fs", "in_dir", "in_tc", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            OUTPUT_FORMATS_BINAURAL[:-1],
            SAMPLE_RATE[-1:],
            INPUT_FORMATS_MASA["dir"],
            INPUT_FORMATS_MASA["tc"],
            HRTF_FILES,
        )
    ],
)
def test_masa_binaural_static(test_info, in_tc, in_dir, fs, out_fmt, hrtf_file):
    # -masa Ch File : MASA format
    #                 where Ch specifies the number of MASA input/transport channels (1 or 2)
    #                 and File specifies input file containing parametric MASA metadata

    bitrate = 256000
    metadata_file = str(
        TESTV_DIR.joinpath(FORMAT_TO_METADATA_FILES["MASA"].format(in_dir, in_tc, fs))
@@ -192,19 +215,25 @@ def test_masa_binaural_static(test_info, in_tc, in_dir, fs, out_fmt, hrtf_file):
    )


@pytest.mark.parametrize("trj_file", [HR_TRAJECTORIES_TO_TEST[1]])
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[:-1])
@pytest.mark.parametrize("fs", SAMPLE_RATE[-1:])
@pytest.mark.parametrize("in_dir", INPUT_FORMATS_MASA["dir"])
@pytest.mark.parametrize("in_tc", INPUT_FORMATS_MASA["tc"])
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_tc", "in_dir", "out_fmt", "fs", "trj_file", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_MASA["tc"],
            INPUT_FORMATS_MASA["dir"],
            OUTPUT_FORMATS_BINAURAL[:-1],
            SAMPLE_RATE[-1:],
            [HR_TRAJECTORIES_TO_TEST[1]],
            HRTF_FILES,
        )
    ],
)
def test_masa_binaural_headrotation(
    test_info, in_tc, in_dir, fs, out_fmt, trj_file, hrtf_file
):
    # -masa Ch File : MASA format
    #                 where Ch specifies the number of MASA input/transport channels (1 or 2)
    #                 and File specifies input file containing parametric MASA metadata

    bitrate = 256000
    metadata_file = str(
        TESTV_DIR.joinpath(FORMAT_TO_METADATA_FILES["MASA"].format(in_dir, in_tc, fs))
@@ -228,15 +257,18 @@ def test_masa_binaural_headrotation(
""" ISM """


@pytest.mark.parametrize("out_fmt", [OUTPUT_FORMATS_BINAURAL[0]])
@pytest.mark.parametrize("out_fs", SAMPLE_RATE)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_fmt", "out_fs", "out_fmt", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_ISM, SAMPLE_RATE, [OUTPUT_FORMATS_BINAURAL[0]], HRTF_FILES
        )
    ],
)
def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_file):
    # -ism [+]Ch Files : ISM format
    #                    where Ch specifies the number of ISMs (1-4)
    #                    and Files specify input files containing metadata, one file per object

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
@@ -261,18 +293,24 @@ def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_file):
    )


@pytest.mark.parametrize("trj_file", [HR_TRAJECTORIES_TO_TEST[0]])
@pytest.mark.parametrize("out_fmt", [OUTPUT_FORMATS_BINAURAL[0]])
@pytest.mark.parametrize("out_fs", SAMPLE_RATE)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_fmt", "out_fs", "out_fmt", "trj_file", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_ISM,
            SAMPLE_RATE,
            [OUTPUT_FORMATS_BINAURAL[0]],
            [HR_TRAJECTORIES_TO_TEST[0]],
            HRTF_FILES,
        )
    ],
)
def test_ism_binaural_headrotation(
    test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_file
):
    # -ism [+]Ch Files : ISM format
    #                    where Ch specifies the number of ISMs (1-4)
    #                    and Files specify input files containing metadata, one file per object

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
@@ -301,15 +339,18 @@ def test_ism_binaural_headrotation(
""" ISM - Room Reverb """


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[-1:])
@pytest.mark.parametrize("out_fs", SAMPLE_RATE)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_fmt", "out_fs", "out_fmt", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_ISM, SAMPLE_RATE, OUTPUT_FORMATS_BINAURAL[-1:], HRTF_FILES
        )
    ],
)
def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf_file):
    # -ism [+]Ch Files : ISM format
    #                    where Ch specifies the number of ISMs (1-4)
    #                    and Files specify input files containing metadata, one file per object

    in_fs = 48
    bitrate = BITRATE_ISM[in_fmt]
    option_list = ["-ism", in_fmt]
@@ -334,11 +375,21 @@ def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf
    )


@pytest.mark.parametrize("trj_file", [HR_TRAJECTORIES_TO_TEST[0]])
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[-1:])
@pytest.mark.parametrize("out_fs", SAMPLE_RATE)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("hrtf_file", HRTF_FILES)
@pytest.mark.parametrize(
    ("in_fmt", "out_fs", "out_fmt", "trj_file", "hrtf_file"),
    [
        pytest.param(*x, marks=pytest.mark.xfail(strict=True))
        if x[-1] == HRTF_BINARY_FILE_DIFF_FROM_ROM
        else x
        for x in itertools.product(
            INPUT_FORMATS_ISM,
            SAMPLE_RATE,
            OUTPUT_FORMATS_BINAURAL[-1:],
            [HR_TRAJECTORIES_TO_TEST[0]],
            HRTF_FILES,
        )
    ],
)
def test_ism_binaural_roomreverb_headrotation(
    test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_file
):