forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 7cb30bf3c8f789c839dad16c2b013c15ecab4fa2Filtered to crates/engine/src/waveform.rsClear filter

2026-09-24

📝 docs(engine): the seat remembers a window that would not open, the memo does notAhmet Kaan Gümüş · 7cb30bf
📝 docs(engine): the seat remembers a window that would not open, the memo does not

The comment claimed the opposite of what the code does: a window that fails to
decode is latched in the seat's own handle -- as an empty slice, for as long as
it paints in that window -- precisely so a file that is not there is not asked
thirty times a second. The memo still keeps successes only, so the next window
and the next seek ask again. Comment only; no behaviour changed.
⚡️ perf(engine): a film's visualizer reads a window of its envelope, not the whole fileAhmet Kaan Gümüş · 0cf7335
⚡️ perf(engine): a film's visualizer reads a window of its envelope, not the whole file

A look drag re-opens the visualizer seat once per pointer sample, and the seat
asks for the clip's whole envelope: two hours at the visualizer's 4000 buckets a
second is 230 MB, past `PEAKS_MEMO_BUCKETS`, so the memo refuses to hold it and
every one of those asks decoded the whole file again -- six channels through
`ec-aac`, ~7 s of four cores, per pointer sample, for a picture that shows two
seconds of sound. The cap is not the bug: one entry that size is not a memo.

The seat's ask is now the shape of what it paints. `viz_envelope` answers with
the memo's own whole-file handle when it holds one, and otherwise with a
*window* of the file's envelope about each frame's own time -- 30 s of buckets,
decoded once per window per process, held under a 4M-bucket ceiling
(VIZ_WINDOW_MEMO_BUCKETS, 32 MB, ~34 windows for every source in the session).
A window is 1.5% of the film's envelope and a drag re-asks the one it is in.

Two scalars of the whole file are still needed to draw any frame of it: the
file's loudest bucket, which every column is scaled by, and its exact length,
which is where "past the end of the file" is measured. `viz_summary` reads both
off one pass that keeps no buckets -- the same windows, threads and opens
`peaks_over` decodes an envelope with, so the peak is the envelope's own -- and
the summary is kept per stream, sixteen bytes rather than 230 MB. Both routes
are memoized; a failed ask still is not.

`VizView` is what a painter is handed: either the whole envelope
(`visualizer_i420`, unchanged for export and the tests) or a window with the
file's own `total` and `peak`. A view that is a window cannot derive either from
itself, which is why they travel with it.

Also guards the sample rate that becomes samples-per-bucket: `per_bucket_of`
floors the rate at one both ways, because `sample / 0.0` is infinite, `as usize`
saturates and the fold's `resize(bucket + 1)` is then a length that does not
exist -- a panic in debug, a wrap and an out-of-bounds index in release. The
window arithmetic is written in buckets *per second* off the same helper.

Evidence (`cargo test -p engine --lib -- --test-threads=1 waveform::`):
16 passed, including a 40-minute FLAC whose envelope is 9.6M buckets (past the
real ceiling): a window's buckets are the envelope's bucket for bucket and its
frame is byte for byte the frame the whole envelope paints, the first ask decodes
a window, and the three asks after it -- a drag, a new seat each time -- decode
nothing at all.

2026-09-17

⚡ perf(audio): the envelope memo answers a trackless source tooAhmet Kaan Gümüş · 98fe25f
⚡ perf(audio): the envelope memo answers a trackless source too

peaks_shared returned early on Ok(None) and on Err, so a visualizer clip on
a source with no audio track re-opened its container on every picture
rebuild -- the per-rebuild cost the memo exists to remove. The map now holds
NoTrack as well as an envelope, and the two arithmetic paths (an envelope
over the ceiling is never held; a replaced entry's buckets come off the
count) are pinned by tests, mutation-checked against the three regressions.

2026-09-16

⚡ perf(audio): the visualizer reads its envelope from a process memoAhmet Kaan Gümüş · dc551d7
⚡ perf(audio): the visualizer reads its envelope from a process memo

A picture rebuild called `open_visualizer`, which decoded the whole file's
audio envelope again -- ~51 ms of CPU, 598k buckets for a 150 s song -- so
every look edit, and every sample of a wheel drag, paid a whole-file decode
for an answer that had not changed. `waveform::peaks_shared` memoises it by
the file's own stat (path, stream, buckets, length, mtime), bounded in
buckets; the envelope fed to the painter is the same value as before.

The user's "dragging causes frame drop" was that decode on the frame path:
rebuild latency p50 68 -> 6-18 ms, playing frame interval p95 80 -> 48 ms,
frames over 50 ms 32/438 -> 1/496. The wheel's own 720-polygon repaint
measured ~0.9 ms and the engine write's UI-thread share ~42 us, so neither
was touched.

2026-09-12

✨ feat(engine): the multichannel AAC decode seat is an ec-aac native — rusty_aac stays encoder-onlyAhmet Kaan Gümüş · fc0891f
✨ feat(engine): the multichannel AAC decode seat is an ec-aac native — rusty_aac stays encoder-only

- the >2-channel seat (a film's 5.1/7.1 track, symphonia refusing anything
  wider than stereo) now decodes with the family's own ec-aac; the same
  construction and decode call sites, the same seat shape, the same film
  channel order FL FR FC LFE BL BR the downmix folds
- witness: fold correlation +1.00000 against the retired rusty_aac decoder on
  2000 identical AUs of a 5.1 film remux (max|diff| 5.96e-8,
  RMS ratio 1.0000, channel matrix diagonal-dominant); stereo fixture
  +1.00000 / 5.46e-4 (PNS noise seed differs); new ffmpeg-correlated film
  witness a_seek_into_real_five_one_aac_film... scores 0.929/0.858/0.922
  landing on the asked second (threshold 0.5)
- perf: 12.0-13.2 Msamples/s (250-275x realtime) vs rusty 2.8-3.6 (58-75x) at
  5.1 on identical packets; 26-32 Msamples/s (580-719x) vs 6.7-7.7 (151-174x)
  on the stereo fixture -- ~3.5x the retired decoder, bar was >=0.9x
- known behaviour delta, honest in both directions: HE-AAC v1 (SBR) now
  reconstructs at the extension rate where rusty band-limited everything to
  the core Nyquist; PS streams decode core-only at the core rate in BOTH

2026-08-13

chore: rename ponytail: comment marker to corner-cut:Ahmet Kaan Gümüş · 9ba8e0a
chore: rename ponytail: comment marker to corner-cut:

Marker convention renamed after uninstalling the ponytail plugin;
semantics unchanged (deliberate corner-cut, known ceiling + upgrade path).
Token-only rename, 81 comment lines, no code change.
⚡ perf(waveform): a film's envelope is read by several handsAhmet Kaan Gümüş · 50e3988
⚡ perf(waveform): a film's envelope is read by several hands

Importing a source decodes its whole audio track for the lane's waveform, and
on a film that is the longest thing an import waits for: 22.7 s of one core for
a 2 h 39 m 5.1 E-AC-3 mkv, 3.8 s for a 2 h stereo AAC mp4. It is linear in
length and nothing about it was parallel, though `open_multi_streams` has
always taken a window per call and seeked to it.

So a source long enough to pay for the extra opens is cut into windows -- one
per minute, capped at the machine's cores and at eight -- decoded side by side
and stitched. The first window is the session that was opened to learn the
length, so a split costs `jobs - 1` opens and not `jobs`. Joining is safe
because the fold is min/max into absolutely-numbered buckets: the chunk that
straddles a joint is folded into both windows and cannot be double-counted.

The 2 h 39 m mkv's 22.7 s becomes 4.6 s and the 2 h mp4's 3.8 s becomes 1.2 s,
bucket count identical either way. A clip under two minutes is read exactly as
it was, on the calling thread. `bench waveform <file>` is the metric.

2026-08-11

✨ fix(waveform): a film in an mkv paints its wave, and a failure says soAhmet Kaan Gümüş · ffb3105
✨ fix(waveform): a film in an mkv paints its wave, and a failure says so

A 5.1 AAC track decodes through rusty_aac, whose IMDCT ran as an 8 MB
cosine matrix -- 88% of decode time and 2x realtime, so a two-hour film
needed an hour of background decode before its lane had anything to
draw. The same file has an N/4-point FFT already, for the encoder: the
IMDCT is a DCT-IV read at an offset, so both directions now share
dsp::dct4. 40x on the fixture, 141 s for the film.

And a decode that fails is no longer a silent file: peaks() errors reach
the lane as Wave::Failed with a band that says "audio unreadable", the
reason goes to the log, and the Matroska opener logs what it swallows.

2026-08-10

Merge S5a audio-file import into stream-picker mainAhmet Kaan Gümüş · 1bb8ee2
Merge S5a audio-file import into stream-picker main

Both sides taught `audio` a new axis and they meet on one type: S5a made
`Track` an enum over the mp4/AAC reader and symphonia's, main gave every
reader a `(path, stream)` address. The merged `Track::open(path, stream)`
keeps both -- the stream index lives inside `AacTrack::open`, and a
standalone audio file, which has exactly one track by construction, refuses
any stream above 0 rather than quietly serving the only one it has.

- `AudioProbe` is S5a's `{sample_rate, channels}`: equality is playability,
  so an mp3 may share a timeline with mp4s. Copyability is a separate
  refusal, at export, and stays AAC-only through `copy_track`.
- `probe_streams` reads a standalone file through symphonia instead of
  walking it as an mp4 -- an ALAC .m4a parses as an mp4 whose only audio
  track is not AAC, so the mp4 walk would call it undecodable where
  symphonia decodes it.
- Which lane a source lands on is decided once, in `place_stream_at`: a
  file with no picture is placed on the audio lane alone, everything else
  is pasted as a grouped take. The front-end only owes the refusal notice.
- `unsupported()` and the NTSC/VP9 work are untouched; `is_audio` files
  never reach the former, since a song cannot open a timeline at all.
✨ feat(library): every audio stream is a row, and the picked one plays and exportsAhmet Kaan Gümüş · ecb5e06
✨ feat(library): every audio stream is a row, and the picked one plays and exports

A file with one audio track per language is one row per track now, not one row
per file. The engine carries the pick end to end: a source is a (file, audio
stream) pair, .edith v3 writes the stream on the source line, playback opens it
and — the trap this closes — the export copies *that* stream's packets rather
than always stream 0.

Streams that cannot go on the timeline are listed greyed with the reason
instead of hidden: a codec we cannot read, or a rate/layout that cannot share
one output device and one copied AAC track with the rest of the timeline (there
is no resampler here and no AAC encoder to write a join with). place_stream_at
is the one door a row goes through, and it refuses those in the engine's own
words.

- v2 and v1 files still load: no stream field means stream 0, which is all
  those dialects could play; saving either writes v3.
- Waveform peaks are keyed by file *and* stream, so two tracks of one file
  cannot draw each other's envelope.
- Library swatches and clip tints follow the *file*, so a file's streams share
  one colour in the panel and on the lanes.
- assets/test_multilang.mp4: two AAC 44.1k stereo streams (und, fra), the shape
  real multi-language media has and the one where a second stream is placeable.

2026-08-09