Commit 28f515dc authored by bayers's avatar bayers
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 678-asan-in-ism-to-sba-conversion-in-jbm

parents e5729b7b 80973a73
Loading
Loading
Loading
Loading
Loading
+58 −2
Original line number Diff line number Diff line
@@ -732,7 +732,7 @@ ivas-pytest-on-merge-request:
    - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true
    - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true

    ### If ref_using_main is not set, checkoug the source branch to use scripts and input from there
    ### If ref_using_main is not set, checkout the source branch to use scripts and input from there
    - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi

    ### prepare pytest
@@ -767,6 +767,62 @@ ivas-pytest-on-merge-request:
      junit:
        - report-junit.xml


# Check interop IVAS_cod_test -> IVAS_dec_ref
ivas-interop-on-merge-request:
  extends:
    - .test-job-linux
    - .rules-merge-request
  stage: test
  needs: ["build-codec-linux-cmake"]
  timeout: "10 minutes"
  script:
    - *print-common-info
    - *get-commits-behind-count
    - *check-commits-behind-count-in-compare-jobs
    - *merge-request-comparison-setup-codec
    # the next line is dependent on ref-using-main flag in the other tests, but here the flag does not make sense
    - git checkout $source_branch_commit_sha

    # some helper variables - "|| true" to prevent failures from grep not finding anything
    # write to temporary file as workaround for failures observed with piping echo
    - echo $CI_MERGE_REQUEST_TITLE > tmp.txt
    - non_interop_flag=$(grep -c --ignore-case "\[non[ -]*io\]" tmp.txt) || true

    ### prepare pytest
    # create short test vectors
    - python3 tests/create_short_testvectors.py

    # Run reference creation, using source branch encoder and main decoder (see .merge-request-comparison-setup-codec)
    - exit_code=0
    - exit_code2=0
    # set timeout for individual testcase runs to 60 seconds
    - testcase_timeout=60
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --update_ref 1 -m create_ref --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec_ref --testcase_timeout=$testcase_timeout || exit_code=$?
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report2.html --self-contained-html --junit-xml=report2-junit.xml --update_ref 1 -m create_ref_part2 --ref_encoder_path ./IVAS_cod --ref_decoder_path ./IVAS_dec_ref --testcase_timeout=$testcase_timeout || exit_code2=$?
    - zero_failures=$(cat report-junit.xml report2-junit.xml | grep -c 'failures="0"') || true

    - if [ $zero_failures != 2 ] && [ $non_interop_flag == 0 ]; then echo "Non-interop cases without non-interop flag encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $zero_failures != 2 ] && [ $non_interop_flag == 1 ]; then echo "Non-interop cases with non-interop flag encountered"; exit $EXIT_CODE_NON_BE; fi
    - exit 0

  allow_failure:
    exit_codes:
      - 123
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - report-junit.xml
      - report.html
      - report2-junit.xml
      - report2.html
    expose_as: "interop test results"
    reports:
      junit:
        - report*-junit.xml

evs-pytest-on-merge-request:
  extends:
    - .test-job-linux
+82 −63
Original line number Diff line number Diff line
__copyright__ = \
    """
__copyright__ = """
    (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
@@ -29,8 +28,7 @@ __copyright__ = \
    the United Nations Convention on Contracts on the International Sales of Goods.
    """

__doc__ = \
    """
__doc__ = """
    Test file to run C encoder and decoder code.
    The outputs are compared with C generated references.
    """
@@ -46,20 +44,36 @@ from tests.cmp_pcm import cmp_pcm

# params
# output_mode_list = ['MONO', 'STEREO', '5_1', '7_1', '5_1_2', '5_1_4', '7_1_4', 'FOA', 'HOA2', 'HOA3', 'BINAURAL', 'BINAURAL_ROOM', 'EXT']
output_mode_list = ['BINAURAL', 'EXT']
ivas_br_masa = [13200, 16400, 24400, 32000, 48000, 64000, 80000, 96000, 128000, 160000, 192000, 256000, 384000, 512000]
output_mode_list = ["BINAURAL", "EXT"]
ivas_br_masa = [
    13200,
    16400,
    24400,
    32000,
    48000,
    64000,
    80000,
    96000,
    128000,
    160000,
    192000,
    256000,
    384000,
    512000,
]

# Write file-based parameter sets here (metafile, pcm/wave, numDir, numTC, DTX_toggle)
masa_metadata_audio_ndir_ntransportch_dtx_list = [  # ('stv1MASA1TC48c.met', 'stv1MASA1TC48c.wav', 1, 1, False),
    # ('stv1MASA2TC48c.met', 'stv1MASA2TC48c.wav', 1, 2, False),
                                                  ('stv2MASA1TC48c.met', 'stv2MASA1TC48c.wav', 2, 1, False),
    ("stv2MASA1TC48c.met", "stv2MASA1TC48c.wav", 2, 1, False),
    # ('stv2MASA2TC48c.met', 'stv2MASA2TC48c.wav', 2, 2, False),
    # ('stv1MASA1TC48n.met', 'stv1MASA1TC48n.wav', 1, 1, True),
                                                  ('stv1MASA2TC48n.met', 'stv1MASA2TC48n.wav', 1, 2, True)]
    ("stv1MASA2TC48n.met", "stv1MASA2TC48n.wav", 1, 2, True),
]

# Used to not test every combination
test_split_br = [13200, 24400, 48000, 80000, 128000, 256000, 512000];
AbsTol = '0'
test_split_br = [13200, 24400, 48000, 80000, 128000, 256000, 512000]
AbsTol = "0"


def check_and_makedir(dir_path):
@@ -74,12 +88,15 @@ def check_and_makedir(dir_path):
@pytest.mark.create_ref
@pytest.mark.parametrize("output_mode", output_mode_list)
@pytest.mark.parametrize("ivas_br", ivas_br_masa)
@pytest.mark.parametrize("masa_metadata_audio_ndir_ntransportch_dtx", masa_metadata_audio_ndir_ntransportch_dtx_list)
@pytest.mark.parametrize(
    "masa_metadata_audio_ndir_ntransportch_dtx",
    masa_metadata_audio_ndir_ntransportch_dtx_list,
)
def test_masa_enc_dec(
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
        ref_encoder_path,
        ref_decoder_path,
    ref_encoder_frontend: EncoderFrontend,
    ref_decoder_frontend: DecoderFrontend,
    reference_path,
    dut_base_path,
    update_ref,
@@ -102,13 +119,13 @@ def test_masa_enc_dec(

    # Apply test skipping here
    if dtx:
        if output_mode != 'EXT':
        if output_mode != "EXT":
            if ivas_br not in test_split_br:
                pytest.skip("Skipping some DTX bitrates for other than EXT output to save time")
                pytest.skip(
                    "Skipping some DTX bitrates for other than EXT output to save time"
                )

    # Set reference encoder and decoder
    ref_encoder_frontend = EncoderFrontend(ref_encoder_path, "REF")
    ref_decoder_frontend = DecoderFrontend(ref_decoder_path, "REF")

    # Set output paths
    out_dir_bs_ref = f"{reference_path}/masa_test/bitstreams"
@@ -125,7 +142,7 @@ def test_masa_enc_dec(
    output_bitstream_dut = f"{out_dir_bs_dut}/masa{masa_channel_count}_ndirs{n_directions}_outputmode{output_mode}_ivasbr{ivas_br}k_DTX{dtx}.bts"
    dec_output_ref = f"{out_dir_dec_output_ref}/masa{masa_channel_count}_ndirs{n_directions}_outputmode{output_mode}_ivasbr{ivas_br}k_DTX{dtx}.wav"
    dec_output_dut = f"{out_dir_dec_output_dut}/masa{masa_channel_count}_ndirs{n_directions}_outputmode{output_mode}_ivasbr{ivas_br}k_DTX{dtx}.wav"
    if output_mode == 'EXT':
    if output_mode == "EXT":
        dec_met_output_ref = f"{dec_output_ref}.met"
        dec_met_output_dut = f"{dec_output_dut}.met"
    else:
@@ -177,12 +194,14 @@ def test_masa_enc_dec(
        )

        # Compare outputs. For EXT output, also compare metadata.
        if output_mode == 'EXT':
        if output_mode == "EXT":
            # Compare metadata as binary blob
            metacmp_res = cmp(dec_met_output_ref, dec_met_output_dut)

            # Compare audio outputs
            pcmcmp_res, reason = cmp_pcm(dec_output_dut, dec_output_ref, output_mode, int(out_fs*1000))
            pcmcmp_res, reason = cmp_pcm(
                dec_output_dut, dec_output_ref, output_mode, int(out_fs * 1000)
            )

            # Fail if compare fails compare result
            if metacmp_res == False and pcmcmp_res != 0:
@@ -198,7 +217,9 @@ def test_masa_enc_dec(
            # Compare audio outputs
            filecmp_res = cmp(dec_output_ref, dec_output_dut)
            if filecmp_res == False:
                cmp_result, reason = cmp_pcm(dec_output_dut, dec_output_ref, output_mode, int(out_fs*1000))
                cmp_result, reason = cmp_pcm(
                    dec_output_dut, dec_output_ref, output_mode, int(out_fs * 1000)
                )
                # Report compare result
                assert cmp_result == 0, reason
            else:
@@ -227,9 +248,8 @@ def ivas_enc(
    output_bitstream,
    dtx: Optional[bool] = False,
):

    # ------------  run cmd  ------------
    options = ['-masa', f"{masa_channel_count}", f"{masa_path}"]
    options = ["-masa", f"{masa_channel_count}", f"{masa_path}"]

    # call encoder
    encoder_frontend.run(
@@ -249,7 +269,6 @@ def ivas_dec(
    input_bitstream,
    output_path,
):

    # --------  run cmd  ------------

    # call decoder
+11 −16
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ def convert_test_string_to_tag(test_string):
def test_param_file_tests(
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
    ref_encoder_path,
    ref_decoder_path,
    ref_encoder_frontend: EncoderFrontend,
    ref_decoder_frontend: DecoderFrontend,
    reference_path,
    dut_base_path,
    test_vector_path,
@@ -180,7 +180,7 @@ def test_param_file_tests(

    encode(
        dut_encoder_frontend,
        ref_encoder_path,
        ref_encoder_frontend,
        reference_path,
        dut_base_path,
        bitrate,
@@ -272,7 +272,7 @@ def test_param_file_tests(

    stdout = decode(
        dut_decoder_frontend,
        ref_decoder_path,
        ref_decoder_frontend,
        reference_path,
        dut_base_path,
        output_config,
@@ -291,7 +291,6 @@ def test_param_file_tests(
        output_differs, reason = cmp_pcm(
            dut_output_file, ref_output_file, output_config, fs
        )

        md_out_files = get_expected_md_files(ref_output_file, enc_split, output_config)

        metadata_differs = False
@@ -331,8 +330,8 @@ def test_param_file_tests(


def encode(
    encoder_frontend,
    ref_encoder_path,
    dut_encoder_frontend,
    ref_encoder_frontend,
    reference_path,
    dut_base_path,
    bitrate,
@@ -355,9 +354,7 @@ def encode(
    if update_ref == 1 or update_ref == 2 and not os.path.exists(ref_out_file):
        check_and_makedir(ref_out_dir)
        # call REF encoder
        assert ref_encoder_path
        ref_encoder = EncoderFrontend(ref_encoder_path, "REF")
        ref_encoder.run(
        ref_encoder_frontend.run(
            bitrate,
            sampling_rate,
            testv_file,
@@ -368,7 +365,7 @@ def encode(
    if update_ref in [0, 2]:
        check_and_makedir(dut_out_dir)
        # call DUT encoder
        encoder_frontend.run(
        dut_encoder_frontend.run(
            bitrate,
            sampling_rate,
            testv_file,
@@ -447,7 +444,7 @@ def simulate(

def decode(
    decoder_frontend,
    ref_decoder_path,
    ref_decoder_frontend,
    reference_path,
    dut_base_path,
    output_config,
@@ -479,9 +476,7 @@ def decode(
                for x in dec_opts_list
            ]
        # call REF decoder
        assert ref_decoder_path
        ref_decoder = DecoderFrontend(ref_decoder_path, "REF")
        ref_decoder.run(
        ref_decoder_frontend.run(
            output_config,
            sampling_rate,
            ref_in_file,
@@ -489,7 +484,7 @@ def decode(
            add_option_list=add_option_list,
        )

        stdout = ref_decoder.stdout
        stdout = ref_decoder_frontend.stdout

    if update_ref in [0, 2]:
        check_and_makedir(dut_out_dir)
+109 −92
Original line number Diff line number Diff line
__copyright__ = \
    """
__copyright__ = """
    (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
@@ -29,8 +28,7 @@ __copyright__ = \
    the United Nations Convention on Contracts on the International Sales of Goods.
    """

__doc__ = \
    """
__doc__ = """
    Test file to run C encoder and decoder code.
    The outputs are compared with C generated references.
    """
@@ -43,28 +41,40 @@ from tests.cmp_pcm import cmp_pcm
from tests.cut_pcm import cut_samples
from tests.conftest import EncoderFrontend, DecoderFrontend
from cut_bs import cut_from_start
# params

tag_list = ['stvFOA']
tag_list_HOA2 = ['stv2OA']
tag_list_HOA3 = ['stv3OA']

tag_list_bw_force = ['stvFOA']
dtx_set = ['0', '1']
dict_fsample_bw = {'48': '3', '32': '2', '16': '1'}
dict_bw_idx = {'FB': '3', 'SWB': '2', 'WB': '1'}
dict_bw_tag = {'SWB': '_ForceSWB', 'WB': '_ForceWB'}
ivas_br_FOA = ['13200','16400','32000','64000', '96000', '160000', '256000', '384000', '512000','sw_24k4_256k.bin']
ivas_br_HOA2 = ['256000', '384000', '512000']
ivas_br_HOA3 = ['256000', '384000', '512000']
# params

sample_rate_list = ['48', '32', '16']
tag_list = ["stvFOA"]
tag_list_HOA2 = ["stv2OA"]
tag_list_HOA3 = ["stv3OA"]

tag_list_bw_force = ["stvFOA"]
dtx_set = ["0", "1"]
dict_fsample_bw = {"48": "3", "32": "2", "16": "1"}
dict_bw_idx = {"FB": "3", "SWB": "2", "WB": "1"}
dict_bw_tag = {"SWB": "_ForceSWB", "WB": "_ForceWB"}
ivas_br_FOA = [
    "13200",
    "16400",
    "32000",
    "64000",
    "96000",
    "160000",
    "256000",
    "384000",
    "512000",
    "sw_24k4_256k.bin",
]
ivas_br_HOA2 = ["256000", "384000", "512000"]
ivas_br_HOA3 = ["256000", "384000", "512000"]

sample_rate_list = ["48", "32", "16"]
bypass_list = [1, 2]
gain_list = [0, 1]

sample_rate_bw_idx_list = [('48', 'SWB'), ('48', 'WB'), ('32', 'WB')]
sample_rate_bw_idx_list = [("48", "SWB"), ("48", "WB"), ("32", "WB")]

AbsTol = '0'
AbsTol = "0"


def check_and_makedir(dir_path):
@@ -86,8 +96,8 @@ def test_bypass_enc(
    test_vector_path,
    reference_path,
    dut_base_path,
    ref_encoder_path,
    ref_decoder_path,
    ref_encoder_frontend,
    ref_decoder_frontend,
    update_ref,
    keep_files,
    tag,
@@ -97,9 +107,9 @@ def test_bypass_enc(
    if update_ref == 1 and bypass == 1:
        pytest.skip()

    tag = tag + fs + 'c'
    ivas_br = '256000'
    dtx = '0'
    tag = tag + fs + "c"
    ivas_br = "256000"
    dtx = "0"
    max_bw = "FB"
    gain_flag = -1
    sba_order = "+1"
@@ -109,7 +119,7 @@ def test_bypass_enc(
    sba_enc(
        dut_encoder_frontend,
        test_vector_path,
        ref_encoder_path,
        ref_encoder_frontend,
        reference_path,
        dut_base_path,
        None,
@@ -123,13 +133,13 @@ def test_bypass_enc(
        sba_order,
        update_ref,
        gain_flag,
        cut_testv=True
        cut_testv=True,
    )

    # dec
    sba_dec(
        dut_decoder_frontend,
        ref_decoder_path,
        ref_decoder_frontend,
        reference_path,
        dut_base_path,
        tag,
@@ -158,8 +168,8 @@ def test_sba_enc_system(
    test_vector_path,
    reference_path,
    dut_base_path,
    ref_encoder_path,
    ref_decoder_path,
    ref_encoder_frontend,
    ref_decoder_frontend,
    br_switch_file_path,
    update_ref,
    keep_files,
@@ -170,26 +180,26 @@ def test_sba_enc_system(
    gain_flag,
):
    SID = 0
    if dtx == '1' and ivas_br not in ['13200','16400','24400','32000','64000']:
    if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]:
        # skip high bitrates for DTX until DTX issue is resolved
        pytest.skip()
    if ivas_br == 'sw_24k4_256k.bin' and gain_flag != 1:
    if ivas_br == "sw_24k4_256k.bin" and gain_flag != 1:
        pytest.skip()
    if ivas_br == '13200' or ivas_br == '16400':
        if dtx == '1' and gain_flag == 0 and fs != '16':
    if ivas_br == "13200" or ivas_br == "16400":
        if dtx == "1" and gain_flag == 0 and fs != "16":
            SID = 1
        else:
            pytest.skip()
    if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']:
    if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]:
        pytest.skip()
    tag = tag + fs + 'c'
    tag = tag + fs + "c"
    max_bw = "FB"
    bypass = -1
    sba_order = "+1"
    output_config = "FOA"
    if gain_flag == 1:
        cut_gain = "16.0"
    elif dtx == '1':
    elif dtx == "1":
        cut_gain = ".004"
    else:
        cut_gain = "1.0"
@@ -197,7 +207,7 @@ def test_sba_enc_system(
    sba_enc(
        dut_encoder_frontend,
        test_vector_path,
        ref_encoder_path,
        ref_encoder_frontend,
        reference_path,
        dut_base_path,
        br_switch_file_path,
@@ -213,13 +223,13 @@ def test_sba_enc_system(
        gain_flag,
        cut_gain=cut_gain,
        create_dutenc=True,
        cut_testv=True
        cut_testv=True,
    )

    # dec
    sba_dec(
        dut_decoder_frontend,
        ref_decoder_path,
        ref_decoder_frontend,
        reference_path,
        dut_base_path,
        tag,
@@ -245,18 +255,18 @@ def test_spar_hoa2_enc_system(
    test_vector_path,
    reference_path,
    dut_base_path,
    ref_encoder_path,
    ref_decoder_path,
    ref_encoder_frontend,
    ref_decoder_frontend,
    update_ref,
    keep_files,
    ivas_br,
    tag,
):
    fs = '48'
    dtx = '0'
    fs = "48"
    dtx = "0"
    gain_flag = -1

    tag = tag + fs + 'c'
    tag = tag + fs + "c"
    max_bw = "FB"
    bypass = -1
    sba_order = "+2"
@@ -266,7 +276,7 @@ def test_spar_hoa2_enc_system(
    sba_enc(
        dut_encoder_frontend,
        test_vector_path,
        ref_encoder_path,
        ref_encoder_frontend,
        reference_path,
        dut_base_path,
        None,
@@ -285,7 +295,7 @@ def test_spar_hoa2_enc_system(
    # dec
    sba_dec(
        dut_decoder_frontend,
        ref_decoder_path,
        ref_decoder_frontend,
        reference_path,
        dut_base_path,
        tag,
@@ -311,18 +321,18 @@ def test_spar_hoa3_enc_system(
    test_vector_path,
    reference_path,
    dut_base_path,
    ref_encoder_path,
    ref_decoder_path,
    ref_encoder_frontend,
    ref_decoder_frontend,
    update_ref,
    keep_files,
    ivas_br,
    tag,
):
    fs = '48'
    dtx = '0'
    fs = "48"
    dtx = "0"
    gain_flag = -1

    tag = tag + fs + 'c'
    tag = tag + fs + "c"
    max_bw = "FB"
    bypass = -1
    sba_order = "+3"
@@ -332,7 +342,7 @@ def test_spar_hoa3_enc_system(
    sba_enc(
        dut_encoder_frontend,
        test_vector_path,
        ref_encoder_path,
        ref_encoder_frontend,
        reference_path,
        dut_base_path,
        None,
@@ -351,7 +361,7 @@ def test_spar_hoa3_enc_system(
    # dec
    sba_dec(
        dut_decoder_frontend,
        ref_decoder_path,
        ref_decoder_frontend,
        reference_path,
        dut_base_path,
        tag,
@@ -379,8 +389,8 @@ def test_sba_enc_BWforce_system(
    test_vector_path,
    reference_path,
    dut_base_path,
    ref_encoder_path,
    ref_decoder_path,
    ref_encoder_frontend,
    ref_decoder_frontend,
    update_ref,
    keep_files,
    ivas_br,
@@ -388,16 +398,16 @@ def test_sba_enc_BWforce_system(
    tag,
    sample_rate_bw_idx,
):
    if dtx == '1' and ivas_br not in ['32000','64000']:
    if dtx == "1" and ivas_br not in ["32000", "64000"]:
        # skip high bitrates for DTX until DTX issue is resolved
        pytest.skip()
    if ivas_br == '13200' or ivas_br == '16400':
    if ivas_br == "13200" or ivas_br == "16400":
        pytest.skip()
    if ivas_br == 'sw_24k4_256k.bin':
    if ivas_br == "sw_24k4_256k.bin":
        pytest.skip()
    fs = sample_rate_bw_idx[0]
    bw = sample_rate_bw_idx[1]
    tag = tag + fs + 'c'
    tag = tag + fs + "c"
    bypass = -1
    gain_flag = -1
    sba_order = "+1"
@@ -407,7 +417,7 @@ def test_sba_enc_BWforce_system(
    sba_enc(
        dut_encoder_frontend,
        test_vector_path,
        ref_encoder_path,
        ref_encoder_frontend,
        reference_path,
        dut_base_path,
        None,
@@ -421,13 +431,13 @@ def test_sba_enc_BWforce_system(
        sba_order,
        update_ref,
        gain_flag,
        cut_testv=True
        cut_testv=True,
    )

    # dec
    sba_dec(
        dut_decoder_frontend,
        ref_decoder_path,
        ref_decoder_frontend,
        reference_path,
        dut_base_path,
        tag,
@@ -449,7 +459,7 @@ def test_sba_enc_BWforce_system(
def sba_enc(
    encoder_frontend,
    test_vector_path,
    ref_encoder_path,
    ref_encoder_frontend,
    reference_path,
    dut_base_path,
    br_switch_file_path,
@@ -463,11 +473,10 @@ def sba_enc(
    sba_order,
    update_ref,
    gain_flag,
    cut_gain='1.0',
    cut_gain="1.0",
    create_dutenc=False,
    cut_testv=False
    cut_testv=False,
):

    # ------------  run cmd  ------------
    dut_out_dir = f"{dut_base_path}/sba_bs/pkt"
    ref_out_dir = f"{reference_path}/sba_bs/pkt"
@@ -484,13 +493,13 @@ def sba_enc(
        tag = tag + dict_bw_tag[ivas_max_bw]

    tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}"
    if ivas_br == 'sw_24k4_256k.bin':
    if ivas_br == "sw_24k4_256k.bin":
        ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin"
    short_tag_ext = ""
    if gain_flag == 1:
        short_tag_ext += f'_Gain{gain_flag}'
        short_tag_ext += f"_Gain{gain_flag}"
    if SID == 1:
        short_tag_ext += f'_SID'
        short_tag_ext += f"_SID"
    # we update only bypass = 0/2 (bypass 1 is the same as the baseline)
    if bypass in [0, 2]:
        short_tag_ext += f"_pca{bypass}"
@@ -507,10 +516,12 @@ def sba_enc(
    if SID == 1:
        dut_pkt_file_cut = f"{dut_out_dir}/{tag_out}{long_tag_ext}_cut.pkt"
        ref_pkt_file_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_cut.pkt"
        ref_pkt_file_dutenc_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt"
        ref_pkt_file_dutenc_cut = (
            f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt"
        )
    input_path = f"{test_vector_path}/{tag_in}{in_extension}"
    bypass_mode = bypass if bypass >= 0 else None
    dtx_mode = dtx == '1'
    dtx_mode = dtx == "1"

    if cut_testv:
        # use shortened and potentially gain adjusted input PCM file - create if not present
@@ -523,13 +534,20 @@ def sba_enc(
        else:
            cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}"
        if not os.path.exists(cut_file):
            cut_samples(input_path, cut_file, num_channels, sampling_rate + "000", cut_from, cut_len, cut_gain)
            cut_samples(
                input_path,
                cut_file,
                num_channels,
                sampling_rate + "000",
                cut_from,
                cut_len,
                cut_gain,
            )
        input_path = cut_file

    if ref_encoder_path:
        ref_encoder = EncoderFrontend(ref_encoder_path, "REF")
    if ref_encoder_frontend:
        # call REF encoder
        ref_encoder.run(
        ref_encoder_frontend.run(
            ivas_br,
            sampling_rate,
            input_path,
@@ -566,7 +584,7 @@ def sba_enc(
        )

    if SID == 1:
        if ref_encoder_path:
        if ref_encoder_frontend:
            with open(ref_pkt_file, "rb") as fp_in:
                with open(ref_pkt_file_cut, "wb") as fp_out:
                    fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True)
@@ -580,9 +598,11 @@ def sba_enc(
                with open(dut_pkt_file_cut, "wb") as fp_out:
                    fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True)
            os.remove(dut_pkt_file)


def sba_dec(
    decoder_frontend,
    ref_decoder_path,
    ref_decoder_frontend,
    reference_path,
    dut_base_path,
    tag,
@@ -597,7 +617,6 @@ def sba_dec(
    gain_flag,
    keep_files,
):

    # --------  run cmd  ------------
    # sampling rate to BW mapping
    bw_idx = dict_fsample_bw[sampling_rate]
@@ -608,12 +627,12 @@ def sba_dec(

    short_tag_ext = ""
    if gain_flag == 1:
        short_tag_ext += f'_Gain{gain_flag}'
        short_tag_ext += f"_Gain{gain_flag}"
    # we update only bypass = 0/2 (bypass 1 is the same as the baseline)
    if bypass in [0, 2]:
        short_tag_ext += f"_pca{bypass}"
    if SID == 1:
       short_tag_ext += f'_SID_cut'
        short_tag_ext += f"_SID_cut"
    # to avoid conflicting names in case of parallel test execution, differentiate all cases
    if gain_flag == 1:
        long_tag_ext = f"_Gain{gain_flag}"
@@ -633,11 +652,9 @@ def sba_dec(
    check_and_makedir(dut_out_dir)
    check_and_makedir(ref_out_dir)

    if ref_decoder_path:
        ref_decoder = DecoderFrontend(ref_decoder_path, "REF")

    if ref_decoder_frontend:
        # call REF decoder
        ref_decoder.run(
        ref_decoder_frontend.run(
            output_config,
            sampling_rate,
            ref_in_pkt,
+99 −29

File changed.

Preview size limit exceeded, changes collapsed.