Repository navigation
feat(codec): deserializePointCloudView — decode PJ.PointCloud without copying the points (0.35.0) - #201
Merged
Conversation
… copying the points (0.35.0) deserializePointCloud() copies the packed point bytes out of the wire buffer for every sample. deserializePointCloudView(data, size, anchor) points the cloud's `data` into the input instead and keeps it alive through the caller's BufferAnchor, like deserializeVideoFrameView. A null anchor copies, exactly as before. A new name rather than an overload: builtin_object_codec.cpp (and any consumer) takes the address of deserializePointCloud, which an overload would make ambiguous. Motivation (PJ4, Iris Xe): the host's per-sample copy of a 10M-point cloud costs a memmove plus ~29k first-touch page faults per frame; with the view the 10M stream frame went from 137 to 71 ms of wall time. MINOR: an additive client-side helper; host contract unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3ZZU95hWdyWcCj8dQkmAi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PJ::deserializePointCloudView(data, size, BufferAnchor anchor)inpj_base/builtin/point_cloud_codec.hpp. It decodes a canonicalPJ.PointCloudwhile pointingdatainto the input buffer instead of copying it, and keeps that buffer alive through the caller's anchor. This mirrorsdeserializeVideoFrameView.deserializePointCloud(), which is unchanged.decodePointCloud, so validation and field handling are the same code path.builtin_object_codec.cpptakes&deserializePointCloud, and an overload would make that ambiguous, for consumers as well.Why
PJ4's host decodes every point-cloud sample from the ObjectStore, and that payload is already immutable and anchored. Measured on the PJ4 QRhi branch (Iris Xe, 5 interleaved rounds) with a local build of this change:
deserializePointCloud)deserializePointCloudView)At 300k points, GUI CPU goes from 1.73 to 1.36 ms.
Versioning
MINOR (0.35.0). This is an additive client-side helper: no host surface, no vtable or ABI change, and existing binaries are unaffected. The CHANGELOG records
Host contract: unchanged (no floor impact), andVERSIONis bumped.Test plan
point_cloud_codec_test: 7/7 pass, including 3 new tests:./build.sh --sdk-local: the point-cloud golden images are byte-identical.🤖 Generated with Claude Code
https://claude.ai/code/session_01V3ZZU95hWdyWcCj8dQkmAi