Loading tests/codec_be_on_mr_nonselection/test_param_file.py +9 −35 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import os import platform from pathlib import Path from subprocess import run from tempfile import NamedTemporaryFile import pytest import re import sys Loading @@ -46,11 +45,14 @@ import numpy as np THIS_PATH = os.path.join(os.getcwd(), __file__) sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../../scripts")) import pyaudio3dtools from tests.cmp_pcm import cmp_pcm, out_config_2_nchannels from tests.cmp_stats_files import cmp_stats_files from tests.conftest import DecoderFrontend, EncoderFrontend, parse_properties from tests.conftest import ( DecoderFrontend, EncoderFrontend, parse_properties, compare_dmx_signals, ) from tests.testconfig import PARAM_FILE from tests.constants import ( MAX_ENC_FILE_LENGTH_DIFF, Loading Loading @@ -511,37 +513,9 @@ def run_test( str(f).replace(dut_base_path, reference_path) for f in dut_dmx_files ] nchannels = len(dut_dmx_files) with NamedTemporaryFile(suffix=".ref_dmx.pcm") as dmx_file_ref_tmp: with NamedTemporaryFile(suffix=".dut_dmx.pcm") as dmx_file_dut_tmp: pyaudio3dtools.audiofile.combinefiles( ref_dmx_files, dmx_file_ref_tmp.name, out_nchans=nchannels, in_fs=in_sr, ) pyaudio3dtools.audiofile.combinefiles( dut_dmx_files, dmx_file_dut_tmp.name, out_nchans=nchannels, in_fs=in_sr, ) dmx_differs, reason = cmp_pcm( dmx_file_ref_tmp.name, dmx_file_dut_tmp.name, nchannels, in_sr, get_mld=True, get_ssnr=True, quiet=True, ) dmx_props = [DMX_DIFF, DMX_MLD, DMX_SSNR] pytest.set_trace() prop_results = parse_properties(reason, dmx_differs, dmx_props) for prop in dmx_props: dut_decoder_frontend.record_property(prop, prop_results[prop]) prop_results = compare_dmx_signals(ref_dmx_files, dut_dmx_files, in_sr) for prop, val in prop_results.items(): dut_decoder_frontend.record_property(prop, val) # Output file names for comparison dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}" Loading tests/conftest.py +36 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import platform import textwrap from pathlib import Path from subprocess import TimeoutExpired, run from tempfile import NamedTemporaryFile import tempfile from typing import Optional, Union import numpy as np Loading Loading @@ -78,6 +79,8 @@ import sys sys.path.append(str(SCRIPTS_DIR)) import prepare_combined_format_inputs import pyaudio3dtools from tests.cmp_pcm import cmp_pcm def log_dbg_msg(message): Loading Loading @@ -1169,3 +1172,36 @@ def parse_properties(text_to_parse: str, output_differs: bool, props_to_record: class MaxDiffPatternNotFound(Exception): pass def compare_dmx_signals(ref_dmx_files, dut_dmx_files, fs) -> dict: nchannels = len(dut_dmx_files) with NamedTemporaryFile(suffix=".ref_dmx.pcm") as dmx_file_ref_tmp: with NamedTemporaryFile(suffix=".dut_dmx.pcm") as dmx_file_dut_tmp: pyaudio3dtools.audiofile.combinefiles( ref_dmx_files, dmx_file_ref_tmp.name, out_nchans=nchannels, in_fs=fs, ) pyaudio3dtools.audiofile.combinefiles( dut_dmx_files, dmx_file_dut_tmp.name, out_nchans=nchannels, in_fs=fs, ) dmx_differs, reason = cmp_pcm( dmx_file_ref_tmp.name, dmx_file_dut_tmp.name, nchannels, fs, get_mld=True, get_ssnr=True, quiet=True, ) dmx_props = [DMX_DIFF, DMX_MLD, DMX_SSNR] prop_results = parse_properties(reason, dmx_differs, dmx_props) return prop_results Loading
tests/codec_be_on_mr_nonselection/test_param_file.py +9 −35 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import os import platform from pathlib import Path from subprocess import run from tempfile import NamedTemporaryFile import pytest import re import sys Loading @@ -46,11 +45,14 @@ import numpy as np THIS_PATH = os.path.join(os.getcwd(), __file__) sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../../scripts")) import pyaudio3dtools from tests.cmp_pcm import cmp_pcm, out_config_2_nchannels from tests.cmp_stats_files import cmp_stats_files from tests.conftest import DecoderFrontend, EncoderFrontend, parse_properties from tests.conftest import ( DecoderFrontend, EncoderFrontend, parse_properties, compare_dmx_signals, ) from tests.testconfig import PARAM_FILE from tests.constants import ( MAX_ENC_FILE_LENGTH_DIFF, Loading Loading @@ -511,37 +513,9 @@ def run_test( str(f).replace(dut_base_path, reference_path) for f in dut_dmx_files ] nchannels = len(dut_dmx_files) with NamedTemporaryFile(suffix=".ref_dmx.pcm") as dmx_file_ref_tmp: with NamedTemporaryFile(suffix=".dut_dmx.pcm") as dmx_file_dut_tmp: pyaudio3dtools.audiofile.combinefiles( ref_dmx_files, dmx_file_ref_tmp.name, out_nchans=nchannels, in_fs=in_sr, ) pyaudio3dtools.audiofile.combinefiles( dut_dmx_files, dmx_file_dut_tmp.name, out_nchans=nchannels, in_fs=in_sr, ) dmx_differs, reason = cmp_pcm( dmx_file_ref_tmp.name, dmx_file_dut_tmp.name, nchannels, in_sr, get_mld=True, get_ssnr=True, quiet=True, ) dmx_props = [DMX_DIFF, DMX_MLD, DMX_SSNR] pytest.set_trace() prop_results = parse_properties(reason, dmx_differs, dmx_props) for prop in dmx_props: dut_decoder_frontend.record_property(prop, prop_results[prop]) prop_results = compare_dmx_signals(ref_dmx_files, dut_dmx_files, in_sr) for prop, val in prop_results.items(): dut_decoder_frontend.record_property(prop, val) # Output file names for comparison dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}" Loading
tests/conftest.py +36 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import platform import textwrap from pathlib import Path from subprocess import TimeoutExpired, run from tempfile import NamedTemporaryFile import tempfile from typing import Optional, Union import numpy as np Loading Loading @@ -78,6 +79,8 @@ import sys sys.path.append(str(SCRIPTS_DIR)) import prepare_combined_format_inputs import pyaudio3dtools from tests.cmp_pcm import cmp_pcm def log_dbg_msg(message): Loading Loading @@ -1169,3 +1172,36 @@ def parse_properties(text_to_parse: str, output_differs: bool, props_to_record: class MaxDiffPatternNotFound(Exception): pass def compare_dmx_signals(ref_dmx_files, dut_dmx_files, fs) -> dict: nchannels = len(dut_dmx_files) with NamedTemporaryFile(suffix=".ref_dmx.pcm") as dmx_file_ref_tmp: with NamedTemporaryFile(suffix=".dut_dmx.pcm") as dmx_file_dut_tmp: pyaudio3dtools.audiofile.combinefiles( ref_dmx_files, dmx_file_ref_tmp.name, out_nchans=nchannels, in_fs=fs, ) pyaudio3dtools.audiofile.combinefiles( dut_dmx_files, dmx_file_dut_tmp.name, out_nchans=nchannels, in_fs=fs, ) dmx_differs, reason = cmp_pcm( dmx_file_ref_tmp.name, dmx_file_dut_tmp.name, nchannels, fs, get_mld=True, get_ssnr=True, quiet=True, ) dmx_props = [DMX_DIFF, DMX_MLD, DMX_SSNR] prop_results = parse_properties(reason, dmx_differs, dmx_props) return prop_results