Commit 8cc9a382 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix for windows

parents 02e78c2e 6a301dd0
Loading
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -47,9 +47,6 @@ import scipy.signal as sig

sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))

#from pyaudio3dtools.audiofile import readfile, writefile
#from pyaudio3dtools.audioarray import resample


def readfile(
    filename: str, nchannels: int = 1, fs: int = 48000, outdtype="float"
@@ -205,6 +202,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"]
@@ -220,6 +218,9 @@ class MLDConformance:
    def setupDUT(self):
        self.cut_build_path = args.cut_build_path
        self.filter = args.filter
        exe_platform = platform.system()
        if platform.system() == 'Windows':
            exe_platform = 'Win32'
        self.mldbin = os.path.join(self.toolsdir, platform.system(), "mld")
        self.wavdiffbin = os.path.join(self.toolsdir, platform.system(), "wav-diff")
        self.CutBins = dict()
@@ -434,7 +435,10 @@ class MLDConformance:
        command = self.reformatCommand(command)
        command = self.setCommandExec(tag="ENC", command=command)
        dutEncOutput = self.getOutputFile(command)
        self.process(command)

        if not self.args.dec_for_dut_enc:
            self.process(command=command)

        assert ".192" in dutEncOutput, "Output file not identified"

        # Decode the encoded output with Reference decoder
@@ -774,6 +778,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
@@ -790,6 +798,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")


@@ -820,6 +830,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,