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 main 866185a (v3.2.0) into plan/rife-torch-backend-1021: the torch backend beside the 3.x in-between readings (hole, doubled)

Soohong Kimc47a6af04d56
diff --cc CHANGELOG.md
index bcbbe99,bd346a7..0bc09d3
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -2,16 -2,575 +2,585 @@@
All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.
+## Unreleased - The new RIFE torch backend runs rife-v4.6 in PyTorch for compute GPUs without Vulkan; rife-ncnn-vulkan stays the default
+
- **Upgrading from 2.45.2: Defaults stay unchanged, cache keys update once, reports show the backend, install checks model hashes, and schemas are unchanged.** With `SPRITE_GEN_RIFE_BACKEND` unset (the default), RIFE is the `rife-ncnn-vulkan` binary as before. Its frames are the same bytes as 2.45.2. Measured: the binary's frames and sixteen-pass readings through the changed engine equal the old engine's, byte for byte. A `--between-cache` directory kept by 2.45.2 is made again once. The key now names the backend (`backend: "ncnn"`). The engine's `rife.py` changed, and its sha256 is part of the key anyway. Reports take `interpolator.kind` from what made the frames: `rife-ncnn-vulkan` as before for the binary, or `rife-torch` for the new backend. The overlapped wrap's record counts `binary_calls` for the binary as before, or `runs` for the torch backend. `SPRITE_GEN_RIFE_EXECUTOR` (new) is unset by default, and RIFE runs in this process. `sprite-gen rife install` now checks the model's two files (`rife-v4.6/flownet.param`, `flownet.bin`) against pinned SHA-256 after unpacking, for either backend. A model that differs installs nothing. The line a missing RIFE is reported with (`install` in records, warnings) is `sprite-gen rife install` for the binary. Where the torch backend is chosen, that line is: `pip install "sprite-gen[torch]" && sprite-gen rife install --backend torch`. No command-line flags of `video-loop` / `video-cycle-align` / `video-set` change. No restoration schemas change: `source-restoration-v5`, repair report `schema_version` 4, comparison `schema_version` 6.
++**Upgrading from 3.2.0: Defaults stay unchanged, cache keys update once, reports show the backend, install checks model hashes, and schemas are unchanged.** With `SPRITE_GEN_RIFE_BACKEND` unset (the default), RIFE is the `rife-ncnn-vulkan` binary as before. Its frames are the same bytes as 3.2.0. Measured: the binary's frames and sixteen-pass readings through the changed engine equal the old engine's, byte for byte. A `--between-cache` directory kept by 3.2.0 is made again once. The key now names the backend (`backend: "ncnn"`). The engine's `rife.py` changed, and its sha256 is part of the key anyway. Reports take `interpolator.kind` from what made the frames: `rife-ncnn-vulkan` as before for the binary, or `rife-torch` for the new backend. The overlapped wrap's and the seam bridge's records count `binary_calls` for the binary as before, or `runs` for the torch backend. `SPRITE_GEN_RIFE_EXECUTOR` (new) is unset by default, and RIFE runs in this process. `sprite-gen rife install` now checks the model's two files (`rife-v4.6/flownet.param`, `flownet.bin`) against pinned SHA-256 after unpacking, for either backend. A model that differs installs nothing. The line a missing RIFE is reported with (`install` in records, warnings) is `sprite-gen rife install` for the binary. Where the torch backend is chosen, that line is: `pip install "sprite-gen[torch]" && sprite-gen rife install --backend torch`. No command-line flags of `video-loop` / `video-cycle-align` / `video-set` change. No restoration schemas change: `source-restoration-v5`, repair report `schema_version` 4, comparison `schema_version` 6.
+
+- **New: RIFE's torch backend runs rife-v4.6 in PyTorch for compute GPUs without Vulkan.** `SPRITE_GEN_RIFE_BACKEND=torch` runs the same rife-v4.6 in PyTorch (`sprite_gen/video/rife_torch.py`). It serves a GPU the binary cannot run on: rife-ncnn-vulkan needs Vulkan, and a GPU offered for compute alone (CUDA with no Vulkan driver) has none. The network is rife-v4.6's IFNet written again from Practical-RIFE's `IFNet_HDv3` (MIT, notice in NOTICE). Its weights are read out of the binary's own model files (SHA-256 pinned, the binary's float16 weights), with no other download. One run does what one call of the binary does with `-x -z`. The pair is turned eight ways and run both ways in time, with flows averaged at each of four levels. The loop follows rife-ncnn-vulkan's `RIFE::process_v4` (MIT, notice in NOTICE). `SPRITE_GEN_RIFE_DEVICE` names `cuda` (default) or `cpu`. `SPRITE_GEN_RIFE_TTA` means the same for both backends. The default augmentation stays `-x -z`. To install: `pip install "sprite-gen[torch]"` (new extra: `torch>=2.13.0,<3`). Then run: `sprite-gen rife install --backend torch` (new flag; defaults to `SPRITE_GEN_RIFE_BACKEND`). This unpacks the model, and makes a check frame through PyTorch on `SPRITE_GEN_RIFE_DEVICE`. It reads the model only, so a Linux ARM machine the binary does not run on is not refused. A CPU-only host installs PyTorch's CPU build first: `pip install torch==2.13.0 --index-url https://download.pytorch.org/whl/cpu` (192 MB, against the CUDA build's 527 MB plus its CUDA libraries). Nothing falls back. With torch chosen the binary is never looked for or run. `cuda` where PyTorch finds no CUDA is refused naming why (a CPU-only PyTorch, or a CUDA that finds no GPU) and does not run on the CPU. `mps` (Apple's GPU) is refused (no lane measures it; on a Mac the binary runs on the GPU already). A backend or device named wrong is refused. A device that fails as the network is put on it or as a frame runs (out of its memory, its driver or CUDA failing) is a RIFE that fails, in PyTorch's own words: the loop fails with its record, and the install's check frame fails. PyTorch not installed, or no model where the backend looks (`SPRITE_GEN_RIFE_MODEL`, else the install root), is RIFE not installed, as the binary missing is. Under `--repair auto` the loop is cut as filmed with the warning, and its record names the torch install line. On CUDA each frame runs with cuDNN deterministic, its benchmark off and convolutions in IEEE float32 (no TF32). The same frame twice is the same bytes on one GPU, driver and PyTorch. What made a frame is the RIFE's identity: backend, model bytes loaded, network code, PyTorch, on CUDA the GPU, driver, CUDA, cuDNN and those settings; on the CPU its instruction set. Because of this identity, `--between-cache` never hands one backend's or GPU's frame to another. Measured on synthetic walkers: Seven walker pairs (clean, outline lost, ghost, torn, a cross-fade to look at) get the same verdicts from the binary on an Apple GPU, the binary on Mesa llvmpipe and the torch backend on a CPU. The torch frame lies 0.005 to 0.052 of 255 on average from the binary's Apple GPU frame. The binary's own llvmpipe frame lies 0.007 to 0.25. A 960 x 960 frame of a synthetic walker with `-x -z`: On an Apple M4 Max CPU (12 threads), 3.3 to 3.6 s; the binary on that Mac's GPU takes 1.27 to 1.37 s. In a Modal container of two CPUs (the app's job size), 22.6 to 28.5 s on two threads; the binary on Mesa llvmpipe in the same container takes 127.7 to 131.5 s. On an NVIDIA T4 rented from Modal (CUDA), 1.36 to 1.41 s. The torch backend's frames are not the binary's bytes, which is one reason the binary stays the default. [loop-repair](docs/loop-repair.md) section 1
+- **New: a host with no GPU sends the torch backend's frames to a GPU elsewhere (`SPRITE_GEN_RIFE_EXECUTOR`).** The host names a send of its own, `SPRITE_GEN_RIFE_EXECUTOR=module:attr`: a function from a request's bytes to its answer's. It reaches `sprite_gen.video.rife_torch.serve` on the GPU's machine, the same sprite-gen with PyTorch and the model installed there. The engine knows nothing of what carries the bytes, and the host needs no PyTorch. A frame is one call (its two runs made there), and a read is one call (its two runs and sixteen passes, the passes reduced there to how far they disagree). A RIFE asks the executor what it is once, as it is made (the probe, which takes the cold start), so a `video-loop` makes at most 53 calls. The RIFE holds that answer for its life, and every request carries it. An executor that is not it any more (another GPU, driver or image) makes nothing, and the RIFE fails naming what differs (`gpu: Tesla T4 -> NVIDIA L4`). An answer from another identity is not handed on. So one RIFE never hands on frames of two GPUs, and a frame taken from `--between-cache` is the frame it would make; the next RIFE asks again and keys its frames anew. Refused: an executor named with the binary's backend or with `SPRITE_GEN_RIFE_DEVICE` (the device is the executor's), a send that cannot be imported, and an executor whose `rife.py` or protocol is another (run the same sprite-gen on both sides). A send that raises, an answer that does not read (not the format, damaged or cut short on the way, or not the frame's size) and the executor's own failure are each a RIFE that fails, in its words; nothing is asked again or run elsewhere. The host names one GPU type for the executor (no fallback list) and does not deploy it anew while a run goes on. Requests and answers are a compressed NumPy archive, read with `allow_pickle=False`, each member whole so its CRC-32 is checked before its array is read: an answer damaged on the way hands on no other pixels. Reports name `executor` and the executor's `device` and `gpu`; the overlapped wrap counts `runs` and `executor_calls`. Measured on an NVIDIA T4 rented from Modal, from a host of two CPUs without PyTorch: a 960 x 960 `-x -z` frame of a synthetic walker takes 1.49 to 1.52 s, 0.1 to 0.2 s more than in the T4's own process, a read as long, and the frames and readings are the same bytes as there. [loop-repair](docs/loop-repair.md) section 1
+- **Lane: `scripts/linux_lane.sh` tests PyTorch 2.13.0 CPU after the suite.** After the suite, PyTorch 2.13.0 CPU is installed into the same environment. It runs `sprite-gen rife install --backend torch`'s check frame. It runs every test marked `torch_rife` with `SPRITE_GEN_RIFE_DEVICE=cpu`, with none skipped. `--rife-only` runs the same. `--rife-unmeasured` lets `torch_rife` tests skip as it lets `real_rife` ones. CUDA is not measured by this lane.
+- **Lane: `scripts/t4_lane.py` tests the torch backend on an NVIDIA T4, rented from Modal.** `modal run scripts/t4_lane.py` builds the checked-out commit's tree into an image as the Linux lane installs a clean clone: Python 3.14, PyTorch 2.13.0 from PyPI (its Linux wheel is the CUDA 13 build), the tree with `.[dev]`, and the model by `sprite-gen rife install --backend torch`, where the engine looks for no binary. On one T4 it makes the install's check frame on CUDA and runs every test marked `torch_rife` and not `real_rife` on CUDA, with none skipped. `--whole-suite` first runs the whole suite in that environment, PyTorch in it, as the Linux lane's RIFE-less run does. A commit passes the lanes where the Linux lane passed at it and one T4 lane run at it exited 0. [release](docs/release.md)
+- **Tests**: `tests/video/test_rife_torch.py` (the eight ways undo themselves and are the single passes' eight turns; flows of a textured patch run alone each of the sixteen ways and turned back point alike, where a wrong sign, a transpose's x/y, or a backward swap puts one elsewhere; `-z` and `-x` give the same frame the other way in time and flipped; the install check frame's disc lands half way; the model loads strict and other bytes are refused by SHA-256; the same frame twice is the same bytes and the identity names what makes it; seven recorded synthetic walker pairs in `tests/fixtures/rife-walkers` are judged as the binary judged them with no binary, the frame within twice the binary's own GPU-to-GPU gap, and alike to this machine's binary where both run; a device that fails as the network is put on it or as a frame runs (out of its memory, its driver, CUDA not starting, a CUDA call deferred to its start) is a RIFE that fails in PyTorch's words, a TypeError there is raised as it is, a loop whose device fails as the network is put on it fails with its record, and the install's check frame fails; without PyTorch: torch chosen and not installed is RIFE not installed and the binary is never run, a loop's record names it, a backend or device named wrong is refused before anything is looked for, cuda where there is none is refused, a model not the pinned one is refused; with a runner stood in: reports name rife-torch and count runs, the loop and the alignment name the torch backend, and a frame kept by one runner is not taken for another); `tests/video/test_rife_executor.py` (a frame is one call and a read one call, and the RIFE probes once as it is made, their bytes the same device's in this process with this host's augmentation; every request names the engine code and the identity held; the host runs without PyTorch; the identity is the executor's as the RIFE was made; a T4 frame kept is the RIFE's own after the executor turns L4, which it then refuses to make anew, and the next RIFE misses and keeps the L4 frame under its own key; an executor whose GPU, driver, network code, weights, PyTorch, cuDNN or determinism changed makes nothing, the field named; an answer from another identity is neither handed on nor kept; another container of the same identity runs on, and the next RIFE takes every frame with its probe alone; a T4 and L4 pool is refused at the first L4 request; a frame made while this host's augmentation changed is not kept; other engine code or another protocol is refused before anything loads; a request that does not read, is pickled or was damaged on the way is answered so, in the reading's words; a send, an answer or an executor that fails is a RIFE that fails, in its words; an answer damaged in a member's local header, a compressed block, an array's header or its own bytes, or its end record, or cut short, is a RIFE that fails in the words of what reading it raised, which is its cause, and undamaged is the frame made here; each byte of the probe's, a frame's and a read's answer damaged in turn fails the RIFE or reads as it was made, nothing else raised and no other pixels handed on; a reading that cannot read what `pack` writes raises as it is, a fault of the code; an answer that is not bytes does not read; an executor named with the binary, with a device, or not there is refused and the binary never runs; a loop names the executor, and a loop whose executor's answer was damaged on the way fails with its record (`failed`, in the decompressor's words, the gait fallback's frames removed); marked `torch_rife`: `rife_torch.serve` makes the frame and the read of the backend in this process, loaded once); `tests/video/test_rife_install.py` (a zip whose model is not the pinned one installs nothing for both backends; `--backend torch` installs on a machine the binary does not run on and checks its frame through torch); `tests/release/test_lane_rife_collection.py` (a test RIFE decides carries `real_rife` or `torch_rife`); `tests/release/test_t4_lane.py` (the T4 lane installs the PyTorch and the Python the Linux lane does); new pytest mark `torch_rife` (skipped where PyTorch, the model or the named device is missing).
+
+ ## v3.2.0 - Cycle alignment hole and doubled faults, and loop repair for size held cuts
+
+ **Upgrading from 3.1.0: `video-cycle-align` now gives way to the nearer source frame on made frames with enclosed limb holes under `--between auto`, changing only alignment outputs with such holes while made frames without them and all outputs from `video-loop`, `video-loop-compare`, and `video-loop-repair` keep their bytes.**
+
+ - **New: `video-cycle-align` now reads a new `hole` fault on frames RIFE makes between source frames and gives way to the nearer source frame.** On every frame RIFE makes between two source frames, `video-cycle-align` reads a new fault, `hole` ("a hole through a limb"). Under `--between auto` (the default) a made frame with this fault gives way to the nearer source frame, like the other faults (`smear`, `outline`, `ghost`); under `--between rife` the frame is kept and named in the warnings. `video-set --align-cycles auto` runs the same alignment. RIFE runs a frame's colour and its coverage as two separate runs. Where a step opens a gap between the legs in one source frame and not the other, the coverage run can carry that gap into a leg the colour run keeps whole: the made frame shows a transparent band through the leg with the leg's fill on both sides. Nothing is added (no `smear`), there is no part coverage (no `ghost`), and the leg's own fill is the only line round the band. The fault `outline` needs both outline readings: the dark line (`outline_loss`) counts a fill darker than 70/255 (dark tights, a boot) as outline, and the rank reading (`outline_shift`) reads the band's edge as lost only where it is 50/255 lighter than the source frames' lines at the same rank, which light lines elsewhere on the art (fur, hair drawn without a dark line) can hide; so such a frame passes every fault and is delivered. The reading `rife.hole(made, a, b, t)` measures pixels under solid (alpha under 0.5) that the outside of the picture cannot reach without crossing its solid body (enclosed holes). A pixel of a made frame's hole is the source frames' own when either source frame is under solid within 4 px (`rife.HOLE_REACH`, a square neighbourhood) of where that pixel lay at that frame's time, read in place (the background, still, and a gap kept, or opened by a step where the frame that shows it open has it) and carried with the whole figure along the motion the two source frames show for the whole figure. Where a made frame sits at fraction `t` of the way from source frame a to source frame b, a pixel of it lay in a at `t` of the motion back and lies in b at `1 - t` of it on (rounded so the two are the whole motion apart). The motion is measured only from the two source frames, never from the made frame and never from RIFE's own flow: over the box round all three frames' solid bodies, each pixel is read in a where it lay and in b where it lies for a candidate motion; the motion whose mean absolute difference of premultiplied colour and coverage over the box is least is the motion there, ties going to the smaller motion. It is followed up to 20 % of the body's height each way (`rife.HOLE_TRAVEL`, 0.2), coarse to fine: the whole range on a level pooled in square blocks of a power of two, the smallest for which the range is at most 24 px each way (`rife.HOLE_COARSE`, 24), then within 2 px of twice the coarser motion on each finer level, down to the pixel. A hole those two readings leave is the source frames' own, whatever carried it (a part moving over a body that stays, plain or patterned, turning, growing, sheared or swinging), where it is one hole of each source frame. A hole is an 8-connected piece of a frame's enclosed pixels: the made frame's count where they keep a pixel opened by a 5 px square, a source frame's where they keep one opened by a 3 px square (`rife.HOLE_SOURCE_THICK`, 3). Each is read for its area, its centroid, its shape (the logarithms of its pixels' two principal second moments, each plus 1/12, over its area, which turning and growing keep) and the colour round it (the mean premultiplied colour of the frame's solid pixels 5 to 8 px out). The two source frames' holes: areas within 4 times of each other (`rife.HOLE_PAIR_AREA`, 4.0), shapes within 2 times on each moment (`rife.HOLE_PAIR_SHAPE`, 2.0), colours within 0.12 on each channel (`rife.HOLE_COLOUR`, 0.12), centroids at most sqrt(2) times the reach and 4 px apart. The made frame's hole: area within a quarter of their range (`rife.HOLE_AREA`, 0.25), shape within 1.3 times of theirs (`rife.HOLE_SHAPE`, 1.3), colour within 0.12 of each, and centroid within 4 px and 0.1 of their distance (`rife.HOLE_PATH`, 0.1) of the point at `t` on the line between theirs. Pairs are taken one to one: no hole of any frame is in two pairs taken, so each source frame's hole explains one of the holes paired. A hole of the made frame that the first two readings give the source frames takes no pair, being theirs already, and the pairing reads only the holes those readings leave: of the sets of pairs that can be taken together, the set taken pairs the most holes, and of those, has the least summed cost (the same frames always giving the same set), so alike holes moving together each keep their own two. Pairs sharing a hole form a group, read apart: an exact search first asks whether one set pairs every hole of the group, cutting branches where the holes left cannot each keep a hole of each source frame of their own; where it finds one, every hole of the group is paired, and where there is none, a second exact search finds the set pairing the most. Each search takes at most 5000 steps per group (`rife.HOLE_PAIR_STEPS`, 5000): where the first runs past them, the second runs; a group whose second search runs past them pairs none of its holes, and the frame gives way to the nearer source frame. The made frame is never used to measure a motion, and RIFE's flow is never read. The motion is read only on frames that keep a hole after the in-place reading, and the pairing only on frames that keep one after the whole figure's motion; a frame with no hole in place is read with no further cost. The regions at least 5 px thick (`rife.HOLE_THICK`, opened by a 5 px square, so a pinhole or an antialiased crevice a pixel or two wide is not counted) are taken after each step, as a fraction of the made frame's solid pixels, or 0 where the frame has no solid body. The fault `hole` is any reading over 0 (`interpolation_quality.HOLE_WARN`, 0.0). A band cut through a leg's edge, reaching the outside, is not an enclosed hole and is left to the outline readings as before.
+ - Report fields: each row of a loop's `smear` list in the `video-cycle-align` report (and in `cycle_align` in `strip.json`) gains `hole`. A frame given way for it carries `faults: ["hole"]` and `method: "nearest"`, and gets a line in `warnings`; the line says the frame opened a transparent hole inside its outline over the given share of its body, at least 5 px thick, where neither source frame beside it has one, a gap through a limb, and that the nearer source frame was taken there. The `--between` help says the same.
+ - Python callers: new `rife.hole(made, a, b, t)`, `rife.HOLE_TRAVEL` (0.2), `rife.HOLE_COARSE` (24), `rife.HOLE_REACH` (4), `rife.HOLE_THICK` (5), `rife.HOLE_SOURCE_THICK` (3), `rife.HOLE_PAIR_AREA` (4.0), `rife.HOLE_PAIR_SHAPE` (2.0), `rife.HOLE_AREA` (0.25), `rife.HOLE_SHAPE` (1.3), `rife.HOLE_PATH` (0.1), `rife.HOLE_COLOUR` (0.12), and `rife.HOLE_PAIR_STEPS` (5000); new `interpolation_quality.HOLE_WARN` (0.0); `interpolation_quality.faults(measure)` returns `"hole"` where the measure carries a `hole` reading over `HOLE_WARN`, and measures without a `hole` key are judged as before.
+ - Output changes: an alignment whose made frame has an enclosed hole 5 px thick or more that neither source frame beside it has within 4 px, in place, carried by the whole figure's motion, or paired with one hole of each source frame as above, now delivers the nearer source frame at that cell instead of the made frame, and counts it in `replaced` and `nearest_at` rather than `made_by_rife` and `made_at`. Made frames without such a hole, and frames whose holes the source frames have, in place, carried or paired, are delivered as in 3.1.0 with the same bytes; the report gains `hole` on every made frame. Synthetic numbers (the figure of the tests below): the frame between with a band 8 px wide and 40 px tall through its far leg reads `outline_loss` 0, `outline_shift` 11.3 % (so no `outline` fault, which needs both over 5 %), `ghost` 0, and `hole` 2.69 %; in 3.1.0 it is kept, now the nearer source frame is taken. The frame drawn between, the same with the arm's gap moved 3 px, and the same with a pinhole 3 px wide through the leg read `hole` 0 and are kept. A frame whose hole both source frames have, carried by a part (moving over a body that stays, plain or patterned, turning, growing, sheared or swinging within reach), is delivered as in 3.1.0 with the same bytes. Figure 5: a body that stays, patterned, with a part on it and a hole through the part's middle, the part moved from one source frame to the next, each frame between drawn exactly at its place. (i) The checkpoint validator's frame: a body 200 by 180 px with stripes 3 px wide every 6 px (a lighter colour by 40 levels), on a 260 by 220 px canvas, a part 24 px square with a hole 10 px square, moved 32 px across: the in-place reading leaves the hole whole, 100 pixels or 0.28 % of the body, and the whole figure's motion is 0; it is one hole of each source frame, alike and on its way, so it is paired: `hole` 0, and both made cells are kept as made, byte for byte. (ii) A body 240 by 260 px on a 300 by 300 px canvas in five patterns (stripes 3, 2 and 6 px wide every 6, 4 and 12 px running up and down; stripes 3 px wide every 6 px running across; checks 4 px square) at contrasts 15, 40 and 120, parts 24, 40 and 60 px square with holes 10, 17 and 25 px square: moved 32 and 48 px across and diagonally at t 0.5 (the moves listed in the test), these frames, and the same three parts moved 16, 32 and 48 px across and diagonally at t 0.25 and 0.75 over the 3 px stripes at contrast 40, every one read `hole` 0. Resampled to eight frames (t 0.25, 0.5 and 0.75 each way), parts of 24, 40 and 60 px moved 32 px diagonally and the 24 px part moved 48 px over stripes at contrast 120 keep every made frame, byte for byte. Figure 6: a torso 120 by 260 px that stays, patterned in blocks 4 px square each lighter by its own whole number up to 200 levels, with an arm beside its right edge: the upper arm and the forearm lie along that edge and are joined by the arm's outer side, so the gap between arm and torso, 16 by 12 px, has the torso's edge on its left and the arm on its other three sides; the arm reaches 48 px above and 52 px below the gap and moves 40 px down from one source frame to the next. The gap lies where the arm covers it in the other source frame, so the in-place reading leaves it, and the whole figure's motion is 0; it is one gap of each source frame, alike and on the arm's way, so it is paired: `hole` 0 at t 0.25, 0.5 and 0.75, and resampled to eight every made frame is kept, byte for byte. A frame with a gap only one source frame opens, on a part moving over a body that stays, plain or patterned, which neither the in-place reading nor the whole figure's motion carries and which has no hole in the other source frame to pair with, gives way to the nearer source frame where 3.1.0 kept it. The boundary, pinned by a test: a part 30 px square moving 32 px across a body that stays, a hole 14 px square open through it in one source frame and closed in the other, 8 px square in the frame between (half open): over a plain body and over the 3 px stripes alike it reads `hole` 0.10 % (its 64 pixels) and both made cells are given way to the nearer source frame, with `faults: ["hole"]`. Figure 7: the plate of the tests (a body 240 by 260 px that stays, striped or plain, with a plate on it and a gap through the plate, 11 by 31 px, each frame between drawn exactly at its place). The third checkpoint validator's frame, the plate turning 60 degrees as it moves 48 px over the stripes, reads `hole` 0 and is delivered as in 3.1.0, both made cells byte for byte, resampled to four and to eight; so are the plate turned 90 degrees, grown 2 times and sheared by 0.6 as it moves 48 px, and swung 45 degrees, over the stripes, and 125 such frames read `hole` 0. A frame between with a hole unlike both source frames' (the gap drawn 16 by 40 px: `hole` 1.04 %; drawn 18 by 18 px: 0.52 %; the plate growing 2.2 times as it moves 48 px, the source frames' gaps more than 4 times apart in area: 0.55 %), off its way (the plate drawn 12 px across it: 0.55 %; drawn where it is at t 0.8 in a frame made at t 0.5: 0.30 %), or out of reach (the plate swung 60 degrees, its centre moving 100 px, where 77.5 px is let through on this body: 0.55 %; the plate moving 80 px: 0.55 %) gives way to the nearer source frame with `hole` among its faults. Figure 8: the plate 120 by 40 px with a row of four holes 8 px square, 24 px apart, moving 32 px down: the frame between drawn exactly, and with the row a pixel taller, read `hole` 0 and are delivered as in 3.1.0; with one hole more (midway between two, between the last two, past the end, or one of the row moved to a midway) it reads 0.10 % and gives way to the nearer source frame. Figure 9: on the same striped body, a plate with a row of two, three or four holes 8 px square, 12 px apart, moving on a curved way, int(40 t + 20 t (1 - t)) px across and int(32 t) px down at time t, the plate moving with the holes or staying while they move through it (with two holes it is the fourth checkpoint validator's frame): the frame between drawn exactly reads `hole` 0 and is delivered as in 3.1.0, both made cells byte for byte, for two, three and four holes, the plate moving or staying; with one hole more before the row, or with the row's last hole shut in the second source frame, it reads 0.10 % and gives way to the nearer source frame. Figure 10: on the same striped body, a plate 40 by 90 px with a column of three holes 8 px square, 24 px apart, moving 32 px down, the middle hole shut in the second source frame: the frame between drawn exactly reads `hole` 0 and is delivered as in 3.1.0: its middle hole, one more than the second source frame has, lies against holes of both source frames and the in-place reading takes it for theirs; the last hole pairs with its own two. Figure 11: on the same striped body, a plate 105 px square with a hole 8 px square that the first source frame and the frame between have in place and the second source frame shuts, beside a hole moving 52 px across and 48 px down, drawn at its exact midpoint 10 px from the first (the fifth checkpoint validator's frame): the frame between reads `hole` 0 and is delivered as in 3.1.0, both made cells byte for byte, and so with the hole in place kept by the second source frame instead. Figure 12: a body 200 by 260 px outlined in black on a 400 by 400 px canvas, moving whole, with holes through it; what the reading does not tell: the body moving 32 px down with a row of four holes 8 px square, 24 px apart, and one hole more midway between the middle two reads `hole` 0 and is delivered as in 3.1.0 (so is figure 8's row standing still, drawn a pixel taller, with one hole more midway); moving 48 px across and 48 px down with a gap 5 by 30 px and one gap more 10 px beside it in the frame between, it reads `hole` 0 and gives way for `outline`, as in 3.1.0; with the gap more 11 px beside, and a gap 8 px wide with its twin 13 px beside it, they read `hole` 0.29 % and 0.45 % and give way as in 3.1.0, now with `hole` among their faults besides `outline`. The jump repair of `video-loop`, its eased retime and overlapped wrap, `video-loop-compare`, and `video-loop-repair` do not read `hole`; their measures and outputs are as in 3.1.0. A `--between-cache` directory written by 3.1.0 is not taken from by this version: the code of `rife.py` is part of what a kept frame is keyed by, so those frames are made again.
+ - **Tests**: new `tests/video/test_inbetween_hole.py`, synthetic only: figure 1 (a 160 by 200 px figure of rectangles outlined in black, legs filled darker than 70/255, the near leg drawn over the far one, an arm joined to the body above and below with an 8 px gap between them in every frame; one source frame with its legs side by side, the other with a gap between them) checks that the band through the far leg reads as a hole over exactly its own 320 pixels as a share of the solid body, and the drawn frame, the arm's gap, that gap moved 3 px, a 3 px pinhole and an empty frame read 0; that the readings before this one pass the band (`outline_loss` 0, `outline_shift` over 5 %, `dark_excess` below 0, `ghost` 0, `partial_excess` 0, no fault) and that with `hole` the fault is `["hole"]`; that resampling the two frames to four under `--between auto` takes the nearer source frame at both made cells (cells 1 and 3) with the fault named in the warning words, while `--between rife` keeps them named; and that the clean frame and the frame with the moved arm gap are delivered as the very frame made. Figure 2 (a body 120 by 180 px of one colour with a gap 8 by 40 px through it, on a 240 by 220 px canvas, moved whole from one source frame to the next by 0, 4, 8, 12, 24 and 32 px, across and diagonally) checks that at every move it is resampled to four with both made cells delivered as the very frame made, no fault, and reads `hole` 0, each source frame moved half the way giving the frame between byte for byte. Figure 3 (a body 90 px wide over two legs 24 px wide, each standing in a boot that reaches under the other leg, so a gap a step opens between the legs is closed by the boots below; in one source frame the legs touch, in the other they are parted), still and moving 30 px between source frames, is kept the same way and reads 0; and moving with an 8 by 40 px band through its body, it reads exactly its 320 pixels as a share of the solid body, in either order of the source frames, with both made cells given way to the nearer source frame and `hole` among their faults. Figure 4 (a body 200 by 180 px of one colour that stays, with a part on it 40 px square and a hole 14 px square through the part, the part moving 32 px from one source frame to the next) is kept the same way and reads 0. Figure 5 (a body that stays, patterned, with a part on it and a hole through the part's middle, the part moved from one source frame to the next, each frame between drawn exactly at its place: the checkpoint validator's frame with a body 200 by 180 px with stripes 3 px wide every 6 px, a lighter colour by 40 levels, on a 260 by 220 px canvas, a part 24 px square with a hole 10 px square, moved 32 px across; and a body 240 by 260 px on a 300 by 300 px canvas in five patterns, stripes 3, 2 and 6 px wide every 6, 4 and 12 px running up and down, stripes 3 px wide every 6 px running across, and checks 4 px square, at contrasts 15, 40 and 120, parts 24, 40 and 60 px square with holes 10, 17 and 25 px square): figure 5's validator frame resampled to four, and its parts of 24, 40 and 60 px moved 32 px diagonally and the 24 px part moved 48 px over stripes at contrast 120 resampled to eight, keep every made frame as made; the wide grid of figure 5 (every pattern and contrast at each listed move at t 0.5, and the three parts moved 16, 32 and 48 px at t 0.25 and 0.75) reads `hole` 0 and is marked slow, so it runs with `pytest --full`. Figure 6 (a torso 120 by 260 px that stays, patterned in blocks 4 px square each lighter by its own whole number up to 200 levels, with an arm beside its right edge: the upper arm and the forearm lie along that edge and are joined by the arm's outer side, so the gap between arm and torso, 16 by 12 px, has the torso's edge on its left and the arm on its other three sides; the arm reaches 48 px above and 52 px below the gap and moves 40 px down from one source frame to the next) reads `hole` 0 at t 0.25, 0.5 and 0.75 and keeps every made frame resampled to eight. The boundary test (a part 30 px square moving 32 px across a body that stays, a hole 14 px square open through it in one source frame and closed in the other, 8 px square in the frame between) checks that the half-open gap on the moving part, over a plain body and over the stripes, reads its 64 pixels as a share of the body and gives both made cells way to the nearer source frame with `faults: ["hole"]`. Figure 7: a body 240 by 260 px on a 300 by 300 px canvas that stays, in stripes 3 px wide every 6 px (lighter by 40 levels) or plain, with a plate on it (|u| < 24 and |v| < 28 px in its own axes) and a gap through the plate (|u| < 6, |v| < 16), each frame between drawn exactly at its place in one motion: the plate's centre moving across as the plate turns, grows or is sheared about it, or the plate swinging from a point 100 px above its centre. One test checks that the third checkpoint validator's frame (the plate turning 60 degrees as it moves 48 px over the stripes), resampled to four, keeps both made frames as made, and resampled to eight (t 0.25, 0.5 and 0.75 each way) every one; that the plate turned 90 degrees, grown 2 times and sheared by 0.6 as it moves 48 px, and swung 45 degrees, resampled to four over the stripes, keep both made frames; and that over the plain body each of these reads `hole` 0. A test marked slow (it runs with `pytest --full`) checks that 125 frames read `hole` 0: the plate turned 0 to 90 degrees, grown 1.1 to 2 times or sheared by 0.15 to 0.6 as it moves 0, 24 or 48 px, or swung 10 to 45 degrees, over both bodies at t 0.5, and turned as it moves over the stripes at t 0.25. A boundary test checks that, on the plate over either body, a frame between with its gap drawn 16 by 40 px or 18 by 18 px, with the plate drawn 12 px across its way or where it is at t 0.8 in a frame made at t 0.5, with the plate growing 2.2 times as it moves 48 px (the source frames' gaps more than 4 times apart in area), with the plate moving 80 px, and with the plate swung 60 degrees, gives both made cells way to the nearer source frame with `hole` among their faults. Figure 8: the same body with a plate 120 by 40 px on it and a row of four holes 8 px square, 24 px apart, through the plate. Its test checks that, the plate moving 32 px down over either body, the frame between drawn exactly and the same with the row a pixel taller keep both made frames as made; that with one hole more midway between two of the row's, between the last two, past the row's end, or with one of the row's moved 12 px to a midway, both made cells give way to the nearer source frame with `hole` among their faults; and that, the plate standing still, the row drawn a pixel taller keeps both made frames. Figure 9: the striped body (240 by 260 px that stays, stripes 3 px wide every 6 px) with a plate on it and a row of two, three or four holes 8 px square, 12 px apart, through the plate, moving on a curved way from one source frame to the next, int(40 t + 20 t (1 - t)) px across and int(32 t) px down at time t; the plate moves with the holes or stays while they move through it. With two holes it is the fourth checkpoint validator's frame. One test checks that, resampled to four, the frame between drawn exactly keeps both made frames as made, for two, three and four holes, the plate moving or staying. Figure 10: the same striped body with a plate 40 by 90 px on it and a column of three holes 8 px square, 24 px apart, through the plate, the plate moving 32 px down from one source frame to the next. A boundary test checks that, with two and four holes, the plate moving or staying, a frame between with one hole more before the row, and a frame between whose second source frame has the row's last hole shut, give both made cells way to the nearer source frame with `hole` among their faults; and that with `rife.HOLE_PAIR_STEPS` set to one step, both searches (the search for a set pairing every hole, and the search for the set pairing the most) run past it and the frame between of two holes gives both made cells way as well. Figure 11: the striped body with a plate 105 px square on it, through it a hole 8 px square that the first source frame and the frame between have in place and the second source frame shuts, beside a hole moving 52 px across and 48 px down, drawn at its exact midpoint 10 px from the first; the fifth checkpoint validator's frame. Its test checks that, resampled to four, both made frames are kept as made, and so with the hole in place kept by the second source frame instead. Figure 12: a body 200 by 260 px outlined in black on a 400 by 400 px canvas, moving whole, with holes through it. Its test pins what the reading does not tell: it checks that the body moving 32 px down with a row of four holes 8 px square, 24 px apart, and one hole more midway between the middle two keeps both made frames as made, and so do figure 8's row standing still, drawn a pixel taller, with one hole more midway, and figure 10's frame with the middle hole shut in the second source frame; that, the body moving 48 px across and 48 px down with a gap 5 by 30 px, one gap more 10 px beside it in the frame between reads `hole` 0 from either source frame to the other; and that the gap more 11 px beside, and a gap 8 px wide with its twin 13 px beside it, give both made cells way with `hole` among their faults. The test on triples alone: twenty alike holes, each with its own two holes and up to five more pairs near its own at seeded random costs. It checks that all twenty are paired, and that none is where the search for a set pairing every hole runs past the steps (the search for the set pairing the most runs past them on this group).
+
+ **Upgrading from 3.1.0: `video-cycle-align` now gives way to the nearer source frame on made frames with double outlines under `--between auto`, changing only alignment outputs with such outlines while made frames without them and all outputs from `video-loop`, `video-loop-compare`, and `video-loop-repair` keep their bytes.**
+
+ - **New: `video-cycle-align` now reads a new `doubled` fault on frames RIFE makes between source frames and gives way to the nearer source frame.** On every frame RIFE makes between two source frames, `video-cycle-align` reads a new fault, `doubled` ("a double outline"). Under `--between auto` (the default) a made frame with this fault gives way to the nearer source frame; under `--between rife` the frame is kept and named. `video-set --align-cycles auto` runs the same alignment. Where RIFE's flow does not follow a line (the top of a boot one source frame tilts and the other plants), it can fade the line out in place instead of moving it, and the made frame shows that source frame's line, lighter, in its own place, beside the line the frame drew: a double outline. Its coverage is whole (no `ghost`), nothing darker is added (no `smear`), the line is inside the body and the edge keeps its line (no `outline`), and there is no hole; the cross-fade reading (`crossfade`) only names frames to look at. So such a frame passed every fault and was delivered. The reading `rife.doubled(made, a, b)`: a frame's line is its solid pixels darker by more than 50/255 than its own luma closed by a square 2.5 % of the made frame's body height wide (`rife.DOUBLED_WIDE`, 0.025; a stroke narrower than that is a line, a dark fill wider is not). A pixel of one source frame's line is left at part strength where the three frames are solid, the other source frame draws no line within 4 px (`rife.DOUBLED_SHARED`, 4) and is lighter there by more than 50/255, and the made frame is darker than the other by more than 50/255 (still seen) but by no more than 0.8 of the line's contrast (`rife.DOUBLED_PART`, 0.8), there and at its darkest pixel within 2 px (no line at full strength beside it). Such pixels count in regions 3 px thick (`rife.DOUBLED_THICK`, 3); widened by 3 px, those that touch make one run; the reading is the longest run's length (sqrt(12) times the root of its pixels' larger second moment) over the made frame's body height. The fault `doubled` is a reading over 0.03 (`interpolation_quality.DOUBLED_WARN`). Kept as the source frames' own: a line both draw within 4 px of each other, at any strength; a line carried at more than 0.8 of its contrast (the source frame's own drawing); the soft edge of a line the flow moved (the full line lies within 2 px); a line left less than 50/255 darker than the other source frame there (not seen); a dark patch wider than the closing; a run of 3 % of the body or less. A line only one source frame draws (a crease that comes or goes), left at part strength, is a double outline too.
+ - Report fields: each row of a loop's `smear` list in the `video-cycle-align` report (and in `cycle_align` in `strip.json`) gains `doubled`. A frame given way for it carries `"doubled"` in `faults` and `method: "nearest"`, and gets a line in `warnings` with these words: "left a line one source frame beside it draws at part strength in its own place, over a run 10.21 % of its body high, a double outline, so the nearer source frame was taken there (--between auto)". The `--between` help names it.
+ - Python callers: new `rife.doubled(made, a, b)`, `rife.DOUBLED_WIDE` (0.025), `rife.DOUBLED_SHARED` (4), `rife.DOUBLED_PART` (0.8), `rife.DOUBLED_THICK` (3); new `interpolation_quality.DOUBLED_WARN` (0.03); `interpolation_quality.faults(measure)` returns `"doubled"` where the measure carries a `doubled` reading over `DOUBLED_WARN`, and measures without a `doubled` key are judged as before.
+ - Output changes: an alignment whose made frame shows a double outline over 3 % of its body height now delivers the nearer source frame at that cell instead, counted in `replaced` and `nearest_at` rather than `made_by_rife` and `made_at`. Other made frames are delivered as before with the same bytes; the report gains `doubled` on every made frame. A frame RIFE cross-fades so that both drawings' lines stay at part strength inside the silhouette over a long enough run now gives way too, still named to look at for its cross-fade (`look`); such frames were kept before because the cross-fade reading is no fault (it also reads over its line on a clean drawing between far-apart drawings, which reads no double outline and is kept). Synthetic numbers (the figure of the tests): a coat over two legs in boots outlined 3 px in near-black, the near boot lifted 18 px in one source frame and planted in the other; the frame drawn between with the first source frame's near-boot lines laid over it at 0.45 of their strength reads `outline_loss` 0, `outline_shift` 0, `ghost` 0, `hole` 0, `crossfade` 0 and `doubled` 0.102; in 3.1.0 it is kept, now the nearer source frame is taken. The frame drawn between, blurred, or smeared along the step, a hand moving 60 px over the coat, boots drawn with a second line, a hem drawn with two lines and softened, and a light crease carried at its own strength read `doubled` 0 and are kept. The jump repair of `video-loop`, its eased retime and overlapped wrap, `video-loop-compare`, and `video-loop-repair` do not read `doubled`; their measures and outputs are as before. A `--between-cache` directory written before this version is not taken from: the code of `rife.py` is part of what a kept frame is keyed by, so those frames are made again.
+ - **Tests**: new `tests/video/test_inbetween_doubled.py`, synthetic only: the figure above; checks that the line left at 0.45 passes every earlier reading and reads `doubled` 0.102, as do both source frames' lines left at half and the colour blended inside the drawing's coverage; that resampling two frames to four under `--between auto` takes the nearer source frame at both made cells with the fault in the warning's words, while `--between rife` keeps them named; that a crease only one source frame draws, left at 0.3 to 0.6, gives way, left at 0.25 reads 0, and the frames that draw it or not keep their bytes; that nine clean, soft or source-drawn frames read 0 and are delivered as the very frame made; that the walker of `tests/video/test_crossfade.py` keeps its drawing between far-apart legs (16 to 3 degrees) in grey and black outlines, reading 0, while its cross-fade gives way, and its 10 to 5 degree cross-fade reads 0.0195 and is kept; and where each bound turns (seen at 0.30 of the line's contrast, not at 0.28; part strength up to 0.80, not 0.82; a boot moved 9 px, not 8; a stroke 3 px wide, not a patch 10 px square; a run over 7 columns, 0.0343, not 6, 0.0294), and that a hand smeared back over a source frame's line reads as that line left (0.063). `tests/video/test_crossfade.py`: the alignment test of the cross-fading stand-in now expects its frames across the legs' long steps to give way under `auto` as double outlines, still named to look at, and to be kept and named to look at under `--between rife`; its 10 to 5 degree cross-fade under `auto` is kept with `doubled` under the line.
+
+ **Upgrading from 3.1.0: `video-loop-repair` can now restore damaged cells on held fixed cuts by reading source frames through recorded frame holds.** Fixed cuts held with `--size-hold auto` now record per-frame holds in `size_hold.cut_frames`. A 3.1.0 report of a held fixed cut lacks this record and stays `source-processing-unsupported`; cut it again with this version to enable repair. A report of a cut that was not held restores as before.
+
+ - **New: Held fixed cuts can now be restored from source frames.** Source projection applies each cut frame's recorded move and `padding_ltrb` before scrub, small-component cleanup, optional integer body ramp, one shared integer crop, and standard resampling. Unmodified cells must reproduce exactly, and cut frames must match `source_projection` hashes; a changed move on a replaced cell is refused as `source-processing-receipt-mismatch`. Reports without `cut_frames` stay `unknown` and `source-processing-unsupported`. Malformed `cut_frames` exit nonzero without writing a candidate. Cuts with `--anchor motion`, `motion-auto`, cycle alignment, wrap blends, or follow warps remain unprojected.
+ - Report fields (`<name>.loop.report.json`): `size_hold` records `cut_frames` on held fixed cuts, giving an ordered list of exact float entries with `scale`, `foot_point_px` (`[x, y]`), and `lift_px` (or `null`).
+ - Repair records: `projection` in repair reports and candidate `restoration` receipts gain `size_hold` (`padding_ltrb`, `cut_frames`) on held cuts, binding proposal IDs to recorded moves.
+ - Python callers: new `gait_fallback.frame_hold(k, measured, lift=None)` returns a frame's move dict, and `gait_fallback.hold_frame(frame, move, pad)` applies it to one frame. `gait_fallback.undo_scale` uses both and preserves previous byte outputs.
+ - Output changes: on a synthetic walk away (15.0 % smaller over 73 frames, feet 20 px higher) cut on frames 24 to 47 with `--anchor body`, projection reproduces 24 of 24 cells. Restoring smeared cell 9 (25 pixels) yields verdict `improved` and recovers the cell byte for byte: 119 px tall with feet on row 129 (held loop cells run 119 to 120 px tall, feet on rows 129 to 130; cut with `--size-hold off`, cell 9 is 111 px tall on row 120, and the loop spans 107 to 113 px tall, feet on rows 116 to 122). In 3.1.0 this request ended `unknown`, `source-processing-unsupported` with no candidate. For six synthetic cuts (174 files), `video-loop` matches 3.1.0 except `producer` and `size_hold.cut_frames`. For five non-held cuts (110 files), `video-loop-repair` matches 3.1.0 except `measurement_engine` and candidate report digests.
+ - **Tests**: `tests/video/test_held_cut_restoration.py` checks that the synthetic walk away cut on frames 24 to 47 with `--anchor body` restores smeared cell 9 byte for byte with verdict `improved`, matching first-cell height and row while the filmed source frame is under 0.95 height and 8 px or more higher; checks exact cell reproduction; checks that reports lacking `cut_frames` stay `source-processing-unsupported`; checks that four malformed records exit nonzero with no candidate; checks that a 1 % scale alteration triggers `source-processing-receipt-mismatch`; and checks that `frame_hold` round-trips through JSON to match `undo_scale` with and without feet held.
+
+ ## v3.1.0 - Walk and run loop gates for held animation and seam pops, size hold for fixed cuts, talking face layer and default chroma decontamination
+
+ **Upgrading from 3.0.0: Fixed walk or run cuts and clips whose feet climb or sink now hold size and feet before cutting, changing bytes when size changes by 1 % or more.** Application scan numbers change for held clips, and held fixed cuts are not restored by `video-loop-repair`. Loops cut with `--size-hold off`, clips changing size by under 1 %, held `motion-auto` cuts on one row, and non-walk cuts keep their bytes. The report records `size_hold` on fixed walk or run cuts, `size_hold.feet` when size is held, `size_hold.anchor_regions` under `--anchor motion`, and `size_hold.at_cut` on fixed cuts; `producer` names the new version.
+
+ - **New: Fixed cuts hold size before the cut is read.** Walk or run cuts using `--cycle fixed` with any anchor (`none`, `body`, `feet`, `motion`) now hold size over the whole clip before reading the cut. A fixed cut is held only where the cut itself shows the change, comparing each frame of the cut with the frame one cycle of the cut's length later, or, where the clip ends before that frame, with the frame one cycle earlier: the median of those ratios must show at least half (`AT_CUT_SHARE`, 0.5) of the clip's predicted change over that length, and feet move only where the cut shows them move the same way. Where the cut does not show the change, it is cut as filmed, and the report says why (`size_hold.why`, `size_hold.feet.why`). The report's `size_hold` gains `at_cut` on a fixed cut the clip reads a change on (`pairs`, `share`, `change`, `feet_px`, `expected`, `feet_expected_px`, `size`, `feet`). Seams, foot crossings (`cycle.step_count`), the gate, and application scans are read on held frames. Under `--anchor motion`, target regions are read where held (`size_hold.anchor_regions`). Passing `--size-hold off` keeps filmed frames pixel for pixel, recording `size_hold: {"applied": false, "why": "--size-hold off"}`. Automatic searches with `--anchor body`, `feet`, or `none`, `--cycle pinned`, and idle cuts are not held.
+ - **Changed: The size hold moves climbing or sinking feet to the first frame's row.** Where size changes by 1 % or more and feet climb or sink by 1 % of first-frame height or more (`FOOT_HOLD_MIN`), frames shift so feet stay on the first frame's row. Foot drift is read one cycle on (`gait_fallback.foot_drift`), preventing settling poses from reading as climbing feet. This stops wrap jumps from shifting into position where motion search (`motion_anchor.SEARCH_RADIUS`, 28 rows) or body anchors cannot correct them. Level clips keep their bytes. `size_hold` records `feet` (`min`: 0.01, `method`: `one-cycle-on`, `change_px`, `held`).
+ - **Note: What --size-hold off leaves in place.** With `--size-hold off`, `motion-auto` keeps its gait fallback: if the first search finds no cycle, size changes of 3 % or more (`SCALE_DRIFT_MIN`) are scaled back one cycle on with feet where filmed (`gait_fallback.scale_undone`). Cuts with `off` keep their previous bytes.
+ - **Changed: Held fixed cuts are not restored from source frames.** `video-loop-repair` reads cuts through source projection, which treats `size_hold.applied` as `source-processing-unsupported`. Recuts or scans of held fixed clips are not restored from source frames.
+ - **Output changes** Fixed walk or run cuts, scans, and `motion-auto` cuts of clips with climbing or sinking feet change bytes when size changes by 1 % or more. Across ten synthetic walkers cut four ways with `auto` and `off`, 62 of 80 keep their bytes. Changed cases are the fixed body cut and scan of eight walks changing size by 1 % or more (shrinking 7 % and 2 %, growing 20 % and 2.5 %, slow walk shrinking 7 %, two walks away, settling walk growing 2.5 %), plus `motion-auto` of the two walks away. On a walk away (15 % smaller, feet 20 px higher), a fixed body cut refused at seam ratio 6.83 passes held at 1.25 (size alone failed at 10.03); shrinking 2 % moves from 3.80 to 1.46; a walk whose feet climb 96 px refused under `motion-auto` at 13.03 passes held at 1.08. Scan ratios drop on the 7 % shrinking walk from 1.16 to 0.52, and on the walk away from 1.66 to 0.42. Shrinking 7 % cut by hand drops from 7.97 to 2.04 (still refused), and a slow walk shrinking 7 % from 18.31 to 4.48. The walk away under `motion-auto` moves from 0.79 to 1.41 because feet are held on row before cutting rather than closed by motion ramps. On test fixtures, a run filmed from a standing start that raises and waves its arm and crouches reads 6.9 % smaller over the clip while its cut shows 0; a walk of 26 frames cut 20 long reads 2.5 % larger over the clip while its cut shows 0; walkers that grow or shrink show 0.94 to 1.07 of predicted change at the cut; and every synthetic case gives the same bytes with this rule as without it.
+ - **Python callers** `gait_fallback.foot_drift(frames, measured)` returns `min`, `method`, `change_px`, `held`, and `lift` (frame shifts in px, None when not held). `gait_fallback.FOOT_HOLD_MIN` (0.01) is added. `gait_fallback.undo_padding` and `undo_scale` take `lift=None`. `gait_fallback.held_box(box, k, measured, pad, lift=None)` maps filmed frame `k` boxes to held coordinates. `gait_fallback.at_cut(frames, measured, feet, *, start, length)` is added and returns that record; `gait_fallback.AT_CUT_SHARE` (0.5) is added.
+ - **Tests** In `tests/video/test_gait_fallback.py`: fixed cuts of the walk away and 2 % shrinking walker pass held under 2.0 seam ratio, wrap changes matching internal steps (size-only hold fails on feet); `motion-auto` on the 96 px climbing walk passes held on row with motion anchor applied; `--size-hold off` gives filmed frames pixel for pixel and records why; stable walkers keep identical bytes under `auto` and `off` and record not held; idle fixed cuts omit `size_hold`; foot drift reads 21 px for the 20 px walk away, 0 for level walks, and 0 for settling poses (fitted lines read 2.7 px); held walks away need no top room and `held_box` aligns head boxes; `--anchor motion` regions match held positions; forward walks mark feet not held while walks away close at feet; a hand cut of the run with earlier motion and of the short walk is not held, `size_hold.at_cut` shows 0 over all pairs, the report says why, and strip and frames match `--size-hold off`; held fixed cuts show the change at the cut (`size_hold.at_cut.size`, and `feet` for the walk away); a synthetic walk away from the camera (15 % smaller by the end, feet 20 px higher), cut by hand on the last 24-frame cycle of a 72-frame clip with 0, 1 or 5 of the cut's own first frames repeated after it, and the same walk cut on its first cycle with 0, 1 or 5 of the cut's last frames placed before it, is held each time on 24 pairs, one for each frame of the cut (the repeated frames show no change against the cut), and the loop passes the seam gate. In `tests/video/test_loop_silent_pass.py`: the walk away jitter test passes `--size-hold off` so feet climb crop rows as before.
+
+ **Upgrading from 3.0.0: Bakes retain the same bytes for figures whose anatomy is unchanged. The `pixel` refusal message now names the sides and pixel counts. A figure that had `face-absent` may now have a face, with a lower rigid boundary only when that face ends below the neck. `video-sway-inspect` records use schema 3, and a cell whose every offset is 0 is now copied as it was, including colour under clear pixels with `--gain 0`; the other changes add options, and without them the strip, records and inspection stay as before.** Smooth bakes that leave the in-breath share out keep their bytes. A smooth `breathe.json` config and a breath sway's `drive` record now carry `inhale`, Python callers of `smooth_wave` and `smooth_shoulder_wave` must pass the share, and `breathe.INHALE` is gone. A smooth `breathe.json` config and a breath sway's `drive` record now also carry `start_cell` (0 when left out) and `loop_cells` (null when left out), and a record without them reads as the loop itself from its first cell.
+
+ The Breathe layer still supports `pixel` and `smooth`.
+
+ - **Changed: Pixel refusal.** `pixel` still refuses stretched content past the top, left, or right of a cell instead of cropping it.
+ The message names each side and its opaque pixel count. A pixel past a corner counts on both sides.
+ When an overflowing side is the drawing's own border, the message also gives the number of pixels covering that edge.
+ It advises `--mode smooth` or sidecar `mode: "smooth"` for an illustration cut by its frame.
+ It advises a wider cell margin or lower `depth` for a pixel sprite.
+ It warns that padding, baking, and cropping back silently loses pushed off content.
+ The curator preview uses the same refusal wording.
+ The border reading follows the 2% rule in [video pipeline](docs/video-pipeline.md) section 3.
+ See [breathing](docs/breathing.md) for behavior at frame edges.
+ - **New: Second eye pair search.** It runs only when the existing search finds no pair.
+ Its minimum eye area is 0.2% of opaque pixels above the neck.
+ Its eye width to height limit is 3.0, and its minimum eye center distance from the body axis is 0.02 of content width.
+ Pair placement, separation, size similarity, and row overlap conditions remain the same.
+ A face found by this search clears `face-absent`. It lowers the boundary only if the face ends below the neck.
+ - **Faster: Breathe bakes.** Array operations speed up pixel outline thinning, appendage weights, and row mapping.
+ `smooth` solves displacement only for pixels that move.
+ Anatomy and settings checks run once per row, and `sprite-gen breathe` shares one anatomy measurement between its report and bake.
+ On synthetic 960 x 960 cells with Apple M1, bake time fell from 0.20 s to 0.10 s for `smooth`.
+ For an outlined figure with arms in `pixel`, it fell from 0.98 s to 0.05 s.
+ These measurements exclude PNG reading and writing.
+ `bake_breathe_sequence(images, cfg, anat=None)` and `anatomy_report(images, cfg, anat=None)` accept measured anatomy.
+ `protect(anat)` accepts one column or an array of columns.
+ - **New: Sway on a cycle's frames.** `video-sway --frames` moves full-size frames and writes them with `sway.json` to a new folder.
+ A whole `cycle/` can supply its frame time; other damped-mass runs require `--fps`.
+ - **New: Sway on the breath.** `--breathe` drives the move from a checked smooth `breathe.json`, with `--lag` setting how late the part follows.
+ The first cell, rests and close have zero offset.
+ - **New: A region moved whole.** A fifth `--region` number, `flat`, keeps the centre at full weight before the weight falls to the rim.
+ - **New: Across apart from down.** `--gain-across` sets the across gain separately from `--gain`, which sets the gain down.
+ - **Changed: Zero-offset cells.** A cell where no region moves is copied byte for byte, including colour under clear pixels.
+ - **Changed: Inspection seams.** `video-sway-inspect` drops a pair's seam points covered by a third moving region.
+ Its record uses `schema_version` 3.
+ - **New: Breathe beat chosen to miss the hands.** In `smooth` mode, `--avoid-region` chooses a breath beat whose peaks keep the chest above the hands' own rise and records the choice in `breathe.json`.
+ - **New: The in-breath share.** The smooth sidecar key `inhale` is the share of one breath the in-breath takes; the in-breath peaks at that phase and the rest of the breath is the out-breath.
+ Default 0.40, range 0.2 to 0.8 with both ends allowed; out-of-range values are refused, not clamped, and a pixel row refuses the key.
+ With the key left out or at 0.40 every bake is byte-identical to before.
+ With `breath_peaks`, the rest between peaks p and q is at p + (1 - inhale) x (q - p).
+ `sprite-gen breathe --inhale S` sets it, and the normalized smooth config in `breathe.json` always carries it.
+ `--avoid-region` scores every candidate on the row's own `inhale` curve, the curve the bake uses.
+ Sway `--breathe` takes the chest curve, the late curve and the phase check at the record's share, so `breath_peaks` phases written at another share are accepted when they match.
+ A record without the key reads as 0.40 and sways exactly as before, and a hand-written record for a breath made elsewhere can state its share.
+ The sway record's `drive` now also carries `inhale`.
+ The curator sidecar round trip keeps `inhale` as written and its range table mirrors 0.2 to 0.8.
+ - **New: A stretch of a loop.** A loop set has an idle loop and short pieces that leave it or join it part way through a breath, and such a piece can now be breathed and swayed on the loop's own breath instead of being padded into a sequence and cut out by hand.
+ The smooth sidecar key `loop_cells` is the number of cells of the loop the row carries the breath of, an integer of 2 or more, and `start_cell` is the loop's cell the row starts at, an integer from 0 to loop_cells minus 1, default 0.
+ Cell i of the row has the phase of the loop's cell (start_cell + i) mod loop_cells, the very same floating point value, the beat (`breaths`, or `breath_peaks` whose cells are cells of that loop) is the loop's, and the row's first cell is then not necessarily at rest.
+ With `loop_cells` left out or null the row is its own loop, with both keys left out phases and bakes are byte identical to before, and the normalized smooth config in `breathe.json` always carries `start_cell: 0` and `loop_cells: null`.
+ `sprite-gen breathe --loop-cells N --start-cell K` sets them; `--avoid-region` is refused with either, since the beat is chosen on a whole loop's frames and a stretch carries on its loop's beat.
+ `sprite-gen breathe --reference FRAME.png`, in any mode, measures the row's anatomy (head line, chest, how far it rises and its place in the frame) on that frame instead of the row's first frame, normally the loop set's first cell, and `breathe.json` records `reference` with the file's `path` and `sha256`.
+ Sway `--breathe` reads `start_cell` and `loop_cells` from the record, recomputes the phases with them and offsets a stretch's cell i exactly as the loop's cell (start_cell + i) mod loop_cells, from the stretch's first cell on, with nothing wound up before it.
+ The fold rule and `--stretch-floor` read the loop's whole breath, so a stretch moves by the same gain as its loop and the seams between them do not jump; the record's `reach_px`, `fold` block and `least_cell` are the loop's, and `least_cell` is a cell of the loop.
+ `sprite-gen video-sway --reference FRAME.png`, only with `--frames`, names the frame the regions were read on; each frame's body motion is read with it laid first, `body_px`, `body_worn_px` and `body_bob_px` come from or span it, and `sway.json` records `reference` with `path` and `sha256`.
+ The sway record's `drive` now also carries `start_cell` and `loop_cells`, and a record without the keys reads as the loop itself from its first cell and sways exactly as before.
+ Refused, never clamped or wrapped: either key on a pixel row, a negative or non integer `start_cell`, a `loop_cells` under 2 or non integer, `start_cell` at or above `loop_cells`, `start_cell` at or above the row's cell count with `loop_cells` left out (at the bake), `breath_peaks` whose last peak is within one cell of the end of `loop_cells`, a `--reference` of another size on either command, and `--reference` with `--loop-dir`.
+ The curator sidecar round trip keeps `start_cell` and `loop_cells` as written and its range check mirrors the Python refusals.
+ - **Changed: Breath curve functions.** `breathe.smooth_wave(t, inhale)` and `breathe.smooth_shoulder_wave(t, lag, inhale)` now require the share.
+ The module constant `breathe.INHALE` is removed; the default lives in `curation.BREATHE_SMOOTH_SHAPE["inhale"]`, and `breathe.smooth_inhale(cfg)` returns a row's share.
+ `breath_beat.choose(images, lift, inhale, avoid, anchor, frame_ms)` and `breath_beat.nudged(n, k, inhale)` take it as well.
+ - **Tests:** `tests/effects/test_breathe.py` checks border counts, advice, smooth edge preservation, and the second face search.
+ `tests/effects/test_breathe_js_mirror.py` checks curator refusal wording and byte identity with the pixel bake.
+ `tests/effects/test_breathe_smooth.py` checks pixel and smooth byte goldens and shared anatomy and strain measurements, and that the in-breath takes the row's share: at share 0.42 the cells at phases 0.21 and 0.42 are byte-identical to the default row's cells at 0.20 and 0.40, `breath_peaks` rests at the share, out-of-range and pixel values are refused, and the CLI flag is honoured.
+ `tests/effects/test_breathe_smooth_curator.py` checks that the sidecar round trip keeps `inhale`.
+ `tests/effects/test_breathe_publish.py` checks that the stand-in bake accepts the new argument.
+ `tests/video/test_sway_frames.py`, `tests/video/test_sway_breath.py`, `tests/video/test_sway_flat_across.py`, and `tests/video/test_sway_seams.py` check the Sway paths, drives, weights, gains and seams.
+ `tests/video/test_sway_breath.py` also checks that the sway follows the share the record says for `breaths` and `breath_peaks`, that a record without the key sways as the default, and that the default breath sways the same bytes as before the change.
+ `tests/effects/test_breathe_smooth.py` also checks that a stretch's cell i has the loop cell (start_cell + i) mod loop_cells phase for `breaths` and `breath_peaks` (inside the loop, past its close, the whole loop, and the loop turned), that a stretch has exactly the phases the pad hand step gave, that a row without the keys is its own loop, the stretch refusals, that the CLI bakes what the sidecar bake bakes, and that `--reference` measures the anatomy on that frame, bakes with it and records it.
+ `tests/effects/test_breathe_smooth_curator.py` also checks that the round trip keeps `start_cell` and `loop_cells` and that rows the bake refuses are kept and reported.
+ `tests/video/test_sway_breath.py` also checks, on a synthetic bust, that a 17 cell way out of a 48 cell loop of two breaths, starting at the loop's cell 13 with its body 0 to 3 px across, is offset as the loop's cells are, at the gain the loop is lowered to by the fold rule, a gain at which the 17 cells alone would not fold; that engine commands give the pad hand step's phases, offsets, fold, gain, reach, carry and cells byte for byte; that without `--reference` the carry is off by where the body lies in the first frame; that old records without the keys sway as before; and the `--reference` size and `--loop-dir` refusals.
+ `tests/effects/test_breath_beat.py` checks beat choice and refusals, and that each beat candidate is read on the row's share.
+ `tests/video/test_follow_stretch_floor.py` and `tests/video/test_follow_inspect.py` cover the changed inspection schema and frames options.
+
+ - **Tests**: A plain `pytest` runs a fast bundle: tests marked `slow` are deselected, the header points to `pytest --full`, and the summary counts deselections. `pytest --full` runs every test. The release lane, `scripts/linux_lane.sh`, passes `--full` to both `pytest` calls, including `-m real_rife`, so its gate still runs every test. `tests/release/test_fast_bundle.py` checks both calls and probes selection with and without `--full`. The `slow` rule in `pyproject.toml` is 1 s per case or 5 s across a function's cases on an 8-core M1 running the whole suite; marking a function marks every case. Five tests remain unmarked as the only fast callers of `video-stop`, `workflow`, `defaults`, `video-sway`, and `export-aseprite`. Three fixture-first tests remain unmarked because other fast tests build their fixtures. In `tests/frames/test_ui_kit.py`, the fast bundle keeps 16 of 512 scattered-drawing grid seeds, 8 of 256 full-size-frame band grid seeds, 9 of 256 missing-element sets, 2 of 17 counterexample sheets, and one placement and start in each publish sweep. `tests/curate/test_anchor_selection.py` extracts each run once per module instead of repeating 1.5 to 2.6 s of setup per test; 25 of 27 affected tests are now fast. Removed `tests/video/test_loop_overlap.py::test_a_tail_on_its_own_beat_is_closed_at_the_wrap_with_the_clips_frames_a_cycle_apart[on]`; its wordless case makes the same call with the default "on". Removed `tests/video/test_walk_steps.py::test_cycle_align_takes_a_loop_cut_two_steps_as_one_cycle` and `tests/video/test_one_step_cut.py::test_cycle_align_takes_the_loop_cut_again_on_its_count`; `tests/video/test_loop_prop_seam_held.py::test_cycle_align_aligns_a_two_step_loop_as_the_one_cycle_it_is` covers alignment from recorded `steps: 2`. Merged `tests/video/test_loop_overlap.py::test_the_cli_passes_overlap_wrap_off_and_on_is_its_default` into `tests/video/test_loop_overlap.py::test_with_the_overlapped_wrap_off_nothing_is_read_for_the_wrap_and_the_gate_refuses_the_cut_as_filmed`, retaining both sets of assertions on one CLI cut with `--overlap-wrap off`. In a new virtual environment, the former suite ran 7,881 tests (7,880 passed, 1 skipped) in 21 minutes 54 seconds; `pytest --full` now runs 7,881, including two new release tests, and the fast bundle runs 6,555 in about 6 minutes. Package code, commands, and outputs are unchanged.
+
+ **Upgrading from 3.0.0: the `sprite-gen logo` text checks read a refused image once more before refusing it, and on codex they read on a fixed model and effort.** A mood or logo reading of `mismatch` or `no-text` is read again, up to `logo.MAX_READS` readings, which is 2. One reading that spells the asked text passes. An image is refused only when every reading differs. A logo now costs four to six calls: two images and two text checks, each read once or twice. Beyond a check's second reading nothing is sent again on its own. On codex the text checks no longer follow the login's `~/.codex/config.toml`. They read on `gpt-6-sol` at reasoning effort `high`, and the report names the model and effort of every reading. **`sprite-gen logo` refuses a chroma key that is one of the title's own colours, and a cut that is see-through inside its letters.** A letter colour in the key's hue is, by its pixels, a mix with the key, so the matte cuts it see-through. `--chroma-key auto` now skips a key whose hue covers 5 % or more of the title's box in the mood image, or 1 % when the brief names a colour in that hue. When both keys are the title's colours, the run is refused at the new step `key` before the lettering image is bought. After the matte, see-through pixels walled in by the lettering, farther from it than the logo's own glow reaches, refuse the logo at `matte` on 1 % of the visible lettering or more. A run that went through before with a key in the title's hue, or with a see-through cut inside its letters, is now refused at `key` or at `matte` instead of passing with `status: ok`. Runs whose title carries neither key's hue pick the same key as before.
+
+ - **A misreading is read once more before it refuses an image.** Before, each check read the image once, and one misreading refused it. A model reading stylised lettering can read the same picture two ways, so a correctly drawn title could be refused on one reading. Both checks use the one rule, `logo.read_text`. A call that fails is not asked again. With no reading before it, the check is `unverified` as before. With a misreading before it, the misreading stands and the image is refused. A refusal message names every reading, for example `the mood image reads ['IO'] and then ['I0'], not ['ION']`. docs/logo.md records a measurement on a synthetic pixel title drawn one stroke short (the Hangul syllable 쿠 drawn as 구, the middle bar of ㅋ left out). The codex reader at gpt-6-sol/high read it as 구 in 10 readings of 10 and never as 쿠, so neither one reading nor a check of two readings (0 of 5) passed the wrong picture. A second reading can only pass a wrong picture if the reader writes a stroke that is not drawn.
+ - `logo.report.json`: `text_check.mood` and `text_check.logo` keep the deciding reading's `verdict` and `read` and gain `max_reads` and `readings`, each reading in order with its `reading` number, `verdict` and `read` lines, or `reason` when it could not be read. `calls` lists a check's call once per reading, each with `reading` (1 or 2) and `effort` (`null` where the provider names none).
+ - Codex reader: the text checks run `codex exec --model gpt-6-sol -c model_reasoning_effort="high"`, named on each call, so a check's verdict does not change with the machine it runs on. Before, each machine read on its own config and the report recorded `model: null`. The values are `facing_vision.CODEX_READ_MODEL` and `facing_vision.CODEX_READ_EFFORT`. `--model` still names the images' model only. The facing check still runs on the login's config, unchanged. The xAI and OpenAI text checks read on their own fixed models, as before.
+ - Python callers: `logo.read_text` returns `(check, calls)`, a list of call records, instead of `(check, call)`. `facing_vision.codex_inspect` takes optional `model` and `effort` keyword arguments. Without them its command line is as before.
+ - **With `--chroma-key auto`, a key in the title's hue is not chosen.** `logo_matte.choose_key` rules out a key whose hue is 5 % or more of the title's box (`logo_matte.CLASH_HUED_PCT`), or 1 % (`logo_matte.NAMED_CLASH_HUED_PCT`) when `--style` or `--scene` names a colour in its hue (`logo.KEY_COLOUR_WORDS`: green, mint, lime, emerald, jade, chartreuse for green; magenta, fuchsia, pink, purple, violet, plum, orchid for magenta). A word alone never rules a key out; the pixels decide. The keys left are scored as before. When both keys are the title's colours there is no third: the run is refused at `key` (`refused_at: key`) before the lettering image is bought. The message gives each key's share and the brief's words for it and says to restyle the title without one of the two hues or to name the key to lose with `--chroma-key` (`--mood <mood.png>` skips the mood image). An explicit `--chroma-key` is kept; when it is one of the title's colours, a warning says so. Before, such a cut passed with `status: ok`, no warning, `key_hue_left` 0 and a matching text check.
+ - **A cut that is see-through inside its letters is refused at `matte`.** `logo_matte.see_through_inside` measures see-through pixels (coverage under 240 of 255) walled in by opaque lettering and farther from it than the logo's own glow reaches beside it. Walled in means no way out to the picture's edge except across opaque pixels: the way out starts from the transparent pixels on the edge of the trimmed logo and runs through transparent pixels and see-through ones; a see-through gap of 2 px or narrower does not count as a way, a transparent gap of any width does. A hole joined to the outside, even through one pixel, is outside; a transparent hole walled in by the letters (an O's counter, or a letter colour cut all the way to nothing) is no way out, and a see-through patch round such a hole is still counted inside. Transparent pixels are never counted, only see-through ones. The same way out decides the glow's reach (`glow_reach_px`): the 99th percentile of how far the see-through pixels that have a way out to the picture's edge lie from the opaque lettering, and at least 2 px. On 1 % of the visible lettering or more (`logo_matte.INSIDE_MAX_PCT`) the logo is refused before its text is read, the cut is kept as `logo.rejected.png` and the preview is written. The message says to generate the lettering again on the other key or to restyle the title without that colour. Only the logo matte's own cut (`method: logo-unmix`) is refused; a lettering image returned with its own alpha is measured, not refused. A glow fades out beside the letters and pools in a counter no farther than it reaches there, so glows are not counted.
+ - `logo.report.json`: `steps.key.scores.<key>` gains `named`, `clash_at_pct` and `clashes`, and `steps.key.key` is `null` when refused at `key`. `logo` gains `see_through_inside` with `px`, `pct_of_visible`, `glow_reach_px`, `max_pct` and `wide`. `refused_at` can now be `key`.
+ - Python callers: `logo_matte.choose_key(mood, box=None, named=None)` takes `named`, the brief's colour words per key from `logo.named_colours(style, scene)`, and returns `key: None` when both keys are the title's colours. `logo_matte.see_through_inside(image)` is new.
+ - **Tests**: `tests/gen/test_logo.py` checks that one matching reading is the whole check, that a misreading read again as asked passes at either check, that two misreadings refuse the mood image and refuse the logo and keep it aside with a refusal naming both, that a check reads no more than `MAX_READS` (set to 3, a third reading is taken), that a failed call is not asked again, that a misreading stands when the second call failed, and that the report names the reader model and effort of every reading. The existing refusal tests now script two misreadings. `tests/gen/test_vision_read.py` checks that codex reads on the named model and effort, passed before the image list, that docs/logo.md names both values, and that the facing check's command carries neither. `tests/frames/test_logo_matte.py` checks that a title in both keys' hues (synthetic patchwork letters: pink and plum in magenta's hue, mint in green's) gets neither key, that a colour in a key's hue rules the key out, that a colour the brief names rules it out at the smaller share while the same share unnamed and the word with no such pixels do not, that on green the mint patches are cut see-through and found inside (9.5 % of the visible lettering) while the other key keeps them and finds nothing, that six glow fixtures (a white glow, an outlined cyan glow, a cyan glow pooled in an O's counter on green and on magenta, an orange glow on green, pixel lettering) find nothing inside, that a mint patch walled in by a navy letter on green is still found inside, with the glow's reach at 2 px, when one or four squares of the key in it are cut to nothing, that a hole glued to the letter's edge is inside while sealed and outside once one pixel joins it to the key round the letter, and that big hollow O and A letters find nothing inside, plain or with a glow pooled round a counter whose middle stays clear (three glows). `tests/gen/test_logo.py` checks that a title in both keys' hues is refused at `key` before the lettering is bought, that a named key in the title's hue is kept and the warning says so, that a see-through cut is refused at `matte` and kept aside with no text check, with or without a 9x9 square of the key in the middle of its patch, and that a glowing title is not see-through inside. `tests/logo_lettering.py` gains the `quilt` fixture: square fabric patches in outlined pixel letters, one with a counter, on a key. It also gains `walled_patch` (a navy letter with a mint patch on pure green, with squares or a pixel of the key painted in) and `hollow_letters` (the big O and A shapes), which `lettering` draws through its new `shapes` argument.
+
+ **Upgrading from 3.0.0:** Existing runs and commands do not change. This release adds two verbs and a JavaScript player. The wheel now also carries `sprite_gen/video/*.mjs`.
+
+ - `sprite-gen video-face` builds a face pack from a reference, a keyed talking clip, and keyed body motions.
+ - `sprite-gen face-bake` runs the pack's player through node to bake a voice onto body frames, with optional MP4 and beside video output.
+ - Face request kind `sprite-gen-face-request`, version 1, records face geometry, clip placement, a rest loop, and optional own-mouth spans or timelines.
+ - Face pack kind `sprite-gen-face-pack`, version 1, carries sprites, body cells, anchors, keeps, rules, a report, a copied player, and SHA-256 digests.
+ - The lower-face layer covers the mouth, jaw line, cheeks, and chin. The body's own dark grey and black that reach in from the layer's boundary, such as a headset boom or a choker, the body's own lines in the layer's feather, and a hand that reaches over the face from outside the layer stay above it.
+ - Each body frame receives a place, size, and tilt anchor. The pack records anchor residuals and corrects outlying readings against neighbouring frames. A body frame whose own mouth is closed has its place read again on a ring of skin round the mouth, because a head that turns moves its hair, headset, and cheeks further than its mouth, and a frame whose mouth is open takes the move of the read frames round it. The pack records each frame's move and the frames read on the ring.
+ - Talking frames are assigned to smile or neutral sets by closed-mouth lift. Entry chooses a matching set and rest.
+ - The player `sprite-gen-face-v1.mjs` contains the voice flap, face pick, scene plan, and live canvas playback rules.
+ - A clip's own mouth and sound finish before a requested line starts. The voice and layer then wait together for the first frame whose switch to the chosen rest is within the 1.4 jump line. Layer exit also uses that jump line.
+ - The live player keeps one queue of every `play` and `say` request, in the order the calls are made, and starts each request on the frame after the one before it has ended, so two voices never overlap. A line placed right after a clip with its own mouth is planned together with that clip, the plan `planScene` makes and `face-bake --play` bakes, and its voice and layer start at the plan's `line_start` after the own-mouth span. The queue has no length limit and drops nothing: a request whose sound does not load or decode, or whose line `planScene` refuses, rejects its promise when its turn comes, and the next request goes on.
+ - Bakes check pack digests, changed pixels outside the weight, and composite jumps. Refused bakes retain their frames for inspection.
+ - See [docs/face-parts.md](docs/face-parts.md) for the request, pack, player, commands, and limits.
+ - **Tests**: `tests/video/test_face_layer.py` uses `tests/talking_face.py` to check smile and neutral sets; clip entry set and rest; own-mouth timelines, including a close during voiced sound and refusal of a missing or never-closing timeline; a head 60 px from its place and tilted 3 degrees; a head that turns, tilting up to 5 degrees about its mouth while its hair, headset, and cheeks move up to 12 px sideways and its mouth stays where it is, with two of its eleven frames open, whose anchor place is within 1 px of the mouth on closed frames and within 2 px on the two open frames and whose tilt is the band's, below minus 2.5 degrees where the turn is fullest; hand, headset boom, and choker keeps; a tongue in the body's own open mouth, joined to a hand by a finger at its corner, covered by the layer; unchanged pixels outside the weight; synthetic cells keeping the key's colour under no coverage; digests and new-folder pack writes; the player flap against its original numpy rule and the pick against the draft Viterbi over every frame; a line waiting for a clip's own mouth and for a frame its layer can come on at; the live player run by node on a fake audio clock, with two lines requested during a greeting's own mouth, three lines requested on the loop, one line requested during the own mouth and one after it, a line whose voice loads late, a line requested right after a clip whose sound loads late, a line whose voice loads only after the greeting's own mouth has ended or only after the greeting has ended, which waits for the greeting to end while the greeting plays to its end with the layer off, a line that plays on the loop when requested right after a clip whose sound fails to load, and a request that fails; loop and post-greeting bakes with greeting frames unchanged byte for byte; and refusal of a changed pack.
+
+ **Upgrading from 3.0.0: This release changes defaults for video frames.**
+
+ Outputs that change bytes are frames from `video-frames` and `video-set` on a green or magenta key.
+ These changes occur within 6 px inside the keyed silhouette only.
+ Video frames keyed with explicit `--decontam palette` also change bytes, because they use the same video fit.
+
+ Outputs that do not change bytes include runs on a white key, subjects with no interior, and runs with `--alpha-mode brightness`.
+ Stills (`cutout`, `gen`) and row extraction (`extract`, `inspect`) do not change bytes.
+ Runs with `--decontam off` also give the 3.0.0 bytes back exactly.
+
+ To get the 3.0.0 frames back, pass:
+ `--decontam off`
+
+ - **Default change: `video-frames` and `video-set` now default to `--decontam auto` (before: `off`).**
+ This release updates these defaults to clean chroma-bleed edges automatically.
+
+ On a chroma key, H.264 4:2:0 chroma mixes key colour into strands one to three pixels wide.
+ With decontamination off, a red hair strand on green keeps an olive rim.
+ The `auto` pass restores the subject's own colour to those edges.
+
+ The video default stayed `off` until now out of caution rather than any known defect.
+ The pass was benchmarked on a green key only.
+ The video fit is less decisive than the still fit.
+ In the documentation's benchmark table, the video-fit row (10.8 % residual contamination, 9.38/8.73 halo, 91.4 % recall) was measured in September 2026 with flank recovery.
+ It has not been remeasured since flank recovery was dropped, because those benchmark inputs and tools are not at hand.
+ The diagnosis table in `docs/chroma-alpha.md` (its `decontam` section) has the current video fit's numbers.
+ Still-fit rows in that table are unchanged.
+
+ Earlier fixes resolved the Grok-magenta regression through the key-hue cap and corrected the frame-edge interaction.
+ No blocking defect remains known.
+
+ On synthetic diagnosis clips (CRF 18, `--spill small`, 6 frames, one machine), `auto` reduced key contamination on red strands on painted green from 24.2 % to 10.2 %, and on pure green from 27.4 % to 10.9 %.
+ Halo composite error on dark and white backgrounds shifted from 11.6/12.1 to 9.6/10.1 on painted green, and from 12.0/11.9 to 10.0/9.9 on pure green.
+ Strand recall stayed at 91.4 % on painted green and 92.4 % on pure green.
+ Strand recall no longer rises with the pass, because that gain came from the flank that the video fit no longer recovers.
+ Halo gains are smaller than before for the same reason.
+ On these moving scenes, key contamination is about one point higher than with the hold and settle alone, because a change of call now takes a few frames to reach the fit's colour.
+
+ Key contamination dropped from 3.4 % to 0.5 % on magenta, and from 5.4 % to 1.8 % on Grok darker magenta.
+ Halo shifted from 15.0/19.6 to 12.7/16.4 on magenta, and from 20.7/31.5 to 19.3/30.0 on Grok darker magenta (compared to 17.1/24.7 when flank recovery was present).
+ Strand recall shifted from 87.0 % to 86.9 % on magenta and from 73.3 % to 73.2 % on Grok darker magenta.
+ Outline ink CIELAB error shifted from 19.3 to 20.2 on magenta, and from 21.7 to 22.6 on Grok darker magenta.
+ Red hair counts as key-coloured material there, so the palette is not key-free and the warning line appears.
+
+ Contamination dropped from 20.6 % to 8.8 % on a translucent glow scene (halo 12.6/9.4 to 11.7/8.5, strand recall 85.7 % to 85.4 %).
+ It dropped from 23.8 % to 11.4 % on a small green charm scene (halo 11.8/12.9 to 10.0/11.1, strand recall 90.7 %).
+
+ Changed pixels make up about 2.4 % of each frame (4.7 % in translucent scenes).
+ All changed pixels lie within 6 px inside the silhouette.
+ Nothing outside the silhouette changes any more.
+ Interior pixels remain byte-identical.
+
+ Stills (`cutout`, `gen`) and row extraction (`extract`, `inspect`) still default to `off`.
+ The row extractor frames are a derived cache that `heal` re-derives, so changing their default would silently rewrite existing runs.
+ Stills remain as they were.
+
+ - **Temporal fit: The video fit holds edge decisions across frames, blends a change of call over frames, settles still pixels, and drops flank recovery.**
+ With default `auto`, the edge of a subject standing still sparkled from frame to frame where `--decontam off` remained calm.
+ Codec noise pushed edge pixels across the pass's threshold tests from frame to frame.
+ These tests decide blends, tints, material behind, explained pixels, palette colours, and flank coverage.
+ Each crossing changed the written colour by far more than the noise itself did.
+ The raw matte with `off` follows codec noise smoothly, staying calm despite keeping an olive rim.
+
+ `video-frames` and `video-set` now maintain a clip history in clip order.
+ This history passes to each frame through `decontaminate` as `history` (`decontam_history` in `cutout` and `remove_chroma_background`).
+
+ Each test now holds its previous outcome at that pixel until current evidence passes the bar the other way by 16 (an RGB distance, `VIDEO_HOLD`).
+ A palette colour picked in the previous frame stays unless another colour's line passes closer by 16.
+ Moving pixels change their evidence far beyond 16 and are decided afresh.
+ Only near-threshold calls stick.
+ With the hold alone, a call that did change could still move a still edge through the whole gap between the matte and the fit in one frame.
+
+ The blend mixes two renderings made from this frame's evidence at every pixel the pass examines.
+ One is the matte with its key hue capped, and the other is the fit's palette colour at the pixel's light, with the fit's coverage where the call refits coverage and the matte's coverage elsewhere.
+ For a palette-colour change, the fit's rendering mixes the two colours' renderings.
+ A new palette colour waits until the change in hand is done, while a return to the old colour turns that change around.
+ The mix moves toward this frame's call by at most 0.2 a frame (`VIDEO_BLEND`).
+ It moves less if needed to limit the output change to 4 (`VIDEO_STEP`) plus 0.25 (`VIDEO_STEP_MOTION`) per unit the source moved, measured in premultiplied colour or coverage across its 3x3 box.
+ A pixel new to the band starts at its call if it was transparent in the previous frame, and otherwise starts from the matte.
+ Both renderings follow a moving subject at once; the change of call is spread over frames.
+
+ A still pixel whose mix moved, has not reached its call, or came into or left the band moves at most 4 a frame from its previous output, measured in premultiplied colour and coverage.
+ Here, still means its source moved by at most 8 in any channel anywhere in its 3x3 box (`VIDEO_STILL`).
+ A pixel the hard cut keyed in this frame stays transparent.
+
+ Still pixels settle toward the current fit when their mix is at its call in both frames.
+ When a pixel was written in both frames in the same palette colour, and its source is still, it settles.
+ It moves a tenth of the way (`VIDEO_SETTLE` 0.1) toward this frame's fit and stays within 12 per channel (`VIDEO_SETTLE_REACH`) of it.
+ When it must catch up to get within 12, it now moves at most 4 a frame in premultiplied colour and coverage instead of moving all at once.
+ This dampens codec noise while following real slow changes within 12 levels.
+
+ The video fit also drops flank recovery.
+ It no longer gives coverage back to keyed pixels (hard cut background within 3 px of the subject).
+ Decoded chroma blur created faint blends on keyed pixels, and codec noise carried them back and forth over the noise floor.
+ This filled dark gaps between strands with a faint smear that came and went across frames.
+ The video fit now examines the band only (subject pixels within 6 px of the keyed background).
+ The still fit keeps its flank recovery unchanged.
+
+ With history enabled, frame bytes depend strictly on previous frames in clip order and remain deterministic.
+ A single video-fit call without history gives the same band bytes as before, leaving keyed flank pixels as the matte keyed them.
+
+ On a synthetic still scene under decoder noise (red strands 1 to 3 px wide on painted green, 8 frames, sigma 2):
+ Mean edge change between frames on a dark background was 2.34 with `off` (99th percentile 8.3).
+ With the hold and settle alone, the mean was 2.27 (99th percentile 8.3).
+ With the blend and still steps, the mean is 2.25 (99th percentile 8.0).
+ Key contamination on that scene was 6.5 % with `off`, 2.3 % with the hold and settle alone, and 2.4 % now.
+
+ On a second synthetic scene, decoder noise changed between two frames and the source then stayed still for 19 frames.
+ With the hold and settle alone, changed calls appeared in one frame and their pixels stopped moving when the source stopped.
+ Now those edge pixels keep moving toward their new calls, by no more than 4.31 premultiplied a frame including uint8 rounding, and arrive by frame 14.
+
+ Per-frame stats and clip totals include `held_px`, `blending_px`, and `settled_px`.
+ `held_px` counts pixels where a held outcome or colour differed from an independent fit.
+ `blending_px` counts pixels showing a mix of two calls rather than this frame's call.
+ `settled_px` counts pixels the settle or a still step moved from the previous frame's output.
+ In video, `recovered_px` is now 0.
+
+ Keying cost was remeasured on an Intel i5-7500 with a 1080x1920 synthetic clip at CRF 18 and `--spill small`, six frames, one process per run, in the same session.
+ Keying took 1.14 s a frame with `off`, 3.25 s with the hold and settle alone, and 3.36 s now.
+ Peak memory was about 400 MB with `off`, 945 MB with the hold and settle alone, and 1155 MB now, adding about 365 MB over `off` per megapixel.
+ Because `video-set` keys three items at once by default, it can use about 2.3 GB more than `off` at that size.
+
+ - **Guards: Two new guards protect key-coloured details and material behind edges in the video fit.**
+ The still fit output is unchanged byte for byte, but explicit `--decontam palette` runs in video also use these guards.
+
+ The key-coloured parts guard protects small details that share the key colour.
+ A subject can own a key-coloured part too small for the palette to keep, such as a green charm on red hair under a green key.
+ When such a part covers under 0.5 % of the interior, the palette learns key-free colours.
+ Without the guard, the pass repainted the rim in the nearest key-free colour, turning the green charm's rim brown.
+
+ Now, when the palette is key-free, band pixels within 6 px of such a part keep the matte's bytes.
+ There is no flank in video any more, so this guard covers band pixels only.
+ This applies to pixels near parts that are opaque, deeper than 6 px, and have key hue above 8.
+ The key-hue cap leaves those pixels alone.
+
+ On synthetic tests, the share of the charm's key-coloured edge pixels that lost half their key hue or coverage was 0.77 with `off` and 0.82 now.
+ Its colour error was 41.7 with `off` and 45.6 now (64.9 without the guard in the diagnosis).
+
+ The material-behind guard preserves edges where subject material continues to the silhouette boundary.
+ A band pixel keeps the matte's bytes when its colour, observed directly or at its own luma, falls within the opaque margin of the mean colour of subject pixels right behind it.
+ This check reads subject pixels deeper than 2 px within a 3 px box radius.
+ Such pixels are treated as material continued to the edge rather than blends or tints.
+ The key-hue cap still applies to them.
+ Unlike the still fit, this guard does not require the pixel to be free of the key's hue, because decoded chroma blur gives every edge some key colour.
+
+ - **Diagnostics: A one-line stderr warning and new report fields track skipped frames and guard activity.**
+ `video-frames` prints a single line on stderr after its JSON summary when edge decontamination warrants attention.
+ The line starts with `video-frames: warning: decontam auto ...` and ends by naming `--decontam off` as the way to keep the matte as it is.
+
+ The warning prints when `auto` ran on no frames, when `auto` skipped some frames, or when the subject owns key-coloured material so the palette is not key-free.
+ On magenta keys, the red hair's blue channel sits more than 8 above its green, making the hair key-coloured material (9.6 % of the interior on magenta and 6.6 % on Grok's darker magenta) and triggering this warning.
+ The warning also prints when the key-coloured part guard kept edge pixels, reporting how many and noting that thin details farther out may be repainted.
+ A few key-hued pixels deep inside from codec noise guard no edge and raise no warning.
+ Brightness alpha raises no warning.
+ `video-set` prefixes this warning line with the item name and records it under `warnings` in the set report.
+
+ The JSON report adds `decontam.reason` for the first skip reason and `decontam.skipped_frames` when frames are skipped.
+ Per-frame stats and clip totals in the video fit add `key_part_kept_px`, `behind_kept_px`, `held_px`, `blending_px`, and `settled_px`.
+ Where `auto` cannot run, frames remain exactly as the matte keyed them.
+ The report records "the white matte has no key colour to remove" for a white key.
+ It records "no interior to learn the subject's colours from" when no pixel lies deeper than 6 px inside the silhouette.
+ Under `--alpha-mode brightness`, `auto` defaults to off, recording `{"mode": "auto", "applied_frames": 0, "reason": "brightness alpha has no key colour to remove"}`.
+ Explicit `--decontam palette` with brightness alpha remains refused.
+
+ Known limits apply to this release.
+
+ The hold works on pixels that stay put.
+ A change of call on a still edge arrives at most 4 a frame.
+ The largest change, between the matte's full coverage and a faint fit, can take up to about 64 frames, or about 2.7 s at 24 fps.
+ Until it arrives, the edge shows a mix of the matte's colour and the fit's.
+ A strand that moves is decided afresh in every frame, while its change of call is spread over a few frames and both renderings follow it.
+ A moving edge still changes from frame to frame as its colour does, so a red rim moving over a dark background changes more than the olive rim `off` leaves.
+ Pixels whose call changes show a mix of the two calls for a few frames.
+
+ The settle follows a slow change within 12 levels per channel and catches up past that at most 4 a frame.
+
+ The video fit gives back no coverage the hard cut keyed.
+ Outer pixels of a soft edge that the cut erased stay erased.
+ Only on stills, outside a dark outline the flank can give a few faint pixels in the subject's colour.
+
+ A thin feature whose colour is absent from the interior can be read as a palette colour plus key.
+ For example, a thin yellow line beside red hair with a pink highlight turned pink (colour error 26.2 with `off`, 47.5 now).
+ `--decontam off` keeps that line.
+
+ A thin key-coloured detail farther than 6 px from any key-coloured interior is repainted in a palette colour.
+
+ The thinnest strands retain some olive because decoders share chroma across aligned 2x2 blocks, leaving a one-pixel strand with half the key's chroma.
+ A block-aware fit is planned separately.
+
+ Pixel-art rows binarizing alpha, the green-only benchmark, and increased processing time and memory remain known limits.
+
+ - **Tests**: `tests/frames/test_chroma_decontam.py` checks that both video verbs default to `auto` and that still verbs and the row extractor do not.
+ It checks that `off` gives the engine's original bytes.
+ It checks that `video-set` hands its value to `video-frames` and lists the warning.
+ It checks that a white key, a subject with no interior, and brightness alpha give the same bytes as `off` with the reason.
+
+ A new section tests the video fit over time on the red-strand scene standing still while decoder noise changes every frame (luma per pixel, chroma per aligned 2x2 block, eight frames).
+ The default's edge changes from one frame to the next no more than `off`'s, in mean and at the 99th percentile.
+ The edge is still cleaned, with key contamination at most half of `off`'s.
+ Clip totals count held and settled pixels, and the first frame has none.
+ A frame given twice comes out with the same bytes both times.
+ Another test decodes one frame of the red-strand scene, then holds a second noise draw (sigma 3) still for nineteen frames.
+ After the source stops changing, the default keeps moving toward the calls the noise changed.
+ No pixel moves more than `VIDEO_STEP` in one frame in premultiplied colour or coverage, plus one for uint8 rounding.
+ It arrives by the last frame.
+ Clip totals count `blending_px`, and the first frame has none.
+
+ The video fit leaves every pixel the hard cut keyed transparent and recovers nothing.
+ The still fit still recovers its flank.
+
+ Changed tests reflect dropped flank recovery in video.
+ A head 6 px under the top frame edge passes the edge gate under the default and keeps the blur rows below the edge band as the matte keyed them.
+ For magenta skin tone in a 4:2:0 frame, the video fit's halo is read on the band where it acts (at most 0.9 of `off`'s), and the keyed flank keeps the matte's bytes.
+ The still fit keeps its halved halo.
+
+ The rim of a small green charm keeps the matte's pixels and loses at most 0.1 more than `off` while strands away from it are cleaned.
+ On magenta and Grok magenta, halo and alpha error do not rise.
+
+ A few key-hued pixels deep inside raise no warning.
+ `video-frames` prints the warning line on stderr.
+
+ `tests/video/test_gait_guard_anchor_wide.py` has its stand-in for `run_frames` take `decontam` and checks that the set's `auto` reaches it.
+
+ **Upgrading from 3.0.0: Walk and run loops now pass a step gate and fixed walk or run cuts are counted, so some cuts that passed before are refused.** Against 2.45.3, on which this change was built, every cut 2.45.3 passed that neither new reading refuses gave the same loop files byte for byte (strip, sidecar, frames, GIF and WebP bytes, the same stderr save new warning lines), measured on a batch of walk clips cut with caller arguments (the automatic walk cut, cuts by hand, forced cuts). The report gains `step_gate` on walk or run loops and `cycle.step_count` on fixed walk or run cuts, `producer` names the new version, and the CLI summary gains `step_gate`, whose `jitter` names the frames entered by steps over 2.5 that are a pixel's jitter, along with `jump_repair.unfixed`. Refusals outside the new readings keep their lines word for word, except the seam line's end where warning lines name a part on a beat of its own. Callers matching failure lines by first words need rules for `video-loop: loop step ratio` (the clip jumps inside: film again), `video-loop: loop step count refutes the fixed cut` (cutting again by hand failed), and `video-loop: loop frames left off the flow` only if passing `--unfixed refuse`; failure reasons can also be read from `seam_refusal`. Any `--seam-max` past 2.5 lifts the step gate and the count refusal, and forced delivery passes `--seam-max 1000` together with `--seam-pop-max off`, because `--seam-max` does not lift the seam pop gate described below. Reading feet on a fixed walk or run cut costs less than the distance matrix read by every cut.
+
+ - **Behavior change: Walk and run loops that play round now pass a step gate that inspects spacing between drawings.** After the seam gate, cells are read between drawings rather than frame by frame, so held animation on twos or threes does not appear uneven when drawings span multiple frames. The largest step from one drawing to the next, the wrap included, over the mean of the others, must be at most `STEP_RATIO_MAX` (2.5), else the loop fails with `video-loop: loop step ratio <ratio> exceeds 2.5 (<kind> length <L> frames from <start>, into frame <frame>, read between its <n> drawings); the loop jumps inside — regenerate the clip`, with jump repair reason `: frame <frame> lies off the walk's flow, and the jump repair's frame there was refused (<faults>), so it plays as filmed` before ` — regenerate the clip` where present. A step over 2.5 is exempt from the bound when it is a pixel's jitter (`loop.step_jitter`): the move that aligns its drawing with the previous drawing with the least coverage difference, measured on alpha so colour has no effect, is at most `STEP_JITTER_PX` (1.5) pixels of the frames as filmed, and the step with that move taken back is within 2.5 of the mean. In a walk going away from the camera, foot rises of a whole crop row measure 2.5 to 3.6 times the mean as drawn, black or grey, but move one pixel and pass without a warning line. One frame of a 400 px tall walk cut moved 6 px and back moves 2 pixels of the frames as filmed, and the gate refuses the loop in every colour, including black. The report records `step_gate` on every walk or run loop (`drawings`, `hold`, `mean_step`, `largest_ratio`, `largest_from`, `largest_into`, `wrap_ratio`, `max`, `jitter`, `lifted`, `kept`; `skipped` for fewer than three drawings). The bound is the larger of 2.5 and `--seam-max`, so any `--seam-max` past 2.5 lifts it; a scan or forced delivery with `--seam-max 1000` keeps a loop whose largest step is over 2.5 with warning `video-loop: warning: the loop's largest step between drawings is <ratio>x their mean (into frame <frame>), over 2.5: it jumps inside — kept, as --seam-max <seam-max> lifts the step gate` and `step_gate.kept`.
+ - **Behavior change: Fixed cuts fail when foot crossings count an odd number of steps.** Manual walk or run cuts using `--cycle fixed` now read the clip's foot crossings and evaluate the cut, matching `--anchor motion-auto`. The report records `cycle.step_count` with `chosen_by: caller`. A cut counted an odd number of steps fails with `video-loop: loop step count refutes the fixed cut <start>/<L> — the clip's crossings count one step, each seen where a walk loops on two, and an odd count swaps the legs at the wrap; cut it again two steps long (about <2 steps> frames)`. An even count is not refused by the count check, and the exemption `--anchor motion-auto` makes for a pass hidden among feet held together (the clip a cut on the same picture) applies identically through shared `local_cycle.same_picture_count`. The strip is unchanged, and there is no `steps` field. Any `--seam-max` past 2.5 lifts this refusal; a scan or forced delivery with `--seam-max 1000` keeps an odd step cut with warning `video-loop: warning: the clip's crossings count the fixed cut <start>/<L> one step, each seen: a walk loops on two steps, and an odd count swaps the legs at the wrap — kept, as --seam-max <seam-max> lifts the step gate` and records `cycle.step_count.lifted`.
+ - **New: Refused jump repair drawings are listed in `jump_repair.unfixed` and can fail the command.** When jump repair refuses a frame group, its frames remain as filmed; where the playing loop still reads a drawing of it 3.0 or more of its window's usual steps off the flow, that drawing is recorded in `jump_repair.unfixed` alongside `refused` (the faults). Every `unfixed` drawing prints warning line `video-loop: warning: frame <frame> of the loop lies <off>x its window's usual step off the walk's flow after the jump repair: the group that would bring it back was refused (<faults>), so it plays as filmed — a jump played as filmed; --unfixed refuse refuses such a loop (docs/loop-repair.md section 2)`. A new flag `--unfixed warn|refuse` (default `warn`) controls handling: `refuse` fails such a loop with an error line starting `video-loop: loop frames left off the flow — `. This failure is not lifted by `--seam-max`.
+ - **Fix: The seam gate failure line explains the cause where warning lines know it.** The first words of the failure line stay the same up to `the cycle does not close — `; where warning lines name a part on a beat of its own (an `--anchor motion-auto` cut two steps long by the clip's crossings whose wrap the gate refuses), the rest says so and names what became of the overlapped wrap, for example `video-loop: loop seam ratio <ratio> exceeds 2.0 (periodic length <L> frames from <start>); the cycle does not close — the cut covers two steps by the clip's crossings, and a part on a beat of its own (a tail, a held prop) closes on no cut of two steps: the overlapped wrap was not made (turned off (--overlap-wrap off)) — regenerate with that part moving on the walk's beat`. Elsewhere the line is word for word as before. Every refusal by the wrap, steps, or count records `seam_refusal` in the report (`reading`: `wrap`, `steps` or `count`). For `wrap`, it records `ratio`, `max`, `reason` (`own-beat` or null), and `overlap_wrap`. For `steps`, it records `ratio`, `max`, `into`, `reason` (`repair-refused`, `unfixed` or null), plus `frames` and `refused` where a reason was found. For `count`, it records `cut`, `verdict`, `k`, `why`, and `two_steps`.
+ - **Tests** — `tests/video/test_loop_silent_pass.py`: a side walk in place with a middle frame moved 10 px fails the step gate while its wrap passes, recording `step_gate` and `seam_refusal`, kept by `--seam-max 1000` with a warning line; an eight drawing walk on threes passes when frame by frame steps exceed 2.5; melted ponytail outlines and smeared stand in RIFE frames stay `unfixed` with faults, cite the refused frame in step gate lines, and fail under `--unfixed refuse`; CLI tests confirm `--unfixed` defaults to `warn` and rejects other words. Hand cuts fail on one step, pass at two, keep one step cuts under `--seam-max 1000`, and exempt hidden far feet on twos. A walker whose tail swings on its own beat fails seam checks with the reason in its line and `seam_refusal`; a sideways wrap shift keeps its line word for word with `seam_refusal.reason` null. The walk going away from the camera passes with foot rises of a whole crop row as drawn, black and in a grey near the backdrop: its steps over 2.5 times the mean move one pixel and are recorded in `step_gate.jitter`. A standing side walk with a frame moved 2 px and back fails on that step as drawn, black and in that grey, with every frame's alpha the same. In `tests/video/test_body_anchor_gate.py`, the sliding side walk with its first frame moved 3 px is refused on the step into frame 1: those 3 px take up the sideways slide at the wrap and put the jump inside the loop. The seam still reads the source frames and is not read again.
+
+ - **Fix: Windows run dir lock handling.** Every command that writes a run dir (for example `extract`, `compose-atlas`, `export-pngs`, `unpack-atlas`) takes a single-writer lock: the entry `.sprite-gen.lock` inside the run dir. Before this fix, on Windows only, when that name held a link pointing at a file that does not exist, the writer followed the link and made the lock file at the link's target, outside the run dir, and that file was left behind when the writer released the lock; also on Windows only, a folder at that name, a link to a folder, or a link whose target is written with forward slashes ended the command with a bare `OSError` (`EACCES` or `EINVAL`) instead of the named refusal. Now on Windows a link or a folder at that name is refused by name, the same as on macOS and Linux (`run dir lock ... is not a lock file (a link or a folder)`), and nothing is followed, made or removed, while macOS and Linux behave exactly as before. The test is `tests/spec/test_run_dir_lock.py`.
+
+ **Upgrading from 3.0.0: commands that write beside what they read now check and refuse any input that overlaps a file or folder the run replaces or deletes, even with `--force`.** This judgment is defined in `docs/run-contract.md` and enforced by `runio.refuse_overlap` before any command creates output. A run is stopped whenever an input matches an output, lies inside it, or passes through anything inside it, and the refusal names both paths.
+
+ - **Behavior change: Overlap refusal for inputs and outputs.** Twelve commands now call `runio.refuse_overlap` before making anything, with or without `--force`: `unpack-atlas`, `video-loop`, `video-stop`, `video-frames`, `correction-loop`, `logo`, `video-extend`, `video-edit`, `video-loop-compare`, `video-loop-repair`, `video-source-manifest` and `shadow`. Inputs include paths given to read and files found inside them (such as frames in `--frames-dir`), followed via `runio.follow_path`. Outputs include each file written, folder replaced or emptied, and report, but not folders only added to (which is why `--out-dir` for `video-loop` and `video-stop` is not compared). Comparisons check real path and file identity (`runio.same_folder`, `runio.inside_folder`), treating links and different spellings on volumes that ignore case as identical, while input link loops are refused by name. A link at a written file is refused if it leads to an input, even where the run would replace the link rather than write through it, whereas paths passing through an output and exiting with `..` (such as `out/cycle.source/../keyed`) are permitted. In `logo`, the folder's own `mood.png` and `lettering.png` remain permitted for `--mood` and `--lettering` while any other output file is refused, and `correction-loop` permits an `--out-dir` inside the run dir or one holding an earlier loop's attempts, best candidate and report.
+ - **Fix: Directory recursion and casing collisions on volumes that ignore case.** Before, `correction-loop` compared only `--out-dir` itself with the run dir, so with a link `attempt-1` in its `--out-dir` leading to the run dir, the loop wrote its attempt into the run it read. Separately, before, the best candidate's copy of the run dir copied itself into itself until the path was too long. (The default `--out-dir`, `<run-dir>/correction-loop`, lies inside the run dir; the copy now leaves it out.) `correction-loop` now takes an earlier loop's candidate away before the provider makes the next one there. `video-sway-inspect` now refuses an `--out-dir` that is the loop directory spelt in capitals on a volume that ignores case, instead of writing boards into it. In addition, `video-loop-compare`, `video-loop-repair`, `video-source-manifest` and `shadow` now call `runio.refuse_overlap` so reports or outputs spelt in capitals on volumes that ignore case are refused instead of overwriting inputs, while `background-tile`, `inspect-motion`, `scene-inspect`, `scene-render`, `game-pack`, `ui-kit` and `video-sway-inspect` verify their single output with `runio.same_folder` and `runio.inside_folder`.
+ - **Behavior change: Unique working folders via stage names.** Any folder a run writes into and then deletes is now created with `runio.new_stage` and named `.<name>.<pid>-<random><suffix>`. These include the frames `video-loop` scales back for a size hold or gait fallback (`.gait-fallback-frames.<pid>-<random>`, removed however the run ends), the PNG frames built into animated WebP files beside the WebP for `video-loop`, `video-stop`, `video-cycle-align`, `video-sway` and `video-loop-repair` (`.<name>.webp.<pid>-<random>.frames`), the working folder `video-frames` keys into (`.keyed.<pid>-<random>.work`), and the working folder of `logo` (`.logo-work.<pid>-<random>`). Folders at old fixed names (`.gait-fallback-frames`, `.webp-frames`, `.keyed.work`, `.logo-work`), whether holding an input or belonging to anyone else, are never written into or removed.
+ - **Behavior change: Input protection, staging, and locks in `unpack-atlas`.** `unpack-atlas` never touches its inputs, refusing before making anything and with or without `--force` any input that is the run dir, lies inside it, goes through anything inside it, or holds it. Guarded inputs include `--pngs-dir`, `--atlas`, `--manifest`, the atlas a manifest names, and what the import reads in `--pngs-dir` (every frame, `_base` image, `_refs` PNG, `meta.json`, and every folder it reads one from, any of which may be a link). Refusals name the first entry the input goes through inside the run dir, while paths that only pass through the run dir itself (such as `run/../incoming`) are not refused. The command builds runs in a dedicated staging folder beside the run dir (`.<name>.<pid>-<random>.sg-staging`) and moves prior content aside into a backup folder inside it (`.sg-backup.<pid>-<random>`), never reusing or removing existing staging or backup folders and putting every prior file back on a failed publish. The run dir's single writer lock is the entry `.sprite-gen.lock` itself (`runio.acquire_run_dir_lock`, every writer) and belongs to the process that took it, and a link or a folder at that name is refused by name and never followed, read or removed, so reclaiming a stale lock deletes only a stale lock file.
+
+ **Upgrading from 3.0.0: A held walk or run whose wrap fell between two drawings, refused before, may now pass.** A walk drawn a frame each gives the same loop files byte for byte. Reports record `seam_read` (`read`, `drawings`, `hold`) on every walk or run whose seam ratio gates the cut, and `seam_after_anchor` gains the same three fields when cells are read again, with `strip.json` and the failure line of the seam gate unchanged.
+
+ - **Behavior change: Walk and run loops gated by their seam ratio now measure the seam between drawings.** For any walk or run whose cut is gated by the seam ratio (neither pinned nor played once), the seam is read between drawings using each drawing's first frame (`loop.seam_drawings`, built on `repair.flow_drawings`), matching the reading used by the step gate. This applies in three places: the seam gate itself, both on source frames (`seam_measurement: source-frames`) and rendered cells (`rendered-cells`); the body anchor ramp rule, reading the wrap and every step between the cells' drawings; and candidate evaluation under `--anchor motion-auto` (`loop.seam_on_cells` through `loop.wrap_on_cells`) when selecting two-step cuts or testing overlapped wrap attempts. Loops showing fewer than three drawings continue to be read on every frame (`seam_read.read: cells`).
+ - **Report: Reports record whether the seam gate read frames or drawings.** On every walk or run whose seam ratio gates the cut, `seam_read` records `read` (`cells` or `drawings`), `drawings`, and `hold`. When `--anchor body` ramps cells and triggers a re-read, `seam_after_anchor` records those same three fields for the cells that play, and its `largest_step_into` names the first frame of a drawing. Strip sidecar `strip.json` does not change.
+ - **Known limits: Measuring between drawings allows cuts from a third of the stride short to a sixth long on twos, and from a third short to a quarter long on threes, to pass.** On synthetic 24-frame stride walks standing in place, cuts of 16 to 28 frames on twos (ratio 1.02 to 1.67; 30 refused at 2.06) and 16 to 30 frames on threes (0.95 to 1.48) pass the seam gate, whereas drawn on ones cuts of 16 to 22, 28, and 30 are refused (2.38 to 4.07). A shifted final drawing passes up to 2 px on twos (1.66; 3 px refused) and up to 4 px on threes (1.73; 6 px refused). Under `--anchor body` sliding 0.2 px a frame, cuts of 16 to 28 frames pass on twos and 16 to 30 on threes, tolerating shifts of 2 px on twos and 6 px on threes. The step gate already passed these cuts (largest step 1.26 to 1.86), while the earlier frame-by-frame seam gate refused them all. For full synthetic limits and ramp discretization behavior, see `docs/loop-review.md` section "The body anchor and the seam gate".
+ - **Tests:** `tests/video/test_held_walk_seam.py`: a held walk cut between its drawings passes the seam gate on twos and threes; a walk drawn a frame each is read on every frame and its ratio is the frames' own; a held walk whose last drawing is moved 10 px is refused between its drawings; a held sliding walk passes on the drawings the ramp plays, and a jump the ramp moves into a held walk is refused as the source frames refuse it; a held walk motion-auto cuts passes on its cells between their drawings (a side walk on twos, a side walker on threes); motion-auto's seam gate reads a held cut between its drawings, and a last drawing with a band of its body gone is over the limit. `tests/video/test_walk_steps.py`: the walker on threes with a tail on its own beat records its tried two-step cut within the seam gate between drawings, declined as out of phase; the search's cut stands as before.
+
+ **Upgrading from 3.0.0: walk and run loops whose seam pop exceeds the bound are now refused by default.** The check is governed by `--seam-pop-max BOUND|off` (default 10). The flag `--seam-max` does not lift this gate. Callers that force delivery with `--seam-max 1000` or scan fixed cuts with lifted gates must add `--seam-pop-max off` beside `--seam-max 1000` to deliver what they delivered before. Callers matching failure lines by their first words need a rule for `video-loop: loop seam pop`. Loops that pass the gate, loops with an unreadable top band, and pinned clips produce the exact same files as before, save an `--anchor motion-auto` cut taken in place of a first choice the gate would have refused before the cut.
+
+ - **Behavior change: seam pop is now a gate.** A walk or run loop whose `pop` is over the bound is refused, while a pop exactly at the bound passes. The gate applies to all walk or run loops gated by seam ratio (`--cycle fixed`, periodic searches, `--anchor motion-auto`, and `--repair off`), but does not gate pinned clips (`--cycle pinned`). The check runs after the seam gate and step gate; cuts refused by earlier gates fail with their existing lines. On refusal, the failure line is `video-loop: loop seam pop <pop> exceeds <bound> (<kind> length <L> frames from <start>): the top of the silhouette jumps into the loop's first frame up or down <percent> % of the body height, <ratio>x its median step — the loop does not close at its top; cut it where it does, or regenerate the clip`, detailing the pop, bound, cut, and directional jump metrics, without printing a warning line or adding to `jolt.warnings`. Loops whose top band cannot be read pass with verdict `unreadable` and retain their warning line. The flag `--seam-max` does not lift this gate, because seam pop measures top band placement rather than seam ratio distance.
+ - **New: `--seam-pop-max` flag.** `video-loop --seam-pop-max BOUND|off` sets the seam pop bound. It defaults to 10 (`repair.SEAM_POP_REFERENCE`) and accepts any number over 0, or `off` to turn the gate off.
+ - **Behavior change: `--anchor motion-auto` evaluates candidates for seam pop before cutting.** Before a cut is taken, candidate cuts are evaluated using `loop.corrected_cut` and `repair.seam_pop_of`. If the search cut would be refused, the engine evaluates up to four candidates (`local_cycle.SEAM_TRIES`) in search order (equivalent cuts earliest first, then remaining best first) and selects the first passing cut; if all four fail, the first choice stays and fails on the loop. For step counts, foot crossing cuts passing the seam gate are checked for pop, taking the first of four cuts that passes both gates. Every motion-auto run now corrects the search cut once before taking the cut.
+ - **Report: `seam_pop_gate` record and step count fields.** Walk and run reports and CLI summaries add `seam_pop_gate` containing `verdict` (`passed`, `refused`, `unreadable`, `off`, or `not-applicable`), `max`, `pop`, and `why`. Failed reports include this record as well. Motion-auto searches record `cycle.seam_pop_gate` with `max`, `tried`, `applied`, and `why`. In addition, `step_count.seam_gate.tried` rows and `step_count.search` gain `pop`, `pop_gate`, and `pop_skipped`.
+ - **Tests: synthetic and unit coverage.** Synthetic tests in `tests/video/test_seam_pop_gate.py` verify a standing rod walk where an 11 px tip drop reads a pop of 11.0 and is refused, while a 9 px drop reads 9.0 and passes. Tests confirm that bound 12 or `--seam-pop-max off` keeps the 11 px loop with identical files, `--seam-max 1000` alone does not keep it, unreadable tops pass as `unreadable`, pinned clips report `not-applicable`, and `--anchor motion-auto` switches from a cut with pop 6.0 (5.0 on twos) to a passing cut with pop 0.0 under bound 3. Unit tests cover `repair.seam_pop_gate`, `local_cycle._pop_gate`, `detect`, and `by_steps`. In `tests/video/test_loop_prop_seam.py`, fixed cuts with dropping staff tips are preserved under `--seam-pop-max off`.
+
+ ## v3.0.0 - Remove rig layer composition
+
+ **Upgrading from 2.46.0: `sprite-gen compose-layers` and its other launch forms are removed, and rig layer declarations are no longer read.** `compose-atlas` no longer writes a manifest `rig` block or `animation.rows.<state>.track` for a run that declared a rig. Runs that never declared `rig`, `layers` or a state `track` get the same manifest as before. Existing run files and `layers/` folders stay on disk.
+
+ ### Breaking
+
+ The rig layer feature has no replacement in 3.0.0:
+
+ | Removed | Use |
+ |---|---|
+ | `sprite-gen compose-layers`, `python -m sprite_gen.compose.compose_layers`, `scripts/compose_layers.py` | No replacement. The CLI verb now ends as an unknown command with argparse exit code 2. |
+ | `sprite_gen/compose/layers.py` (declaration checks for rig profiles, row tracks and composite stacks), `sprite_gen/compose/compose_layers.py` (baking declared stacks into `<run>/layers/`) | No replacement. |
+ | `sprite-request.json` keys `rig`, `layers` and `states.<state>.track` | Remove them with `sprite-gen migrate-request <run> --apply`. |
+ | `sprite_gen.spec.runio.normalize_retired_fit_keys` | `normalize_retired_keys`, which returns a list of keys moved or left out, or an empty list. |
+ | `docs/layer-tracks.md` | No replacement. Its links are gone from the other docs, READMEs and `SKILL.md`; the skill description no longer lists "rig layers". |
+
+ - `prepare` drops the retired keys from `--request` and `--request-json`, naming them in its existing stderr note. Code no longer reads them. On the first read of an old run's request, the process prints one stderr line naming the keys, treats them as absent in memory and leaves the file byte for byte unchanged. Unrelated request rewrites, including reroll and interpolate takes and curation fps edits, preserve those keys as they were.
+ - `sprite-gen migrate-request <run>` lists the keys it would remove without writing. `--apply` removes them from the file; a second apply has nothing to move. The changed bytes move `run_revision`, and the command names the curation rows it will drop before writing. The command also retains its existing `fit.pixel_perfect` to `fit.pixel_unfake` migration. `runio.migrate_request_file` now returns the list of keys moved or left out instead of a boolean.
+ - Talking face parts are planned as a new feature in a later 3.x minor release.
+ - **Tests**: Added `tests/spec/test_request_retired_rig_keys.py` to check the one-time stderr note and unchanged old request bytes, migration dry runs and repeated applies, preservation on unrelated edits, and named drops in `prepare`. Removed `tests/compose/test_layer_compose.py`, `tests/compose/test_layer_contract.py` and `tests/packaging/test_layer_cli_entrypoint.py` with the feature.
+
+ ## v2.46.0 - Changed loop and framing defaults, recognition of cyan or yellow leaning green border keys, Breathe smooth mode and Sway commands
+
+ **Upgrading from 2.45.3: Some existing runs produce different bytes because defaults changed.**
+ `video-loop --cycle pinned` with `--anchor none` now blends the wrap when the pin passes its gate and the pinned last frame redraws the first.
+ A redraw means the first cell differs from the pinned frame by more than `--seam-max` (default 2.0) times the cut's median step at full size.
+ Those cuts have different `cycle/` cells over the last half second, and a different strip, GIF and WebP.
+ `video-set` takes this default for idle and attack clips filmed with their first frame as the last; a walk or run cut the same way is blended too.
+ The blend does not read the state, and `--wrap-blend off` cuts as filmed.
+ Every pinned cut gains the report key `wrap_blend`, which also appears in strip metadata where the blend applied.
+ A source projection reads a blended strip as `source-processing-unsupported`.
+ Under `--repair auto` or `--repair on`, a loop that is not a walk or run and is cut to play as a loop now has its wrap read against the steps beside it.
+ This excludes `--cycle once`, `once-return` and an effect's lifetime.
+ When the wrap step exceeds `--seam-max` times the mean of the three steps on either side and exceeds 0.005, RIFE makes one, two or four frames round the wrap again.
+ Such a loop can have different cells, strip, GIF and WebP, or pass where 2.45.3 refused it.
+ Its report now reads `jump_repair.reading: "seam"` instead of `"why": "not a gait state (...)"`.
+ Without RIFE, a wrap needing the bridge is cut as filmed and a `warning:` line names `sprite-gen rife install`; with `--repair on`, the run is refused.
+ The bridge reads the wrap after the blend, so a pinned idle or attack can receive both.
+ A pinned clip whose pin the gate refuses is not bridged and is refused on its pin as before.
+ Walk and run loops retain their 2.45.3 bytes except when cut pinned with `--anchor none` and a last frame that redraws the first; `--wrap-blend off` restores those bytes.
+ For a loop that is not a walk or run, `--repair off --wrap-blend off` restores the 2.45.3 cells, strip, GIF and WebP, with `"why": "--repair off"` in the report.
+ Do not use `--repair off` to restore a walk or run: it also disables the jump repair that ran by default in 2.45.3.
+ The default `video-frames` edge check (`edge_policy`) is now `border` instead of `refuse`.
+ A clip whose first-frame subject covers at least 2 % of the outermost row or column on the top, left or right now passes where 2.45.3 refused every frame as "framed too tight".
+ If the first frame crosses no side, it is judged and worded as in 2.45.3; `--allow-subject-edge-contact` and `--allow-edge-contact` also judge as before.
+ In a refusal, the top, left and right numbers now count pixels the border does not take.
+ The `video-frames` report gains `edge_border`, and each contact row gains `rim`.
+ A refused `video-frames` run leaves frames in `keyed.refused/`, removes `keyed/` even from an earlier run, and writes a report with `status` set to `passed` or `refused`.
+ A refused `video-loop` run removes an earlier cut's `cycle/`, strip, strip metadata, GIF, WebP, `cycle.source/` and `follow.source.png` from the output folder; a cut already written is kept as `cycle.refused/`.
+ A passing run delivers the same bytes as before, while a caller that misses a refusal's exit code no longer finds an earlier run's files.
+ Borders already recognised as a green key in 2.45.3 key byte for byte as before under the same key.
+ A border green leaning toward cyan or yellow, such as `#00B140`, now uses the green key: `cutout --key auto` and `video-frames` use it instead of the position-based white matte, `video-canvas` repaints such a still to the exact key and accepts `--key green`, and `video-frames --spill auto` reads it as `full`.
+ Those outputs can change; Python callers of `extract.detect_background_key_rgb` can pass the new `threshold` argument, which the engine supplies from `--key-threshold` (default 96).
+ New commands are `sprite-gen breathe`, `video-sway` and `video-sway-inspect`, and Breathe gains a smooth mode for large illustrations and video frames.
+ Breathe without `mode` or with `mode: "pixel"` keeps the same bytes and sidecar; new Breathe values set to 0 or omitted also keep the same bytes.
+ `video-follow` and `video-follow-inspect` keep their names and files, including the `follow` record, `follow.source.png` strip and `follow-inspect.*` inspection files.
+ Moving the written names to `sway` is a later change made together with the tools that read them.
+ Every command now reopens stdout and stderr as UTF-8 where needed so it can print on Windows consoles or pipes using cp949 or cp1252; importing `sprite_gen` leaves the caller's streams alone.
+ Restoration schemas remain `source-restoration-v5`, repair report `schema_version` 4 and comparison `schema_version` 6, while the report's `producer` names the new version.
+ 2.45.3 changed only the `--anchor body` seam check, so detailed comparisons below with 2.45.2 for keying, framing and `video-frames` also hold for 2.45.3.
+
+ - **Changed (default):** A video model given the first frame as the last draws that frame again (softer or sharper, another tone, hair strands a pixel over).
+ The pin gate reads the pose and passes.
+ The drawing stays, so the loop's wrap shows one jump in sharpness where every other step shows the motion.
+ Over the cut's last half second (K = min(round(0.5 s x fps), floor(L / 4)) cells, 12 at 24 fps), wrap blending adds back j/(K+1) of the redraw's difference (first cell minus pinned frame, premultiplied) on the j-th cell.
+ Each pose stays the cell's own, and its drawing turns into the first cell's by the wrap.
+ Only a redraw is ramped.
+ A pixel is held where the two ends hold a part, a line or a dot in different places, and where a ramp cell does not stand where the pinned frame stands.
+ This check applies after one softness match of at most 0.7 px.
+ A pixel is held if it is more than 12 levels outside what the other end holds within 1 px on a 7x7 mean or a 7 px run, over black and over white.
+ It is also held if its value is more than 12 outside the other end's 1 px range where the other end has under half this end's range there, in any direction, length or width.
+ Held pixels are widened 3 px and the weight feathered 7x7.
+ A pixel of weight 0 is the filmed byte.
+ A ramp that steps more than the cut already does, or that does not shrink the wrap, is not used: the cut is written as filmed and a `warning:` line says so.
+ A wrap still over `--seam-max` after blending also gets a `warning:` line.
+ New flag (default `auto`, and `video-set` takes the default):
+ `video-loop --wrap-blend auto|off`
+ New report key `wrap_blend` on every pinned cut (`applied`, `why`, `K`, `cells`, `residual_ratio`, `wrap_ratio_before`, `wrap_ratio_after`, `ramp_step_max_ratio`, `bound_ratio`, `pose_share`, `presence_share`, `never_settled`, `equalize`, `after_check`, `seconds`).
+ `wrap_blend: {cells, K}` appears in the strip metadata where it applied, and in the CLI summary.
+ [loop repair](docs/loop-repair.md#6-the-redrawn-wrap-a-pinned-clip-whose-last-frame-the-model-drew-again)
+ - **Tests**: `tests/video/test_wrap_blend.py` on synthetic clips:
+ a redraw of tone and 0.5 px softness has its wrap brought from 7.31x to 0.57x the median step and only the ramp's cells, strip, GIF and WebP differ from off;
+ an arm still coming down in the ramp stays the filmed arm;
+ a part moved 2 to 64 px, or present at one end only, is never drawn twice (the 14 px part on a flat figure is cut as filmed with a warning);
+ 1 px lines moved 2 to 32 px on a flat figure are byte for byte;
+ stripes swinging inside the ramp keep their swing;
+ a strand against the silhouette is held over white where black alone lets it through;
+ the softness match blurs the sharper end, never past 0.7 px;
+ the idle-still fixture gives every output byte for byte;
+ fixed cuts, body-anchored pinned cuts and refused pins are not touched;
+ a ramp that steps past the cut is refused with a warning;
+ a 1 px line at slope 1/3 moved 8 px is held line for line, thin structures change by at most 2 levels and busier quiet grounds by at most 3, strands off the silhouette by none.
+ - **Changed: `video-loop` bridges a jumping wrap on idle and action loops (`repair.seam_bridge`).** Under `--repair auto` (the default) or `--repair on`, a loop whose state is not a gait (idle, jump, attack, or a generic in-place action) has its wrap read against the steps beside it; where it jumps, one, two, or four frames round the wrap are made again by RIFE between the frames either side; the loop is not read for its flow (an idle's own motion would leave it). See [loop repair](docs/loop-repair.md#the-seam-bridge-a-loop-that-is-not-a-walk-whose-wrap-jumps).
+ - **Tests**: `tests/video/test_seam_bridge.py` covers the synthetic idle with wrap jump J = 2.6 closed by one frame and passing the gate, J = 5 tried at one and two frames then closed by four, J = 12 refused without frames made, J = 1 closed loop untouched without an interpolator, whole-pixel stepped motion not bridged, near-still loop under the noise floor not bridged, loop drawn on twos skipped, real RIFE (rife-v4.6 with augmentation) closing J = 2.6 without faults, frames made with a fault (a stand-in painting a dark patch: smear at every width, seven calls, nothing taken, gate refuses as before), missing RIFE where the wrap is cut as filmed with the install line in `jump_repair` and a `warning:` line, a wrap that reads as a step saying nothing, `--repair on` refusing with the install line, a pinned clip whose pin the gate refuses skipped without reading and refused on its pin, the CLI summary naming the frames made, and the report naming the RIFE that made them; a `--repair on` run without RIFE, in an output folder where an earlier cut passed, refused on a wrap needing the bridge and leaving none of that cut's `cycle/`, strip, strip metadata, GIF or WebP, and no `cycle.refused/` because the new cut was not yet written.
+ - **Default change: A drawing cut by its own frame is no longer refused as framed too tight.** A bust or half-length drawing runs off the frame itself (its sleeve cut off at the left, its hair at the top), so in every frame of its clip the subject touches those edges and no canvas gives it room there. In 2.45.2 the default `video-frames` edge check refused every frame of such a clip with "the subject touches the frame edge ... framed too tight". Only a flag let it through: `--allow-subject-edge-contact`, which also lets through a subject that really leaves the frame, or `--allow-edge-contact`, which turns the check off. The default (`edge_policy` is now `border`, was `refuse`) reads the drawing's own border on the clip's first frame, keyed with its specks erased: a side (top, left, right) whose outermost row or column the subject covers for at least 2 % of its length (`frames.BORDER_MIN_FRACTION`) is a border side. Subject contact there is accepted in every frame, wherever along the side. Subject contact on any other side is still refused as framed too tight (a bust cut at the top and left whose hand leaves the right). The top / left / right numbers in a refusal are now the pixels the border does not take, so a caller that reads them to choose a taller or wider canvas reads the side that needs room. Leftover key is still refused, except the body's rim the matte cut loose: a key-only piece is accepted only on a border side the same frame's subject reaches, holding fewer than 8 pixels in all (`SPECK_MIN_PX`) and lying wholly within 10 px of the frame's body (`frames.RIM_REACH`, counted each way and diagonally; the body is the largest piece holding a pixel off the key). A thin outline blended with the key leaves such pieces at the edge between strands. Larger pieces, farther pieces, pieces on other sides or on a side the frame's subject left, and a detached stain beside a sleeve on the same side are refused as in 2.45.2. A clip whose first frame crosses no side is judged and worded exactly as in 2.45.2, byte for byte. The two flags judge as in 2.45.2. Taking a side as the border prints one stderr line. The report gains `edge_border` (`frame`, `sides`, `outer_px`, `min_fraction`, `rim_reach`, `rim_under_px`); each contact row gains `rim`, and under the default `border` (pixels taken) and `off` (pixels not taken, by side). Known limit: a hand that newly leaves the frame on a side that is already a border side is accepted; by position it cannot be told from the sleeve moving along the edge. [video pipeline](docs/video-pipeline.md), section 3.
+ - **Default change: A refused run hands nothing over.** A caller that does not read the exit code used a refused run's output as if it had passed. In 2.45.2 a refused `video-frames` run left its keyed frames in `keyed/` and wrote no report. `keyed/` was not emptied before keying, so a pass after a longer earlier run in the same folder also held the earlier run's extra frames. A refused `video-loop` run could leave a mixed set: for example after the pin gate refused, `cycle/` and the strip were the refused run's while the GIF and WebP were an earlier run's; a refusal before the cut left the earlier run's whole set. Now `video-frames` keys into a hidden working folder and hands over `keyed/` only when the run passes. A refused run (the edge check, or a frame keyed to 0 % transparency) leaves its frames as `keyed.refused/` and no `keyed/`, not even an earlier run's. A pass removes `keyed.refused/`. The report is written either way, with `status` (`passed` or `refused`); a refused report adds `error`, `refused_dir` and `keyed_dir: null`. Keyed frames that pass are the same bytes as before. Every `video-loop` refusal that writes `status: failed` (selection, motion anchor, jump repair, jolt, pin, seam, a strip with no body, a GIF or WebP that could not be written or verified) removes `cycle/`, `<name>.strip.png`, `<name>.strip.json`, `<name>.gif`, `<name>.webp`, `cycle.source/` and `follow.source.png` from the output folder. A cut it had already written is kept as `cycle.refused/`, which the next pass removes. A strip with no body and a GIF or WebP that could not be written now also write the failed report. Argument errors touch nothing. [video pipeline](docs/video-pipeline.md), sections 3 and 4.
+ - **Tests** - `tests/video/test_edge_border.py` (a bust cut at the top and left passes and the report names its border; a padded jump whose head leaves the top and a first frame with a 2 px wisp on the top are refused with the 2.45.2 message, byte for byte; a key-only patch with no border is worded as in 2.45.2; a hand leaving the right of a bust is framing, its message counting only the right; a hand leaving a border side elsewhere is accepted (the known limit); leftover key that is not the body's rim is refused (a patch on the right, a 48 px fringe beside the sleeve, a patch where the sleeve left, a detached 20 x 90 stain, 2 px pieces 11 and 14 px from the sleeve, pieces of 8 px and more, stripes hugging the head, stains beside the head, a fringe on a side that is not the border, a fringe above a head clear of the top band, a stain round a fleck of the body's colour); 1 px dots are judged piece by piece; 2 px pieces 2 to 10 px from the sleeve and a 7 px piece are the rim; an 8 px piece with 4 pixels in the band and a 7 px piece 11 px away are refused; the two flags judge as in 2.45.2; `classify_edge_contact` counts the rim; a refused `video-frames` run leaves `keyed.refused/`, no `keyed/` and a refused report; a pass after a refusal leaves `keyed/` alone; a pass over a longer run holds its own frames only; a frame keyed to 0 % transparency is refused the same way; an argument error touches nothing; a `video-loop` cut refused after it was written hands nothing over and keeps `cycle.refused/`, removed by the next pass; a cut refused before it was written hands nothing over; a loop argument error touches nothing), `tests/video/test_canvas_key_normalize.py` and `tests/video/test_fit_tight.py` (the 2.45.2 default's framing and mixed-contact tests now move the contact after the first frame and read the refused frames from `keyed.refused/`), `tests/video/test_edge_speck_lead_in.py` (the default policy is named `border`, and the refused frames are read from `keyed.refused/`), `tests/frames/test_chroma_key_relative.py` (the edge-contact split states the `rim` count `classify_edge_contact` now gives).
+ - **Fix: Green screens that lean toward cyan or yellow are now recognised as border keys.** A green screen that leans toward cyan or yellow was not recognised as the key on the border. Examples: the studio chroma-key green `#00B140`, (0, 177, 64); (0, 200, 90), which leans toward cyan; (90, 210, 0), which leans toward yellow. Each sits more than 96 from pure green. With `--key green` the whole background stayed opaque, and `video-canvas` refused `--key green` on such a still; but with `--key auto` the old rule did not take the green route at all: `cutout` and `video-frames` routed the frame to the white (position-based) matte, and `video-canvas` treated the still as a non-key base and did not normalize it. `video-frames --spill auto` did not always choose `full`: when the reference still had the same leaning green, `auto` read the surviving background as key material and chose `small`; when it chose `full` (a reference whose own background the old rule did recognise), the clip's surviving background was despilled to a blue-grey instead of being erased. The cause was that the border rule `extract.is_border_key_candidate` held every unkeyed channel under 64. That bar was set between magentas, whose one unkeyed channel (green) tells a painted magenta from hot pink. Green has two unkeyed channels, and a green screen leans on one of them. For the fix, the darkest unkeyed channel keeps the bar (under 64, and at most 35 % of the brightest keyed channel). The brightest one only has to stay under half of the brightest keyed channel (`extract._BORDER_KEY_MAX_LEAN_RATIO`, 0.5), that is a hue nearer green than yellow or cyan (between 90 and 150 degrees). The border detector, `extract.detect_background_key_rgb`, reads the lean second. It first counts, on their own, the candidates the 2.45.2 rule admitted. When those make up at least 12% of the samples, it returns the mean of their most populated bin, exactly the colour 2.45.2 returned. Below 12%, the samples only the lean admits join them, but their most populated bin gives the colour only where the declared key's own cut would leave that background on the border. Two conditions, both needed: the samples only the lean admits that lie farther from the declared key than the cut (the radius the caller keys with: the new `threshold` argument of `detect_background_key_rgb`, which the engine sets from `--key-threshold`, 96 by default), in that most populated bin or in a bin beside it on every channel, make up at least 2% of the samples; and the candidates outside that bin and the bins beside it make up less than 12% of the samples (the border holds one key-coloured background). Otherwise the declared key is kept, as in 2.45.2. A leaning border the declared key clears by itself gains nothing from the leaning colour; its ball would only reach further into a subject near that colour: (0, 210, 80) sits 91.8 from pure green, inside the cut of 96, so the declared key erases that background on its own, and a teal subject (0, 154, 149), 180 from the key, is kept; read as the painted colour, (0, 210, 80), 88.9 from the teal, let the ball reach the teal subject through the background and erase all of it, with no background gained. The 2% keeps the soft rim where a subject meets an edge of the frame (its blend with the background crossing the cut there) from being read as background the cut left; and a background whose tail past the cut is under 2% of the border keys as before the lean, the few pixels past the cut included. A second key-coloured colour on the border may be the subject's own (a leaf along an edge, another green); read as part of the background it would let the ball take a subject colour near the dominant one. `cutout`, the reference window `video-frames --spill auto` keys, and the YCbCr path's decontamination pass hand the detector the radius they key with, as the engine does. The painted key's erase ball, the spill judgment's subject window and the `video-frames` edge-contact split take the lean only from a painted colour that leans itself (`extract._painted_key_leans`). A colour found the first way never leans itself (magenta has no lean; for green the floor of the mean of one 8-wide bin of 2.45.2 candidates is always one of them), so they read it as 2.45.2 did. `cutout --key auto` and `video-canvas --key` classify the flat corner colour with the border rule, lean included (there the question is what the painted colour can be): a corner colour 2.45.2 took routes as before, and a leaning corner colour now routes to green. The magenta key is exactly as before (its one unkeyed channel is both the darkest and the brightest), so hot pink (250, 77, 150) and purple (213, 112, 246) are still refused. For green, nothing that was a candidate is dropped. Ivory, cyan, teal, sea green, a grey-green with both unkeyed channels lit and a green as near cyan as green are still refused. The interior rule `is_key_family` is unchanged. As a consequence, every image whose border the 2.45.2 rule recognised (its candidates at least 12% of the corner and border samples) keys byte for byte as in 2.45.2 under the same key, whatever leaning green is mixed into that border and in whatever share. Under the same key, every image is keyed either exactly as in 2.45.2 or exactly as with the leaning colour read. As in 2.45.2: wherever the 2.45.2 rule recognised the border (its candidates at least 12% of the corner and border samples), wherever the declared key's cut clears a leaning border by itself, and wherever the border holds a second key-coloured colour. With the leaning colour: where the key's cut leaves the border's one leaning background. Read together, a sample admitted only through the lean can share the 8-wide bin of a background 2.45.2 already found and move its mean, while leaning samples in a bin of their own that outnumber the background would take the mode. A leaning-green part of the subject on the corners and the border can be taken as the painted colour only where the 2.45.2 rule's candidates make up less than 12% of the samples, the key's cut leaves it and no other key-coloured colour holds 12% of the border, that is, only where the subject crowds the border. A leaning-green patch buried in the subject on such a background is kept. [chroma-alpha](docs/chroma-alpha.md), the 2026-10-21 paragraph.
+ - **Tests** - `tests/frames/test_chroma_key_relative.py` (the border table with the three leaning greens accepted and a grey-green and a cyan-midpoint green refused; the detector still refuses hot pink, purple, ivory, cyan, (30, 60, 30), teal, sea green and those two; over the whole RGB cube the lean adds nothing for magenta, drops nothing for either key, and adds for green only hues between 90 and 150 degrees; without the lean the candidate field is the old rule colour for colour over the whole RGB cube; the engine and `cutout --key green` key the leaning greens out with the subject byte-identical; `cutout --key auto` routes a leaning green to `extract:green`; a leaning-green patch ((0, 160, 75) or (10, 120, 50)) buried in the subject is kept byte for byte on (8, 162, 24) and keyed with the background on (0, 200, 90); the edge-contact split reads a leaning piece as residual when the frame was keyed from a leaning background and as the subject's when it was keyed from (8, 162, 24); on (0, 200, 64) with a leaning green, (0, 200, 71) in its bin or (0, 200, 90) in a bin of its own, over the top-left corner (20.5% of the samples) or everywhere but a 32 x 32 block of the background (77.3%), the detector returns (0, 200, 64) and the frame keys exactly as from that colour pinned, a teal subject (0, 154, 149) just outside the ball keeping every pixel; a leaning-green border on (0, 200, 90), past the cut, with no 2.45.2 candidate, or with a block of one under 12% of the samples, is found through the lean and keys out; and over every 8-wide bin of green, the floor of the mean of 2.45.2 candidates is one of them; on (0, 210, 80), inside the key's cut, with no 2.45.2 candidate on the border or with 11% of the samples an interior-family green, the detector keeps the declared key and the frame keys exactly as with the key pinned, a teal subject (0, 154, 149) losing no pixel; a leaning-green leaf of the subject along the bottom edge over a leaning background the key clears, a second leaning green in a corner, and a soft rim crossing the cut where the subject meets the side edges each keep the declared key; with 1.5% of the border a step past the cut the key is kept, and with 2.5% the leaning colour is read; (0, 200, 90) is read with a cut of 96 and not with a cut of 110; over a sweep of borders around the cut every answer is the 2.45.2 answer or the answer that reads the lean, and both occur, as do borders where the two differ and the key is kept), `tests/frames/test_key_detect_banded.py` (the whole-image reference now states this rule, and leaning-green borders (past, across and inside the cut, and two leaning greens on one border) join the images the banded detector is checked against), `tests/video/test_canvas_key_normalize.py` (`video-canvas` repaints a leaning-green still to the exact key and accepts `--key green` on it), and `tests/video/test_video_spill.py` (on a leaning green, `--spill auto` reads the reference as `full` with no key material, and the frame keys with no opaque background pixel and no edge contact, the subject byte-identical, with `--decontam off` and `palette`).
+ - **New: The Breathe layer adds `mode: "smooth"` for large illustrations and video frames.**
+ Set per row: `states.<state>.breathe = {"mode": "smooth", "depth": ..., "breaths": ...}`.
+ `pixel` stays the default.
+ The head and everything above the measured neck line stays in place, byte for byte, in every cell.
+ The figure's bottom stays put.
+ It reuses the automatic anatomy: rigid row, body axis, torso half width, and basis rows.
+ It also uses the neck's width, measured once on the row's first cell.
+ The whole row uses that placement.
+ The chest breathes from its centre.
+ It uses a round (cos^2) weight on the body axis at `chest_y` of the body below the neck.
+ The weight is `chest_rx` x torso half width wide, and `chest_ry` x the body below the neck tall.
+ The chest centre rises by `depth` x basis rows at the in-breath and puffs out by `depth_x` from P (not from the ellipse centre).
+ Two shoulder weights, on either side just below the neck, rise by `shoulder` x the chest's rise.
+ They rise `shoulder_lag` of a breath later.
+ The neck and the collar beside it hold still.
+ Whole rows do not move.
+ For a figure whose body axis is pulled to one side (for example by long hair), the chest is not on the axis: `chest_x` moves the chest ellipse's centre off the body axis, in torso half widths (-1 to 1).
+ The shoulders stay where they were (relative to the body axis).
+ For a turned body: `chest_tilt` (degrees, clockwise on screen) and `chest_dir` (degrees from straight up, negative = up-left).
+ `chest_bias` moves the chest weight's peak P along the chest ellipse's long axis, as a share of its horizontal half width (-0.9 to 0.9, negative is the screen's left).
+ `chest_bias_y` moves the peak P across the long axis, as a share of the vertical half height (-0.9 to 0.9, positive is down).
+ The weight falls from P to the ellipse's rim along the ray from P through each point, so the near side falls off over a short distance and the far side over a long one.
+ P must stay inside the ellipse: `chest_bias` and `chest_bias_y` together at most 0.9 of the radii (refused otherwise).
+ `chest_flat` is the share of the way from the peak P to the rim that rises in full (0 to 0.9).
+ These default to 0; at 0, nothing changes.
+ One breath is a bump from rest (in-breath 40 %, out 60 %).
+ A cell at phase 0 is the source byte for byte.
+ Seams and joins between loops are untouched.
+ `breaths` is a whole number.
+ `breath_peaks` is a list of cells where each in-breath peaks, for timing the breath from outside (for example to keep the breath's peaks off a big hand movement in the clip).
+ The breath count is the number of peaks (`breaths`, if given, must match).
+ The first cell stays at rest and the loop closes at rest: breaths are separated by rests at cell 0, between two peaks where the out-breath has taken 60 % of the gap and the next in-breath 40 %, and at the loop's end.
+ Refused, never silently clamped: `lag` on smooth (it would move the first cell), a stretch past the per-row strain cap (0.25) or a fold, opaque pixels pushed off the canvas, out-of-range values, `chest_bias` and `chest_bias_y` together past 0.9 of the radii, a peak at cell 0, peaks not increasing or closer than two cells, a last peak within one cell of the loop's end, mismatched `breaths`, and shape keys or `breath_peaks` on a pixel row.
+ With the default shape nothing leaves the canvas.
+ A figure cut by the frame at its sides or bottom is not refused.
+ Defaults: `depth` 0.0085 (about 0.5 % of the frame height on a bust illustration), `depth_x` 0.028, `chest_y` 0.31, `chest_rx` 0.83, `chest_ry` 0.28, `shoulder` 0.5, `shoulder_lag` 0.08, and `chest_tilt`, `chest_bias`, `chest_bias_y`, `chest_dir`, `chest_x`, and `chest_flat` 0.
+ Performance is about 0.2 s per 960 px frame.
+ - **New: `sprite-gen breathe <frames> <out>` lays the Breathe layer over a folder of loop frames outside curation.**
+ This lays the Breathe layer (either mode) over a folder of loop frames that is not a curation run, such as a video loop's cells.
+ It takes the sidecar's values through the same checks and the same bake: `--mode`, `--depth`, `--depth-x`, `--breaths`, `--breath-peaks` (for example `--breath-peaks 30,102`), `--lag`, and `--rigid-row`.
+ It also takes the smooth shape flags: `--chest-y`, `--chest-rx`, `--chest-ry`, `--shoulder`, `--shoulder-lag`, `--chest-tilt`, `--chest-bias`, `--chest-bias-y`, `--chest-dir`, `--chest-x`, and `--chest-flat`.
+ The same values give the same bytes as a curation bake.
+ It writes the frames under their names and `breathe.json` (config, phases, the anatomy used) into a new folder all at once.
+ Before creating or deleting anything, it refuses if `<out>` and `<frames>` are the same folder, if either lies inside the other based on real disk location (following symbolic links and treating two spellings on a case-insensitive disk as the same folder), or if `<out>` already exists and is not empty, while an existing empty folder is accepted.
+ It never writes anything into `<frames>`, and it never changes or deletes any frames or other files there.
+ It builds the result in a temporary folder of its own next to `<out>`, with a name no other folder has, and moves it into place in one step, deleting only that temporary folder if a run cannot finish while leaving alone folders it did not make, such as a leftover temporary folder of an earlier run.
+ When `<out>` is a symbolic link to an empty folder, the result is placed in the folder the link points to, and the link stays.
+ - **Output change: The curation webview does not preview a smooth row.**
+ The live preview mirrors the pixel warp only.
+ It shows the original frame with a notice.
+ Its row video export refuses.
+ Saving keeps a smooth sidecar exactly as written instead of filling pixel defaults.
+ - **New: The follow-through is now the Sway layer, replacing `video-follow` with `video-sway`.**
+ `video-sway` and `video-sway-inspect` replace `video-follow` and `video-follow-inspect`.
+ Their Python modules are `sprite_gen.video.sway`, `sway_loop`, `sway_offsets`, and `sprite_gen.video.sway_inspect`.
+ `video-follow` and `video-follow-inspect` remain as aliases with the same results and their own name in messages.
+ A loop's record is read under `sway` or `follow`.
+ Behaviour is unchanged.
+ - **New: `Anatomy` gains `origin` and `neck_span` values.**
+ It does not put these two values in the sidecar or the manifest.
+ `origin` records where the measured frame's figure sits.
+ `neck_span` records the neck's span on the rigid row.
+ Pixel Breathe does not use them.
+ - **Fix: every command prints on a Windows console or pipe in a legacy code page.** A line a command prints can hold an em dash, Korean or a path in any script; on cp949 (Korean Windows) or cp1252 Python could not encode it, and the command died at the print after its work was done (`background-tile` on Korean Windows). Each command's entry now reopens stdout and stderr as UTF-8 where they are not already (`sprite_gen.util.console.utf8_streams`, called first by every `main()` and by `sprite-gen`); importing sprite_gen leaves a program's streams alone. Test: `tests/util/test_console.py`.
+
+ ## v2.45.3 - The seam check reads the frames that play when the body anchor spreads a sideways slide; such a cut passes again, as it did in 2.44.0
+
+ **Upgrading from 2.45.2: Every cut 2.45.2 passed, and every `--anchor motion-auto` run, gives the same bytes as 2.45.2.** Only `--anchor body` cuts that 2.45.2 refused because of the walk sliding sideways before the anchor can now pass, read on the frames that play. Refused cuts print the same error line as before, the report's `producer` field names the new version, and there are no restoration schema changes.
+
+ - **Fix: `video-loop --anchor body` no longer refuses an evenly sliding walk whose wrap the ramp closed when flow repair makes no frame.** Up to 2.44.0 jump repair remade any frame after a step 1.4 times the median, reading rendered cells. Since 2.45.0 flow repair makes no frame for an evenly sliding walk, so the gate read source frames and refused a wrap the ramp closed: on the tests' synthetic walk (0.1 px right a frame, 2.4 px over 24 frames), 3.08 on source frames, 1.33 on cells that play. Now, where source frames refuse the wrap, `wrap_dx_px` is not 0, no frame was made, and the cut is seam-gated, the gate reads the cells that play again (`seam_as_filmed`). It passes the cut on them (`seam_measurement: rendered-cells`, `resampled_seam_ratio`) when the wrap and largest step against the mean step are both within `--seam-max`. Every step is checked because the ramp moves wrap jumps inward. The report gains `seam_after_anchor` (`source_seam_ratio`, `seam_ratio`, `largest_step_ratio`, `largest_step_into`). Passed cuts remain the same bytes, including `--seam-max 1000`; `--anchor motion`, `motion-auto`, `none` and `feet` do not change, nor do pinned clips, flags, or restoration schemas. The reading is only as fine as the limit: half a stride with swapped legs reads 1.93 on cells that play and passes; without slide it reads 2.19 and is refused. [loop review](docs/loop-review.md#the-body-anchor-and-the-seam-gate)
+ - **Tests** — `tests/video/test_body_anchor_gate.py` (the sliding walk cut by hand from four starts with the repair off passes on the cells that play, and so does the walk cut by hand with the repair on and the stride the search finds, the repair making no frame; the source frames' refusal is the one `--anchor none` gives the same cut; a wrap the ramp does not close is refused with the same error line as `--anchor none` gives for one, two, three or four frames at the wrap moved 4 or 10 px sideways, a frame torn across, holed, or moved 8 px down, and cuts of 18 and 28 frames off the stride; a cut the source frames pass is not read again for the walk without the slide, the sliding walk under `--seam-max 1000`, and a first frame moved 3 px; a pinned clip of the sliding walk is gated by its pin and read on its source frames).
+
## v2.45.2 - The new `video-loop --overlap-wrap off` turns the overlapped wrap off on its own; the motion anchor's fine search is faster and gives the same values
**Upgrading from 2.45.1: By default a run delivers the same bytes as 2.45.1, sooner, and only `--overlap-wrap off` changes what is delivered.** With the default `--overlap-wrap on`, the loop files, the frames and the report are the same bytes as 2.45.1 (the report's `producer` field names the new version), and `video-loop --anchor motion-auto` finishes sooner. With `--overlap-wrap off`, the overlapped wrap is not tried (the report's `wrap_overlap.skipped` reads `turned off (--overlap-wrap off)`, no RIFE calls), a `warning:` line is printed, and the seam gate refuses the cut as filmed, so the run fails on its seam instead of spending minutes of CPU on RIFE. No restoration schemas change: `source-restoration-v5`, repair report `schema_version` 4, comparison `schema_version` 6.
diff --cc SKILL.md
index 3239cf2,c82ff3b..35b1f1e
--- a/SKILL.md
+++ b/SKILL.md
@@@ -11,8 -11,10 +11,10 @@@ depends_on
why: "video-frames (clip -> frames) and video-set"
- name: img2webp
why: "video-loop WebP with exact alpha (libwebp); Pillow's animated writer drops -exact"
+ - name: node
+ why: "face-bake: the face pack's player (sprite-gen-face-v1.mjs) picks the frames"
- name: rife-ncnn-vulkan
- why: "video-loop jump repair and video-cycle-align (RIFE v4.6 in-betweens with the -x -z test-time augmentation, release 20221029). Install once with `sprite-gen rife install` (sha256-checked, into the user data directory); SPRITE_GEN_RIFE or PATH override it; Linux without a GPU also needs libvulkan1 mesa-vulkan-drivers. Without it, walk and run loops are cut as filmed with a warning"
+ why: "video-loop jump repair and video-cycle-align (RIFE v4.6 in-betweens with the -x -z test-time augmentation, release 20221029). Install once with `sprite-gen rife install` (sha256-checked, into the user data directory); SPRITE_GEN_RIFE or PATH override it; Linux without a GPU also needs libvulkan1 mesa-vulkan-drivers. Without it, walk and run loops are cut as filmed with a warning. SPRITE_GEN_RIFE_BACKEND=torch runs the same model in PyTorch instead, for a GPU with no Vulkan (`pip install \"sprite-gen[torch]\"`, then `sprite-gen rife install --backend torch`; SPRITE_GEN_RIFE_DEVICE=cuda or cpu; SPRITE_GEN_RIFE_EXECUTOR=module:attr sends its frames to a GPU elsewhere, rife_torch.serve there)"
required_scripts:
- scripts/prepare_sprite_run.py
- scripts/generate_sprite_image.py
diff --cc docs/loop-repair.md
index 7c83628,a4f1d04..0feff77
--- a/docs/loop-repair.md
+++ b/docs/loop-repair.md
@@@ -1,6 -1,6 +1,6 @@@
# Loop repair — RIFE in-betweens for jump frames, the jolt index, one cycle per set
- > Owns: Where RIFE runs and what it costs, which model and augmentation it runs with, its two backends (the binary and PyTorch, the latter in this process or on a GPU elsewhere), how it is installed and what runs without it, jump-frame repair in `video-loop`, the flow reading (frames off a walk's way), the eased retime (a part that rushes on its way), the jolt index and its gate, cycle alignment across a direction set · Index: [docs/README.md](README.md)
-> Owns: Where RIFE runs and what it costs, which model and augmentation it runs with, how it is installed and what runs without it, jump-frame repair in `video-loop`, the flow reading (frames off a walk's way), the eased retime (a part that rushes on its way), the seam bridge (the wrap of a loop that is not a walk), the jolt index and its gate, cycle alignment across a direction set, the redrawn wrap of a pinned clip (`--wrap-blend`) · Index: [docs/README.md](README.md)
++> Owns: Where RIFE runs and what it costs, which model and augmentation it runs with, its two backends (the binary and PyTorch, the latter in this process or on a GPU elsewhere), how it is installed and what runs without it, jump-frame repair in `video-loop`, the flow reading (frames off a walk's way), the eased retime (a part that rushes on its way), the seam bridge (the wrap of a loop that is not a walk), the jolt index and its gate, cycle alignment across a direction set, the redrawn wrap of a pinned clip (`--wrap-blend`) · Index: [docs/README.md](README.md)
A walk loop cut from a generated clip can look right in every still and still hitch when it
plays: the video model redraws thin hair a little differently every frame, and now and then
@@@ -192,14 -69,9 +192,14 @@@ cut before RIFE existed still cuts —
| Where | Default without RIFE | Asked for by name |
|---|---|---|
- | `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 frames, neighbours and `off` of the group the flow 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-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 frames, neighbours and `off` of the group the flow 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. For the seam bridge, the wrap is cut as filmed: `jump_repair` reads `why`, `rife`, `install`, and `unmade` (the `frames`, `anchors`, and `line` of the run it stopped at). One `video-loop: warning:` line says no frame was made round the wrap and names `sprite-gen rife install`. | `--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 |
+With `SPRITE_GEN_RIFE_BACKEND=torch`, PyTorch not installed or no model where the backend looks is RIFE
+not installed in the same way: the records' `rife` names what was missing and `install` gives the torch
+backend's line (`pip install "sprite-gen[torch]" && sprite-gen rife install --backend torch`); the
+binary is not run in its place.
+
A RIFE that is found and then fails (a binary that cannot reach Vulkan, say) is an error in every
mode: the install is there and broken, which a warning would hide. A jolt gate passed to a loop
whose repair could not run (section 3) reads the loop as filmed, and its failure says the
diff --cc docs/release.md
index 6e47680,10a28ea..b35dbc1
--- a/docs/release.md
+++ b/docs/release.md
@@@ -18,28 -17,20 +18,33 @@@ GitHub-hosted CI(GitHub Actions)는 쓰
lavapipe 에서는 첫 업로드에서 죽는다 — 그래서 그런 호스트에서는 RIFE 를 떼어 내되 조용히 건너뛰지는
않는다.
-`scripts/linux_lane.sh` 레인은 두 번의 `pytest` 호출에 모두 `--full` 을 전달해 모든 시험을 실행한다.
++`scripts/linux_lane.sh` 레인은 `pytest` 호출마다 `--full` 을 전달해 모든 시험을 실행한다(T4 레인도 같다).
+ 일반 `pytest` 실행은 `pyproject.toml` 에 등록된 `slow` 표시 시험을 `tests/conftest.py` 가 실행 대상에서
+ 제외하는 빠른 묶음이다. `tests/release/test_fast_bundle.py` 는 레인의 각 `pytest` 호출에 `--full` 이 있는지
+ 확인한다.
+
실제 rife-ncnn-vulkan 을 돌리는 시험은 `real_rife` 표시를 단다(`pyproject.toml` 이 등록하고,
`tests/conftest.py` 가 RIFE 를 못 찾으면 그 표시가 붙은 시험을 건너뛴다). `--rife-unmeasured` 는
RIFE 가 닿는 곳이 하나도 없는 상태로 스위트 전체를 돌려 그 시험들이 이 이유로 건너뛰어지고,
`--rife-only` 는 `sprite-gen rife install`(그 확인 프레임)과 스위트 전체에서 `real_rife` 가 붙은
- 시험(`pytest -m real_rife`)을 돌린다 — 하나라도 건너뛰거나, 표시된 시험이 없으면 실패다. 그래서 새
-시험(`pytest --full -m real_rife`)을 돌린다 — 하나라도 건너뛰거나, 표시된 시험이 없으면 실패다. 그래서 새
++시험(`pytest --full -m "real_rife and not torch_rife"`, 아래 torch 단계가 나머지)을 돌린다 — 하나라도 건너뛰거나, 표시된 시험이 없으면 실패다. 그래서 새
실제-RIFE 시험은 표시만 붙이면 `--rife-only` 가 저절로 걷는다.
+RIFE 의 torch 백엔드(`SPRITE_GEN_RIFE_BACKEND=torch`, docs/loop-repair.md 1절)를 돌리는 시험은
+`torch_rife` 표시를 단다(`pyproject.toml` 이 등록한다). `tests/conftest.py` 는 PyTorch 가 import 되지
+않거나, `rife.locate_model()` 이 모델을 못 찾거나, `SPRITE_GEN_RIFE_DEVICE` 가 이름 댄 장치가
+없으면(기본 cuda 인데 CUDA 가 없으면) 그 표시가 붙은 시험을 건너뛴다. 레인은 스위트를 다 돈 뒤 같은
+환경에 PyTorch 2.13.0 의 CPU 판을 PyTorch CPU 인덱스에서 깔고, `sprite-gen rife install --backend torch`
- 의 확인 프레임(PyTorch 로 만든다)과 `torch_rife` 가 붙은 시험 전부(`pytest -m torch_rife`)를
++의 확인 프레임(PyTorch 로 만든다)과 `torch_rife` 가 붙은 시험 전부(`pytest --full -m torch_rife`)를
+`SPRITE_GEN_RIFE_DEVICE=cpu` 로 돌린다. 하나라도 건너뛰거나 표시된 시험이 없으면 실패다. `--rife-only`
+도 같은 단계를 돈다. `real_rife` 와 `torch_rife` 가 함께 붙은 시험(같은 기계의 바이너리와 torch 판의
+판정 비교)은 `real_rife` 단계에서 빼고 이 단계에서 돈다. `--rife-unmeasured` 는 이 단계를 돌지 않고, 그
+실행에서는 `torch_rife` 가 붙은 시험도 RIFE 때문에 건너뛸 수 있는 것으로 친다.
+`tests/release/test_lane_rife_collection.py` 의 표시 검사도 두 표시를 같이 받는다. CUDA 위의 torch 판은
+이 레인이 재지 않고 T4 레인이 잰다.
+
표시 없이 RIFE 가 없을 때 건너뛰거나 모이지 않는 시험은 두 실행 어느 쪽도 재지 않는다. 그래서
- `--rife-unmeasured` 는 시험을 `pytest --rife-unmeasured` 로 돌리고, 그 실행에서 건너뛴 것마다 — skip
+ `--rife-unmeasured` 는 시험을 `pytest --full --rife-unmeasured` 로 돌리고, 그 실행에서 건너뛴 것마다 — skip
표시로든, fixture 나 시험 본문에서든, 파일째 import 에서든 — `tests/conftest.py` 가 `real_rife` 표시를
본다. 표시가 없고, 같은 파일의 `NOT_RIFE_SKIPS` 가 RIFE 가 아닌 이유(레인이 주지 않는 입력)로
건너뛴다고 이름 대지도 않았으면, 그 결과를 실패로 바꿔 시험의 이름을 댄다. RIFE 가 없으면 아예 모이지
@@@ -47,37 -38,6 +52,37 @@@
있는 척하는 대역을 둔 채 한 번, 없는 채 한 번 모아, 모이는지나 skip 표시의 판정이 갈리는 시험마다
표시를 요구하고 없으면 그 이름을 대고 실패한다.
+## T4 레인 — torch 판을 CUDA 에서
+
+`scripts/t4_lane.py` 는 Modal 에서 빌린 NVIDIA T4 하나에서 torch 판을 CUDA 로 잰다. 메인테이너의 Modal
+작업 공간에서, 잴 커밋을 체크아웃한 트리(커밋되지 않은 변경이 없는)로 돌린다:
+
+```bash
+modal run --env <환경> scripts/t4_lane.py # 게이트
+modal run --env <환경> scripts/t4_lane.py --whole-suite # 그 앞에 스위트 전체도
+```
+
+HEAD 의 트리(`git archive`)를 이미지로 짓는다. 리눅스 레인이 깨끗한 클론에 까는 것처럼, Python 3.14 의 새
+가상 환경에 PyPI 의 PyTorch 2.13.0 과 트리(`pip install -e ".[dev]"`)를 깐다. PyPI 의 리눅스 휠은 CUDA 13
+판이다(`pip install "sprite-gen[torch]"` 이 받는 것). 의존성도 PyPI 에서 받으므로 PyTorch 인덱스의 오래된
+사본이 끼지 않는다. 모델은 `sprite-gen rife install --backend torch` 로 엔진이 바이너리를 찾지 않는 디렉터리에
+둔다. 스위트가 부르는 도구(ffmpeg, libwebp 1.5 의 img2webp, node, git)도 이미지에 있다. 그리고 T4 에서:
+
+- 설치의 확인 프레임을 CUDA 로 만든다(`sprite-gen rife install --backend torch`, `SPRITE_GEN_RIFE_DEVICE=cuda`).
- - `--whole-suite` 면 그 환경(PyTorch 가 든)에서 스위트 전체를 CUDA 로 돈다. `pytest --rife-unmeasured` 로
++- `--whole-suite` 면 그 환경(PyTorch 가 든)에서 스위트 전체를 CUDA 로 돈다. `pytest --full --rife-unmeasured` 로
+ 돌리므로 바이너리가 닿지 않아 건너뛰는 `real_rife` 말고 다른 건너뜀은 실패다(리눅스 레인의 RIFE 없는
+ 실행과 같다).
+- `torch_rife` 가 붙고 `real_rife` 는 붙지 않은 시험 전부를 CUDA 로 돈다. 하나라도 건너뛰거나 표시된 시험이
+ 없으면 실패다. 둘이 함께 붙은 시험(같은 기계의 바이너리와 torch 판의 판정 비교)은 리눅스 레인 몫이다. T4 의
+ GPU 는 계산만 내주므로 바이너리가 쓰지 못한다.
+
+실행은 함수 호출 id, GPU 와 드라이버, 단계마다의 출력을 찍는다. 모든 단계가 통과해야 exit 0 이다. T4 레인이
+통과했다는 것은 그 커밋에서 돈 실행 하나가 exit 0 으로 끝났다는 뜻이다. 두 레인이 같은 PyTorch 와 Python 을
+까는지는 `tests/release/test_t4_lane.py` 가 본다.
+
+## 통과는 커밋 하나의 것이다
+
+커밋이 레인을 통과했다는 것은 그 커밋에서 리눅스 레인이 통과하고(위 정의) T4 레인이 통과했다는 뜻이다.
통과는 커밋 하나의 것이다. 어떤 커밋에서 잰 레인 — 한 번의 exit 0 이든, `--rife-only` 의 exit 0 이든 —
은 다른 커밋의 통과가 아니다. 이전 릴리즈나 부모 커밋의 통과를 다음 커밋으로 옮겨 적지 않고, 머지할
커밋과 태그 커밋을 각각 그 SHA 의 깨끗한 클론에서 잰다. `--rife-unmeasured` 로 잰 커밋은 같은 SHA 의
diff --cc pyproject.toml
index 8586665,2160ef7..7a05f46
--- a/pyproject.toml
+++ b/pyproject.toml
@@@ -78,11 -73,11 +78,14 @@@ pythonpath = ["tests"
timeout = 120
# One mark names a test of the real rife-ncnn-vulkan: tests/conftest.py skips it where no RIFE is
# reachable, and `scripts/linux_lane.sh --rife-only` runs exactly the marked tests (`-m real_rife`).
-# The other names a slow test: a plain `pytest` is the fast bundle, which tests/conftest.py makes by
+# Another names a test of the torch backend: skipped where PyTorch or the rife-v4.6 model is missing, run by
+# the lanes with none skipped (`-m torch_rife`, on SPRITE_GEN_RIFE_DEVICE; docs/release.md).
++# The last names a slow test: a plain `pytest` is the fast bundle, which tests/conftest.py makes by
+ # deselecting the marked tests, and `pytest --full` runs every test, as the release lane does.
markers = [
"real_rife: runs the real rife-ncnn-vulkan; skipped where none is reachable, run by `scripts/linux_lane.sh --rife-only`",
+ "torch_rife: runs RIFE's torch backend; skipped where PyTorch or the model is missing, run by the lanes with `-m torch_rife`",
+ "slow: a case takes 1 s or more, or the function's cases 5 s or more together (an 8-core M1); deselected unless `pytest --full`",
]
# The pipeline ships an importable sprite_gen package. The canonical invocation is the
diff --cc scripts/linux_lane.sh
index bfdc77f,2e65b68..23a843b
--- a/scripts/linux_lane.sh
+++ b/scripts/linux_lane.sh
@@@ -84,20 -79,6 +86,21 @@@ fail()
step() {
echo "== $*"
}
+# RIFE's torch backend on the CPU: PyTorch into .venv, the install's check frame through it (the model
+# `sprite-gen rife install` already put in place), and every test marked torch_rife, none skipped.
+torch_gates() {
+ step "RIFE torch backend (PyTorch $TORCH_VERSION, CPU)"
+ .venv/bin/pip install --quiet --index-url "$TORCH_CPU_INDEX" "torch==$TORCH_VERSION"
+ .venv/bin/python -c 'import torch; print("torch", torch.__version__, "cuda", torch.version.cuda)'
+ SPRITE_GEN_RIFE_BACKEND=torch SPRITE_GEN_RIFE_DEVICE=cpu .venv/bin/sprite-gen rife install
+ step "RIFE torch tests (every test marked torch_rife, none skipped)"
+ torch_log=$(mktemp)
- # No test marked: pytest exits 5 ("no tests ran"), and the lane with it.
- SPRITE_GEN_RIFE_DEVICE=cpu .venv/bin/python -m pytest -q -rs -m torch_rife | tee "$torch_log"
++ # No test marked: pytest exits 5 ("no tests ran"), and the lane with it. --full: a marked test that is
++ # also marked slow runs too.
++ SPRITE_GEN_RIFE_DEVICE=cpu .venv/bin/python -m pytest -q -rs --full -m torch_rife | tee "$torch_log"
+ ! grep -E '^SKIPPED' "$torch_log" >/dev/null || fail "a torch_rife test skipped; this run is meant to measure them"
+ rm -f "$torch_log"
+}
cd "$(git rev-parse --show-toplevel)"
root=$(pwd -P)
@@@ -142,11 -126,10 +148,11 @@@ if [ "$rife_only" = 1 ]; the
step "RIFE tests (every test marked real_rife, none skipped)"
rife_log=$(mktemp)
trap 'rm -f "$rife_log"' EXIT
- # No test marked: pytest exits 5 ("no tests ran"), and the lane with it. Those marked torch_rife as
- # well run with the torch backend's.
- .venv/bin/python -m pytest -q -rs -m "real_rife and not torch_rife" | tee "$rife_log"
+ # No test marked: pytest exits 5 ("no tests ran"), and the lane with it. --full: a marked test that is
- # also marked slow runs too.
- .venv/bin/python -m pytest -q -rs --full -m real_rife | tee "$rife_log"
++ # also marked slow runs too. Those marked torch_rife as well run with the torch backend's.
++ .venv/bin/python -m pytest -q -rs --full -m "real_rife and not torch_rife" | tee "$rife_log"
! grep -E '^SKIPPED' "$rife_log" >/dev/null || fail "a RIFE test skipped; this run is meant to measure them"
+ torch_gates
echo "linux_lane: the RIFE gates passed at $sha"
exit 0
fi
@@@ -175,14 -158,10 +181,15 @@@ test -f "$smoke/run/sprite-sheet-alpha.
test -f "$smoke/run/manifest.json"
step "tests"
- # Without RIFE, a skip of a test not marked real_rife or torch_rife fails unless tests/conftest.py names it.
- # PyTorch is not installed yet: the tests marked torch_rife skip here and run in torch_gates.
- .venv/bin/python -m pytest -q ${rife_unmeasured:+--rife-unmeasured}
+ # Every test (--full): a plain pytest is the fast bundle, the tests marked slow deselected. Without RIFE, a
-# skip of a test not marked real_rife fails unless tests/conftest.py names it.
++# skip of a test not marked real_rife or torch_rife fails unless tests/conftest.py names it. PyTorch is not
++# installed yet: the tests marked torch_rife skip here and run in torch_gates.
+ .venv/bin/python -m pytest -q --full ${rife_unmeasured:+--rife-unmeasured}
+if [ -z "$rife_unmeasured" ]; then
+ torch_gates
+fi
+
if [ -n "$rife_unmeasured" ]; then
echo "linux_lane: every gate but RIFE passed at $sha"
echo "linux_lane: RIFE NOT MEASURED here ($rife_unmeasured): run \`scripts/linux_lane.sh --rife-only\` at $sha on a host where Vulkan works"
diff --cc scripts/t4_lane.py
index ade18f7,0000000..9007a40
mode 100644,000000..100644
--- a/scripts/t4_lane.py
+++ b/scripts/t4_lane.py
@@@ -1,158 -1,0 +1,159 @@@
+# SPDX-License-Identifier: Apache-2.0
+"""The torch backend's CUDA gates, on an NVIDIA T4 rented from Modal: the GPU run `scripts/linux_lane.sh` leaves to this
+lane (docs/release.md). GitHub-hosted CI is not used.
+
+ modal run [--env <environment>] scripts/t4_lane.py [--whole-suite]
+
+Run it from a checkout of the commit being measured with no uncommitted changes: it measures HEAD, its tree as
+`git archive` writes it. The tree is built into an image as the Linux lane installs a clean clone: Python PINNED_PYTHON,
+a new virtual environment holding PyTorch TORCH_VERSION from PyPI (its Linux wheel is the CUDA 13 build, the one
+`pip install "sprite-gen[torch]"` takes; its dependencies come from PyPI too, never the PyTorch index's older copies),
+then the tree (`pip install -e ".[dev]"`) and the model (`sprite-gen rife install --backend torch --no-check`, into a
+directory of its own: the engine looks for no binary here, which is the Linux lane's to measure, and nothing here runs
+Vulkan). The image holds the whole suite's tools as the Linux lane's host does (ffmpeg, img2webp from libwebp >= 1.5,
+node, git). Then, on one T4:
+
+ - the install's check frame on CUDA (`sprite-gen rife install --backend torch` again, SPRITE_GEN_RIFE_DEVICE=cuda);
- - with --whole-suite, the whole suite in that environment, PyTorch in it, on CUDA (`pytest --rife-unmeasured`: the
- tests marked real_rife skip, the binary not being reachable, and any other skip fails unless tests/conftest.py
- names it, as in the Linux lane's RIFE-less run);
++ - with --whole-suite, the whole suite in that environment, PyTorch in it, on CUDA (`pytest --full --rife-unmeasured`:
++ the tests marked slow run too, the tests marked real_rife skip, the binary not being reachable, and any other skip
++ fails unless tests/conftest.py names it, as in the Linux lane's RIFE-less run);
+ - every test marked torch_rife and not real_rife, on CUDA, none skipped. Those marked both set this machine's binary
+ beside the torch backend: the Linux lane runs them.
+
+It prints the function call's id, the GPU, its driver and what each step said, and exits 0 only where every step passed.
+A commit has passed the T4 lane where one run of it at that commit exited 0.
+"""
+from __future__ import annotations
+
+import atexit
+import json
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+import time
+from pathlib import Path
+
+import modal
+
+PINNED_PYTHON = "3.14"
+PYTHON_IMAGE = "python:3.14.9-slim-trixie"
+# The PyTorch the torch backend was measured on, as the Linux lane installs it (there from PyTorch's CPU index).
+TORCH_VERSION = "2.13.0"
+GPU = "T4"
+VENV = "/lane/venv"
+SRC = "/lane/src"
+RIFE_DIR = "/lane/rife"
+
+
+def _fail(why: str) -> None:
+ print(f"t4_lane: {why}", file=sys.stderr)
+ raise SystemExit(1)
+
+
+def _source() -> tuple[str, Path]:
+ """HEAD and its tree as `git archive` writes it, from a checkout with no uncommitted changes."""
+ root = Path(__file__).resolve().parents[1]
+
+ def git(*args: str) -> str:
+ return subprocess.run(["git", "-C", str(root), *args], check=True, capture_output=True, text=True).stdout
+
+ if git("status", "--porcelain", "--untracked-files=no").strip():
+ _fail("the checkout has uncommitted changes")
+ sha = git("rev-parse", "HEAD").strip()
+ work = Path(tempfile.mkdtemp(prefix="t4-lane-"))
+ atexit.register(shutil.rmtree, work, True)
+ tree = work / "source.tar.gz"
+ subprocess.run(["git", "-C", str(root), "archive", "--format=tar.gz", "-o", str(tree), sha], check=True)
+ return sha, tree
+
+
+# Only where `modal run` starts: the container imports this file again and needs no source of its own.
+SHA, TREE = _source() if modal.is_local() else ("", Path("/nonexistent"))
+
+image = (
+ modal.Image.from_registry(PYTHON_IMAGE)
+ .apt_install("ffmpeg", "webp", "nodejs", "git")
+ .env({"PIP_DISABLE_PIP_VERSION_CHECK": "1", "PYTHONDONTWRITEBYTECODE": "1"})
+ .run_commands(f"python{PINNED_PYTHON} -m venv {VENV}", f"{VENV}/bin/pip install --quiet torch=={TORCH_VERSION}")
+ .add_local_file(TREE, "/lane/source.tar.gz", copy=True)
+ .run_commands(
+ f"mkdir -p {SRC} && tar -xzf /lane/source.tar.gz -C {SRC} && rm /lane/source.tar.gz",
+ f"printf '%s\\n' {SHA} > /lane/SOURCE_SHA",
+ f'{VENV}/bin/pip install --quiet -e "{SRC}[dev]"',
+ f"{VENV}/bin/pip freeze --exclude-editable > /lane/pip-freeze.txt",
+ f"SPRITE_GEN_RIFE_BACKEND=torch {VENV}/bin/sprite-gen rife install --dir {RIFE_DIR} --no-check > /lane/rife-install.json",
+ )
+)
+app = modal.App("sprite-gen-t4-lane", image=image)
+
+
+def _step(steps: list[dict], name: str, argv: list[str], env: dict[str, str]) -> subprocess.CompletedProcess[str]:
+ print(f"== {name}", flush=True)
+ t0 = time.monotonic()
+ proc = subprocess.run(argv, cwd=SRC, env=env, capture_output=True, text=True)
+ out = proc.stdout + proc.stderr
+ steps.append({"name": name, "exit": proc.returncode, "seconds": round(time.monotonic() - t0, 1), "out": out})
+ return proc
+
+
[email protected](gpu=GPU, cpu=2.0, memory=8192, timeout=7200)
+def gates(sha: str, whole_suite: bool) -> dict:
+ """The steps above, in this container: their exits and what they said."""
+ built = Path("/lane/SOURCE_SHA").read_text().strip()
+ rec: dict = {"commit": sha, "image_commit": built, "whole_suite": whole_suite, "steps": [], "passed": False}
+ if built != sha:
+ rec["why"] = f"the image holds {built}, not {sha}"
+ return rec
+ model = Path(json.loads(Path("/lane/rife-install.json").read_text())["dir"]) / "rife-v4.6"
+ # Nowhere the engine looks for the binary holds one: an empty data directory, nothing on PATH, no SPRITE_GEN_RIFE.
+ env = {k: v for k, v in os.environ.items() if not k.startswith("SPRITE_GEN_")}
+ env.update(PATH=f"{VENV}/bin:{env.get('PATH', '/usr/local/bin:/usr/bin:/bin')}", XDG_DATA_HOME=tempfile.mkdtemp(),
+ SPRITE_GEN_RIFE_MODEL=str(model), SPRITE_GEN_RIFE_DEVICE="cuda")
+ steps = rec["steps"]
+ rec["pip_freeze"] = Path("/lane/pip-freeze.txt").read_text()
+ smi = subprocess.run(["nvidia-smi", "--query-gpu=name,driver_version,memory.total", "--format=csv,noheader"],
+ capture_output=True, text=True)
+ rec["gpu"] = (smi.stdout or smi.stderr).strip()
+ probe = _step(steps, "PyTorch", [f"{VENV}/bin/python", "-c", "import torch; print('torch', torch.__version__, 'cuda', "
+ "torch.version.cuda, 'cudnn', torch.backends.cudnn.version(), 'gpu', "
+ "torch.cuda.get_device_name() if torch.cuda.is_available() else None)"], env)
+ if probe.returncode != 0 or "gpu None" in probe.stdout:
+ rec["why"] = "PyTorch finds no CUDA GPU here"
+ return rec
+ if _step(steps, "RIFE torch backend (sprite-gen rife install --backend torch, its check frame on CUDA)",
+ [f"{VENV}/bin/sprite-gen", "rife", "install", "--backend", "torch", "--dir", RIFE_DIR], env).returncode != 0:
+ rec["why"] = "the install's check frame failed"
+ return rec
- pytest = [f"{VENV}/bin/python", "-m", "pytest", "-q", "-rs", "-p", "no:cacheprovider"]
++ # --full: every test, those marked slow too (a plain pytest is the fast bundle).
++ pytest = [f"{VENV}/bin/python", "-m", "pytest", "-q", "-rs", "-p", "no:cacheprovider", "--full"]
+ if whole_suite and _step(steps, "the whole suite (PyTorch in the environment, on CUDA; the binary not reachable)",
+ [*pytest, "--basetemp", tempfile.mkdtemp(), "--rife-unmeasured"], env).returncode != 0:
+ rec["why"] = "the whole suite failed"
+ return rec
+ # No test marked: pytest exits 5 ("no tests ran"), and the lane with it.
+ marked = _step(steps, "RIFE torch tests on CUDA (every test marked torch_rife and not real_rife, none skipped)",
+ [*pytest, "--basetemp", tempfile.mkdtemp(), "-m", "torch_rife and not real_rife"], env)
+ if marked.returncode != 0:
+ rec["why"] = "a torch_rife test failed"
+ elif any(line.startswith("SKIPPED") for line in marked.stdout.splitlines()):
+ rec["why"] = "a torch_rife test skipped; this run is meant to measure them"
+ else:
+ rec["passed"] = True
+ return rec
+
+
[email protected]_entrypoint()
+def main(whole_suite: bool = False) -> None:
+ call = gates.spawn(SHA, whole_suite)
+ print(f"t4_lane: commit {SHA}, {GPU}, function call {call.object_id}", flush=True)
+ rec = call.get()
+ print(f"gpu {rec.get('gpu')}")
+ print(rec.get("pip_freeze", "").rstrip())
+ for step in rec["steps"]:
+ print(f"== {step['name']}: exit {step['exit']}, {step['seconds']} s")
+ print(step["out"].rstrip())
+ if not rec["passed"]:
+ _fail(f"{rec.get('why')} at {SHA} (function call {call.object_id})")
+ print(f"t4_lane: the torch backend's CUDA gates passed at {SHA} (function call {call.object_id})")
diff --cc sprite_gen/video/loop.py
index 982a114,c789413..28cda9b
--- a/sprite_gen/video/loop.py
+++ b/sprite_gen/video/loop.py
@@@ -1059,8 -1129,122 +1128,121 @@@ def _overlap_refused(overlap: dict[str
rest = ", the rest not made" if t["unmade"] else ""
return f"{', '.join(t['rejected_for'])} ({', '.join(stopped['faults'])} at frame {stopped['frame']}{rest})"
- refused = "; ".join(f"{t['width']} frames {t['side']} the wrap: {why(t)}" for t in overlap["tries"])
- return [f"{said}, and the overlapped wrap was refused ({refused}): cut as filmed (docs/loop-repair.md section 2)"]
+ return "; ".join(f"{t['width']} frames {t['side']} the wrap: {why(t)}" for t in overlap["tries"])
+
+
+ def _unfixed_lines(jump_repair: dict[str, Any]) -> list[str]:
+ """Each drawing the jump repair left off the walk's flow (`jump_repair.unfixed`), in words."""
+ lines = []
+ for u in jump_repair.get("unfixed") or []:
+ frames = u["frames"]
+ why = (f"the group that would bring it back was refused ({', '.join(u['refused'])}), so it plays as filmed"
+ if "refused" in u else f"no group of up to {jump_repair['span']} drawings brings it under {jump_repair['limit']:g}")
+ lines.append(f"frame{'s' if len(frames) > 1 else ''} {', '.join(map(str, frames))} of the loop lie{'' if len(frames) > 1 else 's'} "
+ f"{u['off']:.2f}x its window's usual step off the walk's flow after the jump repair: {why}")
+ return lines
+
+
+ def _step_reason(jump_repair: dict[str, Any], frames: set[int]) -> dict[str, Any]:
+ """Why a step between drawings jumps, where the jump repair says it: a drawing of it (`frames`) left off the walk's
+ flow (`jump_repair.unfixed`) — the group that would bring it back refused (`repair-refused`, its faults), or none
+ found (`unfixed`) — a refused group's drawing first: the drawings beside it read off the flow because it is; with the
+ failure line's `words`. Elsewhere the reason is not known (`reason` None)."""
+ for u in sorted(jump_repair.get("unfixed") or [], key=lambda u: "refused" not in u):
+ if not frames & set(u["frames"]):
+ continue
+ at = f"frame{'s' if len(u['frames']) > 1 else ''} {', '.join(map(str, u['frames']))} lie{'' if len(u['frames']) > 1 else 's'} off the walk's flow"
+ if "refused" in u:
+ return {"reason": "repair-refused", "frames": u["frames"], "refused": u["refused"],
+ "words": f": {at}, and the jump repair's frame there was refused ({', '.join(u['refused'])}), so it plays as filmed"}
+ return {"reason": "unfixed", "frames": u["frames"],
+ "words": f": {at}, and no group of up to {jump_repair['span']} drawings brings it back"}
+ return {"reason": None}
+
+
+ def seam_reason(report: dict[str, Any], cycle: dict[str, Any]) -> dict[str, Any]:
+ """Why the seam gate refuses a cut, where the warning lines say it: a cut of two steps by the clip's crossings whose
+ wrap a part on a beat of its own leaves open (`own-beat`) — the overlapped wrap was asked (`wrap_overlap`,
+ `_overlap_lines`), or no two-step cut closes (`local_cycle.step_verdict`). `overlap_wrap` says what became of the
+ overlapped wrap (made, skipped, rife not installed, refused; None where it was not asked) and `words` the failure
+ line's. Elsewhere the reason is not known (`reason` None)."""
+ overlap = report.get("wrap_overlap")
+ counted = cycle.get("step_count") or {}
+ if overlap is None and not (counted.get("chosen_by") == "two steps" and not counted.get("gated")):
+ return {"reason": None}
+ words = "the cut covers two steps by the clip's crossings, and a part on a beat of its own (a tail, a held prop) closes on no cut of two steps"
+ if overlap is None:
+ outcome = None
+ elif overlap["frames"]:
+ outcome = "made"
+ words += f": the overlapped wrap was made (frames {', '.join(map(str, overlap['frames']))}) and the wrap still does not close"
+ elif "rife" in overlap:
+ outcome = "rife not installed"
+ words += ": RIFE is not installed, so the overlapped wrap was not made"
+ elif "skipped" in overlap:
+ outcome = "skipped"
+ words += f": the overlapped wrap was not made ({overlap['skipped']})"
+ else:
+ outcome = "refused"
+ words += f": the overlapped wrap was refused ({_overlap_refused(overlap)})"
+ return {"reason": "own-beat", "overlap_wrap": outcome, "words": words}
+
+
+ def _bridge_seam(frames: list[Image.Image], interpolate: rife_mod.Interpolate | None, *, facing: str, required: bool,
+ seam_max: float, hold: int | None, skip: str | None = None) -> tuple[list[Image.Image], dict[str, Any]]:
+ """`repair_mod.seam_bridge` on a loop that is not a walk, with RIFE located only once a frame is to be made: a wrap
+ that reads as a step of the loop needs no binary. The record names the interpolator that made the frames.
+
+ A frame to make and no RIFE installed: `required` lets `RifeNotInstalled` through; otherwise the wrap is read again
+ with no interpolator, cut as filmed, and the record says why (`rife`, `install`, the run it stopped at `unmade`)."""
+ made_by: list[dict[str, str]] = []
+
+ def lazy(a: Image.Image, b: Image.Image, t: float) -> Image.Image:
+ nonlocal interpolate
+ if interpolate is None:
+ found = rife_mod.Rife()
+ made_by.append(found.describe())
+ interpolate = found
+ return interpolate(a, b, t)
+
+ asked = partial(repair_mod.seam_bridge, limit=seam_max, hold=hold, facing=facing, skip=skip)
+ try:
+ frames, record = asked(frames, lazy)
+ except rife_mod.RifeNotInstalled as exc:
+ if required:
+ raise
+ frames, record = asked(frames, None)
- record.update(why="RIFE not installed — the wrap cut as filmed", rife=str(exc), install=rife_mod.INSTALL_COMMAND)
++ record.update(why="RIFE not installed — the wrap cut as filmed", rife=str(exc), install=rife_mod.install_command())
+ record["applied"] = bool(record["replaced"])
+ if record["calls"]:
- record["interpolator"] = ({"kind": "rife-ncnn-vulkan", **made_by[0], "binary_calls": interpolate.calls}
- if made_by else {"kind": "injected"})
++ record["interpolator"] = {**made_by[0], **interpolate.counts()} if made_by else {"kind": "injected"}
+ return frames, record
+
+
+ def _bridge_lines(bridge: dict[str, Any]) -> list[str]:
+ """What became of a wrap the seam bridge read as a jump (`repair.seam_bridge`), in words (`video-loop: warning:`
+ lines): the frames made and the ones to look at, or why none was made. A wrap that reads as a step says nothing."""
+ if "skipped" in bridge:
+ return []
+ said = (f"the loop's wrap jumps (its step {bridge['seam']:.2f}x the mean of the {bridge['around']} steps either side, "
+ f"over {bridge['limit']:g})")
+ if bridge["replaced"]:
+ taken = bridge["tries"][-1]
+ a, b = taken["anchors"]
+ return [f"{said}: frames {', '.join(map(str, taken['frames']))} were made again by RIFE between frames {a} and {b} "
+ "(cycle/), so the loop plays across it — look at them in the loop, or cut it with --repair off "
+ "(docs/loop-repair.md section 2)",
+ *(f"frame {m['frame']} was made at the wrap with RIFE's frame between frames {a} and {b}, which may "
+ f"cross-fade two drawings inside its outline (crossfade {m['proposal']['crossfade']:.4f}); kept, a reading "
+ "to look at (docs/loop-repair.md section 4)" for m in taken["made"] if m["look"])]
+ if "unmade" in bridge:
- return [f"{said}, and RIFE is not installed, so no frame was made round it — run `{rife_mod.INSTALL_COMMAND}` "
++ return [f"{said}, and RIFE is not installed, so no frame was made round it — run `{rife_mod.install_command()}` "
+ "and cut it again (docs/loop-repair.md section 2)"]
+ reasons = {"line": "the straight line between its anchors does not close it", "fault": "a frame made has a fault",
+ "seam": "the frames made do not close it"}
+ refused = "; ".join(f"{t['width']}: {reasons[t['rejected_for']]}" + (f" ({', '.join(t['faults'])})" if t.get("faults") else "")
+ for t in bridge["tries"])
+ return [f"{said}, and no frames made round it close it ({refused}): cut as filmed (docs/loop-repair.md section 2)"]
def _shifts(analysis: dict[str, Any]) -> tuple[np.ndarray, int]:
@@@ -1738,7 -2219,27 +2217,27 @@@ def _cut_loop
rush = report_base["jump_repair"]["surge"]
print(f"video-loop: warning: a part of the loop rushes (frames {rush['frames']}, {rush['ratio']:.1f}x its steps "
"either side) and was not eased — RIFE is not installed, so the loop is cut as filmed; "
- f"run `{rife_mod.INSTALL_COMMAND}` and cut it again (docs/loop-repair.md section 2)", file=sys.stderr)
+ f"run `{rife_mod.install_command()}` and cut it again (docs/loop-repair.md section 2)", file=sys.stderr)
+ elif repair != "off" and cycle["kind"] not in nonloop.KINDS:
+ # A loop that is not a walk: its flow is not read (an idle's blink would leave it), its wrap alone is, and the
+ # frames round a wrap that jumps are made again (the seam bridge, docs/loop-repair.md section 2). A pinned clip
+ # the pin refuses is refused whatever its wrap shows.
+ pin_refused = cycle["kind"] == "pinned" and cycle["pin_error"] > cycle["pin_tolerance"]
+ try:
+ frames, report_base["jump_repair"] = _bridge_seam(
+ frames, interpolate, facing=facing, required=repair == "on", seam_max=seam_max,
+ hold=report_base["cycle_drawings"]["hold"],
+ skip="the pin does not close: the clip is refused on it" if pin_refused else None)
+ except (ValueError, rife_mod.RifeUnavailable) as exc:
- fix = (f"install RIFE (`{rife_mod.INSTALL_COMMAND}`), or pass --repair auto to cut it as filmed with a warning"
++ fix = (f"install RIFE (`{rife_mod.install_command()}`), or pass --repair auto to cut it as filmed with a warning"
+ if isinstance(exc, rife_mod.RifeNotInstalled) else "fix RIFE, or pass --repair off to cut it as filmed")
+ error = f"video-loop: {exc}; the loop's wrap jumps and the frames round it are to be made — {fix} (docs/loop-repair.md section 2)"
+ refuse(target, out_dir, name, {**report_base, "status": "failed", "error": error, "cycle": cycle})
+ raise SystemExit(error) from exc
+ if report_base["jump_repair"]["replaced"]:
+ report_base["seam_measurement"] = "rendered-cells"
+ for line in _bridge_lines(report_base["jump_repair"]):
+ print(f"video-loop: warning: {line}", file=sys.stderr)
else:
report_base["jump_repair"] = {"applied": False, "why": "--repair off" if repair == "off" else f"not a gait state ({state})"}
if prof.gait:
@@@ -1765,10 -2274,18 +2272,18 @@@
error = (f"video-loop: loop jolts — {'; '.join(over)} ({cycle.get('kind', 'periodic')} length {L} frames from {i}"
f"{', after repairing frames ' + str(report_base['jump_repair']['replaced']) if report_base['jump_repair'].get('replaced') else ''}); "
"the motion does not play smoothly — regenerate the clip"
- f"{' (the jump repair did not run: RIFE is not installed — ' + rife_mod.INSTALL_COMMAND + ')' if 'rife' in report_base['jump_repair'] else ''}")
+ f"{' (the jump repair did not run: RIFE is not installed — ' + rife_mod.install_command() + ')' if 'rife' in report_base['jump_repair'] else ''}")
- shutil.rmtree(out_dir / FALLBACK_FRAMES_DIR, ignore_errors=True)
- write_loop_report(target, {**report_base, "status": "failed", "error": error, "cycle": cycle})
+ refuse(target, out_dir, name, {**report_base, "status": "failed", "error": error, "cycle": cycle})
raise SystemExit(error)
+ left = _unfixed_lines(report_base["jump_repair"])
+ if left and unfixed == "refuse":
+ error = (f"video-loop: loop frames left off the flow — {'; '.join(left)} ({cycle.get('kind', 'periodic')} length {L} "
+ f"frames from {i}); the motion does not play smoothly — regenerate the clip")
+ refuse(target, out_dir, name, {**report_base, "status": "failed", "error": error, "cycle": cycle})
+ raise SystemExit(error)
+ for line in left:
+ print(f"video-loop: warning: {line} — a jump played as filmed; --unfixed refuse refuses such a loop "
+ "(docs/loop-repair.md section 2)", file=sys.stderr)
for line in warnings:
print(f"video-loop: warning: {line} (reference bound; the loop is kept — docs/loop-repair.md)", file=sys.stderr)
if "ghost_given_way" not in report_base:
diff --cc tests/conftest.py
index ef17697,70b64ed..c366162
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@@ -60,8 -60,9 +60,9 @@@ def symlink_or_skip(link: Path, target
# Tests that skip where no RIFE is reachable for a reason other than RIFE: an input the lane does not
- # give. Named without their parameters. In the lane's RIFE-less run (`pytest --rife-unmeasured`) these
- # and the tests marked real_rife or torch_rife may skip; any other skip fails (docs/release.md).
+ # give. Named without their parameters, or with them where one case alone skips. In the lane's RIFE-less
-# run (`pytest --rife-unmeasured`) these and the tests marked real_rife may skip; any other skip fails
-# (docs/release.md).
++# run (`pytest --rife-unmeasured`) these and the tests marked real_rife or torch_rife may skip; any other skip
++# fails (docs/release.md).
NOT_RIFE_SKIPS = {
# SPRITE_GEN_CHROMA_REAL_STILLS names model stills, which the repository does not hold.
"tests/frames/test_chroma_key_relative.py::test_real_still_keys_out_its_painted_border",
@@@ -73,48 -96,42 +96,67 @@@ def pytest_addoption(parser: pytest.Par
"--rife-unmeasured",
action="store_true",
help="the RIFE-less run of scripts/linux_lane.sh: a skip fails unless its test is marked real_rife "
- "or named in NOT_RIFE_SKIPS (tests/conftest.py)",
+ "or torch_rife, or named in NOT_RIFE_SKIPS (tests/conftest.py)",
)
+ parser.addoption(
+ "--full",
+ action="store_true",
+ help="run every test; without it a run is the fast bundle, the tests marked slow deselected. "
+ "The release lane (scripts/linux_lane.sh) runs with it",
+ )
+def _torch_rife_missing() -> str | None:
+ """Why the torch backend cannot run here, None where it can: PyTorch, the rife-v4.6 model it reads
+ (`rife.locate_model()`) and the device SPRITE_GEN_RIFE_DEVICE names."""
+ from sprite_gen.video import rife
+
+ try:
+ import torch
+ except ImportError as exc:
+ return f'PyTorch not installed (pip install "sprite-gen[torch]"): {exc}'
+ try:
+ rife.locate_model()
+ named = rife.device()
+ except rife.RifeUnavailable as exc:
+ return f"RIFE's torch backend cannot run here: {exc}"
+ if named == "cuda" and not torch.cuda.is_available():
+ return "SPRITE_GEN_RIFE_DEVICE is cuda (the default) and PyTorch finds no CUDA here; name SPRITE_GEN_RIFE_DEVICE=cpu"
+ return None
+
+
- def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
- """A test marked `real_rife` runs the real binary: skipped where `rife.locate()` finds none, and run
+ def pytest_report_header(config: pytest.Config) -> str | None:
+ if not config.getoption("full"):
+ return "fast bundle: the tests marked slow are deselected; `pytest --full` runs every test"
+ return None
+
+
+ def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:
+ """Without `--full` the tests marked `slow` are deselected: a plain `pytest` is the fast bundle.
+
+ A test marked `real_rife` runs the real binary: skipped where `rife.locate()` finds none, and run
- by `scripts/linux_lane.sh --rife-only` (`-m real_rife`)."""
+ by `scripts/linux_lane.sh --rife-only` (`-m real_rife`). A test marked `torch_rife` runs RIFE's torch
+ backend: skipped where PyTorch, the model or the device is missing (`_torch_rife_missing`), and run by
+ the lanes with none skipped (`-m torch_rife`, docs/release.md)."""
+ if not config.getoption("full"):
+ slow = [item for item in items if item.get_closest_marker("slow")]
+ if slow:
+ config.hook.pytest_deselected(items=slow)
+ items[:] = [item for item in items if not item.get_closest_marker("slow")]
marked = [item for item in items if item.get_closest_marker("real_rife")]
- if not marked:
- return
- from sprite_gen.video import rife
+ torched = [item for item in items if item.get_closest_marker("torch_rife")]
+ if marked:
+ from sprite_gen.video import rife
- try:
- rife.locate()
- except rife.RifeUnavailable:
- for item in marked:
- item.add_marker(pytest.mark.skip(reason="rife-ncnn-vulkan not installed (SPRITE_GEN_RIFE / PATH / sprite-gen rife install)"))
+ try:
+ rife.locate()
+ except rife.RifeUnavailable:
+ for item in marked:
+ item.add_marker(pytest.mark.skip(reason="rife-ncnn-vulkan not installed (SPRITE_GEN_RIFE / PATH / sprite-gen rife install)"))
+ why = _torch_rife_missing() if torched else None
+ if why:
+ for item in torched:
+ item.add_marker(pytest.mark.skip(reason=why))
def _fail_unmeasured_skip(report: pytest.TestReport | pytest.CollectReport, node: pytest.Item | pytest.Collector) -> None:
@@@ -124,8 -141,7 +166,8 @@@
test body, the file at import."""
if not report.skipped or hasattr(report, "wasxfail") or not node.config.getoption("rife_unmeasured", False):
return
- if node.get_closest_marker("real_rife") or {report.nodeid, report.nodeid.partition("[")[0]} & NOT_RIFE_SKIPS:
+ if (node.get_closest_marker("real_rife") or node.get_closest_marker("torch_rife")
- or report.nodeid.partition("[")[0] in NOT_RIFE_SKIPS):
++ or {report.nodeid, report.nodeid.partition("[")[0]} & NOT_RIFE_SKIPS):
return
path, line, reason = report.longrepr
report.outcome = "failed"
diff --cc tests/video/test_seam_bridge.py
index 0000000,ae1c91a..cbc2e63
mode 000000,100644..100644
--- a/tests/video/test_seam_bridge.py
+++ b/tests/video/test_seam_bridge.py
@@@ -1,0 -1,339 +1,342 @@@
+ # SPDX-License-Identifier: Apache-2.0
+ """The seam bridge (docs/loop-repair.md section 2, "The seam bridge"): a loop that is not a walk is not read for its
+ flow, but its wrap is — the step from its last frame to its first against the mean of the three steps either side
+ (`repair.SURGE_AROUND`), on the frames as they play. A wrap over `--seam-max` there, and over the re-render noise of a
+ pinned first frame, jumps: one, two or four frames round it are made again between the frames either side, the fewest
+ first, taken only without faults and where every step from one to the other then reads within the same limit. A wrap
+ that reads as a step of the loop needs no interpolator and leaves the loop byte for byte as it was cut; a loop drawn on
+ twos, a jump no straight line closes and a pin the clip does not keep are left to the gate.
+
+ The body goes round a small circle at an even speed, one turn a loop, so every step moves it as far; its wrap goes `J`
+ of those steps instead of one. The stand-in interpolator draws the body at the time asked on the way between its two
+ frames, so the tests need no binary and can say which frames come back."""
+
+ from __future__ import annotations
+
+ import json
+ import math
+ import os
+ from pathlib import Path
+
+ import numpy as np
+ import pytest
+ from PIL import Image, ImageDraw
+
+ from sprite_gen.video import loop as loop_mod
+ from sprite_gen.video import repair
+
+ W, H, SS, N = 96, 128, 4, 48
+ LINE = (110, 90, 120, 255) # a mid-tone line: no pixel of it reads dark (`rife.DARK_LUMA`), so a made frame smears nothing
+
+
+ def _figure(phase: float, *, radius: float = 3.0, blot: bool = False) -> Image.Image:
+ """A standing body whose centre is at `phase` (turns) round a circle of `radius` px. `blot` paints a dark patch
+ inside it: a frame a smear reads (`rife.smear`)."""
+ dx, dy = radius * math.cos(2 * math.pi * phase), radius * math.sin(2 * math.pi * phase)
+ im = Image.new("RGBA", (W * SS, H * SS), (0, 0, 0, 0))
+ d = ImageDraw.Draw(im)
+ s = lambda v: round(v * SS) # noqa: E731
+ cx, top = 48 + dx, 58 + dy
+ d.rounded_rectangle((s(cx - 20), s(top), s(cx + 20), s(top + 58)), s(9), fill=(70, 110, 190, 255), outline=LINE, width=s(1.5))
+ d.rounded_rectangle((s(cx + 17), s(top + 5), s(cx + 25), s(top + 45)), s(4), fill=(240, 200, 170, 255), outline=LINE, width=s(1.5))
+ hy = top - 25
+ d.ellipse((s(cx - 21), s(hy - 21), s(cx + 21), s(hy + 21)), fill=(245, 210, 180, 255), outline=LINE, width=s(1.5))
+ for ex in (cx - 8, cx + 8):
+ d.ellipse((s(ex - 3), s(hy - 5), s(ex + 3), s(hy + 3)), fill=(100, 80, 120, 255))
+ d.line((s(cx - 5), s(hy + 8), s(cx + 5), s(hy + 8)), fill=LINE, width=s(1))
+ a = np.asarray(im.resize((W, H), Image.LANCZOS)).copy()
+ if blot:
+ a[70:100, 35:60, :3] = 10
+ a[a[..., 3] == 0] = 0 # no colour under full transparency, as a keyed frame has none
+ return Image.fromarray(a, "RGBA")
+
+
+ def _phases(jump: float, *, held: bool = False, count: int = N + 6) -> list[float]:
+ """One turn over a loop of N frames whose wrap goes `jump` steps instead of one; the clip goes on past the cut as
+ filmed. `held`: each drawing shown for two frames."""
+ step = 1.0 / (N - 1 + jump)
+ return [(k - k % 2 if held else k) * step for k in range(count)]
+
+
+ def _keyed(tmp_path: Path, phases: list[float], **kw) -> Path:
+ d = tmp_path / "keyed"
+ d.mkdir()
+ for k, p in enumerate(phases):
+ _figure(p, **kw).save(d / f"{k:04d}.png")
+ return d
+
+
+ class Between:
+ """Stand-in interpolator: the body at the time t of the way from one frame of the clip to another, its centre on
+ the circle between theirs. Each frame it is given is told by its thumbnail."""
+
+ def __init__(self, phases: list[float], *, blot: bool = False):
+ self.phases, self.blot = phases, blot
+ self.small = [loop_mod._small_features(_figure(p)) for p in phases]
+ self.calls: list[tuple[int, int, float]] = []
+
+ def which(self, im: Image.Image) -> int:
+ f = loop_mod._small_features(im)
+ return int(np.argmin([np.abs(f - s).mean() for s in self.small]))
+
+ def at(self, ka: int, kb: int, t: float) -> float:
+ return self.phases[ka] + t * ((self.phases[kb] - self.phases[ka]) % 1.0)
+
+ def __call__(self, a: Image.Image, b: Image.Image, t: float) -> Image.Image:
+ ka, kb = self.which(a), self.which(b)
+ self.calls.append((ka, kb, round(t, 4)))
+ return _figure(self.at(ka, kb, t), blot=self.blot)
+
+
+ def never(a: Image.Image, b: Image.Image, t: float) -> Image.Image:
+ raise AssertionError("no frame is to be made")
+
+
+ def _run(tmp_path: Path, keyed: Path, *, cycle_mode: str = "fixed", **kw) -> dict:
+ cut = {"start": 0, "length": N} if cycle_mode == "fixed" else {}
+ return loop_mod.run_loop(keyed, tmp_path / "out", fps=24.0, state="idle", min_len=None, max_len=None, n_out=None,
+ seam_max=loop_mod.SEAM_RATIO_MAX, name="idle", report_path=tmp_path / "idle.json",
+ cycle_mode=cycle_mode, **cut, **kw)
+
+
+ def _refused(tmp_path: Path, keyed: Path, match: str, **kw) -> dict:
+ with pytest.raises(SystemExit, match=match):
+ _run(tmp_path, keyed, **kw)
+ return json.loads((tmp_path / "idle.json").read_text())
+
+
+ def _report(tmp_path: Path, keyed: Path, **kw) -> dict:
+ """The report of the cut, whatever the gate says of it."""
+ try:
+ _run(tmp_path, keyed, **kw)
+ except SystemExit:
+ pass
+ return json.loads((tmp_path / "idle.json").read_text())
+
+
+ def _cells(out: Path) -> list[np.ndarray]:
+ return [np.asarray(Image.open(p)) for p in sorted((out / "cycle").glob("frame-*.png"))]
+
+
+ @pytest.mark.slow
+ def test_a_wrap_that_jumps_is_bridged_by_one_frame_and_the_loop_then_passes_the_gate(tmp_path):
+ phases = _phases(2.6)
+ keyed = _keyed(tmp_path, phases)
+ refused = _refused(tmp_path / "off", keyed, r"loop seam ratio \d+\.\d+ exceeds 2\.0", repair="off")
+ assert refused["jump_repair"] == {"applied": False, "why": "--repair off"}
+
+ between = Between(phases)
+ rep = _run(tmp_path, keyed, interpolate=between)
+ jr = rep["jump_repair"]
+ assert (jr["reading"], jr["applied"], jr["replaced"], jr["width"]) == ("seam", True, [N - 1], 1)
+ assert jr["seam"] > loop_mod.SEAM_RATIO_MAX and jr["wrap"] > loop_mod.PIN_NOISE_MAX and jr["hold"] == 1
+ assert jr["seam_after"] <= loop_mod.SEAM_RATIO_MAX
+ assert between.calls == [(N - 2, 0, 0.5)] # the frame half way between the frames either side, at its own time
+ assert jr["calls"] == 1 and jr["interpolator"] == {"kind": "injected"} and jr["facing"] == "right"
+ (taken,) = jr["tries"]
+ assert taken["anchors"] == [N - 2, 0] and taken["outcome"] == "accepted" and taken["faults"] == []
+ # the gate reads the cells that play, and the loop now passes it
+ assert rep["status"] == "passed" and rep["seam_measurement"] == "rendered-cells"
+ assert rep["resampled_seam_ratio"] <= loop_mod.SEAM_RATIO_MAX < refused["resampled_seam_ratio"]
+ cells = _cells(tmp_path / "out")
+ assert len(cells) == N # the loop keeps its length
+ assert np.array_equal(cells[N - 1], np.asarray(_figure(between.at(N - 2, 0, 0.5))))
+ filmed = [np.asarray(Image.open(p).convert("RGBA")) for p in sorted(keyed.glob("*.png"))][:N]
+ assert all(np.array_equal(cells[k], filmed[k]) for k in range(N - 1)) # every other frame is the clip's own
+ assert json.loads((tmp_path / "idle.json").read_text())["jump_repair"]["replaced"] == [N - 1]
+
+
+ def test_the_fewest_frames_are_tried_first_and_a_straight_line_that_does_not_close_makes_none(tmp_path, capsys):
+ phases = _phases(5.0)
+ between = Between(phases)
+ rep = _run(tmp_path, _keyed(tmp_path, phases), interpolate=between)
+ jr = rep["jump_repair"]
+ assert [(t["width"], t["frames"], t["anchors"], t["outcome"], t.get("rejected_for")) for t in jr["tries"]] == [
+ (1, [N - 1], [N - 2, 0], "rejected", "line"),
+ (2, [N - 1, 0], [N - 2, 1], "rejected", "seam"),
+ (4, [N - 2, N - 1, 0, 1], [N - 3, 2], "accepted", None)]
+ assert jr["tries"][0]["line"] > loop_mod.SEAM_RATIO_MAX and "made" not in jr["tries"][0]
+ assert jr["tries"][1]["after"] > loop_mod.SEAM_RATIO_MAX >= jr["tries"][2]["after"] == jr["seam_after"]
+ assert jr["replaced"] == [N - 2, N - 1, 0, 1] and jr["calls"] == 6
+ assert between.calls == [(N - 2, 1, 0.3333), (N - 2, 1, 0.6667), (N - 3, 2, 0.2), (N - 3, 2, 0.4), (N - 3, 2, 0.6), (N - 3, 2, 0.8)]
+ assert [m["t"] for m in jr["tries"][2]["made"]] == [0.2, 0.4, 0.6, 0.8]
+ assert rep["status"] == "passed" and rep["resampled_seam_ratio"] <= loop_mod.SEAM_RATIO_MAX
+ cells = _cells(tmp_path / "out")
+ for k, t in zip(jr["replaced"], (0.2, 0.4, 0.6, 0.8)):
+ assert np.array_equal(cells[k], np.asarray(_figure(between.at(N - 3, 2, t))))
+ (line,) = [l for l in capsys.readouterr().err.splitlines() if "wrap jumps" in l]
+ assert f"frames {N - 2}, {N - 1}, 0, 1 were made again by RIFE between frames {N - 3} and 2" in line
+
+
+ @pytest.mark.slow
+ def test_a_wrap_that_reads_as_a_step_needs_no_interpolator_and_is_cut_as_before(tmp_path):
+ keyed = _keyed(tmp_path, _phases(1.0))
+ off = _run(tmp_path / "off", keyed, repair="off")
+ rep = _run(tmp_path, keyed, interpolate=never)
+ jr = rep["jump_repair"]
+ assert jr["skipped"] == "the wrap reads as a step of the loop" and jr["seam"] <= loop_mod.SEAM_RATIO_MAX
+ assert (jr["applied"], jr["replaced"], jr["calls"], jr["tries"]) == (False, [], 0, [])
+ assert rep["seam_measurement"] == off["seam_measurement"] == "source-frames"
+ for name in ("idle.strip.png", "idle.strip.json", "idle.gif", "idle.webp", *(f"cycle/frame-{k:03d}.png" for k in range(N))):
+ assert (tmp_path / "out" / name).read_bytes() == (tmp_path / "off" / "out" / name).read_bytes(), name
+
+
+ def test_a_loop_moved_in_whole_pixels_reads_its_wrap_against_the_steps_beside_it_not_the_loop_mean():
+ """Steps of nothing between steps of a pixel: against the loop's mean step, a wrap of one pixel reads as a jump."""
+ def frame(k: int) -> Image.Image:
+ body = _figure(0.0, radius=0.0)
+ im = Image.new("RGBA", body.size)
+ im.paste(body, (round(6 * math.sin(2 * math.pi * k / N)), 0))
+ a = np.asarray(im).copy()
+ a[40 + k // 12, 40 + k % 12] = (90, 200, 90, 255) # a clip never repeats a frame byte for byte
+ return Image.fromarray(a, "RGBA")
+
+ frames = [frame(k) for k in range(N)]
+ flat = loop_mod.cell_features(frames)
+ ring = np.abs(np.roll(flat, -1, axis=0) - flat).mean(axis=1)
+ assert ring[-1] / ring[:-1].mean() > loop_mod.SEAM_RATIO_MAX # the loop's mean step would name it a jump
+ out, record = repair.seam_bridge(frames, never, limit=loop_mod.SEAM_RATIO_MAX, hold=1)
+ assert record["skipped"] == "the wrap reads as a step of the loop" and record["seam"] <= loop_mod.SEAM_RATIO_MAX
+ assert all(a is b for a, b in zip(out, frames))
+
+
+ def test_a_near_still_loop_whose_wrap_jumps_under_the_re_render_noise_is_left_alone():
+ """A loop that hardly moves — a patch of it shading over the loop and back at the wrap: its steps are so small that a
+ wrap of no visible size reads as many of them."""
+ body = np.asarray(_figure(0.0, radius=0.0))
+ frames = []
+ for k in range(N):
+ a = body.copy()
+ a[60:64, 44:48, :3] = 120 + round(40 * k / N)
+ frames.append(Image.fromarray(a, "RGBA"))
+ out, record = repair.seam_bridge(frames, never, limit=loop_mod.SEAM_RATIO_MAX, hold=1)
+ assert record["seam"] > loop_mod.SEAM_RATIO_MAX and record["wrap"] <= loop_mod.PIN_NOISE_MAX
+ assert record["skipped"] == "the wrap reads as a step of the loop" and all(a is b for a, b in zip(out, frames))
+
+
+ def test_a_loop_drawn_on_twos_is_not_bridged(tmp_path):
+ rep = _report(tmp_path, _keyed(tmp_path, _phases(2.6, held=True)), interpolate=never)
+ jr = rep["jump_repair"]
+ assert rep["cycle_drawings"]["hold"] == 2 and jr["hold"] == 2
+ assert jr["skipped"] == "drawn on twos or threes: a frame made round the wrap would split a drawing"
+ assert jr["seam"] > loop_mod.SEAM_RATIO_MAX and jr["calls"] == 0 and jr["replaced"] == []
+
+
+ def test_a_jump_no_straight_line_closes_makes_no_frame_and_the_gate_refuses_it_as_before(tmp_path, capsys):
+ rep = _refused(tmp_path, _keyed(tmp_path, _phases(12.0)), r"loop seam ratio \d+\.\d+ exceeds 2\.0", interpolate=never)
+ jr = rep["jump_repair"]
+ assert [(t["width"], t["rejected_for"]) for t in jr["tries"]] == [(1, "line"), (2, "line"), (4, "line")]
+ assert jr["calls"] == 0 and jr["applied"] is False and rep["seam_measurement"] == "source-frames"
+ (line,) = [l for l in capsys.readouterr().err.splitlines() if "wrap jumps" in l]
+ assert "no frames made round it close it" in line and "cut as filmed" in line
+
+
+ def test_a_frame_made_with_a_fault_is_not_taken(tmp_path):
+ phases = _phases(2.6)
+ between = Between(phases, blot=True)
+ rep = _refused(tmp_path, _keyed(tmp_path, phases), r"loop seam ratio", interpolate=between)
+ jr = rep["jump_repair"]
+ assert [(t["width"], t["rejected_for"], t["faults"]) for t in jr["tries"]] == [
+ (1, "fault", ["smear"]), (2, "fault", ["smear"]), (4, "fault", ["smear"])]
+ assert jr["calls"] == len(between.calls) == 1 + 2 + 4 and jr["replaced"] == [] and jr["applied"] is False
+ assert rep["seam_measurement"] == "source-frames"
+
+
+ def _no_rife(monkeypatch, tmp_path: Path) -> None:
+ """No RIFE anywhere the engine looks: no SPRITE_GEN_RIFE, an empty PATH, an empty data directory."""
+ monkeypatch.delenv("SPRITE_GEN_RIFE", raising=False)
+ path = [d for d in os.environ.get("PATH", "").split(os.pathsep) if d and not (Path(d) / "rife-ncnn-vulkan").exists()]
+ monkeypatch.setenv("PATH", os.pathsep.join(path))
+ monkeypatch.setenv("SPRITE_GEN_DATA_DIR", str(tmp_path / "data"))
+
+
+ def test_a_wrap_to_bridge_without_rife_is_cut_as_filmed_with_the_install_line(tmp_path, monkeypatch, capsys):
+ _no_rife(monkeypatch, tmp_path)
+ rep = _refused(tmp_path, _keyed(tmp_path, _phases(2.6)), r"loop seam ratio")
+ jr = rep["jump_repair"]
+ assert jr["why"] == "RIFE not installed — the wrap cut as filmed" and jr["install"] == "sprite-gen rife install"
+ assert "rife-ncnn-vulkan not found" in jr["rife"] and jr["unmade"]["frames"] == [N - 1]
+ assert jr["applied"] is False and jr["calls"] == 0 and "interpolator" not in jr
+ (line,) = [l for l in capsys.readouterr().err.splitlines() if "wrap jumps" in l]
+ assert "RIFE is not installed" in line and "sprite-gen rife install" in line
+
+
+ def test_a_wrap_that_reads_as_a_step_without_rife_has_nothing_to_say(tmp_path, monkeypatch, capsys):
+ _no_rife(monkeypatch, tmp_path)
+ rep = _run(tmp_path, _keyed(tmp_path, _phases(1.0)))
+ assert rep["jump_repair"]["skipped"] == "the wrap reads as a step of the loop" and "rife" not in rep["jump_repair"]
+ assert "wrap jumps" not in capsys.readouterr().err
+
+
+ def test_repair_on_without_rife_refuses_a_wrap_to_bridge(tmp_path, monkeypatch):
+ _no_rife(monkeypatch, tmp_path)
+ report = _refused(tmp_path, _keyed(tmp_path, _phases(2.6)), r"sprite-gen rife install.*--repair auto", repair="on")
+ assert report["status"] == "failed" and "rife-ncnn-vulkan not found" in report["error"]
+
+
+ @pytest.mark.slow
+ def test_repair_on_refusing_a_wrap_to_bridge_hands_nothing_over(tmp_path, monkeypatch):
+ """A refused run hands nothing over (docs/video-pipeline.md section 4, `loop.refuse`): the seam bridge's refusal
+ takes back what an earlier cut in the same folder handed over, as every other `video-loop` refusal does."""
+ _no_rife(monkeypatch, tmp_path)
+ _run(tmp_path, _keyed(tmp_path, _phases(1.0)))
+ out, handed = tmp_path / "out", ("cycle", "idle.strip.png", "idle.strip.json", "idle.gif", "idle.webp")
+ assert all((out / n).exists() for n in handed)
+ jumping = tmp_path / "jumping"
+ jumping.mkdir()
+ for k, p in enumerate(_phases(2.6)):
+ _figure(p).save(jumping / f"{k:04d}.png")
+ report = _refused(tmp_path, jumping, r"sprite-gen rife install.*--repair auto", repair="on")
+ assert report["status"] == "failed"
+ assert [n for n in handed if (out / n).exists()] == [] and not (out / loop_mod.CYCLE_REFUSED_DIR).exists()
+
+
+ def test_a_pinned_clip_the_pin_refuses_is_not_bridged(tmp_path):
+ phases = _phases(2.6, count=N) + [0.5] # its last frame is not its first again
+ rep = _refused(tmp_path, _keyed(tmp_path, phases), r"the pinned clip does not end on its first frame",
+ cycle_mode="pinned", interpolate=never)
+ assert rep["jump_repair"]["skipped"] == "the pin does not close: the clip is refused on it"
+ assert rep["jump_repair"]["calls"] == 0 and "seam" not in rep["jump_repair"]
+
+
+ def test_the_summary_names_the_frames_made_and_the_rife_that_made_them(tmp_path, monkeypatch, capsys):
+ """RIFE is located only once a frame is to be made, and named with its calls of the binary."""
+ phases = _phases(2.6)
+ between = Between(phases)
+
+ class Found:
+ calls = 0
+
+ def __call__(self, a, b, t):
+ Found.calls += 2
+ return between(a, b, t)
+
+ def describe(self):
- return {"binary": "rife-ncnn-vulkan", "model": "rife-v4.6", "tta": ""}
++ return {"kind": "rife-ncnn-vulkan", "binary": "rife-ncnn-vulkan", "model": "rife-v4.6", "tta": ""}
++
++ def counts(self):
++ return {"binary_calls": Found.calls}
+
+ monkeypatch.setattr(loop_mod.rife_mod, "Rife", Found)
+ keyed = _keyed(tmp_path, phases)
+ assert loop_mod.main(["--frames-dir", str(keyed), "--out-dir", str(tmp_path / "out"), "--state", "idle", "--cycle", "fixed",
+ "--start", "0", "--length", str(N), "--name", "idle", "--report", str(tmp_path / "idle.json")]) == 0
+ out = capsys.readouterr().out
+ summary = json.loads(out[out.index("{"):])
+ report = json.loads((tmp_path / "idle.json").read_text())
+ assert summary["jump_repair"] == {k: report["jump_repair"][k] for k in ("reading", "seam", "replaced", "seam_after")}
+ assert summary["jump_repair"]["replaced"] == [N - 1]
+ assert report["jump_repair"]["interpolator"] == {"kind": "rife-ncnn-vulkan", "binary": "rife-ncnn-vulkan", "model": "rife-v4.6",
+ "tta": "", "binary_calls": 2}
+
+
+ @pytest.mark.slow
+ @pytest.mark.real_rife
+ def test_rife_bridges_a_wrap_that_jumps_without_a_fault(tmp_path):
+ rep = _run(tmp_path, _keyed(tmp_path, _phases(2.6)))
+ jr = rep["jump_repair"]
+ assert jr["applied"] is True and jr["interpolator"]["kind"] == "rife-ncnn-vulkan"
+ taken = jr["tries"][-1]
+ assert taken["outcome"] == "accepted" and taken["faults"] == [] and jr["replaced"] == taken["frames"]
+ assert jr["seam_after"] <= loop_mod.SEAM_RATIO_MAX
+ assert rep["status"] == "passed" and rep["resampled_seam_ratio"] <= loop_mod.SEAM_RATIO_MAX