Skip to content

Commit

Permalink
PR #13033 from remibettan: color_frame_timestamp_metadata_split_d400_…
Browse files Browse the repository at this point in the history
…d500

d500 devices - hw ts from capture stats
  • Loading branch information
remibettan committed Jun 19, 2024
2 parents b528706 + 8ba6584 commit 8cbb2f2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/ds/d400/d400-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ namespace librealsense

void d400_color::register_metadata(const synthetic_sensor& color_ep) const
{
color_ep.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_uvc_header_parser(&platform::uvc_header::timestamp));

auto md_prop_offset = metadata_raw_mode_offset +
offsetof(md_rgb_mode, rgb_mode) +
offsetof(md_rgb_normal_mode, intel_capture_timing);

color_ep.register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP, make_rs400_sensor_ts_parser(make_uvc_header_parser(&platform::uvc_header::timestamp),
make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset)));

if (_separate_color)
{
auto md_prop_offset = metadata_raw_mode_offset +
Expand Down
14 changes: 14 additions & 0 deletions src/ds/d500/d500-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ namespace librealsense
color_ep.register_metadata(RS2_FRAME_METADATA_AUTO_EXPOSURE, make_attribute_parser(&md_rgb_control::ae_mode, md_rgb_control_attributes::ae_mode_attribute, md_prop_offset,
[](rs2_metadata_type param) { return (param != 1); })); // OFF value via UVC is 1 (ON is 8)

md_prop_offset = metadata_raw_mode_offset +
offsetof(md_rgb_mode, rgb_mode) +
offsetof(md_rgb_normal_mode, intel_capture_stats);

color_ep.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_attribute_parser(&md_capture_stats::hw_timestamp, md_capture_stat_attributes::hw_timestamp_attribute, md_prop_offset));

md_prop_offset = metadata_raw_mode_offset +
offsetof(md_rgb_mode, rgb_mode) +
offsetof(md_rgb_normal_mode, intel_capture_timing);

color_ep.register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP,
make_rs400_sensor_ts_parser(make_attribute_parser(&md_capture_stats::hw_timestamp, md_capture_stat_attributes::hw_timestamp_attribute, md_prop_offset),
make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset)));

_ds_color_common->register_metadata();
}

Expand Down
9 changes: 4 additions & 5 deletions src/ds/d500/d500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,6 @@ namespace librealsense

depth_sensor.register_option( RS2_OPTION_ERROR_POLLING_ENABLED,
std::make_shared< polling_errors_disable >( _polling_error_handler ) );

// Metadata registration
depth_sensor.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_uvc_header_parser(&uvc_header::timestamp));
}); //group_multiple_fw_calls

// attributes of md_capture_timing
Expand All @@ -566,14 +563,16 @@ namespace librealsense
offsetof(md_depth_y_normal_mode, intel_capture_timing);

depth_sensor.register_metadata(RS2_FRAME_METADATA_FRAME_COUNTER, make_attribute_parser(&md_capture_timing::frame_counter, md_capture_timing_attributes::frame_counter_attribute, md_prop_offset));
depth_sensor.register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP, make_rs400_sensor_ts_parser(make_uvc_header_parser(&uvc_header::timestamp),
make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset)));
depth_sensor.register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP,
make_rs400_sensor_ts_parser(make_attribute_parser(&md_capture_stats::hw_timestamp, md_capture_stat_attributes::hw_timestamp_attribute, md_prop_offset),
make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset)));

// attributes of md_capture_stats
md_prop_offset = metadata_raw_mode_offset +
offsetof(md_depth_mode, depth_y_mode) +
offsetof(md_depth_y_normal_mode, intel_capture_stats);

depth_sensor.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_attribute_parser(&md_capture_stats::hw_timestamp, md_capture_stat_attributes::hw_timestamp_attribute, md_prop_offset));
depth_sensor.register_metadata(RS2_FRAME_METADATA_WHITE_BALANCE, make_attribute_parser(&md_capture_stats::white_balance, md_capture_stat_attributes::white_balance_attribute, md_prop_offset));

// attributes of md_depth_control
Expand Down
3 changes: 0 additions & 3 deletions src/ds/ds-color-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ namespace librealsense

void ds_color_common::register_metadata()
{
_color_ep.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_uvc_header_parser(&platform::uvc_header::timestamp));
_color_ep.register_metadata(RS2_FRAME_METADATA_ACTUAL_FPS, std::make_shared<ds_md_attribute_actual_fps>());

// attributes of md_capture_timing
Expand All @@ -75,8 +74,6 @@ namespace librealsense
offsetof(md_rgb_normal_mode, intel_capture_timing);

_color_ep.register_metadata(RS2_FRAME_METADATA_FRAME_COUNTER, make_attribute_parser(&md_capture_timing::frame_counter, md_capture_timing_attributes::frame_counter_attribute, md_prop_offset));
_color_ep.register_metadata(RS2_FRAME_METADATA_SENSOR_TIMESTAMP, make_rs400_sensor_ts_parser(make_uvc_header_parser(&platform::uvc_header::timestamp),
make_attribute_parser(&md_capture_timing::sensor_timestamp, md_capture_timing_attributes::sensor_timestamp_attribute, md_prop_offset)));

// attributes of md_rgb_control
md_prop_offset = metadata_raw_mode_offset +
Expand Down
3 changes: 2 additions & 1 deletion src/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ namespace librealsense
zoom_factor_attribute = (1u << 8),
scene_mode_attribute = (1u << 9),
sensor_framerate_attribute = (1u << 10),
hw_timestamp_attribute = (1u << 11)
};

/**\brief md_depth_control_attributes - bit mask to find active attributes,
Expand Down Expand Up @@ -384,7 +385,7 @@ namespace librealsense
{
md_header header;
uint32_t flags;
uint32_t reserved;
uint32_t hw_timestamp;
uint64_t exposure_time;
uint64_t exposure_compensation_flags;
int32_t exposure_compensation_value;
Expand Down

0 comments on commit 8cbb2f2

Please sign in to comment.