Loading tests/hrtf_binary_loading/test_codec_ROM_vs_file.py +18 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,12 @@ import itertools from tests.hrtf_binary_loading.utils import * from .constants import HRTF_TAGS, MC_BITRATE_FOR_FORMAT, HRTF_TAG_DIFF_FROM_ROM from .constants import ( HRTF_TAGS, MC_BITRATE_FOR_FORMAT, HRTF_TAG_DIFF_FROM_ROM, HRTF_TAG_SAME_AS_ROM, ) """ Binary file """ Loading Loading @@ -237,6 +242,9 @@ def test_masa_binaural_headrotation( @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("hrtf_tag", HRTF_TAGS) def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading Loading @@ -269,6 +277,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag): def test_ism_binaural_headrotation( test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading Loading @@ -302,6 +313,9 @@ def test_ism_binaural_headrotation( @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("hrtf_tag", HRTF_TAGS) def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading Loading @@ -334,6 +348,9 @@ def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf def test_ism_binaural_roomreverb_headrotation( test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading tests/hrtf_binary_loading/test_renderer_ROM_vs_file.py +6 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,9 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( def test_ism_binaural_static_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] except: Loading @@ -150,6 +153,9 @@ def test_ism_binaural_static_with_binary_hrir( def test_ism_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] except: Loading tests/hrtf_binary_loading/utils.py +2 −2 Original line number Diff line number Diff line Loading @@ -325,7 +325,7 @@ def compare_rom_vs_binary( ) out_bin, out_bin_fs = pyaudio3dtools.audiofile.readfile(out_bin_path) check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail) check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail, 0) if keep_file == False: os.remove(bitstream_path) os.remove(out_rom_path) Loading Loading @@ -393,7 +393,7 @@ def compare_renderer_vs_renderer_with_binary_hrir( ref, ref_fs = pyaudio3dtools.audiofile.readfile(ref_out) cut, cut_fs = pyaudio3dtools.audiofile.readfile(cut_out) check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail) check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail, 0) if keep_file == False: os.remove(ref_out) os.remove(cut_out) tests/renderer/utils.py +2 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ def check_BE( cut: np.ndarray, cut_fs: int, xfail: bool = False, atol: int = 2 ): if ref is None or np.array_equal(ref, np.zeros_like(ref)): pytest.fail("REF signal does not exist or is zero!") Loading @@ -89,7 +90,7 @@ def check_BE( cut = np.pad(cut, [(0, ref.shape[0] - cut.shape[0]), (0, 0)]) # check max_diff as well, since compare_audio_arrays will try to adjust for small delay differences diff_found = not np.allclose(ref, cut, rtol=0, atol=2) and max_diff > 2 diff_found = not np.allclose(ref, cut, rtol=0, atol=atol) if diff_found and not xfail: pytest.fail( f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}" Loading Loading
tests/hrtf_binary_loading/test_codec_ROM_vs_file.py +18 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,12 @@ import itertools from tests.hrtf_binary_loading.utils import * from .constants import HRTF_TAGS, MC_BITRATE_FOR_FORMAT, HRTF_TAG_DIFF_FROM_ROM from .constants import ( HRTF_TAGS, MC_BITRATE_FOR_FORMAT, HRTF_TAG_DIFF_FROM_ROM, HRTF_TAG_SAME_AS_ROM, ) """ Binary file """ Loading Loading @@ -237,6 +242,9 @@ def test_masa_binaural_headrotation( @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("hrtf_tag", HRTF_TAGS) def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading Loading @@ -269,6 +277,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag): def test_ism_binaural_headrotation( test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading Loading @@ -302,6 +313,9 @@ def test_ism_binaural_headrotation( @pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) @pytest.mark.parametrize("hrtf_tag", HRTF_TAGS) def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf_tag): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading Loading @@ -334,6 +348,9 @@ def test_ism_binaural_roomreverb_static(test_info, in_fmt, out_fs, out_fmt, hrtf def test_ism_binaural_roomreverb_headrotation( test_info, in_fmt, out_fs, out_fmt, trj_file, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") in_fs = 48 bitrate = BITRATE_ISM[in_fmt] option_list = ["-ism", in_fmt] Loading
tests/hrtf_binary_loading/test_renderer_ROM_vs_file.py +6 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,9 @@ def test_multichannel_binaural_headrotation_with_binary_hrir( def test_ism_binaural_static_with_binary_hrir( test_info, in_fmt, out_fmt, frame_size, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] except: Loading @@ -150,6 +153,9 @@ def test_ism_binaural_static_with_binary_hrir( def test_ism_binaural_headrotation_with_binary_hrir( test_info, in_fmt, out_fmt, trj_file, frame_size, hrtf_tag ): if in_fmt == "4" and hrtf_tag == HRTF_TAG_SAME_AS_ROM: pytest.skip("Skipping ParamBin until binary and ROM contain same data") try: in_meta_files = FORMAT_TO_METADATA_FILES_RENDERER[in_fmt] except: Loading
tests/hrtf_binary_loading/utils.py +2 −2 Original line number Diff line number Diff line Loading @@ -325,7 +325,7 @@ def compare_rom_vs_binary( ) out_bin, out_bin_fs = pyaudio3dtools.audiofile.readfile(out_bin_path) check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail) check_BE(test_info, out_rom, out_rom_fs, out_bin, out_bin_fs, xfail, 0) if keep_file == False: os.remove(bitstream_path) os.remove(out_rom_path) Loading Loading @@ -393,7 +393,7 @@ def compare_renderer_vs_renderer_with_binary_hrir( ref, ref_fs = pyaudio3dtools.audiofile.readfile(ref_out) cut, cut_fs = pyaudio3dtools.audiofile.readfile(cut_out) check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail) check_BE(test_info, ref, ref_fs, cut, cut_fs, xfail, 0) if keep_file == False: os.remove(ref_out) os.remove(cut_out)
tests/renderer/utils.py +2 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ def check_BE( cut: np.ndarray, cut_fs: int, xfail: bool = False, atol: int = 2 ): if ref is None or np.array_equal(ref, np.zeros_like(ref)): pytest.fail("REF signal does not exist or is zero!") Loading @@ -89,7 +90,7 @@ def check_BE( cut = np.pad(cut, [(0, ref.shape[0] - cut.shape[0]), (0, 0)]) # check max_diff as well, since compare_audio_arrays will try to adjust for small delay differences diff_found = not np.allclose(ref, cut, rtol=0, atol=2) and max_diff > 2 diff_found = not np.allclose(ref, cut, rtol=0, atol=atol) if diff_found and not xfail: pytest.fail( f"CuT not BE to REF! SNR : {snr:3.2f} dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}" Loading