Loading tests/split_rendering/utils.py +57 −85 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ accordance with the laws of the Federal Republic of Germany excluding its confli the United Nations Convention on Contracts on the International Sales of Goods. """ import sys import re import sys from pathlib import Path from tempfile import TemporaryDirectory from typing import Tuple, Optional Loading @@ -40,14 +40,21 @@ import numpy as np import pytest import logging from tests.renderer.constants import ( BIN_SUFFIX_MERGETARGET, FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_FILE_SMOKETEST, FORMAT_TO_METADATA_FILES, ) from tests.renderer.utils import ( check_BE, run_ivas_isar_enc_cmd, run_ivas_isar_dec_cmd, run_isar_post_rend_cmd, run_isar_ext_rend_cmd, run_isar_post_rend_cmd, run_ivas_isar_dec_cmd, run_ivas_isar_enc_cmd, run_cmd, ) from tests.split_rendering.constants import * from ..cmp_pcm import cmp_pcm from ..conftest import parse_properties Loading Loading @@ -111,7 +118,7 @@ def check_xfail( f"Unsupported configuration with {in_fmt} at IVAS bitrate {ivas_bitrate}bps" ) if not "0dof" in render_config and pre_rend_fr != 20: if "0dof" not in render_config and pre_rend_fr != 20: pytest.xfail("pose correction (== !0dof) is expected to use 20ms") if ( Loading Loading @@ -197,6 +204,9 @@ def run_full_chain_split_rendering( renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_full_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" if delay_profile: filename_base += f"_{delay_profile.stem}" ivas_bitstream_stem = f"{filename_base}.192" # NOTE: the split bitstream files need to have ".bit" extension otherwise the conformance test breaks split_bitstream_stem = f"{filename_base}.splt.bit" Loading @@ -217,14 +227,10 @@ def run_full_chain_split_rendering( split_md_file = output_path_base.joinpath(split_md_file_stem) # check for metadata files if in_fmt.upper().startswith("OSBA"): if in_fmt.upper().startswith("ISM") and "SBA" in in_fmt.upper(): # use same MD as ISM in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[5]}"] elif ( in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA") or in_fmt.upper().startswith("OMASA") ): in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[3]}"] elif in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] else: in_meta_files = None Loading Loading @@ -309,29 +315,11 @@ def run_full_chain_split_rendering( # CUT creation mode will run a comparison with REF out_file_ref = str(OUTPUT_PATH_REF.joinpath(out_file_stem)) try: ref, ref_fs = readfile(out_file_ref) except FileNotFoundError: pytest.fail( f"Reference vector not found! Ensure they were created with the --create_ref argument.\n{out_file_ref}" ) cut, cut_fs = readfile(out_file) if not get_mld: [diff_found, snr, gain_b, max_diff] = check_BE( test_info, ref, ref_fs, cut, cut_fs ) if diff_found: pytest.fail( f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}" ) else: output_differs, reason = cmp_pcm( out_file, out_file_ref, 2, # is always "BINAURAL" ref_fs, 48000, # currently only 48 kHz tests get_mld=get_mld, mld_lim=mld_lim, get_ssnr=get_ssnr, Loading Loading @@ -407,7 +395,10 @@ def run_external_split_rendering( ) # check for metadata files if in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): if in_fmt.upper().startswith("ISM") and "SBA" in in_fmt.upper(): # use name MD as ISM in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[3]}"] elif in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] else: in_meta_files = None Loading Loading @@ -469,30 +460,11 @@ def run_external_split_rendering( f"{out_file_ref.stem}_plc_{plc_error_pattern.stem}" ) try: ref, ref_fs = readfile(out_file_ref) except FileNotFoundError: pytest.fail( f"Reference vector not found! Ensure they were created with the --create_ref argument.\n{out_file_ref}" ) cut, cut_fs = readfile(out_file) if not get_mld: [diff_found, snr, gain_b, max_diff] = check_BE( test_info, ref, ref_fs, cut, cut_fs ) if diff_found: pytest.fail( f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}" ) else: # see constants.py output_differs, reason = cmp_pcm( out_file, out_file_ref, 2, # is always "BINAURAL", ref_fs, 48000, # currently only 48 kHz tests get_mld=get_mld, mld_lim=mld_lim, get_ssnr=get_ssnr, Loading Loading
tests/split_rendering/utils.py +57 −85 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ accordance with the laws of the Federal Republic of Germany excluding its confli the United Nations Convention on Contracts on the International Sales of Goods. """ import sys import re import sys from pathlib import Path from tempfile import TemporaryDirectory from typing import Tuple, Optional Loading @@ -40,14 +40,21 @@ import numpy as np import pytest import logging from tests.renderer.constants import ( BIN_SUFFIX_MERGETARGET, FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_FILE_SMOKETEST, FORMAT_TO_METADATA_FILES, ) from tests.renderer.utils import ( check_BE, run_ivas_isar_enc_cmd, run_ivas_isar_dec_cmd, run_isar_post_rend_cmd, run_isar_ext_rend_cmd, run_isar_post_rend_cmd, run_ivas_isar_dec_cmd, run_ivas_isar_enc_cmd, run_cmd, ) from tests.split_rendering.constants import * from ..cmp_pcm import cmp_pcm from ..conftest import parse_properties Loading Loading @@ -111,7 +118,7 @@ def check_xfail( f"Unsupported configuration with {in_fmt} at IVAS bitrate {ivas_bitrate}bps" ) if not "0dof" in render_config and pre_rend_fr != 20: if "0dof" not in render_config and pre_rend_fr != 20: pytest.xfail("pose correction (== !0dof) is expected to use 20ms") if ( Loading Loading @@ -197,6 +204,9 @@ def run_full_chain_split_rendering( renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_full_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" if delay_profile: filename_base += f"_{delay_profile.stem}" ivas_bitstream_stem = f"{filename_base}.192" # NOTE: the split bitstream files need to have ".bit" extension otherwise the conformance test breaks split_bitstream_stem = f"{filename_base}.splt.bit" Loading @@ -217,14 +227,10 @@ def run_full_chain_split_rendering( split_md_file = output_path_base.joinpath(split_md_file_stem) # check for metadata files if in_fmt.upper().startswith("OSBA"): if in_fmt.upper().startswith("ISM") and "SBA" in in_fmt.upper(): # use same MD as ISM in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[5]}"] elif ( in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA") or in_fmt.upper().startswith("OMASA") ): in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[3]}"] elif in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] else: in_meta_files = None Loading Loading @@ -309,29 +315,11 @@ def run_full_chain_split_rendering( # CUT creation mode will run a comparison with REF out_file_ref = str(OUTPUT_PATH_REF.joinpath(out_file_stem)) try: ref, ref_fs = readfile(out_file_ref) except FileNotFoundError: pytest.fail( f"Reference vector not found! Ensure they were created with the --create_ref argument.\n{out_file_ref}" ) cut, cut_fs = readfile(out_file) if not get_mld: [diff_found, snr, gain_b, max_diff] = check_BE( test_info, ref, ref_fs, cut, cut_fs ) if diff_found: pytest.fail( f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}" ) else: output_differs, reason = cmp_pcm( out_file, out_file_ref, 2, # is always "BINAURAL" ref_fs, 48000, # currently only 48 kHz tests get_mld=get_mld, mld_lim=mld_lim, get_ssnr=get_ssnr, Loading Loading @@ -407,7 +395,10 @@ def run_external_split_rendering( ) # check for metadata files if in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): if in_fmt.upper().startswith("ISM") and "SBA" in in_fmt.upper(): # use name MD as ISM in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[3]}"] elif in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA"): in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] else: in_meta_files = None Loading Loading @@ -469,30 +460,11 @@ def run_external_split_rendering( f"{out_file_ref.stem}_plc_{plc_error_pattern.stem}" ) try: ref, ref_fs = readfile(out_file_ref) except FileNotFoundError: pytest.fail( f"Reference vector not found! Ensure they were created with the --create_ref argument.\n{out_file_ref}" ) cut, cut_fs = readfile(out_file) if not get_mld: [diff_found, snr, gain_b, max_diff] = check_BE( test_info, ref, ref_fs, cut, cut_fs ) if diff_found: pytest.fail( f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}" ) else: # see constants.py output_differs, reason = cmp_pcm( out_file, out_file_ref, 2, # is always "BINAURAL", ref_fs, 48000, # currently only 48 kHz tests get_mld=get_mld, mld_lim=mld_lim, get_ssnr=get_ssnr, Loading