import { type DecimatedDepthUpload } from "./worker-protocol"; import { type RenderPreparationOptions } from "#types/render-preparation"; /** A decoded depth PNG: host-order samples, or bytes for a confidence plane. */ export interface DecodedDepthImage { readonly width: number; readonly height: number; readonly values: Values; /** Odd-width depth rows padded for WebGL, when asked for. */ readonly paddedUpload?: { readonly bytes: Uint8Array; readonly textureWidth: number; }; /** Depth decimated for upload, when `decimateBy` asked for it. */ readonly decimatedUpload?: DecimatedDepthUpload; } export interface DepthDecodeOptions { readonly padRowsForWebGl?: boolean; /** Also decimate depth by this whole factor for upload, from 2 up. */ readonly decimateBy?: number; /** Drops the result; the decode itself runs to the end in the worker. */ readonly signal?: AbortSignal; } export interface DepthFramePreparer { /** * Decodes worth running at once: one per worker in the pool, sized as the * mask workers are, or 1 on the main thread. */ readonly concurrency: number; /** Decodes a 16-bit depth PNG. The bytes are the preparer's from here on. */ decodeDepth(bytes: ArrayBuffer, options?: DepthDecodeOptions): Promise>; decodeConfidence(bytes: ArrayBuffer, options?: Pick): Promise>; destroy(): void; } /** * Decodes depth and confidence PNGs in a pool of render-preparation workers, * sized the way the mask pool is (`maskFrame.workerCount`, by default half * the cores up to 4), or on the main thread when the mode asks for it or * `Auto` finds no working worker. The first worker starts at once, so a * factory that throws fails `Worker` mode here; the others start only when * every running one is busy, so a still map never spawns a pool. * * Until a worker has answered once, `Auto` posts a copy of the bytes, so a * worker that fails to start (a CSP that blocks blob workers, say) leaves the * original to decode here. After that the bytes are transferred. Nothing ever * terminates a worker to cancel a decode: an aborted request's reply is * dropped when it arrives. */ export declare function createDepthFramePreparer(options: RenderPreparationOptions | undefined): DepthFramePreparer; /** Rejects when the signal aborts; the work itself carries on unobserved. */ export declare function abortable(work: Promise, signal: AbortSignal | undefined): Promise; //# sourceMappingURL=frame-preparer.d.ts.map