Loading tests/cmp_pcm.py +30 −33 Original line number Diff line number Diff line Loading @@ -33,7 +33,9 @@ def cmp_pcm( abs_tol=0, get_ssnr=False, get_odg=False, peaq_binaural=False, odg_input=None, odg_test=None, odg_ref=None, ref_jbm_tf: Optional[Path] = None, cut_jbm_tf: Optional[Path] = None, ) -> (int, str): Loading Loading @@ -66,19 +68,6 @@ def cmp_pcm( fs = fs1 if fs1 != fs2: if peaq_binaural: fs = 48000 s1 = np.clip( pyaudio3dtools.audioarray.resample(s1.astype(float), fs1, fs), -32768, 32767, ).astype(np.int16) s2 = np.clip( pyaudio3dtools.audioarray.resample(s2.astype(float), fs2, fs), -32768, 32767, ).astype(np.int16) else: reason = "FAIL: Sampling rate differs." return 1, reason Loading Loading @@ -148,21 +137,29 @@ def cmp_pcm( reason += msg + " - " if get_odg: if peaq_binaural: pqeval_output = pqevalaudio_wrapper(s1, s2, fs) odg_files = {} for f in [odg_input, odg_test, odg_ref]: # Load PEAQ test files and ensure 48 kHz sampling rate s, fs = pyaudio3dtools.audiofile.readfile( f, nchannels, fs, outdtype=np.int16 ) odg_files[f] = np.clip( pyaudio3dtools.audioarray.resample(s.astype(float), fs, 48000), -32768, 32767, ).astype(np.int16) pqeval_output = pqevalaudio_wrapper(odg_files[odg_input], odg_files[odg_ref], 48000) match_odg = re.search(ODG_PATTERN_PQEVALAUDIO, pqeval_output) odg = float(match_odg.groups()[0]) msg = f"ODG: {odg}" reason += " - " + msg print(msg) else: for n in range(nchannels): pqeval_output = pqevalaudio_wrapper(s1[:, n], s2[:, n], fs) odg_ref = float(match_odg.groups()[0]) pqeval_output = pqevalaudio_wrapper(odg_files[odg_input], odg_files[odg_test], 48000) match_odg = re.search(ODG_PATTERN_PQEVALAUDIO, pqeval_output) odg = float(match_odg.groups()[0]) msg = f"Channel {n} ODG: {odg}" odg_test = float(match_odg.groups()[0]) odg = odg_test - odg_ref # Todo: store both rather than difference? msg = f"ODG: {odg}" reason += " - " + msg print(msg) Loading tests/codec_be_on_mr_nonselection/test_param_file.py +25 −11 Original line number Diff line number Diff line Loading @@ -205,7 +205,6 @@ 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 @@ -237,7 +236,6 @@ def test_param_file_tests( get_enc_stats, get_odg, compare_to_input, peaq_binaural, ) Loading Loading @@ -268,7 +266,6 @@ def run_test( get_enc_stats, get_odg, compare_to_input, peaq_binaural, ): # If compare_to_input is set, only run pass-through test cases Loading Loading @@ -497,12 +494,11 @@ def run_test( 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: allow_differing_lengths = True # Disable tracefile supported comparison -- no tracefile available for input tracefile_dec = "" # Check if we need to render to mono, stereo or binaural for PEAQ comparison odg_input = None odg_test = None odg_ref = None if get_odg: # Find input format in_fmt = [(a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts)][0][1] Loading @@ -513,7 +509,7 @@ def run_test( else ref_decoder_frontend.record_property ) (ref_output_file, dut_output_file) = binauralize_input_and_output( (odg_input, odg_test) = binauralize_input_and_output( record_property, props_to_record, test_info, Loading @@ -528,6 +524,22 @@ def run_test( out_sr, ) (_ , odg_ref) = binauralize_input_and_output( record_property, props_to_record, test_info, testv_file, ref_output_file, ref_output_file, in_fmt, output_config, enc_opts, dec_opts, in_sr, out_sr, skip_input_rendering=True, ) # 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 @@ -572,7 +584,9 @@ def run_test( allow_differing_lengths=allow_differing_lengths, get_ssnr=get_ssnr, get_odg=get_odg, peaq_binaural=peaq_binaural, odg_input=odg_input, odg_test=odg_test, odg_ref=odg_ref, ref_jbm_tf=ref_tracefile_dec, cut_jbm_tf=dut_tracefile_dec, ) Loading tests/codec_be_on_mr_nonselection/test_sba.py +35 −13 Original line number Diff line number Diff line Loading @@ -1175,8 +1175,11 @@ def sba_dec( plc_file=plc_file, ) if peaq_binaural: allow_differing_lengths = True # Check if we need to render to mono, stereo or binaural for PEAQ comparison odg_input = None odg_test = None odg_ref = None if get_odg: enc_opts = "" dec_opts = "" input_file = f"{test_vector_path}/{tag}.wav" Loading @@ -1189,7 +1192,7 @@ def sba_dec( in_sr = sampling_rate out_sr = sampling_rate (ref_out_file, dut_out_file) = binauralize_input_and_output( (odg_input, odg_test) = binauralize_input_and_output( dut_decoder_frontend.record_property, props_to_record, test_info, Loading @@ -1203,7 +1206,24 @@ def sba_dec( in_sr, out_sr, ) else: (_, odg_ref) = binauralize_input_and_output( dut_decoder_frontend.record_property, props_to_record, test_info, input_file, ref_out_file, ref_out_file, in_fmt, output_config, enc_opts, dec_opts, in_sr, out_sr, skip_input_rendering=True, ) allow_differing_lengths = False if compare_to_input: # If comparing to input, set input as reference and allow different length Loading @@ -1227,7 +1247,9 @@ def sba_dec( allow_differing_lengths=allow_differing_lengths, get_ssnr=get_ssnr, get_odg=get_odg, peaq_binaural=peaq_binaural, odg_input=odg_input, odg_test=odg_test, odg_ref=odg_ref, ) text_to_parse = reason Loading tests/conftest.py +1 −16 Original line number Diff line number Diff line Loading @@ -276,13 +276,6 @@ def pytest_addoption(parser): ) 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 @@ -1003,7 +996,6 @@ def reference_path(request) -> str: if ( request.config.option.update_ref == "0" and not request.config.option.compare_to_input and not request.config.option.peaq_binaural ): if not os.path.isdir(path): raise FileNotFoundError( Loading Loading @@ -1054,13 +1046,6 @@ 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") Loading tests/renderer/utils.py +2 −1 Original line number Diff line number Diff line Loading @@ -392,6 +392,7 @@ def binauralize_input_and_output( dec_opts, in_sr, out_sr, skip_input_rendering=False, ): # Use current folder as location for temporary directory, since scene description does not handle spaces in path Loading Loading @@ -520,7 +521,7 @@ def binauralize_input_and_output( else: dut_output_file_binaural = dut_output_file if in_fmt.upper() != output_config.upper(): if in_fmt.upper() != output_config.upper() and not skip_input_rendering: # Render input to match output_config out_fmt = output_config Loading Loading
tests/cmp_pcm.py +30 −33 Original line number Diff line number Diff line Loading @@ -33,7 +33,9 @@ def cmp_pcm( abs_tol=0, get_ssnr=False, get_odg=False, peaq_binaural=False, odg_input=None, odg_test=None, odg_ref=None, ref_jbm_tf: Optional[Path] = None, cut_jbm_tf: Optional[Path] = None, ) -> (int, str): Loading Loading @@ -66,19 +68,6 @@ def cmp_pcm( fs = fs1 if fs1 != fs2: if peaq_binaural: fs = 48000 s1 = np.clip( pyaudio3dtools.audioarray.resample(s1.astype(float), fs1, fs), -32768, 32767, ).astype(np.int16) s2 = np.clip( pyaudio3dtools.audioarray.resample(s2.astype(float), fs2, fs), -32768, 32767, ).astype(np.int16) else: reason = "FAIL: Sampling rate differs." return 1, reason Loading Loading @@ -148,21 +137,29 @@ def cmp_pcm( reason += msg + " - " if get_odg: if peaq_binaural: pqeval_output = pqevalaudio_wrapper(s1, s2, fs) odg_files = {} for f in [odg_input, odg_test, odg_ref]: # Load PEAQ test files and ensure 48 kHz sampling rate s, fs = pyaudio3dtools.audiofile.readfile( f, nchannels, fs, outdtype=np.int16 ) odg_files[f] = np.clip( pyaudio3dtools.audioarray.resample(s.astype(float), fs, 48000), -32768, 32767, ).astype(np.int16) pqeval_output = pqevalaudio_wrapper(odg_files[odg_input], odg_files[odg_ref], 48000) match_odg = re.search(ODG_PATTERN_PQEVALAUDIO, pqeval_output) odg = float(match_odg.groups()[0]) msg = f"ODG: {odg}" reason += " - " + msg print(msg) else: for n in range(nchannels): pqeval_output = pqevalaudio_wrapper(s1[:, n], s2[:, n], fs) odg_ref = float(match_odg.groups()[0]) pqeval_output = pqevalaudio_wrapper(odg_files[odg_input], odg_files[odg_test], 48000) match_odg = re.search(ODG_PATTERN_PQEVALAUDIO, pqeval_output) odg = float(match_odg.groups()[0]) msg = f"Channel {n} ODG: {odg}" odg_test = float(match_odg.groups()[0]) odg = odg_test - odg_ref # Todo: store both rather than difference? msg = f"ODG: {odg}" reason += " - " + msg print(msg) Loading
tests/codec_be_on_mr_nonselection/test_param_file.py +25 −11 Original line number Diff line number Diff line Loading @@ -205,7 +205,6 @@ 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 @@ -237,7 +236,6 @@ def test_param_file_tests( get_enc_stats, get_odg, compare_to_input, peaq_binaural, ) Loading Loading @@ -268,7 +266,6 @@ def run_test( get_enc_stats, get_odg, compare_to_input, peaq_binaural, ): # If compare_to_input is set, only run pass-through test cases Loading Loading @@ -497,12 +494,11 @@ def run_test( 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: allow_differing_lengths = True # Disable tracefile supported comparison -- no tracefile available for input tracefile_dec = "" # Check if we need to render to mono, stereo or binaural for PEAQ comparison odg_input = None odg_test = None odg_ref = None if get_odg: # Find input format in_fmt = [(a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts)][0][1] Loading @@ -513,7 +509,7 @@ def run_test( else ref_decoder_frontend.record_property ) (ref_output_file, dut_output_file) = binauralize_input_and_output( (odg_input, odg_test) = binauralize_input_and_output( record_property, props_to_record, test_info, Loading @@ -528,6 +524,22 @@ def run_test( out_sr, ) (_ , odg_ref) = binauralize_input_and_output( record_property, props_to_record, test_info, testv_file, ref_output_file, ref_output_file, in_fmt, output_config, enc_opts, dec_opts, in_sr, out_sr, skip_input_rendering=True, ) # 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 @@ -572,7 +584,9 @@ def run_test( allow_differing_lengths=allow_differing_lengths, get_ssnr=get_ssnr, get_odg=get_odg, peaq_binaural=peaq_binaural, odg_input=odg_input, odg_test=odg_test, odg_ref=odg_ref, ref_jbm_tf=ref_tracefile_dec, cut_jbm_tf=dut_tracefile_dec, ) Loading
tests/codec_be_on_mr_nonselection/test_sba.py +35 −13 Original line number Diff line number Diff line Loading @@ -1175,8 +1175,11 @@ def sba_dec( plc_file=plc_file, ) if peaq_binaural: allow_differing_lengths = True # Check if we need to render to mono, stereo or binaural for PEAQ comparison odg_input = None odg_test = None odg_ref = None if get_odg: enc_opts = "" dec_opts = "" input_file = f"{test_vector_path}/{tag}.wav" Loading @@ -1189,7 +1192,7 @@ def sba_dec( in_sr = sampling_rate out_sr = sampling_rate (ref_out_file, dut_out_file) = binauralize_input_and_output( (odg_input, odg_test) = binauralize_input_and_output( dut_decoder_frontend.record_property, props_to_record, test_info, Loading @@ -1203,7 +1206,24 @@ def sba_dec( in_sr, out_sr, ) else: (_, odg_ref) = binauralize_input_and_output( dut_decoder_frontend.record_property, props_to_record, test_info, input_file, ref_out_file, ref_out_file, in_fmt, output_config, enc_opts, dec_opts, in_sr, out_sr, skip_input_rendering=True, ) allow_differing_lengths = False if compare_to_input: # If comparing to input, set input as reference and allow different length Loading @@ -1227,7 +1247,9 @@ def sba_dec( allow_differing_lengths=allow_differing_lengths, get_ssnr=get_ssnr, get_odg=get_odg, peaq_binaural=peaq_binaural, odg_input=odg_input, odg_test=odg_test, odg_ref=odg_ref, ) text_to_parse = reason Loading
tests/conftest.py +1 −16 Original line number Diff line number Diff line Loading @@ -276,13 +276,6 @@ def pytest_addoption(parser): ) 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 @@ -1003,7 +996,6 @@ def reference_path(request) -> str: if ( request.config.option.update_ref == "0" and not request.config.option.compare_to_input and not request.config.option.peaq_binaural ): if not os.path.isdir(path): raise FileNotFoundError( Loading Loading @@ -1054,13 +1046,6 @@ 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") Loading
tests/renderer/utils.py +2 −1 Original line number Diff line number Diff line Loading @@ -392,6 +392,7 @@ def binauralize_input_and_output( dec_opts, in_sr, out_sr, skip_input_rendering=False, ): # Use current folder as location for temporary directory, since scene description does not handle spaces in path Loading Loading @@ -520,7 +521,7 @@ def binauralize_input_and_output( else: dut_output_file_binaural = dut_output_file if in_fmt.upper() != output_config.upper(): if in_fmt.upper() != output_config.upper() and not skip_input_rendering: # Render input to match output_config out_fmt = output_config Loading