Commit df1b90d0 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '756-add-rendering-tests-with-5ms-path' into 'main'

Resolve "Add rendering tests with 5ms path"

See merge request !1237
parents fe26d687 8711aa12
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2875,7 +2875,7 @@ static void parseOption(
            assert( numOptionValues == 1 );
            if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) )
            {
                fprintf( stderr, "Unknown or invalid option for LFE position: %s\n", optionValues[0] );
                fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] );
                exit( -1 );
            }

+2 −2
Original line number Diff line number Diff line
@@ -227,5 +227,5 @@ HR_TRAJECTORIES_TO_TEST = [
    # "rotate_yaw_pitch_roll1",
]

""" 5ms framing """
FRAMING_5MS_TO_TEST = ["20ms"]
""" Frame Size """
FRAMING_TO_TEST = ["5ms", "20ms"]
+66 −66
Original line number Diff line number Diff line
@@ -45,41 +45,41 @@ from .utils import *

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ambisonics(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_ambisonics(test_info, in_fmt, out_fmt, frame_size):
    run_renderer(
        test_info,
        in_fmt,
        out_fmt,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


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


@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)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_ambisonics_binaural_headrotation(
    test_info, in_fmt, out_fmt, trj_file, framing_5ms
    test_info, in_fmt, out_fmt, trj_file, frame_size
):
    run_renderer(
        test_info,
        in_fmt,
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@@ -88,20 +88,20 @@ def test_ambisonics_binaural_headrotation(

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_multichannel(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_multichannel(test_info, in_fmt, out_fmt, frame_size):
    run_renderer(
        test_info,
        in_fmt,
        out_fmt,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


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

@@ -109,16 +109,16 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
        test_info,
        in_fmt,
        out_fmt,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@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)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_multichannel_binaural_headrotation(
    test_info, in_fmt, out_fmt, trj_file, framing_5ms
    test_info, in_fmt, out_fmt, trj_file, frame_size
):
    if in_fmt in ["MONO", "STEREO"]:
        pytest.skip("MONO or STEREO to Binaural rendering unsupported")
@@ -128,7 +128,7 @@ def test_multichannel_binaural_headrotation(
        in_fmt,
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@@ -137,21 +137,21 @@ def test_multichannel_binaural_headrotation(

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


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_ism_binaural_static(test_info, in_fmt, out_fmt, frame_size):
    try:
        in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
    except KeyError:
@@ -162,15 +162,15 @@ def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
        in_fmt,
        out_fmt,
        in_meta_files=in_meta_files,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@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)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, frame_size):
    try:
        in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
    except KeyError:
@@ -182,7 +182,7 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        in_meta_files=in_meta_files,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@@ -191,21 +191,21 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing

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


@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_masa_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_masa_binaural_static(test_info, in_fmt, out_fmt, frame_size):
    if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]:
        pytest.skip("Skipping binaural room outputs for MASA as unimplemented.")

@@ -214,15 +214,15 @@ def test_masa_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
        in_fmt,
        out_fmt,
        in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt],
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, frame_size):
    if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]:
        pytest.skip("Skipping binaural room outputs for MASA as unimplemented.")

@@ -232,7 +232,7 @@ def test_masa_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framin
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        in_meta_files=FORMAT_TO_METADATA_FILES[in_fmt],
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@@ -251,13 +251,13 @@ def test_masa_prerend(test_info, in_fmt):

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS)
@pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input(test_info, in_layout, out_fmt, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_custom_ls_input(test_info, in_layout, out_fmt, frame_size):
    run_renderer(
        test_info,
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@@ -283,29 +283,29 @@ 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)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, framing_5ms):
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, frame_size):
    run_renderer(
        test_info,
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@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)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_custom_ls_input_binaural_headrotation(
    test_info, in_layout, out_fmt, trj_file, framing_5ms
    test_info, in_layout, out_fmt, trj_file, frame_size
):
    run_renderer(
        test_info,
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,
        trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
        framing_5ms=(framing_5ms == "5ms"),
        frame_size=frame_size,
    )


@@ -314,14 +314,14 @@ def test_custom_ls_input_binaural_headrotation(

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


@@ -378,12 +378,12 @@ def test_ambisonics_binaural_headrotation_refrotzero(
        ref_kwargs={
            "name_extension": "refrotzero",
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "refrot_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )

@@ -403,7 +403,7 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt
        out_fmt,
        ref_kwargs={
            "name_extension": "refrotequal",
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath(
@@ -412,7 +412,7 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt
            "refrot_file": HR_TRAJECTORY_DIR.joinpath(
                "azi_plus_2-ele_plus_2-every-25-rows.csv"
            ),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )

@@ -437,12 +437,12 @@ def test_ambisonics_binaural_headrotation_refveczero(
        ref_kwargs={
            "name_extension": "refveczero",
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath("const000-Vector3.csv"),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )

@@ -467,7 +467,7 @@ def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt
            out_fmt,
            ref_kwargs={
                "name_extension": "refvecequal",
                "framing_5ms": "5ms",
                "frame_size": "5",
            },
            cut_kwargs={
                "trj_file": HR_TRAJECTORY_DIR.joinpath(
@@ -476,7 +476,7 @@ def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt
                "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                    "full-circle-with-up-and-down-4s-Vector3.csv"
                ),
                "framing_5ms": "5ms",
                "frame_size": "5",
            },
        )

@@ -504,14 +504,14 @@ def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out
                "trj_file": HR_TRAJECTORY_DIR.joinpath(
                    "full-circle-with-up-and-down-4s.csv"
                ),
                "framing_5ms": "5ms",
                "frame_size": "5",
            },
            cut_kwargs={
                "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
                "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                    "full-circle-with-up-and-down-4s-ccw-Vector3.csv"
                ),
                "framing_5ms": "5ms",
                "frame_size": "5",
            },
        )

@@ -539,14 +539,14 @@ def test_ambisonics_binaural_headrotation_refvec_rotating_fixed_pos_offset(
            "trj_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-ccw.csv"
            ),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv"
            ),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )

@@ -574,12 +574,12 @@ def test_ambisonics_binaural_headrotation_refveclev_vs_refvec(
            "refveclev_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-Vector3.csv"
            ),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-4s-Vector3.csv"),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )

@@ -606,14 +606,14 @@ def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, o
            "trj_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s.csv"
            ),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-ccw-Vector3.csv"
            ),
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )

@@ -643,7 +643,7 @@ def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt):
                "full-circle-with-up-and-down-4s.csv"
            ),
            "in_meta_files": in_meta_files,
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
@@ -651,6 +651,6 @@ def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt):
                "full-circle-with-up-and-down-4s-ccw-Vector3.csv"
            ),
            "in_meta_files": in_meta_files,
            "framing_5ms": "5ms",
            "frame_size": "5",
        },
    )
+5 −5
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ def run_renderer(
    refveclev_file: Optional[str] = None,
    config_file: Optional[str] = None,
    binary_suffix: str = "",
    framing_5ms: Optional[bool] = False,
    frame_size: Optional[str] = "20ms",
) -> str:
    # prepare arguments and filepaths
    if trj_file is not None:
@@ -135,8 +135,8 @@ def run_renderer(
    else:
        config_name = ""

    if framing_5ms:
        framing_name = "_5ms_framing"
    if frame_size:
        framing_name = f"_{frame_size}"
    else:
        framing_name = ""

@@ -203,8 +203,8 @@ def run_renderer(
    if config_file is not None:
        cmd.extend(["-render_config", str(config_file)])

    if framing_5ms:
        cmd.extend(["-fr", "5"])
    if frame_size:
        cmd.extend(["-fr", str(frame_size.replace("ms", ""))])

    # Set env variables for UBSAN
    env = os.environ.copy()