Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions tools/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,11 @@ def get_ref_md5(fn):

class ConformanceRunner(TestRunner):
def run(self):
if os.path.isfile(self.args.test_path):
self.__test_file()
else:
self.__test_dir()
self.__test_files(self.files)

def add_args(self, parser):
parser.add_argument("-t", "--threads", type=int, default=16)

def __test_file(self):
pss = self.__test(self.args.test_path)
print(basename(self.args.test_path) + " passed" if pss == PASSED else " failed")
return 0

def __get_md5(self, input):
cmd = self.args.ffmpeg_path + " -i " + input + " -vsync 0 -f md5 -"
print(cmd)
Expand All @@ -110,22 +102,22 @@ def __test(self, f):
print("md5 mismatch ref = " + refmd5 + " md5 = " + md5)
return FAILED


def __submmit_files(self, executor, path):
def __submmit_files(self, executor, files):
future_to_file = {}
file_list = sorted(self.list_files(path), key = lambda x: os.stat(x).st_size)
for f in file_list:
files = sorted(files, key=lambda x: os.stat(x).st_size)
for f in files:
future_to_file[executor.submit(self.__test, f)] = f

return future_to_file


def __test_dir(self):
def __test_files(self, files):
summary = [[], [], []]
count = [0, 0, 0]

with concurrent.futures.ThreadPoolExecutor(max_workers=self.args.threads) as executor:
future_to_file = self.__submmit_files(executor, self.args.test_path)
with concurrent.futures.ThreadPoolExecutor(
max_workers=self.args.threads
) as executor:
future_to_file = self.__submmit_files(executor, files)
for future in concurrent.futures.as_completed(future_to_file):
f = future_to_file[future]
try:
Expand Down
3 changes: 1 addition & 2 deletions tools/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class PerformanceRunner(TestRunner):
def run(self):
self.__app = self.__get_app()

files = self.list_files(self.args.test_path)
for f in files:
for f in self.files:
self.__test(f)

self.__print_summary()
Expand Down
3 changes: 1 addition & 2 deletions tools/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class ThreadRunner(TestRunner):
def run(self):
self.__app = self.__get_app()

files = self.list_files(self.args.test_path)
for f in files:
for f in self.files:
self.__test(f)

self.__print_summary()
Expand Down
11 changes: 9 additions & 2 deletions tools/utils/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestRunner:
def check_input(self):
parser = argparse.ArgumentParser(description="FFVVC test runner")

parser.add_argument("test_path", type=str)
parser.add_argument("test_path", type=str, nargs="+")
parser.add_argument(
"-f",
"--ffmpeg-path",
Expand Down Expand Up @@ -67,4 +67,11 @@ def list_files(path):
fn = os.path.join(root, f)
if TestRunner.is_candidiate(fn):
l.append(fn)
return l
return l

@property
def files(self):
l = []
for path in self.args.test_path:
l += TestRunner.list_files(path)
return l