Skip to content

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

test(video): the real-RIFE made-time ghost case makes with the real RIFE only the frames beside a ghost

Soohong Kim2b8cfc8dbef7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d88377..e42d770 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,7 +17,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- **Output change: source restoration reads the ghost — the ghost guard.** A cell `video-loop` gave a filmed ghost way is a cell the jump repair replaced, and its source frame is the ghost: the source's pixels clear any fault the cell carries, the smear and outline faults measure a frame only against its neighbours, and partial coverage was read only beyond the source reference's own, which is the ghost — so `source-restoration-v4` could propose the cell and accept the ghost back. Now no cell whose source frame the cut's ghost screen names (`interpolation_quality.ghost_screen` on the cropped source frames, at their own size, as the cut read them) is a target; every final cell's faults carry its own ghost reading where the screen reads the loop; and the comparison's new `axes.ghost` reads each cell's own `rife.ghost` on final pixels (`baseline`, `candidate`, `reference`, `threshold` 0.003, `filmed` — the screen), any rise of the excess over the limit `regressed` with `ghost:regressed`. A loop the screen does not read is not judged (`reason: "loop-drawn-part-covered"`). [docs/loop-comparison.md](docs/loop-comparison.md#the-ghost-guard).
- **Contract versions: repair report schema 4, comparison schema 6, metric `source-restoration-v5`, policy `key-protected-source-copy-one-step-cap-jump-ghost-guard-v1`.** A restored cell's pixels are made as in v4. Evidence and receipts of `source-restoration-v4` (2.40.0 – 2.43.0) are refused, never read as v5: a v4 repair report given to `video-loop-compare` is an input error, and a request whose baseline carries a v4 receipt in its loop report is shared `unknown`, `restoration-receipt-policy-unsupported`. The origin itself is still a valid first request. Proposal IDs change with the versions. `video-loop-compare` without the origin and the source (`same-sample-defects-v1`) is unchanged.
- **`tests/video/test_ghost_given_way.py`** draws the walk of `tests/video/test_cycle_align.py` with a band of 0.3 coverage beside the foot: a small one, four times the ghost limit and no jump, delivered as cut before and now given way to RIFE's frame between its neighbours (a stand-in that draws the walk's true frame) or, without RIFE, to the frame after it, the GIF and WebP holding it as one frame; two identical frames in a row passing the check; three ghosts in a row, the middle one kept and named; a wide band that also reads as a jump, named by the screen read before the repair; `--repair off` and `--repair on` without RIFE; an alignment reading the cut given way and carrying its record; with the default seam gate, the walk cut where its wrap is an ordinary step, its ghost at the cut's first frame given way without RIFE or with RIFE's frame a ghost too (refused before, 2.17 times the mean step), at its last given way to its first (read 0.0 before), both beside a frame made, ghosts at its first and last frames at once given way inward (refused before, 2.40), and a cut that does not close whose last frame gives way to its first (delivered before), under `--anchor none` and `--anchor body`; under `--anchor body`, the walk's default, the strip's `seam_ratio_after_anchor` reading a ghost given way at the cut's first frame, its last or both as `--repair off` reads it (read on `cycle/` before: 0.0 at the last); the side walker of `tests/video/test_one_step_cut.py` cut with the application's walk flags (`--anchor motion-auto --size-hold auto --body-height 160`), through a stand-in and through the real RIFE (marked `real_rife`); and the cut's source projection proving every other cell and listing the cell given way, a restoration request reading its playback and proposing nothing there. `tests/video/test_source_restoration.py` adds a source frame that is a filmed ghost the smear and outline faults pass, whose cell v4 proposed first: it is no target, and the ghost restored there regresses.
-- **`tests/video/test_ghost_retake.py`** reproduces on the synthetic legs of `tests/video/test_ghost_screen.py` a ghost kept at a whole time (three in a row), one kept at a time made between two (the stand-in RIFE, and the real one, marked `real_rife`), and a held loop on twos that keeps ghosts too (both reasons, `held-drawings` first); under `--between rife` only the ghost with no clean frame beside it is counted; the fault line names the kept cell as it is.
+- **`tests/video/test_ghost_retake.py`** reproduces on the synthetic legs of `tests/video/test_ghost_screen.py` a ghost kept at a whole time (three in a row), one kept at a time made between two (the stand-in RIFE, and the real one making each frame beside a ghost, marked `real_rife`), and a held loop on twos that keeps ghosts too (both reasons, `held-drawings` first); under `--between rife` only the ghost with no clean frame beside it is counted; the fault line names the kept cell as it is.
## v2.43.0 - No loop delivers a ghost frame unmeasured; a cross-fade inside one silhouette is named, not judged
diff --git a/tests/video/test_ghost_retake.py b/tests/video/test_ghost_retake.py
index b574b4a..9c020b9 100644
--- a/tests/video/test_ghost_retake.py
+++ b/tests/video/test_ghost_retake.py
@@ -128,8 +128,17 @@ def test_a_ghost_kept_at_a_made_time_is_a_take_to_film_again_and_its_fault_line_
@pytest.mark.real_rife
def test_real_rife_a_ghost_kept_at_a_made_time_is_a_take_to_film_again(tmp_path):
- """A2 through the real RIFE: its frame between the two ghosts carries them, and the cell keeps the ghost."""
- _check_made_time(_made_time(tmp_path, rife.Rife()))
+ """A2 through the real RIFE: its frame between the two ghosts carries them, and the cell keeps the ghost.
+ The real RIFE makes each frame beside a filmed ghost, the frames this case reads; the stand-in makes the
+ rest, some forty between two clean frames that no assertion here reads, each of which would cost two runs
+ of rife-ncnn-vulkan, slow where RIFE runs on the CPU."""
+ real = rife.Rife()
+
+ def beside_a_ghost(a: Image.Image, b: Image.Image, t: float) -> Image.Image:
+ return real(a, b, t) if max(rife.ghost(a), rife.ghost(b)) > GHOST_WARN else tg._follow(a, b, t)
+
+ _check_made_time(_made_time(tmp_path, beside_a_ghost))
+ assert real.made == 3 # E's frames made between source frames 4 and 5, 5 and 6, 6 and 7
def test_a_held_loop_that_keeps_a_ghost_carries_both_reasons_held_drawings_first(tmp_path):