Loading tests/codec_be_on_mr_nonselection/test_param_file.py +158 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ from tests.constants import ( SCRIPTS_DIR, MAX_ENC_DIFF, ) import tests.renderer.utils as rend PASSTHROUGH_CONF = [ (r"[\s\S]*", "EXT"), # Any input with EXT output is pass-through Loading Loading @@ -82,6 +83,47 @@ VALID_DEC_OUTPUT_CONF = [ "EXT", ] INPUT_FMT = [ (r"-stereo", "STEREO"), (r"-sba\s?[-+]?1", "FOA"), (r"-sba\s?[-+]?2", "HOA2"), (r"-sba\s?[-+]?3", "HOA3"), (r"-mc\s5_1\s", "5_1"), (r"-mc\s7_1\s", "7_1"), (r"-mc\s5_1_2", "5_1_2"), (r"-mc\s5_1_4", "5_1_4"), (r"-mc\s7_1_4", "7_1_4"), (r"-ism\s?[-+]?1", "ISM1"), (r"-ism\s?[-+]?2", "ISM2"), (r"-ism\s?[-+]?3", "ISM3"), (r"-ism\s?[-+]?4", "ISM4"), (r"-masa\s?1", "MASA1"), (r"-masa\s?2", "MASA2"), (r"-ism_masa\s?1\s?1", "OMASA_1_1"), (r"-ism_masa\s?2\s?1", "OMASA_2_1"), (r"-ism_masa\s?3\s?1", "OMASA_3_1"), (r"-ism_masa\s?4\s?1", "OMASA_4_1"), (r"-ism_masa\s?1\s?2", "OMASA_1_2"), (r"-ism_masa\s?2\s?2", "OMASA_2_2"), (r"-ism_masa\s?3\s?2", "OMASA_3_2"), (r"-ism_masa\s?4\s?2", "OMASA_4_2"), (r"-ism_sba\s?1\s?1", "OSBA_1_1"), (r"-ism_sba\s?2\s?1", "OSBA_2_1"), (r"-ism_sba\s?3\s?1", "OSBA_3_1"), (r"-ism_sba\s?4\s?1", "OSBA_4_1"), (r"-ism_sba\s?1\s?2", "OSBA_1_2"), (r"-ism_sba\s?2\s?2", "OSBA_2_2"), (r"-ism_sba\s?3\s?2", "OSBA_3_2"), (r"-ism_sba\s?4\s?2", "OSBA_4_2"), ] TWO_CHAN_FMT = [ "STEREO", "BINAURAL", "BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB", ] PARAM_FILE_ID = ( "stv" if PARAM_FILE.stem == "self_test" Loading Loading @@ -152,6 +194,7 @@ def convert_test_string_to_tag(test_string): # hack to have stv/ltv/evs in the test name @pytest.mark.parametrize("param_file_id", [PARAM_FILE_ID]) def test_param_file_tests( test_info, props_to_record, encoder_only, decoder_only, Loading @@ -174,6 +217,7 @@ def test_param_file_tests( get_enc_stats, get_odg, compare_to_input, peaq_binaural, ): enc_opts, dec_opts, sim_opts, eid_opts = param_file_test_dict[test_tag] Loading Loading @@ -393,10 +437,114 @@ def test_param_file_tests( decoder_only, ) if update_ref in [0, 2]: # Reconstruct output file names for comparison dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}" ref_output_file = f"{reference_path}/param_file/dec/{output_file}" # Check if we need to render to stereo or binaural for PEAQ comparison if peaq_binaural: dut_output_file_binaural = dut_output_file[0:-4]+".BINAURAL.wav" ref_output_file_binaural = ref_output_file[0:-4]+".BINAURAL.wav" # Disable tracefile supported comparison -- no tracefile available for input tracefile_dec = "" record_property = dut_decoder_frontend.record_property if dut_decoder_frontend else ref_decoder_frontend.record_property in_meta_files = [str(SCRIPTS_DIR.joinpath(m)) for m in re.findall(r'\b\S+\.csv\b', enc_opts)] # All .csv files in enc_opts are metadata files. n_obj = len(in_meta_files) if n_obj > 0 and output_config == "EXT": out_meta_files = [f"{dut_output_file}.{i}.csv" for i in range(0,n_obj)] else: out_meta_files = None metadata_input = None # Todo: This can be used for OMASA/OSBA rendering trj_file = findstr(r'-t\s+(\S+)', dec_opts) non_diegetic_pan = findstr(r'-non_diegetic_pan\s+(\S+)', dec_opts) name_extension = None refrot_file = findstr(r'-rf\s+(\S+)', dec_opts) rot_tmp_file = findstr(r'-rvf\s+(\S+)', dec_opts) refveclev_file = None refvec_file = None if "-otr ref_vec".upper() in dec_opts.upper(): refvec_file = rot_tmp_file if "-otr ref_vec_lev".upper() in dec_opts.upper(): refveclev_file = rot_tmp_file config_file = findstr(r'-render_config\s+(\S+)', dec_opts) binary_suffix = "" frame_size = findstr(r'-fr\s+(\S+)', dec_opts) hrtf_file = findstr(r'-hrtf\s+(\S+)', dec_opts) aeid = findstr(r'-aeid\s+(\S+)', dec_opts) # Find input format in_fmt = [ (a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts) ][0][1] if not output_config in TWO_CHAN_FMT: # Render output output_reformat = "BINAURAL" rend.run_renderer( record_property, props_to_record, test_info, output_config, output_reformat, metadata_input, out_meta_files, trj_file, non_diegetic_pan, name_extension, refrot_file, refvec_file, refveclev_file, config_file, binary_suffix, frame_size, hrtf_file, aeid, in_file=dut_output_file, out_file=dut_output_file_binaural, ) # Use binauralized file for comparison dut_output_file = dut_output_file_binaural if not in_fmt in TWO_CHAN_FMT: # Render input out_fmt = output_config if not out_fmt in TWO_CHAN_FMT: out_fmt = "BINAURAL" rend.run_renderer( record_property, props_to_record, test_info, in_fmt, out_fmt, metadata_input, in_meta_files, trj_file, non_diegetic_pan, name_extension, refrot_file, refvec_file, refveclev_file, config_file, binary_suffix, frame_size, hrtf_file, aeid, in_file=testv_file, out_file=ref_output_file_binaural, ) # Use binauralized file for comparison ref_output_file = ref_output_file_binaural if update_ref in [0, 2]: # set to false per default even if this is no JBM case - makes later check for failure easier tracefile_last_rtp_numbers_differ = False Loading Loading @@ -786,3 +934,11 @@ def get_expected_md_files(ref_output_file, enc_opts, output_config): pass return md_files def findstr(exp, s, one_element=False): result = re.findall(exp, s) if len(result) == 0: return None if one_element: return result[0] return result No newline at end of file tests/codec_be_on_mr_nonselection/test_sba.py +6 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ def test_pca_enc( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): pca = True bitrate = "256000" Loading Loading @@ -224,6 +225,7 @@ def test_sba_enc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): plc_pattern = None Loading Loading @@ -385,6 +387,7 @@ def test_spar_hoa2_enc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sampling_rate = "48" pca = False Loading Loading @@ -520,6 +523,7 @@ def test_spar_hoa3_enc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sampling_rate = "48" pca = False Loading Loading @@ -653,6 +657,7 @@ def test_sba_enc_BWforce_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sid = 0 plc_pattern = None Loading Loading @@ -806,6 +811,7 @@ def test_sba_plc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sid = 0 pca = False Loading tests/conftest.py +18 −0 Original line number Diff line number Diff line Loading @@ -273,6 +273,13 @@ def pytest_addoption(parser): default=False, ) parser.addoption( "--peaq_binaural", action="store_true", help="Compare output to the input file using PEAQ. If input or output is not STEREO or BINAURAL, input and/or output is binauralized using the external renderer", default=False, ) @pytest.fixture(scope="session", autouse=True) def update_ref(request): """ Loading Loading @@ -383,6 +390,10 @@ def dut_encoder_path(request) -> str: return path # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request class EncoderFrontend: def __init__(self, path, enc_type, record_property, timeout=None) -> None: Loading Loading @@ -1007,6 +1018,13 @@ def compare_to_input(request) -> bool: """ return request.config.getoption("--compare_to_input") @pytest.fixture(scope="session", autouse=True) def peaq_binaural(request) -> bool: """ Return value of cmdl param --peaq_binaural """ return request.config.getoption("--peaq_binaural") def pytest_configure(config): config.addinivalue_line("markers", "serial: mark test to run only in serial") if config.option.param_file: Loading tests/renderer/utils.py +15 −18 Original line number Diff line number Diff line Loading @@ -60,12 +60,6 @@ from ..cmp_pcm import cmp_pcm from ..conftest import parse_properties # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request def run_cmd(cmd, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") try: Loading Loading @@ -171,6 +165,8 @@ def run_renderer( get_ssnr=False, get_odg=False, aeid: Optional[Union[Path, int]] = None, in_file = None, out_file = None, ) -> str: # prepare arguments and filepaths if trj_file is not None: Loading Loading @@ -241,6 +237,7 @@ def run_renderer( else: FORMAT_TO_FILE = FORMAT_TO_FILE_SMOKETEST if in_file is None: if metadata_input is not None: in_file = metadata_input in_name = metadata_input.stem Loading @@ -251,8 +248,8 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt if out_file is None: out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}{aeid_name}.wav" out_file = str(output_path_base.joinpath(out_file_stem)) cmd = RENDERER_CMD[:] Loading Loading
tests/codec_be_on_mr_nonselection/test_param_file.py +158 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ from tests.constants import ( SCRIPTS_DIR, MAX_ENC_DIFF, ) import tests.renderer.utils as rend PASSTHROUGH_CONF = [ (r"[\s\S]*", "EXT"), # Any input with EXT output is pass-through Loading Loading @@ -82,6 +83,47 @@ VALID_DEC_OUTPUT_CONF = [ "EXT", ] INPUT_FMT = [ (r"-stereo", "STEREO"), (r"-sba\s?[-+]?1", "FOA"), (r"-sba\s?[-+]?2", "HOA2"), (r"-sba\s?[-+]?3", "HOA3"), (r"-mc\s5_1\s", "5_1"), (r"-mc\s7_1\s", "7_1"), (r"-mc\s5_1_2", "5_1_2"), (r"-mc\s5_1_4", "5_1_4"), (r"-mc\s7_1_4", "7_1_4"), (r"-ism\s?[-+]?1", "ISM1"), (r"-ism\s?[-+]?2", "ISM2"), (r"-ism\s?[-+]?3", "ISM3"), (r"-ism\s?[-+]?4", "ISM4"), (r"-masa\s?1", "MASA1"), (r"-masa\s?2", "MASA2"), (r"-ism_masa\s?1\s?1", "OMASA_1_1"), (r"-ism_masa\s?2\s?1", "OMASA_2_1"), (r"-ism_masa\s?3\s?1", "OMASA_3_1"), (r"-ism_masa\s?4\s?1", "OMASA_4_1"), (r"-ism_masa\s?1\s?2", "OMASA_1_2"), (r"-ism_masa\s?2\s?2", "OMASA_2_2"), (r"-ism_masa\s?3\s?2", "OMASA_3_2"), (r"-ism_masa\s?4\s?2", "OMASA_4_2"), (r"-ism_sba\s?1\s?1", "OSBA_1_1"), (r"-ism_sba\s?2\s?1", "OSBA_2_1"), (r"-ism_sba\s?3\s?1", "OSBA_3_1"), (r"-ism_sba\s?4\s?1", "OSBA_4_1"), (r"-ism_sba\s?1\s?2", "OSBA_1_2"), (r"-ism_sba\s?2\s?2", "OSBA_2_2"), (r"-ism_sba\s?3\s?2", "OSBA_3_2"), (r"-ism_sba\s?4\s?2", "OSBA_4_2"), ] TWO_CHAN_FMT = [ "STEREO", "BINAURAL", "BINAURAL_ROOM_IR", "BINAURAL_ROOM_REVERB", ] PARAM_FILE_ID = ( "stv" if PARAM_FILE.stem == "self_test" Loading Loading @@ -152,6 +194,7 @@ def convert_test_string_to_tag(test_string): # hack to have stv/ltv/evs in the test name @pytest.mark.parametrize("param_file_id", [PARAM_FILE_ID]) def test_param_file_tests( test_info, props_to_record, encoder_only, decoder_only, Loading @@ -174,6 +217,7 @@ def test_param_file_tests( get_enc_stats, get_odg, compare_to_input, peaq_binaural, ): enc_opts, dec_opts, sim_opts, eid_opts = param_file_test_dict[test_tag] Loading Loading @@ -393,10 +437,114 @@ def test_param_file_tests( decoder_only, ) if update_ref in [0, 2]: # Reconstruct output file names for comparison dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}" ref_output_file = f"{reference_path}/param_file/dec/{output_file}" # Check if we need to render to stereo or binaural for PEAQ comparison if peaq_binaural: dut_output_file_binaural = dut_output_file[0:-4]+".BINAURAL.wav" ref_output_file_binaural = ref_output_file[0:-4]+".BINAURAL.wav" # Disable tracefile supported comparison -- no tracefile available for input tracefile_dec = "" record_property = dut_decoder_frontend.record_property if dut_decoder_frontend else ref_decoder_frontend.record_property in_meta_files = [str(SCRIPTS_DIR.joinpath(m)) for m in re.findall(r'\b\S+\.csv\b', enc_opts)] # All .csv files in enc_opts are metadata files. n_obj = len(in_meta_files) if n_obj > 0 and output_config == "EXT": out_meta_files = [f"{dut_output_file}.{i}.csv" for i in range(0,n_obj)] else: out_meta_files = None metadata_input = None # Todo: This can be used for OMASA/OSBA rendering trj_file = findstr(r'-t\s+(\S+)', dec_opts) non_diegetic_pan = findstr(r'-non_diegetic_pan\s+(\S+)', dec_opts) name_extension = None refrot_file = findstr(r'-rf\s+(\S+)', dec_opts) rot_tmp_file = findstr(r'-rvf\s+(\S+)', dec_opts) refveclev_file = None refvec_file = None if "-otr ref_vec".upper() in dec_opts.upper(): refvec_file = rot_tmp_file if "-otr ref_vec_lev".upper() in dec_opts.upper(): refveclev_file = rot_tmp_file config_file = findstr(r'-render_config\s+(\S+)', dec_opts) binary_suffix = "" frame_size = findstr(r'-fr\s+(\S+)', dec_opts) hrtf_file = findstr(r'-hrtf\s+(\S+)', dec_opts) aeid = findstr(r'-aeid\s+(\S+)', dec_opts) # Find input format in_fmt = [ (a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts) ][0][1] if not output_config in TWO_CHAN_FMT: # Render output output_reformat = "BINAURAL" rend.run_renderer( record_property, props_to_record, test_info, output_config, output_reformat, metadata_input, out_meta_files, trj_file, non_diegetic_pan, name_extension, refrot_file, refvec_file, refveclev_file, config_file, binary_suffix, frame_size, hrtf_file, aeid, in_file=dut_output_file, out_file=dut_output_file_binaural, ) # Use binauralized file for comparison dut_output_file = dut_output_file_binaural if not in_fmt in TWO_CHAN_FMT: # Render input out_fmt = output_config if not out_fmt in TWO_CHAN_FMT: out_fmt = "BINAURAL" rend.run_renderer( record_property, props_to_record, test_info, in_fmt, out_fmt, metadata_input, in_meta_files, trj_file, non_diegetic_pan, name_extension, refrot_file, refvec_file, refveclev_file, config_file, binary_suffix, frame_size, hrtf_file, aeid, in_file=testv_file, out_file=ref_output_file_binaural, ) # Use binauralized file for comparison ref_output_file = ref_output_file_binaural if update_ref in [0, 2]: # set to false per default even if this is no JBM case - makes later check for failure easier tracefile_last_rtp_numbers_differ = False Loading Loading @@ -786,3 +934,11 @@ def get_expected_md_files(ref_output_file, enc_opts, output_config): pass return md_files def findstr(exp, s, one_element=False): result = re.findall(exp, s) if len(result) == 0: return None if one_element: return result[0] return result No newline at end of file
tests/codec_be_on_mr_nonselection/test_sba.py +6 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ def test_pca_enc( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): pca = True bitrate = "256000" Loading Loading @@ -224,6 +225,7 @@ def test_sba_enc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): plc_pattern = None Loading Loading @@ -385,6 +387,7 @@ def test_spar_hoa2_enc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sampling_rate = "48" pca = False Loading Loading @@ -520,6 +523,7 @@ def test_spar_hoa3_enc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sampling_rate = "48" pca = False Loading Loading @@ -653,6 +657,7 @@ def test_sba_enc_BWforce_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sid = 0 plc_pattern = None Loading Loading @@ -806,6 +811,7 @@ def test_sba_plc_system( get_odg, get_enc_stats, compare_to_input, peaq_binaural, ): sid = 0 pca = False Loading
tests/conftest.py +18 −0 Original line number Diff line number Diff line Loading @@ -273,6 +273,13 @@ def pytest_addoption(parser): default=False, ) parser.addoption( "--peaq_binaural", action="store_true", help="Compare output to the input file using PEAQ. If input or output is not STEREO or BINAURAL, input and/or output is binauralized using the external renderer", default=False, ) @pytest.fixture(scope="session", autouse=True) def update_ref(request): """ Loading Loading @@ -383,6 +390,10 @@ def dut_encoder_path(request) -> str: return path # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request class EncoderFrontend: def __init__(self, path, enc_type, record_property, timeout=None) -> None: Loading Loading @@ -1007,6 +1018,13 @@ def compare_to_input(request) -> bool: """ return request.config.getoption("--compare_to_input") @pytest.fixture(scope="session", autouse=True) def peaq_binaural(request) -> bool: """ Return value of cmdl param --peaq_binaural """ return request.config.getoption("--peaq_binaural") def pytest_configure(config): config.addinivalue_line("markers", "serial: mark test to run only in serial") if config.option.param_file: Loading
tests/renderer/utils.py +15 −18 Original line number Diff line number Diff line Loading @@ -60,12 +60,6 @@ from ..cmp_pcm import cmp_pcm from ..conftest import parse_properties # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request def run_cmd(cmd, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") try: Loading Loading @@ -171,6 +165,8 @@ def run_renderer( get_ssnr=False, get_odg=False, aeid: Optional[Union[Path, int]] = None, in_file = None, out_file = None, ) -> str: # prepare arguments and filepaths if trj_file is not None: Loading Loading @@ -241,6 +237,7 @@ def run_renderer( else: FORMAT_TO_FILE = FORMAT_TO_FILE_SMOKETEST if in_file is None: if metadata_input is not None: in_file = metadata_input in_name = metadata_input.stem Loading @@ -251,8 +248,8 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt if out_file is None: out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}{aeid_name}.wav" out_file = str(output_path_base.joinpath(out_file_stem)) cmd = RENDERER_CMD[:] Loading