/** Attribute group tag and its dimensionality, in coding order. */ export type CsgsGroup = readonly [tag: string, dims: number]; /** Quantization table and coding parameters shared by the sections of a stream. */ export interface CsgsParams { /** Frames per full section. */ readonly L: number; /** Allowed knot counts per curve, ascending. */ readonly ks: readonly number[]; readonly groups: readonly CsgsGroup[]; /** Static SH scalars per splat (45 for degree 3). */ readonly nSn: number; /** Dequantization offset per scalar: groups in order, then the SH scalars. */ readonly offsets: Float32Array; /** Dequantization step per scalar, same layout as {@link offsets}. */ readonly scales: Float32Array; /** Continuing splats reuse the previous section's last knot as knot 0 verbatim. */ readonly sharedKnot: boolean; readonly keyInterval: number; } /** One decoded section, integer-valued as coded. */ export interface CsgsSection { readonly index: number; /** First absolute frame of the section. */ readonly g0: number; readonly nframes: number; readonly key: boolean; /** Splats coded in this section: the continuing ones first, then the newborn. */ readonly n: number; readonly nCont: number; readonly ids: Uint32Array; /** Birth frame of each newborn splat, relative to `g0` (`n - nCont` entries). */ readonly birth: Uint16Array; /** Death code per splat: the relative frame it disappears, or `nframes + 1` when it continues. */ readonly death: Uint16Array; /** Knot count per splat, per group. */ readonly k: readonly Uint8Array[]; /** Start of each splat's knots in {@link knots}, per group (`n + 1` entries). */ readonly knotOff: readonly Uint32Array[]; /** Quantized knots per group, knot-major per splat (`K × dims` integers each). */ readonly knots: readonly Int32Array[]; /** Quantized SH scalars, `n × nSn` bytes. */ readonly sn: Uint8Array; } /** What a delta section needs from the section before it. */ export interface CsgsState { readonly ids: Uint32Array; /** Last knot of every continuing splat, per group. */ readonly last: readonly Int32Array[]; readonly sn: Uint8Array; /** Index into `ks` of each continuing splat's first-group knot count. */ readonly k0: Uint8Array; readonly nextIndex: number; } interface CsgsHeader { readonly key: boolean; readonly index: number; readonly g0: number; readonly nframes: number; readonly nCont: number; readonly nNew: number; readonly idBase: number; /** Prediction baseline of each SH scalar. */ readonly snPred: Uint8Array; } /** Zlib/PNG CRC-32 over `bytes[start, end)`. */ export declare function csgsCrc32(bytes: Uint8Array, start?: number, end?: number): number; /** * Parses a section header, validating it against the version-1 layout. * * @returns The stream params and header, the byte length of each rANS stream, * and the offset of the first stream. */ export declare function parseCsgsHeader(bytes: Uint8Array): { params: CsgsParams; header: CsgsHeader; streamLengths: number[]; streamsOffset: number; }; /** * Decodes one section. A delta section (`key` flag clear) needs the * {@link CsgsState} left by the section before it. * * @throws {Error} on a CRC mismatch, a malformed or unsupported header, a stream * table that does not match the section size, or a delta section whose state * does not match. */ export declare function decodeCsgsSection(bytes: Uint8Array, state: CsgsState | null): { params: CsgsParams; section: CsgsSection; }; /** The state a delta section after `section` continues from. */ export declare function csgsStateAfter(section: CsgsSection, params: CsgsParams): CsgsState; /** * Sequential `.csgs` decoder. Feed it sections in stream order; it may start * at any key section (random access), and refuses a delta section whose * predecessor it has not seen. */ export declare class CsgsDecoder { private state; private paramsValue; /** Params of the last decoded section, or null before the first. */ get params(): CsgsParams | null; decode(bytes: Uint8Array): CsgsSection; } export {};