Commits
2026-10-23
Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23) On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local repository with all of its history. This commit restores the working tree from the newest surviving copy, the host-c server lane mirror. That mirror matches local main as of the testcut Phase 2 reports, including the tool cache, the nextest fast profile and changed-crates.sh. The history before this commit was not recovered.
2026-09-29
merge current main; drop this lane's conversion of the three test files main already coversAhmet Kaan Gümüş · 2711aa8
merge current main; drop this lane's conversion of the three test files main already covers The wave landed the same class fix for ec-h264 conformance, ec-opus conformance and ec-flac xiph_vectors in its own require_fixtures shape. Keeping both would be two conventions in one file and a 1054-line diff in a preflight lane, so this branch now carries main's version of those three files verbatim and keeps only the crates the wave did not touch.
tests: make the real-library sweeps LOCAL-ONLY, and report the classAhmet Kaan Gümüş · fcb9ffb
tests: make the real-library sweeps LOCAL-ONLY, and report the class
real_library_streams_match_ffmpeg reds every fleet run with "only 0 real
files swept end to end; the sweep is the point". It is not a decoder defect:
the precondition is a PERSONAL media library, reachable only through the
gitignored fixtures/real-library-manifest.tsv that
scripts/scan-real-library.sh generates by scanning the user's own media
directories.
Both of its runner behaviours are wrong, which is why this is #[ignore] and
not an env-gated SKIP:
- manifest absent -> the existing "SKIP: missing" return prints GREEN,
which is the silent-skip class this batch is removing;
- manifest present, paths unresolvable (a host that ran the scan against
an empty library) -> zero swept, `decoded >= 3` fails, red for a reason
unrelated to the decoder.
An env gate whose variable is absent on the runner prints that same green --
the defect, not the fix. An ignore is visible in --list, cannot go green
silently, and leaves the assertion intact.
ec-aac's real_library_tracks_match_ffmpeg gets the identical one-liner: same
manifest, same "skip if missing then assert checked >= 3" shape, same two
failure modes.
Local verdict on the workstation, where the library is: 15 files decoded
bit-exact, 0 refused by name, 0 failures, 1918 s, across matroska and
mov/mp4 at 576px-3840px, with one file taking the container-demux fallback.
The decoder is fine. The 1918 s is now in the ignore reason so the next
person does not read a 30-minute wall time as a wedge.
lanes/h264reallib.report.md carries the full class sweep: 51 sites examined,
2 fixed here, 3 that need a decision (ec-probe library.rs:490, whose own
header comment the assert contradicts, and two bare HOME unwraps that want
unwrap_or_default), and the false positives that must not be touched.fixture-preflight: kill the fixture-absent silent-skip class, generate the fixture library manifestAhmet Kaan Gümüş · 60e2653
fixture-preflight: kill the fixture-absent silent-skip class, generate the fixture library manifest
A test that could not find its fixture printed SKIP and returned, so the suite
reported PASS having tested nothing. That cost a 3-hour suite red from a missing
repo-root fixtures/ dir and three hosts whose fixture libraries differed
silently. Two halves:
1. The sweep. One convention in every non-av1 test crate: probe first, assert
LAST with an EC_REQUIRE_FIXTURES escape, return LAST -- never an early
return, and never the probe folded into the same `if` as the escape (the
`have_ffmpeg` short-circuit in crates/ec-av1/src/stream.rs). Converted
ec-h264 (conformance + encode), ec-flac (xiph_vectors + encode_matrix),
ec-opus conformance, ec-aac (oracle + sbr_real_library), ec-mp3
encode_matrix, ec-vp9 (hbd_exact, inter_pixels_exact, subsampling_exact,
scratch_interdump), plus non-empty floors on fixture loops that ended in a
bare assert!(failed.is_empty()) over a possibly ZERO-iteration loop
(jvt_full_sequence_bit_exact, corrupt_streams_never_panic,
ns_per_macroblock_measurement, ec-aac synthetic_heaac_matrix, ec-mp3's 8-WAV
corpus, ec-vorbis' three user-library sweeps).
Host media directories are deliberately NOT gated: a personal corpus is not
the committed library, and EC_REQUIRE_FIXTURES must not turn one operator's
home into a red fleet. They route through a separate require_host_media
helper. Tool-absence SKIPs (ffmpeg/x264/aomenc on PATH) stay a tool gate,
out of scope.
2. The preflight. scripts/gen-fixture-library.sh GENERATES
scripts/fixture-library.tsv (path, required-by file:line, provenance,
status, sha256) and scripts/verify-fixture-library.sh checks SHAPE, RESOLVE
(every path exists, every directory non-empty) and DRIFT (regenerating
reproduces the committed file). It distinguishes the two failure modes: a
missing fixture ROOT (mode i -- a linked worktree never has the gitignored
fixtures/; fix the tree) from a missing path inside a present root (mode ii
-- run the generator). It honours the same EC_REQUIRE_FIXTURES env: red when
set, SKIP-shaped and exit 0 when not.
The manifest states findings rather than hiding them: 52 committed pins
whose only provenance is a gate comment, 3 known-absent pins kept as rows
(ll444-lossless-key.obu, golden3-pin.obu, sbpart-pin.obu), and 4 committed
pins no source literal references. Enumeration is grep-derived and therefore
blind to runtime-assembled names (191 media literals resolve under no
enumerated directory); those are covered as far as their parent directory,
which must exist and be non-empty.
Proof (EC_NOMEMGUARD=1 only because the repo's memguard runner hit a stale
systemd scope):
EC_REQUIRE_FIXTURES=1 ec-h264 conformance 23 passed / encode 12 passed
EC_REQUIRE_FIXTURES=1 ec-flac xiph_vectors 4, encode_matrix 2 passed
EC_REQUIRE_FIXTURES=1 ec-opus conformance 28 passed / 16 ignored
EC_REQUIRE_FIXTURES=1 ec-aac oracle 14, ec-mp3 encode_matrix 5, ec-vorbis 8
mv fixtures/video/h264-open-gop.mp4 -> RED: "EC_REQUIRE_FIXTURES=1 but
fixture ... is absent -- regenerate with: scripts/gen-fixtures.sh"
mv flac subset/ and opus testvector01.bit -> RED on both
scripts/verify-fixture-library.sh: GREEN; with a fixture renamed and
EC_REQUIRE_FIXTURES=1 -> RED mode ii listing the path; same rename with
the env unset -> SKIP-shaped, exit 0; EC_FIXTURES=/nonexistent -> RED
mode i.2026-08-27
perf(aac): kill the rate loop's powf hot pathAhmet Kaan Gümüş · d08a7f7
perf(aac): kill the rate loop's powf hot path Profiling encode_frame (perf record --call-graph dwarf on a 10s real-PCM loop) showed 82% of wall time in libm's powf_fma, all reached through write_frame's cost closure -> quantise -> band_noise/quantise_one: band_noise's per-band scalefactor search called band_noise (two powf calls per coefficient) up to ~255 times per band, linearly walking every candidate level. - quantise_one's x^0.75 -> sqrt(x)*sqrt(sqrt(x)): two sqrtf beat one powf. - band_noise's q^(4/3) -> a precomputed lookup table over q's bounded (MAX_QUANT) integer range, since q is always an integer there. - the scalefactor search itself -> bisection, since the algorithm already assumed monotonic noise-vs-level to break on first overage; that's exactly what a binary search needs, and it drops ~255 candidate levels to ~8 per band. ec-bench's aac encode row: 3.54x -> 37.83x realtime (10.9x on a standalone 10s-PCM loop, matching the profiling harness). All ec-aac tests green. Also fixes crates/ec-aac/tests/oracle.rs's esds_asc helper, which scanned raw bytes for a literal 0x05 instead of walking the MPEG-4 descriptor tree by tag+length: a legitimate byte in the DecoderConfigDescriptor's avgBitrate field (which shifted with the quantiser's new floating-point path) could and did false-positive as the DecSpecificInfoTag.
2026-08-21
2026-08-20
fix(aac): run PNS noise substitution before M/S and intensity stereoAhmet Kaan Gümüş · 7efd1d7
fix(aac): run PNS noise substitution before M/S and intensity stereo ISO/IEC 14496-3 §4.6.13 fills a PNS band's spectral coefficients with scaled noise; §4.6.8.1 M/S and §4.6.8.2 intensity stereo then combine those coefficients like any other spectral data. BlockDecoder::finish ran M/S and intensity stereo first, then filled PNS bands afterward, so any band coded as PNS in one channel still read zero when the stereo tools combined it -- the pre-fill zero got mixed into the other channel's coefficient (M/S) or copied outright (intensity), corrupting a real channel's data whenever the encoder mixed PNS with stereo coding on the same band. Reordered to match every reference decoder's decode order: PNS -> M/S -> intensity stereo -> TNS. Diagnostic path: chased a consumer sweep's finding of 0.76-0.92 (and one 0.0) whole-file correlation on a set of AAC-in-mp4 screen recordings against ffmpeg. Direct ec-mp4-demux -> ec-aac-decode measurement (crates/ec-aac/tests/obs_real_content.rs), lag-searched per the existing sbr_real_library.rs pattern, reads corr=1.0000 on every non-silent file both before and after this fix -- these files' PNS usage (1-13 AUs) apparently never lands on a band the M/S mask also marks, so the reorder is a real spec-order bug but not what produced that sweep's numbers; the sweep's own method likely lacked a wide-enough lag search and caught this file family's ~1024-sample (~21ms, one AAC frame) container/decode alignment offset instead. The single 0.0000 file is genuine digital silence in both decoders. Also chased a second repro (a real AAC-LC-in-mp4 download, sequential single-decoder scan, crates/ec-aac/tests/reelh_per_frame.rs): per-AU correlation reads 1.0000 across the whole 10.4s file except one near-silent intro AU where both decoders read ~0 RMS and the correlation ratio is numerically meaningless -- no reproducible mid-stream collapse found in this file at this crate's decode layer, with or without this fix. Added crate-level tool-usage side info (EC_AAC_TOOL_SIDEINFO_DEBUG, mirroring sbr_chain's SbrSideInfoRow pattern) and five ffmpeg tool-isolation fixtures (-aac_pns/-aac_is/-aac_ms/-aac_tns, one at a time and one with all four) wired into oracle.rs, all passing at >=0.999 correlation, to pin the fixed decode order and give any future PNS/IS/M-S/TNS regression a per-tool fixture to land on.
2026-08-19
feat(aac): wire SBR HF gen + envelope adjustment into the decode chainAhmet Kaan Gümüş · 5206266
feat(aac): wire SBR HF gen + envelope adjustment into the decode chain sbr_chain.rs ties sbr_payload/_hf/_env/_qmf together per element: a FIL element's sbr_extension_data (explicit ASC signaling only, no implicit ADTS detection yet) drives 32-band analysis of the preceding SCE/CPE's core PCM, HF generation, envelope adjustment, and 64-band resynthesis, replacing that element's plane with double-rate PCM. SbrSupport gains a V1 variant (PS still reports CoreOnly); output_sample_rate now reports the extension rate for a reconstructed stream. sbr_is_reported_not_silently_upsampled is updated (not deleted) to pin the new contract, plus a PS case. Not yet exercised: real-file oracle correlation (next commit), implicit ADTS SBR signaling (deferred, named follow-up per charter), filterbank delay compensation for packet timestamps (open -- see report).
2026-08-14
test(aac): oracle sweep, real-library tracks, incumbent bar and the table derivationAhmet Kaan Gümüş · 646127f
test(aac): oracle sweep, real-library tracks, incumbent bar and the table derivation Thirteen checks over the decoder and encoder, plus the shim's own three at the call shapes the replica has. Decode: every ADTS and mp4 fixture, mono through 5.1, per-channel correlation at or above 0.999998 against a reference decode; five library tracks including a 7.1 mp4 and a 5.1 mkv at 1.000000; the 5.1 element order proved with one tone per channel; and the one HE-AAC track in the library decoded to its AAC-LC core, matched on band energies against the reference's own core band. 426x realtime on 5.1, release build. Encode: against the incumbent's numbers on the same lossless fixtures at the same bitrates, measured by running it as a black box -- 0.9996 to 1.0000 per channel where it manages 0.9611 to 0.9864. Output decodes with no reference-decoder complaint, and the AudioSpecificConfig this crate writes is byte-identical to the one that muxer puts in an esds. Tables: Kraft sum of exactly 1 and the prescribed entry count for all twelve codebooks, band tables monotone and spanning their window. The derivation itself lands under scripts/ so the clean-room claim is reproducible rather than asserted.
feat(aac): AAC-LC decoder, encoder and rusty_aac shimAhmet Kaan Gümüş · 9a848b4
feat(aac): AAC-LC decoder, encoder and rusty_aac shim Decoder covers AAC-LC end to end: AudioSpecificConfig and ADTS framing, all four window sequences and both window shapes, section and scalefactor data, every spectral codebook including the escape one, pulse data, TNS, M/S and intensity stereo, PNS, and SCE/CPE/LFE/DSE/PCE/FIL elements. Output is film order FL, FR, FC, LFE, BL, BR (SL, SR), which is the order the downmix in this family folds, so a 5.1 track needs no caller-side permutation. HE-AAC's SBR is not reconstructed: such a stream decodes to its AAC-LC core and reports the core rate rather than claiming the extension's. Encoder is a full two-loop search: 2048-point FFT masking with spectral flatness for tonality, bark-ish spreading, a relative hearing-threshold floor, transient-driven window switching, per-band mid/side, exact Huffman bit counts for codebook choice, and a bit reservoir against a CBR target. Both ADTS and bare raw_data_block output. The normative tables were derived rather than transcribed: access units with a chosen spectral payload were decoded by a reference decoder and read back through the inverse MDCT, which enumerates each codebook by a binary tree walk. Every one came out with a Kraft sum of exactly 1 and the entry count the standard prescribes. forbid(unsafe_code) in both crates.