Commit 17652aad authored by Vidhya V P's avatar Vidhya V P
Browse files

Moved the added test cases in param file

[x] Added the new test cases to SBA pytests
parent 795a82ff
Loading
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -649,13 +649,6 @@
../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_sw_32-32_DTX_HOA3.tst


// SBA FOA at 13.2 kbps , 32kHz in, 32kHz out, DTX on, BINAURAL out, SID as first frame
../IVAS_cod -dtx -sba 1 13200 32 testv/stvFOA32c.wav bit
../IVAS_dec BINAURAL 32 bit testv/stvFOA32c.wav_BINAURAL_13200_32-32_DTX_SID.tst

// SBA FOA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, SID as first frame
../IVAS_cod -dtx -sba 1 24400 32 testv/stvFOA32c.wav bit
../IVAS_dec BINAURAL 32 bit testv/stvFOA32c.wav_BINAURAL_13200_32-32_DTX_SID.tst

// MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out
../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 13200 48 testv/stv1MASA1TC48c.wav bit
+2 −33
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ from cmp_pcm import cmp_pcm
from cut_pcm import cut_samples
from conftest import EncoderFrontend, DecoderFrontend
from testconfig import PARAM_FILE
from cut_bs import cut_bs


VALID_DEC_OUTPUT_CONF = [
    "MONO",
@@ -162,17 +162,6 @@ def test_param_file_tests(
        sba_br_switching_dtx = 1
        cut_file = pre_proc_input(testv_file, fs)
        testv_file = cut_file
    #SID
    sba_dtx_first_SID = 0
    if (
        bitrate.isdigit()
        and "-dtx" in enc_opts.split()
        and "-sba" in enc_opts.split()
        and "SID" in tag_str.split('_')
    ):
        sba_dtx_first_SID = 1
        cut_file = pre_proc_input(testv_file, fs)
        testv_file = cut_file

    # bitrate can be a filename: remove leading "../"
    if bitrate.startswith("../"):
@@ -199,27 +188,7 @@ def test_param_file_tests(
        enc_split,
        update_ref,
    )
    # SID : Update bitstream
    if sba_dtx_first_SID == 1:
        dut_out_dir = f"{dut_base_path}/param_file/enc"
        ref_out_dir = f"{reference_path}/param_file/enc"
        ref_out_file = f"{ref_out_dir}/{bitstream_file}"
        dut_out_file = f"{dut_out_dir}/{bitstream_file}"
        ref_out_file_cut = ref_out_file +"_cut"
        dut_out_file_cut = dut_out_file +"_cut"

        if update_ref == 1 or update_ref == 2 and not os.path.exists(ref_out_file):
            with open(ref_out_file, "rb") as fp_in:
                with open(ref_out_file_cut, "wb") as fp_out:
                    fr_cnt, cut_cnt = cut_bs(fp_in, fp_out, 0, True)
        if update_ref in [0, 2]:
            with open(dut_out_file, "rb") as fp_in:
                with open(dut_out_file_cut, "wb") as fp_out:
                   fr_cnt, cut_cnt = cut_bs(fp_in, fp_out, 0, True)

        bitstream_file = bitstream_file +"_cut"

    if sba_br_switching_dtx == 1 or sba_dtx_first_SID == 1:
    if sba_br_switching_dtx == 1:
        is_exist = os.path.exists(cut_file)
        if is_exist:
            os.remove(cut_file)
+16 −3
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ from conftest import DecoderFrontend
tag_list = ['stvFOA']
plc_patterns = ['PLperc12mblen5', 'PLperc40mblen50', 'PLperc42mblen2']
dtx_set = ['0', '1']
ivas_br_list = ['32000', '64000', '96000', '256000']
ivas_br_list = ['13200','16400','32000', '64000', '96000', '256000']
sampling_rate_list = ['48', '32', '16']
agc_list = [-1, 0, 1]

@@ -89,10 +89,18 @@ def test_sba_plc_system(
    fs,
    agc
):
    if dtx == '1' and ivas_br not in ['32000', '64000']:
    SID = 0
    if dtx == '1' and ivas_br not in ['13200', '64000']:
        # skip high bitrates for DTX until DTX issue is resolved
        pytest.skip()

    if ivas_br == '13200' or ivas_br == '16400':
        if dtx == '0' and agc == 1:
            pytest.skip()
    if ivas_br == '13200' or ivas_br == '16400':
        if dtx == '1' and agc == 0 and fs != '16':
            SID = 1
        else:
            pytest.skip()
    tag = tag + fs + 'c'

    # dec
@@ -106,6 +114,7 @@ def test_sba_plc_system(
        fs,
        ivas_br,
        dtx,
        SID,
        plc_pattern,
        update_ref,
        agc,
@@ -125,6 +134,7 @@ def sba_dec_plc(
    sampling_rate,
    ivas_br,
    dtx,
    SID,
    plc_pattern,
    update_ref,
    agc,
@@ -147,6 +157,9 @@ def sba_dec_plc(
    plc_file = f"{test_vector_path}/{plc_pattern}.g192"
    ref_in_pkt = f"{reference_path}/sba_bs/pkt/{tag_out}.pkt"
    ref_in_pkt_dutenc = f"{reference_path}/sba_bs/pkt/{tag_out}_dutenc.pkt"
    if SID == 1:
        ref_in_pkt = f"{reference_path}/sba_bs/pkt/{tag_out}_SID_cut.pkt"
        ref_in_pkt_dutenc = f"{reference_path}/sba_bs/pkt/{tag_out}_SID_dutenc_cut.pkt"

    dut_out_raw = f"{dut_out_dir}/{plc_tag_out}.raw"
    ref_out_raw = f"{ref_out_dir}/{plc_tag_out}.raw"
+52 −9
Original line number Diff line number Diff line
@@ -42,8 +42,9 @@ import pytest
from cmp_pcm import cmp_pcm
from cut_pcm import cut_samples
from conftest import EncoderFrontend, DecoderFrontend

from cut_bs import cut_bs
# params

tag_list = ['stvFOA']
tag_list_HOA2 = ['stv2OA']
tag_list_HOA3 = ['stv3OA']
@@ -53,7 +54,7 @@ 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 = ['32000','64000', '96000', '160000', '256000', '384000', '512000','sw_24k4_256k.bin']
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']

@@ -116,6 +117,7 @@ def test_bypass_enc(
        fs,
        ivas_br,
        dtx,
        None,
        max_bw,
        bypass,
        agc,
@@ -134,6 +136,7 @@ def test_bypass_enc(
        fs,
        ivas_br,
        dtx,
        None,
        max_bw,
        bypass,
        agc,
@@ -166,12 +169,17 @@ def test_sba_enc_system(
    fs,
    agc,
):
    if dtx == '1' and ivas_br not in ['32000', '64000']:
    SID = 0
    if dtx == '1' and ivas_br not in ['13200', '64000']:
        # skip high bitrates for DTX until DTX issue is resolved
        pytest.skip()
    if ivas_br == 'sw_24k4_256k.bin' and agc != 1:
        pytest.skip()
    
    if ivas_br == '13200' or ivas_br == '16400':
        if dtx == '1' and agc == 0 and fs != '16':
            SID = 1
        else:
            pytest.skip()
    tag = tag + fs + 'c'
    max_bw = "FB"
    bypass = -1
@@ -195,6 +203,7 @@ def test_sba_enc_system(
        fs,
        ivas_br,
        dtx,
        SID,
        max_bw,
        bypass,
        agc,
@@ -215,6 +224,7 @@ def test_sba_enc_system(
        fs,
        ivas_br,
        dtx,
        SID,
        max_bw,
        bypass,
        agc,
@@ -262,6 +272,7 @@ def test_spar_hoa2_enc_system(
        fs,
        ivas_br,
        dtx,
        None,
        max_bw,
        bypass,
        agc,
@@ -279,6 +290,7 @@ def test_spar_hoa2_enc_system(
        fs,
        ivas_br,
        dtx,
        None,
        max_bw,
        bypass,
        agc,
@@ -326,6 +338,7 @@ def test_spar_hoa3_enc_system(
        fs,
        ivas_br,
        dtx,
        None,
        max_bw,
        bypass,
        agc,
@@ -343,6 +356,7 @@ def test_spar_hoa3_enc_system(
        fs,
        ivas_br,
        dtx,
        None,
        max_bw,
        bypass,
        agc,
@@ -375,6 +389,8 @@ def test_sba_enc_BWforce_system(
    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':
        pytest.skip()
    if ivas_br == 'sw_24k4_256k.bin':
        pytest.skip()
    fs = sample_rate_bw_idx[0]
@@ -397,6 +413,7 @@ def test_sba_enc_BWforce_system(
        fs,
        ivas_br,
        dtx,
        None,
        bw,
        bypass,
        agc,
@@ -415,6 +432,7 @@ def test_sba_enc_BWforce_system(
        fs,
        ivas_br,
        dtx,
        None,
        bw,
        bypass,
        agc,
@@ -437,6 +455,7 @@ def sba_enc(
    sampling_rate,
    ivas_br,
    dtx,
    SID,
    ivas_max_bw,
    bypass,
    agc,
@@ -468,16 +487,23 @@ def sba_enc(
    short_tag_ext = ""
    if agc != -1:
        short_tag_ext += f'_AGC{agc}'
    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}"
    # to avoid conflicting names in case of parallel test execution, differentiate all cases
    long_tag_ext = f"_AGC{agc}" if agc != -1 else "_AGC-unspecified"
    long_tag_ext += f"_pca{bypass}"
    if SID == 1:
        long_tag_ext += f"_SID"
    dut_pkt_file = f"{dut_out_dir}/{tag_out}{long_tag_ext}.pkt"
    ref_pkt_file = f"{ref_out_dir}/{tag_out}{short_tag_ext}.pkt"
    ref_pkt_file_dutenc = f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc.pkt"

    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"
    input_path = f"{test_vector_path}/{tag_in}{in_extension}"
    agc_op = agc if agc != -1 else None
    bypass_mode = bypass if bypass >= 0 else None
@@ -539,7 +565,21 @@ def sba_enc(
            dtx_mode=dtx_mode,
        )


    if SID == 1:
        if ref_encoder_path:
            with open(ref_pkt_file, "rb") as fp_in:
                    with open(ref_pkt_file_cut, "wb") as fp_out:
                        fr_cnt, cut_cnt = cut_bs(fp_in, fp_out, 0, True)
            with open(ref_pkt_file_dutenc, "rb") as fp_in:
                with open(ref_pkt_file_dutenc_cut, "wb") as fp_out:
                    fr_cnt, cut_cnt = cut_bs(fp_in, fp_out, 0, True)
            os.remove(ref_pkt_file)
            os.remove(ref_pkt_file_dutenc)
        if update_ref == 0:
            with open(dut_pkt_file, "rb") as fp_in:
                    with open(dut_pkt_file_cut, "wb") as fp_out:
                        fr_cnt, cut_cnt = cut_bs(fp_in, fp_out, 0, True)
            os.remove(dut_pkt_file)         
def sba_dec(
    decoder_frontend,
    ref_decoder_path,
@@ -549,6 +589,7 @@ def sba_dec(
    sampling_rate,
    ivas_br,
    dtx,
    SID,
    ivas_max_bw,
    bypass,
    agc,
@@ -571,11 +612,13 @@ def sba_dec(
    # 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'
    # to avoid conflicting names in case of parallel test execution, differentiate all cases
    long_tag_ext = f"_AGC{agc}" if agc != -1 else "_AGC-unspecified"
    long_tag_ext += f"_pca{bypass}"

    if SID == 1:
        long_tag_ext += f"_SID_cut"
    dut_out_dir = f"{dut_base_path}/sba_bs/raw"
    ref_out_dir = f"{reference_path}/sba_bs/raw"