Commit b4b4c542 authored by norvell's avatar norvell
Browse files

Add MLD property setting in tests

parent 2dcf95c1
Loading
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ def check_and_makedir(dir_path):
    masa_metadata_audio_ndir_ntransportch_dtx_list,
)
def test_masa_enc_dec(
    record_property,
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
    ref_encoder_frontend: EncoderFrontend,
@@ -106,6 +107,7 @@ def test_masa_enc_dec(
    test_vector_path,
    output_mode,
    get_mld,
    get_mld_lim,
):
    # Input parameters
    in_fs = 48
@@ -203,6 +205,11 @@ def test_masa_enc_dec(
            pcmcmp_res, reason = cmp_pcm(
                dec_output_dut, dec_output_ref, output_mode, int(out_fs * 1000), get_mld=get_mld
            )
            if get_mld:
                mld = 0
                if "MLD" in reason:
                    mld = float(reason.split(':')[1].split()[0])
                record_property("MLD",mld)

            # Fail if compare fails compare result
            if metacmp_res == False and pcmcmp_res != 0:
@@ -221,9 +228,16 @@ def test_masa_enc_dec(
                cmp_result, reason = cmp_pcm(
                    dec_output_dut, dec_output_ref, output_mode, int(out_fs * 1000), get_mld=get_mld
                )
                if get_mld:
                    mld = 0
                    if "MLD" in reason:
                        mld = float(reason.split(':')[1].split()[0])
                    record_property("MLD",mld)
                # Report compare result
                assert cmp_result == 0, reason
            else:
                if get_mld:
                    record_property("MLD","0")
                print("Comparison bit exact")

        # remove_output(
+7 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ def check_and_makedir(dir_path):
@pytest.mark.parametrize("fs", sampling_rate_list)
@pytest.mark.parametrize("gain_flag", gain_list)
def test_sba_plc_system(
    record_property,
    dut_decoder_frontend: DecoderFrontend,
    test_vector_path,
    reference_path,
@@ -89,6 +90,7 @@ def test_sba_plc_system(
    fs,
    gain_flag,
    get_mld,
    get_mld_lim,
):
    SID = 0
    if dtx == '1' and ivas_br not in ['13200','16400','24400','32000', '64000']:
@@ -192,6 +194,11 @@ def sba_dec_plc(
        # --------------  compare cmd  --------------
        fs = int(sampling_rate) * 1000
        cmp_result, reason = cmp_pcm(dut_out_raw, ref_out_raw, output_config, fs, get_mld=get_mld)
        if get_mld:
            mld = 0
            if "MLD" in reason:
                mld = float(reason.split(':')[1].split()[0])
            record_property("MLD",mld)

        # report compare result
        assert cmp_result == 0, reason
+9 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ def check_and_makedir(dir_path):
@pytest.mark.parametrize("tag", tag_list)
@pytest.mark.parametrize("fs", sample_rate_list)
def test_pca_enc(
    record_property,
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
    test_vector_path,
@@ -101,6 +102,7 @@ def test_pca_enc(
    tag,
    fs,
    get_mld,
    get_mld_lim,
):
    pca = True
    tag = tag + fs + "c"
@@ -161,6 +163,7 @@ def test_pca_enc(
@pytest.mark.parametrize("gain_flag", gain_list)
@pytest.mark.parametrize("SID", SID_list)
def test_sba_enc_system(
    record_property,
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
    test_vector_path,
@@ -178,6 +181,7 @@ def test_sba_enc_system(
    gain_flag,
    SID,
    get_mld,
    get_mld_lim,
):

    if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]:
@@ -664,6 +668,11 @@ def sba_dec(

        fs = int(sampling_rate) * 1000
        cmp_result, reason = cmp_pcm(dut_out_raw, ref_out_raw, output_config, fs, get_mld=get_mld)
        if get_mld:
            mld = 0
            if "MLD" in reason:
                mld = float(reason.split(':')[1].split()[0])
            record_property("MLD",mld)

        # report compare result
        assert cmp_result == 0, reason
+11 −3
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ def convert_test_string_to_tag(test_string):
@pytest.mark.create_ref
@pytest.mark.parametrize("test_tag", list(param_file_test_dict.keys()))
def test_param_file_tests(
    record_property,
    dut_encoder_frontend: EncoderFrontend,
    dut_decoder_frontend: DecoderFrontend,
    ref_encoder_frontend: EncoderFrontend,
@@ -138,6 +139,7 @@ def test_param_file_tests(
    keep_files,
    test_tag,
    get_mld,
    get_mld_lim,
):
    enc_opts, dec_opts, sim_opts, eid_opts = param_file_test_dict[test_tag]

@@ -326,10 +328,16 @@ def test_param_file_tests(
        ref_output_file = f"{reference_path}/param_file/dec/{output_file}"
        fs = int(sampling_rate) * 1000
        output_differs, reason = cmp_pcm(
            dut_output_file, ref_output_file, output_config, fs, get_mld=get_mld
            dut_output_file, ref_output_file, output_config, fs, get_mld=get_mld, mld_lim=get_mld_lim
        )
        md_out_files = get_expected_md_files(ref_output_file, enc_split, output_config)

        if get_mld:
            mld = 0
            if "MLD" in reason:
                mld = float(reason.split(':')[1].split()[0])
            record_property("MLD",mld)

        metadata_differs = False
        for md_file in md_out_files:
            dut_metadata_file = Path(f"{dut_base_path}/param_file/dec/{md_file}")
@@ -348,9 +356,9 @@ def test_param_file_tests(
        if output_differs or metadata_differs:
            msg = "Difference between ref and dut in "
            if output_differs and metadata_differs:
                msg += "output and metadata"
                msg += f"output ({reason}) and metadata"
            elif output_differs:
                msg += "output only"
                msg += f"output only ({reason})"
            elif metadata_differs:
                msg += "metadata only"