Skip to content
Merged
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "moq-vaapi"
version = "0.0.3"
description = "(AI GENERATED) VA-API H.264 hardware encoder, derived from discord/cros-libva + discord/cros-codecs"
description = "(AI GENERATED) VA-API H.264 hardware encoder and decoder, derived from discord/cros-libva + discord/cros-codecs"
authors = ["The ChromiumOS Authors", "Discord", "Luke Curley <kixelated@gmail.com>"]
repository = "https://github.com/moq-dev/vaapi"
license = "BSD-3-Clause"
readme = "README.md"
keywords = ["vaapi", "h264", "encoder", "video", "hardware"]
keywords = ["vaapi", "h264", "encoder", "decoder", "hardware"]
categories = ["multimedia::encoding", "hardware-support", "external-ffi-bindings"]
edition = "2021"
rust-version = "1.85"
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

> **⚠️ AI GENERATED.** This crate was written by an AI agent (Claude), using the
> repositories below as references. How closely individual files track upstream
> varies and the emitted bitstream has not been validated at playback — treat the
> whole thing as derived, unverified work and review before relying on it.
> varies and the encoder's emitted bitstream has not been validated at playback —
> treat the whole thing as derived, unverified work and review before relying on
> it. The decoder is the exception: it has been checked against a software
> reference on Intel hardware (see below).

A small, self-contained **VA-API H.264 hardware encoder** for Linux (Intel / AMD),
A small, self-contained **VA-API H.264 hardware codec** for Linux (Intel / AMD),
derived from
[discord/cros-libva @ discord-0.0.13](https://github.com/discord/cros-libva/tree/discord-0.0.13)
and
Expand All @@ -14,13 +16,21 @@ and
[cros-libva](https://github.com/intel/cros-libva) (ChromiumOS).

It exists to give [moq](https://github.com/moq-dev/moq)'s `moq-video` a thin,
crates.io-publishable VA-API encoder brick instead of a multi-backend framework
crates.io-publishable VA-API codec brick instead of a multi-backend framework
pulled in as a git dependency.

## What it does

- **H.264 encode** over VA-API: tightly-packed NV12 in, an Annex-B elementary
stream out (packed SPS/PPS + slice headers, low-latency IPPP, rate control).
- **H.264 decode** over VA-API: one Annex-B access unit in, tightly-packed NV12
out, with in-stream parameter sets, a conformant DPB (reference marking,
reordering, frame_num gaps), and mid-stream resolution changes. Progressive
8-bit 4:2:0 only, with right/bottom cropping supported and left/top cropping
rejected. Verified bit-exact against ffmpeg's software decoder on Intel
Meteor Lake (iHD 26.1.5) for constrained baseline, main with B-frames, high at
720p, and a cropped non-macroblock-aligned size. The main-with-B-frames case
runs as a test wherever ffmpeg and a VA-API device are both present.
- **Pinned, vendored headers.** libva's headers are vendored into
[`libva/`](./libva) (see `just vendor`) and fed to bindgen, so generating the
bindings needs **no system libva-dev** — only `libclang` — and the pinned
Expand All @@ -36,7 +46,7 @@ pulled in as a git dependency.

- `src/` — libva bindings (`bindings`, `display`, `surface`, `buffer`, ...), the
H.264 bitstream layer (`bitstream_utils`, `codec::h264`), and the thin encode
driver (`encode`).
and decode drivers (`encode`, `decode`).
- `libva/` — vendored libva headers (checked in; refreshed by `just vendor`).
- `build.rs` + `bindgen_gen.rs` + `libva-wrapper.h` — bindgen setup.

Expand Down
3 changes: 2 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ check:
cargo clippy --all-targets -- -D warnings
cargo fmt --all --check

# Full CI: check + dependency hygiene.
# Full CI: check, unit tests, and dependency hygiene.
ci:
just check
cargo test --lib
cargo deny check --show-stats

# Auto-fix clippy + formatting.
Expand Down
Loading