Skip to main content

Crate oxideav_bitstream

Crate oxideav_bitstream 

Source
Expand description

Minimal IDR / keyframe header parsing for H.264, HEVC and AV1.

This crate is the parser layer that the oxideav HW-accel bridge crates (oxideav-vaapi, oxideav-vdpau, oxideav-vulkan-video) call before submitting parameter buffers to the GPU. It is not a full codec: there is no DCT, no entropy decode, no inverse transform, no motion compensation. Just enough syntax parsing to populate VAPictureParameterBufferH264 / VdpPictureInfoH264 / VkVideoDecodeH264PictureInfoKHR and the equivalents for HEVC and AV1.

Each codec lives in its own module:

  • h264 — Annex-B framing, SPS, PPS and minimal slice header.
  • hevc — Annex-B framing, VPS, SPS, PPS and minimal slice segment header.
  • h266 — Annex-B framing, 2-byte NAL header decode, VCL / IRAP / parameter-set classifiers. Parameter-set parsing deferred to future rounds.
  • av1 — leb128 reader/writer, OBU walker + emitter, sequence header and key-frame OBU parsing.

There is no shared cross-codec abstraction in v0 — each module exposes its own parse_* entry points and result structs. The shared bit_reader::BitReader type provides u(n), ue(v) and se(v) primitives; bit_writer::BitWriter is its MSB-first inverse for emitting the same fields back out.

§No unsafe

This crate contains zero unsafe blocks. Bit reading is software, no FFI involved.

§Workspace clean-room policy

Bitstream syntax is taken from the relevant ITU-T / Khronos / AOMedia spec PDFs only. We deliberately do not consult ffmpeg / libavcodec, x264, x265, libde265, libaom, dav1d, rav1e or libgav1 source. ffmpeg / aomenc are used only as black-box CLI tools to generate test fixtures.

Modules§

av1
AV1 minimal keyframe header parsing.
bit_reader
Shared MSB-first bit reader with u(n) / ue(v) / se(v) primitives. These are the basic building blocks every codec module needs.
bit_writer
Shared MSB-first bit writer — the inverse of [BitReader].
h264
H.264 / AVC minimal IDR header parsing.
h266
H.266 / VVC minimal NAL-walker layer.
hevc
HEVC / H.265 minimal IDR header parsing.
ivf
Tiny IVF demuxer shared by the VP8 and VP9 modules.
mpeg2
MPEG-2 / H.262 sequence-header, picture-header and extension parser.
vc1
VC-1 (SMPTE 421M) sequence-header / entry-point / picture-header parser. Advanced profile (Annex G start codes) is the primary target — that is what VdpPictureInfoVC1 and VAPictureParameterBufferVC1 consume in any modern HW pipeline.
vp8
VP8 keyframe header parsing (RFC 6386).
vp9
VP9 uncompressed-header parser.

Enums§

BitstreamError
Errors produced by the parsers in this crate.