Commit c845f674 authored by norvell's avatar norvell
Browse files

Merge branch 'main' into 1271-support-tcx10-tcx20-in-the-create_mode_force-py-script

parents bf7f8327 fe73ba2b
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -424,9 +424,13 @@ def dut_encoder_path(request) -> str:


# fixture returns test information, enabling per-testcase SNR
@pytest.fixture
@pytest.fixture(scope="function")
def test_info(request):
    return request
    yield request

    # Check for errors during teardown to report error instead of failure
    if hasattr(request, "error"):
        pytest.fail(request.error)


class EncoderFrontend:
+7 −5
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import pyaudio3dtools


def run_encoder(
    test_info,
    bitrate: int,
    sampling_rate: int,
    input_file: str,
@@ -88,10 +89,11 @@ def run_encoder(
        str(output_file),
    ]

    run_cmd(cmd)
    run_cmd(cmd, test_info)


def run_decoder(
    test_info,
    output_config: str,
    output_sampling_rate: int,
    input_bitstream_path: Path,
@@ -125,7 +127,7 @@ def run_decoder(
        str(output_path),
    ]

    run_cmd(cmd)
    run_cmd(cmd, test_info)


def get_option_list_str(option_list):
@@ -304,7 +306,7 @@ def compare_rom_vs_binary(
        input_path = TESTV_DIR.joinpath(in_file).with_suffix(".wav")
    bitstream_path = BITSTREAM_DIR.joinpath(in_file + file_ext)
    run_encoder(
        bitrate, in_fs, input_path, bitstream_path, add_option_list=option_list_enc
        test_info, bitrate, in_fs, input_path, bitstream_path, add_option_list=option_list_enc
    )

    if trj_file is not None:
@@ -314,7 +316,7 @@ def compare_rom_vs_binary(
        option_list_dec = None
    out_rom_path = DEC_ROM_DIR.joinpath(in_file + file_ext).with_suffix(".wav")
    run_decoder(
        out_fmt, out_fs, bitstream_path, out_rom_path, add_option_list=option_list_dec
        test_info, out_fmt, out_fs, bitstream_path, out_rom_path, add_option_list=option_list_dec
    )
    out_rom, out_rom_fs = pyaudio3dtools.audiofile.readfile(out_rom_path)

@@ -326,7 +328,7 @@ def compare_rom_vs_binary(

    out_bin_path = DEC_BINARY_DIR.joinpath(in_file + file_ext).with_suffix(".wav")
    run_decoder(
        out_fmt, out_fs, bitstream_path, out_bin_path, add_option_list=option_list_dec
        test_info, out_fmt, out_fs, bitstream_path, out_bin_path, add_option_list=option_list_dec
    )
    out_bin, out_bin_fs = pyaudio3dtools.audiofile.readfile(out_bin_path)

+7 −8
Original line number Diff line number Diff line
@@ -64,14 +64,13 @@ from ..cmp_pcm import cmp_pcm
from ..conftest import parse_properties


def run_cmd(cmd, env=None):
def run_cmd(cmd, test_info, env=None):
    logging.info(f"\nRunning command\n{' '.join(cmd)}\n")
    try:
        sp.run(cmd, check=True, capture_output=True, text=True, env=env)
    except sp.CalledProcessError as e:
        raise SystemError(
            f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
        )
        test_info.error = f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
        raise SystemError(test_info.error)


def run_isar_ext_rend_cmd(cmd, env=None):
@@ -310,7 +309,7 @@ def run_renderer(
        )

    # run the renderer
    run_cmd(cmd, env)
    run_cmd(cmd, test_info, env)

    if test_info.config.option.create_cut and not render_for_peaq:
        # CUT creation mode will run a comparison with REF
@@ -350,12 +349,12 @@ def run_renderer(
                    cmd2[0] += binary_suffix
                    if "MASA" in str(out_fmt):
                        cmd2.extend(["-im", out_file + ".met"])
                    run_cmd(cmd2, env)
                    run_cmd(cmd2, test_info, env)

                    # Render ref to BINAURAL with same settings as test
                    cmd2[2] = str(out_file_ref)  # in_file
                    cmd2[6] = odg_ref            # out_file
                    run_cmd(cmd2, env)
                    run_cmd(cmd2, test_info, env)
                    out_fmt_bin = new_fmt
            else:
                out_fmt_bin = out_fmt
@@ -368,7 +367,7 @@ def run_renderer(
                cmd[0] += binary_suffix
                cmd[6] = odg_input       # out_file
                cmd[8] = out_fmt_bin     # out_fmt
                run_cmd(cmd, env)
                run_cmd(cmd, test_info, env)
            else:
                odg_input = in_file

+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ from typing import Tuple
import numpy as np
import pytest

from tests.renderer.utils import check_BE, run_cmd, 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 *

sys.path.append(SCRIPTS_DIR)