supervision 0.2.5 → 0.2.7
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/editing.d.ts +1 -1
- package/dist/editing.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9845 -4759
- package/dist/index.js.map +1 -1
- package/dist/mask-preparation.worker.js +788 -25
- 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/mask-frame-artifact.d.ts +10 -0
- package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
- package/dist/render-preparation/mask-frame-compositor.d.ts +2 -1
- package/dist/render-preparation/mask-frame-compositor.d.ts.map +1 -1
- package/dist/render-preparation/mask-frame-preparer.d.ts.map +1 -1
- package/dist/render-preparation/mask-outline-paths.d.ts +3 -0
- package/dist/render-preparation/mask-outline-paths.d.ts.map +1 -0
- package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +2 -1
- package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
- 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/detection-render-order.d.ts +4 -0
- package/dist/renderers/detection-render-order.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 +16 -2
- 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-box-layer.d.ts +1 -0
- package/dist/renderers/pixi-box-layer.d.ts.map +1 -1
- 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-brush-preview.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 +8 -2
- package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-mask-screen-stroke.d.ts +17 -0
- package/dist/renderers/pixi-mask-screen-stroke.d.ts.map +1 -0
- 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/pixi-vector-layer.d.ts +1 -0
- package/dist/renderers/pixi-vector-layer.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 +33 -0
- package/dist/types/media-renderer.d.ts.map +1 -1
- package/dist/types/media-session.d.ts +21 -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 +8 -3
- package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.js +1172 -70
- 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 +2 -2
- 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/interactions/detection-picker.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/interactions/viewport-controller.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/detections.d.ts +2 -1
- package/node_modules/supervision-js-core/dist/types/detections.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/editing.d.ts +9 -0
- package/node_modules/supervision-js-core/dist/types/editing.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/interaction.d.ts +4 -0
- package/node_modules/supervision-js-core/dist/types/interaction.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/mask-style.d.ts +3 -0
- package/node_modules/supervision-js-core/dist/types/mask-style.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/types/viewport.d.ts +3 -0
- package/node_modules/supervision-js-core/dist/types/viewport.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,612 @@
|
|
|
1
|
+
import { MediaErrorKind, PLAYHEAD_QUANTIZATION_TOLERANCE_SECONDS } from 'supervision-js-core';
|
|
2
|
+
import { M as MediaSourceError } from './video-engine-media-source-DOFsuGS4.js';
|
|
3
|
+
|
|
4
|
+
/** Formats whose first plane is 8-bit luma, which is the code as written. */
|
|
5
|
+
const PLANAR_8_BIT_FORMATS = new Set([
|
|
6
|
+
"I420",
|
|
7
|
+
"I420A",
|
|
8
|
+
"I422",
|
|
9
|
+
"I422A",
|
|
10
|
+
"I444",
|
|
11
|
+
"I444A",
|
|
12
|
+
"NV12",
|
|
13
|
+
]);
|
|
14
|
+
const RGB_FORMATS = new Set(["RGBA", "RGBX", "BGRA", "BGRX"]);
|
|
15
|
+
/**
|
|
16
|
+
* Copies a decoded preview frame's luma codes out of it, mapped through
|
|
17
|
+
* `correction` when one is given. The frame stays open; its owner closes
|
|
18
|
+
* it.
|
|
19
|
+
*/
|
|
20
|
+
async function readVideoFrameLuma(frame, scratch, correction = null) {
|
|
21
|
+
const rect = frame.visibleRect ?? {
|
|
22
|
+
height: frame.codedHeight,
|
|
23
|
+
width: frame.codedWidth,
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0,
|
|
26
|
+
};
|
|
27
|
+
const { width, height } = rect;
|
|
28
|
+
const format = frame.format;
|
|
29
|
+
const planar = format !== null && PLANAR_8_BIT_FORMATS.has(format);
|
|
30
|
+
let bytes;
|
|
31
|
+
let plane;
|
|
32
|
+
if (planar || (format !== null && RGB_FORMATS.has(format))) {
|
|
33
|
+
const size = frame.allocationSize({ rect });
|
|
34
|
+
if (scratch.buffer.byteLength < size)
|
|
35
|
+
scratch.buffer = new ArrayBuffer(size);
|
|
36
|
+
[plane] = await frame.copyTo(scratch.buffer, { rect });
|
|
37
|
+
bytes = new Uint8Array(scratch.buffer);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// A frame in a layout no copy can read is drawn to a canvas, which
|
|
41
|
+
// converts it to RGB as the browser sees fit.
|
|
42
|
+
bytes = drawFrameRgba(frame, width, height);
|
|
43
|
+
}
|
|
44
|
+
const luma = new Uint8Array(width * height);
|
|
45
|
+
const stride = plane?.stride ?? (planar ? width : width * 4);
|
|
46
|
+
const offset = plane?.offset ?? 0;
|
|
47
|
+
if (!planar) {
|
|
48
|
+
// Every RGB layout keeps green second, and luma with neutral chroma
|
|
49
|
+
// converts to three equal channels.
|
|
50
|
+
for (let y = 0; y < height; y += 1) {
|
|
51
|
+
const row = offset + y * stride + 1;
|
|
52
|
+
const target = y * width;
|
|
53
|
+
for (let x = 0; x < width; x += 1) {
|
|
54
|
+
luma[target + x] = bytes[row + x * 4];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (stride === width) {
|
|
59
|
+
luma.set(bytes.subarray(offset, offset + width * height));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
for (let y = 0; y < height; y += 1) {
|
|
63
|
+
luma.set(bytes.subarray(offset + y * stride, offset + y * stride + width), y * width);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (correction) {
|
|
67
|
+
for (let index = 0; index < luma.length; index += 1) {
|
|
68
|
+
luma[index] = correction[luma[index]];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return { height, luma, path: planar ? "plane" : "rgb", width };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Copies on the page, one frame at a time through one scratch buffer. Each
|
|
75
|
+
* copy reports the main-thread time it took.
|
|
76
|
+
*/
|
|
77
|
+
function createMainThreadLumaCopier() {
|
|
78
|
+
const scratch = { buffer: new ArrayBuffer(0) };
|
|
79
|
+
let queue = Promise.resolve();
|
|
80
|
+
return {
|
|
81
|
+
copy(frame, correction) {
|
|
82
|
+
const copied = queue.then(async () => {
|
|
83
|
+
try {
|
|
84
|
+
return await readVideoFrameLuma(frame, scratch, correction);
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
frame.close();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
queue = copied.catch(() => undefined);
|
|
91
|
+
return copied;
|
|
92
|
+
},
|
|
93
|
+
destroy: () => undefined,
|
|
94
|
+
offMainThread: false,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function drawFrameRgba(frame, width, height) {
|
|
98
|
+
const canvas = new OffscreenCanvas(width, height);
|
|
99
|
+
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
100
|
+
if (!context) {
|
|
101
|
+
throw new Error("The depth preview needs a 2D canvas to read this frame.");
|
|
102
|
+
}
|
|
103
|
+
context.drawImage(frame, 0, 0, width, height);
|
|
104
|
+
const { data } = context.getImageData(0, 0, width, height);
|
|
105
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Waits for one step of a video decoder, which answers in milliseconds when
|
|
110
|
+
* it works and may never answer when it does not. Rejects with a
|
|
111
|
+
* `TimeoutError` naming the step once `milliseconds` pass; the step itself
|
|
112
|
+
* carries on, and its owner closes the decoder.
|
|
113
|
+
*
|
|
114
|
+
* The budget runs only while the page is visible: a browser may hold a
|
|
115
|
+
* hidden page's decoder work back, and a step that waited on that is no
|
|
116
|
+
* broken decoder.
|
|
117
|
+
*/
|
|
118
|
+
function withinDecoderDeadline(step, milliseconds, what, page = globalThis.document) {
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
120
|
+
let remaining = milliseconds;
|
|
121
|
+
let startedAt = 0;
|
|
122
|
+
let timer;
|
|
123
|
+
const stop = () => {
|
|
124
|
+
clearTimeout(timer);
|
|
125
|
+
timer = undefined;
|
|
126
|
+
page?.removeEventListener("visibilitychange", onVisibility);
|
|
127
|
+
};
|
|
128
|
+
const expire = () => {
|
|
129
|
+
stop();
|
|
130
|
+
reject(new DOMException(`${what} did not answer within ${formatSeconds(milliseconds)}.`, "TimeoutError"));
|
|
131
|
+
};
|
|
132
|
+
const run = () => {
|
|
133
|
+
if (timer !== undefined)
|
|
134
|
+
return;
|
|
135
|
+
startedAt = performance.now();
|
|
136
|
+
timer = setTimeout(expire, remaining);
|
|
137
|
+
};
|
|
138
|
+
const pause = () => {
|
|
139
|
+
if (timer === undefined)
|
|
140
|
+
return;
|
|
141
|
+
remaining = Math.max(0, remaining - (performance.now() - startedAt));
|
|
142
|
+
clearTimeout(timer);
|
|
143
|
+
timer = undefined;
|
|
144
|
+
};
|
|
145
|
+
function onVisibility() {
|
|
146
|
+
if (page?.visibilityState === "hidden")
|
|
147
|
+
pause();
|
|
148
|
+
else
|
|
149
|
+
run();
|
|
150
|
+
}
|
|
151
|
+
page?.addEventListener("visibilitychange", onVisibility);
|
|
152
|
+
if (page?.visibilityState !== "hidden")
|
|
153
|
+
run();
|
|
154
|
+
step.then((value) => {
|
|
155
|
+
stop();
|
|
156
|
+
resolve(value);
|
|
157
|
+
}, (error) => {
|
|
158
|
+
stop();
|
|
159
|
+
reject(error);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function formatSeconds(milliseconds) {
|
|
164
|
+
return `${Number((milliseconds / 1000).toFixed(2))} s`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Read by the same packet walk the web video engine uses, so a track decoded
|
|
169
|
+
* beside the media and the media itself agree on every frame.
|
|
170
|
+
*/
|
|
171
|
+
async function readTrackFrameIndex(track) {
|
|
172
|
+
const { readFrameIndex } = await import('./web-video-engine/frame-index.js');
|
|
173
|
+
const { timeline, keyIndices } = await readFrameIndex(track);
|
|
174
|
+
const first = timeline.timeAt(0);
|
|
175
|
+
return {
|
|
176
|
+
keyIndices,
|
|
177
|
+
sourceTimes: Float64Array.from({ length: timeline.frameCount }, (_, index) => timeline.sourceTimeAt(index)),
|
|
178
|
+
times: Float64Array.from({ length: timeline.frameCount }, (_, index) => timeline.timeAt(index) - first),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Decode requests kept waiting in the decoder. Enough to keep a hardware
|
|
184
|
+
* decoder busy, few enough that a seek throws little work away.
|
|
185
|
+
*/
|
|
186
|
+
const MAX_DECODE_QUEUE_SIZE = 4;
|
|
187
|
+
/**
|
|
188
|
+
* Frames fed to the decoder and not yet out of it. A decoder holds a few for
|
|
189
|
+
* reordering; more than this means it is not keeping up, so feeding waits.
|
|
190
|
+
*/
|
|
191
|
+
const MAX_FRAMES_IN_FLIGHT = 24;
|
|
192
|
+
/** How long a wait for the decoder sleeps when it cannot hear `dequeue`. */
|
|
193
|
+
const DECODER_POLL_MILLISECONDS = 4;
|
|
194
|
+
/** The same, as a safety net, for a decoder that does say `dequeue`. */
|
|
195
|
+
const DECODER_IDLE_POLL_MILLISECONDS = 25;
|
|
196
|
+
/**
|
|
197
|
+
* How long a decoder may sit on frames it was given, with nothing more it
|
|
198
|
+
* can be fed, before it is flushed for them. Some decoders return frames only
|
|
199
|
+
* once more input arrives or a flush asks for them.
|
|
200
|
+
*/
|
|
201
|
+
const STALLED_DECODER_FLUSH_MILLISECONDS = 100;
|
|
202
|
+
/**
|
|
203
|
+
* How long a flush may go without returning a frame before the decoder is
|
|
204
|
+
* taken for stuck. A flush waits on the decoder alone, never the network.
|
|
205
|
+
*/
|
|
206
|
+
const FLUSH_SILENCE_MILLISECONDS = 3000;
|
|
207
|
+
/** How long the browser may take to say whether it decodes the preview. */
|
|
208
|
+
const DECODER_SUPPORT_MILLISECONDS = 3000;
|
|
209
|
+
const MICROSECONDS_PER_SECOND = 1_000_000;
|
|
210
|
+
/**
|
|
211
|
+
* Opens a depth preview video: an 8-bit grayscale H.264 whose luma codes are
|
|
212
|
+
* depth. Mediabunny is loaded on first use, so a page without a preview never
|
|
213
|
+
* downloads it.
|
|
214
|
+
*/
|
|
215
|
+
async function openDepthPreviewTrack(input, options = {}) {
|
|
216
|
+
const mediabunny = await import('mediabunny');
|
|
217
|
+
const source = typeof input === "string" || input instanceof URL
|
|
218
|
+
? new mediabunny.UrlSource(input)
|
|
219
|
+
: new mediabunny.BufferSource(input);
|
|
220
|
+
const media = new mediabunny.Input({
|
|
221
|
+
formats: [mediabunny.MP4, mediabunny.QTFF],
|
|
222
|
+
source,
|
|
223
|
+
});
|
|
224
|
+
const { signal } = options;
|
|
225
|
+
const stop = () => media.dispose();
|
|
226
|
+
signal?.addEventListener("abort", stop, { once: true });
|
|
227
|
+
try {
|
|
228
|
+
if (signal?.aborted)
|
|
229
|
+
throw signal.reason;
|
|
230
|
+
const track = await media.getPrimaryVideoTrack();
|
|
231
|
+
if (!track) {
|
|
232
|
+
throw new MediaSourceError(MediaErrorKind.NoVideoTrack, "The depth preview has no video track.");
|
|
233
|
+
}
|
|
234
|
+
const [config, rotation, width, height] = await Promise.all([
|
|
235
|
+
track.getDecoderConfig(),
|
|
236
|
+
track.getRotation(),
|
|
237
|
+
track.getDisplayWidth(),
|
|
238
|
+
track.getDisplayHeight(),
|
|
239
|
+
]);
|
|
240
|
+
if (!config ||
|
|
241
|
+
typeof VideoDecoder === "undefined" ||
|
|
242
|
+
!(await isDecoderConfigSupported(config))) {
|
|
243
|
+
throw new MediaSourceError(MediaErrorKind.UnsupportedFormat, `This browser cannot decode the depth preview's codec ${config?.codec ?? "(unknown)"}.`);
|
|
244
|
+
}
|
|
245
|
+
if (rotation !== 0) {
|
|
246
|
+
throw new RangeError(`The depth preview is rotated ${rotation} degrees; depth previews must not be rotated.`);
|
|
247
|
+
}
|
|
248
|
+
const timeline = await readTrackFrameIndex(track);
|
|
249
|
+
const packetSink = new mediabunny.EncodedPacketSink(track);
|
|
250
|
+
if (signal?.aborted)
|
|
251
|
+
throw signal.reason;
|
|
252
|
+
return createDepthPreviewTrackReader({
|
|
253
|
+
config: options.hardwareAcceleration
|
|
254
|
+
? { ...config, hardwareAcceleration: options.hardwareAcceleration }
|
|
255
|
+
: config,
|
|
256
|
+
copier: options.copier,
|
|
257
|
+
correction: options.correction ?? null,
|
|
258
|
+
dispose: () => media.dispose(),
|
|
259
|
+
height,
|
|
260
|
+
packetSink,
|
|
261
|
+
timeline,
|
|
262
|
+
width,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
media.dispose();
|
|
267
|
+
throw signal?.aborted ? signal.reason : error;
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
signal?.removeEventListener("abort", stop);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Whether the browser decodes `config`, given a deadline: a browser that
|
|
275
|
+
* never answers is taken as one that does not.
|
|
276
|
+
*/
|
|
277
|
+
async function isDecoderConfigSupported(config) {
|
|
278
|
+
try {
|
|
279
|
+
const support = await withinDecoderDeadline(VideoDecoder.isConfigSupported(config), DECODER_SUPPORT_MILLISECONDS, "VideoDecoder.isConfigSupported");
|
|
280
|
+
return support.supported === true;
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/** The decoding half, apart from the container so it can be driven directly. */
|
|
287
|
+
function createDepthPreviewTrackReader(options) {
|
|
288
|
+
const Decoder = options.VideoDecoder ?? globalThis.VideoDecoder;
|
|
289
|
+
const { timeline } = options;
|
|
290
|
+
const frameCount = timeline.times.length;
|
|
291
|
+
let decoder = null;
|
|
292
|
+
let hearsDequeue = false;
|
|
293
|
+
let current = null;
|
|
294
|
+
let disposed = false;
|
|
295
|
+
const pageCopier = createMainThreadLumaCopier();
|
|
296
|
+
let lumaPath = null;
|
|
297
|
+
/** A decoded timestamp is its packet's, truncated to microseconds. */
|
|
298
|
+
const indexOfTimestamp = (microseconds) => {
|
|
299
|
+
const time = microseconds / MICROSECONDS_PER_SECOND;
|
|
300
|
+
const times = timeline.sourceTimes;
|
|
301
|
+
let low = 0;
|
|
302
|
+
let high = times.length - 1;
|
|
303
|
+
while (low <= high) {
|
|
304
|
+
const middle = (low + high) >> 1;
|
|
305
|
+
if (times[middle] < time - PLAYHEAD_QUANTIZATION_TOLERANCE_SECONDS) {
|
|
306
|
+
low = middle + 1;
|
|
307
|
+
}
|
|
308
|
+
else if (times[middle] >
|
|
309
|
+
time + PLAYHEAD_QUANTIZATION_TOLERANCE_SECONDS) {
|
|
310
|
+
high = middle - 1;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
return middle;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return -1;
|
|
317
|
+
};
|
|
318
|
+
const closeDecoder = () => {
|
|
319
|
+
if (!decoder)
|
|
320
|
+
return;
|
|
321
|
+
if (decoder.state !== "closed")
|
|
322
|
+
decoder.close();
|
|
323
|
+
decoder = null;
|
|
324
|
+
};
|
|
325
|
+
const ensureDecoder = () => {
|
|
326
|
+
if (decoder && decoder.state !== "closed")
|
|
327
|
+
return decoder;
|
|
328
|
+
const created = new Decoder({
|
|
329
|
+
error: (error) => {
|
|
330
|
+
// The decoder closes itself on an error; the next run makes another.
|
|
331
|
+
decoder = null;
|
|
332
|
+
current?.fail(error);
|
|
333
|
+
},
|
|
334
|
+
output: (frame) => {
|
|
335
|
+
if (current && !current.cancelled)
|
|
336
|
+
current.accept(frame);
|
|
337
|
+
else
|
|
338
|
+
frame.close();
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
hearsDequeue = typeof created.addEventListener === "function";
|
|
342
|
+
created.addEventListener?.("dequeue", () => current?.wake());
|
|
343
|
+
decoder = created;
|
|
344
|
+
return created;
|
|
345
|
+
};
|
|
346
|
+
/** The copier closes `frame`. Resolves null for a frame the copier lost. */
|
|
347
|
+
const copyLuma = (frame, index) => {
|
|
348
|
+
const correction = options.correction ?? null;
|
|
349
|
+
const copied = options.copier?.copy(frame, correction) ??
|
|
350
|
+
pageCopier.copy(frame, correction);
|
|
351
|
+
return copied.then((result) => {
|
|
352
|
+
if (!result)
|
|
353
|
+
return null;
|
|
354
|
+
lumaPath = result.path === "rgb" ? "rgb" : (lumaPath ?? "plane");
|
|
355
|
+
return {
|
|
356
|
+
height: result.height,
|
|
357
|
+
index,
|
|
358
|
+
luma: result.luma,
|
|
359
|
+
width: result.width,
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
const startRun = (fromIndex, runOptions) => {
|
|
364
|
+
const keep = runOptions.keep ?? (() => true);
|
|
365
|
+
const ready = [];
|
|
366
|
+
const runDecoder = ensureDecoder();
|
|
367
|
+
let cancelled = false;
|
|
368
|
+
let failure = null;
|
|
369
|
+
let packets = null;
|
|
370
|
+
let packetsDone = false;
|
|
371
|
+
let fed = 0;
|
|
372
|
+
let delivered = 0;
|
|
373
|
+
/** Last time the decoder took a chunk or returned a frame. */
|
|
374
|
+
let lastProgressAt = performance.now();
|
|
375
|
+
/**
|
|
376
|
+
* The decoder sat on every frame it was given: it is fed past the
|
|
377
|
+
* in-flight limit up to the next key frame, and flushed there.
|
|
378
|
+
*/
|
|
379
|
+
let stalled = false;
|
|
380
|
+
/** A key frame read while stalled, fed once the flush before it ends. */
|
|
381
|
+
let heldKey = null;
|
|
382
|
+
let flushing = false;
|
|
383
|
+
let flushed = false;
|
|
384
|
+
let wakeUp = null;
|
|
385
|
+
let onCancel = () => undefined;
|
|
386
|
+
/** Settles when the run is cancelled, so no await outlives it. */
|
|
387
|
+
const cancellation = new Promise((resolve) => {
|
|
388
|
+
onCancel = () => resolve(null);
|
|
389
|
+
});
|
|
390
|
+
const wake = () => {
|
|
391
|
+
const resolve = wakeUp;
|
|
392
|
+
wakeUp = null;
|
|
393
|
+
resolve?.();
|
|
394
|
+
};
|
|
395
|
+
const sleep = () => new Promise((resolve) => {
|
|
396
|
+
wakeUp = resolve;
|
|
397
|
+
setTimeout(wake, hearsDequeue
|
|
398
|
+
? DECODER_IDLE_POLL_MILLISECONDS
|
|
399
|
+
: DECODER_POLL_MILLISECONDS);
|
|
400
|
+
});
|
|
401
|
+
/**
|
|
402
|
+
* Asks the decoder for every frame it holds. After a flush the decoder
|
|
403
|
+
* takes only a key frame, so one mid-run waits for the next key frame;
|
|
404
|
+
* the one at the end of input ends the run.
|
|
405
|
+
*/
|
|
406
|
+
const flush = (atEnd) => {
|
|
407
|
+
flushing = true;
|
|
408
|
+
lastProgressAt = performance.now();
|
|
409
|
+
runDecoder.flush().then(() => {
|
|
410
|
+
flushing = false;
|
|
411
|
+
stalled = false;
|
|
412
|
+
if (atEnd)
|
|
413
|
+
flushed = true;
|
|
414
|
+
wake();
|
|
415
|
+
}, (error) => {
|
|
416
|
+
// A reset for the next run aborts this flush; that is no failure.
|
|
417
|
+
if (!cancelled && !isAbortError(error))
|
|
418
|
+
failure ??= { error };
|
|
419
|
+
flushing = false;
|
|
420
|
+
if (atEnd)
|
|
421
|
+
flushed = true;
|
|
422
|
+
wake();
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
const readPacket = async () => {
|
|
426
|
+
if (!packets) {
|
|
427
|
+
const from = Math.min(Math.max(0, fromIndex), frameCount - 1);
|
|
428
|
+
const start = (await options.packetSink.getKeyPacket(timeline.sourceTimes[from], {
|
|
429
|
+
verifyKeyPackets: true,
|
|
430
|
+
})) ??
|
|
431
|
+
(await options.packetSink.getFirstKeyPacket({
|
|
432
|
+
verifyKeyPackets: true,
|
|
433
|
+
}));
|
|
434
|
+
if (cancelled)
|
|
435
|
+
return null;
|
|
436
|
+
if (!start)
|
|
437
|
+
return null;
|
|
438
|
+
packets = options.packetSink.packets(start);
|
|
439
|
+
}
|
|
440
|
+
const result = await packets.next();
|
|
441
|
+
return result.done ? null : result.value;
|
|
442
|
+
};
|
|
443
|
+
const state = {
|
|
444
|
+
get cancelled() {
|
|
445
|
+
return cancelled;
|
|
446
|
+
},
|
|
447
|
+
accept(frame) {
|
|
448
|
+
delivered += 1;
|
|
449
|
+
lastProgressAt = performance.now();
|
|
450
|
+
if (!flushing)
|
|
451
|
+
stalled = false;
|
|
452
|
+
const index = indexOfTimestamp(frame.timestamp);
|
|
453
|
+
if (index < 0 || !keep(index)) {
|
|
454
|
+
frame.close();
|
|
455
|
+
wake();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const copied = copyLuma(frame, index);
|
|
459
|
+
// A run cancelled before reading this copy never awaits it.
|
|
460
|
+
copied.catch(() => undefined);
|
|
461
|
+
ready.push(copied);
|
|
462
|
+
wake();
|
|
463
|
+
},
|
|
464
|
+
fail(error) {
|
|
465
|
+
failure ??= { error };
|
|
466
|
+
wake();
|
|
467
|
+
},
|
|
468
|
+
wake,
|
|
469
|
+
cancel() {
|
|
470
|
+
if (cancelled)
|
|
471
|
+
return;
|
|
472
|
+
cancelled = true;
|
|
473
|
+
void packets?.return(undefined).catch(() => undefined);
|
|
474
|
+
onCancel();
|
|
475
|
+
wake();
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
current = state;
|
|
479
|
+
if (runDecoder.state === "configured")
|
|
480
|
+
runDecoder.reset();
|
|
481
|
+
runDecoder.configure(options.config);
|
|
482
|
+
return {
|
|
483
|
+
async next() {
|
|
484
|
+
while (true) {
|
|
485
|
+
if (cancelled || disposed)
|
|
486
|
+
return null;
|
|
487
|
+
if (failure)
|
|
488
|
+
throw failure.error;
|
|
489
|
+
const head = ready.shift();
|
|
490
|
+
if (head) {
|
|
491
|
+
const frame = await Promise.race([head, cancellation]);
|
|
492
|
+
if (cancelled || disposed)
|
|
493
|
+
return null;
|
|
494
|
+
// A frame the copier lost is skipped; the caller asks for it again.
|
|
495
|
+
if (frame)
|
|
496
|
+
return frame;
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
if (flushed)
|
|
500
|
+
return null;
|
|
501
|
+
if (flushing) {
|
|
502
|
+
// Only the decoder can end a flush; one silent this long never will.
|
|
503
|
+
if (performance.now() - lastProgressAt >
|
|
504
|
+
FLUSH_SILENCE_MILLISECONDS) {
|
|
505
|
+
failure ??= {
|
|
506
|
+
error: new Error(`The depth preview decoder returned no frame for ${formatSeconds(FLUSH_SILENCE_MILLISECONDS)} of a flush.`),
|
|
507
|
+
};
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
await Promise.race([sleep(), cancellation]);
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
if (!packetsDone &&
|
|
514
|
+
runDecoder.decodeQueueSize < MAX_DECODE_QUEUE_SIZE &&
|
|
515
|
+
(stalled || fed - delivered < MAX_FRAMES_IN_FLIGHT)) {
|
|
516
|
+
let packet = heldKey;
|
|
517
|
+
heldKey = null;
|
|
518
|
+
if (!packet) {
|
|
519
|
+
const reading = readPacket();
|
|
520
|
+
reading.catch(() => undefined);
|
|
521
|
+
packet = await Promise.race([reading, cancellation]);
|
|
522
|
+
if (cancelled || disposed)
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
if (packet) {
|
|
526
|
+
if (stalled && packet.type === "key" && fed > delivered) {
|
|
527
|
+
// Every frame before this key frame is in the decoder, so a
|
|
528
|
+
// flush now returns them all and loses none.
|
|
529
|
+
heldKey = packet;
|
|
530
|
+
flush(false);
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
runDecoder.decode(packet.toEncodedVideoChunk());
|
|
534
|
+
fed += 1;
|
|
535
|
+
lastProgressAt = performance.now();
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
packetsDone = true;
|
|
539
|
+
}
|
|
540
|
+
if (packetsDone) {
|
|
541
|
+
flush(true);
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
if (!stalled &&
|
|
545
|
+
fed - delivered >= MAX_FRAMES_IN_FLIGHT &&
|
|
546
|
+
runDecoder.decodeQueueSize === 0 &&
|
|
547
|
+
performance.now() - lastProgressAt >=
|
|
548
|
+
STALLED_DECODER_FLUSH_MILLISECONDS) {
|
|
549
|
+
stalled = true;
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
await Promise.race([sleep(), cancellation]);
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
cancel: () => state.cancel(),
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
return {
|
|
559
|
+
frameCount,
|
|
560
|
+
height: options.height,
|
|
561
|
+
times: timeline.times,
|
|
562
|
+
width: options.width,
|
|
563
|
+
keyIndexAtOrBefore(index) {
|
|
564
|
+
const keys = timeline.keyIndices;
|
|
565
|
+
let low = 0;
|
|
566
|
+
let high = keys.length - 1;
|
|
567
|
+
let found = 0;
|
|
568
|
+
while (low <= high) {
|
|
569
|
+
const middle = (low + high) >> 1;
|
|
570
|
+
if (keys[middle] <= index) {
|
|
571
|
+
found = keys[middle];
|
|
572
|
+
low = middle + 1;
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
high = middle - 1;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return found;
|
|
579
|
+
},
|
|
580
|
+
decode(fromIndex, runOptions = {}) {
|
|
581
|
+
if (disposed)
|
|
582
|
+
throw new Error("The depth preview track is closed.");
|
|
583
|
+
current?.cancel();
|
|
584
|
+
return startRun(fromIndex, runOptions);
|
|
585
|
+
},
|
|
586
|
+
lumaPath: () => lumaPath,
|
|
587
|
+
dispose() {
|
|
588
|
+
if (disposed)
|
|
589
|
+
return;
|
|
590
|
+
disposed = true;
|
|
591
|
+
current?.cancel();
|
|
592
|
+
current = null;
|
|
593
|
+
closeDecoder();
|
|
594
|
+
options.dispose?.();
|
|
595
|
+
},
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function isAbortError(error) {
|
|
599
|
+
return (typeof error === "object" &&
|
|
600
|
+
error !== null &&
|
|
601
|
+
error.name === "AbortError");
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
var depthPreviewTrack = /*#__PURE__*/Object.freeze({
|
|
605
|
+
__proto__: null,
|
|
606
|
+
DECODER_SUPPORT_MILLISECONDS: DECODER_SUPPORT_MILLISECONDS,
|
|
607
|
+
createDepthPreviewTrackReader: createDepthPreviewTrackReader,
|
|
608
|
+
openDepthPreviewTrack: openDepthPreviewTrack
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
export { DECODER_SUPPORT_MILLISECONDS as D, depthPreviewTrack as d, openDepthPreviewTrack as o, withinDecoderDeadline as w };
|
|
612
|
+
//# sourceMappingURL=depth-preview-track-BvgwNEE9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depth-preview-track-BvgwNEE9.js","sources":["../src/render-preparation/depth/preview-luma.ts","../src/media/decoder-deadline.ts","../src/media/track-frame-index.ts","../src/media/depth-preview-track.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;AAAA;AACA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAS;IAC3C,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;AACP,CAAA,CAAC;AACF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAyBrE;;;;AAIG;AACI,eAAe,kBAAkB,CACtC,KAAiB,EACjB,OAAgC,EAChC,UAAA,GAAgC,IAAI,EAAA;AAEpC,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,IAAI;QAChC,MAAM,EAAE,KAAK,CAAC,WAAW;QACzB,KAAK,EAAE,KAAK,CAAC,UAAU;AACvB,QAAA,CAAC,EAAE,CAAC;AACJ,QAAA,CAAC,EAAE,CAAC;KACL;AACD,IAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;AAC9B,IAAA,MAAM,MAAM,G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AI;AACd,YAAA,YAAY,EAAE;AACd,YAAA,OAAO,CAAC,OAAO,IAAI;QACrB,CAAC;KACF;AACH;AAEA,SAAS,YAAY,CAAC,KAAc,EAAA;AAClC,IAAA,QACE,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,KAAK,KAAK,IAAI;AACb,QAAA,KAA4B,CAAC,IAAI,KAAK,YAAY;AAEvD;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunked-detection-frame-source.d.ts","sourceRoot":"","sources":["../../src/detections/chunked-detection-frame-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAIlC,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"chunked-detection-frame-source.d.ts","sourceRoot":"","sources":["../../src/detections/chunked-detection-frame-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAIlC,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AA6B7B,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,kCAAkC,GAC1C,oBAAoB,CA2EtB"}
|
package/dist/editing.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* the browser canvas mask brush; hosts own persistence and undo.
|
|
4
4
|
*/
|
|
5
5
|
export { AnnotationFrameMutationKind, AnnotationGeometryKind, AnnotationGestureStateKind, AnnotationHandleKind, DetectionMaskPayloadFormat, applyAnnotationHandleDrag, centerRectToTopLeftRect, computeDetectionMaskRect, computeMaskBounds, convertDetectionBoxToMask, convertDetectionBoxToPolygon, convertDetectionMaskToBox, convertDetectionMaskToPolygon, convertDetectionPolygonToBox, convertDetectionPolygonToMask, createAnnotationEditingEngine, createEditableAnnotationFrameSession, decodeDetectionMaskPayload, deleteAnnotationVertex, detectMaskBorders, distanceToSegment, encodeBinaryMask, encodeCompressedRleCounts, encodeDetectionMaskPayload, extractMaskContour, extractMaskRectRuns, getAnnotationHandles, isDeflatedBase64DetectionMaskPayload, mergeDetectionMasks, mergeDetectionPolygonsByClass, offsetDetection, pickAnnotationHandle, pointInPolygon, polygonArea, polygonToRect, rasterizePolygonToMask, rasterizeRectToMask, rectToPolygon, topLeftRectToCenterRect, } from "supervision-js-core";
|
|
6
|
-
export type { AnnotationCreationTool, AnnotationEditingEngine, AnnotationEditingEngineOptions, AnnotationEditingPreviewStyleContext, AnnotationEditingState, AnnotationFrameMutation, AnnotationFrameMutationListener, AnnotationHandleDefinition, AnnotationOverlayStyle, AnnotationPointerInput, DetectionId, EditableDetection, DetectionMaskCompressionCodec, EditableAnnotationFrameSession, MaskRectRun, MediaDimensions, PreviewOverlayData, PreviewOverlayPoint, } from "supervision-js-core";
|
|
6
|
+
export type { AnnotationCreationTool, AnnotationEditingEngine, AnnotationEditingEngineOptions, AnnotationEditingPreviewStyleContext, AnnotationEditingState, AnnotationFrameMutation, AnnotationFrameMutationListener, AnnotationHandleDefinition, AnnotationOverlayStyle, AnnotationPointerInput, DraftUndoAnnotationEditingEngine, DetectionId, EditableDetection, DetectionMaskCompressionCodec, EditableAnnotationFrameSession, MaskRectRun, MediaDimensions, PreviewOverlayData, PreviewOverlayPoint, } from "supervision-js-core";
|
|
7
7
|
export { MaskBrushMode, createMaskBrushEditor, type MaskBrushEditor, type MaskBrushPreviewOptions, } from "#editing/mask-brush-editor";
|
|
8
8
|
//# sourceMappingURL=editing.d.ts.map
|
package/dist/editing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editing.d.ts","sourceRoot":"","sources":["../src/editing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,oCAAoC,EACpC,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oCAAoC,EACpC,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,6BAA6B,EAC7B,8BAA8B,EAC9B,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,uBAAuB,GAC7B,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"editing.d.ts","sourceRoot":"","sources":["../src/editing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,oCAAoC,EACpC,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oCAAoC,EACpC,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,gCAAgC,EAChC,WAAW,EACX,iBAAiB,EACjB,6BAA6B,EAC7B,8BAA8B,EAC9B,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,uBAAuB,GAC7B,MAAM,4BAA4B,CAAC"}
|