Commits
Commits on
03dc6e9978cbbbba112bf5c6ad925845ede8c744Filtered to crates/ec-hw/tests/gpu.rsClear filter2026-08-20
fix(h264): drop leading pictures after a seek's open-GOP recovery pointAhmet Kaan Gümüş · 03dc6e9
fix(h264): drop leading pictures after a seek's open-GOP recovery point Root cause (crates/ec-h264/src/dpb.rs, crates/ec-h264/src/decoder.rs; mirrored in crates/ec-hw/src/dec/dpb264.rs, crates/ec-hw/src/dec/h264.rs): an open-GOP I picture is not an IDR — it is a plain I slice whose predecessors in decode order can still be referenced by pictures that follow it. A decoder started fresh at that I (exactly what a seek does) has none of those earlier references, so `build_ref_lists` pads the missing entries with whatever it has. The old code decoded and output those leading pictures anyway, handing back frames predicted from padded (garbage) references before the stream ever reaches a picture whose references are all real. Annex D.2.8 defines a `recovery_point` SEI whose absence (the common case, and this fixture's case) defaults `recovery_frame_cnt` to 0: the recovery point is the RAP's own POC, i.e. only pictures with a POC at or after the leading I's own POC are guaranteed fully referenced. The SEI itself is deliberately not parsed — the default already gives the correct threshold for the case that matters (mid-GOP seek), and a real non-zero `recovery_frame_cnt` is out of scope for this fix. `build_ref_lists` now returns whether it had to pad a list ((lists, padded)); `Decoder`/`H264Decoder` OR that per-slice into `cur_ref_padded`/`Current::ref_padded`, latch the first post-reset picture's POC into `recovery_poc` on `end_picture`/`finish_picture`, and compute `output_ok = !(ref_padded && poc < recovery_poc)`. `Dpb::store` takes that flag and marks the picture `Mark::Unused`-eligible for output gating (`pic.output = output_ok`) — it still joins the DPB as a reference and for bookkeeping, but a gated picture is never handed to a caller. `reset_pictures` clears `recovery_poc` so a later seek gets its own threshold. New test `h264_seek_matches_linear_open_gop` in both suites drives this through the real entry surface: fixtures/video/h264-open-gop.mp4 (x264 open-GOP, generated via scripts/gen-fixtures.sh) primes a fresh decoder with the leading IDR's parameter sets, resets picture state (a seek's exact contract), feeds it from the open-GOP I access unit before display frame 30, and asserts the first decoded picture matches a linear decode of frame 30. Confirmed failing before this fix (forcing output_ok true reproduces the mismatch) and passing after, on both the software decoder (crates/ec-h264/tests/conformance.rs) and the VA-API path (crates/ec-hw/tests/gpu.rs, real hardware). cargo test -p ec-h264: 70 lib + 23 conformance + 8 encode passed, 0 failed. cargo test -p ec-hw --test gpu -- --test-threads=1: 19 passed (18 pre-existing + the new one), 0 failed.
fix(ec-hw-hevc): drop RASL pictures after a seek's random-access CRAAhmet Kaan Gümüş · e1b58c9
fix(ec-hw-hevc): drop RASL pictures after a seek's random-access CRA Root cause (crates/ec-hw/src/dec/hevc.rs): a CRA that opens a mid-stream random-access point stores its RASL leading pictures *after* itself in decode order even though they display *before* it (H.265 open-GOP coding). Those RASL pictures predict from pictures before the CRA, which a decoder started at that CRA — exactly what a seek does — never decoded. The old code decoded and output them anyway: bump() orders output purely by POC, so the (garbage) RASL pictures came out ahead of the CRA itself, shifting every subsequent output index by however many RASL pictures the GOP has. Per 8.1.3, `NoRaslOutputFlag` is 1 for the first picture of a coded video sequence — which the first IRAP after a `reset()` (mid-stream start) always is. RASL pictures (nal_type 8/9) associated with such an IRAP must not be decoded or output (8.1.3 / C.5.2.2). `HevcDecoder` now tracks that flag (`no_rasl_output`, set in `start_picture` on every IRAP) and skips `start_picture` entirely for a RASL access unit while it holds, so the picture is dropped whole rather than handed to the driver or bumped out. New test `hevc_seek_matches_linear_mkv` (crates/ec-hw/tests/gpu.rs) drives this through the real entry surface: it primes a fresh `Decoder` with the stream's parameter sets, `reset()`s it (a seek's exact contract per the existing reset() doc comment), feeds it from the CRA access unit preceding display frame 30 of test_hevc.mkv, and asserts the first decoded picture matches a linear decode of frame 30. Confirmed failing before this fix (mismatched I420 planes) and passing after. cargo test -p ec-hw --test gpu -- --test-threads=1: 18 passed (17 pre-existing + the new one), 0 failed.
2026-08-19
test(hw): the reference feed keeps the film's own cadence, and RSS is measured aloneAhmet Kaan Gümüş · 3c2d14b
test(hw): the reference feed keeps the film's own cadence, and RSS is measured alone Three fixes to the live GPU suite: - the reference decode now passes pictures through at their coded cadence instead of conforming to the container's nominal rate, which duplicated or dropped frames on films whose real cadence differs and read as every frame being one off from some point onward - elementary-stream extraction is bounded to the frames under comparison plus a reorder margin, instead of piping a whole feature film through memory - the resident-set leak check re-runs itself in a child process: VmRSS is process-wide, and a sibling test allocating between baseline and end showed up as a 200 MB leak that no code caused
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.
test(hw): live GPU tests against ffmpeg, and Annex B fixturesAhmet Kaan Gümüş · 43c8097
test(hw): live GPU tests against ffmpeg, and Annex B fixtures Every test here talks to the real driver — a hardware crate whose tests do not touch the hardware tests nothing — and none is `#[ignore]`d; they skip when there is no VA display or the fixtures are missing. ffmpeg's software decoder is the oracle: each fixture is decoded both ways and compared frame by frame, at the stream's own bit depth (converting a 10-bit reference down to 8 dithers, which would hide a real difference behind a fake 53 dB one). Alongside the four codecs: the `frame_num` gap synthesis, a 719-frame decode-and-read-back loop watching `VmRSS`, the DRM PRIME export, the encoders round-tripping through ffmpeg *and* through this crate's own decoder, and a spot check against his real library rather than the fixtures alone. `scripts/gen-bitstream-fixtures.sh` gains the H.264 and HEVC elementary streams — including B-frame clips, so output reordering is exercised rather than assumed.