diff --git a/tests/renderer_short/constants.py b/tests/renderer_short/constants.py index 766e64722b80132b963c007880ac732222855dfc..54434e865ff9d652c530763daf17c5315eae23c3 100644 --- a/tests/renderer_short/constants.py +++ b/tests/renderer_short/constants.py @@ -30,8 +30,8 @@ accordance with the laws of the Federal Republic of Germany excluding its confli the United Nations Convention on Contracts on the International Sales of Goods. """ -from pathlib import Path import platform +from pathlib import Path """ Set up paths """ TESTS_DIR = Path(__file__).parent @@ -55,6 +55,8 @@ elif platform.system() in ["Linux", "Darwin"]: else: assert False, f"Unsupported platform {platform.system()}" +SAMPLING_RATES = ["48kHz", "32kHz", "16kHz"] + """ Renderer commandline template """ RENDERER_CMD = [ str(TESTS_DIR.parent.parent.joinpath("IVAS_rend")), @@ -115,29 +117,28 @@ FORMAT_TO_FILE_SMOKETEST = { "NDP_ISM4": NCHAN_TO_FILE[4], "MASA1": NCHAN_TO_FILE[1], "MASA2": NCHAN_TO_FILE[2], - "OMASA_1_1": NCHAN_TO_FILE[2], - "OMASA_1_2": NCHAN_TO_FILE[3], - "OMASA_1_3": NCHAN_TO_FILE[4], - "OMASA_1_4": NCHAN_TO_FILE[5], - "OMASA_2_1": NCHAN_TO_FILE[3], - "OMASA_2_2": NCHAN_TO_FILE[4], - "OMASA_2_3": NCHAN_TO_FILE[5], - "OMASA_2_4": NCHAN_TO_FILE[6], - "OSBA_1_1": NCHAN_TO_FILE[5], - "OSBA_2_1": NCHAN_TO_FILE[6], - "OSBA_3_1": NCHAN_TO_FILE[7], - "OSBA_4_1": NCHAN_TO_FILE[8], - "OSBA_1_2": NCHAN_TO_FILE[10], - "OSBA_2_2": NCHAN_TO_FILE[11], - "OSBA_3_2": NCHAN_TO_FILE[12], - "OSBA_4_2": NCHAN_TO_FILE[13], - "OSBA_1_3": NCHAN_TO_FILE[17], - "OSBA_2_3": NCHAN_TO_FILE[18], - "OSBA_3_3": NCHAN_TO_FILE[19], - "OSBA_4_3": NCHAN_TO_FILE[20], - "META": TEST_VECTOR_DIR.joinpath("mixed_scene.txt"), + "ISM1MASA1": NCHAN_TO_FILE[2], + "ISM2MASA1": NCHAN_TO_FILE[3], + "ISM3MASA1": NCHAN_TO_FILE[4], + "ISM4MASA1": NCHAN_TO_FILE[5], + "ISM1MASA2": NCHAN_TO_FILE[3], + "ISM2MASA2": NCHAN_TO_FILE[4], + "ISM3MASA2": NCHAN_TO_FILE[5], + "ISM4MASA2": NCHAN_TO_FILE[6], + "ISM1SBA1": NCHAN_TO_FILE[5], + "ISM2SBA1": NCHAN_TO_FILE[6], + "ISM3SBA1": NCHAN_TO_FILE[7], + "ISM4SBA1": NCHAN_TO_FILE[8], + "ISM1SBA2": NCHAN_TO_FILE[10], + "ISM2SBA2": NCHAN_TO_FILE[11], + "ISM3SBA2": NCHAN_TO_FILE[12], + "ISM4SBA2": NCHAN_TO_FILE[13], + "ISM1SBA3": NCHAN_TO_FILE[17], + "ISM2SBA3": NCHAN_TO_FILE[18], + "ISM3SBA3": NCHAN_TO_FILE[19], + "ISM4SBA3": NCHAN_TO_FILE[20], + "META": TEST_VECTOR_DIR.joinpath("mixed_scene_48.txt"), "16ch_8+4+4": NCHAN_TO_FILE[16], - "4d4": NCHAN_TO_FILE[8], "t_design_4": NCHAN_TO_FILE[12], } @@ -158,29 +159,28 @@ FORMAT_TO_FILE_COMPARETEST = { "ISM4": TESTV_DIR.joinpath("stv4ISM48s.wav"), "MASA1": TESTV_DIR.joinpath("stv1MASA1TC48c.wav"), "MASA2": TESTV_DIR.joinpath("stv2MASA2TC48c.wav"), - "OMASA_1_1": TESTV_DIR.joinpath("stvOMASA_1ISM_1MASA1TC48c.wav"), - "OMASA_1_2": TESTV_DIR.joinpath("stvOMASA_2ISM_2MASA1TC48c.wav"), - "OMASA_1_3": TESTV_DIR.joinpath("stvOMASA_3ISM_1MASA1TC48c.wav"), - "OMASA_1_4": TESTV_DIR.joinpath("stvOMASA_4ISM_2MASA1TC48c.wav"), - "OMASA_2_1": TESTV_DIR.joinpath("stvOMASA_1ISM_1MASA2TC48c.wav"), - "OMASA_2_2": TESTV_DIR.joinpath("stvOMASA_2ISM_2MASA2TC48c.wav"), - "OMASA_2_3": TESTV_DIR.joinpath("stvOMASA_3ISM_1MASA2TC48c.wav"), - "OMASA_2_4": TESTV_DIR.joinpath("stvOMASA_4ISM_2MASA2TC48c.wav"), - "OSBA_1_1": TESTV_DIR.joinpath("stvOSBA_1ISM_FOA48c.wav"), - "OSBA_1_2": TESTV_DIR.joinpath("stvOSBA_1ISM_2OA48c.wav"), - "OSBA_1_3": TESTV_DIR.joinpath("stvOSBA_1ISM_3OA48c.wav"), - "OSBA_2_1": TESTV_DIR.joinpath("stvOSBA_2ISM_FOA48c.wav"), - "OSBA_2_2": TESTV_DIR.joinpath("stvOSBA_2ISM_2OA48c.wav"), - "OSBA_2_3": TESTV_DIR.joinpath("stvOSBA_2ISM_3OA48c.wav"), - "OSBA_3_1": TESTV_DIR.joinpath("stvOSBA_3ISM_FOA48c.wav"), - "OSBA_3_2": TESTV_DIR.joinpath("stvOSBA_3ISM_2OA48c.wav"), - "OSBA_3_3": TESTV_DIR.joinpath("stvOSBA_3ISM_3OA48c.wav"), - "OSBA_4_1": TESTV_DIR.joinpath("stvOSBA_4ISM_FOA48c.wav"), - "OSBA_4_2": TESTV_DIR.joinpath("stvOSBA_4ISM_2OA48c.wav"), - "OSBA_4_3": TESTV_DIR.joinpath("stvOSBA_4ISM_3OA48c.wav"), - "META": TEST_VECTOR_DIR.joinpath("mixed_scene.txt"), + "ISM1MASA1": TESTV_DIR.joinpath("stvOMASA_1ISM_1MASA1TC48c.wav"), + "ISM2MASA1": TESTV_DIR.joinpath("stvOMASA_2ISM_2MASA1TC48c.wav"), + "ISM3MASA1": TESTV_DIR.joinpath("stvOMASA_3ISM_1MASA1TC48c.wav"), + "ISM4MASA1": TESTV_DIR.joinpath("stvOMASA_4ISM_2MASA1TC48c.wav"), + "ISM1MASA2": TESTV_DIR.joinpath("stvOMASA_1ISM_1MASA2TC48c.wav"), + "ISM2MASA2": TESTV_DIR.joinpath("stvOMASA_2ISM_2MASA2TC48c.wav"), + "ISM3MASA2": TESTV_DIR.joinpath("stvOMASA_3ISM_1MASA2TC48c.wav"), + "ISM4MASA2": TESTV_DIR.joinpath("stvOMASA_4ISM_2MASA2TC48c.wav"), + "ISM1SBA1": TESTV_DIR.joinpath("stvOSBA_1ISM_FOA48c.wav"), + "ISM1SBA2": TESTV_DIR.joinpath("stvOSBA_1ISM_2OA48c.wav"), + "ISM1SBA3": TESTV_DIR.joinpath("stvOSBA_1ISM_3OA48c.wav"), + "ISM2SBA1": TESTV_DIR.joinpath("stvOSBA_2ISM_FOA48c.wav"), + "ISM2SBA2": TESTV_DIR.joinpath("stvOSBA_2ISM_2OA48c.wav"), + "ISM2SBA3": TESTV_DIR.joinpath("stvOSBA_2ISM_3OA48c.wav"), + "ISM3SBA1": TESTV_DIR.joinpath("stvOSBA_3ISM_FOA48c.wav"), + "ISM3SBA2": TESTV_DIR.joinpath("stvOSBA_3ISM_2OA48c.wav"), + "ISM3SBA3": TESTV_DIR.joinpath("stvOSBA_3ISM_3OA48c.wav"), + "ISM4SBA1": TESTV_DIR.joinpath("stvOSBA_4ISM_FOA48c.wav"), + "ISM4SBA2": TESTV_DIR.joinpath("stvOSBA_4ISM_2OA48c.wav"), + "ISM4SBA3": TESTV_DIR.joinpath("stvOSBA_4ISM_3OA48c.wav"), + "META": TEST_VECTOR_DIR.joinpath("mixed_scene_48.txt"), "16ch_8+4+4": TESTV_DIR.joinpath("stv3OA48c.wav"), - "4d4": TESTV_DIR.joinpath("stv71MC48c.wav"), "t_design_4": TESTV_DIR.joinpath("stv714MC48c.wav"), } @@ -201,29 +201,28 @@ FORMAT_TO_FILE_LTV = { "ISM4": LTV_DIR.joinpath("ltv48_4ISM.wav"), "MASA1": LTV_DIR.joinpath("ltv48_MASA1TC.wav"), "MASA2": LTV_DIR.joinpath("ltv48_MASA2TC.wav"), - "OMASA_1_1": LTV_DIR.joinpath("ltv48_OMASA_1ISM_1TC.wav"), - "OMASA_1_2": LTV_DIR.joinpath("ltv48_OMASA_2ISM_1TC.wav"), - "OMASA_1_3": LTV_DIR.joinpath("ltv48_OMASA_3ISM_1TC.wav"), - "OMASA_1_4": LTV_DIR.joinpath("ltv48_OMASA_4ISM_1TC.wav"), - "OMASA_2_1": LTV_DIR.joinpath("ltv48_OMASA_1ISM_2TC.wav"), - "OMASA_2_2": LTV_DIR.joinpath("ltv48_OMASA_2ISM_2TC.wav"), - "OMASA_2_3": LTV_DIR.joinpath("ltv48_OMASA_3ISM_2TC.wav"), - "OMASA_2_4": LTV_DIR.joinpath("ltv48_OMASA_4ISM_2TC.wav"), - "OSBA_1_1": LTV_DIR.joinpath("ltv48_OSBA_1ISM_FOA.wav"), - "OSBA_1_2": LTV_DIR.joinpath("ltv48_OSBA_1ISM_HOA2.wav"), - "OSBA_1_3": LTV_DIR.joinpath("ltv48_OSBA_1ISM_HOA3.wav"), - "OSBA_2_1": LTV_DIR.joinpath("ltv48_OSBA_2ISM_FOA.wav"), - "OSBA_2_2": LTV_DIR.joinpath("ltv48_OSBA_2ISM_HOA2.wav"), - "OSBA_2_3": LTV_DIR.joinpath("ltv48_OSBA_2ISM_HOA3.wav"), - "OSBA_3_1": LTV_DIR.joinpath("ltv48_OSBA_3ISM_FOA.wav"), - "OSBA_3_2": LTV_DIR.joinpath("ltv48_OSBA_3ISM_HOA2.wav"), - "OSBA_3_3": LTV_DIR.joinpath("ltv48_OSBA_3ISM_HOA3.wav"), - "OSBA_4_1": LTV_DIR.joinpath("ltv48_OSBA_4ISM_FOA.wav"), - "OSBA_4_2": LTV_DIR.joinpath("ltv48_OSBA_4ISM_HOA2.wav"), - "OSBA_4_3": LTV_DIR.joinpath("ltv48_OSBA_4ISM_HOA3.wav"), - "META": TEST_VECTOR_DIR.joinpath("mixed_scene.txt"), + "ISM1MASA1": LTV_DIR.joinpath("ltv48_OMASA_1ISM_1TC.wav"), + "ISM2MASA1": LTV_DIR.joinpath("ltv48_OMASA_2ISM_1TC.wav"), + "ISM3MASA1": LTV_DIR.joinpath("ltv48_OMASA_3ISM_1TC.wav"), + "ISM4MASA1": LTV_DIR.joinpath("ltv48_OMASA_4ISM_1TC.wav"), + "ISM1MASA2": LTV_DIR.joinpath("ltv48_OMASA_1ISM_2TC.wav"), + "ISM2MASA2": LTV_DIR.joinpath("ltv48_OMASA_2ISM_2TC.wav"), + "ISM3MASA2": LTV_DIR.joinpath("ltv48_OMASA_3ISM_2TC.wav"), + "ISM4MASA2": LTV_DIR.joinpath("ltv48_OMASA_4ISM_2TC.wav"), + "ISM1SBA1": LTV_DIR.joinpath("ltv48_OSBA_1ISM_FOA.wav"), + "ISM1SBA2": LTV_DIR.joinpath("ltv48_OSBA_1ISM_HOA2.wav"), + "ISM1SBA3": LTV_DIR.joinpath("ltv48_OSBA_1ISM_HOA3.wav"), + "ISM2SBA1": LTV_DIR.joinpath("ltv48_OSBA_2ISM_FOA.wav"), + "ISM2SBA2": LTV_DIR.joinpath("ltv48_OSBA_2ISM_HOA2.wav"), + "ISM2SBA3": LTV_DIR.joinpath("ltv48_OSBA_2ISM_HOA3.wav"), + "ISM3SBA1": LTV_DIR.joinpath("ltv48_OSBA_3ISM_FOA.wav"), + "ISM3SBA2": LTV_DIR.joinpath("ltv48_OSBA_3ISM_HOA2.wav"), + "ISM3SBA3": LTV_DIR.joinpath("ltv48_OSBA_3ISM_HOA3.wav"), + "ISM4SBA1": LTV_DIR.joinpath("ltv48_OSBA_4ISM_FOA.wav"), + "ISM4SBA2": LTV_DIR.joinpath("ltv48_OSBA_4ISM_HOA2.wav"), + "ISM4SBA3": LTV_DIR.joinpath("ltv48_OSBA_4ISM_HOA3.wav"), + "META": TEST_VECTOR_DIR.joinpath("mixed_scene_48.txt"), "16ch_8+4+4": LTV_DIR.joinpath("ltv48_HOA3.wav"), - "4d4": LTV_DIR.joinpath("ltv48_MC71.wav"), "t_design_4": LTV_DIR.joinpath("ltv48_MC714.wav"), } @@ -252,44 +251,44 @@ FORMAT_TO_METADATA_FILES = { ], "MASA1": [str(TESTV_DIR.joinpath("stv1MASA1TC48c.met"))], "MASA2": [str(TESTV_DIR.joinpath("stv2MASA2TC48c.met"))], - "OMASA_1_1": [ + "ISM1MASA1": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvOMASA_1ISM_1MASA1TC48c.met")), ], - "OMASA_1_2": [ + "ISM2MASA1": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvISM2.csv")), str(TESTV_DIR.joinpath("stvOMASA_2ISM_2MASA1TC48c.met")), ], - "OMASA_1_3": [ + "ISM3MASA1": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvISM2.csv")), str(TESTV_DIR.joinpath("stvISM3.csv")), str(TESTV_DIR.joinpath("stvOMASA_3ISM_1MASA1TC48c.met")), ], - "OMASA_1_4": [ + "ISM4MASA1": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvISM2.csv")), str(TESTV_DIR.joinpath("stvISM3.csv")), str(TESTV_DIR.joinpath("stvISM4.csv")), str(TESTV_DIR.joinpath("stvOMASA_4ISM_2MASA1TC48c.met")), ], - "OMASA_2_1": [ + "ISM1MASA2": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvOMASA_1ISM_1MASA2TC48c.met")), ], - "OMASA_2_2": [ + "ISM2MASA2": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvISM2.csv")), str(TESTV_DIR.joinpath("stvOMASA_2ISM_2MASA2TC48c.met")), ], - "OMASA_2_3": [ + "ISM3MASA2": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvISM2.csv")), str(TESTV_DIR.joinpath("stvISM3.csv")), str(TESTV_DIR.joinpath("stvOMASA_3ISM_1MASA2TC48c.met")), ], - "OMASA_2_4": [ + "ISM4MASA2": [ str(TESTV_DIR.joinpath("stvISM1.csv")), str(TESTV_DIR.joinpath("stvISM2.csv")), str(TESTV_DIR.joinpath("stvISM3.csv")), @@ -315,7 +314,7 @@ FORMAT_TO_METADATA_FILES_LTV = { str(LTV_DIR.joinpath("ltvISM3.csv")), str(LTV_DIR.joinpath("ltvISM4.csv")), ], - "NDP_ISM4": [ # Should not be needed, because it is included in all ISM metadata files. + "NDP_ISM4": [ # Should not be needed, because it is included in all ISM metadata files. str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltvISM3.csv")), @@ -323,44 +322,44 @@ FORMAT_TO_METADATA_FILES_LTV = { ], "MASA1": [str(LTV_DIR.joinpath("ltv48_MASA1TC.met"))], "MASA2": [str(LTV_DIR.joinpath("ltv48_MASA2TC.met"))], - "OMASA_1_1": [ + "ISM1MASA1": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_1ISM_1TC.met")), ], - "OMASA_1_2": [ + "ISM2MASA1": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_2ISM_1TC.met")), ], - "OMASA_1_3": [ + "ISM3MASA1": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltvISM3.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_3ISM_1TC.met")), ], - "OMASA_1_4": [ + "ISM4MASA1": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltvISM3.csv")), str(LTV_DIR.joinpath("ltvISM4.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_4ISM_1TC.met")), ], - "OMASA_2_1": [ + "ISM1MASA2": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_1ISM_2TC.met")), ], - "OMASA_2_2": [ + "ISM2MASA2": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_2ISM_2TC.met")), ], - "OMASA_2_3": [ + "ISM3MASA2": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltvISM3.csv")), str(LTV_DIR.joinpath("ltv48_OMASA_3ISM_2TC.met")), ], - "OMASA_2_4": [ + "ISM4MASA2": [ str(LTV_DIR.joinpath("ltvISM1.csv")), str(LTV_DIR.joinpath("ltvISM2.csv")), str(LTV_DIR.joinpath("ltvISM3.csv")), @@ -374,6 +373,31 @@ INPUT_FORMATS_AMBI = ["FOA", "HOA2", "HOA3"] INPUT_FORMATS_MC = ["MONO", "STEREO", "5_1", "5_1_2", "5_1_4", "7_1", "7_1_4"] INPUT_FORMATS_ISM = ["ISM1", "ISM2", "ISM3", "ISM4"] INPUT_FORMATS_MASA = ["MASA1", "MASA2"] +INPUT_FORMATS_OMASA = [ + "ISM1MASA1", + "ISM2MASA1", + "ISM3MASA1", + "ISM4MASA1", + "ISM1MASA2", + "ISM2MASA2", + "ISM3MASA2", + "ISM4MASA2", +] +INPUT_FORMATS_OSBA = [ + "ISM1SBA1", + "ISM1SBA2", + "ISM1SBA3", + "ISM2SBA1", + "ISM2SBA2", + "ISM2SBA3", + "ISM3SBA1", + "ISM3SBA2", + "ISM3SBA3", + "ISM4SBA1", + "ISM4SBA2", + "ISM4SBA3", +] + """ Non binaural / parametric output formats """ OUTPUT_FORMATS = [ @@ -392,7 +416,6 @@ OUTPUT_FORMATS = [ """ Custom loudspeaker input/output """ CUSTOM_LS_TO_TEST = [ "t_design_4", - "4d4", "16ch_8+4+4", ] @@ -418,4 +441,3 @@ PEAQ_SUPPORTED_FMT = [ "BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB", ] - diff --git a/tests/renderer_short/test_renderer.py b/tests/renderer_short/test_renderer.py index 8cfda2f6dbbed56e3c31f39b6ffd818408bc7e4d..9a214e38268b0137427149ba5469bbf6f399aaff 100644 --- a/tests/renderer_short/test_renderer.py +++ b/tests/renderer_short/test_renderer.py @@ -33,25 +33,26 @@ the United Nations Convention on Contracts on the International Sales of Goods. import pytest from .constants import ( - FORMAT_TO_METADATA_FILES_LTV, - OUTPUT_FORMATS, - INPUT_FORMATS_AMBI, - FRAMING_TO_TEST, + CUSTOM_LAYOUT_DIR, + CUSTOM_LS_TO_TEST, EXE_SUFFIX, - OUTPUT_FORMATS_BINAURAL, + FRAMING_TO_TEST, HR_TRAJECTORIES_TO_TEST, HR_TRAJECTORY_DIR, - INPUT_FORMATS_MC, + INPUT_FORMATS_AMBI, INPUT_FORMATS_ISM, INPUT_FORMATS_MASA, + INPUT_FORMATS_MC, + INPUT_FORMATS_OMASA, + INPUT_FORMATS_OSBA, + METADATA_SCENES_TO_TEST, METADATA_SCENES_TO_TEST_MASA_PREREND, + OUTPUT_FORMATS, + OUTPUT_FORMATS_BINAURAL, + SAMPLING_RATES, TEST_VECTOR_DIR, - CUSTOM_LS_TO_TEST, - CUSTOM_LAYOUT_DIR, - METADATA_SCENES_TO_TEST, ) -from .utils import run_renderer, compare_renderer_args -from ..conftest import props_to_record +from .utils import compare_renderer_args, run_renderer ############################################################################## # Bit-exactness tests @@ -65,6 +66,7 @@ from ..conftest import props_to_record @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_ambisonics( record_property, props_to_record, @@ -72,6 +74,7 @@ def test_ambisonics( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -79,6 +82,26 @@ def test_ambisonics( get_odg_bin, split_comparison, ): + if in_fmt == "HOA2": + if out_fmt != "5_1": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + if fs != "48kHz": + pytest.skip() + + if in_fmt == "FOA": + if frame_size != "5ms": + pytest.skip() + if fs != "32kHz": + pytest.skip() + + if in_fmt == "HOA3": + if frame_size != "20ms": + pytest.skip() + if fs == "32kHz": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -93,12 +116,14 @@ def test_ambisonics( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_ambisonics_binaural_static( record_property, props_to_record, @@ -106,6 +131,7 @@ def test_ambisonics_binaural_static( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -113,6 +139,15 @@ def test_ambisonics_binaural_static( get_odg_bin, split_comparison, ): + if in_fmt != "HOA2": + pytest.skip() + + if frame_size != "20ms": + pytest.skip() + + if fs != "48kHz": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -127,6 +162,7 @@ def test_ambisonics_binaural_static( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -134,6 +170,7 @@ def test_ambisonics_binaural_static( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_ambisonics_binaural_headrotation( record_property, props_to_record, @@ -142,6 +179,7 @@ def test_ambisonics_binaural_headrotation( out_fmt, trj_file, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -149,6 +187,14 @@ def test_ambisonics_binaural_headrotation( get_odg_bin, split_comparison, ): + if in_fmt == "HOA2": + pytest.skip() + + if in_fmt == "FOA" and frame_size != "20ms" and fs != "48kHz": + pytest.skip() + + # Run everything for HOA3 input + run_renderer( record_property, props_to_record, @@ -164,6 +210,7 @@ def test_ambisonics_binaural_headrotation( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -172,6 +219,7 @@ def test_ambisonics_binaural_headrotation( @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) @pytest.mark.parametrize("aeid", ["1", "0"]) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_dynamic_acoustic_environment( record_property, props_to_record, @@ -179,6 +227,7 @@ def test_dynamic_acoustic_environment( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -187,8 +236,8 @@ def test_dynamic_acoustic_environment( aeid, split_comparison, ): - rend_config_path = TEST_VECTOR_DIR.joinpath(f"rend_config_combined.cfg") - rend_config_path.with_stem(f"rend_config") + rend_config_path = TEST_VECTOR_DIR.joinpath("rend_config_combined.cfg") + rend_config_path.with_stem("rend_config") run_renderer( record_property, @@ -206,13 +255,15 @@ def test_dynamic_acoustic_environment( config_file=rend_config_path, aeid=aeid, split_comparison=split_comparison, + sr=fs, ) -@pytest.mark.skip("MSAN errors in BASOP need to be fixed") +@pytest.mark.skip(reason="Not supported for BASOP code currently") @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[2:]) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_dynamic_acoustic_environment_file( record_property, props_to_record, @@ -220,6 +271,7 @@ def test_dynamic_acoustic_environment_file( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -227,10 +279,10 @@ def test_dynamic_acoustic_environment_file( get_odg_bin, split_comparison, ): - rend_config_path = TEST_VECTOR_DIR.joinpath(f"rend_config_combined.cfg") - rend_config_path.with_stem(f"rend_config") + rend_config_path = TEST_VECTOR_DIR.joinpath("rend_config_combined.cfg") + rend_config_path.with_stem("rend_config") - aeid = TEST_VECTOR_DIR.joinpath(f"aeid1.txt") + aeid = TEST_VECTOR_DIR.joinpath("aeid1.txt") run_renderer( record_property, @@ -248,6 +300,7 @@ def test_dynamic_acoustic_environment_file( config_file=rend_config_path, aeid=aeid, split_comparison=split_comparison, + sr=fs, ) @@ -257,6 +310,7 @@ def test_dynamic_acoustic_environment_file( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_multichannel( record_property, props_to_record, @@ -264,6 +318,7 @@ def test_multichannel( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -271,6 +326,18 @@ def test_multichannel( get_odg_bin, split_comparison, ): + if in_fmt not in ["STEREO", "7_1_4"]: + if frame_size != "20ms": + pytest.skip() + if fs != "48kHz": + pytest.skip() + if out_fmt not in ["MONO", "STEREO", "FOA", "7_1_4"]: + pytest.skip() + if frame_size != "5ms": + pytest.skip() + + # Run everything for 7_1_4 input + run_renderer( record_property, props_to_record, @@ -285,12 +352,14 @@ def test_multichannel( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_multichannel_binaural_static( record_property, props_to_record, @@ -298,6 +367,7 @@ def test_multichannel_binaural_static( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -308,6 +378,15 @@ def test_multichannel_binaural_static( if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") + if fs != "48kHz": + pytest.skip() + + if frame_size != "20ms": + pytest.skip() + + if in_fmt not in ["5_1", "7_1_4"]: + pytest.skip() + run_renderer( record_property, props_to_record, @@ -322,6 +401,7 @@ def test_multichannel_binaural_static( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -329,6 +409,7 @@ def test_multichannel_binaural_static( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_multichannel_binaural_headrotation( record_property, props_to_record, @@ -337,6 +418,7 @@ def test_multichannel_binaural_headrotation( out_fmt, trj_file, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -347,6 +429,16 @@ def test_multichannel_binaural_headrotation( if in_fmt in ["MONO", "STEREO"]: pytest.skip("MONO or STEREO to Binaural rendering unsupported") + if in_fmt != "5_1_4": + if fs != "48kHz": + pytest.skip() + if in_fmt in ["MONO, 5_1, 7_1_4"] and frame_size != "20ms": + pytest.skip() + if in_fmt not in ["MONO, 5_1, 7_1_4"] and frame_size == "20ms": + pytest.skip() + + # Run everything for 5_1_4 + run_renderer( record_property, props_to_record, @@ -362,6 +454,7 @@ def test_multichannel_binaural_headrotation( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -371,6 +464,7 @@ def test_multichannel_binaural_headrotation( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_ism( record_property, props_to_record, @@ -378,6 +472,7 @@ def test_ism( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -385,6 +480,22 @@ def test_ism( get_odg_bin, split_comparison, ): + if in_fmt != "ISM4": + if frame_size != "20ms": + pytest.skip() + if fs != "48kHz": + pytest.skip() + if out_fmt not in ["STEREO", "5_1"]: + pytest.skip() + + if out_fmt not in ["HOA3", "5_1_2"]: + if frame_size != "5ms": + pytest.skip() + if fs != "32kHz": + pytest.skip() + + # Run almost everything for ISM4 + run_renderer( record_property, props_to_record, @@ -399,12 +510,14 @@ def test_ism( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_ism_binaural_static( record_property, props_to_record, @@ -412,6 +525,7 @@ def test_ism_binaural_static( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -419,6 +533,20 @@ def test_ism_binaural_static( get_odg_bin, split_comparison, ): + if in_fmt != "ISM4": + if frame_size != "20ms": + pytest.skip() + if fs != "48kHz": + pytest.skip() + + if fs == "32kHz" and frame_size == "5ms": + pytest.skip() + + if fs == "16kHz" and frame_size == "20ms": + pytest.skip() + + # Run everything for ISM4 + run_renderer( record_property, props_to_record, @@ -433,6 +561,7 @@ def test_ism_binaural_static( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -440,6 +569,7 @@ def test_ism_binaural_static( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_ism_binaural_headrotation( record_property, props_to_record, @@ -448,6 +578,7 @@ def test_ism_binaural_headrotation( out_fmt, trj_file, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -455,6 +586,14 @@ def test_ism_binaural_headrotation( get_odg_bin, split_comparison, ): + if in_fmt != "ISM4": + if frame_size != "5ms": + pytest.skip() + if fs != "32kHz": + pytest.skip() + + # Run everything for ISM4 + run_renderer( record_property, props_to_record, @@ -470,6 +609,7 @@ def test_ism_binaural_headrotation( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -479,6 +619,7 @@ def test_ism_binaural_headrotation( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_masa( record_property, props_to_record, @@ -486,6 +627,7 @@ def test_masa( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -493,6 +635,46 @@ def test_masa( get_odg_bin, split_comparison, ): + if fs == "32kHz" and out_fmt in [ + "STEREO", + "5_1", + "5_1_2", + "5_1_4", + "7_1", + "7_1_4", + "FOA", + "HOA2", + ]: + pytest.skip() + + if fs == "16kHz" and out_fmt in [ + "5_1_2", + "5_1_4", + "7_1", + "7_1_4", + "FOA", + "HOA2", + "HOA3", + ]: + pytest.skip() + + if fs in ["16kHz", "32kHz"] and frame_size == "5ms": + pytest.skip() + + if ( + out_fmt in ["5_1_2", "5_1_4", "7_1", "HOA2", "HOA3"] + and frame_size != "20ms" + and in_fmt == "MASA1" + ): + pytest.skip() + + if ( + out_fmt in ["5_1_2", "7_1_4", "5_1", "FOA"] + and frame_size != "20ms" + and in_fmt == "MASA2" + ): + pytest.skip() + run_renderer( record_property, props_to_record, @@ -507,12 +689,14 @@ def test_masa( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_masa_binaural_static( record_property, props_to_record, @@ -520,6 +704,7 @@ def test_masa_binaural_static( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -527,8 +712,10 @@ def test_masa_binaural_static( get_odg_bin, split_comparison, ): - if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: - pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") + if fs in ["16kHz", "32kHz"] and frame_size == "5ms": + pytest.skip() + + # fs == 48 tests everything run_renderer( record_property, @@ -544,6 +731,7 @@ def test_masa_binaural_static( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -551,6 +739,7 @@ def test_masa_binaural_static( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_masa_binaural_headrotation( record_property, props_to_record, @@ -559,6 +748,7 @@ def test_masa_binaural_headrotation( out_fmt, trj_file, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -566,8 +756,13 @@ def test_masa_binaural_headrotation( get_odg_bin, split_comparison, ): - if out_fmt in ["BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB"]: - pytest.skip("Skipping binaural room outputs for MASA as unimplemented.") + if fs == 32 and frame_size == "20ms": + pytest.skip() + + if fs == 16 and frame_size == "5ms": + pytest.skip() + + # fs == 48 tests everything run_renderer( record_property, @@ -584,15 +779,57 @@ def test_masa_binaural_headrotation( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) -@pytest.mark.parametrize("in_fmt", METADATA_SCENES_TO_TEST_MASA_PREREND) +@pytest.mark.parametrize("out_fmt", INPUT_FORMATS_MASA) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OMASA) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_masa_prerend( record_property, props_to_record, test_info, in_fmt, + out_fmt, + fs, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt not in ["ISM4MASA2", "ISM1MASA1"] and fs != "48kHz": + pytest.skip() + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + binary_suffix=EXE_SUFFIX, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, + ) + + +@pytest.mark.parametrize("out_fmt", INPUT_FORMATS_MASA) +@pytest.mark.parametrize("in_fmt", METADATA_SCENES_TO_TEST_MASA_PREREND) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_masa_prerend_scenes( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, get_mld, get_mld_lim, get_ssnr, @@ -600,20 +837,326 @@ def test_masa_prerend( get_odg_bin, split_comparison, ): + # Test all scenes + run_renderer( record_property, props_to_record, test_info, "META", - "MASA2", - metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"), + out_fmt, + metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}_{fs[:2]}.txt"), + binary_suffix=EXE_SUFFIX, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, + ) + + +""" OMASA """ + + +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OMASA) +@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_omasa( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, + frame_size, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt != "ISM4MASA2": + if fs != "48kHz": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + if out_fmt not in ["STEREO", "5_1"]: + pytest.skip() + + if in_fmt in ["ISM3MASA1", "ISM2MASA2", "ISM1MASA1"]: + pytest.skip() + + if out_fmt in ["5_1", "5_1_4", "7_1_4", "FOA", "HOA2"]: + if frame_size != "20ms": + pytest.skip() + if fs != "16kHz": + pytest.skip() + + # Test all for ISM4MASA2 + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + binary_suffix=EXE_SUFFIX, + frame_size=frame_size, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, + ) + + +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OMASA) +@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_omasa_binaural_static( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, + frame_size, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt != "ISM4MASA2": + if fs != "48kHz": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + + if in_fmt in ["ISM3MASA2", "ISM2MASA1", "ISM1MASA2", "ISM4MASA1"]: + pytest.skip() + + # Test all for ISM4MASA2 + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, binary_suffix=EXE_SUFFIX, + frame_size=frame_size, get_mld=get_mld, mld_lim=get_mld_lim, get_ssnr=get_ssnr, get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, + ) + + +@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OMASA) +@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_omasa_binaural_headrotation( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, + trj_file, + frame_size, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt not in ["ISM1MASA1", "ISM2MASA2", "ISM4MASA2"]: + if fs != "48kHz": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + + # Test all for ["ISM1MASA1", "ISM2MASA2", "ISM4MASA2"] + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), + binary_suffix=EXE_SUFFIX, + frame_size=frame_size, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, + ) + + +""" OSBA """ + + +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OSBA) +@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_osba( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, + frame_size, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt != "ISM4SBA3": + if fs != "48kHz": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + if out_fmt not in ["HOA3", "5_1"]: + pytest.skip() + + if out_fmt in ["HOA3", "5_1"]: + pytest.skip() + # Test all for ISM4SBA3 + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + binary_suffix=EXE_SUFFIX, + frame_size=frame_size, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, + ) + + +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OSBA) +@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_osba_binaural_static( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, + frame_size, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt != "ISM4SBA3": + pytest.skip() + + if fs != "48kHz": + pytest.skip() + + if frame_size != "20ms": + pytest.skip() + + # Test all for ISM4SBA3 + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + binary_suffix=EXE_SUFFIX, + frame_size=frame_size, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, + ) + + +@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_OSBA) +@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) +def test_osba_binaural_headrotation( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + fs, + trj_file, + frame_size, + get_mld, + get_mld_lim, + get_ssnr, + get_odg, + get_odg_bin, + split_comparison, +): + if in_fmt not in ["ISM1SBA1", "ISM2SBA2", "ISM4SBA3"]: + if fs != "48kHz": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + + # Test all for ["ISM1SBA1", "ISM2SBA2", "ISM4SBA3"] + + run_renderer( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), + binary_suffix=EXE_SUFFIX, + frame_size=frame_size, + get_mld=get_mld, + mld_lim=get_mld_lim, + get_ssnr=get_ssnr, + get_odg=get_odg, + get_odg_bin=get_odg_bin, + split_comparison=split_comparison, + sr=fs, ) @@ -623,6 +1166,7 @@ def test_masa_prerend( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_custom_ls_input( record_property, props_to_record, @@ -630,6 +1174,7 @@ def test_custom_ls_input( in_layout, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -637,6 +1182,14 @@ def test_custom_ls_input( get_odg_bin, split_comparison, ): + if out_fmt not in ["7_1, FOA, STEREO"]: + if fs != "48kHz": + pytest.skip() + if frame_size != "20ms": + pytest.skip() + + # Test rest + run_renderer( record_property, props_to_record, @@ -651,20 +1204,30 @@ def test_custom_ls_input( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize( "in_fmt", - [*INPUT_FORMATS_AMBI, *INPUT_FORMATS_MC, *INPUT_FORMATS_ISM, *INPUT_FORMATS_MASA], + [ + *INPUT_FORMATS_AMBI, + *INPUT_FORMATS_MC, + *INPUT_FORMATS_ISM, + *INPUT_FORMATS_MASA, + *INPUT_FORMATS_OMASA, + *INPUT_FORMATS_OSBA, + ], ) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_custom_ls_output( record_property, props_to_record, test_info, in_fmt, out_fmt, + fs, get_mld, get_mld_lim, get_ssnr, @@ -672,11 +1235,23 @@ def test_custom_ls_output( get_odg_bin, split_comparison, ): - # TODO: revert once BASOP is brought up-to-date - if in_fmt in INPUT_FORMATS_MASA: - pytest.skip("MASA to custom LS not supported on ivas-float-update yet") - if in_fmt in INPUT_FORMATS_ISM and out_fmt == "t_design_4": - pytest.skip("ISMx + t_design_4 skipped until bug in BASOP is fixed") + if in_fmt not in [ + "HOA3", + "MONO", + "STEREO", + "5_1", + "7_1_4", + "MASA1", + "MASA2", + "ISM4", + "ISM4MASA2", + "ISM4SBA3", + ]: + pytest.skip() + + if out_fmt == "t_design_4" and fs != "48kHz": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -690,17 +1265,20 @@ def test_custom_ls_output( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("in_fmt", CUSTOM_LS_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_custom_ls_input_output( record_property, props_to_record, test_info, in_fmt, out_fmt, + fs, get_mld, get_mld_lim, get_ssnr, @@ -721,12 +1299,14 @@ def test_custom_ls_input_output( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_custom_ls_input_binaural( record_property, props_to_record, @@ -734,6 +1314,7 @@ def test_custom_ls_input_binaural( in_layout, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -741,6 +1322,9 @@ def test_custom_ls_input_binaural( get_odg_bin, split_comparison, ): + if fs != "48kHz" or frame_size != "20ms": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -755,6 +1339,7 @@ def test_custom_ls_input_binaural( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -762,6 +1347,7 @@ def test_custom_ls_input_binaural( @pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) @pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST) @pytest.mark.parametrize("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_custom_ls_input_binaural_headrotation( record_property, props_to_record, @@ -770,6 +1356,7 @@ def test_custom_ls_input_binaural_headrotation( out_fmt, trj_file, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -777,6 +1364,12 @@ def test_custom_ls_input_binaural_headrotation( get_odg_bin, split_comparison, ): + if fs == "32kHz" and frame_size == "5ms": + pytest.skip() + + if fs == "16kHz" and frame_size == "20ms": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -792,6 +1385,7 @@ def test_custom_ls_input_binaural_headrotation( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -801,6 +1395,7 @@ 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("frame_size", FRAMING_TO_TEST) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_metadata( record_property, props_to_record, @@ -808,6 +1403,7 @@ def test_metadata( in_fmt, out_fmt, frame_size, + fs, get_mld, get_mld_lim, get_ssnr, @@ -815,13 +1411,22 @@ def test_metadata( get_odg_bin, split_comparison, ): + if fs == "32kHz" and frame_size == "5ms": + pytest.skip() + + if fs == "16kHz" and frame_size == "20ms": + pytest.skip() + + if out_fmt not in ["5_1_2", "HOA3", "STEREO"] and fs != "48kHz": + pytest.skip() + run_renderer( record_property, props_to_record, test_info, "META", out_fmt, - metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"), + metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}_{fs[:2]}.txt"), binary_suffix=EXE_SUFFIX, frame_size=frame_size, get_mld=get_mld, @@ -830,6 +1435,7 @@ def test_metadata( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -839,6 +1445,7 @@ def test_metadata( @pytest.mark.parametrize("out_fmt", ["STEREO"]) @pytest.mark.parametrize("in_fmt", ["MONO"]) @pytest.mark.parametrize("non_diegetic_pan", ["0", "-30", "45", "90", "-90"]) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_non_diegetic_pan_static( record_property, props_to_record, @@ -846,6 +1453,7 @@ def test_non_diegetic_pan_static( in_fmt, out_fmt, non_diegetic_pan, + fs, get_mld, get_mld_lim, get_ssnr, @@ -853,6 +1461,12 @@ def test_non_diegetic_pan_static( get_odg_bin, split_comparison, ): + if non_diegetic_pan in ["0", "45", "-90"] and fs == "32kHz": + pytest.skip() + + if non_diegetic_pan not in ["0", "45", "-90"] and fs == "16kHz": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -867,18 +1481,21 @@ def test_non_diegetic_pan_static( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @pytest.mark.parametrize("out_fmt", ["STEREO"]) @pytest.mark.parametrize("in_fmt", ["ISM1"]) @pytest.mark.parametrize("non_diegetic_pan", ["0", "-30", "45", "90", "-90"]) +@pytest.mark.parametrize("fs", SAMPLING_RATES) def test_non_diegetic_pan_ism_static( record_property, props_to_record, test_info, in_fmt, out_fmt, + fs, non_diegetic_pan, get_mld, get_mld_lim, @@ -887,6 +1504,12 @@ def test_non_diegetic_pan_ism_static( get_odg_bin, split_comparison, ): + if non_diegetic_pan in ["0", "45", "-90"] and fs == "16kHz": + pytest.skip() + + if non_diegetic_pan not in ["0", "45", "-90"] and fs == "32kHz": + pytest.skip() + run_renderer( record_property, props_to_record, @@ -901,6 +1524,7 @@ def test_non_diegetic_pan_ism_static( get_odg=get_odg, get_odg_bin=get_odg_bin, split_comparison=split_comparison, + sr=fs, ) @@ -1044,31 +1668,27 @@ def test_ambisonics_binaural_headrotation_refvecequal( if test_info.config.option.create_ref or test_info.config.option.create_cut: pytest.skip("OTR tests only run for smoke test") - # TODO revert - if in_fmt == "HOA3" and out_fmt == "BINAURAL_ROOM_REVERB": - pytest.xfail("WIP : minor differences to be resolved") - else: - compare_renderer_args( - record_property, - props_to_record, - test_info, - in_fmt, - out_fmt, - ref_kwargs={ - "name_extension": "refvecequal", - "frame_size": "5", - }, - cut_kwargs={ - "trj_file": HR_TRAJECTORY_DIR.joinpath( - "full-circle-with-up-and-down-4s.csv" - ), - "refvec_file": HR_TRAJECTORY_DIR.joinpath( - "full-circle-with-up-and-down-4s-Vector3.csv" - ), - "frame_size": "5", - }, - split_comparison=split_comparison, - ) + compare_renderer_args( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvecequal", + "frame_size": "5", + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath( + "full-circle-with-up-and-down-4s.csv" + ), + "refvec_file": HR_TRAJECTORY_DIR.joinpath( + "full-circle-with-up-and-down-4s-Vector3.csv" + ), + "frame_size": "5", + }, + split_comparison=split_comparison, + ) # This test compares rendering with: @@ -1088,32 +1708,28 @@ def test_ambisonics_binaural_headrotation_refvec_rotating( if test_info.config.option.create_ref or test_info.config.option.create_cut: pytest.skip("OTR tests only run for smoke test") - # TODO revert - if in_fmt == "HOA2" and out_fmt == "BINAURAL_ROOM_REVERB": - pytest.xfail("WIP : minor differences to be resolved") - else: - compare_renderer_args( - record_property, - props_to_record, - test_info, - in_fmt, - out_fmt, - ref_kwargs={ - "name_extension": "refvec_rotating", - "trj_file": HR_TRAJECTORY_DIR.joinpath( - "full-circle-with-up-and-down-4s.csv" - ), - "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" - ), - "frame_size": "5", - }, - split_comparison=split_comparison, - ) + compare_renderer_args( + record_property, + props_to_record, + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath( + "full-circle-with-up-and-down-4s.csv" + ), + "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" + ), + "frame_size": "5", + }, + split_comparison=split_comparison, + ) # This test compares rendering with: diff --git a/tests/renderer_short/utils.py b/tests/renderer_short/utils.py index 9afda68b940d90511cf4cb75485f0f526495de3f..1aa7370f08dd8d919e2cf028bf3e4cfb223447b8 100644 --- a/tests/renderer_short/utils.py +++ b/tests/renderer_short/utils.py @@ -30,44 +30,44 @@ accordance with the laws of the Federal Republic of Germany excluding its confli the United Nations Convention on Contracts on the International Sales of Goods. """ +import errno import filecmp import logging import os -from pathlib import Path +import re import subprocess as sp import sys +import tempfile +from pathlib import Path from typing import Dict, Optional, Union import numpy as np import pytest -import re -import errno -import tempfile +from ..constants import CAT_NORMAL from .compare_audio import compare_audio_arrays from .constants import ( - LTV_DIR, - SCRIPTS_DIR, - OUTPUT_PATH_REF, - OUTPUT_PATH_CUT, + BIN_SUFFIX_MERGETARGET, FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_FILE_LTV, + FORMAT_TO_FILE_SMOKETEST, FORMAT_TO_METADATA_FILES, FORMAT_TO_METADATA_FILES_LTV, - FORMAT_TO_FILE_SMOKETEST, - RENDERER_CMD, - BIN_SUFFIX_MERGETARGET, + LTV_DIR, + OUTPUT_PATH_CUT, + OUTPUT_PATH_REF, PEAQ_SUPPORTED_FMT, + RENDERER_CMD, + SCRIPTS_DIR, ) -from ..constants import CAT_NORMAL sys.path.append(SCRIPTS_DIR) from pyaudio3dtools.audiofile import readfile -from ..cmp_pcm import cmp_pcm -from ..conftest import parse_properties, get_split_idx +from ..cmp_pcm import cmp_pcm +from ..conftest import get_split_idx, parse_properties -def _run_cmd(cmd, env, test_info=None): +def _run_cmd(cmd, test_info=None, env=None ): """ Helper function for running some command. Raises a SystemError if either the return code is non-zero or a USAN printout is detected @@ -92,29 +92,30 @@ def _run_cmd(cmd, env, test_info=None): raise SystemError(error) -def run_cmd(cmd, test_info, env=None): +def run_cmd(cmd, test_info=None, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") - _run_cmd(cmd, env, test_info) + _run_cmd(cmd, test_info=test_info, env=env) -def run_isar_ext_rend_cmd(cmd, env=None): +def run_isar_ext_rend_cmd(cmd, test_info=None, env=None): logging.info(f"\nRunning ISAR EXT REND command\n{' '.join(cmd)}\n") - _run_cmd(cmd, env) + _run_cmd(cmd, test_info=test_info, env=env) -def run_ivas_isar_enc_cmd(cmd, env=None): +def run_ivas_isar_enc_cmd(cmd, test_info=None, env=None): logging.info(f"\nRunning IVAS ISAR encoder command\n{' '.join(cmd)}\n") - _run_cmd(cmd, env) - - -def run_ivas_isar_dec_cmd(cmd, env=None): - logging.info(f"\nDUT decoder command:\n\t{' '.join(cmd)}\n") - _run_cmd(cmd, env) + _run_cmd(cmd, test_info=test_info, env=env) +def run_ivas_isar_dec_cmd(cmd, test_info=None, env=None): + if BIN_SUFFIX_MERGETARGET in cmd[0]: + logging.info(f"\nREF decoder command:\n\t{' '.join(cmd)}\n") + else: + logging.info(f"\nDUT decoder command:\n\t{' '.join(cmd)}\n") + _run_cmd(cmd, test_info=test_info, env=env) -def run_isar_post_rend_cmd(cmd, env=None): +def run_isar_post_rend_cmd(cmd, test_info=None, env=None): logging.info(f"\nRunning ISAR post renderer command\n{' '.join(cmd)}\n") - _run_cmd(cmd, env) + _run_cmd(cmd, test_info=test_info, env=env) def check_BE( @@ -175,7 +176,7 @@ def run_renderer( aeid: Optional[Union[Path, int]] = None, in_file=None, out_file=None, - sr=48, + sr="48kHz", render_for_peaq=False, split_comparison=False, ) -> str: @@ -267,12 +268,20 @@ def run_renderer( else: in_file = format_to_file[in_fmt] in_name = in_fmt + in_file = str(in_file).replace("48", sr[:2]) if in_meta_files is None and in_fmt in format_to_metadata_files: in_meta_files = format_to_metadata_files[in_fmt] + # If metadata not given with ISM input, use default NULL + if in_meta_files is None and isinstance(in_fmt, str) and "ism" in in_fmt.lower(): + match = re.search(r"ism(\d)", in_fmt.lower()) + assert match is not None + num_obj = int(match[1]) + in_meta_files = ["NULL"] * num_obj + if out_file is None: - out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}{aeid_name}.wav" + out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}{aeid_name}_{sr}.wav" out_file = str(output_path_base.joinpath(out_file_stem)) cmd = RENDERER_CMD[:] @@ -280,7 +289,7 @@ def run_renderer( cmd[4] = str(in_fmt) cmd[6] = str(out_file) cmd[8] = str(out_fmt) - cmd[10] = str(sr) + cmd[10] = str(sr[:2]) if test_info.config.option.create_ref: cmd[0] += BIN_SUFFIX_MERGETARGET @@ -370,7 +379,7 @@ def run_renderer( cmd2[4] = str(out_fmt) # in_fmt cmd2[6] = odg_test # out_file cmd2[8] = new_fmt # out_fmt - cmd2[10] = str(sr) + cmd2[10] = str(sr[:2]) cmd2[0] += BIN_SUFFIX_MERGETARGET # Use IVAS_rend_ref for re-rendering cmd2[0] += binary_suffix if "MASA" in str(out_fmt): @@ -551,8 +560,8 @@ def binauralize_input_and_output( # If extended metadata is not used, strip the metadata for the external renderer extended_md_used = ( re.search(r"-ism\s?\+[1-4]", enc_opts) - and not "OMASA" in in_fmt - and not "OSBA" in in_fmt + and "OMASA" not in in_fmt + and "OSBA" not in in_fmt ) if not extended_md_used and n_obj > 0: truncated_meta_files = [] @@ -634,7 +643,7 @@ def binauralize_input_and_output( aeid = findstr(r"-aeid\s+(\S+)", dec_opts) - if not output_config.upper() in PEAQ_SUPPORTED_FMT: + if output_config.upper() not in PEAQ_SUPPORTED_FMT: # Render output to BINAURAL output_reformat = "BINAURAL"