Skip to main content

Module encode

Module encode 

Source
Expand description

Thin VA-API H.264 encoder built on the vendored libva binding.

Reuses the backend-agnostic bitstream layer (crate::codec::h264) from discord/cros-codecs (BSD-3-Clause) for SPS/PPS/slice synthesis, and drives libva directly for surface upload + slice submission, rather than vendoring cros-codecs’s generic multi-backend encoder framework. The per-frame VA buffer population is ported from cros-codecs’s encoder/stateless/h264/vaapi.rs.

Low-latency only: IPPP (no B-frames), one reference frame, matching the VideoToolbox / Media Foundation / NVENC backends in moq-video.

NOTE: compile-verified against libva 1.23, but the emitted bitstream has not been validated at playback. The per-frame param population, the reconstructed surface / reference rotation, and NV12 stride handling are the spots most likely to need hardware tuning.

Structs§

Config
H.264 encoder configuration. Dimensions must be even (4:2:0 chroma).
Encoder
A VA-API H.264 encoder. Built once, fed NV12 frames, emits Annex-B H.264.

Enums§

IsReference
Whether a frame is used as a reference, and for how long. (Vendored from discord/cros-codecs, BSD-3-Clause; used by the slice synthesizer.)