Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

docs(rife): an odd-width cross-fade window counts one lost pixel in up to nine, not four

Soohong Kimb309908ed768
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f57f1c8..51c8d35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- **Fix: the Linux lane's `--rife-only` runs every test of the real RIFE, not one file.** It ran `tests/video/test_rife.py` alone, while `--rife-unmeasured` skips every test that needs the real `rife-ncnn-vulkan` — so a real-RIFE test in another file (2.43.0's in `tests/video/test_crossfade.py` and `tests/video/test_ghost_screen.py`) was measured by neither run. Such a test now carries one mark, `real_rife` (registered in `pyproject.toml`): `tests/conftest.py` skips the marked tests where `rife.locate()` finds no RIFE, and `scripts/linux_lane.sh --rife-only` runs `pytest -m real_rife` over the whole suite, none skipped. A new real-RIFE test is run by `--rife-only` once it is marked. `docs/release.md` says what each run measures.
- **`tests/release/test_lane_rife_collection.py`** collects the suite twice, once with a stand-in RIFE where `rife.locate()` looks (`SPRITE_GEN_RIFE`, `PATH`, the install root) and once with none: a test the two collections skip or collect differently and that is not marked `real_rife` fails it by name.
+- **Correction to 2.43.0's cross-fade measure:** "the windows step by half their size, so one lost pixel is counted in up to four of them" holds where the window is an even number of pixels wide. The step is half the width rounded down, so an odd-width window counts one pixel in up to nine. The `rife.crossfade` docstring and `docs/loop-repair.md` section 4 now say "up to four of them (nine where the window is an odd number of pixels wide)". The measure is unchanged.
## v2.43.0 - No loop delivers a ghost frame unmeasured; a cross-fade inside one silhouette is named, not judged
diff --git a/docs/loop-repair.md b/docs/loop-repair.md
index af01fd9..bb32e4f 100644
--- a/docs/loop-repair.md
+++ b/docs/loop-repair.md
@@ -651,8 +651,9 @@ sprite-gen video-cycle-align --loop-dir set/front-walk/loop --loop-dir set/side-
over 7 px, wider than RIFE's blur, above half the sources' 95th percentile there): a blend shows
each edge at part height, a flow that moved the part shows it whole, only softer. The strong-edge
pixels lost in such windows, over the frame's solid pixels — the windows step by half their size,
- so one lost pixel is counted in up to four of them; 0 where it shows no blend. Relative to the
- source frames' own edges, so the palette's lightness does not decide it.
+ so one lost pixel is counted in up to four of them (nine where the window is an odd number of
+ pixels wide); 0 where it shows no blend. Relative to the source frames' own edges, so the
+ palette's lightness does not decide it.
- Over **0.015** (`interpolation_quality.CROSSFADE_LOOK`) the frame is named to look at: its
`smear` row's `look` is `["crossfade"]`, and a kept frame (`method: rife`) gets a line in
`warnings` ("frame 14 (made by RIFE) may cross-fade two drawings inside its outline …; kept").
diff --git a/sprite_gen/video/rife.py b/sprite_gen/video/rife.py
index ad1e9a7..d22a267 100644
--- a/sprite_gen/video/rife.py
+++ b/sprite_gen/video/rife.py
@@ -267,8 +267,9 @@ def crossfade(made: Image.Image, a: Image.Image, b: Image.Image, t: float) -> fl
of the source frames' strong edges there — a blend shows each edge at part height, a flow that
moved the part shows it whole, only softer. The strong-edge pixels lost in such windows, as a
fraction of the made frame's solid pixels — the windows step by half their size, so one lost pixel
- is counted in up to four of them; 0 where it shows no blend. Relative to the source frames' own
- edges, so a palette's lightness does not decide it (docs/loop-repair.md section 4)."""
+ is counted in up to four of them (nine where the window is an odd number of pixels wide); 0 where
+ it shows no blend. Relative to the source frames' own edges, so a palette's lightness does not
+ decide it (docs/loop-repair.md section 4)."""
m, fa, fb = (np.asarray(f.convert("RGBA"), dtype=np.float32) / 255.0 for f in (made, a, b))
pm, pa, pb = (np.dstack([x[..., :3] * x[..., 3:], x[..., 3:]]) for x in (m, fa, fb))