Commit 518abd2d authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'ci/fix-split-comparison-for-split-rendering' into 'basop-ci-branch'

fix split rendering tests

See merge request !2095
parents e053eb2b 6931121b
Loading
Loading
Loading
Loading
+82 −61
Original line number Diff line number Diff line
@@ -39,7 +39,13 @@ from typing import Tuple
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, run_isar_ext_rend_cmd
from tests.renderer.utils import (
    check_BE,
    run_ivas_isar_enc_cmd,
    run_ivas_isar_dec_cmd,
    run_isar_post_rend_cmd,
    run_isar_ext_rend_cmd,
)
from tests.split_rendering.constants import *
from ..cmp_pcm import cmp_pcm
from ..conftest import parse_properties
@@ -62,8 +68,10 @@ def lc3plus_used(test_info, in_fmt, render_config):
        or ("default" in render_config and "external_split" in test_info.node.name)
    )


FRAME_SIZE_RE = re.compile(r"(\d+)ms")


def transport_codec_frame_size_ms(test_info, in_fmt, render_config, pre_rend_fr):
    explicit_frame_size_ms = FRAME_SIZE_RE.search(render_config)

@@ -176,7 +184,9 @@ def run_full_chain_split_rendering(
    the IVAS encoder, decoder and split renderer
    """

    check_xfail(test_info, in_fmt, render_config.name, pre_rend_fr, post_rend_fr, bitrate)
    check_xfail(
        test_info, in_fmt, render_config.name, pre_rend_fr, post_rend_fr, bitrate
    )

    with TemporaryDirectory() as tmp_dir:
        tmp_dir = Path(tmp_dir)
@@ -206,7 +216,11 @@ def run_full_chain_split_rendering(
        if in_fmt.upper().startswith("OSBA"):
            # use same MD as ISM
            in_meta_files = FORMAT_TO_METADATA_FILES[f"ISM{in_fmt[5]}"]
        elif in_fmt.upper().startswith("ISM") or in_fmt.upper().startswith("MASA") or in_fmt.upper().startswith("OMASA"):
        elif (
            in_fmt.upper().startswith("ISM")
            or in_fmt.upper().startswith("MASA")
            or in_fmt.upper().startswith("OMASA")
        ):
            in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
        else:
            in_meta_files = None
@@ -283,18 +297,19 @@ def run_full_chain_split_rendering(

        cut, cut_fs = readfile(out_file)

        if get_mld == False:
            [diff_found, snr, gain_b, max_diff] = check_BE(test_info, ref, ref_fs, cut, cut_fs)
        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,
                "BINAURAL",
                2,  # is always "BINAURAL"
                ref_fs,
                get_mld=get_mld,
                mld_lim=mld_lim,
@@ -303,6 +318,10 @@ def run_full_chain_split_rendering(
                get_odg_bin=get_odg_bin,
            )

            # NOTE: split comparison not implemented for split rendering, always unpack values
            reason = reason[0]
            output_differs = output_differs[0]

            props = parse_properties(reason, output_differs, props_to_record)
            for k, v in props.items():
                record_property(k, v)
@@ -310,8 +329,6 @@ def run_full_chain_split_rendering(
            if output_differs:
                pytest.fail(f"Output differs: ({reason})")

            
            
    return out_file


@@ -434,7 +451,9 @@ def run_external_split_rendering(
        cut, cut_fs = readfile(out_file)

        if get_mld == False:
            [diff_found, snr, gain_b, max_diff] = check_BE(test_info, ref, ref_fs, cut, cut_fs)
            [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)}"
@@ -444,7 +463,7 @@ def run_external_split_rendering(
            output_differs, reason = cmp_pcm(
                out_file,
                out_file_ref,
                "BINAURAL",
                2,  # is always "BINAURAL",
                ref_fs,
                get_mld=get_mld,
                mld_lim=mld_lim,
@@ -452,6 +471,9 @@ def run_external_split_rendering(
                get_odg=get_odg,
                get_odg_bin=get_odg_bin,
            )
            # NOTE: split comparison not implemented for split rendering, always unpack values
            reason = reason[0]
            output_differs = output_differs[0]

            props = parse_properties(reason, output_differs, props_to_record)
            for k, v in props.items():
@@ -460,5 +482,4 @@ def run_external_split_rendering(
            if output_differs:
                pytest.fail(f"Output differs: ({reason})")

            
    return out_file