This module parses the H.264/AVC syntax needed by Vulkan Video applications: NAL headers, sequence and picture parameter sets (SPS/PPS), video usability information (VUI), and slice headers.
It is not a video decoder: it does not perform entropy decoding, motion
compensation, inverse transforms, or produce pixels. The
v_vulkan_video player uses these
parsed structures to prepare hardware decode operations.
v install antono2.h264The parser is implemented entirely in V and has no native library or GPU
dependency. CI runs the complete test suite on Linux and on Windows Server 2022
with MSVC. Windows 10/11 x64 users can install and import the module with the
same v install command shown above.
import antono2.h264
mut stream := h264.Bitstream{}
stream.init([u8(0x67)]) // forbidden_zero_bit=0, nal_ref_idc=3, type=SPS
mut header := h264.NetworkAbstractionLayerHeader{}
header.read_nal_header(mut stream)
assert header.type == .sequence_parameter_setBitstream.init() expects raw RBSP/NAL bytes in memory. Container extraction,
length prefixes or Annex-B start codes, emulation-prevention removal, frame
reordering, and decoded-picture management remain the caller's responsibility.
The parser exposes low-level syntax structures rather than a defensive media API. Some invalid syntax is rejected with assertions, while truncated fields can read as zero at end of input. Validate untrusted container lengths and NAL boundaries before parsing them.
The implementation covers the syntax exercised by the Vulkan Video H.264 player and is not yet a claim of complete support for every profile, extension, bit depth, chroma format, or interlaced stream.
The included tests are software-only and require no GPU. Run them with the default compiler, or select MSVC on Windows:
v test .v -cc msvc test .They cover fixed-width and Exp-Golomb bit reading, truncated input behavior, NAL headers, RBSP look-ahead, integer bit widths, and representative High-profile SPS/PPS parsing used by the player.