Commit 167aafc1 authored by sagnowski's avatar sagnowski
Browse files

Add tests for 5ms renderer framing

The feature is not implemented yet so they will fail
parent 8d73b36a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ HR_TRAJECTORIES_TO_TEST = [
    "rotate_yaw_pitch_roll1",
]

""" 5ms framing """
FRAMING_5MS_TO_TEST = [True, False]

""" Per-testcase xfail SNR thresholds (dB) """
pass_snr = dict()  # not relevant for tests anymore, should be deprecated soon
_pass_snr = {
+45 −23
Original line number Diff line number Diff line
@@ -35,24 +35,28 @@ from .utils import *

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
def test_ambisonics(test_info, in_fmt, out_fmt):
    run_renderer(in_fmt, out_fmt)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ambisonics(test_info, in_fmt, out_fmt, framing_5ms):
    run_renderer(in_fmt, out_fmt, framing_5ms=framing_5ms)


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt):
    run_renderer(in_fmt, out_fmt)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
    run_renderer(in_fmt, out_fmt, framing_5ms=framing_5ms)


@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
    run_renderer(
        in_fmt,
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        framing_5ms=framing_5ms,
    )


@@ -250,23 +254,26 @@ def test_ambisonics_binaural_headrotation_refveclev_vs_refvec(

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC)
def test_multichannel(test_info, in_fmt, out_fmt):
    run_renderer(in_fmt, out_fmt)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_multichannel(test_info, in_fmt, out_fmt, framing_5ms):
    run_renderer(in_fmt, out_fmt, framing_5ms=framing_5ms)


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC)
def test_multichannel_binaural_static(test_info, in_fmt, out_fmt):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_multichannel_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
    if in_fmt in ["MONO", "STEREO"]:
        pytest.skip("MONO or STEREO to Binaural rendering unsupported")

    run_renderer(in_fmt, out_fmt)
    run_renderer(in_fmt, out_fmt, framing_5ms=framing_5ms)


@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC)
def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
    if in_fmt in ["MONO", "STEREO"]:
        pytest.skip("MONO or STEREO to Binaural rendering unsupported")

@@ -275,12 +282,14 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file
            in_fmt,
            out_fmt,
            trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            framing_5ms=framing_5ms,
        )
    else:
        run_renderer(
            in_fmt,
            out_fmt,
            trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            framing_5ms=framing_5ms,
        )


@@ -318,28 +327,31 @@ def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, o

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
def test_ism(test_info, in_fmt, out_fmt):
    run_renderer(in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt])
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism(test_info, in_fmt, out_fmt, framing_5ms):
    run_renderer(in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt], framing_5ms=framing_5ms)


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
def test_ism_binaural_static(test_info, in_fmt, out_fmt):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
    try:
        in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
    except:
        in_meta_files = None

    if out_fmt == "BINAURAL":
        run_renderer(in_fmt, out_fmt, in_meta_files=in_meta_files)
        run_renderer(in_fmt, out_fmt, in_meta_files=in_meta_files, framing_5ms=framing_5ms)
    else:
        run_renderer(in_fmt, out_fmt, in_meta_files=in_meta_files)
        run_renderer(in_fmt, out_fmt, in_meta_files=in_meta_files, framing_5ms=framing_5ms)


@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
    try:
        in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
    except:
@@ -351,6 +363,7 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file):
            out_fmt,
            trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            in_meta_files=in_meta_files,
            framing_5ms=framing_5ms,
        )
    else:
        run_renderer(
@@ -358,6 +371,7 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file):
            out_fmt,
            trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            in_meta_files=in_meta_files,
            framing_5ms=framing_5ms,
        )


@@ -399,8 +413,9 @@ def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt):

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA)
def test_masa(test_info, in_fmt, out_fmt):
    run_renderer(in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt])
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_masa(test_info, in_fmt, out_fmt, framing_5ms):
    run_renderer(in_fmt, out_fmt, in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt], framing_5ms=framing_5ms)


""" Custom loudspeaker layouts """
@@ -408,8 +423,9 @@ def test_masa(test_info, in_fmt, out_fmt):

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:])
@pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST)
def test_custom_ls_input(test_info, in_layout, out_fmt):
    run_renderer(CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input(test_info, in_layout, out_fmt, framing_5ms):
    run_renderer(CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"), out_fmt, framing_5ms=framing_5ms)


@pytest.mark.parametrize("out_fmt", CUSTOM_LS_TO_TEST)
@@ -432,21 +448,25 @@ def test_custom_ls_input_output(test_info, in_fmt, out_fmt):

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST)
def test_custom_ls_input_binaural(test_info, in_layout, out_fmt):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, framing_5ms):
    run_renderer(
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,
        framing_5ms=framing_5ms,
    )


@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST)
def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, trj_file):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, trj_file, framing_5ms):
    run_renderer(
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        framing_5ms=framing_5ms,
    )


@@ -455,11 +475,13 @@ def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, tr

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS[2:])
@pytest.mark.parametrize("in_fmt", METADATA_SCENES_TO_TEST)
def test_metadata(test_info, in_fmt, out_fmt):
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_metadata(test_info, in_fmt, out_fmt, framing_5ms):
    run_renderer(
        "META",
        out_fmt,
        metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"),
        framing_5ms=framing_5ms,
    )


+4 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ def run_renderer(
    output_path_base: str = OUTPUT_PATH_CUT,
    binary_suffix: str = "",
    is_comparetest: Optional[bool] = False,
    framing_5ms: Optional[bool] = False,
) -> Tuple[np.ndarray, int]:
    """CuT creation with standalone renderer"""
    if trj_file is not None:
@@ -200,6 +201,9 @@ def run_renderer(
    if config_file is not None:
        cmd.extend(["-rc", str(config_file)])

    if framing_5ms:
        cmd.extend(["-fr5"])

    run_cmd(cmd)

    return pyaudio3dtools.audiofile.readfile(out_file)