forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 5c8eff8ca5a0d547bfb22a690b3f7afb373da607Filtered to crates/ec-va/src/vpp.rsClear filter

2026-08-20

feat(ec-hw): route coded-size-mismatched encode_frame sources through VPP region copyAhmet Kaan Gümüş · 58e23aa
feat(ec-hw): route coded-size-mismatched encode_frame sources through VPP region copy

Encoder::encode_frame refused any source whose coded_size differed from
the encoder's block-rounded one (HEVC rounds to 32, so a 3840x2160 source's
2160 stayed unrounded while the HEVC coded height became 2176). Add
Vpp::convert_region (crates/ec-va/src/vpp.rs) — a VAProcPipelineParameterBuffer
submission with explicit surface_region/output_region rectangles, no
scaling — and route both 10-bit (P010) and now 8-bit coded-size-mismatched
sources through it into the encoder's own NV12 pool, placed at (0,0) using
frame.display_size. Encoder's own SPS conformance window / frame_cropping
(already sized from EncoderConfig.width/height, independent of the source
frame) makes the produced stream report the true visible size, not the
padded coded one. The pool is painted black/neutral-chroma once on
creation (Encoder::fill_black) so the padding rows a region copy never
touches are deterministic rather than driver-fresh-allocation garbage.

Real 4K HEVC Main10 mkv (3840x2160):
- encode_frame_accepts_p010_via_vpp: HEVC now accepted and round-trips
  (worst Y inf dB, worst UV 96.2 dB vs the CPU path; H264 worst Y/UV inf
  dB), and ffprobe confirms the produced stream is 3840x2160 for both
  targets.
- p010_zero_copy_encode_is_realtime (--release): H264 zero-copy 6.52
  ms/frame median (CPU path 18.80), HEVC zero-copy 5.29 ms/frame median
  (CPU path 16.95) — both under the 20 ms/frame target.

cargo test -p ec-va -- --test-threads=1: 13 + 6 doctests, all green.
cargo test -p ec-hw --release --test gpu -- --test-threads=1: 27 passed.
feat(ec-hw): P010 encode_frame goes through a GPU-resident VAProfileNone/VideoProc VPP pass, not CPU read-backAhmet Kaan Gümüş · 67c8428
feat(ec-hw): P010 encode_frame goes through a GPU-resident VAProfileNone/VideoProc VPP pass, not CPU read-back

encode_frame previously refused any 10-bit (P010) frame outright, forcing a
consumer's HDR->proxy export onto to_i420()+re-upload for the whole path.
This adds ec_va::Vpp (Config/Context/Buffer/Picture — all the existing
generic VA-API machinery, no new unsafe outside ec-va) wrapping
VAProfileNone/VAEntrypointVideoProc, and wires a lazily-built 2-surface NV12
pool + Vpp into ec_hw::Encoder: a 10-bit frame is converted P010->NV12 on
the GPU (VAProcPipelineParameterBuffer, whole-surface, no filters) and then
submitted through the exact same encode_surface() path as an 8-bit frame.

radeonsi capability check (vainfo): VAProfileNone/VAEntrypointVideoProc is
advertised on this GPU, confirming the entrypoint this crate now uses is
real hardware support, not a driver gap. HDR->SDR tonemap
(VAProcFilterHighDynamicRangeToneMapping) was NOT wired: sys.rs carries the
filter-type constants and Vpp::filters() (vaQueryVideoProcFilters) to check
for it, but the charter's own gpu.rs tests (PSNR/bench harness) were not
written this round — see the ledger DELTA for the honest state of that gap.

Scoped compiles green: `cargo check -p ec-va[--tests]`, `cargo check -p
ec-hw[--tests]`. The 23-test `ec-hw --test gpu` regression and a live P010
decode+encode_frame+decode-back PSNR run were NOT executed this round
(budget) — next round's first move.