Commit b97da935 authored by Jan Kiene's avatar Jan Kiene
Browse files

add head rotation testcases

parent 8cb49adb
Loading
Loading
Loading
Loading
+48 −6
Original line number Diff line number Diff line
@@ -49,6 +49,14 @@ def bitrates_between(lowest, highest):
    return [b for b in BITRATES_ALL if b >= lowest and b <= highest]


def get_file_from_repo(path):
    """
    Helper for getting a file from the repo, e.g. from scripts/testv. The path needs to be given relative to the repository root!
    """
    repo_root = HERE.joinpath("../..").resolve().absolute()
    return str(repo_root.joinpath(path))


DTX_ON = "DTXon"
DTX_OFF = "DTXoff"

@@ -440,18 +448,52 @@ DECODER_CONST_BR_NO_BINAURAL_COMBINED_PARAMS = collapse_into_list_of_pairs(
)

# parameters for const bitrate testcases with binaural output
# TODO: add parameters for all the binaural output options

BINAURAL_HRTF_NONE = "HRTFdefault"
BINAURAL_HRTF_EXT_REPO = "HRFText_repo"
HRTF_PATHS = {
    BINAURAL_HRTF_EXT_REPO: HERE.joinpath(
        "../../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_{fs}kHz.bin"
    BINAURAL_HRTF_EXT_REPO: get_file_from_repo(
        "scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_{fs}kHz.bin"
    )
    .resolve()
    .absolute()
}

# TODO: all the following binaural rendering parameters are takenfrom selftest for now -> would need to create critical ones
OTR_NONE = "OTRnone"
OTR_REF = "OTRref"
OTR_AVG = "OTRavg"
OTR_REF_VEC = "OTRref_vec"
OTR_REF_VEC_LEV = "OTRref_vec_lev"
# TODO: exof
OTR_OPTIONS = {
    OTR_NONE: list(),
    OTR_REF: ["-otr", "ref", "-rf", get_file_from_repo("scripts/testv/headrot.csv")],
    OTR_AVG: ["-otr", "avg"],
    OTR_REF_VEC: [
        "-otr",
        "ref_vec",
        "-rvf",
        get_file_from_repo("scripts/trajectories/full-circle-4s-Vector3.csv"),
    ],
    OTR_REF_VEC_LEV: [
        "-otr",
        "ref_vec_lev",
        "-rvf",
        get_file_from_repo(
            "scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv"
        ),
    ],
}
HEAD_ROTATION_OPTIONS = {
    OTR_NONE: ["-t", get_file_from_repo("scripts/testv/headrot.csv")],
    OTR_REF: ["-t", get_file_from_repo("scripts/testv/headrot.csv")],
    OTR_REF_VEC: ["-t", get_file_from_repo("scripts/trajectories/full-circle-4s.csv")],
    OTR_REF_VEC_LEV: [
        "-t",
        get_file_from_repo("scripts/trajectories/full-circle-with-up-and-down-4s.csv"),
    ],
}
OTR_PARAMS = [OTR_NONE, OTR_REF, OTR_AVG, OTR_REF_VEC, OTR_REF_VEC_LEV]

DECODER_CONST_BR_BINAURAL_MC_AND_MASA = collapse_into_list_of_pairs(
    product(
        MC_PARAMS,
+7 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ from ..constants import (
    BS_PROC_NONE,
    BINAURAL_HRTF_NONE,
    HRTF_PATHS,
    OTR_OPTIONS,
    HEAD_ROTATION_OPTIONS,
)


@@ -99,6 +101,7 @@ def get_bitstream_and_options(
    dtx,
    processing,
    hrtf=BINAURAL_HRTF_NONE,
    otr_mode=None,
    suffix="",
    non_diegetic_pan_value=None,
):
@@ -154,6 +157,10 @@ def get_bitstream_and_options(
        if non_diegetic_pan_value is not None:
            options.extend(["-non_diegetic_pan", f"{non_diegetic_pan_value}"])

        if otr_mode is not None:
            options.extend(HEAD_ROTATION_OPTIONS.get(otr_mode, list()))
            options.extend(OTR_OPTIONS[otr_mode])

        yield bitstream, options