forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 00c1b3ff2d80d84fef71bb6208110dedbbd95fc4Filtered to crates/ec-hw/src/frame.rsClear filter

2026-08-20

feat(hw): expose bit_depth on I420_16 and pin 10-bit readbackAhmet Kaan Gümüş · 54b87cd
feat(hw): expose bit_depth on I420_16 and pin 10-bit readback

I420_16 is the lossless P010 readback, but the value carried nothing to
say so: a 10-bit consumer had only the method name to tell it apart from
the truncating to_i420 path. It now carries bit_depth (always 10),
matching Frame's field.

Adds a unit test that uploads a synthetic P010 surface whose samples
(512, 513, 1023) alias under 8-bit truncation and asserts to_i420_16
preserves them exactly while to_i420 yields the >> 2 values. The crate
doc now states that 10-bit consumers must call to_i420_16.
feat(hw): expose HEVC prefix-SEI HDR peak and VUI colour tags on Frame/DecoderAhmet Kaan Gümüş · 7669974
feat(hw): expose HEVC prefix-SEI HDR peak and VUI colour tags on Frame/Decoder

edith's replica needs MaxCLL/MaxFALL for HDR films whose container never
carried them (they live only in HEVC content_light_level/mastering_display
SEI) — ec-hw's decode() dropped every SEI NAL on the floor. HevcDecoder now
merges ec_core::color::hevc_sei_light per access unit (sticky across frames
that carry none) and resolves VUI colour tags from the SPS; H264Decoder
resolves VUI tags only (no SEI parsing for that codec yet); VP9/AV1 report
None (not implemented). New Frame::colour()/Decoder::colour() surface it,
bundled as ec_hw::frame::Colour{description, light} over the existing
ec-core ColorDescription/ContentLight types.

Tests: hdr_film_light_level_sei_is_exposed pins MaxCLL/MaxFALL 1230/419 and
primaries/transfer/matrix 9/16/9 against the real ReelD rip;
sdr_h264_colour_never_panics proves the VUI-only path doesn't panic on an
SDR fixture (skips when no fixtures generated, same convention as the rest
of gpu.rs).

2026-08-14

fix(hw): HEVC picture order counts follow prevTid0Pic, not the last pictureAhmet Kaan Gümüş · 5f55768
fix(hw): HEVC picture order counts follow prevTid0Pic, not the last picture

A 4K HDR release decoded at 19 dB against the software decoder: right
most of the time, wrong wherever it mattered. Two clauses, one cause.

8.3.1 predicts the picture order count MSB from `prevTid0Pic` — the
previous picture with TemporalId 0 that is neither a leading picture nor
a sub-layer non-reference. Predicting from the previous picture instead
works on a stream without temporal sub-layers (every fixture here) and
puts the MSB a wrap out on one that has them, which hands the driver the
wrong references and the wrong output order.

The same NAL types say which pictures may be referenced at all: a "_N"
type is a sub-layer non-reference, and storing it as a short-term
reference lets the next picture's reference picture set match it by
picture order count.

Also passes `st_rps_bits` through, so a driver that skips a reference
picture set the slice header carried itself knows how long it was, and
adds an `EC_HW_DEBUG` trace of the per-picture DPB state — this bug was
found with it.

Five files from the real library now decode identically to the software
decoder, including the one that failed: 2160p HEVC Main10 HDR, 1080p
HEVC 10-bit, 1080p AV1 10-bit and two 1440p H.264 screen captures.
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.