Skip to content

Commit

Permalink
remove HDR option from D500
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Feb 18, 2024
1 parent 956c586 commit afb0675
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 73 deletions.
76 changes: 4 additions & 72 deletions src/ds/d500/d500-device.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2022 Intel Corporation. All Rights Reserved.

#include "device.h"
#include "image.h"
#include "metadata-parser.h"
#include "metadata.h"
#include <src/backend.h>
Expand All @@ -17,21 +15,15 @@
#include <src/depth-sensor.h>
#include "stream.h"
#include "environment.h"
#include "d500-color.h"
#include "ds/d400/d400-nonmonochrome.h"

#include <src/ds/features/amplitude-factor-feature.h>
#include <src/ds/features/auto-exposure-roi-feature.h>

#include "proc/depth-formats-converter.h"
#include "proc/y8i-to-y8y8.h"
#include "proc/y12i-to-y16y16.h"
#include "proc/y16i-to-y10msby10msb.h"
#include "proc/color-formats-converter.h"

#include "hdr-config.h"
#include "../common/fw/firmware-version.h"
#include "fw-update/fw-update-unsigned.h"
#include <src/fourcc.h>

#include <rsutils/string/hexdump.h>
Expand Down Expand Up @@ -129,8 +121,7 @@ namespace librealsense
: synthetic_sensor(ds::DEPTH_STEREO, uvc_sensor, owner, d500_depth_fourcc_to_rs2_format,
d500_depth_fourcc_to_rs2_stream),
_owner(owner),
_depth_units(-1),
_hdr_cfg(nullptr)
_depth_units(-1)
{ }

processing_blocks get_recommended_processing_blocks() const override
Expand Down Expand Up @@ -260,14 +251,6 @@ namespace librealsense
set_frame_metadata_modifier([&](frame_additional_data& data) {data.depth_units = _depth_units.load(); });
}

void init_hdr_config(const option_range& exposure_range, const option_range& gain_range)
{
_hdr_cfg = std::make_shared<hdr_config>(*(_owner->_hw_monitor), get_raw_sensor(),
exposure_range, gain_range);
}

std::shared_ptr<hdr_config> get_hdr_config() { return _hdr_cfg; }

float get_stereo_baseline_mm() const override { return _owner->get_stereo_baseline_mm(); }

float get_preset_max_value() const override
Expand All @@ -279,7 +262,6 @@ namespace librealsense
const d500_device* _owner;
mutable std::atomic<float> _depth_units;
float _stereo_baseline_mm;
std::shared_ptr<hdr_config> _hdr_cfg;
};

bool d500_device::is_camera_in_advanced_mode() const
Expand Down Expand Up @@ -403,7 +385,7 @@ namespace librealsense
return get_d500_raw_calibration_table(d500_calibration_table_id::rgb_calibration_id);
};

if (((hw_mon_over_xu) && (RS400_IMU_PID != _pid)) || (!group.usb_devices.size()))
if (hw_mon_over_xu || (!group.usb_devices.size()))
{
_hw_monitor = std::make_shared<hw_monitor_extended_buffers>(
std::make_shared<locked_transfer>(
Expand Down Expand Up @@ -495,70 +477,20 @@ namespace librealsense
std::make_shared<uvc_xu_option<uint8_t>>(raw_depth_sensor, depth_xu, DS5_EXT_TRIGGER,
"Generate trigger from the camera to external device once per frame"));

std::shared_ptr<option> exposure_option = nullptr;
std::shared_ptr<option> gain_option = nullptr;
std::shared_ptr<hdr_option> hdr_enabled_option = nullptr;

//EXPOSURE AND GAIN - preparing uvc options
auto uvc_xu_exposure_option = std::make_shared<uvc_xu_option<uint32_t>>(raw_depth_sensor,
auto exposure_option = std::make_shared<uvc_xu_option<uint32_t>>(raw_depth_sensor,
depth_xu,
DS5_EXPOSURE,
"Depth Exposure (usec)");
option_range exposure_range = uvc_xu_exposure_option->get_range();
auto uvc_pu_gain_option = std::make_shared<uvc_pu_option>(raw_depth_sensor, RS2_OPTION_GAIN);
option_range gain_range = uvc_pu_gain_option->get_range();
auto gain_option = std::make_shared<uvc_pu_option>(raw_depth_sensor, RS2_OPTION_GAIN);

//AUTO EXPOSURE
auto enable_auto_exposure = std::make_shared<uvc_xu_option<uint8_t>>(raw_depth_sensor,
depth_xu,
DS5_ENABLE_AUTO_EXPOSURE,
"Enable Auto Exposure");
depth_sensor.register_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, enable_auto_exposure);

// register HDR options
//auto global_shutter_mask = ds_caps::CAP_GLOBAL_SHUTTER;
auto d500_depth = As<d500_depth_sensor, synthetic_sensor>(&get_depth_sensor());
d500_depth->init_hdr_config(exposure_range, gain_range);
auto hdr_cfg = d500_depth->get_hdr_config();

// values from 4 to 14 - for internal use
// value 15 - saved for emiter on off subpreset
option_range hdr_id_range = { 0.f /*min*/, 3.f /*max*/, 1.f /*step*/, 1.f /*default*/ };
auto hdr_id_option = std::make_shared<hdr_option>(hdr_cfg, RS2_OPTION_SEQUENCE_NAME, hdr_id_range,
std::map<float, std::string>{ {0.f, "0"}, { 1.f, "1" }, { 2.f, "2" }, { 3.f, "3" } });
depth_sensor.register_option(RS2_OPTION_SEQUENCE_NAME, hdr_id_option);

option_range hdr_sequence_size_range = { 2.f /*min*/, 2.f /*max*/, 1.f /*step*/, 2.f /*default*/ };
auto hdr_sequence_size_option = std::make_shared<hdr_option>(hdr_cfg, RS2_OPTION_SEQUENCE_SIZE, hdr_sequence_size_range,
std::map<float, std::string>{ { 2.f, "2" } });
depth_sensor.register_option(RS2_OPTION_SEQUENCE_SIZE, hdr_sequence_size_option);

option_range hdr_sequ_id_range = { 0.f /*min*/, 2.f /*max*/, 1.f /*step*/, 0.f /*default*/ };
auto hdr_sequ_id_option = std::make_shared<hdr_option>(hdr_cfg, RS2_OPTION_SEQUENCE_ID, hdr_sequ_id_range,
std::map<float, std::string>{ {0.f, "UVC"}, { 1.f, "1" }, { 2.f, "2" } });
depth_sensor.register_option(RS2_OPTION_SEQUENCE_ID, hdr_sequ_id_option);

option_range hdr_enable_range = { 0.f /*min*/, 1.f /*max*/, 1.f /*step*/, 0.f /*default*/ };
hdr_enabled_option = std::make_shared<hdr_option>(hdr_cfg, RS2_OPTION_HDR_ENABLED, hdr_enable_range);
depth_sensor.register_option(RS2_OPTION_HDR_ENABLED, hdr_enabled_option);

//EXPOSURE AND GAIN - preparing hdr options
auto hdr_exposure_option = std::make_shared<hdr_option>(hdr_cfg, RS2_OPTION_EXPOSURE, exposure_range);
auto hdr_gain_option = std::make_shared<hdr_option>(hdr_cfg, RS2_OPTION_GAIN, gain_range);

//EXPOSURE AND GAIN - preparing hybrid options
auto hdr_conditional_exposure_option = std::make_shared<hdr_conditional_option>(hdr_cfg, uvc_xu_exposure_option, hdr_exposure_option);
auto hdr_conditional_gain_option = std::make_shared<hdr_conditional_option>(hdr_cfg, uvc_pu_gain_option, hdr_gain_option);

exposure_option = hdr_conditional_exposure_option;
gain_option = hdr_conditional_gain_option;

std::vector<std::pair<std::shared_ptr<option>, std::string>> options_and_reasons = { std::make_pair(hdr_enabled_option,
"Auto Exposure cannot be set while HDR is enabled") };
depth_sensor.register_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE,
std::make_shared<gated_option>(
enable_auto_exposure,
options_and_reasons));

//EXPOSURE
depth_sensor.register_option(RS2_OPTION_EXPOSURE,
Expand Down
1 change: 0 additions & 1 deletion src/ds/d500/d500-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

namespace librealsense
{
class hdr_config;
class d400_thermal_monitor;
class ds_devices_common;
class d500_info;
Expand Down

0 comments on commit afb0675

Please sign in to comment.