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

add JBM testcases

parent e9cdcc92
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -374,9 +374,10 @@ COMBINED_FORMATS_PARAMS = OSBA_PARAMS + OMASA_PARAMS

### -------------- decoder parameter lists --------------

FER_0 = "FER_0perc"
FER_15 = "FER_15perc"
BITSTREAM_PROCESSING_FER = [FER_0, FER_15]
BS_PROC_NONE = "CLEAN_CHANNEL"
BS_PROC_FER_15 = "FER_15perc"
BS_PROC_JBM_DLY_PROF_5 = "JBM_dlyprofile5"
BITSTREAM_PROCESSING = [BS_PROC_NONE, BS_PROC_FER_15, BS_PROC_JBM_DLY_PROF_5]

DECODER_CHANNELBASED_AND_MASA_PARAMS = (
    collapse_into_list_of_pairs(
@@ -384,7 +385,7 @@ DECODER_CHANNELBASED_AND_MASA_PARAMS = (
            STEREO_PARAMS,
            OUTPUT_FORMATS_ALL[:2],
            SAMPLING_RATES_ALL,
            BITSTREAM_PROCESSING_FER,
            BITSTREAM_PROCESSING,
        )
    )
    + collapse_into_list_of_pairs(
@@ -392,7 +393,7 @@ DECODER_CHANNELBASED_AND_MASA_PARAMS = (
            MC_PARAMS,
            OUTPUT_FORMATS_ALL[:10] + OUTPUT_FORMATS_BINAURAL,
            SAMPLING_RATES_ALL,
            BITSTREAM_PROCESSING_FER,
            BITSTREAM_PROCESSING,
        )
    )
    + collapse_into_list_of_pairs(
@@ -400,25 +401,21 @@ DECODER_CHANNELBASED_AND_MASA_PARAMS = (
            MASA_PARAMS,
            OUTPUT_FORMATS_ALL,
            SAMPLING_RATES_ALL,
            BITSTREAM_PROCESSING_FER,
            BITSTREAM_PROCESSING,
        )
    )
)
DECODER_OBJECTBASED = collapse_into_list_of_pairs(
    product(
        ISM_PARAMS, OUTPUT_FORMATS_ALL, SAMPLING_RATES_ALL, BITSTREAM_PROCESSING_FER
    )
    product(ISM_PARAMS, OUTPUT_FORMATS_ALL, SAMPLING_RATES_ALL, BITSTREAM_PROCESSING)
)
DECODER_SCENEBASED = collapse_into_list_of_pairs(
    product(
        SBA_PARAMS, OUTPUT_FORMATS_ALL, SAMPLING_RATES_ALL, BITSTREAM_PROCESSING_FER
    )
    product(SBA_PARAMS, OUTPUT_FORMATS_ALL, SAMPLING_RATES_ALL, BITSTREAM_PROCESSING)
)
DECODER_COMBINED_PARAMS = collapse_into_list_of_pairs(
    product(
        COMBINED_FORMATS_PARAMS,
        OUTPUT_FORMATS_ALL,
        SAMPLING_RATES_ALL,
        BITSTREAM_PROCESSING_FER,
        BITSTREAM_PROCESSING,
    )
)
+44 −17
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ from . import (
    REF_PATH,
    DUT_PATH,
    TESTV_PATH,
    HERE,
)
from .constants import *
from pathlib import Path
@@ -55,22 +56,22 @@ def get_output_path(bitstream_path, output_format, output_sampling_rate):


@contextmanager
def get_bitstream(
    testv_name, encoder_format, bitrate, sampling_rate, dtx, suffix="", processing=None
def get_bitstream_and_options(
    testv_name, encoder_format, bitrate, sampling_rate, dtx, processing, suffix=""
):
    """
    Utility to get either the stored reference bitstream or the processed version as a temporary file
    """
    options = list()
    with TemporaryDirectory() as tmp_dir:
        bitstream = get_bitstream_path(
            REF_PATH, testv_name, encoder_format, bitrate, sampling_rate, dtx, suffix
        )
        if processing == FER_15:
            bitstream_out = Path(tmp_dir).joinpath(
                bitstream.stem + f".{processing}.192"
            )
        bitstream_out = Path(tmp_dir).joinpath(bitstream.stem + f".{processing}.192")
        if processing == BS_PROC_FER_15:
            ep_path = TESTV_PATH.joinpath("ltv_ep_015.192")
            cmd = [
                # TODO: adapt for windows
                "eid-xor",
                "-fer",
                "-vbr",
@@ -80,8 +81,27 @@ def get_bitstream(
            ]
            subprocess.run(cmd)
            bitstream = bitstream_out
        elif processing == BS_PROC_JBM_DLY_PROF_5:
            dly_profile_path = HERE.joinpath(
                "../../scripts/dly_error_profiles/dly_error_profile_5.dat"
            )
            tracefile_path = Path(tmp_dir).joinpath(bitstream_out.with_suffix(".trace"))
            # TODO: adapt for windows
            # TODO: get number of frames per packet from error profile name
            cmd = [
                "networkSimulator_g192",
                str(dly_profile_path),
                str(bitstream),
                str(bitstream_out),
                str(tracefile_path),
                "2",
                "0",
            ]
            subprocess.run(cmd)
            bitstream = bitstream_out
            options.append("-VOIP")

        yield bitstream
        yield bitstream, options


def run_check(
@@ -89,10 +109,13 @@ def run_check(
    output_format,
    sampling_rate,
    dut_output,
    options,
    decoder_frontend,
    is_ref_creation,
):
    decoder_frontend.run(output_format, sampling_rate, ref_bitstream, dut_output)
    decoder_frontend.run(
        output_format, sampling_rate, ref_bitstream, dut_output, add_option_list=options
    )

    if not is_ref_creation and not is_be_to_ref(dut_output):
        pytest.fail(f"Decoder output differs from reference")
@@ -117,14 +140,14 @@ def test_decoder_channelbased_and_masa(
    update_ref,
):
    testv_name = get_testv_path(input_format, input_sampling_rate).stem
    with get_bitstream(
    with get_bitstream_and_options(
        testv_name,
        input_format,
        bitrate,
        input_sampling_rate,
        dtx,
        processing=bitstream_processing,
    ) as ref_bitstream:
    ) as (ref_bitstream, options):
        dut_output = get_output_path(ref_bitstream, output_format, output_sampling_rate)

        run_check(
@@ -132,6 +155,7 @@ def test_decoder_channelbased_and_masa(
            output_format,
            output_sampling_rate,
            str(dut_output),
            options,
            dut_decoder_frontend,
            update_ref == 1,
        )
@@ -159,7 +183,7 @@ def test_decoder_objectbased(
        suffix = "_ext_MD"
    elif md_type == ISM_MD_NULL:
        suffix = "_null_MD"
    with get_bitstream(
    with get_bitstream_and_options(
        testv_name,
        input_format,
        bitrate,
@@ -167,7 +191,7 @@ def test_decoder_objectbased(
        dtx,
        suffix=suffix,
        processing=bitstream_processing,
    ) as ref_bitstream:
    ) as (ref_bitstream, options):
        dut_output = get_output_path(ref_bitstream, output_format, output_sampling_rate)

        run_check(
@@ -177,6 +201,7 @@ def test_decoder_objectbased(
            str(dut_output),
            dut_decoder_frontend,
            update_ref == 1,
            add_option_list=options
        )


@@ -200,7 +225,7 @@ def test_decoder_scenebased(
    suffix = ""
    if pca == SBA_FOA_PCA_ON:
        suffix += "-pca"
    with get_bitstream(
    with get_bitstream_and_options(
        testv_name,
        input_format,
        bitrate,
@@ -208,7 +233,7 @@ def test_decoder_scenebased(
        dtx,
        suffix=suffix,
        processing=bitstream_processing,
    ) as ref_bitstream:
    ) as (ref_bitstream, options):
        dut_output = get_output_path(ref_bitstream, output_format, output_sampling_rate)

        run_check(
@@ -218,6 +243,7 @@ def test_decoder_scenebased(
            str(dut_output),
            dut_decoder_frontend,
            update_ref == 1,
            add_option_list=options
        )


@@ -247,7 +273,7 @@ def test_decoder_combined_formats(
        suffix = "_ext_MD"
    elif md_type == ISM_MD_NULL:
        suffix = "_null_MD"
    with get_bitstream(
    with get_bitstream_and_options(
        testv_name,
        input_format_combined,
        bitrate,
@@ -255,7 +281,7 @@ def test_decoder_combined_formats(
        DTX_OFF,
        suffix=suffix,
        processing=bitstream_processing,
    ) as ref_bitstream:
    ) as (ref_bitstream, options):
        dut_output = get_output_path(ref_bitstream, output_format, output_sampling_rate)

        run_check(
@@ -265,4 +291,5 @@ def test_decoder_combined_formats(
            str(dut_output),
            dut_decoder_frontend,
            update_ref == 1,
            add_option_list=options
        )
+7 −1
Original line number Diff line number Diff line
@@ -242,7 +242,13 @@ def test_encoder_combined_formats(
    elif md_type == ISM_MD_NULL:
        suffix = "_null_MD"
    bitstream = get_bitstream_path(
        DUT_PATH, testv.stem, input_format_combined, bitrate, sampling_rate, DTX_OFF, suffix=suffix
        DUT_PATH,
        testv.stem,
        input_format_combined,
        bitrate,
        sampling_rate,
        DTX_OFF,
        suffix=suffix,
    )
    run_check(
        bitstream,