/** * Bit-level I/O for VP8L bitstreams. * * Both reader and writer pack bits LSB-first inside each byte, matching the * VP8L specification. Internally they keep a 32-bit accumulator so most bit * operations are simple shifts and masks — the per-bit shift+push pattern * the previous implementation used was easy to read but ~10× slower on * realistic-sized images. */ /** * Streaming bit-level reader. The accumulator pulls bytes lazily, so reading * past the end produces zeros (rather than throwing) — which matches what * libwebp does and keeps decoders robust against bitstreams that are * implicitly zero-padded at the end. */ export declare class BitReader { constructor(data: Uint8Array); peek(n: number): number; consume(n: number): void; readBit(): number; readBits(n: number): number; alignToByte(): void; getBitPosition(): number; getBytePosition(): number; hasMore(): boolean; } /** * Streaming bit-level writer with auto-growing buffer. Like the reader, it * keeps a 32-bit accumulator and only commits whole bytes — a `writeBits(x, * 8)` is one mask + one assignment, not eight push() calls. */ export declare class BitWriter { constructor(initialCapacity?: number); writeBit(bit: number): void; writeBits(value: number, n: number): void; alignToByte(): void; getBuffer(): Uint8Array; byteLength(): number; }