Skip to content

Commit

Permalink
PR #12052 from remibettan: hdr options and metadata enabled for mipi
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Aug 1, 2023
2 parents 9fe8aa9 + ea06394 commit 43377e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
36 changes: 33 additions & 3 deletions src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ namespace librealsense
depth_sensor.register_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, enable_auto_exposure);

// register HDR options
if (!mipi_sensor && (_fw_version >= hdr_firmware_version))
if (_fw_version >= hdr_firmware_version)
{
auto d400_depth = As<d400_depth_sensor, synthetic_sensor>(&get_depth_sensor());
d400_depth->init_hdr_config(exposure_range, gain_range);
Expand Down Expand Up @@ -934,7 +934,7 @@ namespace librealsense
else
{
// used for mipi device
register_metadata_mipi(depth_sensor);
register_metadata_mipi(depth_sensor, hdr_firmware_version);
}
//mipi

Expand Down Expand Up @@ -1047,7 +1047,7 @@ namespace librealsense
}
}

void d400_device::register_metadata_mipi(const synthetic_sensor &depth_sensor) const
void d400_device::register_metadata_mipi(const synthetic_sensor &depth_sensor, const firmware_version& hdr_firmware_version) const
{
depth_sensor.register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_uvc_header_parser(&platform::uvc_header::timestamp));

Expand Down Expand Up @@ -1120,6 +1120,36 @@ namespace librealsense
make_attribute_parser(&md_mipi_depth_mode::crc,
md_mipi_depth_control_attributes::crc_attribute,
md_prop_offset));

if (_fw_version >= hdr_firmware_version)
{
depth_sensor.register_metadata(RS2_FRAME_METADATA_SEQUENCE_SIZE,
make_attribute_parser(&md_mipi_depth_mode::sub_preset_info,
md_configuration_attributes::sub_preset_info_attribute, md_prop_offset,
[](const rs2_metadata_type& param) {
// bit mask and offset used to get data from bitfield
return (param & md_configuration::SUB_PRESET_BIT_MASK_SEQUENCE_SIZE)
>> md_configuration::SUB_PRESET_BIT_OFFSET_SEQUENCE_SIZE;
}));

depth_sensor.register_metadata(RS2_FRAME_METADATA_SEQUENCE_ID,
make_attribute_parser(&md_mipi_depth_mode::sub_preset_info,
md_configuration_attributes::sub_preset_info_attribute, md_prop_offset,
[](const rs2_metadata_type& param) {
// bit mask and offset used to get data from bitfield
return (param & md_configuration::SUB_PRESET_BIT_MASK_SEQUENCE_ID)
>> md_configuration::SUB_PRESET_BIT_OFFSET_SEQUENCE_ID;
}));

depth_sensor.register_metadata(RS2_FRAME_METADATA_SEQUENCE_NAME,
make_attribute_parser(&md_mipi_depth_mode::sub_preset_info,
md_configuration_attributes::sub_preset_info_attribute, md_prop_offset,
[](const rs2_metadata_type& param) {
// bit mask and offset used to get data from bitfield
return (param & md_configuration::SUB_PRESET_BIT_MASK_ID)
>> md_configuration::SUB_PRESET_BIT_OFFSET_ID;
}));
}
}

void d400_device::create_snapshot(std::shared_ptr<debug_interface>& snapshot) const
Expand Down
2 changes: 1 addition & 1 deletion src/ds/d400/d400-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace librealsense
command get_flash_logs_command() const;

void register_metadata(const synthetic_sensor& depth_sensor, const firmware_version& hdr_firmware_version) const;
void register_metadata_mipi(const synthetic_sensor& depth_sensor) const;
void register_metadata_mipi(const synthetic_sensor& depth_sensor, const firmware_version& hdr_firmware_version) const;

void init(std::shared_ptr<context> ctx,
const platform::backend_device_group& group);
Expand Down

0 comments on commit 43377e1

Please sign in to comment.