supervision 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/depth-preview-probe-DG7McQEN.js +314 -0
- package/dist/depth-preview-probe-DG7McQEN.js.map +1 -0
- package/dist/depth-preview-track-BvgwNEE9.js +612 -0
- package/dist/depth-preview-track-BvgwNEE9.js.map +1 -0
- package/dist/detections/chunked-detection-frame-source.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9504 -4719
- package/dist/index.js.map +1 -1
- package/dist/mask-preparation.worker.js +658 -21
- package/dist/mask-preparation.worker.js.map +1 -1
- package/dist/media/decoder-deadline.d.ts +18 -0
- package/dist/media/decoder-deadline.d.ts.map +1 -0
- package/dist/media/depth-preview-probe.d.ts +65 -0
- package/dist/media/depth-preview-probe.d.ts.map +1 -0
- package/dist/media/depth-preview-track.d.ts +96 -0
- package/dist/media/depth-preview-track.d.ts.map +1 -0
- package/dist/media/media-normalization.d.ts.map +1 -1
- package/dist/media/media-source.d.ts +7 -0
- package/dist/media/media-source.d.ts.map +1 -1
- package/dist/media/mediabunny-frame-clock.d.ts +7 -0
- package/dist/media/mediabunny-frame-clock.d.ts.map +1 -0
- package/dist/media/mediabunny-media-source.d.ts +3 -0
- package/dist/media/mediabunny-media-source.d.ts.map +1 -1
- package/dist/media/track-frame-index.d.ts +14 -0
- package/dist/media/track-frame-index.d.ts.map +1 -0
- package/dist/media/video-engine-media-source.d.ts.map +1 -1
- package/dist/media/video-engine-media-source.js +1 -1
- package/dist/render-preparation/depth/clip-preview.d.ts +41 -0
- package/dist/render-preparation/depth/clip-preview.d.ts.map +1 -0
- package/dist/render-preparation/depth/clip-timing.d.ts +18 -0
- package/dist/render-preparation/depth/clip-timing.d.ts.map +1 -0
- package/dist/render-preparation/depth/clip.d.ts +14 -0
- package/dist/render-preparation/depth/clip.d.ts.map +1 -0
- package/dist/render-preparation/depth/exact-at-rest.d.ts +44 -0
- package/dist/render-preparation/depth/exact-at-rest.d.ts.map +1 -0
- package/dist/render-preparation/depth/exact-playback.d.ts +40 -0
- package/dist/render-preparation/depth/exact-playback.d.ts.map +1 -0
- package/dist/render-preparation/depth/files.d.ts +55 -0
- package/dist/render-preparation/depth/files.d.ts.map +1 -0
- package/dist/render-preparation/depth/frame-decode.d.ts +20 -0
- package/dist/render-preparation/depth/frame-decode.d.ts.map +1 -0
- package/dist/render-preparation/depth/frame-preparer.d.ts +51 -0
- package/dist/render-preparation/depth/frame-preparer.d.ts.map +1 -0
- package/dist/render-preparation/depth/frame-window.d.ts +146 -0
- package/dist/render-preparation/depth/frame-window.d.ts.map +1 -0
- package/dist/render-preparation/depth/options.d.ts +37 -0
- package/dist/render-preparation/depth/options.d.ts.map +1 -0
- package/dist/render-preparation/depth/png16.d.ts +40 -0
- package/dist/render-preparation/depth/png16.d.ts.map +1 -0
- package/dist/render-preparation/depth/preview-luma-copier.d.ts +12 -0
- package/dist/render-preparation/depth/preview-luma-copier.d.ts.map +1 -0
- package/dist/render-preparation/depth/preview-luma.d.ts +48 -0
- package/dist/render-preparation/depth/preview-luma.d.ts.map +1 -0
- package/dist/render-preparation/depth/source.d.ts +123 -0
- package/dist/render-preparation/depth/source.d.ts.map +1 -0
- package/dist/render-preparation/depth/worker-protocol.d.ts +76 -0
- package/dist/render-preparation/depth/worker-protocol.d.ts.map +1 -0
- package/dist/render-preparation/playhead-motion.d.ts +67 -0
- package/dist/render-preparation/playhead-motion.d.ts.map +1 -0
- package/dist/render-preparation/prepared-render-window.d.ts +12 -0
- package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
- package/dist/renderers/depth-textures.d.ts +79 -0
- package/dist/renderers/depth-textures.d.ts.map +1 -0
- package/dist/renderers/id-mask-stroke-coverage.d.ts +3 -0
- package/dist/renderers/id-mask-stroke-coverage.d.ts.map +1 -0
- package/dist/renderers/media-renderer-core.d.ts.map +1 -1
- package/dist/renderers/media-renderer-scene.d.ts +14 -1
- package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
- package/dist/renderers/pixi-batch-texture-bindings.d.ts +9 -0
- package/dist/renderers/pixi-batch-texture-bindings.d.ts.map +1 -0
- package/dist/renderers/pixi-depth-layer.d.ts +76 -0
- package/dist/renderers/pixi-depth-layer.d.ts.map +1 -0
- package/dist/renderers/pixi-depth-shader.d.ts +76 -0
- package/dist/renderers/pixi-depth-shader.d.ts.map +1 -0
- package/dist/renderers/pixi-focus-layer.d.ts +1 -0
- package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-frame-present.d.ts +1 -0
- package/dist/renderers/pixi-frame-present.d.ts.map +1 -1
- package/dist/renderers/pixi-id-mask-shader.d.ts +1 -0
- package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
- package/dist/renderers/pixi-interaction-layer.d.ts +1 -1
- package/dist/renderers/pixi-interaction-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-interaction-presentation-layer.d.ts +1 -0
- package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-mask-halo.d.ts +1 -0
- package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
- package/dist/renderers/pixi-mask-layer.d.ts +4 -0
- package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
- package/dist/renderers/pixi-region-coverage-mask.d.ts +1 -0
- package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -1
- package/dist/renderers/pixi-region-layer.d.ts +1 -0
- package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-scene-layer-slot.d.ts +1 -0
- package/dist/renderers/pixi-scene-layer-slot.d.ts.map +1 -1
- package/dist/renderers/prepared-annotation-window.d.ts +1 -0
- package/dist/renderers/prepared-annotation-window.d.ts.map +1 -1
- package/dist/renderers/render-preparation-report.d.ts +23 -0
- package/dist/renderers/render-preparation-report.d.ts.map +1 -0
- package/dist/sessions/media-session-defaults.d.ts.map +1 -1
- package/dist/sessions/media-session-state.d.ts.map +1 -1
- package/dist/sessions/media-session.d.ts.map +1 -1
- package/dist/tracking.worker.js +64 -0
- package/dist/tracking.worker.js.map +1 -1
- package/dist/types/media-depth.d.ts +55 -0
- package/dist/types/media-depth.d.ts.map +1 -0
- package/dist/types/media-renderer.d.ts +19 -0
- package/dist/types/media-renderer.d.ts.map +1 -1
- package/dist/types/media-session.d.ts +19 -0
- package/dist/types/media-session.d.ts.map +1 -1
- package/dist/types/render-preparation.d.ts +105 -3
- package/dist/types/render-preparation.d.ts.map +1 -1
- package/dist/{video-engine-media-source-DR-x1UfK.js → video-engine-media-source-DOFsuGS4.js} +35 -29
- package/dist/video-engine-media-source-DOFsuGS4.js.map +1 -0
- package/dist/web-video-engine/analysis.js +6 -43
- package/dist/web-video-engine/cache-budget.d.ts +4 -7
- package/dist/web-video-engine/constants.d.ts +3 -4
- package/dist/web-video-engine/create-scrub-cursor.d.ts +1 -0
- package/dist/web-video-engine/decode-resolution-fynpRIAG.js +109 -0
- package/dist/web-video-engine/decode-scheduler.d.ts +1 -0
- package/dist/web-video-engine/engine-core.d.ts +4 -2
- package/dist/web-video-engine/engine.js +8 -6
- package/dist/web-video-engine/engine.worker.js +164 -66
- package/dist/web-video-engine/frame-cache.d.ts +9 -0
- package/dist/web-video-engine/frame-index.d.ts +1 -0
- package/dist/web-video-engine/frame-index.js +97 -0
- package/dist/web-video-engine/{frame-timeline-DreEwsRY.js → frame-timeline-CYgzzmpA.js} +1 -109
- package/dist/web-video-engine/frame-timeline-reader.d.ts +21 -0
- package/dist/web-video-engine/video-engine.d.ts +9 -4
- package/node_modules/supervision-js-core/THIRD_PARTY_NOTICES.md +132 -0
- package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.d.ts +7 -2
- package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.js +1128 -59
- package/node_modules/supervision-js-core/dist/index.js.map +1 -1
- package/node_modules/supervision-js-core/dist/interactions/annotation-editing-engine.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/interactions/annotation-handles.d.ts +2 -2
- package/node_modules/supervision-js-core/dist/interactions/annotation-handles.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/styles/annotation-renderer-presentation.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/styles/annotation-renderer-registry.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts +50 -3
- package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/depth-map.d.ts +203 -0
- package/node_modules/supervision-js-core/dist/types/depth-map.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/types/editing.d.ts +2 -0
- package/node_modules/supervision-js-core/dist/types/editing.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +3 -0
- package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/depth-color-mapping.d.ts +91 -0
- package/node_modules/supervision-js-core/dist/utils/depth-color-mapping.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/depth-colormap-tables.d.ts +30 -0
- package/node_modules/supervision-js-core/dist/utils/depth-colormap-tables.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/depth-colormaps.d.ts +16 -0
- package/node_modules/supervision-js-core/dist/utils/depth-colormaps.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/depth-manifest.d.ts +23 -0
- package/node_modules/supervision-js-core/dist/utils/depth-manifest.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/depth-readout.d.ts +14 -0
- package/node_modules/supervision-js-core/dist/utils/depth-readout.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts +21 -0
- package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +3 -7
- package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
- package/node_modules/supervision-js-core/package.json +2 -1
- package/package.json +6 -1
- package/dist/video-engine-media-source-DR-x1UfK.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-preparer.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/frame-preparer.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAC;AAMnC,gFAAgF;AAChF,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,WAAW,GAAG,UAAU;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;QAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,kEAAkE;IAClE,QAAQ,CAAC,eAAe,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,6EAA6E;IAC7E,WAAW,CACT,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3C,gBAAgB,CACd,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,GAC3C,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,GAAG,SAAS,GAC5C,kBAAkB,CA4LpB;AAWD,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,MAAM,EAAE,WAAW,GAAG,SAAS,cAuBhC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { DepthMap } from "supervision-js-core";
|
|
2
|
+
import type { DepthPreviewDecodeOptions, DepthPreviewDecodeRun, DepthPreviewLumaFrame } from "#media/depth-preview-track";
|
|
3
|
+
import { type RenderPreparationArtifactDiagnostics, type ResolvedRenderPreparationGateThresholds } from "#types/render-preparation";
|
|
4
|
+
/** One pass over a frame source, from where it was started forward. */
|
|
5
|
+
export interface DepthFrameRun<Frame> {
|
|
6
|
+
/** The next frame, or null once the source has ended or the run was cancelled. */
|
|
7
|
+
next(): Promise<Frame | null>;
|
|
8
|
+
cancel(): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A video track decodes from a key frame forward; a source with
|
|
12
|
+
* `randomAccess` starts a run at any frame and skips the frames `keep`
|
|
13
|
+
* turns away at no cost, so one run serves every frame ahead of it.
|
|
14
|
+
*/
|
|
15
|
+
export interface DepthFrameSource<Frame extends {
|
|
16
|
+
readonly index: number;
|
|
17
|
+
} = DepthPreviewLumaFrame> {
|
|
18
|
+
readonly frameCount: number;
|
|
19
|
+
readonly randomAccess?: boolean;
|
|
20
|
+
keyIndexAtOrBefore(index: number): number;
|
|
21
|
+
decode(fromIndex: number, options: DepthPreviewDecodeOptions): DepthFrameRun<Frame> | DepthPreviewDecodeRun;
|
|
22
|
+
}
|
|
23
|
+
export interface DepthWindowEntry {
|
|
24
|
+
readonly index: number;
|
|
25
|
+
readonly map: DepthMap;
|
|
26
|
+
readonly bytes: number;
|
|
27
|
+
}
|
|
28
|
+
export interface DepthFrameWindowOptions<Frame extends {
|
|
29
|
+
readonly index: number;
|
|
30
|
+
} = DepthPreviewLumaFrame> {
|
|
31
|
+
readonly frames: DepthFrameSource<Frame>;
|
|
32
|
+
/** Start of frame `index` on the media timeline, in seconds. */
|
|
33
|
+
readonly timeAt: (index: number) => number;
|
|
34
|
+
/** End of frame `index` on the media timeline, in seconds. */
|
|
35
|
+
readonly endAt: (index: number) => number;
|
|
36
|
+
readonly createMap: (frame: Frame) => DepthMap;
|
|
37
|
+
/**
|
|
38
|
+
* Bytes one decoded frame is expected to hold; sets how many frames fit in
|
|
39
|
+
* `maxBytes`.
|
|
40
|
+
*/
|
|
41
|
+
readonly frameBytes: number;
|
|
42
|
+
/**
|
|
43
|
+
* For frames that differ in size. Defaults to the frame's `luma` length,
|
|
44
|
+
* then `frameBytes`.
|
|
45
|
+
*/
|
|
46
|
+
readonly bytesOf?: (frame: Frame) => number;
|
|
47
|
+
/** Names the frames in errors and warnings. Defaults to "preview". */
|
|
48
|
+
readonly precision?: "exact" | "preview";
|
|
49
|
+
/** What playback draws once the window stops, for its stop message. */
|
|
50
|
+
readonly stillDrawn: () => string;
|
|
51
|
+
/** Budget for decoded frames, in bytes. */
|
|
52
|
+
readonly maxBytes: number;
|
|
53
|
+
/**
|
|
54
|
+
* How far ahead of the playhead to decode while playing, in seconds of
|
|
55
|
+
* media; a drag spends the same span both ways.
|
|
56
|
+
*/
|
|
57
|
+
readonly prefetchSeconds: number;
|
|
58
|
+
/** How much behind the playhead to keep, in seconds of media. */
|
|
59
|
+
readonly retainSeconds: number;
|
|
60
|
+
/**
|
|
61
|
+
* Frames a resting playhead keeps decoded ahead, its own included, so a
|
|
62
|
+
* step forward lands on a decoded frame.
|
|
63
|
+
*/
|
|
64
|
+
readonly pausedFrameCount: number;
|
|
65
|
+
readonly loop?: boolean;
|
|
66
|
+
/** A frame was decoded and kept. */
|
|
67
|
+
readonly onFrame?: (index: number) => void;
|
|
68
|
+
/** What the window holds or waits for changed. */
|
|
69
|
+
readonly onChange?: () => void;
|
|
70
|
+
}
|
|
71
|
+
export interface DepthFrameWindow {
|
|
72
|
+
getEntry(index: number): DepthWindowEntry | null;
|
|
73
|
+
/**
|
|
74
|
+
* The playhead moved to `index`: decoding follows it, and its moves give
|
|
75
|
+
* the heading and, while playing, how many frames each present moves.
|
|
76
|
+
*/
|
|
77
|
+
setPlayhead(index: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Whether playback runs or a drag moves the playhead. A resting playhead
|
|
80
|
+
* keeps only a small margin decoded ahead of it.
|
|
81
|
+
*/
|
|
82
|
+
setPlaybackActive(active: boolean): void;
|
|
83
|
+
/**
|
|
84
|
+
* Whether a drag holds the playhead. A slow drag forward moves it the way
|
|
85
|
+
* playback does; this is what tells the two apart.
|
|
86
|
+
*/
|
|
87
|
+
setScrubbing(scrubbing: boolean): void;
|
|
88
|
+
setLoop(loop: boolean): void;
|
|
89
|
+
/** A hidden page decodes nothing and starts no run until it is shown. */
|
|
90
|
+
setHidden(hidden: boolean): void;
|
|
91
|
+
/** Which way the playhead travels: 1, -1, or 0 without enough to say. */
|
|
92
|
+
heading(): -1 | 0 | 1;
|
|
93
|
+
/**
|
|
94
|
+
* Seconds of decoded frames from the start of `index` onward that the
|
|
95
|
+
* next presents land on, without a gap; Infinity once that run reaches
|
|
96
|
+
* the last frame of a clip that does not loop.
|
|
97
|
+
*/
|
|
98
|
+
leadSeconds(index: number): number;
|
|
99
|
+
needsPlaybackGateWait(index: number, thresholds: ResolvedRenderPreparationGateThresholds): boolean;
|
|
100
|
+
waitForReady(index: number, thresholds: ResolvedRenderPreparationGateThresholds, signal?: AbortSignal): Promise<void>;
|
|
101
|
+
/** Frames decoded and kept, counted up across the window's life. */
|
|
102
|
+
getPreparationProgress(): number;
|
|
103
|
+
/**
|
|
104
|
+
* Decoded entries for `count` frames in a row from `skip` frames after
|
|
105
|
+
* `index`, nearest first, stopping at the first one not decoded.
|
|
106
|
+
*/
|
|
107
|
+
upcoming(index: number, count: number, skip?: number): DepthWindowEntry[];
|
|
108
|
+
getDiagnostics(): RenderPreparationArtifactDiagnostics;
|
|
109
|
+
/**
|
|
110
|
+
* The most lead the window decodes ahead of `index` while playing, in
|
|
111
|
+
* seconds of media; Infinity where that reaches the end of a clip that
|
|
112
|
+
* does not loop.
|
|
113
|
+
*/
|
|
114
|
+
wantedLeadSeconds(index: number): number;
|
|
115
|
+
/** The decoder failed; the window stops waiting and decoding. */
|
|
116
|
+
readonly failure: unknown;
|
|
117
|
+
/** Why the window stopped and what playback draws now, or null. */
|
|
118
|
+
readonly stopMessage: string | null;
|
|
119
|
+
destroy(): void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Decoded depth frames around the playhead, by frame index.
|
|
123
|
+
*
|
|
124
|
+
* One decode run is active at a time; it starts at the frame it is for, or
|
|
125
|
+
* at the key frame before it on a source without random access. What the
|
|
126
|
+
* window wants decoded follows how the playhead moves:
|
|
127
|
+
*
|
|
128
|
+
* - Playing, it leads the playhead by `prefetchSeconds` times how many frames
|
|
129
|
+
* presents move, wrapping at the last frame when the clip loops. Once every
|
|
130
|
+
* recent present has moved the same number of frames, it keeps only the
|
|
131
|
+
* frames presents land on.
|
|
132
|
+
* - Dragged, it spends `prefetchSeconds` both ways, most of it the way the
|
|
133
|
+
* playhead heads. Dragged backwards, a run from a key frame keeps every
|
|
134
|
+
* frame up to the playhead, so the frames the hand reaches next are there.
|
|
135
|
+
* - Resting, it keeps a small margin ahead; stepping backwards fills behind.
|
|
136
|
+
*
|
|
137
|
+
* A frame the playback gate waits on is decoded before anything else. When
|
|
138
|
+
* the budget is short, frames the window no longer wants go first, then the
|
|
139
|
+
* ones farthest the other way from where the playhead heads. The frame at the
|
|
140
|
+
* playhead and the ones the gate waits on or just let through stay, over the
|
|
141
|
+
* budget if they must.
|
|
142
|
+
*/
|
|
143
|
+
export declare function createDepthFrameWindow<Frame extends {
|
|
144
|
+
readonly index: number;
|
|
145
|
+
} = DepthPreviewLumaFrame>(options: DepthFrameWindowOptions<Frame>): DepthFrameWindow;
|
|
146
|
+
//# sourceMappingURL=frame-window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-window.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/frame-window.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIL,KAAK,oCAAoC,EAEzC,KAAK,uCAAuC,EAC7C,MAAM,2BAA2B,CAAC;AA0BnC,uEAAuE;AACvE,MAAM,WAAW,aAAa,CAAC,KAAK;IAClC,kFAAkF;IAClF,IAAI,IAAI,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC9B,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAC/B,KAAK,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB;IAEhE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,yBAAyB,GACjC,aAA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QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC;CACjB;AA4BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,EAChE,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CA0wB3D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DepthPlaybackSource, RenderPreparationDepthOptions } from "#types/render-preparation";
|
|
2
|
+
export interface DepthClipOptions {
|
|
3
|
+
/** Exact frames loaded around the frame at rest. */
|
|
4
|
+
readonly exact: {
|
|
5
|
+
readonly settleSeconds: number;
|
|
6
|
+
readonly neighborFrameCount: number;
|
|
7
|
+
/** The frame on screen is always kept, whatever this says. */
|
|
8
|
+
readonly maxCacheBytes: number;
|
|
9
|
+
};
|
|
10
|
+
readonly playback: {
|
|
11
|
+
readonly source: DepthPlaybackSource;
|
|
12
|
+
readonly maxExactCacheBytes: number;
|
|
13
|
+
};
|
|
14
|
+
/** What the preview window, and the exact playback window, decode ahead. */
|
|
15
|
+
readonly preview: {
|
|
16
|
+
readonly maxCacheBytes: number;
|
|
17
|
+
/** Frames a resting playhead keeps decoded ahead, its own included. */
|
|
18
|
+
readonly pausedFrameCount: number;
|
|
19
|
+
readonly prefetchSeconds: number;
|
|
20
|
+
readonly retainSeconds: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The clip's budgets and timing. Byte budgets that are not given scale with
|
|
25
|
+
* the clip's resolution, so a 4K clip keeps about as many seconds as a 720p
|
|
26
|
+
* one.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveDepthClipOptions(clip: {
|
|
29
|
+
/** Its confidence plane included. */
|
|
30
|
+
readonly exactFrameBytes: number;
|
|
31
|
+
/** 0 without a preview. */
|
|
32
|
+
readonly previewFrameBytes: number;
|
|
33
|
+
readonly frameRate: number;
|
|
34
|
+
}, options?: RenderPreparationDepthOptions, shared?: {
|
|
35
|
+
readonly scheduleBatchSize?: number;
|
|
36
|
+
}): DepthClipOptions;
|
|
37
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AAkBnC,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,8DAA8D;QAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;QACrC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;KACrC,CAAC;IACF,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,uEAAuE;QACvE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE;IACJ,qCAAqC;IACrC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,2BAA2B;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,EACD,OAAO,GAAE,6BAAkC,EAC3C,MAAM,GAAE;IAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,gBAAgB,CAsDlB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** A decoded 16-bit grayscale PNG, samples in host byte order. */
|
|
2
|
+
export interface DecodedPng16 {
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
readonly values: Uint16Array<ArrayBuffer>;
|
|
6
|
+
/**
|
|
7
|
+
* The samples as `rg8` texture bytes with every row padded to a multiple of
|
|
8
|
+
* four bytes, present only when padding was asked for and the width is odd.
|
|
9
|
+
*/
|
|
10
|
+
readonly paddedUpload?: {
|
|
11
|
+
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
12
|
+
readonly textureWidth: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface DecodedPng8 {
|
|
16
|
+
readonly width: number;
|
|
17
|
+
readonly height: number;
|
|
18
|
+
readonly values: Uint8Array<ArrayBuffer>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Inflates a zlib stream split over `chunks` into exactly `byteLength` bytes.
|
|
22
|
+
* A PNG's IDAT chunks, joined, are one zlib stream.
|
|
23
|
+
*/
|
|
24
|
+
export type PngInflate = (chunks: readonly Uint8Array[], byteLength: number) => Promise<Uint8Array>;
|
|
25
|
+
export interface DecodePng16Options {
|
|
26
|
+
readonly inflate?: PngInflate;
|
|
27
|
+
/** Also return WebGL-aligned upload bytes when the width is odd. */
|
|
28
|
+
readonly padRowsForWebGl?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function decodePng16(bytes: ArrayBuffer | Uint8Array, options?: DecodePng16Options): Promise<DecodedPng16>;
|
|
31
|
+
export declare function decodePng8Gray(bytes: ArrayBuffer | Uint8Array, options?: {
|
|
32
|
+
readonly inflate?: PngInflate;
|
|
33
|
+
}): Promise<DecodedPng8>;
|
|
34
|
+
/**
|
|
35
|
+
* Inflates with the platform's `DecompressionStream("deflate")` (zlib
|
|
36
|
+
* framing, which is what PNG uses) straight into one buffer of the expected
|
|
37
|
+
* size, so no second copy joins the output chunks.
|
|
38
|
+
*/
|
|
39
|
+
export declare function inflateWithDecompressionStream(chunks: readonly Uint8Array[], byteLength: number): Promise<Uint8Array>;
|
|
40
|
+
//# sourceMappingURL=png16.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png16.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/png16.ts"],"names":[],"mappings":"AAYA,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAOD,wBAAsB,WAAW,CAC/B,KAAK,EAAE,WAAW,GAAG,UAAU,EAC/B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,YAAY,CAAC,CAqBvB;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,WAAW,GAAG,UAAU,EAC/B,OAAO,GAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAA;CAAO,GAC9C,OAAO,CAAC,WAAW,CAAC,CAatB;AAED;;;;GAIG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,CAAC,CAuCrB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DepthPreviewLumaCopier } from "./preview-luma";
|
|
2
|
+
import { type RenderPreparationOptions } from "#types/render-preparation";
|
|
3
|
+
export type { DepthPreviewLumaCopier };
|
|
4
|
+
/**
|
|
5
|
+
* Hands each frame to a render-preparation worker of its own, which copies
|
|
6
|
+
* its luma and closes it; the page only posts the frame and takes the bytes
|
|
7
|
+
* back. A browser that cannot send a frame to a worker, or a worker that
|
|
8
|
+
* fails, leaves this and every later frame to the page, unless the mode
|
|
9
|
+
* requires the worker.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createDepthPreviewLumaCopier(options: RenderPreparationOptions | undefined): DepthPreviewLumaCopier;
|
|
12
|
+
//# sourceMappingURL=preview-luma-copier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-luma-copier.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/preview-luma-copier.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAC;AAMnC,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,wBAAwB,GAAG,SAAS,GAC5C,sBAAsB,CA+FxB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** How the decoded pixels reached the luma codes. */
|
|
2
|
+
export type DepthPreviewLumaPath =
|
|
3
|
+
/** The decoder's own luma plane: the codes exactly as decoded. */
|
|
4
|
+
"plane"
|
|
5
|
+
/**
|
|
6
|
+
* The browser converted the frame to RGB first, and the green channel
|
|
7
|
+
* stands in for luma. A range or matrix conversion can move codes.
|
|
8
|
+
*/
|
|
9
|
+
| "rgb";
|
|
10
|
+
/** One decoded preview frame's luma, one byte per map pixel. */
|
|
11
|
+
export interface DepthPreviewLuma {
|
|
12
|
+
readonly luma: Uint8Array;
|
|
13
|
+
readonly width: number;
|
|
14
|
+
readonly height: number;
|
|
15
|
+
readonly path: DepthPreviewLumaPath;
|
|
16
|
+
}
|
|
17
|
+
/** A buffer reused from one copy to the next, grown as needed. */
|
|
18
|
+
export interface DepthPreviewLumaScratch {
|
|
19
|
+
buffer: ArrayBuffer;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Copies a decoded preview frame's luma codes out of it, mapped through
|
|
23
|
+
* `correction` when one is given. The frame stays open; its owner closes
|
|
24
|
+
* it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readVideoFrameLuma(frame: VideoFrame, scratch: DepthPreviewLumaScratch, correction?: Uint8Array | null): Promise<DepthPreviewLuma>;
|
|
27
|
+
/** Copies decoded preview frames' luma out, wherever that costs least. */
|
|
28
|
+
export interface DepthPreviewLumaCopier {
|
|
29
|
+
/**
|
|
30
|
+
* Takes the frame and closes it once its luma is out; the promise answers
|
|
31
|
+
* null when the frame was lost on the way, handed to a worker that then
|
|
32
|
+
* failed. Answers null itself, synchronously and leaving the frame
|
|
33
|
+
* untouched, when it cannot take the frame: the page copies it instead.
|
|
34
|
+
*/
|
|
35
|
+
copy(frame: VideoFrame, correction: Uint8Array | null): Promise<DepthPreviewLuma | null> | null;
|
|
36
|
+
readonly offMainThread: boolean;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
39
|
+
/** A copier that never declines: the page always takes the frame. */
|
|
40
|
+
export interface MainThreadLumaCopier extends DepthPreviewLumaCopier {
|
|
41
|
+
copy(frame: VideoFrame, correction: Uint8Array | null): Promise<DepthPreviewLuma>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Copies on the page, one frame at a time through one scratch buffer. Each
|
|
45
|
+
* copy reports the main-thread time it took.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createMainThreadLumaCopier(): MainThreadLumaCopier;
|
|
48
|
+
//# sourceMappingURL=preview-luma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-luma.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/preview-luma.ts"],"names":[],"mappings":"AAYA,qDAAqD;AACrD,MAAM,MAAM,oBAAoB;AAC9B,kEAAkE;AAChE,OAAO;AACT;;;GAGG;GACD,KAAK,CAAC;AAEV,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;CACrC;AAED,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,uBAAuB,EAChC,UAAU,GAAE,UAAU,GAAG,IAAW,GACnC,OAAO,CAAC,gBAAgB,CAAC,CA4D3B;AAED,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,IAAI,CACF,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,UAAU,GAAG,IAAI,GAC5B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,IAAI,CACF,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,UAAU,GAAG,IAAI,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAoBjE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { type DepthMap, type DepthPreviewLevels } from "supervision-js-core";
|
|
2
|
+
import type { DepthPreviewDecoding } from "#media/depth-preview-probe";
|
|
3
|
+
import type { DepthPreviewTrackOptions, DepthPreviewTrackReader } from "#media/depth-preview-track";
|
|
4
|
+
import type { MediaFrameClock } from "#types/media-frame-clock";
|
|
5
|
+
import type { MediaRendererDepthInput } from "#types/media-depth";
|
|
6
|
+
import type { RenderPreparationDepthOptions, RenderPreparationDiagnostics, RenderPreparationMaskFrameOptions, ResolvedRenderPreparationGateThresholds } from "#types/render-preparation";
|
|
7
|
+
import type { DepthFramePreparer } from "./frame-preparer";
|
|
8
|
+
import type { DepthPreviewLumaCopier } from "./preview-luma";
|
|
9
|
+
/** One depth map ready to draw, and which frame of depth it is. */
|
|
10
|
+
export interface DepthFrameEntry {
|
|
11
|
+
readonly map: DepthMap;
|
|
12
|
+
readonly frameIndex: number | null;
|
|
13
|
+
}
|
|
14
|
+
/** What the depth layer reads to find the map for a media time. */
|
|
15
|
+
export interface DepthFrameProvider {
|
|
16
|
+
/**
|
|
17
|
+
* The depth to draw over the frame at `mediaTime`, or null to draw none.
|
|
18
|
+
* The layer asks only for the frame it is drawing, so a clip takes each
|
|
19
|
+
* call as naming the frame on screen.
|
|
20
|
+
*/
|
|
21
|
+
getEntry(mediaTime: number): DepthFrameEntry | null;
|
|
22
|
+
/**
|
|
23
|
+
* Whether playback runs or a drag is still moving. A clip fetches exact
|
|
24
|
+
* frames only once this has been false for a moment, and draws its preview
|
|
25
|
+
* until then.
|
|
26
|
+
*/
|
|
27
|
+
setPlaybackActive?(active: boolean): void;
|
|
28
|
+
/** Whether a drag, not playback, holds the playhead. */
|
|
29
|
+
setScrubbing?(scrubbing: boolean): void;
|
|
30
|
+
/** Whether playback wraps at the media end: decoding ahead wraps with it. */
|
|
31
|
+
setLoop?(loop: boolean): void;
|
|
32
|
+
/** Calls `listener` whenever an answer of `getEntry` may have changed. */
|
|
33
|
+
subscribe?(listener: () => void): () => void;
|
|
34
|
+
/** The playhead moved: decoding ahead follows it. Never called in a present. */
|
|
35
|
+
prefetch?(mediaTime: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* The entries the next presents may draw, nearest first, so their
|
|
38
|
+
* textures can go up before those presents: `count` frames in a row from
|
|
39
|
+
* `skip` frames after the one at `mediaTime`. Above 1x a present skips
|
|
40
|
+
* frames, and `skip` is how many it last moved.
|
|
41
|
+
*/
|
|
42
|
+
getUpcomingEntries?(mediaTime: number, count: number, skip?: number): readonly DepthFrameEntry[];
|
|
43
|
+
/** Whether the frame at `mediaTime` has to wait for depth before it shows. */
|
|
44
|
+
needsPlaybackGateWait?(mediaTime: number, thresholds: ResolvedRenderPreparationGateThresholds): boolean;
|
|
45
|
+
/** Resolves once depth leads `mediaTime` as far as the thresholds ask. */
|
|
46
|
+
waitForReady?(mediaTime: number, thresholds: ResolvedRenderPreparationGateThresholds, signal?: AbortSignal): Promise<void>;
|
|
47
|
+
/** Depth frames prepared ahead, counted up across the source's life. */
|
|
48
|
+
getPreparationProgress?(): number;
|
|
49
|
+
/**
|
|
50
|
+
* The depth frame `getEntry` answers for `mediaTime`, without drawing it,
|
|
51
|
+
* and whether it is decoded yet. Null where there is no depth frame.
|
|
52
|
+
*/
|
|
53
|
+
getFrameStatus?(mediaTime: number): {
|
|
54
|
+
readonly frameIndex: number | null;
|
|
55
|
+
readonly prepared: boolean;
|
|
56
|
+
} | null;
|
|
57
|
+
destroy(): void;
|
|
58
|
+
}
|
|
59
|
+
export interface DepthSourceContext {
|
|
60
|
+
/** The media the map is stretched over. */
|
|
61
|
+
readonly media: {
|
|
62
|
+
readonly width: number;
|
|
63
|
+
readonly height: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The media's frame index. A clip needs it to pair each depth frame with
|
|
67
|
+
* the video frame it measures.
|
|
68
|
+
*/
|
|
69
|
+
readonly frameClock?: MediaFrameClock | null;
|
|
70
|
+
/**
|
|
71
|
+
* Reads the frame index for media that does not keep one, the first time
|
|
72
|
+
* a clip asks: a Mediabunny URL or Blob.
|
|
73
|
+
*/
|
|
74
|
+
readonly readFrameClock?: (() => Promise<MediaFrameClock>) | null;
|
|
75
|
+
/** Why the media has no frame index, told to a clip that needs one. */
|
|
76
|
+
readonly frameClockUnavailableReason?: string;
|
|
77
|
+
/** The decoder, created only when a manifest needs one. */
|
|
78
|
+
readonly preparer?: () => DepthFramePreparer;
|
|
79
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
80
|
+
/** Pad odd-width rows for WebGL while decoding, off the main thread. */
|
|
81
|
+
readonly padRowsForWebGl?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The box the picture is shown in. Exact depth at least twice the size the
|
|
84
|
+
* box shows at its pixel ratio is uploaded shrunk by that whole factor,
|
|
85
|
+
* prepared while decoding; readouts keep the full map.
|
|
86
|
+
*/
|
|
87
|
+
readonly display?: RenderPreparationMaskFrameOptions["display"];
|
|
88
|
+
readonly signal?: AbortSignal;
|
|
89
|
+
readonly depth?: RenderPreparationDepthOptions;
|
|
90
|
+
/**
|
|
91
|
+
* The mask window's schedule batch, which also sizes what the preview keeps
|
|
92
|
+
* at rest: masks and depth keep the same margin ahead of a paused frame.
|
|
93
|
+
*/
|
|
94
|
+
readonly scheduleBatchSize?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Opens a clip's preview video; null leaves the preview out. Defaults to
|
|
97
|
+
* the WebCodecs decoder, loaded on first use.
|
|
98
|
+
*/
|
|
99
|
+
readonly openPreviewTrack?: ((url: string, options?: DepthPreviewTrackOptions) => Promise<DepthPreviewTrackReader>) | null;
|
|
100
|
+
/**
|
|
101
|
+
* Copies decoded preview frames' luma out, made when a preview first opens:
|
|
102
|
+
* the session's render-preparation worker keeps those copies off the page.
|
|
103
|
+
* Without one, they run on the page.
|
|
104
|
+
*/
|
|
105
|
+
readonly previewLumaCopier?: () => DepthPreviewLumaCopier;
|
|
106
|
+
/**
|
|
107
|
+
* Picks, once per page and level, the decoder that returns preview codes
|
|
108
|
+
* as written; null skips the probe and leaves the choice to the browser.
|
|
109
|
+
*/
|
|
110
|
+
readonly choosePreviewDecoding?: ((levels: DepthPreviewLevels) => Promise<DepthPreviewDecoding>) | null;
|
|
111
|
+
/** Hears the preview window's state: its lead, frames held and gate holds. */
|
|
112
|
+
readonly onDiagnostics?: (diagnostics: RenderPreparationDiagnostics) => void;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Checks a depth input against the media it will be drawn over and opens it.
|
|
116
|
+
* A still map, given or loaded from an image manifest, answers every media
|
|
117
|
+
* time with itself. A clip manifest answers with the exact frame for the
|
|
118
|
+
* video frame on screen once playback rests.
|
|
119
|
+
*/
|
|
120
|
+
export declare function openDepthSource(input: MediaRendererDepthInput, context: DepthSourceContext): Promise<DepthFrameProvider>;
|
|
121
|
+
/** Rejects an input whose shape no renderer could draw, before any media opens. */
|
|
122
|
+
export declare function validateDepthInput(input: MediaRendererDepthInput): void;
|
|
123
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACxB,MAAM,qBA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;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,iCAAiC,CAAC,SAAS,CAAC,CAAC;IAChE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,6BAA6B,CAAC;IAC/C;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EACtB,CAAC,CACC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,wBAAwB,KAC/B,OAAO,CAAC,uBAAuB,CAAC,CAAC,GACtC,IAAI,CAAC;IACT;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,sBAAsB,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAC7B,CAAC,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC,GAAG,IAAI,CAAC;IACzE,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,4BAA4B,KAAK,IAAI,CAAC;CAC9E;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAsB7B;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,IAAI,CA2BvE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { DepthPreviewLumaPath } from "./preview-luma";
|
|
2
|
+
/**
|
|
3
|
+
* Messages between the depth source and the render-preparation worker, which
|
|
4
|
+
* decodes depth and confidence PNGs, and copies decoded preview frames' luma,
|
|
5
|
+
* off the main thread. Internal: the worker script is a deployment asset, and
|
|
6
|
+
* its protocol is not public.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum DepthPreparationWorkerMessageType {
|
|
9
|
+
Decode = "depth-decode",
|
|
10
|
+
Complete = "depth-decode-complete",
|
|
11
|
+
Error = "depth-decode-error",
|
|
12
|
+
PreviewLuma = "depth-preview-luma",
|
|
13
|
+
PreviewLumaComplete = "depth-preview-luma-complete"
|
|
14
|
+
}
|
|
15
|
+
/** A decoded preview frame, transferred to the worker, which closes it. */
|
|
16
|
+
export interface DepthPreviewLumaWorkerRequest {
|
|
17
|
+
readonly requestId: number;
|
|
18
|
+
readonly type: DepthPreparationWorkerMessageType.PreviewLuma;
|
|
19
|
+
readonly frame: VideoFrame;
|
|
20
|
+
readonly correction: Uint8Array | null;
|
|
21
|
+
}
|
|
22
|
+
export type DepthPreviewLumaWorkerResponse = {
|
|
23
|
+
readonly requestId: number;
|
|
24
|
+
readonly type: DepthPreparationWorkerMessageType.PreviewLumaComplete;
|
|
25
|
+
/** One byte per pixel, transferred. */
|
|
26
|
+
readonly luma: ArrayBuffer;
|
|
27
|
+
readonly width: number;
|
|
28
|
+
readonly height: number;
|
|
29
|
+
readonly path: DepthPreviewLumaPath;
|
|
30
|
+
} | {
|
|
31
|
+
readonly requestId: number;
|
|
32
|
+
readonly type: DepthPreparationWorkerMessageType.Error;
|
|
33
|
+
readonly error: string;
|
|
34
|
+
};
|
|
35
|
+
export interface DepthPreparationWorkerRequest {
|
|
36
|
+
readonly requestId: number;
|
|
37
|
+
readonly type: DepthPreparationWorkerMessageType.Decode;
|
|
38
|
+
/** The PNG file's bytes, transferred once the worker has proven itself. */
|
|
39
|
+
readonly bytes: ArrayBuffer;
|
|
40
|
+
/** 16 for depth samples, 8 for a confidence plane. */
|
|
41
|
+
readonly bitDepth: 16 | 8;
|
|
42
|
+
/** Also return odd-width depth rows padded for a WebGL upload. */
|
|
43
|
+
readonly padRowsForWebGl?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Also return depth decimated by this whole factor for upload, when it is
|
|
46
|
+
* 2 or more: the texture the box shows, beside the full samples a readout
|
|
47
|
+
* reads.
|
|
48
|
+
*/
|
|
49
|
+
readonly decimateBy?: number;
|
|
50
|
+
}
|
|
51
|
+
export type DepthPreparationWorkerResponse = {
|
|
52
|
+
readonly requestId: number;
|
|
53
|
+
readonly type: DepthPreparationWorkerMessageType.Complete;
|
|
54
|
+
readonly bitDepth: 16 | 8;
|
|
55
|
+
readonly width: number;
|
|
56
|
+
readonly height: number;
|
|
57
|
+
/** Host-order Uint16 samples at 16 bits, bytes at 8, transferred. */
|
|
58
|
+
readonly values: ArrayBuffer;
|
|
59
|
+
readonly paddedUpload?: {
|
|
60
|
+
readonly bytes: ArrayBuffer;
|
|
61
|
+
readonly textureWidth: number;
|
|
62
|
+
};
|
|
63
|
+
readonly decimatedUpload?: DecimatedDepthUpload<ArrayBuffer>;
|
|
64
|
+
} | {
|
|
65
|
+
readonly requestId: number;
|
|
66
|
+
readonly type: DepthPreparationWorkerMessageType.Error;
|
|
67
|
+
readonly error: string;
|
|
68
|
+
};
|
|
69
|
+
/** Depth decimated for upload: two bytes a texel, low byte first, rows padded as asked. */
|
|
70
|
+
export interface DecimatedDepthUpload<Bytes extends ArrayBuffer | Uint8Array> {
|
|
71
|
+
readonly bytes: Bytes;
|
|
72
|
+
readonly width: number;
|
|
73
|
+
readonly height: number;
|
|
74
|
+
readonly textureWidth: number;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=worker-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-protocol.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/worker-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;;;;GAKG;AACH,oBAAY,iCAAiC;IAC3C,MAAM,iBAAiB;IACvB,QAAQ,0BAA0B;IAClC,KAAK,uBAAuB;IAC5B,WAAW,uBAAuB;IAClC,mBAAmB,gCAAgC;CACpD;AAED,2EAA2E;AAC3E,MAAM,WAAW,6BAA6B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AC;IAC1D,QAAQ,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;QAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,QAAQ,CAAC,eAAe,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;CAC9D,GACD;IACE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,iCAAiC,CAAC,KAAK,CAAC;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,2FAA2F;AAC3F,MAAM,WAAW,oBAAoB,CAAC,KAAK,SAAS,WAAW,GAAG,UAAU;IAC1E,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the playhead is moving, read from where it lands: playing forward at a
|
|
3
|
+
* cadence, dragged, or stepped, and which way. Every prepared window that
|
|
4
|
+
* works ahead of the playhead reads it here, so a drag or a fast rate reads
|
|
5
|
+
* the same to each.
|
|
6
|
+
*/
|
|
7
|
+
/** The widest stride a present is taken to move: 8x of a 30 fps clip on 60 Hz. */
|
|
8
|
+
export declare const MAX_PRESENTED_FRAME_STRIDE = 4;
|
|
9
|
+
/**
|
|
10
|
+
* Share of a window spent the way the playhead is heading, as the engine's
|
|
11
|
+
* scrub window spends it. The rest covers the ground just behind, which is
|
|
12
|
+
* what a reversal lands on before the new heading is established.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WINDOW_LEAD_FRACTION = 0.75;
|
|
15
|
+
export interface PlayheadMotion {
|
|
16
|
+
/**
|
|
17
|
+
* The playhead landed at `position`. `settledAdvance` is the widest
|
|
18
|
+
* forward step playback makes, in the same unit; a move past it, or any
|
|
19
|
+
* move back, is a jump.
|
|
20
|
+
*/
|
|
21
|
+
observe(position: number, settledAdvance: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* False while the playhead is dragged: it jumped twice in a row. A single
|
|
24
|
+
* jump is a seek that lands, and the window may lead it at once.
|
|
25
|
+
*/
|
|
26
|
+
readonly settled: boolean;
|
|
27
|
+
/** Which way the playhead travels: 1, -1, or 0 without enough to say. */
|
|
28
|
+
heading(): -1 | 0 | 1;
|
|
29
|
+
/** Playback started or stopped: the gesture that moved the playhead is over. */
|
|
30
|
+
endGesture(): void;
|
|
31
|
+
}
|
|
32
|
+
export declare function createPlayheadMotion(now?: () => number): PlayheadMotion;
|
|
33
|
+
/**
|
|
34
|
+
* How many frames each present moves, from the last few that moved. A
|
|
35
|
+
* cadence counts only once it has repeated, which is what separates it from
|
|
36
|
+
* a seek.
|
|
37
|
+
*/
|
|
38
|
+
export interface PresentedFrameStride {
|
|
39
|
+
observe(step: number): void;
|
|
40
|
+
/** The narrowest of the repeated strides, 1 until there are enough. */
|
|
41
|
+
narrowest(): number;
|
|
42
|
+
/** How far presents move on average, 1 until there are enough. */
|
|
43
|
+
average(): number;
|
|
44
|
+
/**
|
|
45
|
+
* The stride every recent present moved, or 1 when they differ: a cadence
|
|
46
|
+
* that alternates lands on frames no single stride names.
|
|
47
|
+
*/
|
|
48
|
+
uniform(): number;
|
|
49
|
+
reset(): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `sampleCount` is how many moves a cadence has to repeat over. A cadence
|
|
53
|
+
* that is not a whole number of frames, 3.2 at 8x of 24 fps on 60 Hz, moves
|
|
54
|
+
* 3, 3, 3, 3 and then 4, so a reading that skips frames on it needs more
|
|
55
|
+
* than four moves to see that.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createPresentedFrameStride(sampleCount?: number): PresentedFrameStride;
|
|
58
|
+
/**
|
|
59
|
+
* The playhead's own frame plus one schedule batch ahead. A batch is the most
|
|
60
|
+
* a window commits to in one pass, so a resting playhead holds a single pass
|
|
61
|
+
* of work, and a step forward still lands on a frame already prepared.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getPausedPreparedWindowFrameCount(options: {
|
|
64
|
+
readonly prefetchFrameCount: number;
|
|
65
|
+
readonly scheduleBatchSize: number;
|
|
66
|
+
}): number;
|
|
67
|
+
//# sourceMappingURL=playhead-motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playhead-motion.d.ts","sourceRoot":"","sources":["../../src/render-preparation/playhead-motion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAS5C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtB,gFAAgF;IAChF,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAClC,GAAG,GAAE,MAAM,MAAgC,GAC1C,cAAc,CA+EhB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,uEAAuE;IACvE,SAAS,IAAI,MAAM,CAAC;IACpB,kEAAkE;IAClE,OAAO,IAAI,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,IAAI,MAAM,CAAC;IAClB,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,SAAsC,GAChD,oBAAoB,CAqBtB;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC,UAEA"}
|
|
@@ -5,6 +5,11 @@ import { type BufferedDetectionTimeline } from "supervision-js-core";
|
|
|
5
5
|
import type { DetectionFrame } from "supervision-js-core";
|
|
6
6
|
import type { MaskStyle } from "supervision-js-core";
|
|
7
7
|
import { RenderPreparationArtifactKind, type RenderPreparationOptions, type ResolvedRenderPreparationGateThresholds } from "#types/render-preparation";
|
|
8
|
+
export declare enum PreparedRasterTier {
|
|
9
|
+
Coarse = "coarse",
|
|
10
|
+
Fine = "fine"
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_MASK_SCHEDULE_BATCH_SIZE = 2;
|
|
8
13
|
export interface PreparedRenderFrame {
|
|
9
14
|
readonly detectionFrame: DetectionFrame;
|
|
10
15
|
readonly key: string;
|
|
@@ -19,6 +24,10 @@ export declare enum PreparedRenderFrameMaskStatus {
|
|
|
19
24
|
}
|
|
20
25
|
export interface PreparedRenderWindow {
|
|
21
26
|
getFrame(mediaTime: number): PreparedRenderFrame | undefined;
|
|
27
|
+
/** Revision of the prepared artifact, including replacements at the same time. */
|
|
28
|
+
getArtifactRevision(mediaTime: number): number;
|
|
29
|
+
/** Recooks the active frame and its targets after the display raster size changes. */
|
|
30
|
+
invalidateRasterSize(): void;
|
|
22
31
|
/**
|
|
23
32
|
* Whether this window's artifact for a media time is cooked, scheduling
|
|
24
33
|
* nothing. True when there is nothing to cook: no style, no frame there.
|
|
@@ -65,6 +74,9 @@ export declare function createPreparedRenderWindow(options: {
|
|
|
65
74
|
readonly detectionTimeline: BufferedDetectionTimeline;
|
|
66
75
|
readonly maskStyle?: MaskStyle | null;
|
|
67
76
|
readonly maxMaskFrameCacheSize?: number;
|
|
77
|
+
readonly maxMaskFrameCacheBytes?: number;
|
|
78
|
+
/** Reserves renderer backing before a prepared frame can be drawn. */
|
|
79
|
+
readonly resolveMaskFrameBackingBytes?: (frame: PreparedMaskFrame) => number;
|
|
68
80
|
readonly onMaskFrameEvicted?: (key: string) => void;
|
|
69
81
|
readonly onMaskFramePrepared?: (maskFrame: PreparedMaskFrame) => void;
|
|
70
82
|
readonly onMaskFramesCleared?: () => void;
|