@luxonis/visualizer-protobuf 3.1.12 → 3.1.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.
Files changed (68) hide show
  1. package/dist/{FoxgloveServer-Da9kV1cr.js → FoxgloveServer-CpnCBMeV.js} +1 -1
  2. package/dist/{communicator-Dh2aL-rj.js → communicator-DO6hmBxI.js} +1 -1
  3. package/dist/{depth-DiD1V2Sg.js → depth-Me_0Xnx6.js} +89 -2
  4. package/dist/{deserialization.worker-CxHfbNSI.js → deserialization.worker-CUrCdjHf.js} +435 -154
  5. package/dist/{foxglove-protocol-BtLMVx24.js → foxglove-protocol-SrBOBs-8.js} +1 -1
  6. package/dist/{index-B5oN0fQm.js → index-5ZSfZI8d.js} +1 -1
  7. package/dist/{index-yO9F9DL5.js → index-B8aafdRQ.js} +5 -5
  8. package/dist/{index-gafqmUmi.js → index-BMew9qiQ.js} +57 -126
  9. package/dist/{index-BydKxany.js → index-BsIRFSYD.js} +36 -9
  10. package/dist/{index-B8JZ9tAh.js → index-CIhAU5Cs.js} +5 -5
  11. package/dist/{index-DuP_Wg3E.js → index-CN6tI-uI.js} +5 -5
  12. package/dist/{index-BFAcwVLJ.js → index-CQtXiN8I.js} +5 -5
  13. package/dist/{index-C-n27_wk.js → index-CZGEFE1k.js} +5 -5
  14. package/dist/{index-O1aT66OM.js → index-CeRrHeG_.js} +5 -5
  15. package/dist/{index-BtMMMbp8.js → index-CqH6rdRP.js} +5 -5
  16. package/dist/{index-CVrY6MoS.js → index-CrPun-aU.js} +5 -5
  17. package/dist/{index-9Qz76jnn.js → index-Dc3rS1Cf.js} +7 -7
  18. package/dist/{index-RxEWv1Fn.js → index-DgNYLOM9.js} +5 -5
  19. package/dist/{index-8bTMarZg.js → index-DjRF0u25.js} +5 -5
  20. package/dist/{index-CwAmHvi3.js → index-Dmc1065I.js} +5 -5
  21. package/dist/{index-BvC_JYBX.js → index-Dn6pTTdu.js} +5 -5
  22. package/dist/{index-DXdd6C_Q.js → index-N2I7Bhtx.js} +5 -5
  23. package/dist/{index-CQhsew4_.js → index-_Z7btKy-.js} +5 -5
  24. package/dist/{index-D_TjqfY9.js → index-_ggcs841.js} +5 -5
  25. package/dist/{index-oyn_LQK1.js → index-svPKcEP3.js} +5 -5
  26. package/dist/{index-DnaaNoIT.js → index-u1cGSF5c.js} +5 -5
  27. package/dist/index.js +5 -5
  28. package/dist/lib/src/components/PanelToolbar.d.ts.map +1 -1
  29. package/dist/lib/src/components/PanelToolbar.js +2 -2
  30. package/dist/lib/src/components/PanelToolbar.js.map +1 -1
  31. package/dist/lib/src/connection/foxglove-connection.d.ts.map +1 -1
  32. package/dist/lib/src/connection/foxglove-connection.js +12 -2
  33. package/dist/lib/src/connection/foxglove-connection.js.map +1 -1
  34. package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.js +59 -20
  35. package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.js.map +1 -1
  36. package/dist/lib/src/messaging/deserialization/pointcloud/utils.d.ts.map +1 -1
  37. package/dist/lib/src/messaging/deserialization/pointcloud/utils.js.map +1 -1
  38. package/dist/lib/src/messaging/deserialization/video/h264.d.ts +4 -1
  39. package/dist/lib/src/messaging/deserialization/video/h264.d.ts.map +1 -1
  40. package/dist/lib/src/messaging/deserialization/video/h264.js +25 -13
  41. package/dist/lib/src/messaging/deserialization/video/h264.js.map +1 -1
  42. package/dist/lib/src/messaging/deserialization/video/h265.d.ts +3 -0
  43. package/dist/lib/src/messaging/deserialization/video/h265.d.ts.map +1 -1
  44. package/dist/lib/src/messaging/deserialization/video/h265.js +21 -9
  45. package/dist/lib/src/messaging/deserialization/video/h265.js.map +1 -1
  46. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.d.ts +5 -5
  47. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.d.ts.map +1 -1
  48. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.js +362 -91
  49. package/dist/lib/src/messaging/deserialization/video/rgbd-to-pointcloud.js.map +1 -1
  50. package/dist/lib/src/messaging/protobuf.d.ts +2 -2
  51. package/dist/lib/src/messaging/protobuf.d.ts.map +1 -1
  52. package/dist/lib/src/messaging/protobuf.js +3 -3
  53. package/dist/lib/src/messaging/protobuf.js.map +1 -1
  54. package/dist/lib/src/utils/poitcloud-sync.d.ts +7 -2
  55. package/dist/lib/src/utils/poitcloud-sync.d.ts.map +1 -1
  56. package/dist/lib/src/utils/poitcloud-sync.js +10 -6
  57. package/dist/lib/src/utils/poitcloud-sync.js.map +1 -1
  58. package/dist/packages/studio-base/src/panels/ThreeDeeRender/Renderer.d.ts.map +1 -1
  59. package/dist/packages/studio-base/src/panels/ThreeDeeRender/Renderer.js +7 -2
  60. package/dist/packages/studio-base/src/panels/ThreeDeeRender/Renderer.js.map +1 -1
  61. package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.d.ts.map +1 -1
  62. package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.js +33 -1
  63. package/dist/packages/studio-base/src/panels/ThreeDeeRender/ThreeDeeRender.js.map +1 -1
  64. package/dist/{pointcloudFromDepth.worker-60RA4Ief.js → pointcloudFromDepth.worker-wzSOsJVb.js} +86 -47
  65. package/dist/{protobuf-OcbVtxg1.js → protobuf-CKMA2Rn8.js} +214 -214
  66. package/dist/{worker-C2MHIq3t.js → worker-Bhe7uYcO.js} +4 -4
  67. package/dist/{worker-Be-hru8f.js → worker-VIU0v1ZW.js} +3 -3
  68. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"h265.js","sourceRoot":"","sources":["../../../../../../src/messaging/deserialization/video/h265.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAM9F,OA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,MAAM,KAAK,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC3C,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QACxC,OAAO,CACL,IAAI,mBAAmB,CACrB,KAAK,EACL,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CACzE,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { MessageEvent } from "@foxglove/studio-base/players/types";
2
- import { type PointCloudWithDimensions } from "./depth";
3
- import { type TopicDecoders } from "./h264";
4
- import type { RGBDData } from "../../../protobuf.generated/RGBDData";
5
- import type { NeuralCameraIntrinsics } from "../pointcloud/utils";
2
+ import { type PointCloudWithDimensions } from "./depth.js";
3
+ import { type TopicDecoders } from "./h264.js";
4
+ import type { RGBDData } from "../../../protobuf.generated/RGBDData.js";
5
+ import type { NeuralCameraIntrinsics } from "../pointcloud/utils.js";
6
6
  export type DeserializeRGBDFrameArgs = {
7
7
  topic: string;
8
8
  topicDecoders: TopicDecoders;
@@ -13,5 +13,5 @@ export type DeserializeRGBDFrameArgs = {
13
13
  onError: (error: Error) => void;
14
14
  };
15
15
  export type PointCloudWithColorAndDepth = PointCloudWithDimensions;
16
- export declare function deserializeRGBDFrameToPointCloud({ topic, topicDecoders, cameraIntrinsics, maxStereoDepth, message, callback, }: DeserializeRGBDFrameArgs): Promise<void>;
16
+ export declare function deserializeRGBDFrameToPointCloud({ topic, topicDecoders, cameraIntrinsics, maxStereoDepth, message, callback, onError, }: DeserializeRGBDFrameArgs): Promise<void>;
17
17
  //# sourceMappingURL=rgbd-to-pointcloud.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rgbd-to-pointcloud.d.ts","sourceRoot":"","sources":["../../../../../../src/messaging/deserialization/video/rgbd-to-pointcloud.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAyB,KAAK,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAkD,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAK5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAIrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAqVnE,wBAAsB,gCAAgC,CAAC,EACrD,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,QAAQ,GACT,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4E1C"}
1
+ {"version":3,"file":"rgbd-to-pointcloud.d.ts","sourceRoot":"","sources":["../../../../../../src/messaging/deserialization/video/rgbd-to-pointcloud.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAyB,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAkD,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAK/F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAGxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIrE,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAovBnE,wBAAsB,gCAAgC,CAAC,EACrD,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,QAAQ,EACR,OAAO,GACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1C"}
@@ -1,24 +1,32 @@
1
1
  // This Source Code Form is subject to the terms of the Mozilla Public
2
2
  // License, v2.0. If a copy of the MPL was not distributed with this
3
3
  // file, You can obtain one at http://mozilla.org/MPL/2.0/
4
- import { wrap } from "comlink";
4
+ import { releaseProxy, wrap } from "comlink";
5
5
  import { NumericType } from "@foxglove/schemas";
6
6
  import { estimateObjectSize } from "@foxglove/studio-base/players/messageMemoryEstimation";
7
- import { deserializeDepthFrame } from "./depth";
8
- import { convertNv12ToI420, deserializeEncodedFrameH264 } from "./h264";
9
- import { deserializeEncodedFrameH265 } from "./h265";
10
- import { deserializeMJPEGFrame } from "./mjpeg";
11
- import { Profile } from "../../../protobuf.generated/EncodedFrame";
12
- import { Type } from "../../../protobuf.generated/ImgFrame";
13
- import { parseMessage } from "../../utils";
14
- import { Logger } from "../../../utils/logger";
15
- import { uint8ArrayToUint16Array } from "../pointcloud/utils";
16
- const RGBD_POINTCLOUD_WORKER_COUNT = 4;
7
+ import { deserializeDepthFrame } from "./depth.js";
8
+ import { convertNv12ToI420, deserializeEncodedFrameH264 } from "./h264.js";
9
+ import { deserializeEncodedFrameH265 } from "./h265.js";
10
+ import { deserializeMJPEGFrame } from "./mjpeg.js";
11
+ import { Profile } from "../../../protobuf.generated/EncodedFrame.js";
12
+ import { Type } from "../../../protobuf.generated/ImgFrame.js";
13
+ import { parseMessage } from "../../utils.js";
14
+ import { uint8ArrayToUint16Array } from "../pointcloud/utils.js";
15
+ import { constructKeyForTopicRenderMetrics, globalDecodeMetricsManager, globalInputEventMetricsManager, globalRenderMetricsManager } from "../../../utils/metrics-manager.js";
16
+ const RGBD_POINTCLOUD_WORKER_COUNT = 6;
17
+ const RGBD_POINTCLOUD_WORKER_TIMEOUT_MS = 15_000;
18
+ const RGBD_POINTCLOUD_SCHEDULE_DELAY_MS = 0;
19
+ const ENABLE_RGBD_GPU_BATCHING = true;
20
+ const RGBD_GPU_BATCH_SIZE = 2;
21
+ const RGBD_GPU_BATCH_FLUSH_DELAY_MS = 8;
22
+ const RGBD_POINTCLOUD_IDLE_CLEANUP_MS = 30_000;
17
23
  let cachedRGBDHasGPU;
18
24
  let rgbdHasGPUPromise;
19
25
  let rgbdPointCloudWorkers;
20
26
  let rgbdPointCloudWorkerIndex = 0;
21
- const logger = Logger.getLogger();
27
+ let rgbdPointCloudIdleCleanupTimeoutId;
28
+ const rgbdIntrinsicsByTopic = new Map();
29
+ const pendingRGBDBatches = new Map();
22
30
  function ensureEvenByteLength(data) {
23
31
  if (data.length % 2 === 0) {
24
32
  return data;
@@ -27,12 +35,9 @@ function ensureEvenByteLength(data) {
27
35
  padded.set(data);
28
36
  return padded;
29
37
  }
30
- async function detectRGBDGPUSupport() {
31
- if (cachedRGBDHasGPU != undefined) {
32
- return cachedRGBDHasGPU;
33
- }
34
- if (rgbdHasGPUPromise) {
35
- return await rgbdHasGPUPromise;
38
+ function ensureRGBDGPUSupportDetection() {
39
+ if (cachedRGBDHasGPU != undefined || rgbdHasGPUPromise) {
40
+ return;
36
41
  }
37
42
  rgbdHasGPUPromise = (async () => {
38
43
  if (typeof navigator.gpu === "undefined") {
@@ -44,7 +49,7 @@ async function detectRGBDGPUSupport() {
44
49
  cachedRGBDHasGPU = adapter != undefined;
45
50
  return cachedRGBDHasGPU;
46
51
  }
47
- catch {
52
+ catch (error) {
48
53
  cachedRGBDHasGPU = false;
49
54
  return false;
50
55
  }
@@ -52,42 +57,103 @@ async function detectRGBDGPUSupport() {
52
57
  rgbdHasGPUPromise = undefined;
53
58
  }
54
59
  })();
55
- return await rgbdHasGPUPromise;
56
60
  }
57
- function getRGBDPointCloudWorkerSlot() {
61
+ function getRGBDGPUSupport() {
62
+ ensureRGBDGPUSupportDetection();
63
+ return cachedRGBDHasGPU ?? false;
64
+ }
65
+ function ensureRGBDPointCloudWorkers() {
58
66
  if (!rgbdPointCloudWorkers) {
59
67
  rgbdPointCloudWorkers = Array.from({ length: RGBD_POINTCLOUD_WORKER_COUNT }, () => {
60
- const worker = new Worker(new URL("../pointcloud/pointcloudFromDepth.worker", import.meta.url), {
61
- type: "module",
62
- });
63
- return {
64
- worker,
65
- remote: wrap(worker),
66
- activeJobs: 0,
67
- };
68
+ return createRGBDPointCloudWorkerSlot();
68
69
  });
69
70
  }
71
+ return rgbdPointCloudWorkers;
72
+ }
73
+ function createRGBDPointCloudWorkerSlot() {
74
+ const worker = new Worker(new URL("../pointcloud/pointcloudFromDepth.worker", import.meta.url), {
75
+ type: "module",
76
+ });
77
+ const remote = wrap(worker);
78
+ return {
79
+ worker,
80
+ remote,
81
+ activeJobs: 0,
82
+ dispose: () => {
83
+ remote[releaseProxy]();
84
+ worker.terminate();
85
+ },
86
+ };
87
+ }
88
+ function clearRGBDPointCloudIdleCleanupTimeout() {
89
+ if (rgbdPointCloudIdleCleanupTimeoutId != undefined) {
90
+ clearTimeout(rgbdPointCloudIdleCleanupTimeoutId);
91
+ rgbdPointCloudIdleCleanupTimeoutId = undefined;
92
+ }
93
+ }
94
+ function hasActiveRGBDPointCloudWork() {
95
+ const hasActiveJobs = rgbdPointCloudWorkers?.some((slot) => slot.activeJobs > 0) ?? false;
96
+ return hasActiveJobs || pendingRGBDBatches.size > 0;
97
+ }
98
+ function disposeRGBDPointCloudWorkers() {
99
+ clearRGBDPointCloudIdleCleanupTimeout();
100
+ for (const batch of pendingRGBDBatches.values()) {
101
+ clearRGBDBatchFlush(batch);
102
+ }
103
+ pendingRGBDBatches.clear();
104
+ rgbdIntrinsicsByTopic.clear();
105
+ if (rgbdPointCloudWorkers) {
106
+ for (const slot of rgbdPointCloudWorkers) {
107
+ slot.dispose();
108
+ }
109
+ rgbdPointCloudWorkers = undefined;
110
+ }
111
+ rgbdPointCloudWorkerIndex = 0;
112
+ }
113
+ function scheduleRGBDPointCloudWorkersCleanup() {
114
+ clearRGBDPointCloudIdleCleanupTimeout();
115
+ rgbdPointCloudIdleCleanupTimeoutId = setTimeout(() => {
116
+ if (hasActiveRGBDPointCloudWork()) {
117
+ scheduleRGBDPointCloudWorkersCleanup();
118
+ return;
119
+ }
120
+ disposeRGBDPointCloudWorkers();
121
+ }, RGBD_POINTCLOUD_IDLE_CLEANUP_MS);
122
+ }
123
+ function markRGBDPointCloudWorkersActive() {
124
+ scheduleRGBDPointCloudWorkersCleanup();
125
+ }
126
+ function replaceRGBDPointCloudWorker(index) {
127
+ const slots = ensureRGBDPointCloudWorkers();
128
+ const currentSlot = slots[index];
129
+ currentSlot?.dispose();
130
+ const replacementSlot = createRGBDPointCloudWorkerSlot();
131
+ slots[index] = replacementSlot;
132
+ markRGBDPointCloudWorkersActive();
133
+ return replacementSlot;
134
+ }
135
+ function tryAcquireRGBDPointCloudWorkerSlot() {
70
136
  const slots = rgbdPointCloudWorkers;
71
- const candidateSlots = slots
72
- .map((slot, index) => ({ slot, index }))
73
- .sort((left, right) => {
74
- if (left.slot.activeJobs !== right.slot.activeJobs) {
75
- return left.slot.activeJobs - right.slot.activeJobs;
137
+ const ensuredSlots = ensureRGBDPointCloudWorkers();
138
+ markRGBDPointCloudWorkersActive();
139
+ for (let offset = 0; offset < ensuredSlots.length; offset++) {
140
+ const index = (rgbdPointCloudWorkerIndex + offset) % ensuredSlots.length;
141
+ const slot = ensuredSlots[index];
142
+ if (!slot || slot.activeJobs > 0) {
143
+ continue;
76
144
  }
77
- const leftDistance = (left.index - rgbdPointCloudWorkerIndex + slots.length) % slots.length;
78
- const rightDistance = (right.index - rgbdPointCloudWorkerIndex + slots.length) % slots.length;
79
- return leftDistance - rightDistance;
80
- });
81
- const selected = candidateSlots[0];
82
- rgbdPointCloudWorkerIndex = (selected.index + 1) % slots.length;
83
- return selected.slot;
145
+ slot.activeJobs = 1;
146
+ rgbdPointCloudWorkerIndex = (index + 1) % ensuredSlots.length;
147
+ return { slot, index };
148
+ }
149
+ return undefined;
84
150
  }
85
151
  function repackYuv420pToI420(imageFrame, width, height) {
86
152
  const specs = imageFrame.fb ?? imageFrame.sourceFb;
87
153
  const source = ensureEvenByteLength(imageFrame.data);
88
154
  const yStride = specs?.stride || width;
89
- const uvWidth = Math.floor(width / 2);
90
- const uvHeight = Math.floor(height / 2);
155
+ const uvWidth = Math.ceil(width / 2);
156
+ const uvHeight = Math.ceil(height / 2);
91
157
  const uvStride = yStride > width ? Math.floor(yStride / 2) : uvWidth;
92
158
  const yPlaneSize = width * height;
93
159
  const uvPlaneSize = uvWidth * uvHeight;
@@ -167,12 +233,23 @@ function extractIntrinsicsFromTransformation(transformation) {
167
233
  },
168
234
  };
169
235
  }
170
- function resolveRGBDIntrinsics(message, fallbackIntrinsics) {
236
+ function resolveRGBDIntrinsicsFromMessage(message) {
171
237
  return (extractIntrinsicsFromTransformation(message.depthImgFrame?.transformation) ??
172
238
  extractIntrinsicsFromTransformation(message.depthEncodedFrame?.transformation) ??
173
239
  extractIntrinsicsFromTransformation(message.colorImgFrame?.transformation) ??
174
- extractIntrinsicsFromTransformation(message.colorEncodedFrame?.transformation) ??
175
- fallbackIntrinsics);
240
+ extractIntrinsicsFromTransformation(message.colorEncodedFrame?.transformation));
241
+ }
242
+ function getRGBDIntrinsics(topic, message, fallbackIntrinsics) {
243
+ const cachedIntrinsics = rgbdIntrinsicsByTopic.get(topic);
244
+ if (cachedIntrinsics) {
245
+ return cachedIntrinsics;
246
+ }
247
+ const resolvedIntrinsics = resolveRGBDIntrinsicsFromMessage(message);
248
+ if (resolvedIntrinsics) {
249
+ rgbdIntrinsicsByTopic.set(topic, resolvedIntrinsics);
250
+ return resolvedIntrinsics;
251
+ }
252
+ return fallbackIntrinsics;
176
253
  }
177
254
  async function extractEncodedColorFrame(encodedFrame, topicDecoders, topic) {
178
255
  const decodeFrame = async () => await new Promise((resolve, reject) => {
@@ -264,57 +341,251 @@ function parseDimensions(message) {
264
341
  }
265
342
  return obj;
266
343
  }
267
- export async function deserializeRGBDFrameToPointCloud({ topic, topicDecoders, cameraIntrinsics, maxStereoDepth, message, callback, }) {
268
- const workerSlot = getRGBDPointCloudWorkerSlot();
269
- workerSlot.activeJobs += 1;
344
+ function emitRGBDDepthPreview(topic, message, maxStereoDepth, callback, onError) {
345
+ if (!message.depthImgFrame) {
346
+ return;
347
+ }
348
+ const depthFrameForPreview = {
349
+ ...message.depthImgFrame,
350
+ data: message.depthImgFrame.data.slice(),
351
+ };
352
+ void deserializeDepthFrame({
353
+ topic,
354
+ message: depthFrameForPreview,
355
+ callback,
356
+ maxStereoDepth: maxStereoDepth / 1000,
357
+ }).catch(onError);
358
+ }
359
+ function emitRGBDPointCloud(frame, pointCloudData) {
360
+ const foxgloveMessage = {
361
+ timestamp: frame.timestamp ?? frame.receiveTime,
362
+ frame_id: `pointcloud-${frame.topic}-frame`,
363
+ point_stride: 16,
364
+ pose: {
365
+ position: { x: 0, y: 0, z: 0 },
366
+ orientation: { x: 0, y: 0, z: 1, w: 0 }
367
+ },
368
+ width: frame.depthWidth,
369
+ height: frame.depthHeight,
370
+ fields: [
371
+ { name: "x", offset: 0, type: NumericType.FLOAT32 },
372
+ { name: "y", offset: 4, type: NumericType.FLOAT32 },
373
+ { name: "z", offset: 8, type: NumericType.FLOAT32 },
374
+ { name: "red", offset: 12, type: NumericType.UINT8 },
375
+ { name: "green", offset: 13, type: NumericType.UINT8 },
376
+ { name: "blue", offset: 14, type: NumericType.UINT8 },
377
+ { name: "alpha", offset: 15, type: NumericType.UINT8 },
378
+ ],
379
+ data: pointCloudData,
380
+ };
381
+ frame.callback({
382
+ topic: frame.topic,
383
+ receiveTime: frame.receiveTime,
384
+ message: foxgloveMessage,
385
+ sizeInBytes: estimateObjectSize(foxgloveMessage),
386
+ schemaName: "foxglove.PointCloud.Colored"
387
+ });
388
+ }
389
+ function getRGBDBatchSignature(frame) {
390
+ const intrinsics = frame.rgbdIntrinsics.right;
391
+ return [
392
+ frame.depthWidth,
393
+ frame.depthHeight,
394
+ frame.colorFrame.width,
395
+ frame.colorFrame.height,
396
+ intrinsics.focalLenght.x,
397
+ intrinsics.focalLenght.y,
398
+ intrinsics.principalPoint.x,
399
+ intrinsics.principalPoint.y,
400
+ frame.maxStereoDepth,
401
+ frame.hasGPU,
402
+ ].join(":");
403
+ }
404
+ function clearRGBDBatchFlush(batch) {
405
+ if (batch.flushTimeoutId != undefined) {
406
+ clearTimeout(batch.flushTimeoutId);
407
+ batch.flushTimeoutId = undefined;
408
+ }
409
+ }
410
+ async function processRGBDPointCloudBatchOnWorker(workerSlot, workerIndex, frames) {
411
+ const firstFrame = frames[0];
412
+ if (!firstFrame) {
413
+ workerSlot.activeJobs = Math.max(0, workerSlot.activeJobs - 1);
414
+ return;
415
+ }
416
+ const intrinsics = firstFrame.rgbdIntrinsics.right;
417
+ let timeoutId;
418
+ try {
419
+ const pointClouds = await Promise.race([
420
+ workerSlot.remote.depthToPointcloudGPU(frames.map((frame) => frame.depthFrame), firstFrame.depthWidth, firstFrame.depthHeight, intrinsics.focalLenght.x, intrinsics.focalLenght.y, intrinsics.principalPoint.x, intrinsics.principalPoint.y, frames.map((frame) => frame.colorFrame.data), firstFrame.colorFrame.width, firstFrame.colorFrame.height, firstFrame.maxStereoDepth, { hasGPU: firstFrame.hasGPU }),
421
+ new Promise((_, reject) => {
422
+ timeoutId = setTimeout(() => {
423
+ reject(new Error(`RGBD pointcloud worker ${workerIndex} timed out after ${RGBD_POINTCLOUD_WORKER_TIMEOUT_MS}ms for topic ${firstFrame.topic} ` +
424
+ `(batch=${frames.length}, depth=${firstFrame.depthWidth}x${firstFrame.depthHeight}, color=${firstFrame.colorFrame.width}x${firstFrame.colorFrame.height}, hasGPU=${firstFrame.hasGPU})`));
425
+ }, RGBD_POINTCLOUD_WORKER_TIMEOUT_MS);
426
+ }),
427
+ ]);
428
+ if (timeoutId) {
429
+ clearTimeout(timeoutId);
430
+ timeoutId = undefined;
431
+ }
432
+ if (pointClouds.length !== frames.length) {
433
+ throw new Error(`RGBD pointcloud worker returned ${pointClouds.length} frames for batch size ${frames.length}`);
434
+ }
435
+ for (let index = 0; index < frames.length; index++) {
436
+ const frame = frames[index];
437
+ const pointCloud = pointClouds[index];
438
+ if (!frame || !pointCloud) {
439
+ continue;
440
+ }
441
+ emitRGBDPointCloud(frame, pointCloud);
442
+ }
443
+ }
444
+ catch (error) {
445
+ if (timeoutId) {
446
+ clearTimeout(timeoutId);
447
+ timeoutId = undefined;
448
+ }
449
+ if (error instanceof Error && error.message.includes("timed out")) {
450
+ replaceRGBDPointCloudWorker(workerIndex);
451
+ console.error(error);
452
+ }
453
+ const normalizedError = error instanceof Error ? error : new Error(String(error));
454
+ for (const frame of frames) {
455
+ frame.onError(normalizedError);
456
+ }
457
+ }
458
+ finally {
459
+ workerSlot.activeJobs = Math.max(0, workerSlot.activeJobs - 1);
460
+ markRGBDPointCloudWorkersActive();
461
+ }
462
+ }
463
+ async function processRGBDPointCloudOnWorker(workerSlot, workerIndex, frame) {
464
+ const intrinsics = frame.rgbdIntrinsics.right;
465
+ let timeoutId;
466
+ try {
467
+ const pointClouds = await Promise.race([
468
+ workerSlot.remote.depthToPointcloudGPU([frame.depthFrame], frame.depthWidth, frame.depthHeight, intrinsics.focalLenght.x, intrinsics.focalLenght.y, intrinsics.principalPoint.x, intrinsics.principalPoint.y, [frame.colorFrame.data], frame.colorFrame.width, frame.colorFrame.height, frame.maxStereoDepth, { hasGPU: frame.hasGPU }),
469
+ new Promise((_, reject) => {
470
+ timeoutId = setTimeout(() => {
471
+ reject(new Error(`RGBD pointcloud worker ${workerIndex} timed out after ${RGBD_POINTCLOUD_WORKER_TIMEOUT_MS}ms for topic ${frame.topic} ` +
472
+ `(depth=${frame.depthWidth}x${frame.depthHeight}, color=${frame.colorFrame.width}x${frame.colorFrame.height}, hasGPU=${frame.hasGPU})`));
473
+ }, RGBD_POINTCLOUD_WORKER_TIMEOUT_MS);
474
+ }),
475
+ ]);
476
+ if (timeoutId) {
477
+ clearTimeout(timeoutId);
478
+ timeoutId = undefined;
479
+ }
480
+ if (pointClouds.length !== 1 || !pointClouds[0]) {
481
+ throw new Error(`RGBD pointcloud worker returned ${pointClouds.length} frames for single-frame request`);
482
+ }
483
+ emitRGBDPointCloud(frame, pointClouds[0]);
484
+ }
485
+ catch (error) {
486
+ if (timeoutId) {
487
+ clearTimeout(timeoutId);
488
+ timeoutId = undefined;
489
+ }
490
+ if (error instanceof Error && error.message.includes("timed out")) {
491
+ replaceRGBDPointCloudWorker(workerIndex);
492
+ console.error(error);
493
+ }
494
+ frame.onError(error instanceof Error ? error : new Error(String(error)));
495
+ }
496
+ finally {
497
+ workerSlot.activeJobs = Math.max(0, workerSlot.activeJobs - 1);
498
+ markRGBDPointCloudWorkersActive();
499
+ }
500
+ }
501
+ function flushRGBDPointCloudBatch(topic) {
502
+ const batch = pendingRGBDBatches.get(topic);
503
+ if (!batch || batch.frames.length === 0) {
504
+ pendingRGBDBatches.delete(topic);
505
+ return;
506
+ }
507
+ clearRGBDBatchFlush(batch);
508
+ pendingRGBDBatches.delete(topic);
509
+ const reservedWorkerSelection = tryAcquireRGBDPointCloudWorkerSlot();
510
+ if (!reservedWorkerSelection) {
511
+ console.warn(`[RGBD] Dropping pointcloud frame for topic ${topic}: all RGBD pointcloud workers are busy.`);
512
+ return;
513
+ }
514
+ void processRGBDPointCloudBatchOnWorker(reservedWorkerSelection.slot, reservedWorkerSelection.index, batch.frames);
515
+ }
516
+ function enqueueRGBDPointCloudFrame(frame) {
517
+ if (!ENABLE_RGBD_GPU_BATCHING || !frame.hasGPU) {
518
+ const reservedWorkerSelection = tryAcquireRGBDPointCloudWorkerSlot();
519
+ if (!reservedWorkerSelection) {
520
+ console.warn(`[RGBD] Dropping pointcloud frame for topic ${frame.topic}: all RGBD pointcloud workers are busy.`);
521
+ return;
522
+ }
523
+ globalRenderMetricsManager.ensureTopic(constructKeyForTopicRenderMetrics("renderPointCloudFrame", "Point Cloud"));
524
+ globalInputEventMetricsManager.registerEvent(constructKeyForTopicRenderMetrics("incomingPointCloudFrame", "Point Cloud"));
525
+ globalDecodeMetricsManager.registerEvent("Point Cloud");
526
+ void processRGBDPointCloudOnWorker(reservedWorkerSelection.slot, reservedWorkerSelection.index, frame);
527
+ return;
528
+ }
529
+ const existingBatch = pendingRGBDBatches.get(frame.topic);
530
+ if (existingBatch &&
531
+ existingBatch.frames.length > 0 &&
532
+ getRGBDBatchSignature(existingBatch.frames[0]) !== getRGBDBatchSignature(frame)) {
533
+ flushRGBDPointCloudBatch(frame.topic);
534
+ }
535
+ const batch = pendingRGBDBatches.get(frame.topic) ?? { frames: [] };
536
+ batch.frames.push(frame);
537
+ pendingRGBDBatches.set(frame.topic, batch);
538
+ if (batch.frames.length >= RGBD_GPU_BATCH_SIZE) {
539
+ flushRGBDPointCloudBatch(frame.topic);
540
+ return;
541
+ }
542
+ clearRGBDBatchFlush(batch);
543
+ batch.flushTimeoutId = setTimeout(() => {
544
+ flushRGBDPointCloudBatch(frame.topic);
545
+ }, RGBD_GPU_BATCH_FLUSH_DELAY_MS);
546
+ }
547
+ export async function deserializeRGBDFrameToPointCloud({ topic, topicDecoders, cameraIntrinsics, maxStereoDepth, message, callback, onError, }) {
548
+ markRGBDPointCloudWorkersActive();
549
+ emitRGBDDepthPreview(topic, message, maxStereoDepth, callback, onError);
550
+ setTimeout(() => {
551
+ void processScheduledRGBDPointCloud({
552
+ topic,
553
+ topicDecoders,
554
+ cameraIntrinsics,
555
+ maxStereoDepth,
556
+ message,
557
+ callback,
558
+ onError,
559
+ });
560
+ }, RGBD_POINTCLOUD_SCHEDULE_DELAY_MS);
561
+ }
562
+ async function processScheduledRGBDPointCloud({ topic, topicDecoders, cameraIntrinsics, maxStereoDepth, message, callback, onError, }) {
270
563
  const { receiveTime } = parseMessage(message);
271
564
  const { depthWidth, depthHeight } = parseDimensions(message);
272
- const rgbdIntrinsics = resolveRGBDIntrinsics(message, cameraIntrinsics);
273
- const hasGPU = await detectRGBDGPUSupport();
274
- const colorFrame = await extractColorFrame(message.colorEncodedFrame, message.colorImgFrame, topicDecoders, topic);
275
- const uint8DepthFrames = extractDepthFrame(message.depthEncodedFrame, message.depthImgFrame);
276
- const depthFrames = uint8ArrayToUint16Array(uint8DepthFrames);
565
+ const rgbdIntrinsics = getRGBDIntrinsics(topic, message, cameraIntrinsics);
566
+ const hasGPU = getRGBDGPUSupport();
277
567
  try {
278
- const pointCloud = await workerSlot.remote.depthToPointcloudGPU([depthFrames], depthWidth, depthHeight, rgbdIntrinsics.right.focalLenght.x, rgbdIntrinsics.right.focalLenght.y, rgbdIntrinsics.right.principalPoint.x, rgbdIntrinsics.right.principalPoint.y, [colorFrame.data], colorFrame.width, colorFrame.height, maxStereoDepth, { hasGPU });
279
- const foxgloveMessage = {
280
- timestamp: message.tsDevice ?? receiveTime,
281
- frame_id: `pointcloud-${topic}-frame`,
282
- point_stride: 16,
283
- pose: {
284
- position: { x: 0, y: 0, z: 0 },
285
- orientation: { x: 0, y: 0, z: 1, w: 0 }
286
- },
287
- width: depthWidth,
288
- height: depthHeight,
289
- fields: [
290
- { name: "x", offset: 0, type: NumericType.FLOAT32 },
291
- { name: "y", offset: 4, type: NumericType.FLOAT32 },
292
- { name: "z", offset: 8, type: NumericType.FLOAT32 },
293
- { name: "red", offset: 12, type: NumericType.UINT8 },
294
- { name: "green", offset: 13, type: NumericType.UINT8 },
295
- { name: "blue", offset: 14, type: NumericType.UINT8 },
296
- { name: "alpha", offset: 15, type: NumericType.UINT8 },
297
- ],
298
- data: pointCloud[0]
299
- };
300
- callback({
568
+ const colorFrame = await extractColorFrame(message.colorEncodedFrame, message.colorImgFrame, topicDecoders, topic);
569
+ const uint8DepthFrames = extractDepthFrame(message.depthEncodedFrame, message.depthImgFrame);
570
+ const depthFrame = uint8ArrayToUint16Array(uint8DepthFrames);
571
+ const pendingFrame = {
301
572
  topic,
302
573
  receiveTime,
303
- message: foxgloveMessage,
304
- sizeInBytes: estimateObjectSize(foxgloveMessage),
305
- schemaName: "foxglove.PointCloud.Colored"
306
- });
307
- if (message.depthImgFrame) {
308
- void deserializeDepthFrame({
309
- topic,
310
- message: message.depthImgFrame,
311
- callback,
312
- maxStereoDepth: maxStereoDepth / 1000,
313
- });
314
- }
574
+ timestamp: message.tsDevice,
575
+ depthWidth,
576
+ depthHeight,
577
+ rgbdIntrinsics,
578
+ colorFrame,
579
+ depthFrame,
580
+ maxStereoDepth,
581
+ hasGPU,
582
+ callback,
583
+ onError,
584
+ };
585
+ enqueueRGBDPointCloudFrame(pendingFrame);
315
586
  }
316
- finally {
317
- workerSlot.activeJobs = Math.max(0, workerSlot.activeJobs - 1);
587
+ catch (error) {
588
+ onError(error instanceof Error ? error : new Error(String(error)));
318
589
  }
319
590
  }
320
591
  //# sourceMappingURL=rgbd-to-pointcloud.js.map