Skip to content

feat(webv2): reference trims as start + sample length with steppers; 200-frame default - #204

Open
lstein wants to merge 3 commits into
mainfrom
feat/webv2-reference-sample-window
Open

feat(webv2): reference trims as start + sample length with steppers; 200-frame default#204
lstein wants to merge 3 commits into
mainfrom
feat/webv2-reference-sample-window

Conversation

@lstein

@lstein lstein commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Why

Reference frames cost denoise VRAM on every step (the packed sequence grows with reference length), so the useful sample of a reference video is a few seconds — but picking a small interval with independent start/end sliders meant fighting both ends.

What

  • The video reference card's second control is now the sample length in frames (min 1). The start slider slides the whole window at constant length, stopping at the clip's end — a drag overshoot can't shrink your sample. The row's thumbnail still shows the resulting end frame (badged with its frame number, since the number field now shows the length).
  • New video references default to a 200-frame window (~8 s at 24 fps, DEFAULT_REFERENCE_SAMPLE_FRAMES) instead of the whole clip.
  • All trim fields gain increment/decrement steppers (both reference rows and the Initial Video's start/end) for single-frame nudging.
  • The Ref2VA extend anchor keeps its seam contract: its end frame stays pinned to the Initial Video cutpoint — the start slider adjusts the lead-in, and the length control grows backward from the pinned end. (The adversarial review caught the first cut breaking this: a start-slider round trip could silently detach the anchor's window from the seam.)

Storage is unchanged — clips persist startFrame/endFrame, so the request contract, normalization, metadata recall and old generations are untouched; length is derived.

Testing

  • The window math lives in core/settings as pure functions with 11 new unit tests (constant-length slide, wall stop, anchor pinning both directions, corrupt-trim self-healing, single-frame clips).
  • pnpm lint, unit suite (7436), browser suite (1036), and the architecture gate all pass.
  • Adversarial fresh-context review run; all three findings (anchor seam detachment, overshoot ratchet, corrupt-trim repair regression) fixed in the second commit.

🤖 Generated with Claude Code

lstein and others added 2 commits September 3, 2026 10:08
…steppers

Reference frames cost denoise VRAM on every step, so the useful sample
of a reference video is a short window (a few seconds), not the whole
clip - and picking a small interval with independent start/end sliders
meant fighting both ends.

- The video reference card's second row is now the SAMPLE LENGTH in
  frames (min 1, max = frames remaining after start) instead of the end
  frame. Moving the start slides the window at constant length until it
  hits the clip's end. The row's thumbnail still shows the resulting end
  frame, badged with that frame number since the number field beside it
  now shows the length.
- Newly added video references default to a 200-frame window (~8s at
  24 fps; DEFAULT_REFERENCE_SAMPLE_FRAMES in core/settings) instead of
  the whole clip.
- All trim sliders - both reference rows and the Initial Video's
  start/end - gain increment/decrement steppers (SliderNumberField's
  existing showStepper) for single-frame nudging.

Storage is unchanged: clips still persist startFrame/endFrame, so the
request contract, normalization and recall are untouched; length is
derived as end - start + 1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…the math

- The reference-extend anchor's end frame stays PINNED to the Initial
  Video cutpoint: its start slider adjusts only the lead-in, and its
  length control grows the window backward from the pinned end (ceiling:
  the available lead-in). The first cut let a start-slider round trip
  silently detach the anchor's window from the seam.
- An ordinary window's slide now stops at the clip's end instead of
  shrinking, so a transient drag overshoot can no longer ratchet a
  200-frame sample down to 1 frame.
- The window math moved to core/settings (slideReferenceSampleWindow /
  resizeReferenceSampleWindow), is self-healing by construction
  (0 <= start <= end <= numFrames-1 even from corrupt persisted trims,
  which the first cut could make worse), and has 11 unit tests covering
  the wall stop, anchor pinning, corrupt-trim healing and single-frame
  clips.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the python label Sep 3, 2026
@lstein
lstein marked this pull request as ready for review September 3, 2026 15:10
The two controls carry different units - a frame INDEX and a frame COUNT
- so the thumbnail badges alone did not say which was which. Give each
row the shared uppercase FieldLabel: 'Start Frame' and 'Sample Length'.

The length label also carries the window's duration in seconds
('Sample Length · 8.3s'), since hitting a target sample duration is the
point of the control while its unit has to stay frames to match the trim
contract. Guarded on a positive finite fps; falls back to the bare
'Sample Length (Frames)' label otherwise, which remains the aria label
in both cases.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant