Loading tests/codec_be_to_accepted_release/__init__.py +9 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ the United Nations Convention on Contracts on the International Sales of Goods. import filecmp import subprocess from typing import Union from pathlib import Path from itertools import product from ..testconfig import MD5_REF_DICT from .constants import ( Loading Loading @@ -61,13 +63,18 @@ def get_bitstream_path( base_path, testv_name, encoder_format, bitrate, bitrate: Union[int, Path], sampling_rate, max_band, dtx, suffix="", ): bs_name = f"{testv_name}-{encoder_format}-{bitrate}kbps-{sampling_rate}kHz-max_band_{max_band}-{dtx}{suffix}.192" bitrate_str = f"{bitrate}kbps" if isinstance(bitrate, Path): # br switching file path given bitrate_str = f"BRswfile_{bitrate.name}" bs_name = f"{testv_name}-{encoder_format}-{bitrate_str}-{sampling_rate}kHz-max_band_{max_band}-{dtx}{suffix}.192" return base_path.joinpath(bs_name) Loading tests/codec_be_to_accepted_release/constants.py +22 −12 Original line number Diff line number Diff line Loading @@ -49,12 +49,13 @@ def bitrates_between(lowest, highest): return [b for b in BITRATES_ALL if b >= lowest and b <= highest] def get_file_from_repo(path): def get_file_from_repo(path, to_str=True): """ 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)) filepath = repo_root.joinpath(path) return str(filepath) if to_str else filepath DTX_ON = "DTXon" Loading Loading @@ -205,6 +206,11 @@ BITRATES_ISM3_EXTENDED = [b for b in BITRATES_ISM3 if b > 64000] BITRATES_ISM4_EXTENDED = [b for b in BITRATES_ISM4 if b > 64000] BITRATES_EVS = [5900, 7200, 8000, 9600] + BITRATES_ALL[:6] + BITRATES_ALL[7:9] ### Bitrate switching files BR_SW_FILE_STEREO = get_file_from_repo( "scripts/switchPaths/sw_13k2_128k.bin", to_str=False ) SAMPLING_RATES_ALL = [16, 32, 48] MAX_BAND_ALL = ["WB", "SWB", "FB"] Loading Loading @@ -424,19 +430,23 @@ DECODER_CONST_BR_NO_BINAURAL_SCENEBASED = collapse_into_list_of_pairs( ) ) DECODER_CONST_BR_NO_BINAURAL_COMBINED_PARAMS = collapse_into_list_of_pairs( list( product( OSBA_PARAMS, OUTPUT_FORMATS_NON_BINAURAL[:-1], # no EXT here SAMPLING_RATES_ALL, BITSTREAM_PROCESSING, ) + product( ) + list( product( OMASA_PARAMS, OUTPUT_FORMATS_NON_BINAURAL, SAMPLING_RATES_ALL, BITSTREAM_PROCESSING, ) ) ) # parameters for const bitrate testcases with binaural output Loading tests/codec_be_to_accepted_release/encoder/__init__.py +4 −6 Original line number Diff line number Diff line Loading @@ -109,10 +109,7 @@ def get_md(input_format, md_type=None): def get_options(input_format_1, input_format_2=None, max_band=None, md_type=None): print(input_format_1) options = list(CMDL_OPTIONS_FOR_INPUT_FORMAT[input_format_1]) print(options) if md_type == ISM_MD_EXTENDED: assert input_format_1 in INPUT_FORMATS_OBJECT_BASED Loading @@ -130,7 +127,9 @@ def get_options(input_format_1, input_format_2=None, max_band=None, md_type=None elif input_format_2 in INPUT_FORMATS_MASA: input_format_combined = "OMASA" options_combined = list(CMDL_OPTIONS_FOR_INPUT_FORMAT.get(input_format_combined, list())) options_combined = list( CMDL_OPTIONS_FOR_INPUT_FORMAT.get(input_format_combined, list()) ) # add MASA MD files for OMASA modes md_options += get_md(input_format_2) Loading Loading @@ -176,7 +175,6 @@ def run_check( dtx, suffix=bitstream_suffix, ) print(options) encoder_frontend.run( bitrate, sampling_rate, Loading tests/codec_be_to_accepted_release/encoder/test_encoder_bitrate_switching.py +11 −11 Original line number Diff line number Diff line Loading @@ -34,26 +34,26 @@ from . import get_options, run_check, create_br_switching_file from .. import get_testv_path, get_bitstream_path @pytest.mark.skip("not ready, comitted by accident") @pytest.mark.parametrize( "input_format,bitrate,sampling_rate,dtx", ENCODER_CHANNEL_BASED_AND_MASA_PARAMS ) def test_encoder_br_switching_channel_based_and_masa_modes( input_format, bitrate, @pytest.mark.parametrize("sampling_rate", SAMPLING_RATES_ALL) @pytest.mark.parametrize("max_band", MAX_BAND_ALL) @pytest.mark.parametrize("dtx", [DTX_OFF, DTX_ON]) def test_encoder_br_switching_stereo( sampling_rate, max_band, dtx, dut_encoder_frontend, update_ref, ): input_format = "STEREO" testv = get_testv_path(input_format, sampling_rate) options = get_options(input_format) options = get_options(input_format, max_band=max_band) br_sw_file = BR_SW_FILE_STEREO bitstream = get_bitstream_path( DUT_PATH, testv.stem, input_format, bitrate, sampling_rate, dtx DUT_PATH, testv.stem, input_format, br_sw_file, sampling_rate, max_band, dtx ) run_check( bitstream, bitrate, input_format, br_sw_file, sampling_rate, testv, options, Loading tests/codec_be_to_accepted_release/encoder/test_encoder_constant_bitrate.py +6 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,6 @@ 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_fs_mb = "sampling_rate,max_band" fs_mb_params = get_valid_fs_max_band_pairs() Loading Loading @@ -202,7 +201,12 @@ def test_encoder_const_br_combined_formats( f"{input_format_combined}_{input_format_ism}_{input_format_other}", sampling_rate, ) options = get_options(input_format_ism, input_format_2=input_format_other, max_band=max_band, md_type=md_type) options = get_options( input_format_ism, input_format_2=input_format_other, max_band=max_band, md_type=md_type, ) bitstream_suffix = "_basic_MD" if md_type == ISM_MD_EXTENDED: bitstream_suffix = "_ext_MD" Loading Loading
tests/codec_be_to_accepted_release/__init__.py +9 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ the United Nations Convention on Contracts on the International Sales of Goods. import filecmp import subprocess from typing import Union from pathlib import Path from itertools import product from ..testconfig import MD5_REF_DICT from .constants import ( Loading Loading @@ -61,13 +63,18 @@ def get_bitstream_path( base_path, testv_name, encoder_format, bitrate, bitrate: Union[int, Path], sampling_rate, max_band, dtx, suffix="", ): bs_name = f"{testv_name}-{encoder_format}-{bitrate}kbps-{sampling_rate}kHz-max_band_{max_band}-{dtx}{suffix}.192" bitrate_str = f"{bitrate}kbps" if isinstance(bitrate, Path): # br switching file path given bitrate_str = f"BRswfile_{bitrate.name}" bs_name = f"{testv_name}-{encoder_format}-{bitrate_str}-{sampling_rate}kHz-max_band_{max_band}-{dtx}{suffix}.192" return base_path.joinpath(bs_name) Loading
tests/codec_be_to_accepted_release/constants.py +22 −12 Original line number Diff line number Diff line Loading @@ -49,12 +49,13 @@ def bitrates_between(lowest, highest): return [b for b in BITRATES_ALL if b >= lowest and b <= highest] def get_file_from_repo(path): def get_file_from_repo(path, to_str=True): """ 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)) filepath = repo_root.joinpath(path) return str(filepath) if to_str else filepath DTX_ON = "DTXon" Loading Loading @@ -205,6 +206,11 @@ BITRATES_ISM3_EXTENDED = [b for b in BITRATES_ISM3 if b > 64000] BITRATES_ISM4_EXTENDED = [b for b in BITRATES_ISM4 if b > 64000] BITRATES_EVS = [5900, 7200, 8000, 9600] + BITRATES_ALL[:6] + BITRATES_ALL[7:9] ### Bitrate switching files BR_SW_FILE_STEREO = get_file_from_repo( "scripts/switchPaths/sw_13k2_128k.bin", to_str=False ) SAMPLING_RATES_ALL = [16, 32, 48] MAX_BAND_ALL = ["WB", "SWB", "FB"] Loading Loading @@ -424,19 +430,23 @@ DECODER_CONST_BR_NO_BINAURAL_SCENEBASED = collapse_into_list_of_pairs( ) ) DECODER_CONST_BR_NO_BINAURAL_COMBINED_PARAMS = collapse_into_list_of_pairs( list( product( OSBA_PARAMS, OUTPUT_FORMATS_NON_BINAURAL[:-1], # no EXT here SAMPLING_RATES_ALL, BITSTREAM_PROCESSING, ) + product( ) + list( product( OMASA_PARAMS, OUTPUT_FORMATS_NON_BINAURAL, SAMPLING_RATES_ALL, BITSTREAM_PROCESSING, ) ) ) # parameters for const bitrate testcases with binaural output Loading
tests/codec_be_to_accepted_release/encoder/__init__.py +4 −6 Original line number Diff line number Diff line Loading @@ -109,10 +109,7 @@ def get_md(input_format, md_type=None): def get_options(input_format_1, input_format_2=None, max_band=None, md_type=None): print(input_format_1) options = list(CMDL_OPTIONS_FOR_INPUT_FORMAT[input_format_1]) print(options) if md_type == ISM_MD_EXTENDED: assert input_format_1 in INPUT_FORMATS_OBJECT_BASED Loading @@ -130,7 +127,9 @@ def get_options(input_format_1, input_format_2=None, max_band=None, md_type=None elif input_format_2 in INPUT_FORMATS_MASA: input_format_combined = "OMASA" options_combined = list(CMDL_OPTIONS_FOR_INPUT_FORMAT.get(input_format_combined, list())) options_combined = list( CMDL_OPTIONS_FOR_INPUT_FORMAT.get(input_format_combined, list()) ) # add MASA MD files for OMASA modes md_options += get_md(input_format_2) Loading Loading @@ -176,7 +175,6 @@ def run_check( dtx, suffix=bitstream_suffix, ) print(options) encoder_frontend.run( bitrate, sampling_rate, Loading
tests/codec_be_to_accepted_release/encoder/test_encoder_bitrate_switching.py +11 −11 Original line number Diff line number Diff line Loading @@ -34,26 +34,26 @@ from . import get_options, run_check, create_br_switching_file from .. import get_testv_path, get_bitstream_path @pytest.mark.skip("not ready, comitted by accident") @pytest.mark.parametrize( "input_format,bitrate,sampling_rate,dtx", ENCODER_CHANNEL_BASED_AND_MASA_PARAMS ) def test_encoder_br_switching_channel_based_and_masa_modes( input_format, bitrate, @pytest.mark.parametrize("sampling_rate", SAMPLING_RATES_ALL) @pytest.mark.parametrize("max_band", MAX_BAND_ALL) @pytest.mark.parametrize("dtx", [DTX_OFF, DTX_ON]) def test_encoder_br_switching_stereo( sampling_rate, max_band, dtx, dut_encoder_frontend, update_ref, ): input_format = "STEREO" testv = get_testv_path(input_format, sampling_rate) options = get_options(input_format) options = get_options(input_format, max_band=max_band) br_sw_file = BR_SW_FILE_STEREO bitstream = get_bitstream_path( DUT_PATH, testv.stem, input_format, bitrate, sampling_rate, dtx DUT_PATH, testv.stem, input_format, br_sw_file, sampling_rate, max_band, dtx ) run_check( bitstream, bitrate, input_format, br_sw_file, sampling_rate, testv, options, Loading
tests/codec_be_to_accepted_release/encoder/test_encoder_constant_bitrate.py +6 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,6 @@ 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_fs_mb = "sampling_rate,max_band" fs_mb_params = get_valid_fs_max_band_pairs() Loading Loading @@ -202,7 +201,12 @@ def test_encoder_const_br_combined_formats( f"{input_format_combined}_{input_format_ism}_{input_format_other}", sampling_rate, ) options = get_options(input_format_ism, input_format_2=input_format_other, max_band=max_band, md_type=md_type) options = get_options( input_format_ism, input_format_2=input_format_other, max_band=max_band, md_type=md_type, ) bitstream_suffix = "_basic_MD" if md_type == ISM_MD_EXTENDED: bitstream_suffix = "_ext_MD" Loading