import type { MatchOptions, RawImage } from './types.js'; import { AsciiFrame } from './frame.js'; import { blankGlyphId } from './blankGlyph.js'; export declare const ALGORITHM_VERSION = "structural-v1"; export { blankGlyphId }; /** The per-cell outputs of a structural match, without the profile a frame carries. */ export interface StructuralCells { glyphIds: Uint16Array; foreground?: Uint32Array; background?: Uint32Array; flags: Uint16Array; } /** * The previous match of the same band, for exact temporal reuse (spec §21). * * A cell's result is a pure function of its 64 source samples and the options, * so a cell whose samples are byte-identical to last time already has its answer * — comparing 256 bytes is far cheaper than a prefilter over the charset plus a * rerank. The caller owns the "identical options" half of that precondition: * pass `reuse` only when `options`, `columns`, and `bandRows` all match the * match these cells came from. Nothing here can detect an option change, and * reusing across one silently serves stale cells. */ export interface BandReuse { /** The reduced samples those cells were matched from; same layout as `reduced`. */ reduced: Uint8Array; /** That match's band-local outputs. */ cells: StructuralCells; } /** * structural-v1 reference matcher (ALGORITHM.md §§3–11). Deterministic and * all-integer; this implementation defines correctness for every backend. * * Structural only. The approximate matchers (§18–19) and chromatic-v1 are their * own functions — `matchFrameShape6`, `matchFrameRamp`, `matchFrameChromatic` — * so a bundle that never calls them never contains them, and opting into one is * an import rather than a flag. */ export declare function matchFrame(source: RawImage, options: MatchOptions): AsciiFrame; /** * structural-v1 over a band of `bandRows` cell rows, given that band's reduced * samples. Both the input and the outputs are band-local, and no step reads * outside the band — every cell in ALGORITHM.md §§5–10 is independent — so * concatenating bands reproduces `matchFrame` byte for byte. This is the one * implementation of the exact matcher; `matchFrame` is a whole-frame band. */ export declare function matchBand(reduced: Uint8Array, columns: number, bandRows: number, options: MatchOptions, reuse?: BandReuse): StructuralCells;