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(loop-repair): the seam gate reads a cell given way as filmed; without RIFE a jump left says so (rife, unmade)

Soohong Kim6362b619f722
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 40e775c..0f5c90b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,11 +10,11 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- **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.
- **Output change: a filmed ghost with no clean frame beside it is a take to film again — `retake` reason `filmed-ghost`.** Since 2.43.0 `video-cycle-align` delivers a filmed ghost only where the source frames on both sides of its time are ghosts too, and said so in a warning line alone: the loop's `retake` stayed `null`, so a pipeline that films a direction again on `retake` delivered the ghost. Such a loop is now named: its row's `retake` (and the report's, and `video-set`'s) reads `reason: "filmed-ghost"` with `ghost` — the cells `kept`, their frames of `cycle.source/` (`sources`), the highest reading (`ghost_max`) and the screen's `limit` — and `limits.ghost_kept_min` (one cell, `align.RETAKE_GHOST_KEPT_MIN`), with a line "film this direction again (filmed-ghost) — …". `retake` stays one object: `reason` is the first that applies (`held-drawings`, then `filmed-ghost`), the new `reasons` lists every one (`["held-drawings"]` for a held loop as before), and the held numbers stand only where that reason applies. Each `ghost_at` cell that keeps its ghost says why (`kept`: `no-clean-frame`, under any `--between`, or `between-rife` where `--between rife` kept it beside a clean frame — the aligner's choice, not counted). The set is aligned as before (`applied: true`, exit 0). Docs: `docs/loop-repair.md` section 4 (filmed ghost), `docs/video-pipeline.md`.
- **Fix: a made frame given way at a cell that keeps its ghost no longer says the nearer source frame settled it.** Its line said "so the nearer source frame was taken there" where that frame was itself a filmed ghost, delivered for want of a clean one; it now says "the nearer source frame, a filmed ghost, was kept there, the frames beside it being filmed ghosts too". A ghost `--between rife` kept with no clean frame beside it is named "film this direction again", no longer told to align with `auto` for a clean frame that is not there.
-- **Output change: a walk delivered as cut gives its filmed ghost way — `video-loop`'s jump repair stage.** A walk filmed in one direction never meets `video-cycle-align`, which takes a clean frame beside a filmed ghost, so its strip, GIF and WebP delivered the ghost as cut: 2.43.0 named it in a `warning:` line and changed no pixel, and only a band wide enough to read as a jump was replaced, by the jump repair, by chance. The ghost screen now reads the cut as filmed, before the jump repair (`ghost_screen` names a ghost the repair replaced, where it was read after it before), and each ghost it names is a round of that repair, first and outside its three-call budget (`why: "ghost"`; the jump rounds now say `why: "jump"`): RIFE's frame between the two frames beside it where both are clean and the frame has no fault (`taken: "rife"`), else the clean frame beside it — the one after, else the one before, the alignment's own choice at a time on a ghost (`interpolation_quality.clean_beside`, `taken: {"source": k}`) — else, both being filmed ghosts too, the ghost kept (`taken: null`). A ghost round also records `neighbours`, `outcome` (`accepted`, `given-way`, `kept`) and `no_proposal` where no frame was made. A cell given way is in `jump_repair.replaced`, so the seam gate reads rendered cells, the jumps are read after it and never made beside it, and the source projection reads it as a repair hint. The report and its summary carry `ghost_given_way` (`frame`, `ghost`, `taken`) and `ghost_kept` (`frame`, `ghost`), and the strip metadata each where it is not empty — `cycle/` is the alignment's `cycle.source/`, whose screen no longer sees a ghost given way, so an alignment carries the record over. A `warning:` line names each ("… a filmed ghost; given way to RIFE's frame between frames 9 and 11", "given way to frame 11 beside it, shown twice in a row", "kept … — film this direction again"). Without RIFE, `--repair auto` still gives each ghost way to the clean frame beside it and says a jump frame was not repaired only where a jump was left (`unmade`: the step, target and score the jump search stopped at; `repair.repair_jumps` with no interpolator no longer raises on a jump); `--repair on` refuses a ghost between two clean frames as it refuses a jump. `--repair off` and the states other than walk and run are unchanged. A loop with no filmed ghost is cut as before: the same cells and strip metadata, its report adding the two records empty. [docs/loop-repair.md](docs/loop-repair.md) section 2.
+- **Output change: a walk delivered as cut gives its filmed ghost way — `video-loop`'s jump repair stage.** A walk filmed in one direction never meets `video-cycle-align`, which takes a clean frame beside a filmed ghost, so its strip, GIF and WebP delivered the ghost as cut: 2.43.0 named it in a `warning:` line and changed no pixel, and only a band wide enough to read as a jump was replaced, by the jump repair, by chance. The ghost screen now reads the cut as filmed, before the jump repair (`ghost_screen` names a ghost the repair replaced, where it was read after it before), and each ghost it names is a round of that repair, first and outside its three-call budget (`why: "ghost"`; the jump rounds now say `why: "jump"`): RIFE's frame between the two frames beside it where both are clean and the frame has no fault (`taken: "rife"`), else the clean frame beside it — the one after, else the one before, the alignment's own choice at a time on a ghost (`interpolation_quality.clean_beside`, `taken: {"source": k}`) — else, both being filmed ghosts too, the ghost kept (`taken: null`). A ghost round also records `neighbours`, `outcome` (`accepted`, `given-way`, `kept`) and `no_proposal` where no frame was made. A cell given way is in `jump_repair.replaced`, so the jumps are read after it and never made beside it, and the source projection reads it as a repair hint. The seam gate reads a cell given way to the frame beside it as filmed (`seam_as_filmed`, frames of the cut): that frame shown twice in a row is a step of nothing and a step of two, and at the wrap — a ghost at the cut's first frame given way to its second, or at its last given way to its first — the step of two would refuse a walk that closes ("the cycle does not close") and the step of nothing would pass a cut that does not. A loop that only gave its ghosts way to the frames beside them is gated on its source frames (`seam_measurement: source-frames`, as filmed); one with a frame made — RIFE's, for a jump or a ghost — on its rendered cells, the cell given way read on the strip the cut makes with that frame as filmed. `--anchor body`'s `seam_ratio_after_anchor` reads the wrap the same way. The report and its summary carry `ghost_given_way` (`frame`, `ghost`, `taken`) and `ghost_kept` (`frame`, `ghost`), and the strip metadata each where it is not empty — `cycle/` is the alignment's `cycle.source/`, whose screen no longer sees a ghost given way, so an alignment carries the record over. A `warning:` line names each ("… a filmed ghost; given way to RIFE's frame between frames 9 and 11", "given way to frame 11 beside it, shown twice in a row", "kept … — film this direction again"). Without RIFE, `--repair auto` still gives each ghost way to the clean frame beside it and says a jump frame was not repaired only where a jump was left (`unmade`: the step, target and score the jump search stopped at; `repair.repair_jumps` with no interpolator no longer raises on a jump); `--repair on` refuses a ghost between two clean frames as it refuses a jump. `--repair off` and the states other than walk and run are unchanged. A loop with no filmed ghost is cut as before: the same cells and strip metadata, its report adding the two records empty. [docs/loop-repair.md](docs/loop-repair.md) section 2.
- **Fix: a GIF or WebP that holds a frame shown twice in a row passes its check.** Both formats hold two identical frames in a row as one frame of twice the delay, and `video-loop` checked its GIF and WebP for one frame per cell: a cut with two identical frames in a row — what giving a ghost way to the frame beside it leaves — failed (`walk.gif failed verification: 19 frames, expected 20`). `video-loop` and `video-follow` now check for one frame per run of identical cells, as `video-cycle-align` already did (`loop.shown_runs`), and the restoration's playback check (`playback.verify`) reads such a run as one frame held for the sum of its delays (in hundredths of a second in the GIF, as it stores it); its `strip_indices` still lists every scheduled cell.
- **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; 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_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, and a cut that does not close whose last frame gives way to its first (delivered before); 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.
## v2.43.0 - No loop delivers a ghost frame unmeasured; a cross-fade inside one silhouette is named, not judged
diff --git a/SKILL.md b/SKILL.md
index 42c4a51..5b3d93f 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -138,7 +138,7 @@ Scene creation consumes finished assets and remains optional. Asset metadata own
## RIFE for walk and run loops
-`video-loop` repairs a walk's or run's jump frames and gives its filmed ghosts way (a half-drawn frame the video model left, `ghost_given_way`), and `video-set` gives a direction set one cycle length, both with RIFE in-betweens. Install it once per machine: `$SPRITE_GEN_ROOT/.venv/bin/sprite-gen rife install` (pinned rife-ncnn-vulkan 20221029 and model rife-v4.6, SHA-256 checked, into the user data directory, ending with a check frame; Linux without a GPU first needs `libvulkan1 mesa-vulkan-drivers`). Without it every loop is still cut, a jump as filmed (each filmed ghost given way to the clean frame beside it), and says so: a `warning:` line on stderr, `jump_repair.applied: false` in the loop report, `cycle_align.<state>.applied: false` and `warnings` in `set.report.json`. When that happens, tell the user which loops went unrepaired and offer the install; after it, cut those loops again and run `video-cycle-align`. `video-loop --repair on` and `video-cycle-align` fail without RIFE instead. [loop-repair](docs/loop-repair.md).
+`video-loop` repairs a walk's or run's jump frames and gives its filmed ghosts way (a half-drawn frame the video model left, `ghost_given_way`), and `video-set` gives a direction set one cycle length, both with RIFE in-betweens. Install it once per machine: `$SPRITE_GEN_ROOT/.venv/bin/sprite-gen rife install` (pinned rife-ncnn-vulkan 20221029 and model rife-v4.6, SHA-256 checked, into the user data directory, ending with a check frame; Linux without a GPU first needs `libvulkan1 mesa-vulkan-drivers`). Without it every loop is still cut — a jump as filmed, each filmed ghost given way to the clean frame beside it — and what was left unrepaired says so: a `warning:` line on stderr and `jump_repair.rife` with `jump_repair.unmade` (the jump left as filmed) in the loop report (`applied` alone is not the sign: a ghost given way reads true), `cycle_align.<state>.applied: false` and `warnings` in `set.report.json`. When that happens, tell the user which loops went unrepaired and offer the install; after it, cut those loops again and run `video-cycle-align`. `video-loop --repair on` and `video-cycle-align` fail without RIFE instead. [loop-repair](docs/loop-repair.md).
## Contracts and advanced tools
diff --git a/docs/loop-repair.md b/docs/loop-repair.md
index 208c4b6..3d4bed1 100644
--- a/docs/loop-repair.md
+++ b/docs/loop-repair.md
@@ -66,7 +66,7 @@ cut before RIFE existed still cuts — and nothing is left unsaid:
| Where | Default without RIFE | Asked for by name |
|---|---|---|
-| `video-loop` jump repair (section 2) | `--repair auto`: the loop is cut as filmed; `jump_repair` reads `applied: false`, `why`, `rife` (what was not found), `install`, and the worst jump's score; one `video-loop: warning:` line on stderr | `--repair on`: fails with the install line |
+| `video-loop` jump repair (section 2) | `--repair auto`: a jump is cut as filmed, and each filmed ghost is given way to the clean frame beside it (its own `warning:` line). Where a jump is left, `jump_repair` reads `why`, `rife` (what was not found), `install` and `unmade` (the step, target and score the jump search stopped at), and one `video-loop: warning:` line on stderr says the jump frame was not repaired. `applied` is false only where nothing was replaced | `--repair on`: fails with the install line |
| `video-set` cycle alignment (section 4) | `--align-cycles auto`: the state is skipped and every loop keeps its own length; `cycle_align.<state>` reads `applied: false` with `why`, `rife`, `install`; the set report lists it under `warnings`; one `video-set: warning:` line | `video-cycle-align`: fails with the install line |
A RIFE that is found and then fails (a binary that cannot reach Vulkan, say) is an error in every
@@ -192,8 +192,8 @@ Ghost rounds are outside the three-call budget, which is the jumps'. A cell give
it too, and the jumps are then read on the loop as the ghosts left it. A cell given way to the
frame beside it is that frame shown twice in a row — a step of nothing and a step of two — and the
jolt index (section 3) measures it as it plays; the GIF and WebP hold it as one frame of twice the
-delay, and are checked for one frame per run of identical cells. A loop the screen does not read
-(drawn part-covered, `reads: false`) has no ghost round.
+delay, and are checked for one frame per run of identical cells. The seam gate reads it as filmed
+(below). A loop the screen does not read (drawn part-covered, `reads: false`) has no ghost round.
The report's `jump_repair` carries `replaced` (cycle frame indices, ghost and jump rounds alike), `attempts` (the jumps' calls),
`blocked` targets, and each round's `why` (`ghost` or `jump`), target, `original` and `proposal`
@@ -227,8 +227,17 @@ The original middle frame is retained, not a duplicate of either neighbour.
The jump rounds' record is above; `jump_repair` also records `score_max_before` (the cut as
filmed) / `score_max_after`, why it stopped, and which interpolator made the proposals. Rejection is not overall quality failure
or success: original drawing changes and normal gait motion can remain.
-When a frame was replaced the seam gate measures the rendered cells
-(`seam_measurement: rendered-cells`), because the source frames no longer say what plays.
+When a frame was made — RIFE's, for a jump or for a filmed ghost — the seam gate measures the
+rendered cells (`seam_measurement: rendered-cells`), because the source frames no longer say what
+plays. A cell given way to the frame beside it is read as filmed (`seam_as_filmed`, frames of the
+cut). The gate asks whether the cut closes, and that frame shown twice in a row is a step of nothing
+and a step of two wherever the ghost was: at the wrap — a ghost at the cut's first frame given way
+to its second, or at its last given way to its first — the step of two read as a cut that does not
+close (a walk whose wrap is an ordinary step read twice its mean step and was refused), and the
+step of nothing as one that closes whatever the cut. On the source frames the cell is the frame as
+filmed; on the rendered cells, the cell of the strip the cut makes with that frame as filmed. A loop
+that only gave its ghosts way to the frames beside them is gated on its source frames, as filmed.
+`--anchor body` reads its `seam_ratio_after_anchor` the same way.
To compare an active result with a final candidate after all processing, use
[`video-loop-compare`](loop-comparison.md); a seam pass alone is not an improvement.
diff --git a/docs/loop-review.md b/docs/loop-review.md
index 434e85d..16fb61a 100644
--- a/docs/loop-review.md
+++ b/docs/loop-review.md
@@ -230,7 +230,9 @@ Cycle PNGs preserve the supplied keyed pixels (no additional speck removal), wit
common transparent padding to avoid clipping. Strip scaling, GIF palette conversion
and output frame-density settings still apply. The sidecar/report records regions,
measurements, endpoint, every shift and padding. For this mode the unchanged seam
-limit gates the **rendered, resampled cells**, recorded as `seam_measurement=rendered-cells`.
+limit gates the **rendered, resampled cells**, recorded as `seam_measurement=rendered-cells`;
+a cell the jump repair gave a filmed ghost way to the frame beside it is read there as filmed
+(`seam_as_filmed`, [loop repair](loop-repair.md) section 2).
This tests the corrected output, not the drifting input. It cannot repair missing
poses, changing colors, limb identity or an incorrectly chosen cycle.
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index c0d4b80..433e2ac 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -913,7 +913,7 @@ frames beside it, else by the clean frame beside it, else kept and named (`ghost
take a clean frame there. The report's `jump_repair` names the frames. RIFE
is installed once with `sprite-gen rife install`; without it a loop that needs a frame is cut as
filmed with a warning, each filmed ghost given way to the clean frame beside it (`--repair on`
-fails instead). A frame shown twice in a row is one frame of the GIF and WebP, checked so. See [loop repair](loop-repair.md). The repaired loop's jolt index and the head's frame-to-frame
+fails instead). A frame shown twice in a row is one frame of the GIF and WebP, checked so, and the seam gate reads a frame given way as filmed (`seam_as_filmed`). See [loop repair](loop-repair.md). The repaired loop's jolt index and the head's frame-to-frame
moves are reported (`jolt`); beyond the reference bounds that is a warning line, and a gate
(`video-loop: loop jolts — …`) only when `--jolt-max` / `--head-step-max` are passed.