Skip to content

Commit

Permalink
Merge pull request #9642 from Tomertech/depth_fill_17183
Browse files Browse the repository at this point in the history
Updating presets
  • Loading branch information
ev-mp authored Sep 22, 2021
2 parents b2fc7d8 + e412aa5 commit 6d79d80
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 370 deletions.
59 changes: 20 additions & 39 deletions src/ds5/advanced_mode/advanced_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ namespace librealsense
{
auto p = get_all();
res_type res;

// configuration is empty before first streaming - so set default res
if (configuration.empty())
res = low_resolution;
Expand All @@ -87,11 +86,26 @@ namespace librealsense
case ds::RS430_PID:
case ds::RS430I_PID:
case ds::RS435_RGB_PID:
case ds::RS435I_PID:
case ds::RS465_PID:
case ds::RS455_PID:
case ds::RS435I_PID:
default_430(p);
break;
case ds::RS455_PID:
default_450_mid_low_res(p);
switch (res)
{
case low_resolution:
case medium_resolution:
//applied defaultly
break;
case high_resolution:
default_450_high_res(p);
break;
default:
throw invalid_value_exception(to_string() << "apply_preset(...) failed! Given device doesn't support Default Preset (pid=0x" <<
std::hex << device_pid << ")");
break;
}
case ds::RS405U_PID:
default_405u(p);
break;
Expand All @@ -117,46 +131,13 @@ namespace librealsense
p.depth_table.depthUnits = 100; // 0.1mm
break;
case RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY:
switch (res)
{
case low_resolution:
low_res_high_accuracy(p);
break;
case medium_resolution:
mid_res_high_accuracy(p);
break;
case high_resolution:
high_res_high_accuracy(p);
break;
}
high_accuracy(p);
break;
case RS2_RS400_VISUAL_PRESET_HIGH_DENSITY:
switch (res)
{
case low_resolution:
low_res_high_density(p);
break;
case medium_resolution:
mid_res_high_density(p);
break;
case high_resolution:
high_res_high_density(p);
break;
}
high_density(p);
break;
case RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY:
switch (res)
{
case low_resolution:
low_res_mid_density(p);
break;
case medium_resolution:
mid_res_mid_density(p);
break;
case high_resolution:
high_res_mid_density(p);
break;
}
mid_density(p);
break;
case RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN:
{
Expand Down
6 changes: 5 additions & 1 deletion src/ds5/advanced_mode/json_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ namespace librealsense
void load(const std::string& str) override
{
float value = static_cast<float>(::atof(str.c_str()));
strct->vals[0].*field = static_cast<S>(scale * value);
if (std::is_integral<S>::value) //in order to convert float to int correctly we add 0.5 and then use the floor function
value = std::floor(scale * value + 0.5f);
else
value = scale * value;
strct->vals[0].*field = static_cast<S>(value);
strct->update = true;
}

Expand Down
Loading

0 comments on commit 6d79d80

Please sign in to comment.