Files
Sylpheed/tools/re-capture/fade_pair.py
sylph-decoder aa4ffafbc5 re: the decaying quad is the INCOMING screen -- and (A) and (B) are different shapes
Last iteration left an unidentified full-screen untextured quad decaying
255->15 during a menu->title transition, which build 5's declaration does not
account for. Hypothesis: it is the INCOMING screen's own pteff00, which opens at
a255 and clears. 8 frames matching build 4's declared 16 units is a FIT, so the
test was a transition whose incoming screen declares something else: title->menu
brings in build 5, 0->12 = 12 units = 6 frames. Prediction recorded before the
run.

Measured: menu->title decay 8 frames (incoming build 4, declared 8), title->menu
decay 5 frames (incoming build 5, declared 6). Different incoming screen,
different decay, in the predicted direction. The second is one frame short of
prediction, inside the documented +-1.

The tell that clinches it: a screen contributes TWO primitives, pteff00 at 255
and pteff02 at 64. The settled menu's untextured set is [64]; at frame 34 it
becomes [64, 255, 64] -- build 4's opening pair, which no single element
explains.

Bonus, and it closes the alpha puzzle: in capture 2 the outgoing quad ramps with
no other untextured quad present -- 63, 127, 191, 255, steps of exactly 64, four
frames, against build 4's declared 261->269 = 8 units = 4 frames. Exact and
exactly linear. Capture 1's 102/127/255 was a composite of two overlapping
quads, as sylpheed-port proposed.

The thing neither of us predicted: the two directions are not the same shape.
(A) title->menu is SEQUENTIAL with a real black interval of 5 frames (~10 units,
against the port's authored 9). (B) menu->title is a CROSS-FADE with no black
interval at all -- the incoming title starts drawing at frame 34, before the
outgoing menu's quad begins ramping at 40. Authoring one hold for both directions
inserts black that (B) does not have.

Also fixed: fade_pair.py's automatic rising/decaying classifier worked on capture
1 and produced nonsense on capture 2, where the title has no full-screen
primitive at rest and the heuristic latched onto a transient. It now prints and
does not decide.

Refutation attempted: sylpheed-port's structural prediction of a 6-frame decay
for an incoming menu. Measured 5. Survives as direction, one frame short as
duration; recorded as both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
2026-08-30 13:51:48 +00:00

62 lines
2.4 KiB
Python
Executable File

#!/usr/bin/env python3
"""Per-frame full-screen UNTEXTURED quads across a screen change.
The `.prm` primitives are the transition machinery: one RISES to 255 (the
outgoing screen going black), one DECAYS from 255 (the incoming screen's own
fade-in), and a screen's constant primitive sits at a fixed alpha throughout.
This prints them per frame, with draw counts, so the spans can be checked against
durations the FILE declares.
fade_pair.py <capture.log> [--from N] [--to N]
⚠️ An earlier version of this tool tried to CLASSIFY the quads into rising and
decaying series automatically, by picking the constant series as "whatever value
appears on a frame with one quad". That worked on a menu->title capture and
produced nonsense on a title->menu one, where the title has no full-screen
primitive at rest and the heuristic latched onto a transient. The classification
is now left to the reader: the tool prints, it does not decide.
"""
import re
import sys
V = re.compile(r"col=([0-9A-F]{8})")
def main():
a = sys.argv
lo = int(a[a.index("--from") + 1]) if "--from" in a else 0
hi = int(a[a.index("--to") + 1]) if "--to" in a else 10 ** 9
frame, pend = None, None
untex, tex, nd, nt = {}, {}, {}, {}
for line in open(a[1]):
if line.startswith("--- frame"):
frame = int(line.split()[2])
untex.setdefault(frame, []); tex.setdefault(frame, [])
nd[frame] = nt[frame] = 0
continue
if frame is None:
continue
m = re.match(r"\s*(\d+) prim=(\d+)", line)
if m:
nd[frame] += 1
if "tex[base=" in line:
nt[frame] += 1
pend = ("tex" if "tex[base=" in line else "untex") if m.group(2) == "13" else None
continue
if "vb=0x" in line and pend:
c = V.findall(line)
if c and pend == "untex" and "[-1.00,1.00," in line:
untex[frame] += [int(x[:2], 16) for x in c[::4]]
elif c and pend == "tex":
tex[frame] += [int(x[:2], 16) for x in c[::4]]
pend = None
print("frame untextured full-screen textured (distinct) draws tex")
for f in sorted(untex):
if lo <= f <= hi:
print(f"{f:5d} {str(untex[f]):22s} {str(sorted(set(tex[f]))):26s} {nd[f]:4d} {nt[f]:3d}")
return 0
if __name__ == "__main__":
raise SystemExit(main())