forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 99d87d41f2e4bcba2c5f04fd6c42e9935e268377Filtered to crates/engine/src/scale.rsClear filter

2026-08-13

🐛 fix(decode): the queue a file opens with, and the driver a parked worker holdsAhmet Kaan Gümüş · 7985bd5
🐛 fix(decode): the queue a file opens with, and the driver a parked worker holds

Five findings from the lane's verification, in the order they bite.

DEPTH NEVER ENGAGED ON THE PRIMARY PATH. Every session opens its first
worker pass-through -- a freshly opened file *is* the project resolution
-- and a pass-through canvas cannot say how big the pictures will be, so
it answered 2: the bound this engine had before there was any
decode-ahead. A whole file played at that depth until the first seek
built a real canvas. The depth now comes from the stream the sync opener
already read (`scale::queue_depth`), and a paused burst off a freshly
opened 720p file is 17 pictures where it was 3.

A PARKED WORKER NO LONGER HOLDS THE DRIVER. The thread that outlives its
span used to park on its command channel with the VA-API session open,
which widened the Mesa `atexit` window from "quit during a decode" to
"quit any time after opening a file". The wait is in two halves now: the
fast one keeps everything, so a seek, a scrub step and a clip boundary
still find the decoder where they left it, and past two seconds idle the
hardware session is closed. The demuxer stays -- it is a file handle and
an index, not driver state, and it is what costs seconds to rebuild.

DENSITY IS BOUNDED AGAIN. The suite's pump had been weakened to "indices
increase", which a one-in-N delivery regression passes. It asserts
contiguity again -- every session there is a pull consumer, owed every
frame -- and a new test holds a *watched* session to the same contiguity
plus a density floor whenever the decoder is measurably keeping up.

The queue-depth doc now states the measured numbers (16 at 720p, 12 at
1080p, 3 at 3840x2160, 2 at 4096x2160; a burst is depth + 1), and two
comments that still said "cancelled" for what a seek now abandons, and
claimed the drop replaced the front-end's resync, are corrected: both
mechanisms are live and the drop is the first line.
⚡ perf(decode): the queue runs deeper and stops carrying pictures nobody can seeAhmet Kaan Gümüş · fffcda0
⚡ perf(decode): the queue runs deeper and stops carrying pictures nobody can see

Two frames of decode-ahead was the whole buffer, so any hiccup emptied it
and the decoder could never build a lead. The bound is now a budget in
bytes (~96 MB: eleven 1080p pictures, two 4K ones), which is what makes
the second half safe: a deeper queue full of stale pictures would be
worse than a shallow one, so the worker is told where the playhead
stands and stops paying the conversion and the queue slot for anything
already behind it.

The policy has a floor of its own. A machine that cannot decode in real
time is late on every picture, and dropping every picture is a black
screen rather than a stutter, so one in nine is handed over regardless --
roughly what the front-end's restart-every-two-seconds produced, without
the VA-API init each restart cost.

Off unless a caller says it is watching in real time: an export, the
file-level API and a test draining as fast as it can each asked for a
range of frames and are owed every one of them. The window turns it on,
where `Player::pump` was already taking those pictures off the channel
and throwing them away one repaint later.

The playback suite's own pump asserted contiguous indices; it now asserts
increasing ones, which is the invariant that survives a drop -- nothing
out of order, nothing twice.

2026-08-10

✨ feat(engine): project resolution stands apart from media resolutionAhmet Kaan Gümüş · 19e294a
✨ feat(engine): project resolution stands apart from media resolution

A timeline had one resolution because its first source did: import refused
anything else by name, and there was nowhere to say otherwise. A project now
carries its own picture size and every clip is composed onto it, so media of
different resolutions share a timeline the way they do in any editor.

* scale::Composer is the one definition of that composition -- fit_rect,
  scale_i420, compose_i420 onto a black canvas -- and both playback and export
  call it, so what is written is what was watched. A canvas of the picture's
  own size is a pass-through that allocates nothing and touches no byte.
* Grade first, place second: a grade belongs to the clip's pixels at the
  resolution they were shot at, and the letterbox bars are not the clip.
* Per-clip fit policy (fit/fill/stretch/centre), one byte inline in Clip -- it
  lands in padding the clip already had.
* .edith v7: a `resolution <w> <h>` line and a fit word per clip line. v6..v1
  still load, defaulting to source 0's picture and Fit, which is what those
  projects always meant.
* The fps refusal stays: mixing frame rates is resampling the timeline, a
  different problem, and a refusal is the honest answer until it is solved.
* UI: `p` cycles the fit policy of the clip on screen (and a clip-menu item),
  ctrl+r cycles the project resolution through the usual sizes with the media's
  own among them, and the export card says which size it writes.
✨ feat(engine): I420 scaler and fit geometryAhmet Kaan Gümüş · dd54308
✨ feat(engine): I420 scaler and fit geometry

Bilinear 16.16 rescale, four fit policies handing back chroma-grid-aligned
placement and crop rects, and a canvas blit -- the primitive a project
resolution decoupled from media resolution needs. 3.82 ms/frame for
1280x720 -> 1920x1080 in release; nothing is wired to it yet.