forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiBb63bf80Tahinli6 days ago3937 commits

run422-ffmpeg.py54 lines, 1.9 KiBHistoryRawDownload
1#!/usr/bin/env python3
2"""Driver: decode a cell with our decode_probe (EC_AV1_FINAL_DUMP) and compare
3against ffmpeg, per plane, per frame. Geometry from the sequence header."""
4import json
5import os
6import subprocess
7import sys
8
9sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
10import cmpff # noqa: E402
11
12PROBE = "/home/user/.cache/probes/decode_probe-main-8aedb701"
13WORK = "/home/user/.cache/seed422"
14
15
16def decode_ours(name, path, extra_env=None):
17 d = os.path.join(WORK, name)
18 os.makedirs(d, exist_ok=True)
19 for f in os.listdir(d):
20 os.remove(os.path.join(d, f))
21 prefix = os.path.join(d, "ours")
22 env = dict(os.environ, EC_AV1_FINAL_DUMP=prefix)
23 env.update(extra_env or {})
24 r = subprocess.run([PROBE, path], stdout=subprocess.PIPE,
25 stderr=subprocess.STDOUT, timeout=3600, env=env)
26 out = r.stdout.decode("utf-8", "replace")
27 if "REFUSED:" in out:
28 return None, out.split("REFUSED:", 1)[1].strip().splitlines()[0]
29 return prefix, out
30
31
32def one(name, path, want_hidden=None, keep=True):
33 prefix, out = decode_ours(name, path)
34 if prefix is None:
35 print(f"{name}: REFUSES: {out}")
36 return {"cell": name, "status": "REFUSES", "msg": out}
37 res, *_ = cmpff.run(name, path, prefix, want_hidden, json_out=False)
38 res["probe"] = out.strip().splitlines()[-1] if out.strip() else ""
39 return res
40
41
42if __name__ == "__main__":
43 cells = json.load(open(sys.argv[1]))
44 out = []
45 for c in cells:
46 try:
47 res = one(c["name"], c["path"], c.get("hidden"))
48 except SystemExit as e:
49 res = {"cell": c["name"], "status": "COMPARATOR-ERROR", "msg": str(e)}
50 print(json.dumps({k: v for k, v in res.items()
51 if k not in ("per_decode_frame", "per_display_frame", "bbox")}),
52 flush=True)
53 out.append(res)
54 json.dump(out, open(sys.argv[2], "w"), indent=1)