Skip to content

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

Merge plan/held-frames-fill-1029 (v3.10.1, cac8c5f) into plan/qipao-recut-cell-record-1029: a frame between refused as held is the nearer frame in source_frames and the strip's record of its cells

Soohong Kim3ea34d5be0b5
diff --cc CHANGELOG.md
index 1477d3c,933caf9..960a11d
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -2,66 -2,15 +2,75 @@@
All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.
+## Unreleased
+
- **Upgrading from 3.10.0: `video-loop` writes `cell_record` into every strip record `<name>.strip.json`, and `video-sway` gains options that shape a `--region-mask` region alongside `--read-on-cut`. Strips, frames and records keep their bytes by default, but `video-sway --read-on-cut` reads cuts by that record alone and refuses cuts made without it.** New options `--region-over` and `--region-shear` shape the region mask and its rim; both are off by default, and when not given, strips, frames, and records remain byte for byte what they were. With `--region-crease` the wear wears the crease in as before; laid over the figure the region reaches down to the crease again in every cell, changing those runs' output. Runs with `--region-over` and runs with `--region-membrane` draw differently than before this change; the four new membrane options are off by default and byte for byte as before when not given. New options `--region-over-solid`, `--region-rim-round`, `--region-membrane` and `--read-on-cut` are off by default; when not given, strips, frames, and records remain byte for byte what they were. Runs with `--read-on` alone behave as before, except that its no-match message now names `--read-on-cut`. The refusal for `--region-over` or `--region-shear` given without `--region-mask` keeps refusing the same runs, and its message now names the new options too: "--region-over, --region-over-solid, --region-rim-round, --region-shear and --region-membrane shape a region mask; they need --region-mask" (it was "--region-over and --region-shear shape a region mask; they need --region-mask").
++**Upgrading from 3.10.1: `video-loop` writes `cell_record` into every strip record `<name>.strip.json`, and `video-sway` gains options that shape a `--region-mask` region alongside `--read-on-cut`. Strips, frames and records keep their bytes by default, but `video-sway --read-on-cut` reads cuts by that record alone and refuses cuts made without it.** New options `--region-over` and `--region-shear` shape the region mask and its rim; both are off by default, and when not given, strips, frames, and records remain byte for byte what they were. With `--region-crease` the wear wears the crease in as before; laid over the figure the region reaches down to the crease again in every cell, changing those runs' output. Runs with `--region-over` and runs with `--region-membrane` draw differently than before this change; the four new membrane options are off by default and byte for byte as before when not given. New options `--region-over-solid`, `--region-rim-round`, `--region-membrane` and `--read-on-cut` are off by default; when not given, strips, frames, and records remain byte for byte what they were. Runs with `--read-on` alone behave as before, except that its no-match message now names `--read-on-cut`. The refusal for `--region-over` or `--region-shear` given without `--region-mask` keeps refusing the same runs, and its message now names the new options too: "--region-over, --region-over-solid, --region-rim-round, --region-shear and --region-membrane shape a region mask; they need --region-mask" (it was "--region-over and --region-shear shape a region mask; they need --region-mask").
+
+- **New: laying a region over the figure and widening the rim for shear (`--region-over`, `--region-shear`).** `--region-over` lays the region over the figure under it instead of pinning its lower edge, freeing held pixels under the edge (solid or not), moving the band within reach, drawing the layer over the band by alpha, drawing the air by the move, and showing the figure under its lower edge at the move where it lifts. Its soft edge moves with the region (except under the lower edge where touching a solid pixel outside keeps it in the band), its solid outline against air goes with the layer, and `--hold-mask` leaves pixels the region mask does not cover out of the layer and band while pixels it covers move with the region. `--region-shear S` widens the rim across and down so a move one way rises across the rim the other way by at most S px per px (`shear_floor`), preventing tears along the sides. With either option, the ledger records move steps between neighbouring pixels, still strips left standing, and tip outline shapes, and `--region-over` records `lifted_px`. Both require `--region-mask`, are off by default, and leave strips, frames, and records byte for byte what they were when not given. See [video-pipeline](docs/video-pipeline.md) section 6.
+- **Changed: wearing the crease row in like every other edge of the mask and reaching down to the crease only when laying a region over the figure (`--region-crease`, `--region-over`).** Removed: the step that filled each crease column back down to the crease row after the mask was worn in (`crease_kept` is gone). Now `--region-crease` ends the mask on the crease before the wear and the wear (`--region-shrink`) wears the whole mask in, the crease row too, like every other edge. So the record's `mask.box` ends `--region-shrink` rows above the crease row (2 rows at the default), as it did before `crease_kept`. New, under `--region-over` only: in every cell the region reaches down to the crease again (`crease_reach`): the crease's rows (its columns and rows on the cell the mask was drawn on; a column between two crease columns takes the nearer one's row, the left one's on a tie) are carried into the cell by the mask's carry there (the column rounded to the nearest, half to even; the row rounded down), and in each crease column where the region holds a pixel, the cell's solid pixels from the region's lowest pixel down to the crease's row join the region. The crease is the picture's own edge, so the layer reaches it in every cell while the wear still wears the mask in everywhere else. Without `--region-over` nothing reaches back down: the worn mask is the region.
+- **New: solid under-edges, round rims, figure membranes, and recut strip pairing (`--region-over-solid`, `--region-rim-round`, `--region-membrane`, `--read-on-cut`).** `--region-over-solid` frees only solid pixels (alpha 128 or more) under the lower edge into the band while keeping softer pixels as anchors, and carries the region's soft edge with it under the lower edge. `--region-rim-round` holds the rim round beside the region across the wider of its two widths (`max(Lx, Ly)`), preventing steep downward steps below corners where the lower edge runs lower. `--region-membrane N` moves the figure under the lower edge within N + 1 px as a membrane by solving 4-neighbour figure means in passes instead of conjugate gradients (from a cos² start, at most 1200 passes, leaving no piece out) so the figure stretches rather than slides, drawing membrane pixels by their move and reporting membrane-specific fold refusals. `--read-on-cut STRIP` pairs regions read on another cut of the same clip by matching source frame numbers and applying a whole-pixel shift across crops on unaligned and aligned loops alike. The shift is taken on the frame as filmed, less where each cut's body or motion anchor moved that frame. Each cut is now read by its record of its cells alone: `cell_record` in the strip's record (`<name>.strip.json`), which `video-loop` now writes, bound to the strip by `cell_record.strip_sha256` (the sha256 of the strip PNG), with one entry per cell: `source_frame`, `anchor_move_px` (where the anchor moved that frame before the crop, whole px across and down), `scale` (`size_hold` and `gait_fallback`: the factor each step that holds a clip's frames to one size scaled that frame by, 1 where it did not hold them) and `as_filmed` (true where the cell's pixels at the end of the cut are its pixels anchored before any repair, the receipt `source_projection.before_repair_pixels_sha256` in the cut's report, and no step held the clip's frames to one size). On a loop aligned from its cut it reads the cut's own record, which `video-cycle-align` now keeps beside the cut's frames as filmed (`cycle.source/<name>.strip.json`) and which must be bound to the strip the alignment's origin names (`cycle_align.origin.strip_sha256`). It refuses, no-match, saying which and naming the field: a cut with no `cell_record` (any cut made before this release), a record bound to another strip, a record that does not give its cells as `video-loop` writes them (a field missing or not of its kind, in any cell), a loop aligned from its cut with no kept record, a paired cell a hold scaled or not cut as filmed, and two paired cells that are not the same pixels where they overlap at the shift (a record changed to call a cell as filmed is held to the cell's pixels). The report beside a cut is no longer looked for or read. All four options are off by default and leave strips, frames, and records byte for byte what they were when not given. See [video-pipeline](docs/video-pipeline.md) section 6.
+- **New: the membrane's own keys (`--region-membrane-unpin`, `--region-clear-alpha`, `--region-floor-beside`, `--region-own-outline`).** `--region-membrane-unpin` makes what the membrane moves no anchor of the rim either, so the region's move does not fall to none at its first rows under its lower edge. `--region-clear-alpha A` (a whole number from 1 to 127) reads a pixel under alpha A as clear by the sets the region moves and holds and by the membrane's figure while the cell's bytes stay its own, so a speck of dust beside the figure holds nothing. `--region-floor-beside N` sets the lower edge beside the region's columns to the lowest pixel of its columns within N px of that side, not that of its nearest column alone. `--region-own-outline G` grows the region G 4-neighbour steps over the cell's solid pixels within G 4-neighbour steps of a clear pixel before the sets (never under its lower edge's line and never over pixels `--hold-mask` leaves out), moving the outline its carried mask leaves out with the region. All four require `--region-mask`, shape nothing without `--region-membrane` (leaving the same bytes and record, naming none of them), are off by default, and leave strips, frames, and records byte for byte what they were when not given. See [video-pipeline](docs/video-pipeline.md) section 6.
+- **Output change: `cell_record` in strip records, `source_projection` for motion anchors, and kept cut strip records.** `video-loop` now writes `cell_record` into every strip record it writes (the fields above). The strip PNG, the GIF, the WebP and the frames of `cycle/` keep their bytes; the strip record gains this one key. A cut's report gains `source_projection` (`recipe`, `wrap_dx_px`, `before_repair_pixels_sha256`) at `--anchor motion` and `--anchor motion-auto` too, with `recipe` `motion-anchor-correction-v1` there; it was written only at `--anchor none` and `body` before (unchanged there). `cell_record` is written in the strip record only, not in the report's copy of it. `video-cycle-align`'s first alignment of a loop now also writes `cycle.source/<name>.strip.json`, the loop's strip record as cut, byte for byte, before it rewrites `<name>.strip.json`; later alignments leave it as it is, and a new cut with `video-loop` removes it with `cycle.source/`. The aligned strip's record does not carry `cell_record` (it is the record of another strip). The pair policy `RECUT_POLICY` is now `same-clip/source-frame/whole-px-shift/2`. At `--out-fps` (3.8.0: cells each made at a time of their own, more cells than the cut has frames), and at `--out-fps` with the air retimed, the report's `held_fill.out_fps` gains `source_frames` (per cell, the frame of the cut it is, or null where it was made), and `cell_record` now reads a retimed cut the same way as a cut at `--out-fps`: `source_frame` is the frame the cell is, and for a cell made between two frames the cut's frame at or before its time (the frame the seam reads it as), with that frame's `anchor_move_px` and `scale`. `as_filmed` is true only where the cell's pixels are that frame's pixels anchored before any repair, so a cell that repeats a frame unchanged is as filmed, and a cell made between two frames, a cell moved onto the parabola or along, and every cell of a cut the retime laid on a larger canvas are not as filmed, and `video-sway --read-on-cut` does not pair them. The cells before the take-off that the retime neither moved nor laid on a larger canvas stay as filmed.
+- Python callers: `sway_loop`, `sway_frames`, `read_request` and `read_ask` accept `region_over` (bool; default False) and `region_shear` (float; None: off). New in `sprite_gen.video.sway`: `shear_floor`, `layer_sets`, `lay_over`, `cover_depth`, `still_strip`, `tip_shape` and `move_steps`; constants `OVER_POLICY`, `TIP_COLS`, `TIP_AIR`, `TIP_RING`, `TIP_OFF` and `TIP_SEARCH`; `RegionMask` gains `over`, `shear`, `hold` and `edges()`; `Masked` gains `sheared`, `left_out` and `left_out_in(k)`; `rim_bands` gains `floor` (None: as before).
+- Python callers: `sway_loop`, `sway_frames`, `read_request` and `read_ask` accept `region_over_solid` (bool; default False), `region_rim_round` (bool; default False) and `region_membrane` (int; None: off); `sway_loop` and `read_request` accept `read_on_cut` (Path; None: off, refused by `sway_frames`). New in `sprite_gen.video.sway`: `membrane_sets`, `membrane_move(free, figure, own, outline, move, reach)`, `recut_pair`, `recut_ask` and `read_cut`; new in `sprite_gen.video.loop`: `ramp_offset`; new in `sprite_gen.video.motion_anchor`: `laid_at`; constants `OVER_SOLID_POLICY`, `MEMBRANE_POLICY`, `RECUT_POLICY`, `RECUT_DRIFT` and `RIM_ROUND_POLICY`; `RegionMask` gains `over_solid`, `membrane` and `rim_round`; `Request` gains `read_on_cut`; `layer_sets(..., solid_only=False)` gains `solid_only` and returns the new set `below`; `read_on_relation(..., cut=False)` gains `cut`; and `transported_motion(..., paired=None)` gains `paired`. New in `sprite_gen.video.sway`: `cell_record(record, strip_sha256)` (the record of a strip's cells, a ValueError naming what it does not give), `recut_same(pair, cut_cell, cell, read_on)` (refuses two paired cells that are not the same pixels at the shift) and `aligned_from(loop_dir, meta_path, meta)` (the cut's record an alignment kept, or None); `recut_pair(meta, cut, read_on, *, strip_sha256, kept=None)` takes this loop's strip sha256 and the kept record; `read_cut` returns the strip picture under `strip`; `Request` gains `aligned_from`; new in `sprite_gen.video.loop`: constants `CELL_RECORD`, `CELL_SCALE_STEPS` and `MOTION_RECIPE`.
+- **Tests**: new file `tests/video/test_sway_region_over.py` covers these cases on synthetic figures (the region test's body and its striped part over the torso's right side and past it over the air, with a dark crease under it on the torso; an arm block beside the part's lower left; a dark outline row under the part where it hangs over the air). Each case first reads what a sway writes with the new options (its cells, its record), so on a release without them the same input fails on what comes out:
+ - without the new options nothing of them is read or written (cells and record as before, from Python with them passed off);
+ - with `--region-crease` the wear wears the crease in with the rest (the worn mask's lowest row on the torso 2 rows over the crease, its box ending there), nothing under the crease moves, and laid over the figure the region reaches down to the crease again in every cell (its lowest pixel on the crease's row in each crease column);
+ - laid over the figure under it, the lower edge moves as much as the part above it does (at gain 2.5 and 1.25), while without `--region-over` the crease pins it;
+ - the layer draws the band where it lands, no read of the move taken there, and keeps its bytes elsewhere; the move draws the air (reads are taken there); a read in the air that takes the held figure beside it (the torso's soft side past the band) is walked back, in the air alone and never on the band (4, 9 and 6 reads in three cells, none in the others); nothing outside the region, its soft edge, the air and the band changes; the layer covers no deeper than the band; nothing folds;
+ - where the part lifts it shows the figure under it: each pixel there is read at its whole move, none read short, its alpha the source's read there; read wholly on opaque pixels it stays opaque and shows the torso and the crease, not the stripes; beside the torso's soft side one column of the part's, within 2 px of that side, is as soft as its read of that side and the air past it (in 7 of the 12 lifting cells); in the rows the part leaves, its column over the torso's soft side shows thinner than that side in exactly the cells where the part moves toward the torso;
+ - its outline against the air goes with it and leaves the air behind, and its outline against the figure (the crease) keeps its bytes;
+ - two new cases for `--hold-mask` with `--region-over`: the pixels it names that the region mask covers (a piece in the arm's colour inside the part) are the region's, no anchors, and move with the part (one PNG carried and a folder per cell); the pixels it names that the region mask does not cover keep their bytes in every cell, and on a band (`--band auto` with the same `--hold-mask`) every pixel it names keeps its bytes while the part moves round them;
+ - where the part lifts off a piece in the arm's colour right under its lower edge, left out with `--hold-mask`, the part's reads that would take the piece are read from their other pixels (10 in every lifting cell), none of them lifted and all opaque: no hole opens and the piece keeps its bytes;
+ - `--region-shear` 0.5 and 0.25 widen the rim to the least it asks, so the drawn move's step across the rim stays within the bound, and less than without it;
+ - the still strip is read from the region to its side (beside the arm, the px the mask left short; over the air, 0);
+ - the tip is read on the side over the air; a tip moved whole is 0 px off its own shape, its shift found;
+ - `move_steps` reads the most step both ways where both pixels are shown;
+ - `--frames` gives the strip's cells and the same record;
+ - each refusal leaves the loop as it was.
+ `tests/video/test_sway_region.py`'s crease case now reads the worn mask's box ending 2 rows over the crease row. `tests/video/test_follow_inspect.py` now names `--region-over` and `--region-shear` among the arguments `video-sway` takes and `video-sway-inspect` does not.
+- **Tests**: updates to `tests/video/test_sway_region_over.py` and new file `tests/video/test_sway_read_on_recut.py` cover these cases on synthetic figures (the region tests' body with a striped part over the torso's right side and past it over the air; the read-on runner):
+ - over-solid: only solid pixels under the lower edge are free and drawn over; the not-opaque rest stays, an anchor, with bytes kept; the soft edge under the lower edge beside the torso goes with the part, while sliding over without the flag it belongs to the figure;
+ - the membrane at reach 3 and 6: under the lower edge within reach + 1 px, never the outline over the band; each pixel's move is the mean of its figure 4-neighbours' to within less than `MEMBRANE_STEP` (what one more pass would move it), and the record names `step_px` and `passes_most`; the seam step down from the part's last row is at most half of the one sliding over; drawn by the move, never laid over;
+ - the membrane never moves a piece left out (stops at its sides); without the membrane the layer is as it was;
+ - a membrane too short for the move is refused by its name, writing nothing;
+ - below the corner of a part whose lower edge falls from its left side, with `--region-rim-round` the move rises down by at most pi/2 of its size over the rim's wider width, and more than that without the flag;
+ - the refusals list gains each new option's refusal;
+ - without the membrane the four new options shape nothing (the same bytes and record);
+ - the four new options' refusals (each without `--region-mask`, and the values `--region-clear-alpha` 0 and 128, `--region-floor-beside` -1, `--region-own-outline` -2) leave the loop as it was;
+ - two defect shapes, each red on the engine before this change: a part laid over the figure with a few pixels not opaque (alpha 60 and 30) a few rows under its lower edge over the air and a near-clear speck (alpha 3), with `--region-over-solid`, `--region-membrane 6` and `--region-shear 0.35`: with `--region-membrane-unpin` and `--region-clear-alpha 8` the lower edge over the air moves with the part (lag 0.25 px or under), without them it stays short of the move (0.5 px or more), and under the clear alpha the speck is neither held nor the membrane's; and a part whose outline over the air takes one or two pixels past its mask in a row that changes from cell to cell, with `--band-up 0.4` and `--region-membrane 6`: with `--region-own-outline 2` those pixels are the region's and the side moves by each row's share of the move (lag 0.25 px or under), without it they are anchors and the side bends at a row that changes from cell to cell (0.5 px or more);
+ - `--region-floor-beside`: beside a region whose lower edge falls 1 px a column, the lower edge past each side is that of its lowest column within N of that side (directly on `layer_sets`);
+ - the frames path gives the strip's cells with `--region-membrane 6`;
+ - in new file `tests/video/test_sway_read_on_recut.py`, a cut again at the same frame with a wider crop moves the regions and the mask by the crop's shift and gives the sway on the regions drawn there by hand;
+ - a cut again at another start moves the mask onto the cell that is that frame, pixel for pixel, with every pixel outside it kept;
+ - a cell elsewhere in either cut that its record calls scaled or not as filmed leaves the pair as it is;
+ - a loop aligned from the cut again carries the pair through the alignment; the alignment keeps the cut's strip record byte for byte beside its frames (`cycle.source/<name>.strip.json`), bound to the strip its origin names, and a second alignment keeps it as it was; the aligned strip's record holds no `cell_record`;
+ - on a loop aligned from its cut, these are refused, each saying which: a kept record that is gone, a kept record that holds no `cell_record`, a kept record bound to another strip, a paired cell its kept record calls not as filmed, and the read cut's cell drawn between the frames either side with its record changed to call it as filmed;
+ - two cuts at `--anchor body` whose ramps move frame 4 by nothing in the first and by -6 px in the second pair that frame where each ramp moved it: shift (0, 0), no drift, the moved mask is the patch where the second cut drew that frame, pixel for pixel; the crops alone set it 6 px apart;
+ - two cuts at `--anchor body` whose ramps move no frame (both `wrap_dx_px` 0) pair by their crops alone, as before, the mask landing on the patch there;
+ - two cuts at `--anchor motion` (head and torso regions on each cut's first frame) pair the frame where each correction laid it: the shift is the crops' less where the first correction laid that frame plus where the second laid it, not the crops' alone, and the mask lands on the patch there; each cell's `anchor_move_px` is the correction's place and every cell is as filmed; the report's `source_projection` names the motion recipe;
+ - `video-loop` records each cell of its strip in the strip's record bound to its PNG: the source frame, the body ramp's move, no hold's scale, as filmed; the record is written beside the strip and not into the report, whose receipt holds one digest per frame;
+ - a cell the jump repair gave way (a filmed ghost, no RIFE) is recorded not as filmed, every other cell as filmed;
+ - refusals: a frame this loop does not hold, a record with no clip it is cut from, and without `--read-on-cut` the relation's refusal as ever, each leaving the loop as it was;
+ - a record of its cells not there or not as `video-loop` writes it is refused naming the field, on either cut: none, not an object, bound to another strip or none, no cells or one too few, a cell's entry, its `source_frame`, `anchor_move_px`, `scale`, and `as_filmed` missing or not of its kind (float, text, boolean, zero, NaN);
+ - a paired cell its record calls scaled by the size hold or the gait fallback, or not as filmed, is refused saying which, on either cut;
+ - a cell an interpolator made, on either cut, is refused whatever its record says: as `video-loop` records it (not as filmed), and with its record changed to call it as filmed (its pixels are not the other cut's at the shift);
+ - a loop aligned from its cut (`video-cycle-align`) named by `--read-on-cut`, and a cut of another clip, are refused, and what the key is refused for leaves the loop as it was;
+ - the walk away from the camera of the gait fallback tests, cut by `video-loop` with and without the size hold: the record gives the factor the size hold scaled each cell by, equal to the report's `size_hold.cut_frames`, and calls none of the held cells as filmed;
+ - the same walk cut twice by `video-loop` as a walk with the size hold on for one cut, for the other, and for both is refused, leaving the loop as it was, the record of the held cell naming its factor;
+ - the same walk held in one cut with every trace of the hold and walk taken out of the report and strip record (the report's `size_hold`, the report's `state`, the report's strip's `state`, the strip record's `state`) is refused by the record of its cells; with the record's factors and `as_filmed` taken out too, refused naming the field; with the strip record's `cell_record` taken out, refused as a record with none; with the record changed to call every cell as filmed, refused by its pixels on either cut;
+ - the command line reads the relation `recut`.
+ `tests/video/test_follow_inspect.py` now names `--region-over-solid`, `--region-membrane`, `--read-on-cut`, `--region-rim-round`, `--region-membrane-unpin`, `--region-clear-alpha`, `--region-floor-beside` and `--region-own-outline` among the arguments `video-sway` takes and `video-sway-inspect` does not.
+
+ ## v3.10.1 - A frame made that shows the same picture as a frame beside it is refused; it is made again only on the side away from the picture it showed, or its run kept as filmed
+
+ **Upgrading from 3.10.0: Every cut with no held cell, every cut whose frames between are real new pictures, and every `--fill-held off` run give the same cells as 3.10.0.** A run that 3.8.0 to 3.10.0 reported as filled although its frame between repeated a picture beside it is now made at another fraction where one passes, or kept as filmed with a warning. Its `faults` in `held_fill.before.held_runs` list `held`. At `--out-fps` and in an air retimed with `--air-retime`, such cells are now listed in `out_fps.shown_again` or `air_retime.shown_again` with a warning instead of being counted as made. On twelve tests of the suite that run the binary, 3.10.0 runs the binary 146 times and 3.10.1 runs it 188 times because 3.10.0 took frames between that showed a picture beside them again, while 3.10.1 refuses them and makes them again at other fractions. So a cut whose frames between show a picture beside them again asks the binary for more runs, and takes longer, than in 3.10.0.
+
+ - **Fix: A frame made that shows the same picture as a frame beside it is refused as `held`, made again only on the side away from that picture, or its run kept as filmed.** In 3.8.0 to 3.10.0, an interpolator that gave back one of the two frames it was handed, or the same picture for two different times, made no frame between at all. The run was recorded `filled: true`, its cells listed in `made`, with no retry and no warning, while poses over cells remained unchanged. A frame made must not read as the same picture as either frame it is made between, nor as the cell delivered just before it; otherwise it receives the fault `held` and is refused. A refused frame is made again at the nearest other fractions of `RETIME_T` within half a cell, but only on the side away from the picture it showed: later where it showed the frame before or the cell before it, earlier where it showed the frame after, and not again where it showed both. Because frames between run from one pose to the next, a fraction nearer a picture it showed shows that picture too. If none passes, the run is kept as filmed with a `warning:` line naming its cells. At `--out-fps` and in an air retimed with `--air-retime`, a cell refused this way is the nearer frame, listed in `shown_again` and named in a `warning:` line. On the synthetic cuts of eight tests that reach the binary through the default fill, 3.10.0 took all 44 frames between it asked for, and 19 showed a picture beside them again. Version 3.10.1 makes 26 cells. Poses over cells are 324/383 as filmed, 341/383 in 3.10.0, and 348/383 in 3.10.1. Runs of the binary on them are 90 in 3.10.0, 124 in 3.10.1, and 214 in a first version that retried a refused frame at every fraction within half a cell on both sides. On a Linux runner with a CPU Vulkan driver, that first version made each of those eight tests run longer than its 120 s limit, so each of them timed out and failed.
+ - Python callers: New function `held_fill.same_picture(frame, others)`. `held_fill.judge(..., before=)` takes the cell delivered before the frame, and its reading names `shows` (which of `a`, `b` and `before` the frame shows again). Each try the loop report records (`tries`) names `shows` where it showed one.
+ - **Docs**: [loop-repair.md](docs/loop-repair.md) section 7 documents the rule, the side a refused frame is made again on, their measurements, and the `--out-fps` cells. [video-pipeline.md](docs/video-pipeline.md) and `SKILL.md` are updated. [release.md](docs/release.md) notes that a test that reaches the binary through a cut's default fill and runs it often enough to pass the default 120 s limit on a CPU's Vulkan driver carries the 900 s limit and pins its runs of RIFE with `rife_runs`.
+ - **Tests**: `tests/video/test_held_fill.py` (stalled walk with runs of two and three held cells kept as filmed when returning the frame before or after, 24/27 poses/cells, nine frames asked for, pictures matching `--fill-held off`, warnings naming cells 5-6 and 14-16; frame showing both poses refused with no retry; interpolator drawing the half way time making the run of two and trying the second cell of the run of three only later at 0.6667 to 0.8; `--out-fps` 60 from 24 with eight cells listed in `out_fps.shown_again`; synthetic fall refused as `held` at 0.5 and 0.55 and made at 0.6 in changed test `test_a_once_cut_and_a_one_shot_have_their_held_cells_made_too`); `tests/video/test_root_motion.py` (synthetic jump air retimed twice as long with ten cells listed in `air_retime.shown_again` and named in a warning, each tried at 0.5 and then only later). Twelve tests that run the RIFE binary on a synthetic cut (the eight that timed out in the first version: three rows of `tests/video/test_explicit_window.py`, two tests of `tests/video/test_gait_fallback.py`, `tests/video/test_ghost_given_way.py`, one test of `tests/video/test_one_step_cut.py`, `tests/video/test_play.py`; and four more: the step screen test of `tests/video/test_one_step_cut.py`, the checkpoints test of `tests/video/test_wrap_blend.py`, a test of `tests/video/test_once.py`, and a test of `tests/video/test_ghost_screen.py` marked `real_rife` that hands frames to `rife.Rife` itself; the other eleven reach the binary through a cut's default fill) carry `@pytest.mark.timeout(900)` with a comment naming their calls of the binary, and each pins its runs of RIFE (between 6 and 36): eleven through `rife_runs` in `tests/conftest.py` (0 where `rife_located()` finds no binary), the `tests/video/test_ghost_screen.py` test through `Rife.calls`. With no binary found, every count is 0 and the two tests marked `real_rife` skip. On the first version, nine of the twelve fail on the count, with run counts of 18 to 38: the eight, and the checkpoints test of `tests/video/test_wrap_blend.py` (20 against 16). The other three ask for the same runs in both versions. Red first for two test files, `tests/video/test_held_fill.py` and `tests/video/test_root_motion.py`: 10 failed and 46 passed on 3.10.0; 56 passed on 3.10.1. Mutation check over those two files: with the new reading switched off, ten tests fail; without comparison to the cell before, two; without comparison to the frame after, three; without "only later" after the frame before or cell before, eight; without "only earlier" after the frame after, three; with the cell before not counted for the side, two.
+
## v3.10.0 - Root motion on single-play cuts, their air retimed on a given gravity, length and speed (--air-retime), and a caller-named single play (--cycle once --start --length)
**Upgrading from 3.9.0: a cut played once with a body (`video-loop --cycle once`, `once-return`, `one-shot`, and so `video-set`'s single-play states) gains `root_motion` in its report and strip metadata: each cell's root, what it stands on, and its airs. Its cells and every other key keep their bytes and values. The air is drawn again only when asked (`--air-retime`).**
diff --cc docs/loop-repair.md
index aff0d30,0551223..bee8e7f
--- a/docs/loop-repair.md
+++ b/docs/loop-repair.md
@@@ -2805,14 -2806,13 +2806,15 @@@ its drawings on its own cells, not on t
time of its own, made by RIFE between the frames beside it, judged as the fill's frames are, never showing a frame
again. A loop has round(L x F / fps) cells over its cycle's seconds, at times k x L / cells; a cut played once runs
from its first frame to its last, round((L - 1) x F / fps) + 1 cells, each 1/F. A cell on a frame's time is that
- frame; one between two frames showing one picture (a hold kept) is that picture; one no frame made is taken for is
- the nearer frame, named (`out_fps.shown_again`). The record's `out_fps.source_frames` gives the frame each cell is
- (null where it was made), which the strip record's `cell_record` reads for its `source_frame` (`docs/video-pipeline.md`
- section 6). `cycle/` holds every cell; the strip holds them up to its cell and
- width caps, subsampled past them as any strip is (`subsampled`). The strip metadata says `out_fps` and `source_fps`,
- and `source_cut.times` in place of `samples`. With no RIFE the cut is delivered at its own rate with a `warning:` line
- and `out_fps.applied` false. `video-cycle-align` and `video-stop` refuse such a loop (each makes its own frames
- between from the cut at the clip's rate), and restoration reads it as `source-processing-unsupported`.
+ frame; one between two frames showing one picture (a hold kept) is that picture; one no frame made is taken for (a
+ fault, or `held`: the frame shows the picture of a frame beside it, or of the cell before it, again) is the nearer
-frame, listed in `out_fps.shown_again` and named in a `warning:` line. `cycle/` holds every cell; the strip holds them
++frame, listed in `out_fps.shown_again` and named in a `warning:` line. The record's `out_fps.source_frames` gives the
++frame each cell is (null where it was made), which the strip record's `cell_record` reads for its `source_frame`
++(`docs/video-pipeline.md` section 6). `cycle/` holds every cell; the strip holds them
+ up to its cell and width caps, subsampled past them as any strip is (`subsampled`). The strip metadata says `out_fps`
+ and `source_fps`, and `source_cut.times` in place of `samples`. With no RIFE the cut is delivered at its own rate with
+ a `warning:` line and `out_fps.applied` false. `video-cycle-align` and `video-stop` refuse such a loop (each makes its
+ own frames between from the cut at the clip's rate), and restoration reads it as `source-processing-unsupported`.
Where sprite-gen gives frames at a higher rate than it was given them:
diff --cc sprite_gen/video/held_fill.py
index 37e41b0,2a71544..f9ea096
--- a/sprite_gen/video/held_fill.py
+++ b/sprite_gen/video/held_fill.py
@@@ -311,10 -334,10 +338,11 @@@ def at_times(frames: list[Image.Image]
continue
t = tau - a
half = (spacing if isinstance(spacing, (int, float)) else spacing[k]) / 2
- frame, how = _made(interpolate, frames[a], frames[(a + 1) % n], t, (t - half, t + half), reads=reads)
+ frame, how = _made(interpolate, frames[a], frames[(a + 1) % n], t, (t - half, t + half), reads=reads,
+ before=out[-1] if out else None)
if frame is None:
out.append(frames[near % n])
+ source_frames.append(near % n)
shown_again.append(k)
made.append({"cell": k, "between": [a, (a + 1) % n], "taken": near % n, **how})
continue
diff --cc tests/video/test_root_motion.py
index 7a00f3e,e777c79..99709a2
--- a/tests/video/test_root_motion.py
+++ b/tests/video/test_root_motion.py
@@@ -215,38 -230,6 +233,55 @@@ def test_no_rife_leaves_the_air_as_film
assert meta["root_motion"]["air"][0]["seconds"] == pytest.approx(J.AIR, abs=1e-3)
+def test_a_retimed_cut_records_each_cell_as_the_frame_it_is_and_a_cell_made_or_moved_as_not_filmed(tmp_path):
+ """The strip's record of its cells (`cell_record`, video-sway --read-on-cut) of the jump with its air half as long
+ again, on the clip's own canvas: a cell held_fill.at_times takes as a frame (`source_frames`) is that frame, one made between
+ two frames reads as the frame before its time; the cells up to the take-off are their frames as filmed, and no air
+ cell (made, or moved onto the parabola) nor any from the landing on (moved along) is, so --read-on-cut does not
+ pair it."""
+ between = Between(J.draw, range(J.FRAMES))
+ rep = _run(tmp_path, J.jump(), "long", state="jump", cycle_mode="once", air_retime=f"air={1.5 * J.AIR}",
+ interpolate=between)
+ meta = _meta(rep)
+ record = meta["air_retime"]
+ (air,) = record["air"]
+ assert record["applied"] and record["canvas_offset"] == [0, 0] and air["moved_along_px"] != 0
+ assert {im.size for im in (Image.open(p) for p in (Path(rep["out_dir"]) / "cycle").glob("frame-*.png"))} == {(J.W, J.H)}
+ sha = hashlib.sha256(Path(rep["strip"]["path"]).read_bytes()).hexdigest()
+ cells, times = sway.cell_record(meta, sha), meta["source_cut"]["times"]
+ assert len(cells) == meta["frames"] == len(times)
+ made = [c for c, t in enumerate(times) if abs(t - round(t)) > held_fill.SNAP]
+ assert len(made) == record["made"] == 10 and all(air["takeoff"] < c < air["landing"] for c in made)
+ for c, (cell, t) in enumerate(zip(cells, times)):
+ assert cell["source_frame"] == (math.floor(t) if c in made else round(t)), c
+ assert cell["as_filmed"] is (c <= air["takeoff"]), c
+ # Read on a cut of the same clip from frame 6: the retimed cut's first cell of frame 6 is made between 6 and 7.
+ read = _run(tmp_path, J.jump(), "from6", state="jump", cycle_mode="once", start=6, length=10)
+ first = [c["source_frame"] for c in cells].index(6)
+ assert first in made
+ with pytest.raises(SystemExit, match=rf"cell {first} is not that frame as filmed: video-loop did not cut it as filmed "
+ rf"\(cell_record\.cells\[{first}\]\.as_filmed\)"):
+ sway.recut_pair(meta, _meta(read), hashlib.sha256(Path(read["strip"]["path"]).read_bytes()).hexdigest(),
+ strip_sha256=sha)
+
+
++def test_a_retimed_cut_whose_frames_between_show_a_frame_again_records_those_cells_as_the_nearer_frame(tmp_path):
++ """The same air half as long again with an interpolator that gives back the frame before: no cell between two
++ frames is made (each refused, `held`), each is the nearer frame (`air_retime.shown_again`), and the strip's record of
++ its cells names that frame (`source_frames`, held_fill.at_times'), not the frame before its time."""
++ rep = _run(tmp_path, J.jump(), "stuck", state="jump", cycle_mode="once", air_retime=f"air={1.5 * J.AIR}",
++ interpolate=lambda a, b, t: a)
++ meta = _meta(rep)
++ record = meta["air_retime"]
++ between = [c for c, t in enumerate(meta["source_cut"]["times"]) if abs(t - round(t)) > held_fill.SNAP]
++ assert record["applied"] and record["made"] == 0 and record["shown_again"] == between and len(between) == 10
++ sha = hashlib.sha256(Path(rep["strip"]["path"]).read_bytes()).hexdigest()
++ cells, times = sway.cell_record(meta, sha), meta["source_cut"]["times"]
++ assert len(cells) == meta["frames"] == len(times)
++ assert [cell["source_frame"] for cell in cells] == [round(t) for t in times]
++ assert any(round(times[c]) != math.floor(times[c]) for c in between)
++
++
def test_gravity_or_speed_without_metres_per_pixel_is_refused(tmp_path):
with pytest.raises(SystemExit, match="--meters-per-px"):
_run(tmp_path, J.jump(), "g", state="jump", cycle_mode="once", air_retime="gravity=9.81")