Commit 7185c06f authored by Jan Kiene's avatar Jan Kiene
Browse files

separate omasa and osba encoder testcases

parent 0d3af357
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -493,6 +493,7 @@ OSBA_PARAMS = list(
        [ISM_MD_BASIC, ISM_MD_NULL, ISM_MD_EXTENDED],
    )
)
OSBA_PARAMS_REDUCED = list()
OMASA_PARAMS = list(
    product(
        INPUT_FORMATS_OBJECT_BASED,
@@ -501,6 +502,7 @@ OMASA_PARAMS = list(
        [ISM_MD_BASIC, ISM_MD_NULL, ISM_MD_EXTENDED],
    )
)
OMASA_PARAMS_REDUCED = list()
COMBINED_FORMATS_PARAMS = OSBA_PARAMS + OMASA_PARAMS


+16 −49
Original line number Diff line number Diff line
@@ -28,66 +28,33 @@ 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 itertools
import random
from ..constants import (
    ISM_MD_NULL,
    OMASA_PARAMS,
    OMASA_PARAMS_REDUCED,
    ISM_MD_EXTENDED,
    ENCODER_CHANNEL_BASED_AND_MASA_PARAMS,
    ISM_MD_NULL,
    DTX_OFF,
    ISM_PARAMS,
    SBA_PARAMS,
    SBA_FOA_PCA_ON,
    STEREO_DMX_EVS_PARAMS,
    COMBINED_FORMATS_PARAMS,
)
from . import get_options, run_check
from .. import get_testv_path, get_valid_fs_max_band_pairs


TEST_PARAMS_EXHAUSTIVE = {
    "test_encoder_const_br_channel_based_and_masa_modes": (
        "input_format,bitrate,dtx",
        ENCODER_CHANNEL_BASED_AND_MASA_PARAMS,
    ),
    "test_encoder_const_br_object_based_modes": (
        "input_format,bitrate,dtx,md_type",
        ISM_PARAMS,
    ),
    "test_encoder_const_br_scenebased": ("input_format,bitrate,dtx,pca", SBA_PARAMS),
    "test_encoder_const_br_stereo_dmx_evs": ("bitrate,dtx", STEREO_DMX_EVS_PARAMS),
    "test_encoder_const_br_combined_formats": (
        "input_format_ism,input_format_other,bitrate,md_type",
        COMBINED_FORMATS_PARAMS,
    ),
}

N_PARAMS = {t: n for t, n in zip(TEST_PARAMS_EXHAUSTIVE.keys(), [40] * 5)}


def pytest_generate_tests(metafunc):
    func_name = metafunc.function.__name__
    param_string = "input_format_ism,input_format_masa,bitrate,md_type"
    reduction_level = metafunc.config.getoption("reduction_level")

    if reduction_level == "exhaustive":
        param_string_fs_mb = "sampling_rate,max_band"
        fs_mb_params = get_valid_fs_max_band_pairs()
    param_string, params = TEST_PARAMS_EXHAUSTIVE[func_name]

    if metafunc.config.getoption("reduced"):
        # randomly choose lower number of parameters
        random.seed("IVAAAAS")
        param_string = ",".join([param_string, param_string_fs_mb])
        combined_params = [p[0] + p[1] for p in itertools.product(params, fs_mb_params)]
        metafunc.parametrize(
            param_string, random.sample(combined_params, N_PARAMS[func_name])
        )
    else:
        # NOTE: this excludes narrow-band modes for stereo_dmx_evs as those are not really IVAS but EVS and implementation is complicated...
        metafunc.parametrize(param_string_fs_mb, fs_mb_params)
        metafunc.parametrize(param_string, params)
        metafunc.parametrize(param_string, OMASA_PARAMS)
    elif reduction_level == "reduced":
        raise NotImplementedError()


def test_encoder_const_br_combined_formats(
def test_enc_const_br_omasa(
    input_format_ism,
    input_format_other,
    input_format_masa,
    bitrate,
    sampling_rate,
    max_band,
@@ -95,14 +62,14 @@ def test_encoder_const_br_combined_formats(
    dut_encoder_frontend,
    update_ref,
):
    input_format_combined = "OMASA" if "MASA" in input_format_other else "OSBA"
    input_format_combined = "OMASA"
    testv = get_testv_path(
        f"{input_format_combined}_{input_format_ism}_{input_format_other}",
        f"{input_format_combined}_{input_format_ism}_{input_format_masa}",
        sampling_rate,
    )
    options = get_options(
        input_format_ism,
        input_format_2=input_format_other,
        input_format_2=input_format_masa,
        max_band=max_band,
        md_type=md_type,
    )
+91 −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.
"""

from ..constants import (
    OSBA_PARAMS,
    OSBA_PARAMS_REDUCED,
    ISM_MD_EXTENDED,
    ISM_MD_NULL,
    DTX_OFF,
)
from . import get_options, run_check
from .. import get_testv_path, get_valid_fs_max_band_pairs


def pytest_generate_tests(metafunc):
    param_string = "input_format_ism,input_format_sba,bitrate,md_type"
    reduction_level = metafunc.config.getoption("reduction_level")

    if reduction_level == "exhaustive":
        param_string_fs_mb = "sampling_rate,max_band"
        fs_mb_params = get_valid_fs_max_band_pairs()
        metafunc.parametrize(param_string_fs_mb, fs_mb_params)
        metafunc.parametrize(param_string, OSBA_PARAMS)
    elif reduction_level == "reduced":
        raise NotImplementedError()


def test_enc_const_br_osba(
    input_format_ism,
    input_format_sba,
    bitrate,
    sampling_rate,
    max_band,
    md_type,
    dut_encoder_frontend,
    update_ref,
):
    input_format_combined = "OSBA"
    testv = get_testv_path(
        f"{input_format_combined}_{input_format_ism}_{input_format_sba}",
        sampling_rate,
    )
    options = get_options(
        input_format_ism,
        input_format_2=input_format_sba,
        max_band=max_band,
        md_type=md_type,
    )
    bitstream_suffix = "_basic_MD"
    if md_type == ISM_MD_EXTENDED:
        bitstream_suffix = "_ext_MD"
    elif md_type == ISM_MD_NULL:
        bitstream_suffix = "_null_MD"
    run_check(
        input_format_combined,
        bitrate,
        sampling_rate,
        testv,
        options,
        dut_encoder_frontend,
        update_ref == 1,
        DTX_OFF,
        bitstream_suffix=bitstream_suffix,
    )