/** * rANS entropy decoder with adaptive frequency models, the entropy stage of * the Faltwerk `.csgs` container (`docs/format-csgs.md` ยง3 in that * repository). Ported from Faltwerk's TypeScript decoder (MIT, see * `THIRD_PARTY_NOTICES.md`); the arithmetic must stay bit-exact with the * Python reference encoder, so every step mirrors it. * * The decoder state `x` is kept in `[2^23, 2^31)`, which makes every * operation exact in a JS double and lets the hot path stay in int32 ops. */ /** Alphabet size of the universal integer models (16 literals + 33 escapes). */ export declare const CSGS_RANS_TOKENS: number; /** * An adaptive frequency model over `n` symbols. Counts start at one, grow by * `inc` per coded symbol, halve past a limit, and are folded into a * cumulative table on a doubling rebuild schedule. */ export declare class CsgsAdaptiveModel { readonly n: number; readonly counts: Uint32Array; readonly cdf: Uint32Array; /** First symbol whose interval reaches into each slot bucket. */ readonly lut: Uint16Array; private total; private interval; private until; private readonly inc; constructor(n: number, inc?: number); private rebuild; /** Accounts one decoded symbol. */ update(symbol: number): void; } /** Range decoder over one byte range of a section. */ export declare class CsgsRansDecoder { private readonly buffer; private position; private readonly end; private x; constructor(buffer: Uint8Array, position?: number, end?: number); private renormalize; /** Decodes one symbol of `model` and adapts it. */ get(model: CsgsAdaptiveModel): number; /** Reads `count` raw bits, most significant chunk first. */ getBits(count: number): number; /** Decodes an unsigned integer: a literal below 16, else an escape plus raw bits. */ getUint(model: CsgsAdaptiveModel): number; /** Decodes a zigzag-coded signed integer. */ getSint(model: CsgsAdaptiveModel): number; /** True once the stream is consumed exactly: no bytes left and the state back at its floor. */ get consumed(): boolean; }