@camstack/addon-post-analysis 1.1.26 → 1.1.28

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.
@@ -1,44 +0,0 @@
1
- import sharp from "sharp";
2
- //#region src/shared/frame/crop-extractor.ts
3
- /**
4
- * Extracts a JPEG-encoded crop from a raw frame buffer using a normalized bounding box.
5
- * Coordinates are clamped to frame bounds to avoid out-of-range errors.
6
- */
7
- async function extractCrop(frameData, frameWidth, frameHeight, bbox) {
8
- const rawLeft = Math.round(bbox.x * frameWidth);
9
- const rawTop = Math.round(bbox.y * frameHeight);
10
- const rawWidth = Math.round(bbox.w * frameWidth);
11
- const rawHeight = Math.round(bbox.h * frameHeight);
12
- const left = Math.max(0, Math.min(rawLeft, frameWidth - 1));
13
- const top = Math.max(0, Math.min(rawTop, frameHeight - 1));
14
- const width = Math.max(1, Math.min(rawWidth, frameWidth - left));
15
- const height = Math.max(1, Math.min(rawHeight, frameHeight - top));
16
- return {
17
- crop: await sharp(frameData, { raw: {
18
- width: frameWidth,
19
- height: frameHeight,
20
- channels: 3
21
- } }).extract({
22
- left,
23
- top,
24
- width,
25
- height
26
- }).jpeg({ quality: 90 }).toBuffer(),
27
- width,
28
- height
29
- };
30
- }
31
- //#endregion
32
- //#region src/shared/frame/resolve-frame.ts
33
- /**
34
- * Resolve the pixels a `FrameHandle` refers to. Local shm read when the
35
- * handle's `nodeId` matches `deps.ownNodeId`, else routed via
36
- * `deps.getRemoteFrame`. Returns `null` when the frame is no longer
37
- * available (slot recycled locally, or the remote node reports no frame).
38
- */
39
- async function resolveFrame(handle, deps) {
40
- if (handle.nodeId === deps.ownNodeId) return deps.readers.read(handle);
41
- return deps.getRemoteFrame(handle);
42
- }
43
- //#endregion
44
- export { extractCrop as n, resolveFrame as t };
@@ -1,57 +0,0 @@
1
- const require_dist = require("./dist-BEx5ST1W.js");
2
- let sharp = require("sharp");
3
- sharp = require_dist.__toESM(sharp);
4
- //#region src/shared/frame/crop-extractor.ts
5
- /**
6
- * Extracts a JPEG-encoded crop from a raw frame buffer using a normalized bounding box.
7
- * Coordinates are clamped to frame bounds to avoid out-of-range errors.
8
- */
9
- async function extractCrop(frameData, frameWidth, frameHeight, bbox) {
10
- const rawLeft = Math.round(bbox.x * frameWidth);
11
- const rawTop = Math.round(bbox.y * frameHeight);
12
- const rawWidth = Math.round(bbox.w * frameWidth);
13
- const rawHeight = Math.round(bbox.h * frameHeight);
14
- const left = Math.max(0, Math.min(rawLeft, frameWidth - 1));
15
- const top = Math.max(0, Math.min(rawTop, frameHeight - 1));
16
- const width = Math.max(1, Math.min(rawWidth, frameWidth - left));
17
- const height = Math.max(1, Math.min(rawHeight, frameHeight - top));
18
- return {
19
- crop: await (0, sharp.default)(frameData, { raw: {
20
- width: frameWidth,
21
- height: frameHeight,
22
- channels: 3
23
- } }).extract({
24
- left,
25
- top,
26
- width,
27
- height
28
- }).jpeg({ quality: 90 }).toBuffer(),
29
- width,
30
- height
31
- };
32
- }
33
- //#endregion
34
- //#region src/shared/frame/resolve-frame.ts
35
- /**
36
- * Resolve the pixels a `FrameHandle` refers to. Local shm read when the
37
- * handle's `nodeId` matches `deps.ownNodeId`, else routed via
38
- * `deps.getRemoteFrame`. Returns `null` when the frame is no longer
39
- * available (slot recycled locally, or the remote node reports no frame).
40
- */
41
- async function resolveFrame(handle, deps) {
42
- if (handle.nodeId === deps.ownNodeId) return deps.readers.read(handle);
43
- return deps.getRemoteFrame(handle);
44
- }
45
- //#endregion
46
- Object.defineProperty(exports, "extractCrop", {
47
- enumerable: true,
48
- get: function() {
49
- return extractCrop;
50
- }
51
- });
52
- Object.defineProperty(exports, "resolveFrame", {
53
- enumerable: true,
54
- get: function() {
55
- return resolveFrame;
56
- }
57
- });