Commit 03ee7de4 authored by Jiaquan Huo's avatar Jiaquan Huo
Browse files

prepare for adding sba ltv pytests to basop

parent 84993100
Loading
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -41,9 +41,13 @@ import pytest
from tests.cmp_pcm import cmp_pcm
from tests.conftest import DecoderFrontend
from . import MLD_PATTERN, MAX_DIFF_PATTERN
from tests.testconfig import use_ltv

# params
tag_list = ["stvFOA"]
tag_list = ["ltvFOA" if use_ltv else "stvFOA"]

tag_list_bw_force = ["stvFOA", "ltvFOA"]
tag_list_bw_force = tag_list
plc_patterns = ["PLperc12mblen5", "PLperc40mblen50", "PLperc42mblen2"]
dtx_set = ["0", "1"]
ivas_br_list = ["13200", "16400", "32000", "64000", "96000", "256000"]
@@ -110,7 +114,12 @@ def test_sba_plc_system(
            pytest.skip()
    if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]:
        pytest.skip()
    if "ltv" in tag:
        tag = f"ltv{fs}_FOA"
    elif "stv" in tag:
        tag = tag + fs + "c"
    else:
        assert 0 

    # dec
    sba_dec_plc(
+49 −12
Original line number Diff line number Diff line
@@ -44,14 +44,15 @@ from tests.cmp_pcm import cmp_pcm
from tests.conftest import DecoderFrontend, EncoderFrontend
from tests.cut_pcm import cut_samples
from . import MLD_PATTERN, MAX_DIFF_PATTERN
from tests.testconfig import use_ltv

# params

tag_list = ["stvFOA"]
tag_list_HOA2 = ["stv2OA"]
tag_list_HOA3 = ["stv3OA"]
tag_list = ["ltvFOA" if use_ltv else "stvFOA"]
tag_list_HOA2 = ["ltvHOA2" if use_ltv else "stv2OA"]
tag_list_HOA3 = ["ltvHOA3" if use_ltv else "stv3OA"]

tag_list_bw_force = ["stvFOA"]
tag_list_bw_force = tag_list
dtx_set = ["0", "1"]
dict_fsample_bw = {"48": "3", "32": "2", "16": "1"}
dict_bw_idx = {"FB": "3", "SWB": "2", "WB": "1"}
@@ -110,7 +111,6 @@ def test_pca_enc(
    abs_tol,
):
    pca = True
    tag = tag + fs + "c"
    ivas_br = "256000"
    dtx = "0"
    max_bw = "FB"
@@ -118,6 +118,15 @@ def test_pca_enc(
    sba_order = "+1"
    output_config = "FOA"
    
    if "ltv" in tag:
        tag = f"ltv{fs}_FOA"
        cut_testv = False
    elif "stv" in tag:
        tag = tag + fs + "c"
        cut_testv=True
    else:
        assert 0 

    if not decoder_only:
        # enc
        sba_enc(
@@ -137,7 +146,7 @@ def test_pca_enc(
            update_ref,
            gain_flag,
            keep_files,
            cut_testv=True,
            cut_testv=cut_testv,
            pca=pca,
        )

@@ -214,7 +223,16 @@ def test_sba_enc_system(
        pytest.skip()
    if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]:
        pytest.skip()

    if "ltv" in tag:
        tag = f"ltv{fs}_FOA"
        cut_testv = False
    elif "stv" in tag:
        tag = tag + fs + "c"
        cut_testv = True
    else:
        assert 0 

    max_bw = "FB"
    sba_order = "+1"
    output_config = "FOA"
@@ -246,7 +264,7 @@ def test_sba_enc_system(
            keep_files,
            cut_gain=cut_gain,
            create_dutenc=True,
            cut_testv=True,
            cut_testv=cut_testv,
        )

    # dec
@@ -298,7 +316,13 @@ def test_spar_hoa2_enc_system(
    dtx = "0"
    gain_flag = -1

    if "ltv" in tag:
        tag = f"ltv{fs}_HOA2"
    elif "stv" in tag:
        tag = tag + fs + "c"
    else:
        assert 0 

    max_bw = "FB"
    sba_order = "+2"
    output_config = "HOA2"
@@ -373,7 +397,13 @@ def test_spar_hoa3_enc_system(
    dtx = "0"
    gain_flag = -1

    if "ltv" in tag:
        tag = f"ltv{fs}_HOA3"
    elif "stv" in tag:
        tag = tag + fs + "c"
    else:
        assert 0 

    max_bw = "FB"
    sba_order = "+3"
    output_config = "HOA3"
@@ -457,7 +487,14 @@ def test_sba_enc_BWforce_system(
        pytest.skip()
    fs = sample_rate_bw_idx[0]
    bw = sample_rate_bw_idx[1]
    if "ltv" in tag:
        tag = f"ltv{fs}_FOA"
        cut_testv = False
    elif "stv" in tag:
        tag = tag + fs + "c"
        cut_testv = True
    else:
        assert 0 
    gain_flag = -1
    sba_order = "+1"
    output_config = "FOA"
@@ -481,7 +518,7 @@ def test_sba_enc_BWforce_system(
            update_ref,
            gain_flag,
            keep_files,
            cut_testv=True,
            cut_testv=cut_testv,
        )

    # dec
+8 −0
Original line number Diff line number Diff line
@@ -176,6 +176,12 @@ def pytest_addoption(parser):
        default=False,
    )

    parser.addoption(
        "--use_ltv",
        action="store_true",
        help="If specified, run relevant tests with ltv.",
    )

    parser.addoption(
        "--create_cut",
        action="store_true",
@@ -746,3 +752,5 @@ def pytest_configure(config):
            testconfig.MD5_REF_DICT = {
                line.split()[0]: line.split()[1] for line in f.readlines()
            }
    if config.option.use_ltv:
        testconfig.use_ltv = True
+3 −0
Original line number Diff line number Diff line
@@ -35,3 +35,6 @@ To configure test modules.
PARAM_FILE = "scripts/config/self_test.prm"

MD5_REF_DICT = dict()

use_ltv = False