Commits
2026-11-25
ec-hw: HwEncoder (Vulkan first, VA fallback on Linux), HwDecoder (VA for now), capabilities() without opening an encoder; compiles on every OS; hw_caps exampleAhmet Kaan Gümüş · 274b9cbBrowse files
ec-va: depend on the vendored cros-libva by path instead of a workspace [patch], so path and git consumers get the VPP use-after-free fix without patchingAhmet Kaan Gümüş · 24666c0Browse files
ec-va: import_prime_raw / RawPrimeObject import DMA-BUFs by borrowed RawFd; cros-libva vendored in shims with Buffer owning its params, fixing a use-after-free of VAProcPipelineParameterBuffer regions that made every VPP region/scale convert render nothing (encode_surface/encode_frame of a size-mismatched source encoded black); ec-hw: submit_prime scales any source size to the encoder's size on the GPUAhmet Kaan Gümüş · d27d669Browse files
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-08-24
2026-08-20
feat(ec-probe,ec-matroska): register the TrueHD decoder in the unified readerAhmet Kaan Gümüş · 4026107
feat(ec-probe,ec-matroska): register the TrueHD decoder in the unified reader ec-probe's AudioDecoder now carries a TrueHd arm (mirrors Ac3: send_packet/ receive_frame/flush/reset through the generic Decoder trait), so a TrueHD track decodes through Reader/AudioDecoder like any other codec instead of only being named in Reader::unsupported. ec-matroska's muxer writes CodecId::TrueHd back out as A_TRUEHD (demux already read it in); the symphonia shim needed no change since it wraps ec_probe::AudioDecoder generically. Library test updated from "TrueHD is listed unsupported" to "the TrueHD track in his 7.1 remux decodes, 8ch/48kHz, alongside the AC-3 track"; added a demux->mux->demux codec-id round-trip test in ec-matroska.
2026-08-14
feat(hw): the VA-API parameter buffers, surface pool and frame readbackAhmet Kaan Gümüş · 89d28a7
feat(hw): the VA-API parameter buffers, surface pool and frame readback The foundation of the hardware crate: every codec parameter struct libva defines for the paths this family uses, transcribed by hand from the system headers and checked field for field by a `const` assertion against `crates/ec-hw/abi-probe.c`. A transcription slip is a compile error rather than a driver reading garbage. Around them: - `SurfacePool`, which allocates once and recycles: a surface returns to the free list when the reference buffer and the caller are both done with it, so nothing leaks and nothing is reallocated per frame. - `Frame`, with the two ways to reach the pixels — DRM PRIME export for the zero-copy path, and `vaGetImage` readback into I420 (8 or 10 bit) for callers that want the samples. The readback image is created once per stream: one `vaCreateImage`/`vaDestroyImage` pair per frame costs ~20 ms at 1080p on this driver, more than the decode itself. - A typed error for every failure. Nothing here panics: edith loads this path as a dlopen'd plugin whose fall back to software is only as good as that promise.
feat(shims): rusty_h264 0.9.1 surface over ec-h264Ahmet Kaan Gümüş · f26a1d2
feat(shims): rusty_h264 0.9.1 surface over ec-h264 Decoder::decode over whole access units and the EncoderConfig/Encoder/ YuvFrame/Preset surface edith's export path calls, without the incumbent's process-wide allocator and without its lookahead buffering: try_encode returns the access unit of the picture it was handed, every time.
feat(probe): one sniffing reader and one decoder registry for every audio fileAhmet Kaan Gümüş · 51de303
feat(probe): one sniffing reader and one decoder registry for every audio file Content decides the format, never the extension: RIFF, fLaC, OggS, EBML and ftyp by magic, MP3 and ADTS by three chaining frames after any ID3 tag (a lone MPEG audio header turns up inside AAC payload often enough that a single sync is not evidence). WAV, MP3, FLAC and ADTS are demuxed here — one walk, four framings, a frame index built on the first seek so a landing is sample-accurate. Ogg, mp4 and Matroska are delegated to their own crates: there is one EBML parser in this family and it is ec-matroska (cargo tree -p ec-probe shows the edge). Everything is served on the one reader the file was opened with, however many times it is seeked. Reader::seek answers where it actually landed, which is the number a segment start is trimmed against. Reader::unsupported names every audio track with no decoder and why. Cover art is not a video track and never appears as one. Tags: ID3v1/v2 and Vorbis comments; mp4 ilst is not read (edith reads no metadata today) and says so in the module docs. Verified: 26-file fixture matrix (format, codec, channels, packet counts against ffprobe, sample counts against ffmpeg), 100 random seeks per file each landing at or before its target within the container's own granularity, and a 9-file sweep of the real library covering aac, ac3, eac3, opus, mp3 and a TrueHD remux whose unplayable track is listed.
feat(image): PNG decoding and the still-image APIAhmet Kaan Gümüş · 7bceff2
feat(image): PNG decoding and the still-image API ec-image decodes stills for the engine's placed-picture path. This first stage is the shared API — format guessing from content, a Pixels buffer in the file's own colour form, parsed-but-unapplied metadata, and pixel limits checked before any buffer is sized from a header — plus the PNG decoder over ec-inflate. Every colour type at every legal bit depth, all five filter types, Adam7 interlace, palette and colour-key transparency, gamma and sRGB exposed, ancillary chunks skipped by length, and every chunk CRC verified: a PNG that fails its own checksum is refused rather than decoded into a picture nobody can tell is wrong. scripts/gen-still-fixtures.sh generates the seeded corpus the later stages measure against; the fixtures themselves stay out of the repository.
feat(h265-syntax): NAL framing, parameter sets, slice headers and SEIAhmet Kaan Gümüş · 0d07f18
feat(h265-syntax): NAL framing, parameter sets, slice headers and SEI Writers and parsers for the same structures, so a round trip is a test rather than an article of faith. Sized by what a stateless hardware decoder asks for: every field of VAPictureParameterBufferHEVC and VASliceParameterBufferHEVC is a field here or a named method on one. The conformance window is first class - 1920x1080 codes as 1920x1088 and crops - and the slice header hands back where the data starts, escape bytes counted, which is what slice_data_byte_offset means.
feat(mp3): Layer III decoder and encoder, tables measured not copiedAhmet Kaan Gümüş · 1325107
feat(mp3): Layer III decoder and encoder, tables measured not copied ec-mp3 decodes MPEG-1, MPEG-2 LSF and MPEG-2.5 Layer III and encodes CBR MPEG-1 Layer III, and shims/rusty_mp3 carries the incumbent's name, version and call shape over it. Layer III's Huffman code tables and its 512-tap polyphase window are normative data no formula produces. Instead of copying them out of an existing implementation, scripts/mp3-tables measures them against a reference decoder: it writes legal frames whose main-data bits it chooses, decodes them with ffmpeg, and reads the answer back through a model of the decode chain. Every code tree is walked to its leaves and checked for a Kraft sum of exactly 1, complete coverage of its value grid and no duplicates; the window is least-squares fitted to a 1.6e-6 residual, the f32 noise floor of the decoder measured. The same rig produced the MPEG-1 long scalefactor band widths, which came out equal to the published layouts, and it corrected two things a description would not have: the MPEG-2.5 11.025 and 12 kHz short-block layouts are the 16 kHz ones, and the short-block region boundary is three scalefactor bands rather than the fixed 36 lines that only holds where those bands are four wide. Decoder: header and CRC, side info, scalefactors (MPEG-1 with scfsi and the LSF partition scheme), all Huffman tables, requantisation, mid/side and intensity stereo, short-block reorder, alias reduction, IMDCT with the four block windows, and a DCT-based polyphase bank from ec-dsp. ID3v2 and the Xing/LAME/VBRI header frame are skipped, junk is resynced over, and free-format is refused by name rather than guessed at. Encoder: polyphase analysis (the synthesis bank's adjoint, reconstructing to its -85 dB design limit), MDCT with block switching, an FFT-based masking model whose gaps are stated in the module docs, inner rate and outer distortion loops, Huffman table and region selection, and a bit reservoir that emits frames one behind so a granule can start inside the previous frame's payload. Measured, all against ffmpeg: - decode: 47 fixtures (nine sample rates, mono/stereo/joint/simple, CBR and VBR) at correlation 1.000000, 333-3232x realtime - encode: at or above rusty_mp3 0.6.1 on the same corpus and metric at 128/192/320 kbit/s, mono and stereo, every stream decoding without an ffmpeg warning
feat(ac3): A/52 headers, bit allocation model and transform primitivesAhmet Kaan Gümüş · bd2188c
feat(ac3): A/52 headers, bit allocation model and transform primitives syncinfo/bsi (including the Annex D alternate syntax), the parametric bit allocation of section 7.2.2 with its spec tables, exponent and mantissa unpacking, and the 512/256-sample IMDCT with window and overlap-add over the shared ec-dsp FFT. Grouped mantissas are shared across exponent sets, per section 7.3.5: the group state belongs to the audio block, not to the channel.
feat(h264): registry Decoder entry, avcC extradata, mechanism-named refusalsAhmet Kaan Gümüş · 19f3903
feat(h264): registry Decoder entry, avcC extradata, mechanism-named refusals The NAL-level Decoder is what a bitstream tool wants; a demuxer wants packets. H264Decoder implements ec_core::registry::Decoder over the same decode core and adds the two things a container brings with it: parameter sets carried out of band in an avcC record (14496-15 clause 5.3.3.1), and NAL units framed by a length prefix instead of Annex B start codes. The framing is decided once, by whether extradata held an avcC, and the SPS inside it publishes the picture size before the first packet arrives. Every refusal's why-text now names the syntax element that fired and the machinery it would need, not just "not implemented" — the conformance suite proves each one against a stream that really uses the feature, so the text is the capability statement a caller reads.
feat(mp4): ISOBMFF box model, esds descriptors and the demuxerAhmet Kaan Gümüş · 49be010
feat(mp4): ISOBMFF box model, esds descriptors and the demuxer The box walk checks every size against its parent and every table entry count against the box that holds it, so a crafted header is an error and never an allocation. The moov walk resolves the sample tables into offset/size/dts/cts/sync per sample, reads fragments (moof/traf/trun) into the same tables, and takes the frame rate off stts as an exact rational -- whole track over whole track, so NTSC film stays 24000/1001 instead of decaying into 23. A sample entry is read for what it says it is: an mp4a holding MP3 is an MP3 track rather than a dropped one, ac-3/ec-3/alac/Opus/fLaC and the QuickTime PCM entries are their own codecs, and an entry with no CodecId leaves its track listed rather than decoded as something else. The esds parser hands back the DecoderSpecificInfo as bytes, which is the field callers previously had to rebuild from parsed fields.
feat(vp9,av1): bitstream header parsers for stateless hardware decodeAhmet Kaan Gümüş · ee46976
feat(vp9,av1): bitstream header parsers for stateless hardware decode ec-vp9-syntax parses the superframe index and the whole uncompressed frame header (profiles 0-3, colour config, size-from-reference, loop filter, quantization, segmentation, tile info), carrying the state VP9 spreads across frames: reference sizes, segmentation data and loop filter deltas. The spec 8.6.1 dequantization tables and the 8.8.1 loop filter level derivation ship with it, so every field of VADecPictureParameterBufferVP9 and VASegmentParameterVP9 comes out of the parse. ec-av1-syntax parses OBU framing, the sequence header and the frame header in full (superres, reference signalling incl. set_frame_refs, tile info, quant, segmentation, delta q/lf, loop filter, CDEF, loop restoration, tx mode, skip mode, global motion, film grain) plus tile group offsets, and derives the warp shear validity VAWarpedMotionParamsAV1 asks for. Both are BitReader-based, forbid unsafe, and answer malformed input with a typed error rather than a panic. Verified against every VP9/AV1 fixture stream with ffprobe as the oracle: dimensions, profile, bit depth, chroma, per-frame key flags and shown-frame counts all agree, including 10-bit, 4:4:4, monochrome, multi-tile, superframes and show_existing_frame.
feat(matroska): EBML grammar and Matroska/WebM demuxerAhmet Kaan Gümüş · 4888147
feat(matroska): EBML grammar and Matroska/WebM demuxer The element grammar both directions share (variable-length ids and sizes, in-memory child walks, the unknown-length rule) and the reader on top of it: segment and track walk, cluster walk, SimpleBlock and BlockGroup, all three lacings, ContentEncodings undone (zlib through ec-inflate, header stripping put back, everything else refused by name), and cue-driven seeking on the one reader a file was opened with. Ported from the engine's own demuxer, restructured around the ec-core Demuxer contract: packets stream out of one cluster-sized allocation instead of a frame index built for a video editor, and every track of the file becomes a StreamInfo rather than one picture track plus a sound list.
feat(riff): WAV reader/writer and the hound shim over itAhmet Kaan Gümüş · 5dd56cf
feat(riff): WAV reader/writer and the hound shim over it ec-riff writes and reads RIFF/WAVE: 8/16/24/32-bit integer PCM and 32-bit float, mono through 7.1, any sample rate. The writer streams and patches the RIFF, data and fact sizes in finalize (best-effort on drop), and emits WAVE_FORMAT_EXTENSIBLE with a channel mask whenever a file has more than two channels or more than 16 bits. The reader walks the chunk list rather than assuming fmt-then-data, so LIST/INFO, fact and odd-sized chunks with their pad byte are skipped, and a truncated or unpatched data size yields what is actually there. RF64, ADPCM and 64-bit float are refused by name. shims/hound carries package name hound 3.5.1 over ec-riff, covering exactly what edith consumes: WavWriter::create/write_sample/finalize, WavSpec, SampleFormat and an Error with the incumbent's variants. Checks: cargo test -p ec-riff -p hound (10 tests), and the emitted oracle artifacts compared against ffmpeg's own decode - 5 written formats and the 6 wav fixtures all PASS at corr 1.000000, RMS delta 0.
feat(opus): range decoder and packet framingAhmet Kaan Gümüş · b05a16e
feat(opus): range decoder and packet framing RFC 6716 Section 4.1 range decoder (exact u32 arithmetic, raw bits from the frame end, ec_tell/ec_tell_frac) and Section 3 + Appendix B framing: TOC, codes 0-3, padding, and the self-delimiting variant multistream needs. Checks: symbol round-trip against a test-only range encoder written from Section 5.1, tell/tell_frac agreement, and a malformed-input sweep that must never panic.
feat(core): workspace + ec-core IR foundationAhmet Kaan Gümüş · a3c0049
feat(core): workspace + ec-core IR foundation
Cargo workspace (crates/*, shims/*, tools/*) and ec-core, the IR every
crate in the family builds on:
- timebase: reduced rational TimeBase + Timestamp, all i128-exact integer
math, four rounding modes. 24000/1001 is representable and stays exact;
cross-base ordering compares instants without rounding first.
- packet: Buf (refcounted byte range, cheap clone and slice) + Packet with
optional pts/dts/duration, flags and side data.
- frame: VideoFrame over validated planes (I420/I422/I444, 10-bit I010/
I210/I410, NV12/NV21, P010/P016, gray, packed RGB/BGRA) with CICP colour
code points, AudioFrame with named channel positions (5.1 = FL FR FC LFE
BL BR) interleaved or planar.
- bitio: MSB and LSB bit readers/writers, exp-Golomb ue/se both ways,
truncation reported as NeedMore instead of panicking, exp-Golomb prefix
bounded so a fuzzer cannot spin.
- error: NeedMore/Eof/Unsupported{what,why}/Corrupt{context}/Io; a refusal
always names what was refused and why.
- registry: CodecId for every codec edith touches (video, audio, subtitle),
CodecParameters/StreamInfo, and the Demuxer/Muxer/Decoder/Encoder
contracts. Codecs are push/pull (send_packet/receive_frame) because
packets and frames do not correspond one to one and end of stream has to
be drainable.
forbid(unsafe_code), warn(missing_docs), no dependencies, no async.