mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-11-02 12:23:17 +02:00
37 lines
1.1 KiB
Python
Executable File
37 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Make a small known movie for the one-frame MAME FILL check."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from pipeline.movie import FrameRecord, MovieHeader, write_movie
|
|
from pipeline.tilepack import diff_tiles
|
|
|
|
|
|
def main() -> int:
|
|
width, height = 640, 512
|
|
canvas = np.zeros((height, width), dtype=bool)
|
|
canvas[20:70, 10:110] = True # a rectangle crossing tiles
|
|
canvas[96:128, 160:192] = True # a solid logical tile at (5,3)
|
|
records = diff_tiles(np.zeros_like(canvas), canvas, tile=32)
|
|
frames = [FrameRecord(1, 0, records)]
|
|
header = MovieHeader(width, height, 2, 32, width // 32, height // 32,
|
|
len(frames), 60, 72)
|
|
out = ROOT / "data" / "test_movie.bin"
|
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
write_movie(str(out), frames, header)
|
|
print("%s: %d bytes, %d dirty tiles"
|
|
% (out, out.stat().st_size, len(records)))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|