legacy video: bench lines (320x240 / 320x200 fixtures), Smacker frame decoder through 10-bit lookup tables
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4b098276e2
commit
53325af777
5 files changed
+157
-56
No files matched your search
+10
-4
@@ -381,11 +381,14 @@ def tone(n, ch, bits, rate, seed, f0):
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------- files
|
||||
def idx_frames(w, h, n, seed):
|
||||
def idx_frames(w, h, n, seed, busy=False):
|
||||
rnd = random.Random(seed)
|
||||
out = []
|
||||
for t in range(n):
|
||||
img = [[(x // 8 + y // 8 * 3) % 40 for x in range(w)] for y in range(h)]
|
||||
if busy: # textured, moving: mostly FULL blocks (the bench)
|
||||
img = [[(x * 3 + y * 5 + ((x + t * 4) * (y + t)) // 7) % 251 for x in range(w)] for y in range(h)]
|
||||
else:
|
||||
img = [[(x // 8 + y // 8 * 3) % 40 for x in range(w)] for y in range(h)]
|
||||
for y in range(8, 24):
|
||||
for x in range(8 + t * 4, 24 + t * 4):
|
||||
img[y][x] = 100 + (x + y) % 2 # two colours: MONO blocks
|
||||
@@ -399,10 +402,10 @@ def idx_frames(w, h, n, seed):
|
||||
return out
|
||||
|
||||
|
||||
def smk_file(version, w, h, nframes, pts_inc, tracks, ring, seed):
|
||||
def smk_file(version, w, h, nframes, pts_inc, tracks, ring, seed, busy=False):
|
||||
"""version 2 / 4; tracks = [(kind, rate, ch, bits)] kind "packed" / "raw"; returns bytes, track info"""
|
||||
rnd = random.Random(seed)
|
||||
frames = idx_frames(w, h, nframes, seed)
|
||||
frames = idx_frames(w, h, nframes, seed, busy)
|
||||
if ring:
|
||||
frames = frames + [frames[0]]
|
||||
treebytes, sizes, video = encode_video(frames, w, h, version == 4, rnd)
|
||||
@@ -491,3 +494,6 @@ def generate(ctx):
|
||||
cases.append({"name": name, "data": data, "width": w, "height": h, "rate": rate, "frames": crcs, "audio": audio,
|
||||
"ring": ring})
|
||||
ctx.emit("smk_cases", cases)
|
||||
# tools/bench.luau: a 320x200 SMK4 with 22.05 kHz packed stereo audio, 10 frames
|
||||
ctx.emit("smk_bench", {"data": smk_file(4, 320, 200, 10, 100, [("packed", 22050, 2, 16)], False, 9, True), "width": 320,
|
||||
"height": 200, "frames": 10})
|
||||
Reference in new issue
Block a user