Commit 733a2882 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

add BE, max diff stat to the print

parent c3125154
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ class MLDConformance:
        # CREATE OUTPUT DIRECTORY STRUCTURE : CLEAN PREV OUTPUT
        self.outputDir = os.path.join(self.scriptsDir, "CUT_OUTPUTS")
        if os.path.exists(self.outputDir):
            if not self.args.dec_for_dut_enc:
                shutil.rmtree(self.outputDir, ignore_errors=False)
        os.makedirs(self.outputDir, exist_ok=True)
        subdirs = ["enc", "dec", "renderer_short", "split_rendering"]
@@ -79,7 +80,11 @@ class MLDConformance:
    def setupDUT(self):
        self.cut_build_path = args.cut_build_path
        self.filter = args.filter
        self.mldbin = os.path.join(self.toolsdir, platform.system(), "mld")
        exe_platform = platform.system()
        if platform.system() == 'Windows':
            exe_platform = 'Win32'
        self.mldbin = os.path.join(self.toolsdir, exe_platform, "mld")
        print(self.mldbin)
        self.CutBins = dict()
        self.mldcsv = dict()
        self.sampleStats = dict()
@@ -243,6 +248,7 @@ class MLDConformance:
        command = self.reformatCommand(command=command, ref=False)
        command = self.setCommandExec(tag="ENC", command=command, ref=False)
        dutEncOutput = self.getOutputFile(command)
        if not self.args.dec_for_dut_enc:
            self.process(command=command)
        assert ".192" in dutEncOutput, "Output file not identified"

@@ -524,6 +530,10 @@ class MLDConformance:
        for tag in keys:
            if os.path.exists(self.mldcsv[tag]):
                mdlValues = np.loadtxt(self.mldcsv[tag], delimiter=" ", dtype=float)
                bePercent = np.loadtxt(self.sampleStats[tag], delimiter=",", dtype=float, skiprows=1, usecols=3)
                maxDiff = np.loadtxt(self.sampleStats[tag], delimiter=",", dtype=float, skiprows=1, usecols=1)
                bePercentAvg = np.average(bePercent)
                maxDiffmax = np.max(maxDiff)*32768.0
                N = mdlValues.shape[0]
                if N == 0:
                    continue
@@ -540,6 +550,8 @@ class MLDConformance:
                print(f"<{tag}> Frames with MLD <= 1 : {m1} frames ({PCNT(m1)}%)")
                print(f"<{tag}> Frames with MLD <= 2 : {m2} frames ({PCNT(m2)}%)")
                print(f"<{tag}> Frames with MLD <= 5 : {m5} frames ({PCNT(m5)}%)")
                print(f"<{tag}> BE frames percentage = {bePercentAvg}")
                print(f"<{tag}> max absolute diff = {maxDiffmax}, sample range (-32768, 32767)")
                print("##########################################################\n")


@@ -570,6 +582,12 @@ if __name__ == "__main__":
        action="store_true",
        help="Regenerate the encoder reference bitstreams and decoded outputs",
    )
    parser.add_argument(
        "--dec-for-dut-enc",
        default=False,
        action="store_true",
        help="process dut ENC files with REF decoder",
    )    
    parser.add_argument(
        "--verbose",
        default=False,