Loading tests/check_masa_meta_diff.py 0 → 100644 +85 −0 Original line number Diff line number Diff line __copyright__ = """ (C) 2022-2026 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository retain full ownership rights in their respective contributions in the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the development stage. It is intended exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. Any dispute, controversy or claim arising under or in relation to providing this software shall be submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and the United Nations Convention on Contracts on the International Sales of Goods. """ __doc__ = """ Interface to use masaDiffTool in tests """ from pathlib import Path import platform import shutil import subprocess REPO_ROOT = Path(__file__).parent.parent.resolve() TOOLSDIR = REPO_ROOT.joinpath("scripts/tools").resolve() def check_masa_meta_diff( ref = None, dut = None, print_stdout: bool = True ): metadata_differs = False curr_platform = platform.system() if curr_platform not in {"Windows", "Linux", "Darwin"}: raise NotImplementedError( f"masaDiffTool not available for {curr_platform}" ) search_path = TOOLSDIR.joinpath(curr_platform.replace("Windows", "Win32")) masaDiff = search_path.joinpath("masaDiffTool").with_suffix( ".exe" if curr_platform == "Windows" else "" ) if not masaDiff.exists(): masaDiff = shutil.which("masaDiffTool") if masaDiff is None: raise FileNotFoundError( f"masaDiffTool tool not found in {search_path} or PATH!" ) cmd = [ str(masaDiff), str(ref), str(dut), ] proc = subprocess.run(cmd, capture_output=True, text=True) if print_stdout: print("") print("MASA metadata diff tool report") print("==============================") print(proc.stdout) if proc.returncode: metadata_differs = True return metadata_differs tests/codec_be_on_mr_nonselection/test_param_file.py +15 −10 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ __doc__ = """ Execute tests specified via a parameter file. """ import filecmp import os import platform from pathlib import Path Loading @@ -41,6 +40,7 @@ import pytest import re import sys import numpy as np from tests.check_masa_meta_diff import check_masa_meta_diff THIS_PATH = os.path.join(os.getcwd(), __file__) sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../../scripts")) Loading Loading @@ -708,17 +708,22 @@ def run_test( ] for dut_metadata_file, ref_metadata_file in md_file_pairs: md_file = os.path.basename(dut_metadata_file) try: if not filecmp.cmp(dut_metadata_file, ref_metadata_file): print("Output metadata differs for file: " + md_file) metadata_differs = True except FileNotFoundError: if not dut_metadata_file.exists(): print("DUT output metadata missing for expected file: " + md_file) metadata_differs = True if not ref_metadata_file.exists(): print("REF output metadata missing for expected file: " + md_file) metadata_differs = True # Only test if both files exist if metadata_differs == False: metadata_differs = check_masa_meta_diff( ref=ref_metadata_file, dut=dut_metadata_file, print_stdout=True) if enc_test_result: pytest.fail("Too high difference in encoder statistics found.") Loading Loading
tests/check_masa_meta_diff.py 0 → 100644 +85 −0 Original line number Diff line number Diff line __copyright__ = """ (C) 2022-2026 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository. All Rights Reserved. This software is protected by copyright law and by international treaties. The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other contributors to this repository retain full ownership rights in their respective contributions in the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. This software is provided "AS IS", without any express or implied warranties. The software is in the development stage. It is intended exclusively for experts who have experience with such software and solely for the purpose of inspection. All implied warranties of non-infringement, merchantability and fitness for a particular purpose are hereby disclaimed and excluded. Any dispute, controversy or claim arising under or in relation to providing this software shall be submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and the United Nations Convention on Contracts on the International Sales of Goods. """ __doc__ = """ Interface to use masaDiffTool in tests """ from pathlib import Path import platform import shutil import subprocess REPO_ROOT = Path(__file__).parent.parent.resolve() TOOLSDIR = REPO_ROOT.joinpath("scripts/tools").resolve() def check_masa_meta_diff( ref = None, dut = None, print_stdout: bool = True ): metadata_differs = False curr_platform = platform.system() if curr_platform not in {"Windows", "Linux", "Darwin"}: raise NotImplementedError( f"masaDiffTool not available for {curr_platform}" ) search_path = TOOLSDIR.joinpath(curr_platform.replace("Windows", "Win32")) masaDiff = search_path.joinpath("masaDiffTool").with_suffix( ".exe" if curr_platform == "Windows" else "" ) if not masaDiff.exists(): masaDiff = shutil.which("masaDiffTool") if masaDiff is None: raise FileNotFoundError( f"masaDiffTool tool not found in {search_path} or PATH!" ) cmd = [ str(masaDiff), str(ref), str(dut), ] proc = subprocess.run(cmd, capture_output=True, text=True) if print_stdout: print("") print("MASA metadata diff tool report") print("==============================") print(proc.stdout) if proc.returncode: metadata_differs = True return metadata_differs
tests/codec_be_on_mr_nonselection/test_param_file.py +15 −10 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ __doc__ = """ Execute tests specified via a parameter file. """ import filecmp import os import platform from pathlib import Path Loading @@ -41,6 +40,7 @@ import pytest import re import sys import numpy as np from tests.check_masa_meta_diff import check_masa_meta_diff THIS_PATH = os.path.join(os.getcwd(), __file__) sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../../scripts")) Loading Loading @@ -708,17 +708,22 @@ def run_test( ] for dut_metadata_file, ref_metadata_file in md_file_pairs: md_file = os.path.basename(dut_metadata_file) try: if not filecmp.cmp(dut_metadata_file, ref_metadata_file): print("Output metadata differs for file: " + md_file) metadata_differs = True except FileNotFoundError: if not dut_metadata_file.exists(): print("DUT output metadata missing for expected file: " + md_file) metadata_differs = True if not ref_metadata_file.exists(): print("REF output metadata missing for expected file: " + md_file) metadata_differs = True # Only test if both files exist if metadata_differs == False: metadata_differs = check_masa_meta_diff( ref=ref_metadata_file, dut=dut_metadata_file, print_stdout=True) if enc_test_result: pytest.fail("Too high difference in encoder statistics found.") Loading