Commit eb672b93 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main' into scripts-updates-to-basop-ci-branch

parents 72f620cb 2bff0b96
Loading
Loading
Loading
Loading
Loading
+88 −62
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ from typing import Tuple

import numpy as np
import pytest
import logging

from tests.renderer.utils import (
    check_BE,
@@ -178,6 +179,7 @@ def run_full_chain_split_rendering(
    get_ssnr=False,
    get_odg=False,
    get_odg_bin=False,
    delay_profile: Optional[Path] = None,
) -> str:
    """
    Runs the full split rendering chain consisting of
@@ -228,63 +230,80 @@ def run_full_chain_split_rendering(
            in_meta_files = None

        # run encoder
        cmd = SPLIT_PRE_COD_CMD[:]
        enc_cmd = SPLIT_PRE_COD_CMD[:]

        if test_info.config.option.create_ref:
            cmd[0] += BIN_SUFFIX_MERGETARGET
        cmd[0] += binary_suffix
        cmd[1] = bitrate
            enc_cmd[0] += BIN_SUFFIX_MERGETARGET
        enc_cmd[0] += binary_suffix
        enc_cmd[1] = bitrate
        # if in REF or CUT creation mode use the comparetestv
        if test_info.config.option.create_ref or test_info.config.option.create_cut:
            in_file = FORMAT_TO_FILE_COMPARETEST[in_fmt]
            truncate_signal(in_file, cut_in_file)

            cmd[3] = str(cut_in_file)
            enc_cmd[3] = str(cut_in_file)
        else:
            cmd[3] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt])
        cmd[4] = str(ivas_bitstream)
            enc_cmd[3] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt])
        enc_cmd[4] = str(ivas_bitstream)

        if in_meta_files:
            cmd[1:1] = in_meta_files

        cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt]

        run_ivas_isar_enc_cmd(cmd)
            enc_cmd[1:1] = in_meta_files

        enc_cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt]

        run_ivas_isar_enc_cmd(enc_cmd)

        if delay_profile:
            rtp_bitstream = ivas_bitstream.with_suffix(".rtpg192")
            netsim_cmd = [
                str(TOOLS_DIR / f"networkSimulator_g192{EXE_SUFFIX}"),
                str(delay_profile),
                str(ivas_bitstream),
                str(rtp_bitstream),
                str(tmp_dir / "tmp.netsimtrace"),
                "1",
                "0",
            ]
            run_cmd(netsim_cmd, test_info=test_info)
            ivas_bitstream = rtp_bitstream

        # decode to split-rendering bitstream
        cmd = SPLIT_PRE_DEC_CMD[:]
        dec_cmd = SPLIT_PRE_DEC_CMD[:]

        if test_info.config.option.create_ref:
            cmd[0] += BIN_SUFFIX_MERGETARGET
        cmd[0] += binary_suffix
        cmd[2] = str(pre_trajectory)
        cmd[4] = str(render_config)
        cmd[6] = str(pre_rend_fr)
        cmd[7] = renderer_fmt
        cmd[9] = str(ivas_bitstream)
        cmd[10] = str(split_bitstream)
            dec_cmd[0] += BIN_SUFFIX_MERGETARGET
        dec_cmd[0] += binary_suffix
        dec_cmd[2] = str(pre_trajectory)
        dec_cmd[4] = str(render_config)
        dec_cmd[6] = str(pre_rend_fr)
        dec_cmd[7] = renderer_fmt
        dec_cmd[9] = str(ivas_bitstream)
        dec_cmd[10] = str(split_bitstream)

        if renderer_fmt == "BINAURAL_SPLIT_PCM":
            cmd[5:5] = ["-om", str(split_md_file)]
            dec_cmd[5:5] = ["-om", str(split_md_file)]

        if delay_profile:
            dec_cmd[5:5] = ["-voip"]

        run_ivas_isar_dec_cmd(cmd)
        run_ivas_isar_dec_cmd(dec_cmd)

        # run split renderer
        cmd = SPLIT_POST_REND_CMD[:]
        post_rend_cmd = SPLIT_POST_REND_CMD[:]

        if test_info.config.option.create_ref:
            cmd[0] += BIN_SUFFIX_MERGETARGET
        cmd[0] += binary_suffix
        cmd[4] = str(split_bitstream)
        cmd[6] = renderer_fmt
        cmd[8] = str(out_file)
        cmd[10] = str(post_trajectory)
        cmd[12] = post_rend_fr
            post_rend_cmd[0] += BIN_SUFFIX_MERGETARGET
        post_rend_cmd[0] += binary_suffix
        post_rend_cmd[4] = str(split_bitstream)
        post_rend_cmd[6] = renderer_fmt
        post_rend_cmd[8] = str(out_file)
        post_rend_cmd[10] = str(post_trajectory)
        post_rend_cmd[12] = post_rend_fr

        if renderer_fmt == "BINAURAL_SPLIT_PCM":
            cmd[7:7] = ["-im", str(split_md_file)]
            post_rend_cmd[7:7] = ["-im", str(split_md_file)]

        run_isar_post_rend_cmd(cmd)
        run_isar_post_rend_cmd(post_rend_cmd)

    if test_info.config.option.create_cut:
        # CUT creation mode will run a comparison with REF
@@ -329,6 +348,11 @@ def run_full_chain_split_rendering(
                record_property(k, v)

        if output_differs:
            logging.error(f"Encoder command line was: {' '.join(enc_cmd)}")
            if delay_profile:
                logging.error(f"Netsim command line was: {' '.join(netsim_cmd)}")
            logging.error(f"Decoder command line was: {' '.join(dec_cmd)}")
            logging.error(f"Post renderer command line was: {' '.join(post_rend_cmd)}")
            pytest.fail(f"Output differs: ({reason})")

    return out_file
@@ -390,52 +414,52 @@ def run_external_split_rendering(
            in_meta_files = None

        # generate split-rendering bitstream
        cmd = SPLIT_PRE_REND_CMD[:]
        split_pre_cmd = SPLIT_PRE_REND_CMD[:]

        if test_info.config.option.create_ref:
            cmd[0] += BIN_SUFFIX_MERGETARGET
        cmd[0] += binary_suffix
        cmd[4] = str(render_config)
            split_pre_cmd[0] += BIN_SUFFIX_MERGETARGET
        split_pre_cmd[0] += binary_suffix
        split_pre_cmd[4] = str(render_config)
        if is_comparetest:
            in_file = FORMAT_TO_FILE_COMPARETEST[in_fmt]
            truncate_signal(in_file, cut_in_file)

            cmd[6] = str(cut_in_file)
            split_pre_cmd[6] = str(cut_in_file)
        else:
            cmd[6] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt])
        cmd[8] = in_fmt
        cmd[10] = str(split_bitstream)
        cmd[12] = renderer_fmt
        cmd[14] = str(pre_trajectory)
        cmd[16] = pre_rend_fr
            split_pre_cmd[6] = str(FORMAT_TO_FILE_SMOKETEST[in_fmt])
        split_pre_cmd[8] = in_fmt
        split_pre_cmd[10] = str(split_bitstream)
        split_pre_cmd[12] = renderer_fmt
        split_pre_cmd[14] = str(pre_trajectory)
        split_pre_cmd[16] = pre_rend_fr

        if renderer_fmt == "BINAURAL_SPLIT_PCM":
            cmd[13:13] = ["-om", str(split_md_file)]
            split_pre_cmd[13:13] = ["-om", str(split_md_file)]

        if in_meta_files:
            cmd[9:9] = ["-im", *in_meta_files]
            split_pre_cmd[9:9] = ["-im", *in_meta_files]

        run_isar_ext_rend_cmd(cmd)
        run_isar_ext_rend_cmd(split_pre_cmd)

        # run split renderer
        cmd = SPLIT_POST_REND_CMD[:]
        split_post_cmd = SPLIT_POST_REND_CMD[:]

        if test_info.config.option.create_ref:
            cmd[0] += BIN_SUFFIX_MERGETARGET
        cmd[0] += binary_suffix
        cmd[4] = str(split_bitstream)
        cmd[6] = renderer_fmt
        cmd[8] = str(out_file)
        cmd[10] = str(post_trajectory)
        cmd[12] = post_rend_fr
            split_post_cmd[0] += BIN_SUFFIX_MERGETARGET
        split_post_cmd[0] += binary_suffix
        split_post_cmd[4] = str(split_bitstream)
        split_post_cmd[6] = renderer_fmt
        split_post_cmd[8] = str(out_file)
        split_post_cmd[10] = str(post_trajectory)
        split_post_cmd[12] = post_rend_fr

        if renderer_fmt == "BINAURAL_SPLIT_PCM":
            cmd[7:7] = ["-im", str(split_md_file)]
            split_post_cmd[7:7] = ["-im", str(split_md_file)]

        if plc_error_pattern:
            cmd[1:1] = ["-prbfi", str(plc_error_pattern)]
            split_post_cmd[1:1] = ["-prbfi", str(plc_error_pattern)]

        run_isar_ext_rend_cmd(cmd)
        run_isar_ext_rend_cmd(split_post_cmd)

    if test_info.config.option.create_cut:
        # CUT creation mode will run a comparison with REF
@@ -484,6 +508,8 @@ def run_external_split_rendering(
                record_property(k, v)

        if output_differs:
            logging.error(f"Split Pre command line was: {' '.join(split_pre_cmd)}")
            logging.error(f"Split Post command line was: {' '.join(split_post_cmd)}")
            pytest.fail(f"Output differs: ({reason})")

    return out_file