import type { DepthPreviewLevels } from "supervision-js-core"; import { type DepthPreviewLumaPath, type DepthPreviewTrackReader, type DepthPreviewTrackInput } from "./depth-preview-track"; /** * How long one decoder may take to return the probe's first frame. The clip * is in memory, so this is decoder time alone; a decoder that works takes a * few milliseconds. */ export declare const PROBE_DECODE_MILLISECONDS = 5000; /** What a browser's decoder did to the codes a producer wrote. */ export interface DepthPreviewCodeProbe { /** Every judged code came back exactly as written. */ readonly exact: boolean; /** Codes judged: 256 at full levels, the 220 from 16 to 235 at TV levels. */ readonly judgedCodes: number; readonly mismatchedCodes: number; readonly maxError: number; /** The code read back for each written code, indexed by the written one. */ readonly decoded: Uint8Array; readonly lumaPath: DepthPreviewLumaPath | null; } export interface DepthPreviewDecoderVerdict { readonly hardwareAcceleration: HardwareAcceleration; readonly supported: boolean; readonly probe: DepthPreviewCodeProbe | null; readonly error?: string; } /** How this page decodes depth previews, chosen once by probing. */ export interface DepthPreviewDecoding { readonly hardwareAcceleration: HardwareAcceleration; /** * The probe through the chosen decoder, before any correction; null when * no decoder returned a frame of it, and a preview would not decode either. */ readonly probe: DepthPreviewCodeProbe | null; /** * Maps a code read back to the code written, when the chosen decoder * changes codes and the table brings them closer; null when it does not. */ readonly correction: Uint8Array | null; /** Largest error left after the correction, in codes. */ readonly residualError: number; readonly verdicts: readonly DepthPreviewDecoderVerdict[]; } type OpenTrack = (input: DepthPreviewTrackInput, options?: { readonly hardwareAcceleration?: HardwareAcceleration; }) => Promise; /** * Decodes a clip of known codes, written at the preview's levels, through * each decoder the page offers in the same path a depth preview takes, and * keeps the first that returns them as written, directly or through a * table that undoes a conversion it makes. Without one, it picks the * closest. Run once per page and level: the answer is a property of the * browser, not of any one preview. Probes run one after another, so the * page never holds two of their decoders. */ export declare function chooseDepthPreviewDecoding(levels?: DepthPreviewLevels, open?: OpenTrack, isSupported?: (preference: HardwareAcceleration) => Promise): Promise; export declare function depthPreviewProbeBytes(levels?: DepthPreviewLevels): Uint8Array; /** * For each code a decoder can return, the written code from `firstCode` to * `lastCode` it most likely came from: the one whose read-back value is * nearest, the nearest written code on a tie. */ export declare function createCodeCorrection(decoded: Uint8Array, firstCode?: number, lastCode?: number): Uint8Array; export {}; //# sourceMappingURL=depth-preview-probe.d.ts.map