Loading tests/codec_be_on_mr_selection/__init__.py +49 −5 Original line number Diff line number Diff line import tempfile import pytest import filecmp from pathlib import Path import subprocess from .constants import TESTV_PATH, REF_PATH, DUT_PATH from .constants import OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT HERE = Path(__file__).parent TESTV_PATH = HERE.joinpath("testv") REF_PATH = HERE.joinpath("ref") DUT_PATH = HERE.joinpath("dut") def get_testvector_for_exp_cat_and_testset(experiment, category, testset): ISM_NUM_FOR_EXP = { "P800-6": 1, "P800-7": 2, "BS1534-6a": 3, "BS1534-6b": 4, } MASA_TESTS = ("P800-8", "P800-9", "BS1534-7a", "BS1534-7a") def get_testvectors_for_exp_cat_and_testset(experiment, category, testset): fname = f"{experiment}-cat{category}-{testset}-input.wav" return TESTV_PATH.joinpath(fname).absolute() signal = TESTV_PATH.joinpath(fname).absolute() # will be an empty list if not ISM experiment metadata = sorted([TESTV_PATH.joinpath(fname + f"{i}.csv") for i in range(ISM_NUM_FOR_EXP.get(experiment, 0))]) if experiment in MASA_TESTS: metadata.append(TESTV_PATH.joinpath(fname + ".met")) return signal, metadata def get_out_bitstream_and_synthesis_name(input_signal, bitrate, dtx, fer): dtx_str = "DTXon" if dtx else "DTXoff" fer_str = "FER_5perc" if fer else "FER_0perc" suffix = [".192", ".wav"] return [DUT_PATH.joinpath(f"{input_signal.name}-{bitrate}bps-{dtx_str}-{fer_str}{s}") for s in suffix] return [DUT_PATH.joinpath(f"{input_signal.stem}-{bitrate}bps-{dtx_str}-{fer_str}{s}") for s in suffix] def get_error_pattern_for_exp_cat_and_testset(experiment, category, testset): Loading @@ -39,3 +59,27 @@ def is_be_to_reference(dut_file: Path): # TODO: handle .wav files differently ref_file = REF_PATH.joinpath(dut_file.name) return filecmp.cmp(ref_file, dut_file) def run_check(experiment, category, testset, bitrate, dtx, fer, encoder_frontend, decoder_frontend, is_ref_creation): sampling_rate = 48 output_mode, options = OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT[experiment] testv, metadata = get_testvectors_for_exp_cat_and_testset(experiment, category, testset) error_pattern = get_error_pattern_for_exp_cat_and_testset(experiment, category, testset) if fer else None dut_bitstream, dut_output = get_out_bitstream_and_synthesis_name(testv, bitrate, dtx, fer) options.extend(metadata) encoder_frontend.run(bitrate, sampling_rate, testv, dut_bitstream, dtx_mode=dtx, add_option_list=options) if not is_ref_creation and not is_be_to_reference(dut_bitstream): pytest.fail("Bitstream file differs from reference") if error_pattern is not None: apply_error_pattern_on_bitstream(dut_bitstream, error_pattern, dut_bitstream) decoder_frontend.run(output_mode, sampling_rate, dut_bitstream, dut_output) # TODO: also compare metadata if present if not is_ref_creation and not is_be_to_reference(dut_output): pytest.fail("Decoder output differs from reference") No newline at end of file tests/codec_be_on_mr_selection/constants.py +200 −6 Original line number Diff line number Diff line from pathlib import Path from itertools import product from typing import Union, List HERE = Path(__file__).parent TESTV_PATH = HERE.joinpath("testv") REF_PATH = HERE.joinpath("ref") DUT_PATH = HERE.joinpath("dut") def zip_with_check(*args): """ Like normal zip, but raises error if given iterables have different lengths. Used here to avoid forgetting a bitrate or so. """ lengths = [len(it) for it in args] assert len(set(lengths)) == 1 SAMPLING_RATE = 48 No newline at end of file return zip(*args) def assemble_unified_params_for_experiment(experiment, params, testset): return [(experiment, *p, t) for p, t in product(params, testset)] class ExperimentParams(): def __init__(self, name: str, n_conditions: int, bitrates: List[int], testsets: List[str], dtx: Union[List[bool], bool] = False, fer: Union[List[bool], bool] = False): dtx = n_conditions * [dtx] if isinstance(dtx, bool) else dtx fer = n_conditions * [fer] if isinstance(fer, bool) else fer assert len(bitrates) == n_conditions and len(testsets) == 2 and len(dtx) == n_conditions and len(fer) == n_conditions self.name = name self.bitrates = bitrates self.testsets = testsets self.dtx = dtx self.fer = fer def assemble_unified_params(self): params = zip(self.bitrates, self.dtx, self.fer) return [(self.name, *p, t) for p, t in product(params, self.testsets)] P800_CATEGORIES = range(1, 7) EXPERIMENT_PARAMS = [ ExperimentParams( name="P800-1", n_conditions=12, bitrates=[13200, 16400, 24400, 32000, 48000, 13200, 16400, 24400, 32000, 48000, 24400, 13200], dtx=10 * [False] + 2 * [True], fer=5 * [False] + 5 * [True] + [False, True], testsets=["a", "d"] ), ExperimentParams( name="P800-2", n_conditions=11, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 48000], dtx=6 * [False] + 5 * [True], testsets=["b", "d"] ), ExperimentParams( name="P800-3", n_conditions=13, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 48000, 24400, 13200], dtx=11 * [False] + 2 * [True], fer=6 * [False] + 5 * [True] + [False, True], testsets=["a", "d"] ), ExperimentParams( name="P800-4", n_conditions=13, bitrates=[16400, 24400, 32000, 48000, 64000, 80000, 96000, 24400, 32000, 48000, 64000, 80000, 96000], fer=7 * [False] + 6 * [True], testsets=["a", "c"] ), ExperimentParams( name="P800-5", n_conditions=13, bitrates=[16400, 24400, 32000, 48000, 64000, 80000, 96000, 16400, 24400, 32000, 48000, 64000, 80000], dtx=7 * [False] + 6 * [True], testsets=["a", "b"] ), ExperimentParams( name="P800-6", n_conditions=13, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 13200, 16400, 24400], dtx=10 * [False] + 3 * [True], fer=6 * [False] + 4 * [True] + 3 * [False], testsets=["a", "c"] ), ExperimentParams( name="P800-7", n_conditions=13, bitrates=[16400, 24400, 32000, 48000, 64000, 16400, 24400, 32000, 48000, 16400, 24400, 32000, 48000], dtx=9 * [False] + 4 * [True], fer=5 * [False] + 4 * [True] + 4 * [False], testsets=["a", "d"] ), ExperimentParams( name="P800-8", n_conditions=12, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 80000, 13200, 16400, 24400, 48000, 64000], fer=7 * [False] + 5 * [True], testsets=["a", "b"] ), ExperimentParams( name="P800-9", n_conditions=13, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 80000, 13200, 16400, 24400, 32000, 48000, 64000], dtx=7 * [False] + 6 * [True], testsets=["a", "d"] ), ExperimentParams( name="BS1534-1a", n_conditions=2, bitrates=[48000, 64000], testsets=["a", "d"] ), ExperimentParams( name="BS1534-1b", n_conditions=2, bitrates=[96000, 128000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-2a", n_conditions=2, bitrates=[64000, 96000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-2b", n_conditions=2, bitrates=[128000, 160000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-3a", n_conditions=2, bitrates=[128000, 160000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-3b", n_conditions=2, bitrates=[384000, 512000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-4a", n_conditions=3, bitrates=[96000, 128000, 160000], testsets=["a", "d"] ), ExperimentParams( name="BS1534-4b", n_conditions=2, bitrates=[160000, 192000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-5a", n_conditions=2, bitrates=[192000, 256000], testsets=["a", "d"] ), ExperimentParams( name="BS1534-5b", n_conditions=2, bitrates=[384000, 512000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-6a", n_conditions=3, bitrates=[48000, 64000, 96000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-6b", n_conditions=3, bitrates=[96000, 128000, 256000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-7a", n_conditions=2, bitrates=[96000, 128000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-7b", n_conditions=2, bitrates=[192000, 256000], testsets=["b", "d"] ), ] OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-1": ("STEREO", ["-stereo"]), "P800-2": ("STEREO", ["-stereo"]), "P800-3": ("STEREO", ["-stereo"]), "P800-4": ("FOA", ["-sba", "1"]), "P800-5": ("FOA", ["-sba", "1"]), "P800-6": ("EXT", ["-ism", "1"]), "P800-7": ("EXT", ["-ism", "2"]), "P800-8": ("EXT", ["-masa", "2"]), "P800-9": ("EXT", ["-masa", "2"]), } tests/codec_be_on_mr_selection/test_experiments.py +6 −46 Original line number Diff line number Diff line import pytest from . import get_testvector_for_exp_cat_and_testset, get_out_bitstream_and_synthesis_name, apply_error_pattern_on_bitstream, get_error_pattern_for_exp_cat_and_testset, is_be_to_reference from . import run_check from .constants import EXPERIMENT_PARAMS, P800_CATEGORIES P800_CATEGORIES = range(1, 3) P800_1_BITRATES = [13200, 16400, 24400, 32000, 48000, 13200, 16400, 24400, 32000, 48000, 24400, 13200] P800_1_DTX = 10 * [False] + 2 * [True] P800_1_FER = 5 * [False] + 5 * [True] + [False, True] # TODO: use correct range P800_1_TESTSETS = ["a", "d"] P800_1_PARAMS = zip(P800_1_BITRATES, P800_1_DTX, P800_1_FER) P800_2_BITRATES = [13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 48000] P800_2_DTX = 6 * [False] + 5 * [False] P800_2_TESTSETS = ["b", "d"] P800_2_PARAMS = list(zip(P800_2_BITRATES, P800_2_DTX)) OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-1": ("STEREO", ["-stereo"]), "P800-2": ("STEREO", ["-stereo"]), } def run_check(experiment, category, testset, bitrate, dtx, fer, encoder_frontend, decoder_frontend, is_ref_creation): sampling_rate = 48 output_mode, options = OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT[experiment] testv = get_testvector_for_exp_cat_and_testset(experiment, category, testset) error_pattern = get_error_pattern_for_exp_cat_and_testset(experiment, category, testset) if fer else None dut_bitstream, dut_output = get_out_bitstream_and_synthesis_name(testv, bitrate, dtx, fer) encoder_frontend.run(bitrate, sampling_rate, testv, dut_bitstream, dtx_mode=dtx, add_option_list=options) if not is_ref_creation and not is_be_to_reference(dut_bitstream): pytest.fail("Bitstream file differs from reference") if error_pattern is not None: apply_error_pattern_on_bitstream(dut_bitstream, error_pattern, dut_bitstream) decoder_frontend.run(output_mode, sampling_rate, dut_bitstream, dut_output) # TODO: also compare metadata if present if not is_ref_creation and not is_be_to_reference(dut_output): pytest.fail("Decoder output differs from reference") P800_PARAMS_UNIFIED = [i for sl in [p.assemble_unified_params() for p in EXPERIMENT_PARAMS] for i in sl] @pytest.mark.create_ref @pytest.mark.parametrize("bitrate,dtx,fer", P800_1_PARAMS) @pytest.mark.parametrize("experiment,bitrate,dtx,fer,testset", P800_PARAMS_UNIFIED) @pytest.mark.parametrize("category", P800_CATEGORIES) @pytest.mark.parametrize("testset", P800_1_TESTSETS) def test_p800_1(bitrate, dtx, fer, category, testset, dut_encoder_frontend, dut_decoder_frontend, update_ref): experiment = "P800-1" def test_experiment(experiment, bitrate, dtx, fer, testset, category, dut_encoder_frontend, dut_decoder_frontend, update_ref): run_check(experiment, category, testset, bitrate, dtx, fer, dut_encoder_frontend, dut_decoder_frontend, update_ref == 1) Loading
tests/codec_be_on_mr_selection/__init__.py +49 −5 Original line number Diff line number Diff line import tempfile import pytest import filecmp from pathlib import Path import subprocess from .constants import TESTV_PATH, REF_PATH, DUT_PATH from .constants import OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT HERE = Path(__file__).parent TESTV_PATH = HERE.joinpath("testv") REF_PATH = HERE.joinpath("ref") DUT_PATH = HERE.joinpath("dut") def get_testvector_for_exp_cat_and_testset(experiment, category, testset): ISM_NUM_FOR_EXP = { "P800-6": 1, "P800-7": 2, "BS1534-6a": 3, "BS1534-6b": 4, } MASA_TESTS = ("P800-8", "P800-9", "BS1534-7a", "BS1534-7a") def get_testvectors_for_exp_cat_and_testset(experiment, category, testset): fname = f"{experiment}-cat{category}-{testset}-input.wav" return TESTV_PATH.joinpath(fname).absolute() signal = TESTV_PATH.joinpath(fname).absolute() # will be an empty list if not ISM experiment metadata = sorted([TESTV_PATH.joinpath(fname + f"{i}.csv") for i in range(ISM_NUM_FOR_EXP.get(experiment, 0))]) if experiment in MASA_TESTS: metadata.append(TESTV_PATH.joinpath(fname + ".met")) return signal, metadata def get_out_bitstream_and_synthesis_name(input_signal, bitrate, dtx, fer): dtx_str = "DTXon" if dtx else "DTXoff" fer_str = "FER_5perc" if fer else "FER_0perc" suffix = [".192", ".wav"] return [DUT_PATH.joinpath(f"{input_signal.name}-{bitrate}bps-{dtx_str}-{fer_str}{s}") for s in suffix] return [DUT_PATH.joinpath(f"{input_signal.stem}-{bitrate}bps-{dtx_str}-{fer_str}{s}") for s in suffix] def get_error_pattern_for_exp_cat_and_testset(experiment, category, testset): Loading @@ -39,3 +59,27 @@ def is_be_to_reference(dut_file: Path): # TODO: handle .wav files differently ref_file = REF_PATH.joinpath(dut_file.name) return filecmp.cmp(ref_file, dut_file) def run_check(experiment, category, testset, bitrate, dtx, fer, encoder_frontend, decoder_frontend, is_ref_creation): sampling_rate = 48 output_mode, options = OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT[experiment] testv, metadata = get_testvectors_for_exp_cat_and_testset(experiment, category, testset) error_pattern = get_error_pattern_for_exp_cat_and_testset(experiment, category, testset) if fer else None dut_bitstream, dut_output = get_out_bitstream_and_synthesis_name(testv, bitrate, dtx, fer) options.extend(metadata) encoder_frontend.run(bitrate, sampling_rate, testv, dut_bitstream, dtx_mode=dtx, add_option_list=options) if not is_ref_creation and not is_be_to_reference(dut_bitstream): pytest.fail("Bitstream file differs from reference") if error_pattern is not None: apply_error_pattern_on_bitstream(dut_bitstream, error_pattern, dut_bitstream) decoder_frontend.run(output_mode, sampling_rate, dut_bitstream, dut_output) # TODO: also compare metadata if present if not is_ref_creation and not is_be_to_reference(dut_output): pytest.fail("Decoder output differs from reference") No newline at end of file
tests/codec_be_on_mr_selection/constants.py +200 −6 Original line number Diff line number Diff line from pathlib import Path from itertools import product from typing import Union, List HERE = Path(__file__).parent TESTV_PATH = HERE.joinpath("testv") REF_PATH = HERE.joinpath("ref") DUT_PATH = HERE.joinpath("dut") def zip_with_check(*args): """ Like normal zip, but raises error if given iterables have different lengths. Used here to avoid forgetting a bitrate or so. """ lengths = [len(it) for it in args] assert len(set(lengths)) == 1 SAMPLING_RATE = 48 No newline at end of file return zip(*args) def assemble_unified_params_for_experiment(experiment, params, testset): return [(experiment, *p, t) for p, t in product(params, testset)] class ExperimentParams(): def __init__(self, name: str, n_conditions: int, bitrates: List[int], testsets: List[str], dtx: Union[List[bool], bool] = False, fer: Union[List[bool], bool] = False): dtx = n_conditions * [dtx] if isinstance(dtx, bool) else dtx fer = n_conditions * [fer] if isinstance(fer, bool) else fer assert len(bitrates) == n_conditions and len(testsets) == 2 and len(dtx) == n_conditions and len(fer) == n_conditions self.name = name self.bitrates = bitrates self.testsets = testsets self.dtx = dtx self.fer = fer def assemble_unified_params(self): params = zip(self.bitrates, self.dtx, self.fer) return [(self.name, *p, t) for p, t in product(params, self.testsets)] P800_CATEGORIES = range(1, 7) EXPERIMENT_PARAMS = [ ExperimentParams( name="P800-1", n_conditions=12, bitrates=[13200, 16400, 24400, 32000, 48000, 13200, 16400, 24400, 32000, 48000, 24400, 13200], dtx=10 * [False] + 2 * [True], fer=5 * [False] + 5 * [True] + [False, True], testsets=["a", "d"] ), ExperimentParams( name="P800-2", n_conditions=11, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 48000], dtx=6 * [False] + 5 * [True], testsets=["b", "d"] ), ExperimentParams( name="P800-3", n_conditions=13, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 48000, 24400, 13200], dtx=11 * [False] + 2 * [True], fer=6 * [False] + 5 * [True] + [False, True], testsets=["a", "d"] ), ExperimentParams( name="P800-4", n_conditions=13, bitrates=[16400, 24400, 32000, 48000, 64000, 80000, 96000, 24400, 32000, 48000, 64000, 80000, 96000], fer=7 * [False] + 6 * [True], testsets=["a", "c"] ), ExperimentParams( name="P800-5", n_conditions=13, bitrates=[16400, 24400, 32000, 48000, 64000, 80000, 96000, 16400, 24400, 32000, 48000, 64000, 80000], dtx=7 * [False] + 6 * [True], testsets=["a", "b"] ), ExperimentParams( name="P800-6", n_conditions=13, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 13200, 16400, 24400], dtx=10 * [False] + 3 * [True], fer=6 * [False] + 4 * [True] + 3 * [False], testsets=["a", "c"] ), ExperimentParams( name="P800-7", n_conditions=13, bitrates=[16400, 24400, 32000, 48000, 64000, 16400, 24400, 32000, 48000, 16400, 24400, 32000, 48000], dtx=9 * [False] + 4 * [True], fer=5 * [False] + 4 * [True] + 4 * [False], testsets=["a", "d"] ), ExperimentParams( name="P800-8", n_conditions=12, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 80000, 13200, 16400, 24400, 48000, 64000], fer=7 * [False] + 5 * [True], testsets=["a", "b"] ), ExperimentParams( name="P800-9", n_conditions=13, bitrates=[13200, 16400, 24400, 32000, 48000, 64000, 80000, 13200, 16400, 24400, 32000, 48000, 64000], dtx=7 * [False] + 6 * [True], testsets=["a", "d"] ), ExperimentParams( name="BS1534-1a", n_conditions=2, bitrates=[48000, 64000], testsets=["a", "d"] ), ExperimentParams( name="BS1534-1b", n_conditions=2, bitrates=[96000, 128000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-2a", n_conditions=2, bitrates=[64000, 96000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-2b", n_conditions=2, bitrates=[128000, 160000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-3a", n_conditions=2, bitrates=[128000, 160000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-3b", n_conditions=2, bitrates=[384000, 512000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-4a", n_conditions=3, bitrates=[96000, 128000, 160000], testsets=["a", "d"] ), ExperimentParams( name="BS1534-4b", n_conditions=2, bitrates=[160000, 192000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-5a", n_conditions=2, bitrates=[192000, 256000], testsets=["a", "d"] ), ExperimentParams( name="BS1534-5b", n_conditions=2, bitrates=[384000, 512000], testsets=["a", "b"] ), ExperimentParams( name="BS1534-6a", n_conditions=3, bitrates=[48000, 64000, 96000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-6b", n_conditions=3, bitrates=[96000, 128000, 256000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-7a", n_conditions=2, bitrates=[96000, 128000], testsets=["b", "d"] ), ExperimentParams( name="BS1534-7b", n_conditions=2, bitrates=[192000, 256000], testsets=["b", "d"] ), ] OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-1": ("STEREO", ["-stereo"]), "P800-2": ("STEREO", ["-stereo"]), "P800-3": ("STEREO", ["-stereo"]), "P800-4": ("FOA", ["-sba", "1"]), "P800-5": ("FOA", ["-sba", "1"]), "P800-6": ("EXT", ["-ism", "1"]), "P800-7": ("EXT", ["-ism", "2"]), "P800-8": ("EXT", ["-masa", "2"]), "P800-9": ("EXT", ["-masa", "2"]), }
tests/codec_be_on_mr_selection/test_experiments.py +6 −46 Original line number Diff line number Diff line import pytest from . import get_testvector_for_exp_cat_and_testset, get_out_bitstream_and_synthesis_name, apply_error_pattern_on_bitstream, get_error_pattern_for_exp_cat_and_testset, is_be_to_reference from . import run_check from .constants import EXPERIMENT_PARAMS, P800_CATEGORIES P800_CATEGORIES = range(1, 3) P800_1_BITRATES = [13200, 16400, 24400, 32000, 48000, 13200, 16400, 24400, 32000, 48000, 24400, 13200] P800_1_DTX = 10 * [False] + 2 * [True] P800_1_FER = 5 * [False] + 5 * [True] + [False, True] # TODO: use correct range P800_1_TESTSETS = ["a", "d"] P800_1_PARAMS = zip(P800_1_BITRATES, P800_1_DTX, P800_1_FER) P800_2_BITRATES = [13200, 16400, 24400, 32000, 48000, 64000, 13200, 16400, 24400, 32000, 48000] P800_2_DTX = 6 * [False] + 5 * [False] P800_2_TESTSETS = ["b", "d"] P800_2_PARAMS = list(zip(P800_2_BITRATES, P800_2_DTX)) OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-1": ("STEREO", ["-stereo"]), "P800-2": ("STEREO", ["-stereo"]), } def run_check(experiment, category, testset, bitrate, dtx, fer, encoder_frontend, decoder_frontend, is_ref_creation): sampling_rate = 48 output_mode, options = OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT[experiment] testv = get_testvector_for_exp_cat_and_testset(experiment, category, testset) error_pattern = get_error_pattern_for_exp_cat_and_testset(experiment, category, testset) if fer else None dut_bitstream, dut_output = get_out_bitstream_and_synthesis_name(testv, bitrate, dtx, fer) encoder_frontend.run(bitrate, sampling_rate, testv, dut_bitstream, dtx_mode=dtx, add_option_list=options) if not is_ref_creation and not is_be_to_reference(dut_bitstream): pytest.fail("Bitstream file differs from reference") if error_pattern is not None: apply_error_pattern_on_bitstream(dut_bitstream, error_pattern, dut_bitstream) decoder_frontend.run(output_mode, sampling_rate, dut_bitstream, dut_output) # TODO: also compare metadata if present if not is_ref_creation and not is_be_to_reference(dut_output): pytest.fail("Decoder output differs from reference") P800_PARAMS_UNIFIED = [i for sl in [p.assemble_unified_params() for p in EXPERIMENT_PARAMS] for i in sl] @pytest.mark.create_ref @pytest.mark.parametrize("bitrate,dtx,fer", P800_1_PARAMS) @pytest.mark.parametrize("experiment,bitrate,dtx,fer,testset", P800_PARAMS_UNIFIED) @pytest.mark.parametrize("category", P800_CATEGORIES) @pytest.mark.parametrize("testset", P800_1_TESTSETS) def test_p800_1(bitrate, dtx, fer, category, testset, dut_encoder_frontend, dut_decoder_frontend, update_ref): experiment = "P800-1" def test_experiment(experiment, bitrate, dtx, fer, testset, category, dut_encoder_frontend, dut_decoder_frontend, update_ref): run_check(experiment, category, testset, bitrate, dtx, fer, dut_encoder_frontend, dut_decoder_frontend, update_ref == 1)