forge
Explore
Log in

Don't you dare go Hollow

Commits

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

2026-08-21

2026-08-20

feat(ec-hw): zero-copy decode-to-encode surface path, VUI colour descriptionAhmet Kaan Gümüş · fc705c7
feat(ec-hw): zero-copy decode-to-encode surface path, VUI colour description

Encoder::encode_frame submits a Frame's decoded VA surface directly as the
encoder's source picture, with no to_i420 CPU read-back and no re-upload —
what the consumer's previous backend did for a decode-then-encode pipeline.
Refuses a cross-Display frame, a 10-bit (P010) source (no Main10 profile is
built here), or a coded-size mismatch with a typed Error.

EncoderConfig::colour(primaries, transfer, matrix, full_range) reaches the
VUI of both the H.264 and HEVC packed SPS writers
(video_signal_type_present_flag / colour_description_present_flag), so an
HDR or BT.709 export stops reading back as "unspecified".

Live-GPU tests in gpu.rs cover both: encode_frame vs the CPU-path baseline
on the same decoded frames (PSNR compared, further: they came back byte
identical on this driver), and ffprobe reading BT.2020/PQ/BT.2020nc back off
a written stream while the no-colour-set case stays deterministic.

2026-08-14

feat(hw): hardware encoding for H.264 and HEVC, AV1 behind an opt-inAhmet Kaan Gümüş · 7368f27
feat(hw): hardware encoding for H.264 and HEVC, AV1 behind an opt-in

IDR-then-P with a single reference, CQP or CBR, one frame in and one
coded frame out. HEVC encoding is in the tree rather than on a branch,
which is the whole point of writing this one: the conformance window is
a field of the sequence, so 1916x1080 comes out the size it went in.

The packed headers are the application's job here. This driver
advertises `SEQUENCE | PICTURE | SLICE` and then writes none of them
itself, so the crate writes the H.264 parameter sets and slice headers,
and reuses `ec-h265-syntax` for the HEVC ones — the same code that
parses them. Two driver behaviours are pinned down by comment where they
were found by measurement: the parameter sets only reach the stream when
a slice header accompanies them, and the HEVC slice header this driver
composes omits `slice_loop_filter_across_slices_enabled_flag`, so the
PPS has to say the flag is absent or every P picture decodes as
`alignment_bit_equal_to_one = 0`.

AV1 encoding is refused unless a caller sets `allow_av1`. That guard is
not caution for its own sake: a probe at the driver's own minimum encode
size took the GPU down with a hard recovery on 2026-08-14, and there is
no error to return from a context that no longer exists.