From 3da5641dc8b0e1ac52fd41467cfd5b82f5558de3 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 15 May 2024 15:17:51 +1000 Subject: [PATCH 1/7] fix sba pytests with dtx on --- .../codec_be_on_mr_nonselection/test_param_file.py | 14 ++++++++++---- .../codec_be_on_mr_nonselection/test_sba_bs_enc.py | 8 ++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 137000976f..3d2d1aa1bb 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -39,7 +39,7 @@ import re import platform from pathlib import Path from subprocess import run - +import tempfile import pytest from tests.cmp_pcm import cmp_pcm @@ -173,7 +173,7 @@ def test_param_file_tests( and Path(testv_file).name.startswith("stv") ): sba_br_switching_dtx = 1 - cut_file = pre_proc_input(testv_file, fs) + cut_file, cut_file_pre_exist = pre_proc_input(testv_file, fs) testv_file = cut_file # bitrate can be a filename: remove leading "../" @@ -204,7 +204,7 @@ def test_param_file_tests( ) if sba_br_switching_dtx == 1 and not keep_files: is_exist = os.path.exists(cut_file) - if is_exist: + if is_exist and cut_file_pre_exist == 0: os.remove(cut_file) # check for networkSimulator_g192 command line @@ -462,8 +462,14 @@ def pre_proc_input(testv_file, fs): elif "stv3OA" in testv_file: num_channel = "16" cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav") + cut_file_pre_exist = 1; + if not os.path.exists(cut_file): + tmpf = tempfile.TemporaryFile() + cut_file = tmpf.name + num_channel + "chn_" + cut_gain + ".wav" + cut_file_pre_exist = 0; + cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain) - return cut_file + return cut_file, cut_file_pre_exist def simulate( diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index b7effa986c..e60d4a3aeb 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -36,6 +36,7 @@ __doc__ = """ import errno import os import re +import tempfile import pytest from cut_bs import cut_from_start @@ -586,6 +587,13 @@ def sba_enc( else: cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}" if not os.path.exists(cut_file): + tmpf = tempfile.TemporaryFile() + cut_file = tmpf.name + if cut_gain == "1.0": + cut_file += f"{tag_in}_cut{in_extension}" + else: + cut_file += f"{tag_in}_cut_{cut_gain}{in_extension}" + cut_samples( input_path, cut_file, -- GitLab From b01c431c15866476ae651607d702ebe0cc18e062 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 15 May 2024 17:06:03 +1000 Subject: [PATCH 2/7] fix short test vectors to generate cut samples for all sba inputs --- tests/codec_be_on_mr_nonselection/test_param_file.py | 7 ++++--- tests/create_short_testvectors.py | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 3d2d1aa1bb..91152f06de 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -454,18 +454,19 @@ def encode( def pre_proc_input(testv_file, fs): cut_from = "0.0" cut_len = "5.0" - cut_gain = "0.004" + cut_gain = ".004" if "stvFOA" in testv_file: num_channel = "4" elif "stv2OA" in testv_file: num_channel = "9" elif "stv3OA" in testv_file: num_channel = "16" - cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav") + cut_file = testv_file.replace(".wav", "_cut_" + cut_gain + ".wav") cut_file_pre_exist = 1; if not os.path.exists(cut_file): tmpf = tempfile.TemporaryFile() - cut_file = tmpf.name + num_channel + "chn_" + cut_gain + ".wav" + cut_file = tmpf.name + cut_file += "_cut_" + cut_gain + ".wav" cut_file_pre_exist = 0; cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain) diff --git a/tests/create_short_testvectors.py b/tests/create_short_testvectors.py index e51f018f45..8efa0894d9 100755 --- a/tests/create_short_testvectors.py +++ b/tests/create_short_testvectors.py @@ -72,12 +72,12 @@ def collect_files(file_ids): return files -def create_short_testvectors(which="foa", cut_len=5.0): +def create_short_testvectors(which="sba", cut_len=5.0): file_ids = [] if which == "all": file_ids = FILE_IDS - elif which == "foa": - file_ids = FILE_IDS[:1] + elif which == "sba": + file_ids = FILE_IDS[:3] for f in collect_files(file_ids): for g in GAINS: @@ -91,7 +91,7 @@ def create_short_testvectors(which="foa", cut_len=5.0): if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument("--which", choices=["foa", "all"], default="foa") + parser.add_argument("--which", choices=["sba", "all"], default="sba") def positive_float(x: str) -> float: x = float(x) -- GitLab From 85522174cd963c0ee45d22af6fac198c6c376419 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 15 May 2024 21:42:05 +1000 Subject: [PATCH 3/7] remove input file writing from sba pytests --- .../test_param_file.py | 26 +++---------------- .../test_sba_bs_enc.py | 20 +------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 91152f06de..948c3ac560 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -39,7 +39,7 @@ import re import platform from pathlib import Path from subprocess import run -import tempfile +from tempfile import TemporaryDirectory import pytest from tests.cmp_pcm import cmp_pcm @@ -173,7 +173,7 @@ def test_param_file_tests( and Path(testv_file).name.startswith("stv") ): sba_br_switching_dtx = 1 - cut_file, cut_file_pre_exist = pre_proc_input(testv_file, fs) + cut_file = pre_proc_input(testv_file, fs) testv_file = cut_file # bitrate can be a filename: remove leading "../" @@ -202,10 +202,6 @@ def test_param_file_tests( enc_split, update_ref, ) - if sba_br_switching_dtx == 1 and not keep_files: - is_exist = os.path.exists(cut_file) - if is_exist and cut_file_pre_exist == 0: - os.remove(cut_file) # check for networkSimulator_g192 command line if sim_opts != "": @@ -452,25 +448,9 @@ def encode( def pre_proc_input(testv_file, fs): - cut_from = "0.0" - cut_len = "5.0" cut_gain = ".004" - if "stvFOA" in testv_file: - num_channel = "4" - elif "stv2OA" in testv_file: - num_channel = "9" - elif "stv3OA" in testv_file: - num_channel = "16" cut_file = testv_file.replace(".wav", "_cut_" + cut_gain + ".wav") - cut_file_pre_exist = 1; - if not os.path.exists(cut_file): - tmpf = tempfile.TemporaryFile() - cut_file = tmpf.name - cut_file += "_cut_" + cut_gain + ".wav" - cut_file_pre_exist = 0; - - cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain) - return cut_file, cut_file_pre_exist + return cut_file def simulate( diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index e60d4a3aeb..788421f833 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -36,14 +36,12 @@ __doc__ = """ import errno import os import re -import tempfile import pytest from cut_bs import cut_from_start from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend -from tests.cut_pcm import cut_samples from . import MLD_PATTERN, MAX_DIFF_PATTERN # params @@ -586,23 +584,7 @@ def sba_enc( cut_file = f"{test_vector_path}/{tag_in}_cut{in_extension}" else: cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}" - if not os.path.exists(cut_file): - tmpf = tempfile.TemporaryFile() - cut_file = tmpf.name - if cut_gain == "1.0": - cut_file += f"{tag_in}_cut{in_extension}" - else: - cut_file += f"{tag_in}_cut_{cut_gain}{in_extension}" - - cut_samples( - input_path, - cut_file, - num_channels, - cut_from, - cut_len, - cut_gain, - sample_rate=sampling_rate + "000", - ) + input_path = cut_file if ref_encoder_frontend: -- GitLab From 6062799e6bc7d587880d95a0b34125d4cf44c27d Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 15 May 2024 23:44:57 +1000 Subject: [PATCH 4/7] add cut pcm sba files as lfs objects to testv folder and update create_short_testvectors.py --- scripts/testv/stv2OA16c_cut.wav | 3 +++ scripts/testv/stv2OA16c_cut_.004.wav | 3 +++ scripts/testv/stv2OA16c_cut_16.0.wav | 3 +++ scripts/testv/stv2OA32c_cut.wav | 3 +++ scripts/testv/stv2OA32c_cut_.004.wav | 3 +++ scripts/testv/stv2OA32c_cut_16.0.wav | 3 +++ scripts/testv/stv2OA48c_cut.wav | 3 +++ scripts/testv/stv2OA48c_cut_.004.wav | 3 +++ scripts/testv/stv2OA48c_cut_16.0.wav | 3 +++ scripts/testv/stv3OA16c_cut.wav | 3 +++ scripts/testv/stv3OA16c_cut_.004.wav | 3 +++ scripts/testv/stv3OA16c_cut_16.0.wav | 3 +++ scripts/testv/stv3OA32c_cut.wav | 3 +++ scripts/testv/stv3OA32c_cut_.004.wav | 3 +++ scripts/testv/stv3OA32c_cut_16.0.wav | 3 +++ scripts/testv/stv3OA48c_cut.wav | 3 +++ scripts/testv/stv3OA48c_cut_.004.wav | 3 +++ scripts/testv/stv3OA48c_cut_16.0.wav | 3 +++ scripts/testv/stvFOA16c_cut.wav | 3 +++ scripts/testv/stvFOA16c_cut_.004.wav | 3 +++ scripts/testv/stvFOA16c_cut_16.0.wav | 3 +++ scripts/testv/stvFOA32c_cut.wav | 3 +++ scripts/testv/stvFOA32c_cut_.004.wav | 3 +++ scripts/testv/stvFOA32c_cut_16.0.wav | 3 +++ scripts/testv/stvFOA48c_cut.wav | 3 +++ scripts/testv/stvFOA48c_cut_.004.wav | 3 +++ scripts/testv/stvFOA48c_cut_16.0.wav | 3 +++ tests/create_short_testvectors.py | 2 -- 28 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 scripts/testv/stv2OA16c_cut.wav create mode 100644 scripts/testv/stv2OA16c_cut_.004.wav create mode 100644 scripts/testv/stv2OA16c_cut_16.0.wav create mode 100644 scripts/testv/stv2OA32c_cut.wav create mode 100644 scripts/testv/stv2OA32c_cut_.004.wav create mode 100644 scripts/testv/stv2OA32c_cut_16.0.wav create mode 100644 scripts/testv/stv2OA48c_cut.wav create mode 100644 scripts/testv/stv2OA48c_cut_.004.wav create mode 100644 scripts/testv/stv2OA48c_cut_16.0.wav create mode 100644 scripts/testv/stv3OA16c_cut.wav create mode 100644 scripts/testv/stv3OA16c_cut_.004.wav create mode 100644 scripts/testv/stv3OA16c_cut_16.0.wav create mode 100644 scripts/testv/stv3OA32c_cut.wav create mode 100644 scripts/testv/stv3OA32c_cut_.004.wav create mode 100644 scripts/testv/stv3OA32c_cut_16.0.wav create mode 100644 scripts/testv/stv3OA48c_cut.wav create mode 100644 scripts/testv/stv3OA48c_cut_.004.wav create mode 100644 scripts/testv/stv3OA48c_cut_16.0.wav create mode 100644 scripts/testv/stvFOA16c_cut.wav create mode 100644 scripts/testv/stvFOA16c_cut_.004.wav create mode 100644 scripts/testv/stvFOA16c_cut_16.0.wav create mode 100644 scripts/testv/stvFOA32c_cut.wav create mode 100644 scripts/testv/stvFOA32c_cut_.004.wav create mode 100644 scripts/testv/stvFOA32c_cut_16.0.wav create mode 100644 scripts/testv/stvFOA48c_cut.wav create mode 100644 scripts/testv/stvFOA48c_cut_.004.wav create mode 100644 scripts/testv/stvFOA48c_cut_16.0.wav diff --git a/scripts/testv/stv2OA16c_cut.wav b/scripts/testv/stv2OA16c_cut.wav new file mode 100644 index 0000000000..ff5d903c04 --- /dev/null +++ b/scripts/testv/stv2OA16c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:603bcfa3fdaf1cb7e73b7c9da7017b37680d85162b7494177be3cffed61d4231 +size 1440044 diff --git a/scripts/testv/stv2OA16c_cut_.004.wav b/scripts/testv/stv2OA16c_cut_.004.wav new file mode 100644 index 0000000000..d5180c44b0 --- /dev/null +++ b/scripts/testv/stv2OA16c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a08210deb9d2585838ad27b41e22b769b3e54cc8d5bfe15229520e19bf3098dc +size 1440044 diff --git a/scripts/testv/stv2OA16c_cut_16.0.wav b/scripts/testv/stv2OA16c_cut_16.0.wav new file mode 100644 index 0000000000..18a826bf09 --- /dev/null +++ b/scripts/testv/stv2OA16c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f8012db61a4be19a12d074b94a7a1b6ce15c71e0f84daabbfaae18aa97700c3 +size 1440044 diff --git a/scripts/testv/stv2OA32c_cut.wav b/scripts/testv/stv2OA32c_cut.wav new file mode 100644 index 0000000000..7e5c6aae89 --- /dev/null +++ b/scripts/testv/stv2OA32c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:038b5280a4c975ae3b6206d9b69ff513493f975d41c71d04a95209960e7a629b +size 2880044 diff --git a/scripts/testv/stv2OA32c_cut_.004.wav b/scripts/testv/stv2OA32c_cut_.004.wav new file mode 100644 index 0000000000..3f8956143d --- /dev/null +++ b/scripts/testv/stv2OA32c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db2a43841dbbd87cc152d7e703e53da77059ca8f52e92030990b2d884aaeea57 +size 2880044 diff --git a/scripts/testv/stv2OA32c_cut_16.0.wav b/scripts/testv/stv2OA32c_cut_16.0.wav new file mode 100644 index 0000000000..5f0d85863c --- /dev/null +++ b/scripts/testv/stv2OA32c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f287429064e1a79f9f2c0b1d2bf0e6a8badc6224e9b12b67cd30975b1224cf4b +size 2880044 diff --git a/scripts/testv/stv2OA48c_cut.wav b/scripts/testv/stv2OA48c_cut.wav new file mode 100644 index 0000000000..eb8d0a3f62 --- /dev/null +++ b/scripts/testv/stv2OA48c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df84bfe267d016665865ef1eced65c0150afb9b9a4890efd86ffbb87be36668e +size 4320044 diff --git a/scripts/testv/stv2OA48c_cut_.004.wav b/scripts/testv/stv2OA48c_cut_.004.wav new file mode 100644 index 0000000000..af076a2ccc --- /dev/null +++ b/scripts/testv/stv2OA48c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f1b7acc2b75144f970c0a158ae1706365c8247dec14ad43967360f1abf5c09a +size 4320044 diff --git a/scripts/testv/stv2OA48c_cut_16.0.wav b/scripts/testv/stv2OA48c_cut_16.0.wav new file mode 100644 index 0000000000..5ce1e0b733 --- /dev/null +++ b/scripts/testv/stv2OA48c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07d7bd51701997a3301ccee71e421c422388b8a076cc8b0b23b169da55a4b1b3 +size 4320044 diff --git a/scripts/testv/stv3OA16c_cut.wav b/scripts/testv/stv3OA16c_cut.wav new file mode 100644 index 0000000000..0a2952b90c --- /dev/null +++ b/scripts/testv/stv3OA16c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35950b5b10ca76e910ae5294ee108d4d5b5fd1404aa69f678b035dd24438172e +size 2560044 diff --git a/scripts/testv/stv3OA16c_cut_.004.wav b/scripts/testv/stv3OA16c_cut_.004.wav new file mode 100644 index 0000000000..258b0b6d0b --- /dev/null +++ b/scripts/testv/stv3OA16c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97fdb3191b17a60372f8f71d923f2bd0365c239a3ed5b9ff5a35a0cb94a2002f +size 2560044 diff --git a/scripts/testv/stv3OA16c_cut_16.0.wav b/scripts/testv/stv3OA16c_cut_16.0.wav new file mode 100644 index 0000000000..f835fb1c0c --- /dev/null +++ b/scripts/testv/stv3OA16c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:377e348577a95275dfc6741a30693678c462726968d07557e456d3bd709674f0 +size 2560044 diff --git a/scripts/testv/stv3OA32c_cut.wav b/scripts/testv/stv3OA32c_cut.wav new file mode 100644 index 0000000000..9839a146f0 --- /dev/null +++ b/scripts/testv/stv3OA32c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:841d1c86539c0842013c9ad3a562bdcc0d69ebd5c41f8655536898bbb7e79d35 +size 5120044 diff --git a/scripts/testv/stv3OA32c_cut_.004.wav b/scripts/testv/stv3OA32c_cut_.004.wav new file mode 100644 index 0000000000..6ed3da7e3b --- /dev/null +++ b/scripts/testv/stv3OA32c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4536b7f93ab6e12e1714ce419af8c7477790b71d0372bb430c9a2d46424cbdcc +size 5120044 diff --git a/scripts/testv/stv3OA32c_cut_16.0.wav b/scripts/testv/stv3OA32c_cut_16.0.wav new file mode 100644 index 0000000000..db3f20c704 --- /dev/null +++ b/scripts/testv/stv3OA32c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04cc8770deaf7899966ea1b94aa290a5a4ae2c712c85c51805ee2a6eeb409a2b +size 5120044 diff --git a/scripts/testv/stv3OA48c_cut.wav b/scripts/testv/stv3OA48c_cut.wav new file mode 100644 index 0000000000..6be77fbd8a --- /dev/null +++ b/scripts/testv/stv3OA48c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd905c085de10ea6cb3e753eae5a053082909a0022364c2a22b6ddc3319cbd8e +size 7680044 diff --git a/scripts/testv/stv3OA48c_cut_.004.wav b/scripts/testv/stv3OA48c_cut_.004.wav new file mode 100644 index 0000000000..0a7a771757 --- /dev/null +++ b/scripts/testv/stv3OA48c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:794c7cf7321d0e9c811358195f9bc8d28ba564ff22a6af587376c83b46361c22 +size 7680044 diff --git a/scripts/testv/stv3OA48c_cut_16.0.wav b/scripts/testv/stv3OA48c_cut_16.0.wav new file mode 100644 index 0000000000..8e3f436df2 --- /dev/null +++ b/scripts/testv/stv3OA48c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:232f2d173e864ac3843197e2d6c291881980aa22710aa0a16f518b5684d25ae4 +size 7680044 diff --git a/scripts/testv/stvFOA16c_cut.wav b/scripts/testv/stvFOA16c_cut.wav new file mode 100644 index 0000000000..6529a74cf3 --- /dev/null +++ b/scripts/testv/stvFOA16c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7cefe32372f32cf518486b4dd5bdb599a34a877b5822152d62777d0be723cffd +size 640044 diff --git a/scripts/testv/stvFOA16c_cut_.004.wav b/scripts/testv/stvFOA16c_cut_.004.wav new file mode 100644 index 0000000000..9d07f0d7d4 --- /dev/null +++ b/scripts/testv/stvFOA16c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56c7fe054cb42b39ba8e4ff67d00adcf0fe82edfcdaf58179380708ea9dc760b +size 640044 diff --git a/scripts/testv/stvFOA16c_cut_16.0.wav b/scripts/testv/stvFOA16c_cut_16.0.wav new file mode 100644 index 0000000000..7ede9f2692 --- /dev/null +++ b/scripts/testv/stvFOA16c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23c1baac936d4ee00304b8da8847fc201bf5658827bf5155038ea73dd50048ce +size 640044 diff --git a/scripts/testv/stvFOA32c_cut.wav b/scripts/testv/stvFOA32c_cut.wav new file mode 100644 index 0000000000..1fc25fcd62 --- /dev/null +++ b/scripts/testv/stvFOA32c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e204055ee1daeecc715f8d167532ba6b49b022c7671487f6abcadca0fc33bea +size 1280044 diff --git a/scripts/testv/stvFOA32c_cut_.004.wav b/scripts/testv/stvFOA32c_cut_.004.wav new file mode 100644 index 0000000000..a122bc2098 --- /dev/null +++ b/scripts/testv/stvFOA32c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55037196717e4e8f0f4b532381e0770642ace75adfac0524230e09ef7b407635 +size 1280044 diff --git a/scripts/testv/stvFOA32c_cut_16.0.wav b/scripts/testv/stvFOA32c_cut_16.0.wav new file mode 100644 index 0000000000..213a894796 --- /dev/null +++ b/scripts/testv/stvFOA32c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e55b8064e43221eff40393b903c973aae937244874f677f4a9358c8cb16caba +size 1280044 diff --git a/scripts/testv/stvFOA48c_cut.wav b/scripts/testv/stvFOA48c_cut.wav new file mode 100644 index 0000000000..7f3c6231ec --- /dev/null +++ b/scripts/testv/stvFOA48c_cut.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d86c4f8fcd8de2395cbe83a9d7846c107bf4a34c4878c6731827ff2acf6f9a7 +size 1920044 diff --git a/scripts/testv/stvFOA48c_cut_.004.wav b/scripts/testv/stvFOA48c_cut_.004.wav new file mode 100644 index 0000000000..f6bbf0f1ff --- /dev/null +++ b/scripts/testv/stvFOA48c_cut_.004.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5e40af6a3133a734abebb25071de55cec175d824b381ae92948489ef2099cc5 +size 1920044 diff --git a/scripts/testv/stvFOA48c_cut_16.0.wav b/scripts/testv/stvFOA48c_cut_16.0.wav new file mode 100644 index 0000000000..30a9b21f2c --- /dev/null +++ b/scripts/testv/stvFOA48c_cut_16.0.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07ba1c3ebfe3c427fab6efc0c9f58b3bfe3a744e5cb394653ac92457d6b46250 +size 1920044 diff --git a/tests/create_short_testvectors.py b/tests/create_short_testvectors.py index 8efa0894d9..305fc78d92 100755 --- a/tests/create_short_testvectors.py +++ b/tests/create_short_testvectors.py @@ -76,8 +76,6 @@ def create_short_testvectors(which="sba", cut_len=5.0): file_ids = [] if which == "all": file_ids = FILE_IDS - elif which == "sba": - file_ids = FILE_IDS[:3] for f in collect_files(file_ids): for g in GAINS: -- GitLab From 5ce75400d698a9edc5a1d506c2a2dec29b3b17df Mon Sep 17 00:00:00 2001 From: rtyag Date: Thu, 16 May 2024 10:15:10 +1000 Subject: [PATCH 5/7] modify yml file to remove create short testvectors --- .gitlab-ci.yml | 11 ----------- tests/create_short_testvectors.py | 3 --- 2 files changed, 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be07b53f13..e740627fca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -602,8 +602,6 @@ pytest-compare-20ms-and-5ms-rendering: ### prepare pytest - cp IVAS_cod IVAS_cod_ref - cp IVAS_dec IVAS_dec_ref - # create short test vectors - - python3 tests/create_short_testvectors.py # create references - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 @@ -920,8 +918,6 @@ ivas-pytest-on-merge-request: - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi ### prepare pytest - # create short test vectors - - python3 tests/create_short_testvectors.py # create references - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 @@ -975,8 +971,6 @@ ivas-interop-on-merge-request: - non_interop_flag=$(grep -c --ignore-case "\[non[ -]*io\]" tmp.txt) || true ### prepare pytest - # create short test vectors - - python3 tests/create_short_testvectors.py # Run reference creation, using source branch encoder and main decoder (see .merge-request-comparison-setup-codec) - exit_code=0 @@ -1300,8 +1294,6 @@ codec-comparison-on-main-push: - if [ $ref_using_main == 0 ]; then git checkout $latest_commit;fi ### prepare pytest - # create short test vectors - - python3 tests/create_short_testvectors.py # rename test binaries back - mv IVAS_cod_test IVAS_cod - mv IVAS_dec_test IVAS_dec @@ -1385,7 +1377,6 @@ ivas-conformance: - cp -force IVAS_rend.exe IVAS_rend_ref.exe # Reference creation - - python tests/create_short_testvectors.py - python scripts/prepare_combined_format_inputs.py - $TEST_SET = "tests/codec_be_on_mr_nonselection", "tests/renderer/test_renderer.py", "tests/split_rendering/test_split_rendering.py" - python -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files @@ -1479,7 +1470,6 @@ ivas-conformance-linux: - cp IVAS_rend IVAS_rend_ref # Reference creation - - python3 tests/create_short_testvectors.py - python3 scripts/prepare_combined_format_inputs.py - TEST_SET="tests/codec_be_on_mr_nonselection tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py" - python3 -m pytest $TEST_SET -v -n auto --update_ref 1 -m create_ref --create_ref --keep_files @@ -2237,7 +2227,6 @@ coverage-test-on-main-scheduled: - *copy-ltv-files-to-testv-dir - make GCOV=1 -j - cp IVAS_rend IVAS_rend_ref # Copy exec to be able to run renderer script - - python3 tests/create_short_testvectors.py - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v -n auto --update_ref 1 -m create_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v -n auto --update_ref 1 -m create_ref_part2 --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec # need to ignore non-zero exit codes as limiter is active and thus the different framesiszes will not be BE in all cases diff --git a/tests/create_short_testvectors.py b/tests/create_short_testvectors.py index 305fc78d92..e3329511a9 100755 --- a/tests/create_short_testvectors.py +++ b/tests/create_short_testvectors.py @@ -47,9 +47,6 @@ NUM_CHANNELS = "4" # currently only FOA CUT_FROM = "0.0" FILE_IDS = [ - "stvFOA", - "stv2OA", - "stv3OA", "stv51MC", "stv71MC", "stv512MC", -- GitLab From 8ee4df33a5528d3975dd836013d83b1b76c4d43e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 16 May 2024 10:35:54 +0200 Subject: [PATCH 6/7] cleanup in test_param_file.py and adjust filenames in config --- scripts/config/self_test.prm | 10 +++--- .../test_param_file.py | 19 ------------ tests/test_param_file_ltv.py | 31 ------------------- 3 files changed, 5 insertions(+), 55 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 1c194cc882..caf2f264e9 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -851,11 +851,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.wav_sw_48-48_7_1_4.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out -../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.wav bit +../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c_cut_.004.wav bit ../IVAS_dec BINAURAL 32 bit testv/stvFOA32c.wav_sw_32-32_DTX_BINAURAL.tst // SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, HOA3 out -../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c.wav bit +../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c_cut_.004.wav bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_sw_32-32_DTX_HOA3.tst // SBA FOA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, FOA out @@ -1773,14 +1773,14 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL_ROOM_REVERB 48 bit testv/stvOSBA_4ISM_p3OA48c.wav_BINAURAL_ROOM_REVERB_512000_48-48.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, EXT out -../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.wav bit +../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c_cut_.004.wav bit ../IVAS_dec EXT 32 bit testv/stvFOA32c.wav_sw_32-32_DTX_EXT.tst // SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, EXT out -../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c.wav bit +../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c_cut_.004.wav bit ../IVAS_dec EXT 32 bit testv/stv3OA32c.wav_sw_32-32_DTX_EXT.tst // SBA 2OA bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, EXT out, random FER at 5%, DTX on -../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv3OA48c.wav bit +../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv3OA48c_cut_.004.wav bit eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error ../IVAS_dec EXT 48 bit_error testv/stv3OA48c.wav_sw_48-48_EXT_FER5.tst diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 948c3ac560..e8de6decf3 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -39,12 +39,10 @@ import re import platform from pathlib import Path from subprocess import run -from tempfile import TemporaryDirectory import pytest from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend -from tests.cut_pcm import cut_samples from tests.testconfig import PARAM_FILE from . import MLD_PATTERN, MAX_DIFF_PATTERN @@ -165,17 +163,6 @@ def test_param_file_tests( sampling_rate = int(fs) bitrate = enc_split.pop() - sba_br_switching_dtx = 0 - if ( - not bitrate.isdigit() - and "-dtx" in enc_split - and "-sba" in enc_split - and Path(testv_file).name.startswith("stv") - ): - sba_br_switching_dtx = 1 - cut_file = pre_proc_input(testv_file, fs) - testv_file = cut_file - # bitrate can be a filename: remove leading "../" if bitrate.startswith("../"): bitrate = bitrate[3:] @@ -447,12 +434,6 @@ def encode( ) -def pre_proc_input(testv_file, fs): - cut_gain = ".004" - cut_file = testv_file.replace(".wav", "_cut_" + cut_gain + ".wav") - return cut_file - - def simulate( reference_path, dut_base_path, diff --git a/tests/test_param_file_ltv.py b/tests/test_param_file_ltv.py index 36efa91a2c..646258fabb 100644 --- a/tests/test_param_file_ltv.py +++ b/tests/test_param_file_ltv.py @@ -44,7 +44,6 @@ import pytest from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend -from tests.cut_pcm import cut_samples from .codec_be_on_mr_nonselection import MLD_PATTERN, MAX_DIFF_PATTERN # from tests.testconfig import PARAM_FILE @@ -167,17 +166,6 @@ def test_param_file_tests( sampling_rate = int(fs) bitrate = enc_split.pop() - sba_br_switching_dtx = 0 - if ( - not bitrate.isdigit() - and "-dtx" in enc_split - and "-sba" in enc_split - and testv_file.split("/")[1].startswith("stv") - ): - sba_br_switching_dtx = 1 - cut_file = pre_proc_input(testv_file, fs) - testv_file = cut_file - # bitrate can be a filename: remove leading "../" if bitrate.startswith("../"): bitrate = bitrate[3:] @@ -203,10 +191,6 @@ def test_param_file_tests( enc_split, update_ref, ) - if sba_br_switching_dtx == 1 and not keep_files: - is_exist = os.path.exists(cut_file) - if is_exist: - os.remove(cut_file) # check for networkSimulator_g192 command line if sim_opts != "": @@ -435,21 +419,6 @@ def encode( ) -def pre_proc_input(testv_file, fs): - cut_from = "0.0" - cut_len = "5.0" - cut_gain = "0.004" - if "stvFOA" in testv_file: - num_channel = "4" - elif "stv2OA" in testv_file: - num_channel = "9" - elif "stv3OA" in testv_file: - num_channel = "16" - cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav") - cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain) - return cut_file - - def simulate( reference_path, dut_base_path, -- GitLab From 1110f7fdfc45020b109bc806e03ca827f6ae42b9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 16 May 2024 10:51:06 +0200 Subject: [PATCH 7/7] cleanup in create_short_testvectors.py --- .gitlab-ci.yml | 2 +- tests/create_short_testvectors.py | 35 +++++++++++++------------------ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e740627fca..541aee3207 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1177,7 +1177,7 @@ check-bitexactness-hrtf-rom-and-file: - *print-common-info - cmake . - make -j - - python3 tests/create_short_testvectors.py --which all --cut_len 1.0 + - python3 tests/create_short_testvectors.py --cut_len 1.0 - python3 -m pytest tests/hrtf_binary_loading --html=report.html --junit-xml=report-junit.xml --self-contained-html artifacts: paths: diff --git a/tests/create_short_testvectors.py b/tests/create_short_testvectors.py index e3329511a9..87d05e001e 100755 --- a/tests/create_short_testvectors.py +++ b/tests/create_short_testvectors.py @@ -42,10 +42,13 @@ from cut_pcm import cut_samples HERE = Path(__file__).parent.resolve() TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() +SCRIPTS_DIR = HERE.joinpath("../scripts").resolve() -NUM_CHANNELS = "4" # currently only FOA -CUT_FROM = "0.0" +sys.path.append(SCRIPTS_DIR) +from pyaudio3dtools import audiofile +CUT_FROM = "0.0" +GAIN = "1.0" FILE_IDS = [ "stv51MC", "stv71MC", @@ -55,38 +58,31 @@ FILE_IDS = [ "ISM", "MASA", ] -GAINS = ["1.0", "16.0", ".004"] -def collect_files(file_ids): +def collect_files(): files = [ f.absolute() for f in TEST_VECTOR_DIR.iterdir() if f.suffix == ".wav" - and any([id in f.name for id in file_ids]) + and any([id in f.name for id in FILE_IDS]) and "_cut" not in f.name ] return files -def create_short_testvectors(which="sba", cut_len=5.0): - file_ids = [] - if which == "all": - file_ids = FILE_IDS - - for f in collect_files(file_ids): - for g in GAINS: - suffix = "_cut" - if g != "1.0": - suffix += f"_{g}" +def create_short_testvectors(cut_len=5.0): + files = collect_files() - out_file = f.parent.joinpath(f.stem + suffix + f.suffix) - cut_samples(f, out_file, NUM_CHANNELS, CUT_FROM, f"{cut_len}", g) + for f in files: + suffix = "_cut" + out_file = f.parent.joinpath(f.stem + suffix + f.suffix) + num_channels = audiofile.get_wav_file_info(f)["channels"] + cut_samples(f, out_file, num_channels, CUT_FROM, f"{cut_len}", GAIN) if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument("--which", choices=["sba", "all"], default="sba") def positive_float(x: str) -> float: x = float(x) @@ -96,6 +92,5 @@ if __name__ == "__main__": parser.add_argument("--cut_len", type=positive_float, default=5.0) args = parser.parse_args() - which = args.which cut_len = args.cut_len - sys.exit(create_short_testvectors(which=args.which, cut_len=cut_len)) + sys.exit(create_short_testvectors(cut_len=cut_len)) -- GitLab