forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on c3273089121706b520cb38f4b341d22cfde05d8eFiltered to crates/engine/src/scale.rsClear filter

2026-10-23

🚚 edith moves to git.tahinli.comAhmet Kaan Gümüş · b02f499
🚚 edith moves to git.tahinli.com

The working tree as of 2026-10-23, as one commit on top of the last one
here. It carries the work up to that date plus the test-slimming work:
integration tests merged into one binary per crate, nextest config,
doctest = false, debug line tables only, perf tests behind --ignored,
and faster generators, reverse, undo, subtitle-export, hevc, stabilise
and hear tests.

2026-09-30

🔀 merge(edithloader): the .edith door bounds the caption window, band gain and transform positionAhmet Kaan Gümüş · 2c809fd
🔀 merge(edithloader): the .edith door bounds the caption window, band gain and transform position

# Conflicts:
#	crates/engine/src/project.rs
fix(engine): bound a clip's transform position, and sweep the loader classAhmet Kaan Gümüş · d964f6c
fix(engine): bound a clip's transform position, and sweep the loader class

The third of the class "a number read out of a file a hand can edit,
used in arithmetic without a bound", and the last one the sweep found.

`transformed_dst_rect` caps `scale` at 1024 canvas widths for exactly
this reason -- the comment at the cap says so -- and `pos_x`/`pos_y`
multiply the canvas and are *added* to the placement's centre with no
bound at all. `float()` in the parser refuses only inf/NaN, so
`transform 3e38 0 1 0 0 0 0 0` is a legal line. `f64 as i64` saturates,
so the value arrived as `i64::MAX` and the ADD is what overflowed: a
panic on the compositing thread in a debug build, a silently wrapped
position in a release one. Clamped to the same +/-1024 canvas fractions
`scale` already gets, with saturating adds, so a position past the point
where the picture is long gone gives the two empty rects the function
already answers with.

The sweep, over every numeric field the `.edith` parser reads and every
config file the app reads. Two rules decide a site: a value is safe
either because the parse bounds it by name, or because a consumer clamps
it unconditionally before the arithmetic -- and only the second kind is
silent about a value the file actually stated.

The parser's four helpers (`number`, `number64`, `micros`, `float`) bound
nothing; the bound is always in the branch or in a consumer.

SAFE (bounded at the parse): resolution (`is_resolution`), fps
(0 < f <= 1000), samplerate (1k..384k), limiter.ceiling_db
(`with_ceiling` at the parse itself), clip geometry (`check()`'s
`start + frames`), clip.speed, the three fade/transition counts
(`.min(frames)`), clip.visualizer (`u8::try_from`), every table index
(`table_index` re-checks), sub.start/frames (`checked_add`), sub.track
(must name a palette row the file has), sub.link (saturating counter).

SAFE (clamped by a consumer, wherever the value came from): eq/color/
transform floats, gain.db (`with_mix`), color.* (`Lut::new`),
transform.scale/rotate/crop_* (`cap_w`, `nearest_90_steps`, the crop
clamp), playhead (`landing`), source.audio_stream (no arithmetic; every
consumer `.get()`s).

KNOWN, NOT A FAULT: clip.viz_paint is an unbounded u64, but every
accessor in `decode.rs` is a bit mask, so there is no overflow -- the
glow byte is read unclamped where the writer clamps it to 16, so a
hand-written file can ask for more work than the UI can produce. A cost,
not a wrong answer. Left alone deliberately.

The app's own config: eight files, only two carry a number. The
stance-splits loader (I-2) is safe because `split_size` re-clamps every
seam on every frame and `Player::split_px` is its only reader -- the
loader stores a value the frame loop then bounds. The subtitle size is
range-checked at the parse, and `RangeInclusive::contains` being a
partial comparison is what makes NaN/inf fall back rather than survive.
The keymap reads no number at all; the rest are whole-file tokens
resolving to a bool or an enum.

2026-09-18

🐛 fix(media): audio routing, session audio re-arm, hw trailing-zero NALs, display-matrix rotationAhmet Kaan Gümüş · bc8b82e
🐛 fix(media): audio routing, session audio re-arm, hw trailing-zero NALs, display-matrix rotation

- is_audio admits .mpeg/.mpg so mp3-with-cover files import (was fed to Mp4Demuxer)
- session audio walks past trackless leading sources and re-arms when a
  sounding file joins a silent timeline (fixes add/remove/add silence)
- engine-hw pump clears trailing cabac_zero_word bytes instead of dying
  with code -2; export falls back to software decode before first frame
- tkhd display matrix read for mp4; 90/180/270 turns baked into preview
  and export pixels; other angles refused by name (UnsupportedRotation)

2026-09-14

✨ feat(audio): create a waveform visualizer as a video clipAhmet Kaan Gümüş · 735b90e
✨ feat(audio): create a waveform visualizer as a video clip

Select an audio clip and press h (or the clip menu). The sound's envelope
is painted as a sliding mirrored waveform onto a video lane, so preview
and export both show it. Paste still never drops a song on V1.

2026-08-20

🐛 fix(engine): a moved placement clips instead of squeezing the sourceAhmet Kaan Gümüş · ef5832f
🐛 fix(engine): a moved placement clips instead of squeezing the source

transformed_dst_rect used to clamp the moved/scaled dst rect straight onto
the canvas: a negative pos_x/pos_y clamped to 0 and rendered pixel-identical
to the identity, and a positive one shrank the dst rect while the source
crop stayed full-size, so place_transformed squeezed the whole picture into
whatever survived the clamp instead of moving it. Real translation now keeps
the box's own size (aspect stays put) and clips it to the canvas, trimming
the matching fraction off the source rect on the same side -- both axes,
chroma-grid aligned. Marked-pixel tests (not uniform fills, which cannot
tell a squeeze from a shift) cover +/- pos_x, +/- pos_y, fully off-canvas,
and position combined with scale.

Same pass fixes the transform card's ~3-4s settle lag: place_transformed
always paid rotate_i420_90s's full-picture copy even at zero rotation steps
(the common case, since most edits are a move or a scale), unlike the grade
path which never copies the picture. Skipped now when there is nothing to
rotate.

Also gives the clip menu's Transform row a truncating, shrinkable label so
its long text ("Transform — position, scale, rotation, crop") stops running
the shortcut hint off the fixed-width menu -- it now shows ctrl+k like every
other row.
✨ feat(engine): clips can be moved, scaled, rotated and cropped (edith 20)Ahmet Kaan Gümüş · 684b8a4
✨ feat(engine): clips can be moved, scaled, rotated and cropped (edith 20)

Per-clip TransformParams (position, scale, 90-degree rotation, crop)
shared through a colour-style table, applied in both the playback
preview and the export compositor, persisted as the edith 20 dialect;
v19 files load untransformed.

2026-08-19

wip: transform engine scaffoldingAhmet Kaan Gümüş · 3050ac9Browse files
✨ feat(engine): clips can name a dissolve into their neighbor (edith 19, storage+format)Ahmet Kaan Gümüş · 8369d8e
✨ feat(engine): clips can name a dissolve into their neighbor (edith 19, storage+format)

transition_out frames on a video clip dissolve it into the adjacent
next clip; split keeps the tail's transition clamped and zeroes the
head; v18 files load with hard cuts, v19 round-trips bit-exactly.
Blending (playback and export) lands separately.

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.