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

add -no_delay_cmp and rewrite get_options()

parent 92fc3b8d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ def get_bitstream_and_options(
    The reason for implementing this as a context manager instead of a simple function is that this way
    the temporary processed bitstream files are cleaned up automatically and do not exploce disk space even more...
    """
    options = list()
    options = ["-no_delay_cmp"]
    with TemporaryDirectory() as tmp_dir:
        # TODO: this should be coming from TESTV_PATH - current setuponly for development
        bitstream = get_bitstream_path(
+34 −10
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ from ..constants import (
    TESTV_PATH,
    REF_PATH,
    DTX_ON,
    INPUT_FORMATS_SCENE_BASED,
    INPUT_FORMATS_MASA,
)


@@ -106,21 +108,43 @@ def get_md(input_format, md_type=None):
    return md_files


def get_options(input_format, max_band=None, md_type=None):
def get_options(input_format_1, input_format_2=None, max_band=None, md_type=None):

    options = list()
    if max_band is not None:
        options.extend(["-max_band", max_band])

    options.extend(list(CMDL_OPTIONS_FOR_INPUT_FORMAT[input_format]))
    print(input_format_1)
    options = list(CMDL_OPTIONS_FOR_INPUT_FORMAT[input_format_1])
    print(options)

    if md_type == ISM_MD_EXTENDED:
        assert input_format in INPUT_FORMATS_OBJECT_BASED
        idx = options.index("-ism") + 1
        options[idx] = f"+{options[idx]}"
    md_options = get_md(input_format, md_type)
        assert input_format_1 in INPUT_FORMATS_OBJECT_BASED
        options[1] = f"+{options[1]}"

    md_options = get_md(input_format_1, md_type)
    
    # this block is for the combined formats only
    if input_format_2 is not None:
        options_other = list(CMDL_OPTIONS_FOR_INPUT_FORMAT.get(input_format_2, list()))

        input_format_combined = None
        if input_format_2 in INPUT_FORMATS_SCENE_BASED:
            input_format_combined = "OSBA"
        elif input_format_2 in INPUT_FORMATS_MASA:
            input_format_combined = "OMASA"

        options_combined = list(CMDL_OPTIONS_FOR_INPUT_FORMAT.get(input_format_combined, list()))

        options = options_combined + options[1:2] + options_other[1:2] + md_options + options_other[2:]

    else:
        options.extend(md_options)

    if max_band is not None:
        options.insert(0, "-max_band")
        options.insert(1, max_band)

    options.insert(0, "-no_delay_cmp")

    print(options)

    return options


+5 −15
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ def test_encoder_const_br_channel_based_and_masa_modes(
    update_ref,
):
    testv = get_testv_path(input_format, sampling_rate)
    options = get_options(input_format, max_band)
    options = get_options(input_format, max_band=max_band)
    run_check(
        input_format,
        bitrate,
@@ -122,7 +122,7 @@ def test_encoder_const_br_object_based_modes(
    update_ref,
):
    testv = get_testv_path(input_format, sampling_rate)
    options = get_options(input_format, max_band, md_type=md_type)
    options = get_options(input_format, max_band=max_band, md_type=md_type)
    bitstream_suffix = "_basic_MD"
    if md_type == ISM_MD_EXTENDED:
        bitstream_suffix = "_ext_MD"
@@ -152,7 +152,7 @@ def test_encoder_const_br_scenebased(
    update_ref,
):
    testv = get_testv_path(input_format, sampling_rate)
    options = get_options(input_format, max_band)
    options = get_options(input_format, max_band=max_band)
    bitstream_suffix = ""
    if pca == SBA_FOA_PCA_ON:
        options.extend(["-bypass", "2"])
@@ -175,7 +175,7 @@ def test_encoder_const_br_stereo_dmx_evs(
):
    testv = get_testv_path("STEREO", sampling_rate)
    input_format = "STEREO_DMX_EVS"
    options = get_options(input_format, max_band)
    options = get_options(input_format, max_band=max_band)
    run_check(
        input_format,
        bitrate,
@@ -203,17 +203,7 @@ def test_encoder_const_br_combined_formats(
        f"{input_format_combined}_{input_format_ism}_{input_format_other}",
        sampling_rate,
    )
    options_ism = get_options(input_format_ism, md_type=md_type)
    options_other = get_options(input_format_other)
    options_combined = get_options(input_format_combined, max_band)
    # glue together: combined mode option, ism num, SBA order/MASA TCs, ISM MD files, MASA MD files (slice results in empty list for OSBA)
    options = (
        options_combined
        + options_ism[1:2]
        + options_other[1:2]
        + options_ism[2:]
        + options_other[2:]
    )
    options = get_options(input_format_ism, input_format_2=input_format_other, max_band=max_band, md_type=md_type)
    bitstream_suffix = "_basic_MD"
    if md_type == ISM_MD_EXTENDED:
        bitstream_suffix = "_ext_MD"