diff --git a/common/model-views.cpp b/common/model-views.cpp index 9ada1ea90b..de9dd46de8 100644 --- a/common/model-views.cpp +++ b/common/model-views.cpp @@ -40,18 +40,6 @@ #include "opengl3.h" - rs2_sensor_mode rs2::resolution_from_width_height(int width, int height) -{ - if ((width == 240 && height == 320) || (width == 320 && height == 240)) - return RS2_SENSOR_MODE_QVGA; - else if ((width == 640 && height == 480) || (height == 640 && width == 480)) - return RS2_SENSOR_MODE_VGA; - else if ((width == 1024 && height == 768) || (height == 1024 && width == 768)) - return RS2_SENSOR_MODE_XGA; - else - return RS2_SENSOR_MODE_COUNT; -} - ImVec4 flip(const ImVec4& c) { return{ c.y, c.x, c.z, c.w }; diff --git a/common/model-views.h b/common/model-views.h index fbdff04027..5d444dceff 100644 --- a/common/model-views.h +++ b/common/model-views.h @@ -48,8 +48,6 @@ namespace rs2 static const float FEET_TO_METER = 0.3048f; - rs2_sensor_mode resolution_from_width_height(int width, int height); - template void sort_together(std::vector& vec, std::vector& names) { diff --git a/common/subdevice-model.cpp b/common/subdevice-model.cpp index b4dbf10ce5..98251d0d4a 100644 --- a/common/subdevice-model.cpp +++ b/common/subdevice-model.cpp @@ -10,49 +10,6 @@ namespace rs2 { - static void width_height_from_resolution(rs2_sensor_mode mode, int& width, int& height) - { - switch (mode) - { - case RS2_SENSOR_MODE_VGA: - width = 640; - height = 480; - break; - case RS2_SENSOR_MODE_XGA: - width = 1024; - height = 768; - break; - case RS2_SENSOR_MODE_QVGA: - width = 320; - height = 240; - break; - default: - width = height = 0; - break; - } - } - - static int get_resolution_id_from_sensor_mode(rs2_sensor_mode sensor_mode, - const std::vector< std::pair< int, int > >& res_values) - { - int width = 0, height = 0; - width_height_from_resolution(sensor_mode, width, height); - auto iter = std::find_if(res_values.begin(), - res_values.end(), - [width, height](std::pair< int, int > res) { - if (((res.first == width) && (res.second == height)) - || ((res.first == height) && (res.second == width))) - return true; - return false; - }); - if (iter != res_values.end()) - { - return static_cast(std::distance(res_values.begin(), iter)); - } - - throw std::runtime_error("cannot convert sensor mode to resolution ID"); - } - std::vector get_string_pointers(const std::vector& vec) { std::vector res; @@ -436,33 +393,6 @@ namespace rs2 ui.selected_res_id = selection_index; } - if (new_device_connected) - { - // Have the various preset options automatically update based on the resolution of the - // (closed) stream... - // TODO we have no res_values when loading color rosbag, and color sensor isn't - // even supposed to support SENSOR_MODE... see RS5-7726 - if (s->supports(RS2_OPTION_SENSOR_MODE) && !res_values.empty()) - { - // Watch out for read-only options in the playback sensor! - try - { - auto requested_sensor_mode = static_cast(resolution_from_width_height( - res_values[ui.selected_res_id].first, - res_values[ui.selected_res_id].second)); - - auto currest_sensor_mode = s->get_option(RS2_OPTION_SENSOR_MODE); - - if (requested_sensor_mode != currest_sensor_mode) - s->set_option(RS2_OPTION_SENSOR_MODE, requested_sensor_mode); - } - catch (not_implemented_error const&) - { - // Just ignore for now: need to figure out a way to write to playback sensors... - } - } - } - if (ui.is_multiple_resolutions) { for (auto it = ui.selected_res_id_map.begin(); it != ui.selected_res_id_map.end(); ++it) @@ -568,46 +498,8 @@ namespace rs2 res = true; _options_invalidated = true; - // Set sensor mode only at the Viewer app, - // DQT app will handle the sensor mode when the streaming is off (while reseting the stream) - if (s->supports(RS2_OPTION_SENSOR_MODE) && !allow_change_resolution_while_streaming) - { - auto width = res_values[tmp_selected_res_id].first; - auto height = res_values[tmp_selected_res_id].second; - auto res = resolution_from_width_height(width, height); - if (res >= RS2_SENSOR_MODE_VGA && res < RS2_SENSOR_MODE_COUNT) - { - try - { - s->set_option(RS2_OPTION_SENSOR_MODE, float(res)); - } - catch (const error& e) - { - error_message = error_to_string(e); - } + ui.selected_res_id = tmp_selected_res_id; - // Only update the cached value once set_option is done! That way, if it doesn't change anything... - try - { - int sensor_mode_val = static_cast(s->get_option(RS2_OPTION_SENSOR_MODE)); - { - ui.selected_res_id = get_resolution_id_from_sensor_mode( - static_cast(sensor_mode_val), - res_values); - } - } - catch (...) {} - } - else - { - error_message = rsutils::string::from() << "Resolution " << width << "x" << height - << " is not supported on this device"; - } - } - else - { - ui.selected_res_id = tmp_selected_res_id; - } } ImGui::PopStyleColor(); ImGui::PopItemWidth(); @@ -807,47 +699,9 @@ namespace rs2 { res = true; _options_invalidated = true; + + ui.selected_res_id_map[stream_type_id] = tmp_selected_res_id; - // Set sensor mode only at the Viewer app, - // DQT app will handle the sensor mode when the streaming is off (while reseting the stream) - if (s->supports(RS2_OPTION_SENSOR_MODE) && !allow_change_resolution_while_streaming) - { - auto width = res_values[tmp_selected_res_id].first; - auto height = res_values[tmp_selected_res_id].second; - auto res = resolution_from_width_height(width, height); - if (res >= RS2_SENSOR_MODE_VGA && res < RS2_SENSOR_MODE_COUNT) - { - try - { - s->set_option(RS2_OPTION_SENSOR_MODE, float(res)); - } - catch (const error& e) - { - error_message = error_to_string(e); - } - - // Only update the cached value once set_option is done! That way, if it doesn't change anything... - try - { - int sensor_mode_val = static_cast(s->get_option(RS2_OPTION_SENSOR_MODE)); - { - ui.selected_res_id = get_resolution_id_from_sensor_mode( - static_cast(sensor_mode_val), - res_values); - } - } - catch (...) {} - } - else - { - error_message = rsutils::string::from() << "Resolution " << width << "x" << height - << " is not supported on this device"; - } - } - else - { - ui.selected_res_id_map[stream_type_id] = tmp_selected_res_id; - } } ImGui::PopStyleColor(); ImGui::PopItemWidth(); diff --git a/common/viewer.cpp b/common/viewer.cpp index e515c7234e..26d3f93376 100644 --- a/common/viewer.cpp +++ b/common/viewer.cpp @@ -788,7 +788,6 @@ namespace rs2 _hidden_options.emplace(RS2_OPTION_STREAM_FORMAT_FILTER); _hidden_options.emplace(RS2_OPTION_STREAM_INDEX_FILTER); _hidden_options.emplace(RS2_OPTION_FRAMES_QUEUE_SIZE); - _hidden_options.emplace(RS2_OPTION_SENSOR_MODE); _hidden_options.emplace(RS2_OPTION_NOISE_ESTIMATION); _hidden_options.emplace(RS2_OPTION_REGION_OF_INTEREST); } diff --git a/include/librealsense2/h/rs_option.h b/include/librealsense2/h/rs_option.h index 80c30bc853..f63dc8d6b1 100644 --- a/include/librealsense2/h/rs_option.h +++ b/include/librealsense2/h/rs_option.h @@ -96,7 +96,7 @@ extern "C" { RS2_OPTION_INVALIDATION_BYPASS, /**< Enable\disable pixel invalidation */ RS2_OPTION_AMBIENT_LIGHT, /**< DEPRECATED! - Use RS2_OPTION_DIGITAL_GAIN instead. */ RS2_OPTION_DIGITAL_GAIN = RS2_OPTION_AMBIENT_LIGHT, /**< Change the depth digital gain see rs2_digital_gain for values */ - RS2_OPTION_SENSOR_MODE, /**< The resolution mode: see rs2_sensor_mode for values */ + RS2_OPTION_SENSOR_MODE, /**< DEPRECATED! - The resolution mode: see rs2_sensor_mode for values */ RS2_OPTION_EMITTER_ALWAYS_ON, /**< Enable Laser On constantly (GS SKU Only) */ RS2_OPTION_THERMAL_COMPENSATION, /**< Depth Thermal Compensation for selected D400 SKUs */ RS2_OPTION_TRIGGER_CAMERA_ACCURACY_HEALTH, /**< DEPRECATED as of 2.46! */ @@ -237,7 +237,7 @@ extern "C" { } rs2_l500_visual_preset; const char* rs2_l500_visual_preset_to_string(rs2_l500_visual_preset preset); - /** \brief For setting the camera_mode option */ + /** \brief DEPRECATED! - For setting the camera_mode option */ typedef enum rs2_sensor_mode { RS2_SENSOR_MODE_VGA, diff --git a/tools/depth-quality/depth-quality-model.cpp b/tools/depth-quality/depth-quality-model.cpp index db65524c1b..be14ab5416 100644 --- a/tools/depth-quality/depth-quality-model.cpp +++ b/tools/depth-quality/depth-quality-model.cpp @@ -580,17 +580,6 @@ namespace rs2 { try // Retries are needed to cope with HW stability issues { - - auto dev = cfg.resolve(_pipe); - auto depth_sensor = dev.get_device().first< rs2::depth_sensor >(); - if (depth_sensor.supports(RS2_OPTION_SENSOR_MODE)) - { - auto depth_profile = dev.get_stream(RS2_STREAM_DEPTH); - auto w = depth_profile.as().width(); - auto h = depth_profile.as().height(); - depth_sensor.set_option(RS2_OPTION_SENSOR_MODE, (float)(resolution_from_width_height(w, h))); - } - auto profile = _pipe.start(cfg); success = profile; } diff --git a/unit-tests/live/live-common.h b/unit-tests/live/live-common.h index 9c50cd6845..e9f363f9f9 100644 --- a/unit-tests/live/live-common.h +++ b/unit-tests/live/live-common.h @@ -207,34 +207,6 @@ inline stream_profile find_confidence_corresponding_to_depth(rs2::depth_sensor d return *confidence_profile; } -inline stream_profile -find_profile( rs2::depth_sensor depth_sens, rs2_stream stream, rs2_sensor_mode mode ) -{ - std::vector< stream_profile > stream_profiles; - REQUIRE_NOTHROW( stream_profiles = depth_sens.get_stream_profiles() ); - - std::map< rs2_sensor_mode, std::pair< uint32_t, uint32_t > > sensor_mode_to_resolution - = { { { RS2_SENSOR_MODE_VGA }, { 640, 480 } }, - { { RS2_SENSOR_MODE_XGA }, { 1024, 768 } }, - { { RS2_SENSOR_MODE_QVGA }, { 320, 240 } } }; - - - auto profile - = std::find_if( stream_profiles.begin(), stream_profiles.end(), [&]( stream_profile sp ) { - auto vp = sp.as< video_stream_profile >(); - if( vp ) - { - return sp.stream_type() == stream - && vp.width() == sensor_mode_to_resolution[mode].first - && vp.height() == sensor_mode_to_resolution[mode].second; - } - return false; - } ); - - REQUIRE( profile != stream_profiles.end() ); - return *profile; -} - inline void do_while_streaming( rs2::sensor depth_sens, std::vector< stream_profile > profiles, std::function< void() > action ) diff --git a/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java b/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java index 7cb3bd607d..7a569de047 100644 --- a/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java +++ b/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java @@ -72,7 +72,7 @@ public enum Option { INVALIDATION_BYPASS(68), AMBIENT_LIGHT(69), // Deprecated - Use DIGITAL_GAIN instead DIGITAL_GAIN(69), - SENSOR_MODE(70), + SENSOR_MODE(70), // Deprecated EMITTER_ALWAYS_ON(71), THERMAL_COMPENSATION(72), TRIGGER_CAMERA_ACCURACY_HEALTH(73), diff --git a/wrappers/csharp/Intel.RealSense/Types/Enums/Option.cs b/wrappers/csharp/Intel.RealSense/Types/Enums/Option.cs index 9528349642..300e0dee3d 100644 --- a/wrappers/csharp/Intel.RealSense/Types/Enums/Option.cs +++ b/wrappers/csharp/Intel.RealSense/Types/Enums/Option.cs @@ -224,7 +224,7 @@ public enum Option /// Change the depth digital gain see rs2_digital_gain for values DigitalGain = 69, - /// The resolution mode: see rs2_sensor_mode for values + /// Deprecated - The resolution mode: see rs2_sensor_mode for values SensorMode = 70, /// Enable Laser On constantly (GS SKU Only) diff --git a/wrappers/matlab/option.m b/wrappers/matlab/option.m index 363a59bed8..63ed9903da 100644 --- a/wrappers/matlab/option.m +++ b/wrappers/matlab/option.m @@ -71,7 +71,7 @@ invalidation_bypass (68) ambient_light_env_level (69) % Deprecated - Use DIGITAL_GAIN instead digital_gain (69) - sensor_mode (70) + sensor_mode (70) % Deprecated emitter_always_on (71) thermal_compensation (72) trigger_camera_accuracy_health (73) diff --git a/wrappers/python/pybackend.cpp b/wrappers/python/pybackend.cpp index eb4241ea31..b056ba9486 100644 --- a/wrappers/python/pybackend.cpp +++ b/wrappers/python/pybackend.cpp @@ -176,7 +176,7 @@ PYBIND11_MODULE(NAME, m) { .value("activate_pixel_invalidation", RS2_OPTION_INVALIDATION_BYPASS) .value("ambient_light_environment_level", RS2_OPTION_AMBIENT_LIGHT) .value("digital_gain", RS2_OPTION_DIGITAL_GAIN) - .value("sensor_resolution_mode", RS2_OPTION_SENSOR_MODE) + .value("sensor_resolution_mode", RS2_OPTION_SENSOR_MODE) // Deprecated .value("emitter_always_on", RS2_OPTION_EMITTER_ALWAYS_ON) .value("thermal_compensation", RS2_OPTION_THERMAL_COMPENSATION) .value("host_performance", RS2_OPTION_HOST_PERFORMANCE) diff --git a/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h b/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h index fe7ba2e588..4f17858d7d 100755 --- a/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h +++ b/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h @@ -124,7 +124,7 @@ enum class ERealSenseOptionType : uint8 INVALIDATION_BYPASS , /**< Enable\disable pixel invalidation */ AMBIENT_LIGHT , /**< Change the depth ambient light see rs2_ambient_light for values */ DIGITAL_GAIN = AMBIENT_LIGHT , /**< Change the depth digital gain see rs2_digital_gain for values */ - SENSOR_MODE , /**< The resolution mode: see rs2_sensor_mode for values */ + SENSOR_MODE , /**< Deprecated!! - The resolution mode: see rs2_sensor_mode for values */ EMITTER_ALWAYS_ON , /**< Enable Laser On constantly (GS SKU Only) */ THERMAL_COMPENSATION , /**< Depth Thermal Compensation for selected D400 SKUs */ TRIGGER_CAMERA_ACCURACY_HEALTH , /**< DEPRECATED! */