CrImage::WEBP::BitWriter
Inherits Reference / Object
BitWriter provides low-level utility for writing variable-length bit sequences to a byte stream in little-endian order. It accumulates bits in a buffer and flushes complete bytes to the output.
This is used for writing VP8L bitstreams and Huffman-encoded data.
Constructors
Instance methods
Align to byte boundary by padding with zeros. Rounds up to next multiple of 8 bits.
Get the accumulated bytes as a Bytes slice Note: This does NOT align to byte boundary automatically Call align_byte explicitly if needed before calling this
Write n bits from value in little-endian order. n must be between 0 and 64. value must fit within n bits.
Write a byte array directly to the buffer. Each byte is written as 8 bits.
Write a Huffman code with bit reversal. WebP uses reversed Huffman codes, so we reverse the bits before writing.