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

fix merge error

parent 9868b4ac
Loading
Loading
Loading
Loading
Loading
+29 −36
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ submitted to and settled by the final, binding jurisdiction of the courts of Mun
accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
the United Nations Convention on Contracts on the International Sales of Goods.
"""

import argparse
import os
import platform
@@ -474,9 +475,9 @@ class MLDConformance:
    def genEncoderReferences(self, tag: str, encPytestTag: str):
        # RUN ENCODER'S OUTPUT DECODED WITH REF DECODER
        testDesc = self.TestDesc[tag][encPytestTag]
        assert isinstance(
            testDesc, BitstreamTestDescriptor
        ), f"Expected bitstream test descriptor for {tag}"
        assert isinstance(testDesc, BitstreamTestDescriptor), (
            f"Expected bitstream test descriptor for {tag}"
        )

        # Decode the encoded output with Reference IVAS decoder
        if tag == "ENC":
@@ -510,9 +511,9 @@ class MLDConformance:

    def analyseWavOutputTest(self, tag: str, dutPytestTag: str):
        testDesc = self.TestDesc[tag][dutPytestTag]
        assert isinstance(
            testDesc, TestDescriptor
        ), f"Expected pcm test descriptor for {tag}"
        assert isinstance(testDesc, TestDescriptor), (
            f"Expected pcm test descriptor for {tag}"
        )

        if self.args.be_test:
            DUTmdFiles = self.getMDfileList(outFile=testDesc.dutOutput)
@@ -537,9 +538,9 @@ class MLDConformance:

    def analyseOneEncoderTest(self, tag: str, encPytestTag: str):
        testDesc = self.TestDesc[tag][encPytestTag]
        assert isinstance(
            testDesc, BitstreamTestDescriptor
        ), f"Expected bitstream test descriptor for {tag}"
        assert isinstance(testDesc, BitstreamTestDescriptor), (
            f"Expected bitstream test descriptor for {tag}"
        )

        if self.args.be_test:
            self.beTest(
@@ -566,9 +567,9 @@ class MLDConformance:

    def analyseOneIsarEncoderTest(self, tag: str, pytestTag: str):
        testDesc = self.TestDesc[tag][pytestTag]
        assert isinstance(
            testDesc, BitstreamTestDescriptor
        ), f"Expected bitstream test descriptor for {tag}"
        assert isinstance(testDesc, BitstreamTestDescriptor), (
            f"Expected bitstream test descriptor for {tag}"
        )

        if self.args.be_test:
            self.beTest(
@@ -787,9 +788,9 @@ class MLDConformance:
        with tempfile.TemporaryDirectory() as tmpdir:
            refSamples, fsR = readfile(refFile, outdtype="float")
            dutSamples, fsD = readfile(dutFile, outdtype="float")
            assert (
                refSamples.shape[1] == dutSamples.shape[1]
            ), "No of channels mismatch if ref vs cut"
            assert refSamples.shape[1] == dutSamples.shape[1], (
                "No of channels mismatch if ref vs cut"
            )
            maxDiff, rmsdB, beSamplesPercent = self.getSampleStats(
                refSamples, dutSamples
            )
@@ -863,19 +864,7 @@ class MLDConformance:
        if not filecmp.cmp(refFile, dutFile):
            BE_flag = 1
        with open(self.BEcsv[tag], "a") as f:
            f.write(
                f"{pytestTag}, {BE_flag}\n"
            )

        for i in range(0,len(DUTmdFileList)):
            if os.path.exists(DUTmdFileList[i]):
                BE_flag = 0
                if not filecmp.cmp(REFmdFileList[i], DUTmdFileList[i]):
                    BE_flag = 1
                with open(self.BEcsv[tag], "a") as f:
                    f.write(
                        f"{DUTmdFileList[i]}, {BE_flag}\n"
                    )
            f.write(f"{pytestTag}, {BE_flag}\n")

        assert len(DUTmdFileList) == len(REFmdFileList)
        for refMDfile, dutMDfile in zip(REFmdFileList, DUTmdFileList):
@@ -903,9 +892,7 @@ class MLDConformance:
                assert False, f"MD file has unknown suffix {ref_suffix}"

            with open(self.BEcsv[tag], "a") as f:
                f.write(
                    f"{dutMDfile}, {BE_flag}\n"
                )
                f.write(f"{dutMDfile}, {BE_flag}\n")

    def doBEanalysis(self, selectTag="all"):
        keys = IVAS_Bins.keys() if selectTag == "all" else [selectTag]
@@ -936,9 +923,13 @@ class MLDConformance:
        dutMLD = mldCutWithTags["MLD"][indDut]
        diff = dutMLD - refMLD
        if diff.max() > threshold:
            print(f"\033[91mMLD Corridor failed for {tag} with max MLD diff of {diff.max()} \033[00m")
            print(
                f"\033[91mMLD Corridor failed for {tag} with max MLD diff of {diff.max()} \033[00m"
            )
        else:
            print(f"\033[92mMLD Corridor passed for {tag} with max MLD diff of {diff.max()} \033[00m")
            print(
                f"\033[92mMLD Corridor passed for {tag} with max MLD diff of {diff.max()} \033[00m"
            )

    def doAnalysis(self, selectTag="all", corridor=False):
        keys = IVAS_Bins.keys() if selectTag == "all" else [selectTag]
@@ -1002,7 +993,9 @@ class MLDConformance:
                        )
                        self.computeCorridor(mldRefWithTags, mdlCutWithTags, tag)
                    else:
                        print(f"\033[91mMissing reference MLD file for {tag} : {refMldFile} \033[00m")
                        print(
                            f"\033[91mMissing reference MLD file for {tag} : {refMldFile} \033[00m"
                        )


if __name__ == "__main__":