"""BlastEm against PicoDrive: for each title and checkpoint, the closest PicoDrive frame.""" import sys from pathlib import Path sys.path.insert(0, "scripts") from compare_frames import compare from megadrive_python.png import read_png M = Path("reference/m6") for d in sorted((M / "blastem").iterdir()): out = [] for n in range(100, 1201, 100): b = read_png(d / f"f{n:05d}.png") if len({p for r in b for p in r}) == 1: out.append(f"{n}:blank"); continue best = None for m in range(max(2, n - 300), min(1200, n + 300) + 1, 2): diff = len(compare(b, read_png(M / "pico" / d.name / f"f{m:05d}.png"), 0, 0, 12)) / (320 * 224) if best is None or diff < best[1]: best = (m, diff) out.append(f"{n}:{n - best[0]:+d}/{best[1]:.0%}") print(d.name[:36].ljust(36), " ".join(out), flush=True)