Loading tests/codec_be_on_mr_selection/__init__.py +18 −4 Original line number Diff line number Diff line Loading @@ -19,14 +19,18 @@ ISM_NUM_FOR_EXP = { MASA_TESTS = ("P800-8", "P800-9", "BS1534-7a", "BS1534-7a") def get_testvectors_for_exp_cat_and_testset(experiment, category, testset): fname = f"{experiment}-{category}-{testset}-input.wav" def get_testvectors_for_exp_cat_and_testset( experiment, category, testset, input_file_num ): input_file_num_str = "" if input_file_num is None else f"-{input_file_num}" category = "-" if category == "" else f"-{category}-" fname = f"{experiment}{category}{testset}-input{input_file_num_str}.wav" signal = TESTV_PATH.joinpath(fname).absolute() # will be an empty list if not ISM experiment metadata = sorted( [ TESTV_PATH.joinpath(fname + f"{i}.csv") TESTV_PATH.joinpath(fname + f".{i}.csv") for i in range(ISM_NUM_FOR_EXP.get(experiment, 0)) ] ) Loading Loading @@ -82,18 +86,28 @@ def run_check( encoder_frontend, decoder_frontend, is_ref_creation, input_file_num=None, ): 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 experiment, category, testset, input_file_num ) error_pattern = ( get_error_pattern_for_exp_cat_and_testset(experiment, category, testset) if fer else None ) if not testv.exists(): pytest.fail(f"Testv file not found: {testv}") if error_pattern is not None and not error_pattern.exists(): pytest.fail(f"Error pattern not found: {error_pattern}") for md in metadata: if not md.exists(): pytest.fail(f"MD file not found: {md}") dut_bitstream, dut_output = get_out_bitstream_and_synthesis_name( testv, bitrate, dtx, fer ) Loading tests/codec_be_on_mr_selection/constants.py +44 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,9 @@ class ExperimentParams: P800_CATEGORIES = [f"cat{i}" for i in range(1, 7)] BS1534_CATEGORIES = [""] BS1534_MASA_CATEGORIES = ["FOA", "HOA2"] BS1534_MASA_HOA2_FILE_NUMS = [1, 3, 5, 7, 9, 11, 13, 15] BS1534_MASA_FOA_FILE_NUMS = [2, 4, 6, 8, 10, 12, 14, 16] BS1534_N_FILES = 16 P800_PARAMS = [ ExperimentParams( Loading Loading @@ -285,6 +287,33 @@ BS1534_PARAMS_MASA = [ ), ] P800_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in P800_PARAMS] for i in sl ] BS1534_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS] for i in sl ] BS1534_MASA_PARAMS = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS_MASA] for i in sl ] BS1534_MASA_PARAMS = [ x + tuple([y]) for x, y in product(BS1534_MASA_PARAMS, ["FOA", "HOA2"]) ] BS1534_MASA_PARAMS_UNIFIED = [ x + tuple([y]) for x, y in product( [p for p in BS1534_MASA_PARAMS if p[5] == "FOA"], range(2, 1 + BS1534_N_FILES, 2), ) ] + [ x + tuple([y]) for x, y in product( [p for p in BS1534_MASA_PARAMS if p[5] == "HOA2"], range(1, 1 + BS1534_N_FILES, 2), ) ] OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-1": ("STEREO", ["-stereo"]), "P800-2": ("STEREO", ["-stereo"]), Loading @@ -295,4 +324,18 @@ OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-7": ("EXT", ["-ism", "2"]), "P800-8": ("EXT", ["-masa", "2"]), "P800-9": ("EXT", ["-masa", "2"]), "BS1534-1a": ("STEREO", ["-stereo"]), "BS1534-1b": ("STEREO", ["-stereo"]), "BS1534-2a": ("5_1", ["-mc", "5_1"]), "BS1534-2b": ("5_1", ["-mc", "5_1"]), "BS1534-3a": ("7_1_4", ["-mc", "7_1_4"]), "BS1534-3b": ("7_1_4", ["-mc", "7_1_4"]), "BS1534-4a": ("HOA3", ["-sba", "1"]), "BS1534-4b": ("HOA3", ["-sba", "2"]), "BS1534-5a": ("HOA3", ["-sba", "3"]), "BS1534-5b": ("HOA3", ["-sba", "3"]), "BS1534-6a": ("EXT", ["-ism", "3"]), "BS1534-6b": ("EXT", ["-ism", "4"]), "BS1534-7a": ("EXT", ["-masa", "2"]), "BS1534-7b": ("EXT", ["-masa", "2"]), } tests/codec_be_on_mr_selection/test_experiments.py +19 −16 Original line number Diff line number Diff line import pytest from itertools import product from . import run_check from .constants import P800_CATEGORIES, BS1534_CATEGORIES, BS1534_MASA_CATEGORIES, P800_PARAMS, BS1534_PARAMS, BS1534_PARAMS_MASA P800_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in P800_PARAMS] for i in sl ] BS1534_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS] for i in sl ] BS1534_MASA_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS_MASA] for i in sl ] from .constants import ( P800_CATEGORIES, BS1534_CATEGORIES, BS1534_N_FILES, P800_PARAMS_UNIFIED, BS1534_PARAMS_UNIFIED, BS1534_MASA_PARAMS_UNIFIED, ) @pytest.mark.create_ref Loading Loading @@ -40,12 +37,11 @@ def test_p800( update_ref == 1, ) # need to split BS1534 tests as MASA tests have categories (FOA, HOA2) # otherwise, it is the exact same test @pytest.mark.create_ref @pytest.mark.parametrize("experiment,bitrate,dtx,fer,testset", BS1534_PARAMS_UNIFIED) @pytest.mark.parametrize("category", BS1534_CATEGORIES) @pytest.mark.parametrize("input_file_num", range(1, 1 + BS1534_N_FILES)) def test_bs1534_no_masa( experiment, bitrate, Loading @@ -53,6 +49,7 @@ def test_bs1534_no_masa( fer, testset, category, input_file_num, dut_encoder_frontend, dut_decoder_frontend, update_ref, Loading @@ -67,11 +64,15 @@ def test_bs1534_no_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, ) @pytest.mark.create_ref @pytest.mark.parametrize("experiment,bitrate,dtx,fer,testset", BS1534_MASA_PARAMS_UNIFIED) @pytest.mark.parametrize("category", BS1534_MASA_CATEGORIES) @pytest.mark.parametrize( "experiment,bitrate,dtx,fer,testset,category,input_file_num", BS1534_MASA_PARAMS_UNIFIED, ) def test_bs1534_masa( experiment, bitrate, Loading @@ -79,6 +80,7 @@ def test_bs1534_masa( fer, testset, category, input_file_num, dut_encoder_frontend, dut_decoder_frontend, update_ref, Loading @@ -93,4 +95,5 @@ def test_bs1534_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, ) Loading
tests/codec_be_on_mr_selection/__init__.py +18 −4 Original line number Diff line number Diff line Loading @@ -19,14 +19,18 @@ ISM_NUM_FOR_EXP = { MASA_TESTS = ("P800-8", "P800-9", "BS1534-7a", "BS1534-7a") def get_testvectors_for_exp_cat_and_testset(experiment, category, testset): fname = f"{experiment}-{category}-{testset}-input.wav" def get_testvectors_for_exp_cat_and_testset( experiment, category, testset, input_file_num ): input_file_num_str = "" if input_file_num is None else f"-{input_file_num}" category = "-" if category == "" else f"-{category}-" fname = f"{experiment}{category}{testset}-input{input_file_num_str}.wav" signal = TESTV_PATH.joinpath(fname).absolute() # will be an empty list if not ISM experiment metadata = sorted( [ TESTV_PATH.joinpath(fname + f"{i}.csv") TESTV_PATH.joinpath(fname + f".{i}.csv") for i in range(ISM_NUM_FOR_EXP.get(experiment, 0)) ] ) Loading Loading @@ -82,18 +86,28 @@ def run_check( encoder_frontend, decoder_frontend, is_ref_creation, input_file_num=None, ): 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 experiment, category, testset, input_file_num ) error_pattern = ( get_error_pattern_for_exp_cat_and_testset(experiment, category, testset) if fer else None ) if not testv.exists(): pytest.fail(f"Testv file not found: {testv}") if error_pattern is not None and not error_pattern.exists(): pytest.fail(f"Error pattern not found: {error_pattern}") for md in metadata: if not md.exists(): pytest.fail(f"MD file not found: {md}") dut_bitstream, dut_output = get_out_bitstream_and_synthesis_name( testv, bitrate, dtx, fer ) Loading
tests/codec_be_on_mr_selection/constants.py +44 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,9 @@ class ExperimentParams: P800_CATEGORIES = [f"cat{i}" for i in range(1, 7)] BS1534_CATEGORIES = [""] BS1534_MASA_CATEGORIES = ["FOA", "HOA2"] BS1534_MASA_HOA2_FILE_NUMS = [1, 3, 5, 7, 9, 11, 13, 15] BS1534_MASA_FOA_FILE_NUMS = [2, 4, 6, 8, 10, 12, 14, 16] BS1534_N_FILES = 16 P800_PARAMS = [ ExperimentParams( Loading Loading @@ -285,6 +287,33 @@ BS1534_PARAMS_MASA = [ ), ] P800_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in P800_PARAMS] for i in sl ] BS1534_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS] for i in sl ] BS1534_MASA_PARAMS = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS_MASA] for i in sl ] BS1534_MASA_PARAMS = [ x + tuple([y]) for x, y in product(BS1534_MASA_PARAMS, ["FOA", "HOA2"]) ] BS1534_MASA_PARAMS_UNIFIED = [ x + tuple([y]) for x, y in product( [p for p in BS1534_MASA_PARAMS if p[5] == "FOA"], range(2, 1 + BS1534_N_FILES, 2), ) ] + [ x + tuple([y]) for x, y in product( [p for p in BS1534_MASA_PARAMS if p[5] == "HOA2"], range(1, 1 + BS1534_N_FILES, 2), ) ] OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-1": ("STEREO", ["-stereo"]), "P800-2": ("STEREO", ["-stereo"]), Loading @@ -295,4 +324,18 @@ OUTPUT_MODES_AND_OPTIONS_FOR_EXPERIMENT = { "P800-7": ("EXT", ["-ism", "2"]), "P800-8": ("EXT", ["-masa", "2"]), "P800-9": ("EXT", ["-masa", "2"]), "BS1534-1a": ("STEREO", ["-stereo"]), "BS1534-1b": ("STEREO", ["-stereo"]), "BS1534-2a": ("5_1", ["-mc", "5_1"]), "BS1534-2b": ("5_1", ["-mc", "5_1"]), "BS1534-3a": ("7_1_4", ["-mc", "7_1_4"]), "BS1534-3b": ("7_1_4", ["-mc", "7_1_4"]), "BS1534-4a": ("HOA3", ["-sba", "1"]), "BS1534-4b": ("HOA3", ["-sba", "2"]), "BS1534-5a": ("HOA3", ["-sba", "3"]), "BS1534-5b": ("HOA3", ["-sba", "3"]), "BS1534-6a": ("EXT", ["-ism", "3"]), "BS1534-6b": ("EXT", ["-ism", "4"]), "BS1534-7a": ("EXT", ["-masa", "2"]), "BS1534-7b": ("EXT", ["-masa", "2"]), }
tests/codec_be_on_mr_selection/test_experiments.py +19 −16 Original line number Diff line number Diff line import pytest from itertools import product from . import run_check from .constants import P800_CATEGORIES, BS1534_CATEGORIES, BS1534_MASA_CATEGORIES, P800_PARAMS, BS1534_PARAMS, BS1534_PARAMS_MASA P800_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in P800_PARAMS] for i in sl ] BS1534_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS] for i in sl ] BS1534_MASA_PARAMS_UNIFIED = [ i for sl in [p.assemble_unified_params() for p in BS1534_PARAMS_MASA] for i in sl ] from .constants import ( P800_CATEGORIES, BS1534_CATEGORIES, BS1534_N_FILES, P800_PARAMS_UNIFIED, BS1534_PARAMS_UNIFIED, BS1534_MASA_PARAMS_UNIFIED, ) @pytest.mark.create_ref Loading Loading @@ -40,12 +37,11 @@ def test_p800( update_ref == 1, ) # need to split BS1534 tests as MASA tests have categories (FOA, HOA2) # otherwise, it is the exact same test @pytest.mark.create_ref @pytest.mark.parametrize("experiment,bitrate,dtx,fer,testset", BS1534_PARAMS_UNIFIED) @pytest.mark.parametrize("category", BS1534_CATEGORIES) @pytest.mark.parametrize("input_file_num", range(1, 1 + BS1534_N_FILES)) def test_bs1534_no_masa( experiment, bitrate, Loading @@ -53,6 +49,7 @@ def test_bs1534_no_masa( fer, testset, category, input_file_num, dut_encoder_frontend, dut_decoder_frontend, update_ref, Loading @@ -67,11 +64,15 @@ def test_bs1534_no_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, ) @pytest.mark.create_ref @pytest.mark.parametrize("experiment,bitrate,dtx,fer,testset", BS1534_MASA_PARAMS_UNIFIED) @pytest.mark.parametrize("category", BS1534_MASA_CATEGORIES) @pytest.mark.parametrize( "experiment,bitrate,dtx,fer,testset,category,input_file_num", BS1534_MASA_PARAMS_UNIFIED, ) def test_bs1534_masa( experiment, bitrate, Loading @@ -79,6 +80,7 @@ def test_bs1534_masa( fer, testset, category, input_file_num, dut_encoder_frontend, dut_decoder_frontend, update_ref, Loading @@ -93,4 +95,5 @@ def test_bs1534_masa( dut_encoder_frontend, dut_decoder_frontend, update_ref == 1, input_file_num=input_file_num, )