Skip to content

[RSDEV-13202][D585][gmsl] Render RGB calibration in RealSense Viewer - #15566

Draft
polejoe wants to merge 2 commits into
realsenseai:developmentfrom
polejoe:viewer/render-rgb-calib
Draft

[RSDEV-13202][D585][gmsl] Render RGB calibration in RealSense Viewer#15566
polejoe wants to merge 2 commits into
realsenseai:developmentfrom
polejoe:viewer/render-rgb-calib

Conversation

@polejoe

@polejoe polejoe commented Aug 17, 2026

Copy link
Copy Markdown

Overview: Adds a color preview for D500 GMSL RW16 calibration streams in RealSense Viewer while preserving the existing unsupported behavior for unrelated RAW16 streams.

Tracked on [RSDEV-13202]

Depends on #15565

Why

D500 GMSL exposes the RGB calibration surface as RAW16 through the RW16 V4L2 format. RealSense Viewer treated every RAW16 stream as unsupported and cleared its preview, so the calibration profile appeared as a black stream.

Summary

  • Identify D500 MIPI color RAW16 profiles as RW16 GRBG10 calibration surfaces.
  • Label those profiles as RW16 in the Viewer profile selector.
  • Convert each 2x2 GRBG10 Bayer block into an RGB preview without changing RAW16 behavior for other devices.
  • Keep the RGB calibration commit stacked on the NV12 branch from [D585][gmsl][RSDEV-13159] Enable NV12 color in RealSense Viewer #15565.

Test plan

  • The original calibration change passed a Jetson ARM64 Viewer/full build and rendered RW16 at 1600x1300@25 before the PR split.
  • Re-run the stacked head build and live Viewer check on Jetson67 when the shared bench is available.

🤖 Generated by AI

Problem: D500 GMSL exposes native NV12 profiles, but the D500 color processing graph registered only YUYV, so NV12 was filtered from the SDK profile set. Semi-planar frames were also assigned a 12-bpp-derived row stride that did not match their byte-per-pixel plane layout.

Fix: Register NV12 conversion and identity paths first for D500 MIPI while retaining YUYV fallback. Assign byte-row stride for NV12/M420 and expose their complete contiguous buffers through the Python buffer protocol.

Validation: The Jetson ARM64 RelWithDebInfo full build passed, including pyrealsense2. D585 GMSL NV12 profile enumeration, 1280x960@60 capture, and Python buffer layout validation passed.
Signed-off-by: zhou <shengyong.zhou@realsenseai.com>
Problem: The viewer treated every RAW16 stream as unsupported, and its generic texture fallback cleared the frame, so D500 GMSL RGB calibration profiles enumerated but rendered as a black unsupported stream.

Fix: Identify D500 MIPI Color RAW16 as the RW16 GRBG10 calibration surface, label it accordingly, and render its little-endian 10-bit Bayer samples through a 2x2 GRBG-to-RGB preview. Other RAW16 devices keep the existing unsupported behavior.

Validation: The Jetson ARM64 viewer target and full RelWithDebInfo build passed. Build-tree and system-installed viewers rendered RW16 at 1600x1300@25 without the unsupported overlay; the frame counter advanced continuously from 207 to 686 and the rendered region measured Y=16..235.
Signed-off-by: zhou <shengyong.zhou@realsenseai.com>

@sysrsbuild-gh-agentic sysrsbuild-gh-agentic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by rs-agentic bot — potential BUGs flagged inline below.

Comment thread common/rendering.h
{
if( ! raw16_grbg10 )
{
memset( (void *)data, 0, height * width );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 [rs-agentic bot — auto generated] BUG: data is const void*; casting it away and writing via memset is undefined behaviour and can silently corrupt the frame buffer for any other consumer sharing the same data pointer. Use a separate local zero-filled buffer instead of mutating the input.

Also the size height * width is half the actual RAW16 frame size (height * width * 2 bytes); even ignoring the const issue, only half the buffer is being zeroed.

Comment thread common/rendering.h
auto bytes = static_cast< const uint8_t * >( data );
for( int y = 0; y < height - 1; y += 2 )
{
auto row0 = reinterpret_cast< const uint16_t * >( bytes + y * stride );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 [rs-agentic bot — auto generated] BUG: stride is used here but is not introduced in this diff. Please confirm it is already in scope inside the enclosing upload function — if not, this will not compile.


std::string format = rs2_format_to_string(profile.format());

// D500 MIPI exposes the RAW16 SDK format through the RW16 V4L2 fourcc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 [rs-agentic bot — auto generated] BUG: use_rw16_label relabels all RS2_FORMAT_RAW16 profiles on D500 MIPI (not just the color stream) to "RW16". This is inconsistent with the narrower guard in stream-model.cpp which also requires p.stream_type() == RS2_STREAM_COLOR. Add the same stream-type check here to avoid mislabeling unrelated RAW16 profiles.

@polejoe polejoe changed the title [D585][gmsl] Render RGB calibration in RealSense Viewer [RSDEV-13202][D585][gmsl] Render RGB calibration in RealSense Viewer Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants