supervision 0.1.7 → 0.2.0-next.1
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/constants/media-renderer.d.ts +3 -0
- package/dist/constants/media-renderer.d.ts.map +1 -1
- package/dist/detections/chunked-detection-frame-source.d.ts.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9281 -5038
- package/dist/index.js.map +1 -1
- package/dist/mask-preparation.worker.js +409 -185
- package/dist/mask-preparation.worker.js.map +1 -1
- package/dist/media/display-pixel-ratio.d.ts +15 -0
- package/dist/media/display-pixel-ratio.d.ts.map +1 -0
- package/dist/media/engine-import-failure.d.ts +16 -0
- package/dist/media/engine-import-failure.d.ts.map +1 -0
- package/dist/media/media-errors.d.ts +6 -0
- package/dist/media/media-errors.d.ts.map +1 -1
- package/dist/media/media-normalization.d.ts.map +1 -1
- package/dist/media/media-probe.d.ts.map +1 -1
- package/dist/media/media-source-state.d.ts.map +1 -1
- package/dist/media/media-source.d.ts +17 -0
- package/dist/media/media-source.d.ts.map +1 -1
- package/dist/media/mediabunny-media-source.d.ts.map +1 -1
- package/dist/media/video-engine-media-source.d.ts +54 -0
- package/dist/media/video-engine-media-source.d.ts.map +1 -0
- package/dist/media/video-engine-media-source.js +3 -0
- package/dist/media/video-engine-media-source.js.map +1 -0
- package/dist/playback/media-playback-controller.d.ts +7 -1
- package/dist/playback/media-playback-controller.d.ts.map +1 -1
- package/dist/render-preparation/mask-frame-artifact.d.ts +48 -12
- package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
- package/dist/render-preparation/mask-frame-compositor.d.ts +12 -5
- 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-preparation-worker-count.d.ts +4 -4
- package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +13 -3
- package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
- package/dist/render-preparation/prepared-render-window.d.ts +44 -2
- package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
- package/dist/render-preparation/prepared-window-timeline.d.ts +2 -6
- package/dist/render-preparation/prepared-window-timeline.d.ts.map +1 -1
- package/dist/renderers/injected-pixi.d.ts +38 -0
- package/dist/renderers/injected-pixi.d.ts.map +1 -0
- package/dist/renderers/mask-palette.d.ts +14 -0
- package/dist/renderers/mask-palette.d.ts.map +1 -0
- package/dist/renderers/mask-vertex.d.ts +14 -0
- package/dist/renderers/mask-vertex.d.ts.map +1 -0
- package/dist/renderers/media-renderer-core.d.ts +9 -0
- package/dist/renderers/media-renderer-core.d.ts.map +1 -1
- package/dist/renderers/media-renderer-scene.d.ts +50 -2
- package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
- package/dist/renderers/media-renderer-state.d.ts +20 -1
- package/dist/renderers/media-renderer-state.d.ts.map +1 -1
- package/dist/renderers/media-renderer-transport.d.ts +72 -0
- package/dist/renderers/media-renderer-transport.d.ts.map +1 -0
- package/dist/renderers/pixi-box-layer.d.ts +5 -0
- package/dist/renderers/pixi-box-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-focus-layer.d.ts +19 -2
- package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-frame-present.d.ts +77 -0
- package/dist/renderers/pixi-frame-present.d.ts.map +1 -0
- package/dist/renderers/pixi-id-mask-shader.d.ts +6 -25
- package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
- package/dist/renderers/pixi-interaction-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-interaction-presentation-layer.d.ts +12 -2
- package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-mask-halo.d.ts +18 -23
- package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
- package/dist/renderers/pixi-mask-layer.d.ts +94 -32
- package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-media-scene.d.ts +67 -0
- package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
- package/dist/renderers/pixi-polygon-layer.d.ts +9 -2
- package/dist/renderers/pixi-polygon-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-region-coverage-mask.d.ts +62 -0
- package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -0
- package/dist/renderers/pixi-region-effect.d.ts +42 -0
- package/dist/renderers/pixi-region-effect.d.ts.map +1 -0
- package/dist/renderers/pixi-region-layer.d.ts +43 -2
- package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
- package/dist/renderers/pixi-shader-lifecycle.d.ts +14 -0
- package/dist/renderers/pixi-shader-lifecycle.d.ts.map +1 -0
- package/dist/renderers/pixi-vector-layer.d.ts.map +1 -1
- package/dist/renderers/prepared-annotation-window.d.ts +47 -0
- package/dist/renderers/prepared-annotation-window.d.ts.map +1 -0
- package/dist/renderers/presented-frame-channel.d.ts +138 -0
- package/dist/renderers/presented-frame-channel.d.ts.map +1 -0
- package/dist/renderers/scene-render-scheduler.d.ts +20 -0
- package/dist/renderers/scene-render-scheduler.d.ts.map +1 -0
- package/dist/sessions/media-session-defaults.d.ts +10 -6
- package/dist/sessions/media-session-defaults.d.ts.map +1 -1
- package/dist/sessions/media-session-media.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 +73 -4
- package/dist/tracking.worker.js.map +1 -1
- package/dist/types/media-normalization.d.ts +34 -0
- package/dist/types/media-normalization.d.ts.map +1 -1
- package/dist/types/media-renderer.d.ts +31 -1
- package/dist/types/media-renderer.d.ts.map +1 -1
- package/dist/types/media-session.d.ts +89 -15
- package/dist/types/media-session.d.ts.map +1 -1
- package/dist/types/render-preparation.d.ts +149 -5
- package/dist/types/render-preparation.d.ts.map +1 -1
- package/dist/video-engine-media-source-CUXnOJOV.js +450 -0
- package/dist/video-engine-media-source-CUXnOJOV.js.map +1 -0
- package/dist/web-video-engine/analysis-session.d.ts +75 -0
- package/dist/web-video-engine/analysis.d.ts +6 -0
- package/dist/web-video-engine/analysis.js +1850 -0
- package/dist/web-video-engine/cache-budget.d.ts +18 -0
- package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts +89 -0
- package/dist/web-video-engine/clock.d.ts +82 -0
- package/dist/web-video-engine/constants.d.ts +261 -0
- package/dist/web-video-engine/create-scrub-cursor.d.ts +65 -0
- package/dist/web-video-engine/decode-resolution.d.ts +114 -0
- package/dist/web-video-engine/decode-scheduler.d.ts +371 -0
- package/dist/web-video-engine/decode-session.d.ts +283 -0
- package/dist/web-video-engine/decode-source.d.ts +258 -0
- package/dist/web-video-engine/diagnostics-store.d.ts +17 -0
- package/dist/web-video-engine/diagnostics.d.ts +316 -0
- package/dist/web-video-engine/embedded-engine-worker.d.ts +1 -0
- package/dist/web-video-engine/engine-core.d.ts +269 -0
- package/dist/web-video-engine/engine.d.ts +25 -0
- package/dist/web-video-engine/engine.js +912 -0
- package/dist/web-video-engine/engine.worker.d.ts +1 -0
- package/dist/web-video-engine/engine.worker.js +33624 -0
- package/dist/web-video-engine/frame-cache.d.ts +236 -0
- package/dist/web-video-engine/frame-extractor.d.ts +27 -0
- package/dist/web-video-engine/frame-timeline-DreEwsRY.js +616 -0
- package/dist/web-video-engine/frame-timeline.d.ts +80 -0
- package/dist/web-video-engine/frame-walker.d.ts +73 -0
- package/dist/web-video-engine/index.d.ts +13 -0
- package/dist/web-video-engine/index.d.ts.map +1 -0
- package/dist/web-video-engine/index.js +3 -0
- package/dist/web-video-engine/index.js.map +1 -0
- package/dist/web-video-engine/key-packet.d.ts +64 -0
- package/dist/web-video-engine/keyframe-index.d.ts +90 -0
- package/dist/web-video-engine/mirror-store.d.ts +55 -0
- package/dist/web-video-engine/renderer.d.ts +93 -0
- package/dist/web-video-engine/rotation.d.ts +34 -0
- package/dist/web-video-engine/scrub-controller.d.ts +375 -0
- package/dist/web-video-engine/scrub-cursor.d.ts +347 -0
- package/dist/web-video-engine/scrub-trajectory.d.ts +29 -0
- package/dist/web-video-engine/source-residency.d.ts +91 -0
- package/dist/web-video-engine/trace-recorder.d.ts +163 -0
- package/dist/web-video-engine/types.d.ts +200 -0
- package/dist/web-video-engine/video-engine.d.ts +437 -0
- package/dist/web-video-engine/webgpu-renderer.d.ts +61 -0
- package/dist/web-video-engine/worker-bridge.d.ts +11 -0
- package/dist/web-video-engine/worker-dispatch.d.ts +16 -0
- package/dist/web-video-engine/worker-protocol.d.ts +282 -0
- package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/detections/composite-detection-frame-source.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.d.ts +5 -4
- package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/index.js +1167 -280
- package/node_modules/supervision-js-core/dist/index.js.map +1 -1
- package/node_modules/supervision-js-core/dist/styles/default-annotation-presentation.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts +4 -36
- package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts +5 -0
- package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts +92 -7
- package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +191 -17
- package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +83 -5
- package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts +2 -0
- package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts +32 -0
- package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/detection-conversions.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts +5 -0
- package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts +9 -0
- package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts +18 -0
- package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts.map +1 -0
- package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +34 -2
- package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
- package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts +7 -0
- package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts.map +1 -0
- package/package.json +24 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-interaction-presentation-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-interaction-presentation-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pixi-interaction-presentation-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-interaction-presentation-layer.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAUnF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,QAAQ,IAAI,YAAY,EACxB,WAAW,IAAI,eAAe,EAC9B,IAAI,IAAI,QAAQ,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C,aAAa,CAAC,UAAU,EAAE;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,GAAG,aAAa,CAAC;IAClB,SAAS,CAAC,OAAO,EAAE,4CAA4C,GAAG,IAAI,CAAC;IACvE,mBAAmB,CACjB,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CAAC;IACR,OAAO,IAAI,IAAI,CAAC;CACjB;AASD,wBAAgB,sCAAsC,CAAC,OAAO,EAAE;IAC9D,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAC9C,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC;IAChD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC;CACjE,GAAG,gCAAgC,CAyTnC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
import type { InjectedMeshConstructor, InjectedMeshGeometryConstructor, InjectedShaderFactory } from "#renderers/injected-pixi";
|
|
2
|
+
import type { Detection, MaskHaloDrawInstruction, MaskHaloStyle, MaskHaloStyleContext, MaskStyle } from "supervision-js-core";
|
|
1
3
|
import type { Container as PixiContainer, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
|
|
2
4
|
type PixiMaskHaloMesh = PixiMesh<PixiMeshGeometry, PixiShader>;
|
|
3
5
|
type ContainerConstructor = new () => PixiContainer;
|
|
4
|
-
type MeshConstructor = new (options: {
|
|
5
|
-
geometry: PixiMeshGeometry;
|
|
6
|
-
shader: PixiShader;
|
|
7
|
-
}) => PixiMaskHaloMesh;
|
|
8
6
|
type ImageSourceConstructor = new (options: {
|
|
9
7
|
autoGenerateMipmaps?: boolean;
|
|
10
8
|
dynamic: boolean;
|
|
@@ -13,22 +11,6 @@ type ImageSourceConstructor = new (options: {
|
|
|
13
11
|
scaleMode?: "linear" | "nearest";
|
|
14
12
|
width: number;
|
|
15
13
|
}) => PixiImageSource;
|
|
16
|
-
type MeshGeometryConstructor = new (options: {
|
|
17
|
-
indices: Uint32Array;
|
|
18
|
-
positions: Float32Array;
|
|
19
|
-
shrinkBuffersToFit: boolean;
|
|
20
|
-
topology: "triangle-list";
|
|
21
|
-
uvs: Float32Array;
|
|
22
|
-
}) => PixiMeshGeometry;
|
|
23
|
-
type ShaderFactory = {
|
|
24
|
-
from(options: {
|
|
25
|
-
gl: {
|
|
26
|
-
fragment: string;
|
|
27
|
-
vertex: string;
|
|
28
|
-
};
|
|
29
|
-
resources: Record<string, unknown>;
|
|
30
|
-
}): PixiShader;
|
|
31
|
-
};
|
|
32
14
|
type UniformGroupConstructor = new (uniforms: Record<string, {
|
|
33
15
|
type: "f32";
|
|
34
16
|
value: number;
|
|
@@ -37,6 +19,19 @@ type UniformGroupConstructor = new (uniforms: Record<string, {
|
|
|
37
19
|
type: "vec4<f32>";
|
|
38
20
|
value: Float32Array;
|
|
39
21
|
}>) => PixiUniformGroup;
|
|
22
|
+
/**
|
|
23
|
+
* The halo a detection actually paints, or `undefined`. A style may answer an
|
|
24
|
+
* instruction that draws nothing, and both the coverage the halo prepares and
|
|
25
|
+
* the passes it renders have to read that the same way: the raster carries one
|
|
26
|
+
* detection id per pixel, so a detection admitted into the coverage but never
|
|
27
|
+
* painted still claims its pixels and buries the ids the glow is drawn from.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolvePaintedMaskHalo(haloStyle: MaskHaloStyle, detection: Detection, context: MaskHaloStyleContext): MaskHaloDrawInstruction | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The mask coverage a halo-only presentation prepares. Nothing here reaches the
|
|
32
|
+
* screen, so the fill colour and alpha are arbitrary.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createMaskHaloPreparationStyle(haloStyle: MaskHaloStyle, artifactKey: string): MaskStyle;
|
|
40
35
|
export interface PixiBlurFilterLike {
|
|
41
36
|
strength: number;
|
|
42
37
|
}
|
|
@@ -75,9 +70,9 @@ export declare function createPixiMaskHaloRenderer(options: {
|
|
|
75
70
|
readonly Container: ContainerConstructor;
|
|
76
71
|
readonly Rectangle: RectangleConstructor;
|
|
77
72
|
readonly ImageSource: ImageSourceConstructor;
|
|
78
|
-
readonly Mesh:
|
|
79
|
-
readonly MeshGeometry:
|
|
80
|
-
readonly Shader:
|
|
73
|
+
readonly Mesh: InjectedMeshConstructor<PixiMaskHaloMesh>;
|
|
74
|
+
readonly MeshGeometry: InjectedMeshGeometryConstructor;
|
|
75
|
+
readonly Shader: InjectedShaderFactory;
|
|
81
76
|
readonly UniformGroup: UniformGroupConstructor;
|
|
82
77
|
readonly mediaHeight: number;
|
|
83
78
|
readonly mediaWidth: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-mask-halo.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-mask-halo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pixi-mask-halo.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-mask-halo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACv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AC;IACvC,QAAQ,CAAC,YAAY,EAAE,uBAAuB,CAAC;IAC/C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GAAG,oBAAoB,CA6JvB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,CAChB,MAAM,EACN;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CACnD,GACA,YAAY,CAkBd"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type PreparedRenderTimelineContext } from "#render-preparation/prepared-render-window";
|
|
2
|
-
import { type
|
|
2
|
+
import { IdMaskTextureFormat, type PreparedIdMaskFrame, type PreparedRegionMaskCoverageEntry, type PreparedRegionMaskCoverageFrame } from "#render-preparation/mask-frame-artifact";
|
|
3
3
|
import type { BufferedDetectionTimeline } from "supervision-js-core";
|
|
4
4
|
import type { DetectionPickPoint, DetectionPickResult } from "supervision-js-core";
|
|
5
5
|
import type { MaskHaloStyle, MaskStyle } from "supervision-js-core";
|
|
6
|
-
import
|
|
6
|
+
import { RenderPreparationArtifactKind } from "#types/render-preparation";
|
|
7
|
+
import type { RenderPreparationMaskFrameOptions, RenderPreparationOptions, ResolvedRenderPreparationGateThresholds } from "#types/render-preparation";
|
|
8
|
+
import type { InjectedMeshConstructor, InjectedMeshGeometryConstructor, InjectedShaderFactory } from "#renderers/injected-pixi";
|
|
9
|
+
import type { PresentedFrameId } from "./presented-frame-channel";
|
|
7
10
|
import type { SerializableMaskInstruction } from "#render-preparation/mask-preparation-worker-protocol";
|
|
8
|
-
import type { Container as PixiContainer, ImageSource as PixiImageSource, Mesh as PixiMesh,
|
|
11
|
+
import type { BufferImageSource as PixiBufferImageSource, Container as PixiContainer, ImageSource as PixiImageSource, Mesh as PixiMesh, Sprite as PixiSprite, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
|
|
9
12
|
type ImageSourceConstructor = new (options: {
|
|
10
13
|
autoGenerateMipmaps?: boolean;
|
|
11
14
|
dynamic: boolean;
|
|
@@ -14,9 +17,18 @@ type ImageSourceConstructor = new (options: {
|
|
|
14
17
|
scaleMode?: "linear" | "nearest";
|
|
15
18
|
width: number;
|
|
16
19
|
}) => PixiImageSource;
|
|
20
|
+
export type BufferImageSourceConstructor = new (options: {
|
|
21
|
+
autoGenerateMipmaps?: boolean;
|
|
22
|
+
dynamic: boolean;
|
|
23
|
+
format: IdMaskTextureFormat;
|
|
24
|
+
height: number;
|
|
25
|
+
resource: Uint8Array;
|
|
26
|
+
scaleMode?: "linear" | "nearest";
|
|
27
|
+
width: number;
|
|
28
|
+
}) => PixiBufferImageSource;
|
|
17
29
|
type TextureConstructor = new (options: {
|
|
18
30
|
dynamic: boolean;
|
|
19
|
-
source: PixiImageSource;
|
|
31
|
+
source: PixiImageSource | PixiBufferImageSource;
|
|
20
32
|
}) => PixiTexture;
|
|
21
33
|
type TextureConstructorWithEmpty = TextureConstructor & {
|
|
22
34
|
readonly EMPTY: PixiTexture;
|
|
@@ -25,26 +37,6 @@ type SpriteConstructor = new (options?: {
|
|
|
25
37
|
texture?: PixiTexture;
|
|
26
38
|
}) => PixiSprite;
|
|
27
39
|
type ContainerConstructor = new () => PixiContainer;
|
|
28
|
-
type MeshConstructor = new (options: {
|
|
29
|
-
geometry: PixiMeshGeometry;
|
|
30
|
-
shader: PixiShader;
|
|
31
|
-
}) => PixiMesh;
|
|
32
|
-
type MeshGeometryConstructor = new (options: {
|
|
33
|
-
indices: Uint32Array;
|
|
34
|
-
positions: Float32Array;
|
|
35
|
-
shrinkBuffersToFit: boolean;
|
|
36
|
-
topology: "triangle-list";
|
|
37
|
-
uvs: Float32Array;
|
|
38
|
-
}) => PixiMeshGeometry;
|
|
39
|
-
type ShaderFactory = {
|
|
40
|
-
from(options: {
|
|
41
|
-
gl: {
|
|
42
|
-
fragment: string;
|
|
43
|
-
vertex: string;
|
|
44
|
-
};
|
|
45
|
-
resources: Record<string, unknown>;
|
|
46
|
-
}): PixiShader;
|
|
47
|
-
};
|
|
48
40
|
type UniformGroupConstructor = new (uniforms: Record<string, {
|
|
49
41
|
type: "f32";
|
|
50
42
|
value: number;
|
|
@@ -57,31 +49,95 @@ type UniformGroupConstructor = new (uniforms: Record<string, {
|
|
|
57
49
|
type: "vec2<f32>" | "vec4<f32>";
|
|
58
50
|
value: Float32Array;
|
|
59
51
|
}>) => PixiUniformGroup;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the frame on screen can answer for detection ids. Hover, selection
|
|
54
|
+
* and focus highlighting all cut their shapes out of the id raster, so a frame
|
|
55
|
+
* that reaches the screen without one draws its whole picture while those three
|
|
56
|
+
* have nothing to cut from.
|
|
57
|
+
*/
|
|
58
|
+
export declare enum PixiMaskLayerIdMaskStatus {
|
|
59
|
+
/** A mask frame is on screen and carries no id raster. */
|
|
60
|
+
Absent = "absent",
|
|
61
|
+
/** No mask frame is on screen. */
|
|
62
|
+
None = "none",
|
|
63
|
+
/** The id raster is on screen. */
|
|
64
|
+
Present = "present"
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What the mask layer has on screen after its last draw.
|
|
68
|
+
*
|
|
69
|
+
* `drawnFrameTime` is the detection frame the visible raster belongs to, and it
|
|
70
|
+
* is the frame the rest of the present drew or the layer draws nothing.
|
|
71
|
+
* `drawnFrameId` names the producer frame that raster was accepted for, and is
|
|
72
|
+
* null on a draw the producer did not drive: a pull-path sample and a redraw at
|
|
73
|
+
* a resting playhead both carry a media time and no frame identity.
|
|
74
|
+
*/
|
|
75
|
+
export interface PixiMaskLayerState {
|
|
76
|
+
readonly drawnFrameTime: number | null;
|
|
77
|
+
readonly drawnFrameKey: string | null;
|
|
78
|
+
readonly drawnFrameId: PresentedFrameId | null;
|
|
79
|
+
readonly idMaskStatus: PixiMaskLayerIdMaskStatus;
|
|
80
|
+
}
|
|
60
81
|
export interface PixiMaskLayer {
|
|
61
82
|
createSprite(dimensions: {
|
|
62
83
|
width: number;
|
|
63
84
|
height: number;
|
|
64
85
|
}): PixiContainer | PixiSprite;
|
|
65
|
-
drawFrame(mediaTime: number): void;
|
|
66
|
-
|
|
86
|
+
drawFrame(mediaTime: number, presentedFrameId?: PresentedFrameId | null): void;
|
|
87
|
+
/** The state the last drawFrame or clearFrame left on screen. */
|
|
88
|
+
getDrawnState(): PixiMaskLayerState;
|
|
89
|
+
/** Puts the media time in front of the cook without drawing it. */
|
|
90
|
+
prepareFrame(mediaTime: number): void;
|
|
91
|
+
clearFrame(): void;
|
|
92
|
+
isArtifactPrepared(mediaTime: number): boolean;
|
|
93
|
+
/** Frames this layer's preparation has finished, counted up over its life. */
|
|
94
|
+
getPreparationProgress(): number;
|
|
95
|
+
/** Whether `waitForRenderPreparation` would wait, scheduling nothing. */
|
|
96
|
+
needsRenderPreparationWait(mediaTime: number, options: ResolvedRenderPreparationGateThresholds): boolean;
|
|
97
|
+
waitForRenderPreparation(mediaTime: number, options: ResolvedRenderPreparationGateThresholds, signal?: AbortSignal): Promise<void>;
|
|
67
98
|
pickDetectionAtPoint(point: DetectionPickPoint, mediaTime: number): DetectionPickResult | null;
|
|
68
|
-
|
|
99
|
+
/**
|
|
100
|
+
* The raster on screen, for a caller drawing the same detection frame it
|
|
101
|
+
* belongs to. Both of these are read by layers that pair the raster to
|
|
102
|
+
* detections by position, so a raster from any other frame pairs one frame's
|
|
103
|
+
* silhouettes to another frame's detections.
|
|
104
|
+
*/
|
|
105
|
+
getActiveIdMaskFrameTexture(detectionFrameTime: number | null): PixiActiveIdMaskFrameTexture | null;
|
|
106
|
+
getActiveRegionMaskCoverage(detectionFrameTime: number | null): PixiActiveRegionMaskCoverage | null;
|
|
107
|
+
setPlaybackActive(active: boolean): void;
|
|
69
108
|
setTimelineContext(context: PreparedRenderTimelineContext): void;
|
|
70
109
|
setMaskStyle(maskStyle: MaskStyle | null | undefined): void;
|
|
71
110
|
setMaskHaloStyle(maskHaloStyle: MaskHaloStyle | null | undefined): void;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the mask fill reaches the screen. Preparation runs either way, so
|
|
113
|
+
* consumers of the id raster still get an artifact while the fill is off.
|
|
114
|
+
*/
|
|
115
|
+
setFillVisible(visible: boolean): void;
|
|
72
116
|
destroy(): void;
|
|
73
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Cook-only style for consumers that read detection ids out of the raster
|
|
120
|
+
* instead of drawing the fill. Ids come from the detection index, so the colour
|
|
121
|
+
* and alpha here never reach the screen.
|
|
122
|
+
*/
|
|
123
|
+
export declare const ID_MASK_PREPARATION_STYLE: MaskStyle;
|
|
124
|
+
export type IdMaskDisplayBox = NonNullable<RenderPreparationMaskFrameOptions["display"]>;
|
|
74
125
|
export interface PixiActiveIdMaskFrameTexture {
|
|
75
|
-
readonly frame:
|
|
126
|
+
readonly frame: PreparedIdMaskFrame;
|
|
76
127
|
readonly texture: PixiTexture;
|
|
77
128
|
}
|
|
129
|
+
export interface PixiActiveRegionMaskCoverage {
|
|
130
|
+
readonly frame: PreparedRegionMaskCoverageFrame;
|
|
131
|
+
getTexture(entry: PreparedRegionMaskCoverageEntry): PixiTexture | undefined;
|
|
132
|
+
}
|
|
78
133
|
export declare function createPixiMaskLayer(options: {
|
|
79
134
|
readonly artifactKind?: RenderPreparationArtifactKind;
|
|
135
|
+
readonly BufferImageSource?: BufferImageSourceConstructor;
|
|
80
136
|
readonly Container?: ContainerConstructor;
|
|
81
137
|
readonly ImageSource: ImageSourceConstructor;
|
|
82
|
-
readonly Mesh?:
|
|
83
|
-
readonly MeshGeometry?:
|
|
84
|
-
readonly Shader?:
|
|
138
|
+
readonly Mesh?: InjectedMeshConstructor<PixiMesh>;
|
|
139
|
+
readonly MeshGeometry?: InjectedMeshGeometryConstructor;
|
|
140
|
+
readonly Shader?: InjectedShaderFactory;
|
|
85
141
|
readonly Sprite: SpriteConstructor;
|
|
86
142
|
readonly Texture: TextureConstructorWithEmpty;
|
|
87
143
|
readonly UniformGroup?: UniformGroupConstructor;
|
|
@@ -95,7 +151,13 @@ export declare function createPixiMaskLayer(options: {
|
|
|
95
151
|
readonly detectionTimeline: BufferedDetectionTimeline;
|
|
96
152
|
readonly maskHaloStyle?: MaskHaloStyle | null;
|
|
97
153
|
readonly maskStyle: MaskStyle;
|
|
98
|
-
readonly
|
|
154
|
+
readonly onPreparedWindowChange?: () => void;
|
|
155
|
+
/**
|
|
156
|
+
* Whether the renderer takes a single-channel upload whose rows are not on a
|
|
157
|
+
* four-byte boundary. Answered when the first raster is uploaded, since the
|
|
158
|
+
* renderer this scene ends up with is not known when the layer is built.
|
|
159
|
+
*/
|
|
160
|
+
readonly acceptsUnalignedTextureRows?: () => boolean;
|
|
99
161
|
readonly renderPreparation?: RenderPreparationOptions;
|
|
100
162
|
readonly resolveInstructions?: (options: {
|
|
101
163
|
readonly frame: import("supervision-js-core").DetectionFrame;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-mask-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-mask-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pixi-mask-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-mask-layer.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,mBAAmB,EAGnB,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EAErC,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC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AM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IACtD,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,2BAA2B,CAAC,EAAE,MAAM,OAAO,CAAC;IACrD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IACtD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE;QACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,qBAAqB,EAAE,cAAc,CAAC;QAC7D,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;QAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,KAAK,SAAS,2BAA2B,EAAE,CAAC;CAC9C,GAAG,aAAa,CA6wBhB"}
|
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
import type { AnnotationVisibility } from "supervision-js-core";
|
|
2
2
|
import type { MediaRendererScene, MediaRendererSceneOptions } from "./media-renderer-scene";
|
|
3
3
|
export declare function observePixiContainerResize(container: HTMLElement, resize: () => void): () => void;
|
|
4
|
+
type MediaCompositor = {
|
|
5
|
+
upload(frame: VideoFrame): void;
|
|
6
|
+
destroy(): void;
|
|
7
|
+
};
|
|
8
|
+
/** The binding a compositor points at whichever texture holds the last frame. */
|
|
9
|
+
export interface MediaGpuTextureSource {
|
|
10
|
+
resize(width: number, height: number, resolution: number): void;
|
|
11
|
+
updateGPUTexture(texture: GPUTexture): void;
|
|
12
|
+
}
|
|
13
|
+
export interface MediaCompositorOptions {
|
|
14
|
+
readonly device: GPUDevice;
|
|
15
|
+
readonly height: number;
|
|
16
|
+
readonly width: number;
|
|
17
|
+
/**
|
|
18
|
+
* Puts the compositor's first texture on screen and returns the binding every
|
|
19
|
+
* later texture replaces it through.
|
|
20
|
+
*/
|
|
21
|
+
readonly attach: (texture: GPUTexture) => MediaGpuTextureSource;
|
|
22
|
+
/** Runs after a decode of a new size swapped the texture underneath. */
|
|
23
|
+
readonly onTextureReplaced: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Two ways to drive the same layer stack.
|
|
27
|
+
*
|
|
28
|
+
* Pull presentation is the default: the renderer asks the media source for the
|
|
29
|
+
* sample it wants, hands it to `presentSample`, and Pixi's ticker paints the
|
|
30
|
+
* scene every frame.
|
|
31
|
+
*
|
|
32
|
+
* Push presentation engages when the opened source carries a presented-frame
|
|
33
|
+
* channel. The producer then decides which frame is on screen and announces it,
|
|
34
|
+
* so the ticker paints nothing and every render is an explicit answer to a
|
|
35
|
+
* change: a presented frame, a layer turned on or off, restyling, hover or
|
|
36
|
+
* selection, a viewport move, a resize, or the swapchain coming back after the
|
|
37
|
+
* tab was hidden. A notification that describes what is already drawn renders
|
|
38
|
+
* nothing, so a paused scene nobody touches renders nothing at all.
|
|
39
|
+
*
|
|
40
|
+
* The focus layer's fade is not an exception to that. It advances with the
|
|
41
|
+
* presented media time, so it fades during playback and is applied at once when
|
|
42
|
+
* a hover or selection arrives with no frame behind it: paused focus is static,
|
|
43
|
+
* and no animation keeps the scene rendering on its own.
|
|
44
|
+
*/
|
|
4
45
|
export declare function createPixiMediaScene(options: MediaRendererSceneOptions): Promise<MediaRendererScene>;
|
|
5
46
|
export declare function canReuseMaskVisibilityArtifacts(previous: AnnotationVisibility | undefined, next: AnnotationVisibility | undefined): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Copies presented frames into a GPU texture Pixi samples, with no CPU readback
|
|
49
|
+
* in between. A decode whose size changed gets a new texture, and the swap is
|
|
50
|
+
* all-or-nothing: exactly one of the two textures survives it.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createMediaCompositor(options: MediaCompositorOptions): MediaCompositor;
|
|
53
|
+
/**
|
|
54
|
+
* Whether this device's queue takes a decoded frame as a copy source.
|
|
55
|
+
*
|
|
56
|
+
* Chrome converts a VideoFrame. Firefox's converter accepts only ImageBitmap,
|
|
57
|
+
* HTMLImageElement, HTMLCanvasElement and OffscreenCanvas, and rejects the
|
|
58
|
+
* frame with a TypeError thrown from inside the present. The present abandons
|
|
59
|
+
* the steps after the upload, so the media sprite keeps a texture nothing ever
|
|
60
|
+
* wrote to while the redraw at the resting playhead keeps putting annotations
|
|
61
|
+
* over it: the scene then reads as a working library over a broken video,
|
|
62
|
+
* which is worse than an error. Answering here instead routes those frames
|
|
63
|
+
* through the staging canvas, which every non-WebGPU scene already uses.
|
|
64
|
+
*
|
|
65
|
+
* The answer is a property of the browser rather than of the decode, so it is
|
|
66
|
+
* asked once when the compositor is built and never per frame: a browser that
|
|
67
|
+
* takes the frame pays one one-pixel copy each time media is opened, and
|
|
68
|
+
* nothing at all while it plays.
|
|
69
|
+
*/
|
|
70
|
+
export declare function acceptsVideoFrameUpload(device: GPUDevice): boolean;
|
|
71
|
+
export declare function resolvePixiResolution(maxDevicePixelRatio: number | undefined): number;
|
|
72
|
+
export {};
|
|
6
73
|
//# sourceMappingURL=pixi-media-scene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-media-scene.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-media-scene.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pixi-media-scene.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-media-scene.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EAG1B,MAAM,wBAAwB,CAAC;AA4IhC,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,WAAW,EACtB,MAAM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from "#render-preparation/mask-preparation-worker-protocol";
|
|
2
2
|
import { type AnnotationStyleContext, type Detection, type DetectionFrame, type PolygonDrawInstruction, type PolygonStyle } from "supervision-js-core";
|
|
3
|
-
import { createPixiMaskLayer, type PixiMaskLayer } from "./pixi-mask-layer";
|
|
3
|
+
import { createPixiMaskLayer, type BufferImageSourceConstructor, type PixiMaskLayer } from "./pixi-mask-layer";
|
|
4
4
|
type PixiMaskLayerOptions = Parameters<typeof createPixiMaskLayer>[0];
|
|
5
5
|
export interface PixiPolygonLayer {
|
|
6
6
|
createDisplay(dimensions: {
|
|
@@ -8,13 +8,20 @@ export interface PixiPolygonLayer {
|
|
|
8
8
|
readonly width: number;
|
|
9
9
|
}): ReturnType<PixiMaskLayer["createSprite"]>;
|
|
10
10
|
drawFrame(mediaTime: number, viewportScale?: number): void;
|
|
11
|
+
prepareFrame(mediaTime: number, viewportScale?: number): void;
|
|
12
|
+
clearFrame: PixiMaskLayer["clearFrame"];
|
|
13
|
+
isArtifactPrepared: PixiMaskLayer["isArtifactPrepared"];
|
|
14
|
+
getPreparationProgress: PixiMaskLayer["getPreparationProgress"];
|
|
15
|
+
needsRenderPreparationWait: PixiMaskLayer["needsRenderPreparationWait"];
|
|
11
16
|
getVectorFallbackStyle(): PolygonStyle;
|
|
12
17
|
setPolygonStyle(polygonStyle: PolygonStyle | null | undefined): void;
|
|
13
18
|
setTimelineContext: PixiMaskLayer["setTimelineContext"];
|
|
14
19
|
waitForRenderPreparation: PixiMaskLayer["waitForRenderPreparation"];
|
|
15
20
|
destroy(): void;
|
|
16
21
|
}
|
|
17
|
-
export declare function createPixiPolygonLayer(options: Omit<PixiMaskLayerOptions, "artifactKind" | "maskStyle" | "resolveInstructions"> & {
|
|
22
|
+
export declare function createPixiPolygonLayer(options: Omit<PixiMaskLayerOptions, "BufferImageSource" | "artifactKind" | "maskStyle" | "resolveInstructions"> & {
|
|
23
|
+
/** Without it a frame that cooked to an id raster reaches no texture. */
|
|
24
|
+
readonly BufferImageSource: BufferImageSourceConstructor;
|
|
18
25
|
readonly polygonStyle: PolygonStyle;
|
|
19
26
|
readonly resolveContextState?: (detection: Detection) => Partial<AnnotationStyleContext>;
|
|
20
27
|
}): PixiPolygonLayer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-polygon-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-polygon-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"pixi-polygon-layer.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-polygon-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,KAAK,4BAA4B,EACjC,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,UAAU,EAAE;QACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,GAAG,UAAU,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;IAC9C,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CA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pC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAC7B,SAAS,EAAE,SAAS,KACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,GAAG,SAAS,2BAA2B,EAAE,CAkDzC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { InjectedMeshConstructor, InjectedMeshGeometryConstructor, InjectedShaderFactory } from "#renderers/injected-pixi";
|
|
2
|
+
import type { PreparedRegionMaskCoverageEntry } from "#render-preparation/mask-frame-artifact";
|
|
3
|
+
import type { AlphaMask as PixiAlphaMask, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
|
|
4
|
+
type RegionCoverageMaskMesh = PixiMesh<PixiMeshGeometry, PixiShader>;
|
|
5
|
+
type AlphaMaskConstructor = new (options: {
|
|
6
|
+
mask: RegionCoverageMaskMesh;
|
|
7
|
+
}) => PixiAlphaMask;
|
|
8
|
+
type ImageSourceConstructor = new (options: {
|
|
9
|
+
autoGenerateMipmaps?: boolean;
|
|
10
|
+
dynamic: boolean;
|
|
11
|
+
height: number;
|
|
12
|
+
resource: HTMLCanvasElement;
|
|
13
|
+
scaleMode?: "linear" | "nearest";
|
|
14
|
+
width: number;
|
|
15
|
+
}) => PixiImageSource;
|
|
16
|
+
type UniformGroupConstructor = new (uniforms: Record<string, {
|
|
17
|
+
type: "f32";
|
|
18
|
+
value: number;
|
|
19
|
+
} | {
|
|
20
|
+
type: "vec4<f32>";
|
|
21
|
+
value: Float32Array;
|
|
22
|
+
}>) => PixiUniformGroup;
|
|
23
|
+
export interface PixiRegionCoverageMaskArtifact {
|
|
24
|
+
readonly texture: PixiTexture;
|
|
25
|
+
}
|
|
26
|
+
export interface PixiRegionCoverageMask {
|
|
27
|
+
readonly display: RegionCoverageMaskMesh;
|
|
28
|
+
readonly effect: PixiAlphaMask;
|
|
29
|
+
render(options: {
|
|
30
|
+
readonly artifact: PixiRegionCoverageMaskArtifact;
|
|
31
|
+
readonly coverage: PreparedRegionMaskCoverageEntry;
|
|
32
|
+
readonly crop: {
|
|
33
|
+
readonly height: number;
|
|
34
|
+
readonly width: number;
|
|
35
|
+
readonly x: number;
|
|
36
|
+
readonly y: number;
|
|
37
|
+
};
|
|
38
|
+
readonly flipHorizontal: boolean;
|
|
39
|
+
readonly flipVertical: boolean;
|
|
40
|
+
readonly height: number;
|
|
41
|
+
readonly rotation: number;
|
|
42
|
+
readonly width: number;
|
|
43
|
+
readonly x: number;
|
|
44
|
+
readonly y: number;
|
|
45
|
+
}): void;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Produces a per-detection alpha mask from a compact prepared coverage crop.
|
|
50
|
+
* The crop is sampled and transformed entirely on the GPU; semantic RLE masks
|
|
51
|
+
* never enter the playback hot path.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createPixiRegionCoverageMask(options: {
|
|
54
|
+
readonly AlphaMask: AlphaMaskConstructor;
|
|
55
|
+
readonly ImageSource: ImageSourceConstructor;
|
|
56
|
+
readonly Mesh: InjectedMeshConstructor<RegionCoverageMaskMesh>;
|
|
57
|
+
readonly MeshGeometry: InjectedMeshGeometryConstructor;
|
|
58
|
+
readonly Shader: InjectedShaderFactory;
|
|
59
|
+
readonly UniformGroup: UniformGroupConstructor;
|
|
60
|
+
}): PixiRegionCoverageMask;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=pixi-region-coverage-mask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pixi-region-coverage-mask.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-region-coverage-mask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,K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D,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,CAAC;QACnD,QAAQ,CAAC,IAAI,EAAE;YACb,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YACvB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;YACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC;QACF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;QACjC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACpD,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC,sBAAsB,CAAC,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,+BAA+B,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,uBAAuB,CAAC;CAChD,GAAG,sBAAsB,CAsGzB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type RegionRendererMediaEffect } from "supervision-js-core";
|
|
2
|
+
import type { Filter as PixiFilterClass } from "pixi.js";
|
|
3
|
+
type PixiFilter = {
|
|
4
|
+
destroy?(): void;
|
|
5
|
+
padding?: number;
|
|
6
|
+
};
|
|
7
|
+
type PixiFilterDisplay = {
|
|
8
|
+
filters?: readonly PixiFilter[] | null;
|
|
9
|
+
};
|
|
10
|
+
type BlurFilterConstructor = new (options: {
|
|
11
|
+
kernelSize?: number;
|
|
12
|
+
quality?: number;
|
|
13
|
+
repeatEdgePixels?: boolean;
|
|
14
|
+
strength?: number;
|
|
15
|
+
}) => PixiFilter;
|
|
16
|
+
type FilterFactory = Pick<typeof PixiFilterClass, "from">;
|
|
17
|
+
export interface PixiRegionEffect {
|
|
18
|
+
/**
|
|
19
|
+
* Applies the effect at the current media-to-viewport scale.
|
|
20
|
+
*
|
|
21
|
+
* Public effect sizes are expressed in media pixels, while Pixi evaluates a
|
|
22
|
+
* filter over the scaled display texture. Rebuild only when that scale
|
|
23
|
+
* changes so the filter's rendered-pixel inputs remain semantically stable.
|
|
24
|
+
*/
|
|
25
|
+
apply(display: PixiFilterDisplay, viewportScale?: number): void;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates one filter for one pooled region display.
|
|
30
|
+
*
|
|
31
|
+
* The public descriptor stays semantic. This browser-only primitive owns the
|
|
32
|
+
* Pixi filter and is deliberately kept beneath the region layer so no filter,
|
|
33
|
+
* shader, texture, or render target appears in the package API.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createPixiRegionEffect(options: {
|
|
36
|
+
readonly BlurFilter?: BlurFilterConstructor;
|
|
37
|
+
readonly defaultFilterVert?: string;
|
|
38
|
+
readonly Filter?: FilterFactory;
|
|
39
|
+
readonly effect: RegionRendererMediaEffect;
|
|
40
|
+
}): PixiRegionEffect | undefined;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=pixi-region-effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pixi-region-effect.d.ts","sourceRoot":"","sources":["../../src/renderers/pixi-region-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF,KAAK,qBAAqB,GAAG,KAAK,OAAO,EAAE;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KAAK,UAAU,CAAC;AAEjB,KAAK,aAAa,GAAG,IAAI,CAAC,OAAO,eAAe,EAAE,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,EAAE,iBAAiB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;CAC5C,GAAG,gBAAgB,GAAG,SAAS,CAuD/B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { InjectedMeshConstructor, InjectedMeshGeometryConstructor, InjectedShaderFactory } from "#renderers/injected-pixi";
|
|
1
2
|
import type { AnnotationStyleContext, BufferedDetectionTimeline, Detection, RegionAnnotationRenderer } from "supervision-js-core";
|
|
2
|
-
import type { Container as PixiContainer, Sprite as PixiSprite, Texture as PixiTexture } from "pixi.js";
|
|
3
|
+
import type { AlphaMask as PixiAlphaMask, BlurFilter as PixiBlurFilter, Container as PixiContainer, Filter as PixiFilter, Graphics as PixiGraphics, ImageSource as PixiImageSource, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Rectangle as PixiRectangle, Shader as PixiShader, Sprite as PixiSprite, Texture as PixiTexture, UniformGroup as PixiUniformGroup } from "pixi.js";
|
|
3
4
|
import type { GifSource as PixiGifSource, GifSprite as PixiGifSprite } from "pixi.js/gif";
|
|
5
|
+
import type { PixiActiveRegionMaskCoverage } from "./pixi-mask-layer";
|
|
4
6
|
type RegionAsset = PixiTexture | PixiGifSource;
|
|
5
7
|
interface RegionAssetLoader {
|
|
6
8
|
load<T = RegionAsset>(src: string): Promise<T>;
|
|
@@ -16,8 +18,19 @@ export interface PixiRegionLayer {
|
|
|
16
18
|
translateDetection(id: string | number, x: number, y: number): boolean;
|
|
17
19
|
destroy(): void;
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
type RegionMesh = PixiMesh<PixiMeshGeometry, PixiShader>;
|
|
22
|
+
/** Browser implementation for asset- and media-backed region descriptors. */
|
|
20
23
|
export declare function createPixiRegionLayer(options: {
|
|
24
|
+
readonly AlphaMask: new (options: {
|
|
25
|
+
mask: RegionMesh;
|
|
26
|
+
}) => PixiAlphaMask;
|
|
27
|
+
readonly BlurFilter?: new (options: {
|
|
28
|
+
kernelSize?: number;
|
|
29
|
+
quality?: number;
|
|
30
|
+
repeatEdgePixels?: boolean;
|
|
31
|
+
strength?: number;
|
|
32
|
+
}) => PixiBlurFilter;
|
|
33
|
+
readonly defaultFilterVert?: string;
|
|
21
34
|
readonly Assets: RegionAssetLoader;
|
|
22
35
|
readonly Container: new () => PixiContainer;
|
|
23
36
|
readonly GifSprite: new (options: {
|
|
@@ -25,10 +38,38 @@ export declare function createPixiRegionLayer(options: {
|
|
|
25
38
|
readonly loop?: boolean;
|
|
26
39
|
readonly source: PixiGifSource;
|
|
27
40
|
}) => PixiGifSprite;
|
|
41
|
+
readonly Filter?: typeof PixiFilter;
|
|
42
|
+
readonly Graphics: new () => PixiGraphics;
|
|
43
|
+
readonly ImageSource: new (options: {
|
|
44
|
+
autoGenerateMipmaps?: boolean;
|
|
45
|
+
dynamic: boolean;
|
|
46
|
+
height: number;
|
|
47
|
+
resource: HTMLCanvasElement;
|
|
48
|
+
scaleMode?: "linear" | "nearest";
|
|
49
|
+
width: number;
|
|
50
|
+
}) => PixiImageSource;
|
|
51
|
+
readonly Mesh: InjectedMeshConstructor<RegionMesh>;
|
|
52
|
+
readonly MeshGeometry: InjectedMeshGeometryConstructor;
|
|
53
|
+
readonly Rectangle: new (x?: number, y?: number, width?: number, height?: number) => PixiRectangle;
|
|
28
54
|
readonly Sprite: new (options: {
|
|
29
55
|
texture: PixiTexture;
|
|
30
56
|
}) => PixiSprite;
|
|
57
|
+
readonly Shader: InjectedShaderFactory;
|
|
58
|
+
readonly Texture: new (options: {
|
|
59
|
+
readonly dynamic?: boolean;
|
|
60
|
+
readonly frame?: PixiRectangle;
|
|
61
|
+
readonly source: PixiTexture["source"];
|
|
62
|
+
}) => PixiTexture;
|
|
63
|
+
readonly UniformGroup: new (uniforms: Record<string, {
|
|
64
|
+
type: "f32";
|
|
65
|
+
value: number;
|
|
66
|
+
} | {
|
|
67
|
+
type: "vec4<f32>";
|
|
68
|
+
value: Float32Array;
|
|
69
|
+
}>) => PixiUniformGroup;
|
|
31
70
|
readonly detectionTimeline: BufferedDetectionTimeline;
|
|
71
|
+
readonly getActiveRegionMaskCoverage: (detectionFrameTime: number | null) => PixiActiveRegionMaskCoverage | null;
|
|
72
|
+
readonly getMediaTexture: () => PixiTexture | undefined;
|
|
32
73
|
readonly onInvalidate?: () => void;
|
|
33
74
|
readonly onAssetError?: (options: {
|
|
34
75
|
readonly error: unknown;
|