Commit edc2f442 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '1357-ci-review-usage-of-check_be-function-in-split-rendering-pytest' into 'main'

[CI] Resolve #1357 - Use cmp_pcm instead of check_BE in split rendering tests

See merge request !2193
parents fb5d349b 982d15e9
Loading
Loading
Loading
Loading
Loading
+38 −76
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import numpy as np
import pytest

from tests.renderer.utils import (
    check_BE,
    run_ivas_isar_enc_cmd,
    run_ivas_isar_dec_cmd,
    run_isar_post_rend_cmd,
@@ -290,29 +289,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,
@@ -445,30 +426,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,