Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdr options and metadata enabled for mipi #12079

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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