Commit 86bb66b4 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix pca tests

parent b0cab6a0
Loading
Loading
Loading
Loading
Loading
+30 −33
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ ivas_br_HOA2 = ["256000", "384000", "512000"]
ivas_br_HOA3 = ["256000", "384000", "512000"]
SID_list = [0, 1]
sample_rate_list = ["48", "32", "16"]
bypass_list = [ ]
pca_list = [False, True]
gain_list = [0, 1]

sample_rate_bw_idx_list = [("48", "SWB"), ("48", "WB"), ("32", "WB")]
@@ -89,8 +89,8 @@ def check_and_makedir(dir_path):
@pytest.mark.create_ref
@pytest.mark.parametrize("tag", tag_list)
@pytest.mark.parametrize("fs", sample_rate_list)
@pytest.mark.parametrize("bypass", bypass_list)
def test_bypass_enc(
@pytest.mark.parametrize("pca", pca_list)
def test_pca_enc(
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
    test_vector_path,
@@ -102,9 +102,9 @@ def test_bypass_enc(
    keep_files,
    tag,
    fs,
    bypass,
    pca,
):
    if update_ref == 1 and bypass == 1:
    if update_ref == 1 and not pca:
        pytest.skip()

    tag = tag + fs + "c"
@@ -129,7 +129,7 @@ def test_bypass_enc(
        dtx,
        None,
        max_bw,
        bypass,
        pca,
        sba_order,
        update_ref,
        gain_flag,
@@ -148,7 +148,7 @@ def test_bypass_enc(
        dtx,
        None,
        max_bw,
        bypass,
        pca,
        output_config,
        update_ref,
        gain_flag,
@@ -197,7 +197,7 @@ def test_sba_enc_system(
        pytest.skip()
    tag = tag + fs + "c"
    max_bw = "FB"
    bypass = -1
    pca = False
    sba_order = "+1"
    output_config = "FOA"
    if gain_flag == 1:
@@ -220,7 +220,7 @@ def test_sba_enc_system(
        dtx,
        SID,
        max_bw,
        bypass,
        pca,
        sba_order,
        update_ref,
        gain_flag,
@@ -241,7 +241,7 @@ def test_sba_enc_system(
        dtx,
        SID,
        max_bw,
        bypass,
        pca,
        output_config,
        update_ref,
        gain_flag,
@@ -271,7 +271,7 @@ def test_spar_hoa2_enc_system(

    tag = tag + fs + "c"
    max_bw = "FB"
    bypass = -1
    pca = False
    sba_order = "+2"
    output_config = "HOA2"

@@ -289,7 +289,7 @@ def test_spar_hoa2_enc_system(
        dtx,
        None,
        max_bw,
        bypass,
        pca,
        sba_order,
        update_ref,
        gain_flag,
@@ -307,7 +307,7 @@ def test_spar_hoa2_enc_system(
        dtx,
        None,
        max_bw,
        bypass,
        pca,
        output_config,
        update_ref,
        gain_flag,
@@ -337,7 +337,7 @@ def test_spar_hoa3_enc_system(

    tag = tag + fs + "c"
    max_bw = "FB"
    bypass = -1
    pca = False
    sba_order = "+3"
    output_config = "HOA3"

@@ -355,7 +355,7 @@ def test_spar_hoa3_enc_system(
        dtx,
        None,
        max_bw,
        bypass,
        pca,
        sba_order,
        update_ref,
        gain_flag,
@@ -373,7 +373,7 @@ def test_spar_hoa3_enc_system(
        dtx,
        None,
        max_bw,
        bypass,
        pca,
        output_config,
        update_ref,
        gain_flag,
@@ -411,7 +411,7 @@ def test_sba_enc_BWforce_system(
    fs = sample_rate_bw_idx[0]
    bw = sample_rate_bw_idx[1]
    tag = tag + fs + "c"
    bypass = -1
    pca = False
    gain_flag = -1
    sba_order = "+1"
    output_config = "FOA"
@@ -430,7 +430,7 @@ def test_sba_enc_BWforce_system(
        dtx,
        None,
        bw,
        bypass,
        pca,
        sba_order,
        update_ref,
        gain_flag,
@@ -449,7 +449,7 @@ def test_sba_enc_BWforce_system(
        dtx,
        None,
        bw,
        bypass,
        pca,
        output_config,
        update_ref,
        gain_flag,
@@ -472,7 +472,7 @@ def sba_enc(
    dtx,
    SID,
    ivas_max_bw,
    bypass,
    pca,
    sba_order,
    update_ref,
    gain_flag,
@@ -503,14 +503,13 @@ def sba_enc(
        short_tag_ext += f"_Gain{gain_flag}"
    if SID == 1:
        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}"
    if pca:
        short_tag_ext += f"_pca"
    # to avoid conflicting names in case of parallel test execution, differentiate all cases
    if gain_flag == 1:
        long_tag_ext = f"_Gain{gain_flag}"
    else:
        long_tag_ext = f"_pca{bypass}"
        long_tag_ext = f"_pca"
    if SID == 1:
        long_tag_ext += f"_SID"
    dut_pkt_file = f"{dut_out_dir}/{tag_out}{long_tag_ext}.pkt"
@@ -523,7 +522,6 @@ def sba_enc(
            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"

    if cut_testv:
@@ -557,7 +555,7 @@ def sba_enc(
            ref_pkt_file,
            sba_order=sba_order,
            max_band=ivas_max_bw,
            bypass_mode=bypass_mode,
            pca=pca,
            dtx_mode=dtx_mode,
        )
        if create_dutenc:
@@ -569,7 +567,7 @@ def sba_enc(
                ref_pkt_file_dutenc,
                sba_order=sba_order,
                max_band=ivas_max_bw,
                bypass_mode=bypass_mode,
                pca=pca,
                dtx_mode=dtx_mode,
            )

@@ -582,7 +580,7 @@ def sba_enc(
            dut_pkt_file,
            sba_order=sba_order,
            max_band=ivas_max_bw,
            bypass_mode=bypass_mode,
            pca=pca,
            dtx_mode=dtx_mode,
        )

@@ -614,7 +612,7 @@ def sba_dec(
    dtx,
    SID,
    ivas_max_bw,
    bypass,
    pca,
    output_config,
    update_ref,
    gain_flag,
@@ -631,16 +629,15 @@ def sba_dec(
    short_tag_ext = ""
    if gain_flag == 1:
        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 pca:
        short_tag_ext += f"_pca"
    if SID == 1:
        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}"
    else:
        long_tag_ext = f"_pca{bypass}"
        long_tag_ext = f"_pca"
    if SID == 1:
        long_tag_ext += f"_SID_cut"
    dut_out_dir = f"{dut_base_path}/sba_bs/raw"
+6 −3
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ class EncoderFrontend:
        sba_order: Optional[str] = None,
        dtx_mode: Optional[bool] = False,
        max_band: Optional[str] = None,
        bypass_mode: Optional[int] = None,
        pca: Optional[bool] = None,
        quiet_mode: Optional[bool] = True,
        add_option_list: Optional[list] = None,
    ) -> None:
@@ -239,8 +239,8 @@ class EncoderFrontend:
        if max_band is not None:
            command.extend(["-max_band", max_band])

        if bypass_mode is not None:
            command.extend(["-pca", str(bypass_mode)])
        if pca:
            command.extend(["-pca"])

        if quiet_mode:
            command.extend(["-q"])
@@ -259,6 +259,9 @@ class EncoderFrontend:
        cmd_str = textwrap.indent(" ".join(command), prefix="\t")
        log_dbg_msg(f"{self._type} encoder command:\n{cmd_str}")

        print(command)
        pytest.fail()

        try: 
            result = run(command, capture_output=True, check=True, timeout=self.timeout)
        except TimeoutExpired: