Commit 759960ba authored by Jan Kiene's avatar Jan Kiene
Browse files

add test code and data

parent 608d34e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@ test_audiotools_convert:
  tags:
    - linux
  script:
    - python -m pytest -q -n auto tests/test_audiotools_convert.py
    - python3 -m pytest -q -n auto tests/test_audiotools_convert.py

tests/constants.py

0 → 100644
+202 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3

#
#  (C) 2022-2023 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 PurePath

""" Set up paths """
TESTS_DIR = PurePath(__file__).parent
TEST_VECTOR_DIR = TESTS_DIR.joinpath("data")

ISM_METADATA_DIR = TEST_VECTOR_DIR.joinpath("ism_metadata")
MASA_METADATA_DIR = TEST_VECTOR_DIR.joinpath("masa")
SCENE_DESC_DIR = TEST_VECTOR_DIR.joinpath("scene_description")

OUTPUT_PATH_REF = TESTS_DIR.joinpath("ref")
OUTPUT_PATH_CUT = TESTS_DIR.joinpath("cut")

CUSTOM_LAYOUT_DIR = TEST_VECTOR_DIR.joinpath("ls_layouts")
HR_TRAJECTORY_DIR = TEST_VECTOR_DIR.joinpath("trajectories")

""" Renderer commandline template """
RENDERER_CMD = [
    str(TESTS_DIR.parent.parent.joinpath("IVAS_rend")),
    "-i",
    "",  # 2 -> input file
    "-if",
    "",  # 4 -> input format
    "-o",
    "/dev/null",  # 6 -> output file
    "-of",
    "",  # 8 -> output format
    "-fs",
    "48",  # 10 -> input fs
    # "--no_delay_cmp",
    # "-ndl",
    "-q",
]

""" Format to file mappings """
NCHAN_TO_FILE = {
    1: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_1ch_48kHz.wav"),
    2: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_2ch_48kHz.wav"),
    3: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_3ch_48kHz.wav"),
    4: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_4ch_48kHz.wav"),
    5: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_5ch_48kHz.wav"),
    6: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_6ch_48kHz.wav"),
    8: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_8ch_48kHz.wav"),
    9: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_9ch_48kHz.wav"),
    10: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_10ch_48kHz.wav"),
    11: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_11ch_48kHz.wav"),
    12: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_12ch_48kHz.wav"),
    15: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_15ch_48kHz.wav"),
    16: TEST_VECTOR_DIR.joinpath("spectral").joinpath("spectral_test_16ch_48kHz.wav"),
}

FORMAT_TO_FILE = {
    "MONO": NCHAN_TO_FILE[1],
    "STEREO": NCHAN_TO_FILE[2],
    "5_1": NCHAN_TO_FILE[6],
    "7_1": NCHAN_TO_FILE[8],
    "5_1_2": NCHAN_TO_FILE[8],
    "5_1_4": NCHAN_TO_FILE[10],
    "7_1_4": NCHAN_TO_FILE[12],
    "FOA": NCHAN_TO_FILE[4],
    "HOA2": NCHAN_TO_FILE[9],
    "HOA3": NCHAN_TO_FILE[16],
    "ISM1": NCHAN_TO_FILE[1],
    "ISM2": NCHAN_TO_FILE[2],
    "ISM3": NCHAN_TO_FILE[3],
    "ISM4": NCHAN_TO_FILE[4],
    "MASA1": NCHAN_TO_FILE[1],
    "MASA2": NCHAN_TO_FILE[2],
    # "MASA1": TEST_VECTOR_DIR.joinpath("stv_IVASMASA_1dir1TC.pcm"),
    # "MASA2": TEST_VECTOR_DIR.joinpath("stv_IVASMASA_2dir2TC.pcm"),
    "META": TEST_VECTOR_DIR.joinpath("mixed_scene.txt"),
    "16ch_8+4+4": NCHAN_TO_FILE[16],
    "4d0": NCHAN_TO_FILE[4],
    "4d4": NCHAN_TO_FILE[8],
    "cicp1": NCHAN_TO_FILE[1],
    "cicp20": NCHAN_TO_FILE[15],
    "cicp2": NCHAN_TO_FILE[2],
    "custom1": NCHAN_TO_FILE[11],
    "itu_4+5+1": NCHAN_TO_FILE[11],
    "t_design_4": NCHAN_TO_FILE[12],
}

FORMAT_TO_METADATA_FILES = {
    "ISM1": [str(ISM_METADATA_DIR.joinpath("stvISM1.csv"))],
    "ISM2": [
        str(ISM_METADATA_DIR.joinpath("stvISM1.csv")),
        str(ISM_METADATA_DIR.joinpath("stvISM2.csv")),
    ],
    "ISM3": [
        str(ISM_METADATA_DIR.joinpath("stvISM1.csv")),
        str(ISM_METADATA_DIR.joinpath("stvISM2.csv")),
        str(ISM_METADATA_DIR.joinpath("stvISM3.csv")),
    ],
    "ISM4": [
        str(ISM_METADATA_DIR.joinpath("stvISM1.csv")),
        str(ISM_METADATA_DIR.joinpath("stvISM2.csv")),
        str(ISM_METADATA_DIR.joinpath("stvISM3.csv")),
        str(ISM_METADATA_DIR.joinpath("stvISM4.csv")),
    ],
    "MASA1": [str(MASA_METADATA_DIR.joinpath("stv_IVASMASA_1dir1TC.met"))],
    "MASA2": [str(MASA_METADATA_DIR.joinpath("stv_IVASMASA_2dir2TC.met"))],
}

""" Input formats """
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"]

""" Non binaural / parametric output formats """
OUTPUT_FORMATS = [
    "MONO",
    "STEREO",
    "5_1",
    "5_1_2",
    "5_1_4",
    "7_1",
    "7_1_4",
    "FOA",
    "HOA2",
    "HOA3",
]

""" Custom loudspeaker input/output """
CUSTOM_LS_TO_TEST = [
    # "cicp1",
    # "cicp2",
    "t_design_4",
    # "4d0",
    "4d4",
    "itu_4+5+1",
    "custom1",
    # "cicp20",
    "16ch_8+4+4",
]

""" Mixed scene ( metadata ) rendering """
METADATA_SCENES_TO_TEST = [
    SCENE_DESC_DIR.joinpath(s) for s in ["mixed_scene", "mixed_scene_simple"]
]
METADATA_SCENES_TO_TEST_NO_BE = [SCENE_DESC_DIR.joinpath(s) for s in ["masa_scene"]]

""" Binaural rendering """
INPUT_FORMATS_BINAURAL = OUTPUT_FORMATS[2:]
INPUT_FORMATS_BINAURAL.extend(
    [
        "ISM1",
        "ISM2",
        "ISM3",
        "ISM4",
        "MASA1",
        "MASA2",
    ]
)
OUTPUT_FORMATS_BINAURAL = ["BINAURAL", "BINAURAL_ROOM"]
HR_TRAJECTORIES_TO_TEST = [
    # "const000",
    # "full_circle_in_15s",
    "full_circle_in_15s-Euler",
    "rotate_yaw_pitch_roll1",
]

""" Generate Test Items Configs """
# TODO reorganize later
INPUT_CONFIG_FILES = [
    str(TEST_VECTOR_DIR.joinpath("test_ISM.yml")),
    # str(TEST_VECTOR_DIR.joinpath("test_MASA.yml")), # TODO
    str(TEST_VECTOR_DIR.joinpath("test_MC.yml")),
    str(TEST_VECTOR_DIR.joinpath("test_SBA.yml")),
]
+50 −0
Original line number Diff line number Diff line
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
-030.00,+00.00,01.00,000.00,1.00
+50 −0
Original line number Diff line number Diff line
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+000.00,+00.00,01.00,000.00,1.00
+50 −0
Original line number Diff line number Diff line
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
+030.00,+00.00,01.00,000.00,1.00
Loading