@trillboards/edge-core 0.4.12 → 0.4.14
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/jpegFrameSize.d.ts +30 -0
- package/dist/jpegFrameSize.d.ts.map +1 -0
- package/dist/jpegFrameSize.js +95 -0
- package/dist/jpegFrameSize.js.map +1 -0
- package/package.json +2 -6
package/dist/index.d.ts
CHANGED
|
@@ -26,4 +26,5 @@ export { ZKAudienceProver } from './ZKAudienceProver';
|
|
|
26
26
|
export type { AudienceObservation, AudienceAggregate, AudienceProof, VerificationResult, } from './ZKAudienceProver';
|
|
27
27
|
export { CentroidTracker, DEFAULT_MATCH_RATIO, DEFAULT_STALE_MS, DEFAULT_MAX_TRACKS, } from './centroidTracker';
|
|
28
28
|
export type { TrackedBox, TrackRecord, CentroidTrackerOptions } from './centroidTracker';
|
|
29
|
+
export { readJpegFrameSize, type JpegFrameSize } from './jpegFrameSize';
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,e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AwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,+BAA+B,EAC/B,oBAAoB,EACpB,cAAc,EACd,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAC,iBAAiB,EAAC,KAAK,aAAa,EAAC,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.DEFAULT_MAX_TRACKS = exports.DEFAULT_STALE_MS = exports.DEFAULT_MATCH_RATIO = exports.CentroidTracker = exports.ZKAudienceProver = exports.ModelManager = exports.MemoryTier = exports.MemoryAttenuationManager = exports.getAttenuationTier = exports.getShedOrder = exports.isModelActive = exports.getCapabilityMatrix = exports.computeTier = exports.classifyObservationSignal = exports.StatusServer = exports.TelemetryScheduler = exports.RecoveryLadder = exports.SubsystemHealthRegistry = exports.SqliteStore = exports.JsonFileStore = exports.SignalBuffer = exports.VASWeightConfig = exports.SocketManager = exports.SensingConfig = exports.DeviceIdentity = void 0;
|
|
18
|
+
exports.readJpegFrameSize = exports.DEFAULT_MAX_TRACKS = exports.DEFAULT_STALE_MS = exports.DEFAULT_MATCH_RATIO = exports.CentroidTracker = exports.ZKAudienceProver = exports.ModelManager = exports.MemoryTier = exports.MemoryAttenuationManager = exports.getAttenuationTier = exports.getShedOrder = exports.isModelActive = exports.getCapabilityMatrix = exports.computeTier = exports.classifyObservationSignal = exports.StatusServer = exports.TelemetryScheduler = exports.RecoveryLadder = exports.SubsystemHealthRegistry = exports.SqliteStore = exports.JsonFileStore = exports.SignalBuffer = exports.VASWeightConfig = exports.SocketManager = exports.SensingConfig = exports.DeviceIdentity = void 0;
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
var DeviceIdentity_1 = require("./DeviceIdentity");
|
|
21
21
|
Object.defineProperty(exports, "DeviceIdentity", { enumerable: true, get: function () { return DeviceIdentity_1.DeviceIdentity; } });
|
|
@@ -63,4 +63,6 @@ Object.defineProperty(exports, "CentroidTracker", { enumerable: true, get: funct
|
|
|
63
63
|
Object.defineProperty(exports, "DEFAULT_MATCH_RATIO", { enumerable: true, get: function () { return centroidTracker_1.DEFAULT_MATCH_RATIO; } });
|
|
64
64
|
Object.defineProperty(exports, "DEFAULT_STALE_MS", { enumerable: true, get: function () { return centroidTracker_1.DEFAULT_STALE_MS; } });
|
|
65
65
|
Object.defineProperty(exports, "DEFAULT_MAX_TRACKS", { enumerable: true, get: function () { return centroidTracker_1.DEFAULT_MAX_TRACKS; } });
|
|
66
|
+
var jpegFrameSize_1 = require("./jpegFrameSize");
|
|
67
|
+
Object.defineProperty(exports, "readJpegFrameSize", { enumerable: true, get: function () { return jpegFrameSize_1.readJpegFrameSize; } });
|
|
66
68
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src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AvC,8GAAA,aAAa,OAAA;AACtB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAE3B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,6EAGuC;AAFrC,wIAAA,yBAAyB,OAAA;AAG3B,iDAMyB;AALvB,4GAAA,WAAW,OAAA;AACX,oHAAA,mBAAmB,OAAA;AACnB,8GAAA,aAAa,OAAA;AACb,6GAAA,YAAY,OAAA;AACZ,mHAAA,kBAAkB,OAAA;AAEpB,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AAOjC,uEAAwD;AAA/C,sHAAA,UAAU,OAAA;AACnB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAQzB,8EAA8E;AAC9E,iFAAiF;AACjF,2CAA2C;AAC3C,qDAK2B;AAJzB,kHAAA,eAAe,OAAA;AACf,sHAAA,mBAAmB,OAAA;AACnB,mHAAA,gBAAgB,OAAA;AAChB,qHAAA,kBAAkB,OAAA;AAIpB,iDAAqE;AAA7D,kHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pixel dimensions of a JPEG, read from its own header.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS AT ALL. A detector box arrives in PIXELS and an operator's
|
|
5
|
+
* region is NORMALIZED, so one of them has to be converted and neither the
|
|
6
|
+
* detector wire nor `DetectResult` carries a frame size. Asking the service for
|
|
7
|
+
* one would change a FROZEN contract (`cctv-detector-tier.md`: it carries
|
|
8
|
+
* `classes` and nothing else) to obtain a number already present in the bytes we
|
|
9
|
+
* just sent it.
|
|
10
|
+
*
|
|
11
|
+
* WHY NOT A DECODE. `sharp` is not a connector dependency and a full decode of
|
|
12
|
+
* every frame to learn two integers is a per-frame cost on the hot path. The SOF
|
|
13
|
+
* marker is 9 bytes into a segment that appears once, near the front.
|
|
14
|
+
*
|
|
15
|
+
* IT RETURNS NULL RATHER THAN GUESSING. A truncated or non-JPEG buffer has no
|
|
16
|
+
* dimensions, and inventing 1920x1080 would silently rescale every region — a
|
|
17
|
+
* doorway at x=0.4 lands somewhere else and the alert quietly watches the wrong
|
|
18
|
+
* part of the room. The caller must treat null as "no region can be applied",
|
|
19
|
+
* which degrades to the unfocused count rather than to zero.
|
|
20
|
+
*/
|
|
21
|
+
export interface JpegFrameSize {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @param jpeg the raw bytes, exactly as posted to the detector
|
|
27
|
+
* @returns the frame size, or null when the buffer is not a readable JPEG
|
|
28
|
+
*/
|
|
29
|
+
export declare function readJpegFrameSize(jpeg: Uint8Array | null | undefined): JpegFrameSize | null;
|
|
30
|
+
//# sourceMappingURL=jpegFrameSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jpegFrameSize.d.ts","sourceRoot":"","sources":["../src/jpegFrameSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAiBH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAyC3F"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The pixel dimensions of a JPEG, read from its own header.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS EXISTS AT ALL. A detector box arrives in PIXELS and an operator's
|
|
6
|
+
* region is NORMALIZED, so one of them has to be converted and neither the
|
|
7
|
+
* detector wire nor `DetectResult` carries a frame size. Asking the service for
|
|
8
|
+
* one would change a FROZEN contract (`cctv-detector-tier.md`: it carries
|
|
9
|
+
* `classes` and nothing else) to obtain a number already present in the bytes we
|
|
10
|
+
* just sent it.
|
|
11
|
+
*
|
|
12
|
+
* WHY NOT A DECODE. `sharp` is not a connector dependency and a full decode of
|
|
13
|
+
* every frame to learn two integers is a per-frame cost on the hot path. The SOF
|
|
14
|
+
* marker is 9 bytes into a segment that appears once, near the front.
|
|
15
|
+
*
|
|
16
|
+
* IT RETURNS NULL RATHER THAN GUESSING. A truncated or non-JPEG buffer has no
|
|
17
|
+
* dimensions, and inventing 1920x1080 would silently rescale every region — a
|
|
18
|
+
* doorway at x=0.4 lands somewhere else and the alert quietly watches the wrong
|
|
19
|
+
* part of the room. The caller must treat null as "no region can be applied",
|
|
20
|
+
* which degrades to the unfocused count rather than to zero.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.readJpegFrameSize = void 0;
|
|
24
|
+
/**
|
|
25
|
+
* Every Start-Of-Frame marker. SOF0/1/2 are the common ones; the rest are
|
|
26
|
+
* arithmetic/progressive/lossless variants that carry the SAME 5-byte header.
|
|
27
|
+
*
|
|
28
|
+
* NOT in this set on purpose: 0xC4 (DHT), 0xC8 (JPG, reserved) and 0xCC (DAC)
|
|
29
|
+
* share the 0xC0-0xCF range and are NOT frame headers. Reading dimensions out of
|
|
30
|
+
* a Huffman table is how a frame ends up 1x1 with no error anywhere.
|
|
31
|
+
*/
|
|
32
|
+
const SOF_MARKERS = new Set([
|
|
33
|
+
0xc0, 0xc1, 0xc2, 0xc3,
|
|
34
|
+
0xc5, 0xc6, 0xc7,
|
|
35
|
+
0xc9, 0xca, 0xcb,
|
|
36
|
+
0xcd, 0xce, 0xcf,
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* @param jpeg the raw bytes, exactly as posted to the detector
|
|
40
|
+
* @returns the frame size, or null when the buffer is not a readable JPEG
|
|
41
|
+
*/
|
|
42
|
+
function readJpegFrameSize(jpeg) {
|
|
43
|
+
if (!jpeg || jpeg.length < 4)
|
|
44
|
+
return null;
|
|
45
|
+
// SOI. A buffer that does not start with it is not a JPEG, and scanning on
|
|
46
|
+
// would find a "marker" in arbitrary payload bytes.
|
|
47
|
+
if (jpeg[0] !== 0xff || jpeg[1] !== 0xd8)
|
|
48
|
+
return null;
|
|
49
|
+
let i = 2;
|
|
50
|
+
while (i + 3 < jpeg.length) {
|
|
51
|
+
if (jpeg[i] !== 0xff) {
|
|
52
|
+
// Not at a marker. Resynchronising by scanning would read entropy-coded
|
|
53
|
+
// data as structure, so this refuses instead.
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
let marker = jpeg[i + 1];
|
|
57
|
+
// 0xFF fill bytes are legal padding before a marker.
|
|
58
|
+
let j = i + 1;
|
|
59
|
+
while (marker === 0xff && j + 1 < jpeg.length) {
|
|
60
|
+
j += 1;
|
|
61
|
+
marker = jpeg[j];
|
|
62
|
+
}
|
|
63
|
+
if (marker === 0xd8 || (marker >= 0xd0 && marker <= 0xd9)) {
|
|
64
|
+
i = j + 1;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
// SOS: entropy-coded data begins and no SOF can follow. A JPEG that reaches
|
|
68
|
+
// here without one has no dimensions we can read.
|
|
69
|
+
if (marker === 0xda)
|
|
70
|
+
return null;
|
|
71
|
+
const lenAt = j + 1;
|
|
72
|
+
if (lenAt + 1 >= jpeg.length)
|
|
73
|
+
return null;
|
|
74
|
+
const segLen = (jpeg[lenAt] << 8) | jpeg[lenAt + 1];
|
|
75
|
+
if (segLen < 2)
|
|
76
|
+
return null;
|
|
77
|
+
if (SOF_MARKERS.has(marker)) {
|
|
78
|
+
// length(2) precision(1) height(2) width(2)
|
|
79
|
+
const h = lenAt + 3;
|
|
80
|
+
if (h + 3 >= jpeg.length)
|
|
81
|
+
return null;
|
|
82
|
+
const height = (jpeg[h] << 8) | jpeg[h + 1];
|
|
83
|
+
const width = (jpeg[h + 2] << 8) | jpeg[h + 3];
|
|
84
|
+
// A zero dimension is a malformed header, not a frame. Returning it would
|
|
85
|
+
// divide by zero downstream, or worse, be clamped to something plausible.
|
|
86
|
+
if (width <= 0 || height <= 0)
|
|
87
|
+
return null;
|
|
88
|
+
return { width, height };
|
|
89
|
+
}
|
|
90
|
+
i = lenAt + segLen;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
exports.readJpegFrameSize = readJpegFrameSize;
|
|
95
|
+
//# sourceMappingURL=jpegFrameSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jpegFrameSize.js","sourceRoot":"","sources":["../src/jpegFrameSize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACtB,IAAI,EAAE,IAAI,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI,EAAE,IAAI;CACjB,CAAC,CAAC;AAOH;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,IAAmC;IACnE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,2EAA2E;IAC3E,oDAAoD;IACpD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEtD,IAAI,C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C,IAAI,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACtC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/C,0EAA0E;YAC1E,0EAA0E;YAC1E,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC3B,CAAC;QACD,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAzCD,8CAyCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trillboards/edge-core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
4
4
|
"description": "Core identity, heartbeat, Socket.io, config, and signal buffer for Trillboards Edge AI SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,14 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"author": "Trillboards <engineering@trillboards.com>",
|
|
36
36
|
"license": "MIT",
|
|
37
|
+
"homepage": "https://trillboards.com/support/developers/edge-sdk/",
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public"
|
|
39
40
|
},
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "https://github.com/trillboards/packages.git",
|
|
43
|
-
"directory": "trillboards-edge-sdk/packages/edge-core"
|
|
44
|
-
},
|
|
45
41
|
"keywords": [
|
|
46
42
|
"edge-ai",
|
|
47
43
|
"dooh",
|