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(video-sway): --read-on-cut reads each cut by its record of its cells (cell_record), kept beside an aligned loop's frames as filmed, and refuses a cut with no such record, in docs/video-pipeline.md section 6 and the CHANGELOG's Unreleased

Soohong Kim2dd0b5280475
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3f54d9f..a5c0826 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,11 +27,12 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- **New: holding pixels through banded sway (`--hold-mask`).** `--hold-mask MASK.png|DIR` leaves pixels as they are while a band moves its regions round them, requiring `--band` and off by default, byte for byte as before when not given. The mask is a PNG drawn on the cell the regions were read on (holding pixels where alpha is 128 or more; where the PNG has no alpha, grey 128 or more) or a folder of PNGs giving one mask per cell in file-name order. One mask is split into 8-connected pieces, each carried into every cell by its own solid pixels within `CARRY_SEARCH` (9) px by least squared difference of premultiplied colour and parabolic fitting (reverting to body lay with a warning on stderr when uncertain or covering no solid pixel), then grown by `HOLD_GROW` (3) px. Each cell keeps byte for byte the mask pixels, soft edges, and air within `ceil(reach) + HOLD_EDGE` (2) px. Other pixels are read short of kept pixels along the move direction by `f = min(s, h)` px, where `h` is `HOLD_SLOPE` (0.5) times free distance to kept or margin pixels (`HOLD_MARGIN` of 1 px), bounded to rise by at most `HOLD_SLOPE` per pixel (`read_share`). Reads touching forbidden pixels are renormalised or walked back by 1/`HOLD_STEPS` (1/16) of their move. Metadata gains `follow.hold` (and `sway.json` gains `hold` for `--frames`), while stdout JSON gains `hold` with `pieces`, `lay_cells`, and `read_folded_px_max`.
- **New: a region given as a mask (`--region-mask`, `--region-rim`, `--region-shrink`, `--region-crease`).** `--region-mask MASK.png|DIR` gives the region as a mask of the part's own pixels instead of the ellipse's weight, moving the part while holding every visible pixel outside it and its soft edge in every cell, off by default and byte for byte as before when not given. The mask is a PNG drawn on the cell the regions were read on (alpha 128 or more, or grey 128 or more where it has no alpha) or a folder of PNGs giving one mask per cell in file-name order. When requested, `--region-crease` aligns the mask's lower edge to the median darkest row from `CREASE_UP` (5) rows above to `CREASE_DOWN` (3) rows below over `CREASE_SPAN` (2) columns either way, and `--region-shrink PX` (default `SHRINK_DEFAULT`, 2) wears the mask in by 4-neighbour steps. With `--region-crease`, after the mask is worn in, each column the crease ended where the worn mask still holds a pixel is filled back down to the crease row with the mask's pixels before wear (`crease_kept`), leaving the crease edge where it is while wearing in the rest of the mask; the record's `mask.box` now ends on the crease row. One mask is carried into each cell by its own solid pixels within `CARRY_SEARCH` (9) px by least squared difference of premultiplied colour, searching round the cell before and the body's lay, keeping the carry of the cell before when neither settles. The region and its soft edge (pixels not opaque within `REGION_SOFT`, 2, px of the region, not beside another solid pixel) move, and the air (clear pixels within `ceil(reach) + REGION_AIR`, 2, px of the region) is where they may move into; every other visible pixel is held. Inside the region, its soft edge and the air, weight rises by `sin²(pi/2 x d)` from 0 at held pixels to 1 across a rim scaled by `--region-rim SCALE` (default `RIM_DEFAULT`, 1.0) and widened until slope is at most `RIM_SLOPE` (0.9), preventing folding. With `--band-up`, weight is the lesser of the rim and the upper yield. Strip metadata gains `follow.region_mask` (and `sway.json` gains `region_mask` for `--frames`), while stdout JSON gains `region_mask` with `kept_cells`, `rim_px`, `move_most_px`, and `walked_px_max`. See [video-pipeline](docs/video-pipeline.md) section 6.
- **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 band and air pixels by alpha, and showing the figure under the region in its own column 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 out of the layer and band. `--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.
-- **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 with conjugate gradients 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. It pairs a frame only where each cut's report beside its strip says that frame is in the cut as filmed. A run is refused if a report is missing or is another cut's, if frames were scaled by the size hold or gait fallback, or if the frame was altered by jump repair, seam bridges, overlap, or wrap blending. Each step's record is now read as `video-loop` writes it, and the run is refused where a report lacks a record `video-loop` always writes, where the report's strip does not say the cut's anchor, kind or state that tells, where a record is not a JSON object or a field of one is missing or not of its kind, or where `applied` is not borne out by its list. 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: 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 with conjugate gradients 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.
+- **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`.
- Python callers: `sway_loop`, `sway_frames`, `read_request`, and `read_ask` accept `band`, `band_margin`, and `band_up` (`band_up` as `(flat, px_or_"auto")` or command-line string). New in `sprite_gen.video.sway`: `band_weight`, `band_shapes`, `carry_match`, `carry_own`, `band_steepest`, `steepest_gain`, `band_ledger`, `band_notes`, and `jacobian` (moved from `sway_inspect`, which retains it under the same name); constants `BAND_POLICY`, `CARRY_BASIS_BAND`, `CARRY_SEARCH`, `HANG_PAST`, `PRESSED`, `STRETCHED`, `MOVED_PX`, and `AUTO`; and methods `Answer.band_field(k, xx, yy)` and `Answer.band_record()`. `sway_loop`, `sway_frames`, `read_request`, and `read_ask` accept `hold_mask` (a Path to a PNG or folder; None: off); new in `sprite_gen.video.sway`: `Hold`, `read_hold`, `Held`, `hold_sets`, `free_back`, `read_share`, `draw_held`, `hold_ledger`, `hold_notes`, and `carry_mask`; constants `HOLD_POLICY`, `HOLD_GROW`, `HOLD_EDGE`, `HOLD_MARGIN`, `HOLD_SLOPE`, `HOLD_ROUND`, and `HOLD_STEPS`; `Ask.hold`, `Answer.hold`, `Answer.held_cell(k)`, and `Answer.hold_record()`; and `carry_own` now calls `carry_mask` (same behaviour).
- Python callers: `sway_loop`, `sway_frames`, `read_request`, and `read_ask` accept `region_mask` (a Path to a PNG or a folder; None: off), `region_rim` (float; None: 1.0), `region_shrink` (int; None: 2), and `region_crease` (bool); new in `sprite_gen.video.sway`: `RegionMask`, `Masked`, `crease_of`, `carry_region`, `rim_bands`, `rim_distance`, `region_sets`, `region_ledger`, and `region_notes`; constants `REGION_POLICY`, `RIM_SLOPE`, `RIM_DEFAULT`, `SHRINK_DEFAULT`, `REGION_SOFT`, `REGION_AIR`, `CREASE_UP`, `CREASE_DOWN`, and `CREASE_SPAN`; `Ask.mask`, `Answer.mask`, `Answer.mask_field(k, xx, yy)`, `Answer.masked_cell(k)`, and `Answer.mask_record()`; and `draw_held` gains `short` (default true; false reads every pixel at its whole move).
- 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`: `crease_kept`, `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`, `recut_pair`, `recut_ask`, `read_cut` and `anchor_move`; new in `sprite_gen.video.loop`: `ramp_offset`; new in `sprite_gen.video.motion_anchor`: `laid_at`; constants `OVER_SOLID_POLICY`, `MEMBRANE_POLICY`, `MEMBRANE_TOL`, `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`. `as_filmed` checks that a cut's cell is as filmed, `recut_pair` takes both cuts' reports via `reports`, `read_cut` returns the found report under `report`, and `Request` gains `loop_report`.
+- 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`, `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`, `MEMBRANE_TOL`, `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`.
- Record fields: `follow.band` in strip metadata and `band` in `sway.json` record `policy` (`own-pixels/margin-band-cos2/1`), `asked` (`{band, margin, up}`), `reach_px`, `band_px`, and `margin_px`. They record per-region `flat_px` and `band_px` (across, above, below); per region in `follow.band.regions[i]`, `steepest`: `per_gain` (the slope per unit of gain), `cell`, and `ratio` (the region's gain times `per_gain`, under 1 on any written strip); `carry` with `search_px` (9) and per-cell, per-region `px`, `from` (`base`, `pixels`, or `lay`), `why` for lay, `least`, and `curvature`; `lay` entries for cells carried by lay; and `ledger` lists per cell (with `<key>_max` values) for `band_on_regions_px`, `pressed_px`, `stretched_px`, `pressed_box`, `stretched_box`, `area_least`, `area_most`, `outside_moved_px`, and `jacobian_min`. Only the four counts warn: `band_on_regions_px`, `pressed_px`, `stretched_px`, and `outside_moved_px`. For each that is not 0 in some cell, one warning line on stderr says in how many cells, up to how many px and in which cell (for `pressed_px` and `stretched_px` also the least or the most area and where), and ends with the record key: `follow.band.ledger.<key>` on `--loop-dir`, `sway.json band.ledger.<key>` on `--frames`. The lay warning names its record key the same way: `follow.band.lay` on `--loop-dir`, `sway.json band.lay` on `--frames`. `jacobian_min` (the least area of the source any pixel of a moved cell takes, per cell) gives no warning: it is recorded, and 0 or under in any cell refuses the run as the last check, named the engine's fault, nothing written. Command stdout JSON gains `band` containing `band_px`, `margin_px`, and `lay_cells`.
- Record fields: `follow.hold` in strip metadata and `hold` in `sway.json` record `policy` (`own-pixels-grown/kept-edge-air/read-short-sloped/1`), `asked` (`per_cell`, and `sha256`: the file's, or a list per file for a folder), `grow_px` (3; null for a folder), `edge_px`, `margin_px` (1), `slope` (0.5), `round_px` (1), and `steps` (16). They record `pieces` with each piece's `px` and `box` (`x0`, `y0`, `x1`, `y1`) on the cell it was drawn on (empty for a folder); `carry` with `search_px` (9) and per-cell, per-piece `px`, `from` (`base`, `pixels`, or `lay`), `why` for lay, `least`, and `curvature` (null for a folder); `lay` entries (`{cell, piece, why}`) for pieces carried by lay; and `ledger` lists per cell (with `<key>_max` values) for `held_px`, `soft_px`, `air_px`, `short_px`, `renormalised_px`, `walked_px`, `read_folded_px`, `read_folded_edge_px`, `read_least`, `read_turn_folded_px`, and `read_turn_least`. Warning lines on stderr report a piece carried by the lay (in how many cells and why), ending with the record key: `follow.hold.lay` on `--loop-dir`, `sway.json hold.lay` on `--frames`. For `renormalised_px`, `walked_px`, and `read_folded_px`, when not 0 in some cell, one warning line on stderr says in how many cells, up to how many px and in which cell, ending with the record key: `follow.hold.ledger.<key>` on `--loop-dir`, `sway.json hold.ledger.<key>` on `--frames`. Command stdout JSON gains `hold` containing `pieces`, `lay_cells`, and `read_folded_px_max`.
- Record fields: `follow.region_mask` in strip metadata and `region_mask` in `sway.json` record `policy` (`own-pixels-mask/held-outside/rim-sin2/1`), `asked` (`per_cell`, `sha256`: the file's, or a list per file for a folder, `rim`: the scale, `shrink_px`, `crease`: true/false, and `up`: `{flat, band}` or null), `soft_px` (2), and `air_px` (`ceil(reach) + 2`). They record `rim` (`across_px` for Lx, `down_px` for Ly, `least_px`: the two bands it started at, `slope`: the steepest `(pi/2) x sqrt(...)` over the cells, and `slope_bound`: 0.9); `mask` (`px`: its pixel count as worn in, `box`, and `carried_by_px`: the solid pixels it was carried by; null for a folder); `crease` (per mask, `rows`: each column's row, keyed by column, and `free_columns`; null when not asked); `carry` (`search_px` of 9 and `cells`: per cell `px`, `from`: `base`, `pixels` or `before`, `guess`: `before` or `lay` where carried by its pixels, `why` where it kept the cell before's carry, `least`, and `curvature`; null for a folder); `kept` entries (`{cell, why}`) for cells keeping the carry of the cell before; `up` containing the upper yield's shape as a band's record (`reach_px`, `band_px`, `margin_px`, per region `flat_px`, `band_px` and `steepest`, its `carry` and `lay`; null without `--band-up`); and `ledger` lists per cell (with `<key>_max` values) for `region_px`, `soft_px`, `air_px`, `held_px`, `held_changed_px` (0), `move_most` ([px, x, y] of the region pixel that moves most; null where none moves) with `move_most_max`, `pressed_px`, `pressed_box`, `area_least`, `stretched_px`, `stretched_box`, `area_most`, `folded_px`, `jacobian_min`, `read_held_weight` ([weight, x, y]; null where none), `read_held_half_px`, `renormalised_px`, and `walked_px`. Warning lines on stderr report cells that kept the carry of the cell before (ending `follow.region_mask.kept`), a region whose `--band-up` yield was carried by the lay (ending `follow.region_mask.up.lay`), and for `held_changed_px`, `pressed_px`, `stretched_px`, `read_held_half_px`, `renormalised_px` and `walked_px` when not 0 in some cell, one line reports in how many cells and up to how many px (with area and location for pressed and stretched), ending with `follow.region_mask.ledger.<key>` on `--loop-dir` or `sway.json region_mask.ledger.<key>` on `--frames`. Command stdout JSON gains `region_mask` containing `kept_cells`, `rim_px` ([Lx, Ly]), `move_most_px`, and `walked_px_max`.
@@ -108,19 +109,22 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- 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 loop aligned from the cut again carries the pair through the alignment;
+ - 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; the same two cuts' records named `--anchor motion-auto` pair alike (`--anchor motion-auto` takes no `--cycle fixed`; it records its correction as `--anchor motion` does);
- - refusals (frame not held, a record with no source frame, `--read-on-cut` without `--read-on`, another clip, three records that do not give where the anchor moved the frame: the cut's record saying nothing of its anchor, this loop's record cut at `--anchor body` with no `wrap_dx_px`, and at `--anchor motion` with no `motion_anchor`, and a loop aligned from its cut (`video-cycle-align`) named by `--read-on-cut`) leave the loop as it was;
- - every hand cut fixture now writes the report beside its strip as `video-loop` does, keeping existing assertions;
- - a cell of this loop's cut made again by RIFE between the frames either side is refused, not paired as the frame filmed;
- - a cut with no report beside its strip, and a cut whose report beside it is the same cut's of another take, each on the cut `--read-on-cut` names and on this loop's, are refused with two distinct reasons;
- - the seam bridge, the overlapped wrap, the wrap blend, the gait fallback, a report that does not say what the jump repair made, and frames not named as whole frames are each refused saying which;
- - the walk away from the camera of the gait fallback tests, 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;
- - a report that does not say what a step did as `video-loop` writes it, on the cut `--read-on-cut` names or on this loop's, is refused naming the field and leaving the loop as it was; the cases: a step's record that is not a JSON object, a field of one missing or not of its kind, no `size_hold` record on a walk cut given with `--cycle fixed` or on a cut at `--anchor motion-auto`, no `wrap_blend` record on a pinned cut, a strip that does not say its anchor, kind or state where that tells, and an `applied` its list does not bear out;
- - what `video-loop` writes of a step that did not run, in both cuts' reports, leaves the frame paired as before, the mask landing on the patch there;
- - the walk away from the camera of the gait fallback tests, cut by `video-loop` with the size hold on, its report changed so that it no longer says the cut was held (`size_hold.applied` or the whole `size_hold` record removed on either cut), is refused;
+ - 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` and `--region-rim-round` among the arguments `video-sway` takes and `video-sway-inspect` does not.
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index 27c97ad..66545bb 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -682,56 +682,70 @@ lowercase hexadecimal digits; anything else is refused before anything is read):
- **`recut`**: the regions were read on another cut of this loop's own source clip, given by
`--read-on-cut STRIP`. It pairs the cuts when both records name the same source in `source_cut`
- and this loop's cut holds cut cell 0's source frame at cell j. When the run starts, it finds the
- report `video-loop` wrote for both cuts (the cut `--read-on-cut` names, and this loop's cut in
- `--loop-dir`): a passed `sprite-gen-video-loop-report` in or above the strip's folder, matching
- that strip's file name and cut (start and length in `cycle`) named in the strip record
- (`cycle_drawings`). A cut whose report was written elsewhere with `--report` needs that report put
- beside its strip. The paired frame must be in each cut as filmed, but for where its anchor moved
- it. Before crops are read, the run is refused no-match and the loop left as it was if no report is
- beside a cut's strip, or it belongs to another cut (the report strip's `source_cut` is not the
- record's). Refusal also occurs if the size hold (`size_hold.applied`) or gait fallback
- (`gait_fallback.scale_undone`) held cut frames to one size before cutting, which refuses the whole
- cut whatever frame is paired. It also occurs if `jump_repair` omits what jump repair made, if the
- paired frame is in `jump_repair.replaced`, `wrap_overlap.frames`, or `wrap_blend.cells`, or if one
- of those three lists does not name its frames as whole frames. Each step's record in each cut's
- report is read as `video-loop` writes it, and a missing record or field is never taken for a step
- that did not run. `video-loop` writes the `jump_repair` record of every cut, the `size_hold`
- record of every cut at `--anchor motion-auto` and of every walk or run cut given with
- `--cycle fixed`, and the `wrap_blend` record of every pinned cut, whether the step ran or not, but
- the `gait_fallback` and `wrap_overlap` records only where the step ran or was asked; the report's
- strip tells those cuts by its `foot_anchor`, `kind` and `state`. The run is also refused no-match
- if a report lacks a record `video-loop` always writes of that cut, if the report's strip does not
- say the anchor, kind or state that tells, if a step's record is not a JSON object or a field of
- one is missing or not of its kind (`size_hold.applied`, `gait_fallback.scale_undone`,
- `jump_repair.applied` and `wrap_blend.applied` must be true or false), or if an `applied` is not
- borne out by its list (true with no frame named, or false with one named). What `video-loop`
- writes of a step that did not run still pairs: `applied` false with no list or an empty one, an
- empty `wrap_overlap.frames`, and no `gait_fallback` or `wrap_overlap` record. The refusal names
- whose records do not give that frame as filmed (the cut's, given by `--read-on-cut`, or this
- loop's), and why. The regions' centres, a `--region-mask` PNG, and a single `--hold-mask` PNG are
- moved pixel for pixel onto cell j by the whole pixel shift derived from their crops and cell sizes
- taken on the frame as filmed, provided every pixel lands within `RECUT_DRIFT` (1.0 px) of that
- shift. Each cut's crop is its `source_rect` less where its anchor moved that frame before the
- crop. The anchor moves nothing at `--anchor none`, moves frame k of a cut L frames long across by
- round(`wrap_dx_px` x k / L) px at `--anchor body`, and lays frame k at the left and top of
- `padding_ltrb` plus that frame's entry of `shifts_xy` at `--anchor motion` and
- `--anchor motion-auto`. On an unaligned loop the regions are read on cell j and carried from
- there, while on an aligned loop they sit on the aligned cell matching cut cell j and are carried
- as `transported` carries them. A run is refused no-match if the clips differ, if either cut lacks
- recorded source frames, if this loop does not hold that source frame, if a record does not give
- where its anchor moved the frame, or if the strip `--read-on-cut` names is a loop aligned from its
- cut (`cycle_align`), whose cells are not the cut's frames in order, and refused uncertain if a cut
- records no crop, if crops, scales and anchors set pixels more than 1 px off one whole shift, or if
- an aligned loop holds no cell for cut cell j. `STRIP` is that cut's strip PNG, whose bytes must
- have the sha256 `--read-on` names, with its record beside it as `video-loop` writes one using the
- same file name ending `.json` instead of `.png`, refusing with "--read-on-cut names the strip
- --read-on names by its sha256; it needs --read-on" when `--read-on` is not given and "wants the
- strip's PNG and its record beside it" when either file is missing. Masks are moved by the shift
- alone with no polygon grown and no scaling, while a mask pixel that would leave the cell refuses
- the run, and a folder of masks (one per cell) is refused under `--read-on-cut` with "regions read
- on another cut (--read-on-cut) are drawn on its cell 0 alone: give one PNG". `video-sway` takes
- `--read-on-cut` on `--loop-dir` only, and `video-sway-inspect` does not take it.
+ (its `source`) and this loop's cut holds the source frame of the cut's cell 0, at its cell j.
+ The report `video-loop` wrote beside a cut is no longer looked for or read for `--read-on-cut`,
+ and need not be beside the strip. Each cut is now read by its record of its cells alone.
+ `video-loop` writes it in the strip's record (`<name>.strip.json`, not the report) under
+ `cell_record`, bound to the strip by `cell_record.strip_sha256`, the sha256 of the strip PNG it
+ describes. `cell_record.cells` holds one entry per cell of the strip, in order: `source_frame`,
+ the source frame the cell is (a whole number); `anchor_move_px`, where the cut's anchor moved
+ that frame before the crop, across and down, in whole px (nothing (`[0, 0]`) at `--anchor none`,
+ round(`wrap_dx_px` x k / L) across at `--anchor body` for frame k of a cut L frames long, and the
+ left and top of `padding_ltrb` plus that frame's entry of `shifts_xy` at `--anchor motion` and
+ `--anchor motion-auto`); `scale`, the factor each step that holds a clip's frames to one size
+ scaled the frame by about its feet before the cut, `size_hold` (the size hold) and `gait_fallback`
+ (the gait fallback), 1 where the step did not hold the clip's frames; and `as_filmed`, true where
+ the cell is that frame as filmed but for its anchor's move. Its pixels at the end of the cut are
+ its pixels anchored, before any repair (the receipt `video-loop` writes in its report,
+ `source_projection.before_repair_pixels_sha256`), and no step held the clip's frames to one size.
+ A cell the jump repair, the seam bridge, the overlapped wrap or the wrap blend made again, gave
+ way or redrew is not as filmed by its pixels; no list of those steps is read. `video-loop` now
+ writes that receipt (`source_projection`) in the report of every cut but `--anchor feet` and a
+ lifetime cut, so also at `--anchor motion` and `motion-auto` (`recipe`
+ `motion-anchor-correction-v1` there). On a loop aligned from its cut (`cycle_align`), the aligned
+ strip is another strip, so `video-cycle-align` does not carry `cell_record` over to it. Its first
+ alignment keeps the cut's own strip record, byte for byte, beside the cut's frames as filmed
+ (`cycle.source/<name>.strip.json`), and later alignments keep it. There the cut's record is read
+ from that file, bound to the strip the alignment's origin names
+ (`cycle_align.origin.strip_sha256`); the regions sit on the aligned cell that is cut cell j and
+ are carried as `transported` carries them. On an unaligned loop they are read on cell j and
+ carried from there. The regions' centres, a `--region-mask` PNG, and a single `--hold-mask` PNG
+ are moved pixel for pixel onto cell j by the whole pixel shift the two crops and cell sizes set
+ that frame apart, each crop taken on the frame as filmed: its `source_rect` less the cell's
+ `anchor_move_px`. A pixel may lie at most `RECUT_DRIFT` (1.0 px) off that shift anywhere in the
+ cell. The pair's policy is now `same-clip/source-frame/whole-px-shift/2`. Then the two cells are
+ compared: the cut's cell 0 laid on this loop's cell j at the shift must be the same pixels (RGBA)
+ wherever they overlap. A record changed to call a cell the frame as filmed is held to that
+ frame's pixels this way. Before crops are read, the run is refused no-match and the loop left as
+ it was, saying which and naming the field: a cut with no `cell_record` (a cut `video-loop` made
+ before it wrote one: every cut made by 3.5.0 or before), on the cut `--read-on-cut` names or on
+ this loop's ("it holds no record of them (cell_record), as a cut video-loop made before it wrote
+ one does"); a record of another strip (`cell_record.strip_sha256` is not the strip's sha256); a
+ record that does not give its cells as `video-loop` writes it, naming the field, for instance
+ `cell_record.cells[2].source_frame` (`cell_record` not an object, `cells` not one entry per cell of
+ the strip, a cell's entry not an object, `source_frame` not a whole number, `anchor_move_px` not
+ two whole px, a `scale` factor missing or not a positive number, `as_filmed` not true or false);
+ a loop aligned from its cut whose cut's record is not kept beside its frames as filmed
+ (`cycle.source/<name>.strip.json`); a record that names no clip it is cut from (`source_cut`),
+ two cuts of different clips, or a source frame this loop's cut does not hold. Every cell's entry
+ is read this way, not only the cell paired. Refusal no-match also occurs if either cell paired was
+ scaled by a hold (its `scale.size_hold` or `scale.gait_fallback` not 1: no whole px shift undoes a
+ scale), or is not as filmed (`as_filmed` false). Only the two cells paired are read for this; a
+ cell elsewhere in either cut that a hold scaled or a repair made leaves the pair as it is.
+ Refusal no-match also occurs if the two cells are not the same pixels where they overlap at the
+ shift, saying how many of how many px differ, or if the strip `--read-on-cut` names is a loop
+ aligned from its cut (`cycle_align`), whose cells are not the cut's frames in order. A run is
+ refused uncertain if a cut records no crop, if crops, scales and anchors set a pixel more than 1 px
+ off one whole shift, or if an aligned loop holds no cell for cut cell j. `STRIP` is that cut's
+ strip PNG, whose bytes must have the sha256 `--read-on` names, with its record beside it as
+ `video-loop` writes one using the same file name ending `.json` instead of `.png`, refusing with
+ "--read-on-cut names the strip --read-on names by its sha256; it needs --read-on" when `--read-on`
+ is not given and "wants the strip's PNG and its record beside it" when either file is missing.
+ Masks are moved by the shift alone with no polygon grown and no scaling, while a mask pixel that
+ would leave the cell refuses the run, and a folder of masks (one per cell) is refused under
+ `--read-on-cut` with "regions read on another cut (--read-on-cut) are drawn on its cell 0 alone:
+ give one PNG". `video-sway` takes `--read-on-cut` on `--loop-dir` only, and `video-sway-inspect`
+ does not take it.
- **`no-match`**, refused: neither — another clip, another cut no record pairs with this one
(`--read-on-cut` names the cut that one does), a strip nothing here was cut or aligned from.
Locate the regions again on this strip.