import type { MotionOptions } from './types.js'; /** * Per-cell motion field (ALGORITHM.md §21). * * Integer throughout, like every other path here (§0), so a GPU implementation * can agree bit-for-bit instead of drifting. That rules out the float smoothstep * and sqrt the effect is usually written with; both are done in fixed point * below, and the integer square root is the adjusted kind so a shader's * imprecise `sqrt` lands on the same value. */ export interface MotionField { columns: number; rows: number; /** Per-cell 0..255: 0 still, 255 moving hard. Row-major, `columns · rows`. */ magnitude: Uint8Array; } /** * Retained state for a motion field: the previous frame's per-cell mean luma and * the decaying trail. Band-local, and the caller owns keeping it with the band * it describes — the same contract `BandReuse` carries. */ export interface MotionState { columns: number; rows: number; luma: Uint8Array; trail: Uint8Array; primed: boolean; } export declare function createMotionState(columns: number, rows: number): MotionState; /** * floor(sqrt(n)) for n ≥ 0, exact. * * `Math.sqrt` is correctly rounded and WGSL's is not, so neither can be floored * and trusted near a perfect square. The adjustment makes both exact from any * starting estimate that is close, which is what lets the two implementations * agree. */ export declare function isqrt(n: number): number; /** * Advance `state` by one frame of reduced samples and return the field. * * `reduced` is reduce-v1 output (§4) for this band: `columns · 8` by `rows · 8` * RGBA samples. Cells are read exactly as §5 reads them, so the motion field is * defined over the same mean luma the matcher already computes — it just is not * emitted there, and deriving it here keeps structural-v1 and its conformance * contract untouched. */ export declare function motionField(reduced: Uint8Array, columns: number, rows: number, state: MotionState, options?: MotionOptions): MotionField;