Repository navigation
Allow loading json for auto-hdr - #14046
Conversation
|
I see the windows GHA runner has a depracation error
|
| return map; | ||
| } | ||
|
|
||
| std::string controlNameFromId( ControlId id ) |
There was a problem hiding this comment.
Why did we change the naming convention?
CamelCase instead of using _ like above?
Same comment for all functions added here
There was a problem hiding this comment.
saw it was used like that on a commented code on another file (bottom of hdr-config.cpp), thought it was intentional
I will change it to the regular naming convention
| { | ||
| return it->second; | ||
| } | ||
| throw std::invalid_argument("Error: Incorrect buffer! controlName NOT found! (" + std::to_string(id) + ")"); |
There was a problem hiding this comment.
It gets an id not name, right?
| // Build reverse map on first use | ||
| static const std::unordered_map< std::string, ControlId > string_control_id_map = []() | ||
| { | ||
| std::unordered_map< std::string, ControlId > result; |
|
General comment please add a unit test for this feature |
| "algorithm\nClick the button, then draw a rect on the frame" ); | ||
| } | ||
|
|
||
| //if (opt == RS2_OPTION_HDR_ENABLED && false) // TODO: enable this when the auto-hdr feature is fully implemented, currently works via the load/save preset buttons at the top of the viewer - make sure to disable HDR before loading! |
There was a problem hiding this comment.
Instead of a comment lets add the code and wrap with a compilation flag
#if defined(AUTO_HDR)
#endif
There was a problem hiding this comment.
Do we plan on creating a compilation flag for this feature alone? or this is temporary until we add the feature?
|
@OhadMeir please continue the review as I will be OOO |
| static constexpr uint8_t size() { return sizeof(item_header); } | ||
| }; | ||
|
|
||
| struct Control { |
There was a problem hiding this comment.
Also I think librealsense::control is to common name for this. Maybe put under hdr namespace (will also remove need to comment hdr structs region).
| static constexpr uint8_t size() { return sizeof(Control); } | ||
| }; | ||
|
|
||
| struct sub_preset |
There was a problem hiding this comment.
Is sub_preset the best name? It does not convey any meaning
I know it's the FW name but it doesn't have to be ours too...
hdr_setting/hdr_control or similar will be better
| white_balance_control color_white_balance; | ||
| auto_white_balance_control color_auto_white_balance; | ||
| power_line_frequency_control color_power_line_frequency; | ||
| sub_preset sub_preset; |
There was a problem hiding this comment.
Does hdr setting need to change if changing visual preset?
| error_message = safe_call([&]() { | ||
| dev->dev.as<serializable_device>().load_json(str); | ||
|
|
||
| LOG_INFO("HDR config loaded from JSON file: " << ret); |
There was a problem hiding this comment.
Use notification_model::add_log. Remove easylogging include
| void get_color_white_balance(white_balance_control* ptr) const; | ||
| void get_color_auto_white_balance(auto_white_balance_control* ptr) const; | ||
| void get_color_power_line_frequency(power_line_frequency_control* ptr) const; | ||
| void get_sub_preset(hdr::hdr_control* ptr) const; |
There was a problem hiding this comment.
As mentioned elsewhere, don't use the term "sub_preset". You can "get_hdr_preset" or "get_hdr_control", etc...
| } | ||
|
|
||
| // Given a sub_preset_header and items, build the byte buffer | ||
| std::vector<uint8_t> serialize_sub_preset( |
There was a problem hiding this comment.
Also here, don't use "sub_preset". Try "serialize_hdr_data/control/preset"
|
|
||
| sub_preset["items"].push_back(std::move(item)); | ||
| } | ||
| preset_writer.write_root_param("SubPreset", sub_preset); |
There was a problem hiding this comment.
Also rename SubPreset and sub_preset here.
There was a problem hiding this comment.
this is used to write to JSON, we will have to keep SubPreset here, but I will rename sub_preset to something else
| static const std::unordered_map< control_id, std::string > control_id_string_map = { | ||
| { DEPTH_LASER_MODE, "DepthLaserMode" }, | ||
| { DEPTH_MAN_EXP, "DepthManExp" }, | ||
| { DEPTH_GAIN, "DepthGain" }, |
There was a problem hiding this comment.
@OhadMeir If we change the JSON keys, we can also change those, right? call those depth-laser-mode, depth-exposure and depth-gain
| // build 'controls' array for the item | ||
| for (int c = 0; c < ih.num_of_controls; ++c) { | ||
| const hdr_preset::sub_control& ctrl = auto_hdr.items[i].second[c]; | ||
| const std::string controlName = control_name_from_id( hdr_preset::control_id( ctrl.control_id ) ); |
OhadMeir
left a comment
There was a problem hiding this comment.
Looks good. Will merge after minor fix (rename)
Tracked on: [LRS-1270]