Commit 56c3dcab authored by Jan Kiene's avatar Jan Kiene
Browse files

add directivity ISM rendering testcases

parent 36fdd8b5
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -494,9 +494,20 @@ HEAD_ROTATION_OPTIONS = {
OTR_PARAMS = [OTR_NONE, OTR_REF, OTR_AVG, OTR_REF_VEC, OTR_REF_VEC_LEV]
EXOF_OFF = "EXOF_off"
EXOF_ON = "EXOF_on"
EXOF_OPTIONS = ["-exof", get_file_from_repo("scripts/testv/headrot_case00_3000_q_combinedRotationTest.csv")]
EXOF_OPTIONS = [
    "-exof",
    get_file_from_repo("scripts/testv/headrot_case00_3000_q_combinedRotationTest.csv"),
]
EXOF_PARAMS = [EXOF_OFF, EXOF_ON]

RENDER_CONFIG_OPTIONS = [
    "-render_config",
    str(TESTV_PATH.joinpath("render_config.cfg")),
]
DPID_OPTIONS = ["-dpid", "0", "1", "2", "3"]
# For testing only
DPID_OPTIONS = ["-dpid", "0", "0", "0", "0"]

DECODER_CONST_BR_BINAURAL_MC_AND_MASA = collapse_into_list_of_pairs(
    product(
        MC_PARAMS,
+21 −1
Original line number Diff line number Diff line
@@ -49,7 +49,9 @@ from ..constants import (
    HEAD_ROTATION_OPTIONS,
    EXOF_OFF,
    EXOF_ON,
    EXOF_OPTIONS
    EXOF_OPTIONS,
    RENDER_CONFIG_OPTIONS,
    DPID_OPTIONS,
)


@@ -108,6 +110,8 @@ def get_bitstream_and_options(
    suffix="",
    non_diegetic_pan_value=None,
    exof=EXOF_OFF,
    render_config=False,
    dpid=False,
):
    """
    Utility to get either the stored reference bitstream or the processed version as a temporary file
@@ -168,6 +172,22 @@ def get_bitstream_and_options(
        if exof == EXOF_ON:
            options.extend(EXOF_OPTIONS)

        if render_config:
            options.extend(RENDER_CONFIG_OPTIONS)

        if dpid:
            assert render_config
            if encoder_format.startswith("ISM"):
                n_ism = int(encoder_format[-1])
            elif encoder_format in ["OMASA", "OSBA"]:
                # get number of isms from testv name
                n_ism = int(testv_name.split("_")[2][0])
            else:
                raise ValueError("dpid only for ISM and combined_formats")

            # +1 for the "-dpid" at index 0
            options.extend(DPID_OPTIONS[: n_ism + 1])

        yield bitstream, options


+7 −7
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ def test_decoder_hr_mc_and_masa(
        dtx,
        processing=bitstream_processing,
        otr_mode=otr_mode,
        exof=exof
        exof=exof,
    ) as (ref_bitstream, options):
        run_check(
            ref_bitstream,
@@ -72,7 +72,7 @@ def test_decoder_hr_mc_and_masa(
            dut_decoder_frontend,
            update_ref == 1,
            bitstream_processing=bitstream_processing,
            output_suffix=f"{otr_mode}-{exof}"
            output_suffix=f"{otr_mode}-{exof}",
        )


@@ -113,7 +113,7 @@ def test_decoder_hr_objectbased(
        suffix=suffix,
        processing=bitstream_processing,
        otr_mode=otr_mode,
        exof=exof
        exof=exof,
    ) as (ref_bitstream, options):
        run_check(
            ref_bitstream,
@@ -123,7 +123,7 @@ def test_decoder_hr_objectbased(
            dut_decoder_frontend,
            update_ref == 1,
            bitstream_processing=bitstream_processing,
            output_suffix=f"{otr_mode}-{exof}"
            output_suffix=f"{otr_mode}-{exof}",
        )


@@ -160,7 +160,7 @@ def test_decoder_hr_scenebased(
        suffix=suffix,
        processing=bitstream_processing,
        otr_mode=otr_mode,
        exof=exof
        exof=exof,
    ) as (ref_bitstream, options):
        run_check(
            ref_bitstream,
@@ -170,7 +170,7 @@ def test_decoder_hr_scenebased(
            dut_decoder_frontend,
            update_ref == 1,
            bitstream_processing=bitstream_processing,
            output_suffix=f"{otr_mode}-{exof}"
            output_suffix=f"{otr_mode}-{exof}",
        )


@@ -223,5 +223,5 @@ def test_decoder_hr_combined_formats(
            dut_decoder_frontend,
            update_ref == 1,
            bitstream_processing=bitstream_processing,
            output_suffix=f"{otr_mode}-{exof}"
            output_suffix=f"{otr_mode}-{exof}",
        )
+128 −0
Original line number Diff line number Diff line
__copyright__ = """
(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.
"""

import pytest
from . import get_bitstream_and_options, run_check
from .. import get_testv_path
from ..constants import *


@pytest.mark.parametrize(
    "input_format,bitrate,input_sampling_rate,dtx,md_type,output_format,output_sampling_rate,bitstream_processing",
    DECODER_CONST_BR_BINAURAL_OBJECTBASED,
)
def test_decoder_objectbased_directivity(
    input_format,
    bitrate,
    input_sampling_rate,
    dtx,
    md_type,
    output_format,
    output_sampling_rate,
    bitstream_processing,
    dut_decoder_frontend,
    update_ref,
):
    testv_name = get_testv_path(input_format, input_sampling_rate).stem
    suffix = "_basic_MD"
    if md_type == ISM_MD_EXTENDED:
        suffix = "_ext_MD"
    elif md_type == ISM_MD_NULL:
        suffix = "_null_MD"
    with get_bitstream_and_options(
        testv_name,
        input_format,
        bitrate,
        input_sampling_rate,
        dtx,
        suffix=suffix,
        processing=bitstream_processing,
        render_config=True,
        dpid=True,
    ) as (ref_bitstream, options):
        run_check(
            ref_bitstream,
            output_format,
            output_sampling_rate,
            options,
            dut_decoder_frontend,
            update_ref == 1,
            output_suffix="dpid",
            bitstream_processing=bitstream_processing,
        )


@pytest.mark.parametrize(
    "input_format_ism,input_format_other,bitrate,input_sampling_rate,md_type,output_format,output_sampling_rate,bitstream_processing",
    DECODER_CONST_BR_BINAURAL_COMBINED_PARAMS,
)
def test_decoder_combined_formats(
    input_format_ism,
    input_format_other,
    bitrate,
    input_sampling_rate,
    md_type,
    output_format,
    output_sampling_rate,
    bitstream_processing,
    dut_decoder_frontend,
    update_ref,
):
    input_format_combined = "OMASA" if "MASA" in input_format_other else "OSBA"
    testv_name = get_testv_path(
        f"{input_format_combined}_{input_format_ism}_{input_format_other}",
        input_sampling_rate,
    ).stem
    suffix = "_basic_MD"
    if md_type == ISM_MD_EXTENDED:
        suffix = "_ext_MD"
    elif md_type == ISM_MD_NULL:
        suffix = "_null_MD"
    with get_bitstream_and_options(
        testv_name,
        input_format_combined,
        bitrate,
        input_sampling_rate,
        DTX_OFF,
        suffix=suffix,
        processing=bitstream_processing,
        render_config=True,
        dpid=True,
    ) as (ref_bitstream, options):
        run_check(
            ref_bitstream,
            output_format,
            output_sampling_rate,
            options,
            dut_decoder_frontend,
            update_ref == 1,
            output_suffix="dpid",
            bitstream_processing=bitstream_processing,
        )