Skip to main content

Module bitstream

Module bitstream 

Source
Expand description

Bit-level output primitives shared by the native codecs.

BitWriter packs bits MSB-first into a byte buffer and knows the two variable-length codes the HEVC high-level syntax needs: unsigned/signed Exp-Golomb (ue(v) / se(v)). rbsp_trailing_bits and emulation_prevention turn a raw bit payload into the byte-stuffed form a NAL unit carries.

Pure core/alloc + std::Vec — no OS, threads, or time — so it builds and runs identically on native and wasm32.

Structs§

BitWriter
Packs bits MSB-first into a growable byte buffer.

Functions§

emulation_prevention
Insert emulation-prevention bytes, turning a raw byte-aligned RBSP into the EBSP a NAL unit carries (H.265 §7.3.1.1).
rbsp_trailing_bits
Append RBSP trailing bits: a single 1 stop bit followed by 0s to the next byte boundary (H.265 §7.3.2.11). Every RBSP ends with this.