diff --git a/ci/remove_unsupported_testcases.py b/ci/remove_unsupported_testcases.py new file mode 100644 index 0000000000000000000000000000000000000000..5d01fe77915b948f86717b838897edc105d9c8b0 --- /dev/null +++ b/ci/remove_unsupported_testcases.py @@ -0,0 +1,79 @@ +__copyright__ = """ +(C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +the software. This notice grants no license of any kind, including but not limited to patent +license, nor is any license granted by implication, estoppel or otherwise. + +Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. +""" + +from pathlib import Path +import argparse + +# Enter tag of testcases to remove here WITHOUT the leading // +TESTCASES = [ + "OMASA 2Dir2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, EXT out", + "OSBA planar FOA 2ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL out", + "4 ISM with extended metadata at 128 kbps, 48 kHz in, 48 kHz out, BINAURAL_ROOM_REVERB out, combined render config, directivity configuration with identifiers", + "OSBA planar FOA 1ISM at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out", + "Multi-channel 5_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 10%, bandwidth switching", + "OSBA FOA 4ISM at bitrate switching 13.2 to 512 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 5%, bandwidth switching", + "OSBA FOA 2ISM at 64 kbps, 48kHz in, 48kHz out, HOA3 out, bandwidth switching", + "OMASA 2Dir2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, EXT out", + "OSBA planar FOA 2ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL out", + "OSBA planar FOA 1ISM at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out", + "SBA 3OA at 128 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB combined renderer configuration with selected acoustic environment", + "OSBA FOA 4ISM at bitrate switching 13.2 to 512 kbps, 48kHz in, 16kHz out, BINAURAL out (Model from file), FER at 5%, bandwidth switching", +] + + +def remove_testcases(cfg: Path, testcases: list): + """ + Go through file line by line and copy all testcases except the given ones + """ + with open(cfg, "r") as f: + content_in = f.readlines() + + content_out = list() + copy_flag = True + for line in content_in: + if any([tc in line for tc in testcases]): + copy_flag = False + + if copy_flag: + content_out.append(line) + elif line == "\n": + copy_flag = True + + with open(cfg, "w") as f: + f.write("".join(content_out)) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("cfg_files", nargs="+", type=Path) + args = parser.parse_args() + + for f in args.cfg_files: + remove_testcases(f, TESTCASES) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 8576dd8d105b04e85822562acf7c7f77dc6cb1ab..ca71224aea36a0f266b91d4226e1eed3be302fdb 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -32,7 +32,25 @@ import pytest -from .utils import * +from .constants import ( + OUTPUT_FORMATS, + INPUT_FORMATS_AMBI, + FRAMING_TO_TEST, + EXE_SUFFIX, + OUTPUT_FORMATS_BINAURAL, + HR_TRAJECTORIES_TO_TEST, + HR_TRAJECTORY_DIR, + INPUT_FORMATS_MC, + INPUT_FORMATS_ISM, + FORMAT_TO_METADATA_FILES, + INPUT_FORMATS_MASA, + METADATA_SCENES_TO_TEST_MASA_PREREND, + TEST_VECTOR_DIR, + CUSTOM_LS_TO_TEST, + CUSTOM_LAYOUT_DIR, + METADATA_SCENES_TO_TEST, +) +from .utils import run_renderer, compare_renderer_args, test_info ############################################################################## # Bit-exactness tests @@ -354,8 +372,8 @@ def test_masa_prerend(record_property, test_info, in_fmt, get_mld, get_mld_lim): "MASA2", metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"), binary_suffix=EXE_SUFFIX, - get_mld=get_mld, - mld_lim=get_mld_lim, + get_mld=get_mld, + mld_lim=get_mld_lim, ) @@ -393,8 +411,8 @@ def test_custom_ls_output( in_fmt, CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), binary_suffix=EXE_SUFFIX, - get_mld=get_mld, - mld_lim=get_mld_lim, + get_mld=get_mld, + mld_lim=get_mld_lim, ) @@ -410,8 +428,8 @@ def test_custom_ls_input_output( CUSTOM_LAYOUT_DIR.joinpath(f"{in_fmt}.txt"), CUSTOM_LAYOUT_DIR.joinpath(f"{out_fmt}.txt"), binary_suffix=EXE_SUFFIX, - get_mld=get_mld, - mld_lim=get_mld_lim, + get_mld=get_mld, + mld_lim=get_mld_lim, ) @@ -502,8 +520,8 @@ def test_non_diegetic_pan_static( out_fmt, non_diegetic_pan=non_diegetic_pan, binary_suffix=EXE_SUFFIX, - get_mld=get_mld, - mld_lim=get_mld_lim, + get_mld=get_mld, + mld_lim=get_mld_lim, ) @@ -521,8 +539,8 @@ def test_non_diegetic_pan_ism_static( out_fmt, non_diegetic_pan=non_diegetic_pan, binary_suffix=EXE_SUFFIX, - get_mld=get_mld, - mld_lim=get_mld_lim, + get_mld=get_mld, + mld_lim=get_mld_lim, ) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 71cd852d59955a7017c88a4e2b727f795c08a847..2193ee4bfbe82b7fb92ce760d99824dc8ca073ee 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -41,10 +41,19 @@ import numpy as np import pytest from .compare_audio import compare_audio_arrays -from .constants import * +from .constants import ( + SCRIPTS_DIR, + OUTPUT_PATH_REF, + OUTPUT_PATH_CUT, + FORMAT_TO_FILE_COMPARETEST, + FORMAT_TO_FILE_SMOKETEST, + RENDERER_CMD, + BIN_SUFFIX_MERGETARGET, +) sys.path.append(SCRIPTS_DIR) from pyaudio3dtools.audiofile import readfile +from .. import cmp_pcm # fixture returns test information, enabling per-testcase SNR @@ -105,7 +114,7 @@ def check_BE( cut: np.ndarray, cut_fs: int, xfail: bool = False, - atol: int = 2 + 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!") @@ -152,6 +161,7 @@ def run_renderer( hrtf_file: Optional[str] = None, get_mld=False, mld_lim=0, + get_mld_lim=0, ) -> str: # prepare arguments and filepaths if trj_file is not None: @@ -273,6 +283,8 @@ def run_renderer( out_file_ref = str(OUTPUT_PATH_REF.joinpath(out_file_stem)) if get_mld: + # see constants.py + ref_fs = cmd[10] output_differs, reason = cmp_pcm( out_file, out_file_ref, diff --git a/tests/scale_pcm.py b/tests/scale_pcm.py index 356cdd90e12b95e818bf0f2fa58600fe48d96efc..9aef914da1db574c84c54c0dc7f7d7097691f0ec 100755 --- a/tests/scale_pcm.py +++ b/tests/scale_pcm.py @@ -1,33 +1,33 @@ #!/usr/bin/env python3 -import argparse import os -import pathlib import sys +import argparse +import pathlib THIS_PATH = os.path.join(os.getcwd(), __file__) sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../scripts")) -import concurrent.futures - import pyaudio3dtools +import pyivastest +import numpy as np +import concurrent.futures def scale_folder(folder, factor): + files = list(folder.glob("*.wav")) with concurrent.futures.ThreadPoolExecutor() as executor: executor.map(scale_file, files, files, [factor] * len(files)) - -def scale_file(file1, file2, factor=1.0) -> None: +def scale_file(file1, file2, factor = 1.0) -> None: """ Scale file1 to file2 """ s1, fs = pyaudio3dtools.audiofile.readfile(file1) - s2 = s1 * factor + s2 = s1 * factor; pyaudio3dtools.audiofile.writefile(file2, s2, fs) - if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("folder", type=pathlib.Path)