ds-device.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2016 Intel Corporation. All Rights Reserved.
3 
4 #include <climits>
5 #include <algorithm>
6 #include <iomanip> // for std::put_time
7 
8 #include "image.h"
9 #include "ds-private.h"
10 #include "ds-device.h"
11 
12 using namespace rsimpl;
13 using namespace rsimpl::ds;
14 using namespace rsimpl::motion_module;
15 
16 // DS4 Exposure ROI uses stream resolution as control constraints
17 // When stream disabled, we are supposed to use VGA as the default
18 #define MAX_DS_DEFAULT_X 639
19 #define MAX_DS_DEFAULT_Y 439
20 
21 namespace rsimpl
22 {
23  ds_device::ds_device(std::shared_ptr<uvc::device> device, const static_device_info & info, calibration_validator validator)
24  : rs_device_base(device, info, validator), start_stop_pad(std::chrono::milliseconds(500))
25  {
27  double units;
28  get_options(opt, 1, &units);
29  on_update_depth_units(static_cast<int>(units));
30  }
31 
33  {
34 
35  }
36 
38  {
40  return depth.is_enabled() && depth.get_format() == RS_FORMAT_DISPARITY16;
41  }
42 
44  {
45  if(is_disparity_mode_enabled()) return;
46  config.depth_scale = (float)((double)units * 0.000001); // Convert from micrometers to meters
47  }
48 
50  {
51  if(!is_disparity_mode_enabled()) return;
54  config.depth_scale = static_cast<float>(depth.get_intrinsics().fx * baseline * multiplier);
55  }
56 
57  std::vector<supported_option> ds_device::get_ae_range_vec()
58  {
59  std::vector<supported_option> so_vec;
61  for (auto& opt : ae_vector)
62  {
63  double min, max, step, def;
64  get_option_range(opt, min, max, step, def);
65  so_vec.push_back({ opt, min, max, step, def });
66  }
67 
68  return so_vec;
69  }
70 
71 
73  {
75  uint16_t max_x = MAX_DS_DEFAULT_X;
76  uint16_t max_y = MAX_DS_DEFAULT_Y;
77  if (stream.is_enabled())
78  {
79  auto intrinsics = stream.get_intrinsics();
80  max_x = intrinsics.width - 1;
81  max_y = intrinsics.height - 1;
82  }
83 
84  // first, bring to the valid range
85  params.exposure_left_edge = std::max((uint16_t)0, std::min(max_x, params.exposure_left_edge));
86  params.exposure_right_edge = std::max((uint16_t)0, std::min(max_x, params.exposure_right_edge));
87  params.exposure_top_edge = std::max((uint16_t)0, std::min(max_y, params.exposure_top_edge));
88  params.exposure_bottom_edge = std::max((uint16_t)0, std::min(max_y, params.exposure_bottom_edge));
89  // now, let's take care of order:
90  auto left = std::min(params.exposure_left_edge, params.exposure_right_edge);
91  auto right = std::max(params.exposure_left_edge, params.exposure_right_edge);
92  auto top = std::min(params.exposure_top_edge, params.exposure_bottom_edge);
93  auto bottom = std::max(params.exposure_top_edge, params.exposure_bottom_edge);
94 
95  if (right == left){
96  if (left == 0) right++;
97  else left--;
98  }
99  if (bottom == top) {
100  if (top == 0) bottom++;
101  else top--;
102  }
103 
104  params.exposure_left_edge = left;
105  params.exposure_right_edge = right;
106  params.exposure_top_edge = top;
107  params.exposure_bottom_edge = bottom;
108  }
109 
110  void ds_device::set_options(const rs_option options[], size_t count, const double values[])
111  {
112  std::vector<rs_option> base_opt;
113  std::vector<double> base_opt_val;
114 
115  auto & dev = get_device();
116  auto minmax_writer = make_struct_interface<ds::range >([&dev]() { return ds::get_min_max_depth(dev); }, [&dev](ds::range v) { ds::set_min_max_depth(dev,v); });
117  auto disp_writer = make_struct_interface<ds::disp_mode>([&dev]() { return ds::get_disparity_mode(dev); }, [&dev](ds::disp_mode v) { ds::set_disparity_mode(dev,v); });
118  auto ae_writer = make_struct_interface<ds::ae_params>(
119  [&dev, this]() {
122  return ae;
123  },
124  [&dev, this](ds::ae_params& v) {
127  }
128  );
129  auto dc_writer = make_struct_interface<ds::dc_params>([&dev]() { return ds::get_depth_params(dev); }, [&dev](ds::dc_params v) { ds::set_depth_params(dev,v); });
130 
131  for (size_t i = 0; i<count; ++i)
132  {
133  if (uvc::is_pu_control(options[i]))
134  {
135  // Disabling auto-setting controls, if needed
136  switch (options[i])
137  {
140  default: break;
141  }
142 
143  uvc::set_pu_control_with_retry(get_device(), 2, options[i], static_cast<int>(values[i]));
144  continue;
145  }
146 
147  switch(options[i])
148  {
149 
150  case RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED: ds::set_lr_exposure_mode(get_device(), static_cast<uint8_t>(values[i])); break;
151  case RS_OPTION_R200_LR_GAIN: ds::set_lr_gain(get_device(), {get_lr_framerate(), static_cast<uint32_t>(values[i])}); break; // TODO: May need to set this on start if framerate changes
152  case RS_OPTION_R200_LR_EXPOSURE: ds::set_lr_exposure(get_device(), {get_lr_framerate(), static_cast<uint32_t>(values[i])}); break; // TODO: May need to set this on start if framerate changes
154  case RS_OPTION_R200_DEPTH_UNITS: ds::set_depth_units(get_device(), static_cast<uint32_t>(values[i]));
155  on_update_depth_units(static_cast<uint32_t>(values[i])); break;
156 
157  case RS_OPTION_R200_DEPTH_CLAMP_MIN: minmax_writer.set(&ds::range::min, values[i]); break;
158  case RS_OPTION_R200_DEPTH_CLAMP_MAX: minmax_writer.set(&ds::range::max, values[i]); break;
159 
160  case RS_OPTION_R200_DISPARITY_MULTIPLIER: disp_writer.set(&ds::disp_mode::disparity_multiplier, values[i]); break;
161  case RS_OPTION_R200_DISPARITY_SHIFT: ds::set_disparity_shift(get_device(), static_cast<uint32_t>(values[i])); break;
162 
165  case RS_OPTION_R200_AUTO_EXPOSURE_KP_GAIN: ae_writer.set(&ds::ae_params::kp_gain, values[i]); break;
166  case RS_OPTION_R200_AUTO_EXPOSURE_KP_EXPOSURE: ae_writer.set(&ds::ae_params::kp_exposure, values[i]); break;
168  case RS_OPTION_R200_AUTO_EXPOSURE_TOP_EDGE: ae_writer.set(&ds::ae_params::exposure_top_edge, values[i]); break;
170  case RS_OPTION_R200_AUTO_EXPOSURE_LEFT_EDGE: ae_writer.set(&ds::ae_params::exposure_left_edge, values[i]); break;
171  case RS_OPTION_R200_AUTO_EXPOSURE_RIGHT_EDGE: ae_writer.set(&ds::ae_params::exposure_right_edge, values[i]); break;
172 
175  case RS_OPTION_R200_DEPTH_CONTROL_MEDIAN_THRESHOLD: dc_writer.set(&ds::dc_params::median_thresh, values[i]); break;
182  case RS_OPTION_R200_DEPTH_CONTROL_LR_THRESHOLD: dc_writer.set(&ds::dc_params::lr_thresh, values[i]); break;
183 
184  default:
185  base_opt.push_back(options[i]); base_opt_val.push_back(values[i]); break;
186  }
187  }
188 
189  minmax_writer.commit();
190  disp_writer.commit();
191  if(disp_writer.active) on_update_disparity_multiplier(disp_writer.struct_.disparity_multiplier);
192  ae_writer.commit();
193  dc_writer.commit();
194 
195  //Handle common options
196  if (base_opt.size())
197  rs_device_base::set_options(base_opt.data(), base_opt.size(), base_opt_val.data());
198  }
199 
200  void ds_device::get_options(const rs_option options[], size_t count, double values[])
201  {
202  std::vector<rs_option> base_opt;
203  std::vector<size_t> base_opt_index;
204  std::vector<double> base_opt_val;
205 
206  auto & dev = get_device();
207  auto minmax_reader = make_struct_interface<ds::range >([&dev]() { return ds::get_min_max_depth(dev); }, [&dev](ds::range v) { ds::set_min_max_depth(dev,v); });
208  auto disp_reader = make_struct_interface<ds::disp_mode>([&dev]() { return ds::get_disparity_mode(dev); }, [&dev](ds::disp_mode v) { ds::set_disparity_mode(dev,v); });
209  auto ae_reader = make_struct_interface<ds::ae_params>(
210  [&dev, this]() {
213  return ae;
214  },
215  [&dev, this](ds::ae_params& v) {
218  }
219  );
220  auto dc_reader = make_struct_interface<ds::dc_params>([&dev]() { return ds::get_depth_params(dev); }, [&dev](ds::dc_params v) { ds::set_depth_params(dev,v); });
221 
222  for (size_t i = 0; i<count; ++i)
223  {
224 
225  if(uvc::is_pu_control(options[i]))
226  {
227  values[i] = uvc::get_pu_control(get_device(), 2, options[i]);
228  continue;
229  }
230 
231  switch(options[i])
232  {
233 
235 
236  case RS_OPTION_R200_LR_GAIN: // Gain is framerate dependent
238  values[i] = ds::get_lr_gain(get_device()).value;
239  break;
240  case RS_OPTION_R200_LR_EXPOSURE: // Exposure is framerate dependent
242  values[i] = ds::get_lr_exposure(get_device()).value;
243  break;
246  break;
247 
248  case RS_OPTION_R200_DEPTH_UNITS: values[i] = ds::get_depth_units(dev); break;
249 
250  case RS_OPTION_R200_DEPTH_CLAMP_MIN: values[i] = minmax_reader.get(&ds::range::min); break;
251  case RS_OPTION_R200_DEPTH_CLAMP_MAX: values[i] = minmax_reader.get(&ds::range::max); break;
252 
253  case RS_OPTION_R200_DISPARITY_MULTIPLIER: values[i] = disp_reader.get(&ds::disp_mode::disparity_multiplier); break;
254  case RS_OPTION_R200_DISPARITY_SHIFT: values[i] = ds::get_disparity_shift(dev); break;
255 
258  case RS_OPTION_R200_AUTO_EXPOSURE_KP_GAIN: values[i] = ae_reader.get(&ds::ae_params::kp_gain ); break;
259  case RS_OPTION_R200_AUTO_EXPOSURE_KP_EXPOSURE: values[i] = ae_reader.get(&ds::ae_params::kp_exposure ); break;
261  case RS_OPTION_R200_AUTO_EXPOSURE_TOP_EDGE: values[i] = ae_reader.get(&ds::ae_params::exposure_top_edge ); break;
262  case RS_OPTION_R200_AUTO_EXPOSURE_BOTTOM_EDGE: values[i] = ae_reader.get(&ds::ae_params::exposure_bottom_edge ); break;
263  case RS_OPTION_R200_AUTO_EXPOSURE_LEFT_EDGE: values[i] = ae_reader.get(&ds::ae_params::exposure_left_edge ); break;
264  case RS_OPTION_R200_AUTO_EXPOSURE_RIGHT_EDGE: values[i] = ae_reader.get(&ds::ae_params::exposure_right_edge ); break;
265 
268  case RS_OPTION_R200_DEPTH_CONTROL_MEDIAN_THRESHOLD: values[i] = dc_reader.get(&ds::dc_params::median_thresh ); break;
275  case RS_OPTION_R200_DEPTH_CONTROL_LR_THRESHOLD: values[i] = dc_reader.get(&ds::dc_params::lr_thresh ); break;
276 
277  default:
278  base_opt.push_back(options[i]); base_opt_index.push_back(i); break;
279  }
280  }
281  if (base_opt.size())
282  {
283  base_opt_val.resize(base_opt.size());
284  rs_device_base::get_options(base_opt.data(), base_opt.size(), base_opt_val.data());
285  }
286 
287  // Merge the local data with values obtained by base class
288  for (auto i : base_opt_index)
289  values[i] = base_opt_val[i];
290  }
291 
293  {
295  rs_device_base::stop(source);
296  }
297 
299  {
300  rs_device_base::start(source);
302  }
303 
304  void ds_device::start_fw_logger(char fw_log_op_code, int grab_rate_in_ms, std::timed_mutex& mutex)
305  {
306  rs_device_base::start_fw_logger(fw_log_op_code, grab_rate_in_ms, mutex);
307  }
308 
310  {
312  }
313 
314  void ds_device::on_before_start(const std::vector<subdevice_mode_selection> & selected_modes)
315  {
316  rs_option depth_units_option = RS_OPTION_R200_DEPTH_UNITS;
317  double depth_units;
318 
319  uint8_t streamIntent = 0;
320  for(const auto & m : selected_modes)
321  {
322  switch(m.mode.subdevice)
323  {
324  case 0: streamIntent |= ds::STATUS_BIT_LR_STREAMING; break;
325  case 2: streamIntent |= ds::STATUS_BIT_WEB_STREAMING; break;
326  case 1:
327  streamIntent |= ds::STATUS_BIT_Z_STREAMING;
328  auto dm = ds::get_disparity_mode(get_device());
329  switch(m.get_format(RS_STREAM_DEPTH))
330  {
331  default: throw std::logic_error("unsupported R200 depth format");
332  case RS_FORMAT_Z16:
333  dm.is_disparity_enabled = 0;
334  get_options(&depth_units_option, 1, &depth_units);
335  on_update_depth_units(static_cast<int>(depth_units));
336  break;
337  case RS_FORMAT_DISPARITY16:
338  dm.is_disparity_enabled = 1;
339  on_update_disparity_multiplier(static_cast<float>(dm.disparity_multiplier));
340  break;
341  }
343 
344  auto ae_enabled = ds::get_lr_exposure_mode(get_device()) > 0;
345  if (ae_enabled)
346  {
349  }
350 
351  break;
352  }
353  }
354  ds::set_stream_intent(get_device(), streamIntent);
355  }
356 
357  rs_stream ds_device::select_key_stream(const std::vector<rsimpl::subdevice_mode_selection> & selected_modes)
358  {
359  // When all streams are enabled at an identical framerate, R200 images are delivered in the order: Z -> Third -> L/R
360  // To maximize the chance of being able to deliver coherent framesets, we want to wait on the latest image coming from
361  // a stream running at the fastest framerate.
362  int fps[RS_STREAM_NATIVE_COUNT] = {}, max_fps = 0;
363  for(const auto & m : selected_modes)
364  {
365  for(const auto & output : m.get_outputs())
366  {
367  fps[output.first] = m.mode.fps;
368  max_fps = std::max(max_fps, m.mode.fps);
369  }
370  }
371 
372  // Select the "latest arriving" stream which is running at the fastest framerate
374  {
375  if(fps[s] == max_fps) return s;
376  }
377  return RS_STREAM_DEPTH;
378  }
379 
381  {
383  {
384  auto & stream = get_stream_interface(s);
385  if(stream.is_enabled()) return static_cast<uint32_t>(stream.get_framerate());
386  }
387  return 30; // If no streams have yet been enabled, return the minimum possible left/right framerate, to allow the maximum possible exposure range
388  }
389 
390  void ds_device::set_common_ds_config(std::shared_ptr<uvc::device> device, static_device_info& info, const ds::ds_info& cam_info)
391  {
392  auto & c = cam_info.calibration;
398 
403 
404  // Set up modes for left/right/z images
405  for(auto fps : {30, 60, 90})
406  {
407  // Subdevice 0 can provide left/right infrared via four pixel formats, in three resolutions, which can either be uncropped or cropped to match Z
408  for(auto pf : {pf_y8, pf_y8i, pf_y16, pf_y12i})
409  {
410  info.subdevice_modes.push_back({0, {640, 481}, pf, fps, c.modesLR[0], {}, {0, -6}});
411  info.subdevice_modes.push_back({0, {640, 373}, pf, fps, c.modesLR[1], {}, {0, -6}});
412  info.subdevice_modes.push_back({0, {640, 254}, pf, fps, c.modesLR[2], {}, {0, -6}});
413  }
414 
415  // Subdevice 1 can provide depth, in three resolutions, which can either be unpadded or padded to match left/right
416  info.subdevice_modes.push_back({ 1,{ 628, 469 }, pf_z16, fps, pad_crop_intrinsics(c.modesLR[0], -6),{},{ 0, +6 } });
417  info.subdevice_modes.push_back({ 1,{ 628, 361 }, pf_z16, fps, pad_crop_intrinsics(c.modesLR[1], -6),{},{ 0, +6 } });
418  info.subdevice_modes.push_back({ 1,{ 628, 242 }, pf_z16, fps, pad_crop_intrinsics(c.modesLR[2], -6),{},{ 0, +6 } });
419  }
420 
421  // Subdevice 2 can provide color, in several formats and framerates
422  info.subdevice_modes.push_back({ 2, { 640, 480 }, pf_yuy2, 60, c.intrinsicsThird[1], { c.modesThird[1][0] }, { 0 } });
423  info.subdevice_modes.push_back({ 2, { 640, 480 }, pf_yuy2, 30, c.intrinsicsThird[1], { c.modesThird[1][0] }, { 0 } });
424  info.subdevice_modes.push_back({ 2, { 320, 240 }, pf_yuy2, 60, scale_intrinsics(c.intrinsicsThird[1], 320, 240), { c.modesThird[1][1] }, { 0 } });
425  info.subdevice_modes.push_back({ 2, { 320, 240 }, pf_yuy2, 30, scale_intrinsics(c.intrinsicsThird[1], 320, 240), { c.modesThird[1][1] }, { 0 } });
426 
427  info.subdevice_modes.push_back({ 2,{ 1920, 1080 }, pf_yuy2, 15, c.intrinsicsThird[0],{ c.modesThird[0][0] },{ 0 } });
428  info.subdevice_modes.push_back({ 2,{ 1920, 1080 }, pf_yuy2, 30, c.intrinsicsThird[0],{ c.modesThird[0][0] },{ 0 } });
429 
430 
431  // subdev native-dim pf fps native_intrinsics rect_modes crop-options
432  // ------ ---------- -- --- ----------------- ---------- ------------
433  info.subdevice_modes.push_back({ 2,{ 1280, 720 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[0], 1280, 720), { c.modesThird[0][1] }, { 0 } });
434  info.subdevice_modes.push_back({ 2, { 960, 540 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[0], 960, 540), { c.modesThird[0][1] }, { 0 } });
435  info.subdevice_modes.push_back({ 2, { 848, 480 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[0], 848, 480), { c.modesThird[0][1] }, { 0 } });
436 
437  info.subdevice_modes.push_back({ 2, { 640, 480 }, pf_yuy2, 15, c.intrinsicsThird[1], { c.modesThird[1][0] }, { 0 } });
438  info.subdevice_modes.push_back({ 2, { 640, 480 }, pf_rw16, 15, c.intrinsicsThird[1], { c.modesThird[1][0] }, { 0 } });
439 
440  info.subdevice_modes.push_back({ 2, { 640, 360 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[1], 640, 360), { c.modesThird[1][0] }, { 0 } });
441  info.subdevice_modes.push_back({ 2, { 424, 240 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[1], 424, 240), { c.modesThird[1][0] }, { 0 } });
442 
443  info.subdevice_modes.push_back({ 2, { 320, 240 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[1], 320, 240), { c.modesThird[1][1] }, { 0 } });
444  info.subdevice_modes.push_back({ 2, { 320, 180 }, pf_yuy2, 15, scale_intrinsics(c.intrinsicsThird[1], 320, 180), { c.modesThird[1][1] }, { 0 } });
445 
446  // Set up interstream rules for left/right/z images
447  for(auto ir : {RS_STREAM_INFRARED, RS_STREAM_INFRARED2})
448  {
449  info.interstream_rules.push_back({ RS_STREAM_DEPTH, ir, &stream_request::width, 0, 12, RS_STREAM_COUNT, false, false, false });
450  info.interstream_rules.push_back({ RS_STREAM_DEPTH, ir, &stream_request::height, 0, 12, RS_STREAM_COUNT, false, false, false });
451  info.interstream_rules.push_back({ RS_STREAM_DEPTH, ir, &stream_request::fps, 0, 0, RS_STREAM_COUNT, false, false, false });
452  }
453  info.interstream_rules.push_back({ RS_STREAM_DEPTH, RS_STREAM_COLOR, &stream_request::fps, 0, 0, RS_STREAM_DEPTH, true, false, false });
454  info.interstream_rules.push_back({ RS_STREAM_INFRARED, RS_STREAM_INFRARED2, &stream_request::fps, 0, 0, RS_STREAM_COUNT, false, false, false });
455  info.interstream_rules.push_back({ RS_STREAM_INFRARED, RS_STREAM_INFRARED2, &stream_request::width, 0, 0, RS_STREAM_COUNT, false, false, false });
456  info.interstream_rules.push_back({ RS_STREAM_INFRARED, RS_STREAM_INFRARED2, &stream_request::height, 0, 0, RS_STREAM_COUNT, false, false, false });
457  info.interstream_rules.push_back({ RS_STREAM_INFRARED, RS_STREAM_INFRARED2, nullptr, 0, 0, RS_STREAM_COUNT, false, false, true });
458 
460  info.presets[RS_STREAM_DEPTH ][RS_PRESET_BEST_QUALITY] = {true, 480, 360, RS_FORMAT_Z16, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
461  info.presets[RS_STREAM_COLOR ][RS_PRESET_BEST_QUALITY] = {true, 640, 480, RS_FORMAT_RGB8, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
462 
463  info.presets[RS_STREAM_INFRARED][RS_PRESET_LARGEST_IMAGE] = {true, 640, 480, RS_FORMAT_Y8, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
464  info.presets[RS_STREAM_DEPTH ][RS_PRESET_LARGEST_IMAGE] = {true, 640, 480, RS_FORMAT_Z16, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
465  info.presets[RS_STREAM_COLOR ][RS_PRESET_LARGEST_IMAGE] = {true, 1920, 1080, RS_FORMAT_RGB8, 30, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
466 
467  info.presets[RS_STREAM_INFRARED][RS_PRESET_HIGHEST_FRAMERATE] = {true, 320, 240, RS_FORMAT_Y8, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
468  info.presets[RS_STREAM_DEPTH ][RS_PRESET_HIGHEST_FRAMERATE] = {true, 320, 240, RS_FORMAT_Z16, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
469  info.presets[RS_STREAM_COLOR ][RS_PRESET_HIGHEST_FRAMERATE] = {true, 640, 480, RS_FORMAT_RGB8, 60, RS_OUTPUT_BUFFER_FORMAT_CONTINUOUS};
470 
471  for(int i=0; i<RS_PRESET_COUNT; ++i)
473 
474  // Extended controls ranges cannot be retrieved from device, therefore the data is locally defined
475  //Option Min Max Step Default
476  info.options.push_back({ RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED, 0, 1, 1, 0 });
477  info.options.push_back({ RS_OPTION_R200_EMITTER_ENABLED, 0, 1, 1, 0 });
478  info.options.push_back({ RS_OPTION_R200_DEPTH_UNITS, 0, INT_MAX, 1, 1000 }); // What is the real range?
479  info.options.push_back({ RS_OPTION_R200_DEPTH_CLAMP_MIN, 0, USHRT_MAX, 1, 0 });
480  info.options.push_back({ RS_OPTION_R200_DEPTH_CLAMP_MAX, 0, USHRT_MAX, 1, USHRT_MAX });
481  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_MEAN_INTENSITY_SET_POINT, 0, 4095, 1, 512 });
482  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_BRIGHT_RATIO_SET_POINT, 0, 1, 1, 0 });
483  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_KP_GAIN, 0, 1000, 1, 0 });
484  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_KP_EXPOSURE, 0, 1000, 1, 0 });
485  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_KP_DARK_THRESHOLD, 0, 1000, 1, 0 });
486  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_TOP_EDGE, 0, MAX_DS_DEFAULT_Y, 1, MAX_DS_DEFAULT_Y });
487  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_BOTTOM_EDGE, 0, MAX_DS_DEFAULT_Y, 1, MAX_DS_DEFAULT_Y});
488  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_LEFT_EDGE, 0, MAX_DS_DEFAULT_X, 1, MAX_DS_DEFAULT_X });
489  info.options.push_back({ RS_OPTION_R200_AUTO_EXPOSURE_RIGHT_EDGE, 0, MAX_DS_DEFAULT_X, 1, MAX_DS_DEFAULT_X });
490  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_ESTIMATE_MEDIAN_DECREMENT, 0, 0xFF, 1, 5 });
491  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_ESTIMATE_MEDIAN_INCREMENT, 0, 0xFF, 1, 5 });
492  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_MEDIAN_THRESHOLD, 0, 0x3FF, 1, 0xc0 });
493  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_SCORE_MINIMUM_THRESHOLD, 0, 0x3FF, 1, 1 });
494  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_SCORE_MAXIMUM_THRESHOLD, 0, 0x3FF, 1, 0x200 });
495  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_TEXTURE_COUNT_THRESHOLD, 0, 0x1F, 1, 6 });
496  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_TEXTURE_DIFFERENCE_THRESHOLD, 0, 0x3FF, 1, 0x18 });
497  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_SECOND_PEAK_THRESHOLD, 0, 0x3FF, 1, 0x1b });
498  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_NEIGHBOR_THRESHOLD, 0, 0x3FF, 1, 0x7 });
499  info.options.push_back({ RS_OPTION_R200_DEPTH_CONTROL_LR_THRESHOLD, 0, 0x7FF, 1, 0x18 });
500 
501  // We select the depth/left infrared camera's viewpoint to be the origin
502  info.stream_poses[RS_STREAM_DEPTH] = {{{1,0,0},{0,1,0},{0,0,1}},{0,0,0}};
503  info.stream_poses[RS_STREAM_INFRARED] = {{{1,0,0},{0,1,0},{0,0,1}},{0,0,0}};
504 
505  // The right infrared camera is offset along the +x axis by the baseline (B)
506  info.stream_poses[RS_STREAM_INFRARED2] = {{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {c.B * 0.001f, 0, 0}}; // Sterling comment
507 
508  // The transformation between the depth camera and third camera is described by a translation vector (T), followed by rotation matrix (Rthird)
509  for(int i=0; i<3; ++i) for(int j=0; j<3; ++j)
510  info.stream_poses[RS_STREAM_COLOR].orientation(i,j) = c.Rthird[i*3+j];
511  for(int i=0; i<3; ++i)
512  info.stream_poses[RS_STREAM_COLOR].position[i] = c.T[i] * 0.001f;
513 
514  // Our position is added AFTER orientation is applied, not before, so we must multiply Rthird * T to compute it
516  info.nominal_depth_scale = 0.001f;
517  info.serial = std::to_string(c.serial_number);
519 
520  auto &h = cam_info.head_content;
524 
526  info.camera_info[RS_CAMERA_INFO_IMAGER_MODEL_NUMBER] = to_string() << h.imager_model_number;
527  info.camera_info[RS_CAMERA_INFO_CAMERA_TYPE] = to_string() << h.prq_type;
528  info.camera_info[RS_CAMERA_INFO_OEM_ID] = to_string() << h.oem_id;
529  info.camera_info[RS_CAMERA_INFO_MODULE_VERSION] = to_string() << (int)h.module_version << "." << (int)h.module_major_version << "." << (int)h.module_minor_version << "." << (int)h.module_skew_version;
530  info.camera_info[RS_CAMERA_INFO_FOCUS_VALUE] = to_string() << h.platform_camera_focus;
531  info.camera_info[RS_CAMERA_INFO_CONTENT_VERSION] = to_string() << h.camera_head_contents_version;
532  info.camera_info[RS_CAMERA_INFO_LENS_TYPE] = to_string() << h.lens_type;
533  info.camera_info[RS_CAMERA_INFO_LENS_COATING__TYPE] = to_string() << h.lens_coating_type;
534  info.camera_info[RS_CAMERA_INFO_3RD_LENS_TYPE] = to_string() << h.lens_type_third_imager;
535  info.camera_info[RS_CAMERA_INFO_3RD_LENS_COATING_TYPE] = to_string() << h.lens_coating_type_third_imager;
536  info.camera_info[RS_CAMERA_INFO_NOMINAL_BASELINE] = to_string() << h.nominal_baseline << " mm";
537  info.camera_info[RS_CAMERA_INFO_3RD_NOMINAL_BASELINE] = to_string() << h.nominal_baseline_third_imager << " mm";
538  info.camera_info[RS_CAMERA_INFO_EMITTER_TYPE] = to_string() << h.emitter_type;
539 
540  if (std::isnormal(h.calibration_date))
542  if (std::isnormal(h.first_program_date))
543  info.camera_info[RS_CAMERA_INFO_PROGRAM_DATE] = time_to_string(h.first_program_date);
544  if (std::isnormal(h.focus_alignment_date))
545  info.camera_info[RS_CAMERA_INFO_FOCUS_ALIGNMENT_DATE] = time_to_string(h.focus_alignment_date);
546  if (std::isnormal(h.build_date))
548 
549  // On LibUVC backends, the R200 should use four transfer buffers
551 
553  }
554 
556  {
557  std::vector<rs_option> auto_exposure_options = {
567  };
568 
569  if (std::find(auto_exposure_options.begin(), auto_exposure_options.end(), option) != auto_exposure_options.end())
570  {
571  return ds::get_lr_exposure_mode(get_device()) > 0;
572  }
573 
574  std::vector<rs_option> only_when_not_streaming = {
580  };
581 
582  if (std::find(only_when_not_streaming.begin(), only_when_not_streaming.end(), option) != only_when_not_streaming.end())
583  {
584  if (is_capturing()) return false;
585  }
586 
587  // We have special logic to implement LR gain and exposure, so they do not belong to the standard option list
589  }
590 
591  void ds_device::get_option_range(rs_option option, double & min, double & max, double & step, double & def)
592  {
593  // Gain min/max is framerate dependent
594  if(option == RS_OPTION_R200_LR_GAIN)
595  {
597  auto disc = ds::get_lr_gain_discovery(get_device());
598  min = disc.min;
599  max = disc.max;
600  step = 1;
601  def = disc.default_value;
602  return;
603  }
604 
605  // Exposure min/max is framerate dependent
606  if(option == RS_OPTION_R200_LR_EXPOSURE)
607  {
610  min = disc.min;
611  max = disc.max;
612  step = 1;
613  def = disc.default_value;
614  return;
615  }
616 
617  // Exposure values converted from [0..3] to [0..1] range
619  {
620  rs_device_base::get_option_range(option, min, max, step, def);
621  max = 1;
622  step = 1;
623  return;
624  }
625 
626  std::vector<rs_option> auto_exposure_options = {
631  };
632  if (std::find(auto_exposure_options.begin(), auto_exposure_options.end(), option) != auto_exposure_options.end())
633  {
636  {
637  auto max_x = MAX_DS_DEFAULT_X;
638  if (stream.is_enabled()) max_x = stream.get_intrinsics().width - 1;
639  min = 1; max = max_x; step = 1; def = max_x;
640  return;
641  }
642  else if (option == RS_OPTION_R200_AUTO_EXPOSURE_LEFT_EDGE)
643  {
644  auto max_x = MAX_DS_DEFAULT_X;
645  if (stream.is_enabled()) max_x = stream.get_intrinsics().width - 1;
646  min = 1; max = max_x - 1; step = 1; def = 0;
647  return;
648  }
649  else if (option == RS_OPTION_R200_AUTO_EXPOSURE_BOTTOM_EDGE)
650  {
651  auto max_y = MAX_DS_DEFAULT_Y;
652  if (stream.is_enabled()) max_y = stream.get_intrinsics().height - 1;
653  min = 1; max = max_y; step = 1; def = max_y;
654  return;
655  }
656  else if (option == RS_OPTION_R200_AUTO_EXPOSURE_TOP_EDGE)
657  {
658  auto max_y = MAX_DS_DEFAULT_Y;
659  if (stream.is_enabled()) max_y = stream.get_intrinsics().height - 1;
660  min = 0; max = max_y - 1; step = 1; def = 0;
661  return;
662  }
663  }
664 
665  // Default to parent implementation
666  rs_device_base::get_option_range(option, min, max, step, def);
667  }
668 
669  // All R200 images which are not in YUY2 format contain an extra row of pixels, called the "dinghy", which contains useful information
670  const ds::dinghy & get_dinghy(const subdevice_mode & mode, const void * frame)
671  {
672  return *reinterpret_cast<const ds::dinghy *>(reinterpret_cast<const uint8_t *>(frame) + mode.pf.get_image_size(mode.native_dims.x, mode.native_dims.y-1));
673  }
674 
676  {
677  int fps;
681 
682  public:
683  dinghy_timestamp_reader(int fps) : fps(fps), last_timestamp(0), timestamp_wraparound(1, std::numeric_limits<uint32_t>::max()), frame_counter_wraparound(1, std::numeric_limits<uint32_t>::max()) {}
684 
685  bool validate_frame(const subdevice_mode & mode, const void * frame) override
686  {
687  // Check magic number for all subdevices
688  auto & dinghy = get_dinghy(mode, frame);
689  const uint32_t magic_numbers[] = {0x08070605, 0x04030201, 0x8A8B8C8D};
690  if(dinghy.magicNumber != magic_numbers[mode.subdevice])
691  {
692  LOG_WARNING("Subdevice " << mode.subdevice << " bad magic number 0x" << std::hex << dinghy.magicNumber);
693  return false;
694  }
695 
696  // Check frame status for left/right/Z subdevices only
697  if(dinghy.frameStatus != 0)
698  {
699  LOG_WARNING("Subdevice " << mode.subdevice << " frame status 0x" << std::hex << dinghy.frameStatus);
700  return false;
701  }
702  // Check VDF error status for all subdevices
703  if(dinghy.VDFerrorStatus != 0)
704  {
705  LOG_WARNING("Subdevice " << mode.subdevice << " VDF error status 0x" << std::hex << dinghy.VDFerrorStatus);
706  return false;
707  }
708  // Check CAM module status for left/right subdevice only
709  if (dinghy.CAMmoduleStatus != 0 && mode.subdevice == 0)
710  {
711  LOG_WARNING("Subdevice " << mode.subdevice << " CAM module status 0x" << std::hex << dinghy.CAMmoduleStatus);
712  return false;
713  }
714 
715  // TODO: Check for missing or duplicate frame numbers
716  return true;
717  }
718 
719  double get_frame_timestamp(const subdevice_mode & mode, const void * frame, double /*actual_fps*/) override
720  {
721  auto new_ts = timestamp_wraparound.fix(last_timestamp + 1000. / fps);
722  last_timestamp = new_ts;
723  return new_ts;
724  }
725 
726  unsigned long long get_frame_counter(const subdevice_mode & mode, const void * frame) override
727  {
728  auto frame_number = 0;
729 
730  frame_number = get_dinghy(mode, frame).frameCount; // All other formats can use the frame number in the dinghy row
731  return frame_counter_wraparound.fix(frame_number);
732  }
733  };
734 
736  {
737  int get_embedded_frame_counter(const void * frame) const
738  {
739  int embedded_frame_counter = 0;
740  firmware_version firmware(fw_version);
741  if (firmware >= firmware_version("1.27.2.90")) // Frame counter is exposed at first LSB bit in first 4-pixels from version 1.27.2.90
742  {
743  auto data = static_cast<const char*>(frame);
744 
745  for (int i = 0, j = 0; i < 4; ++i, ++j)
746  embedded_frame_counter |= ((data[i] & 0x01) << j);
747  }
748  else if (firmware < firmware_version("1.27.2.90")) // Frame counter is exposed by the 4 LSB bits of the first pixel from all versions under 1.27.2.90
749  {
750  embedded_frame_counter = reinterpret_cast<byte_wrapping&>(*((unsigned char*)frame)).lsb;
751  }
752 
753  return embedded_frame_counter;
754  }
755 
757  std::mutex mutex;
763  mutable bool validate;
764 
765  public:
766  fisheye_timestamp_reader(int in_configured_fps, const char* fw_ver) : configured_fps(in_configured_fps), last_fisheye_timestamp(0), last_fisheye_counter(0), timestamp_wraparound(1, std::numeric_limits<uint32_t>::max()), frame_counter_wraparound(0, std::numeric_limits<uint32_t>::max()), validate(true), fw_version(fw_ver){}
767 
768  bool validate_frame(const subdevice_mode & /*mode*/, const void * frame) override
769  {
770  if (!validate)
771  return true;
772 
773  bool sts;
774  auto pixel_lsb = get_embedded_frame_counter(frame);
775  if ((sts = (pixel_lsb != 0)))
776  validate = false;
777 
778  return sts;
779  }
780 
782  unsigned char lsb : 4;
783  unsigned char msb : 4;
784  };
785 
786  unsigned long long get_frame_counter(const subdevice_mode & /*mode*/, const void * frame) override
787  {
788  std::lock_guard<std::mutex> guard(mutex);
789 
790  auto last_counter_lsb = reinterpret_cast<byte_wrapping&>(last_fisheye_counter).lsb;
791  auto pixel_lsb = get_embedded_frame_counter(frame);
792  if (last_counter_lsb == pixel_lsb)
793  return last_fisheye_counter;
794 
795  auto last_counter_msb = (last_fisheye_counter >> 4);
796  auto wrap_around = reinterpret_cast<byte_wrapping&>(last_fisheye_counter).lsb;
797  if (wrap_around == 15 || pixel_lsb < last_counter_lsb)
798  {
799  ++last_counter_msb;
800  }
801 
802  auto fixed_counter = (last_counter_msb << 4) | (pixel_lsb & 0xff);
803 
804  last_fisheye_counter = fixed_counter;
805  return frame_counter_wraparound.fix(fixed_counter);
806  }
807 
808  double get_frame_timestamp(const subdevice_mode & mode, const void * frame, double actual_fps) override
809  {
810  auto new_ts = timestamp_wraparound.fix(last_fisheye_timestamp + 1000. / actual_fps);
811  last_fisheye_timestamp = new_ts;
812  return new_ts;
813  }
814  };
815 
817  {
818  int fps, scale;
821  bool first_frames = true;
823  public:
824  color_timestamp_reader(int fps, int scale) : fps(fps), scale(scale), last_timestamp(0), timestamp_wraparound(0, std::numeric_limits<uint32_t>::max()), frame_counter_wraparound(0, std::numeric_limits<uint32_t>::max()) {}
825 
826  bool validate_frame(const subdevice_mode & mode, const void * frame) override
827  {
828  auto counter = get_frame_counter(mode, frame);
829 
830  if (counter == 0 && first_frames) return false;
831  first_frames = false;
832  return true;
833  }
834 
835  unsigned long long get_frame_counter(const subdevice_mode & mode, const void * frame) override
836  {
837  auto frame_number = 0;
838 
839  // YUY2 images encode the frame number in the low order bits of the final 32 bytes of the image
840  auto data = reinterpret_cast<const uint8_t *>(frame)+((mode.native_dims.x * mode.native_dims.y) - 32) * 2;
841  for (auto i = 0; i < 32; ++i)
842  {
843  frame_number |= ((*data & 1) << (i & 1 ? 32 - i : 30 - i));
844  data += 2;
845  }
846 
847  frame_number /= scale;
848 
849  return frame_counter_wraparound.fix(frame_number);
850  }
851 
852  double get_frame_timestamp(const subdevice_mode & mode, const void * frame, double /*actual_fps*/) override
853  {
854  auto new_ts = timestamp_wraparound.fix(last_timestamp + 1000. / fps);
855  last_timestamp = new_ts;
856  return new_ts;
857  }
858  };
859 
861  {
864  double ts_step;
867 
868  public:
869  serial_timestamp_generator(int fps) : fps(fps), serial_frame_number(), last_timestamp(0), timestamp_wraparound(0, std::numeric_limits<uint32_t>::max()), frame_counter_wraparound(0, std::numeric_limits<uint32_t>::max())
870  {
871  assert(fps > 0);
872  ts_step = 1000. / fps;
873  }
874 
875  bool validate_frame(const subdevice_mode & /*mode*/, const void * /*frame*/) override { return true; }
876  double get_frame_timestamp(const subdevice_mode &, const void *, double /*actual_fps*/) override
877  {
878  auto new_ts = timestamp_wraparound.fix(last_timestamp + ts_step);
879  last_timestamp = new_ts;
880  return new_ts;
881  }
882  unsigned long long get_frame_counter(const subdevice_mode &, const void *) override
883  {
884  return frame_counter_wraparound.fix(++serial_frame_number);
885  }
886  };
887 
888  // TODO refactor supported streams list to derived
889  std::shared_ptr<frame_timestamp_reader> ds_device::create_frame_timestamp_reader(int subdevice) const
890  {
891  auto & stream_depth = get_stream_interface(RS_STREAM_DEPTH);
892  auto & stream_infrared = get_stream_interface(RS_STREAM_INFRARED);
893  auto & stream_infrared2 = get_stream_interface(RS_STREAM_INFRARED2);
894  auto & stream_fisheye = get_stream_interface(RS_STREAM_FISHEYE);
895  auto & stream_color = get_stream_interface(RS_STREAM_COLOR);
896 
897  switch (subdevice)
898  {
899  case SUB_DEVICE_DEPTH:
900  if (stream_depth.is_enabled())
901  return std::make_shared<dinghy_timestamp_reader>(stream_depth.get_framerate());
902  break;
903  case SUB_DEVICE_INFRARED:
904  if (stream_infrared.is_enabled())
905  return std::make_shared<dinghy_timestamp_reader>(stream_infrared.get_framerate());
906 
907  if (stream_infrared2.is_enabled())
908  return std::make_shared<dinghy_timestamp_reader>(stream_infrared2.get_framerate());
909  break;
910  case SUB_DEVICE_FISHEYE:
911  if (stream_fisheye.is_enabled())
912  return std::make_shared<fisheye_timestamp_reader>(stream_fisheye.get_framerate(), get_camera_info(RS_CAMERA_INFO_ADAPTER_BOARD_FIRMWARE_VERSION));
913  break;
914  case SUB_DEVICE_COLOR:
915  if (stream_color.is_enabled())
916  {
917  // W/A for DS4 issue: when running at Depth 60 & Color 30 it seems that the frame counter is being incremented on every
918  // depth frame (or ir/ir2). This means we need to reduce color frame number accordingly
919  // In addition, the frame number is embedded only in YUYV format
920  bool depth_streams_active = stream_depth.is_enabled() | stream_infrared.is_enabled() | stream_infrared2.is_enabled();
921 
922  if (depth_streams_active && (stream_color.get_format() != rs_format::RS_FORMAT_RAW16))
923  {
924  auto master_fps = stream_depth.is_enabled() ? stream_depth.get_framerate() : 0;
925  master_fps = stream_infrared.is_enabled() ? stream_infrared.get_framerate() : master_fps;
926  master_fps = stream_infrared2.is_enabled() ? stream_infrared2.get_framerate() : master_fps;
927  auto scale = master_fps / stream_color.get_framerate();
928 
929  return std::make_shared<color_timestamp_reader>(stream_color.get_framerate(), scale);
930  }
931  else
932  {
933  return std::make_shared<serial_timestamp_generator>(stream_color.get_framerate());
934  }
935  }
936  break;
937  }
938 
939  // No streams enabled, so no need for a timestamp converter
940  return nullptr;
941  }
942 
943  std::vector<std::shared_ptr<frame_timestamp_reader>> ds_device::create_frame_timestamp_readers() const
944  {
949  }
950 }
uint32_t score_max_thresh
Definition: ds-private.h:314
const GLfloat * params
Definition: glext.h:371
uint32_t texture_count_thresh
Definition: ds-private.h:315
rsimpl::device_config config
Definition: device.h:79
uint32_t texture_diff_thresh
Definition: ds-private.h:316
static void update_device_info(rsimpl::static_device_info &info)
Definition: device.cpp:525
virtual void get_option_range(rs_option option, double &min, double &max, double &step, double &def) override
Definition: device.cpp:633
color_timestamp_reader(int fps, int scale)
Definition: ds-device.cpp:824
const std::shared_ptr< rsimpl::uvc::device > device
Definition: device.h:77
double get_frame_timestamp(const subdevice_mode &mode, const void *frame, double) override
Definition: ds-device.cpp:719
virtual rs_extrinsics get_extrinsics_to(const rs_stream_interface &other) const override
Definition: stream.cpp:12
const ds::dinghy & get_dinghy(const subdevice_mode &mode, const void *frame)
Definition: ds-device.cpp:670
virtual void get_options(const rs_option options[], size_t count, double values[]) override
Definition: device.cpp:681
const rsimpl::uvc::device & get_device() const
Definition: device.h:102
uint32_t robbins_munroe_plus_inc
Definition: ds-private.h:311
time_pad start_stop_pad
Definition: ds-device.h:40
bool validate_frame(const subdevice_mode &mode, const void *frame) override
Definition: ds-device.cpp:685
void set_disparity_mode(uvc::device &device, disp_mode mode)
Definition: ds-private.h:408
wraparound_mechanism< unsigned long long > frame_counter_wraparound
Definition: ds-device.cpp:679
GLfixed units
Definition: glext.h:4893
pose stream_poses[RS_STREAM_NATIVE_COUNT]
Definition: types.h:277
uint32_t get_lr_framerate() const
Definition: ds-device.cpp:380
#define MAX_DS_DEFAULT_X
Definition: ds-device.cpp:18
const GLfloat * m
Definition: glext.h:6461
native_pixel_format pf
Definition: types.h:158
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9820
#define LOG_WARNING(...)
Definition: types.h:79
virtual void stop(rs_source source) override
Definition: ds-device.cpp:292
const native_pixel_format pf_y8i
Definition: image.cpp:469
bool validate_frame(const subdevice_mode &mode, const void *frame) override
Definition: ds-device.cpp:826
const native_pixel_format pf_y12i
Definition: image.cpp:470
uint32_t get_depth_units(const uvc::device &device)
Definition: ds-private.h:365
uint32_t VDFerrorStatus
Definition: ds-private.h:440
bool get_emitter_state(const uvc::device &device, bool is_streaming, bool is_depth_enabled)
Definition: ds-private.cpp:384
GLsizei const GLchar *const * string
Definition: glext.h:683
int get_embedded_frame_counter(const void *frame) const
Definition: ds-device.cpp:737
const int STATUS_BIT_WEB_STREAMING
Definition: ds-private.h:21
virtual void stop_fw_logger() override
Definition: ds-device.cpp:309
Definition: archive.h:12
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glext.h:112
rs_intrinsics pad_crop_intrinsics(const rs_intrinsics &i, int pad_crop)
Definition: types.h:477
const int STATUS_BIT_Z_STREAMING
Definition: ds-private.h:19
virtual void stop(rs_source source) override
Definition: device.cpp:239
rs_option
Defines general configuration controls.
Definition: rs.h:128
static void set_common_ds_config(std::shared_ptr< uvc::device > device, static_device_info &info, const ds::ds_info &cam_info)
Definition: ds-device.cpp:390
disp_mode get_disparity_mode(const uvc::device &device)
Definition: ds-private.h:367
GLuint GLuint stream
Definition: glext.h:1774
unsigned long long get_frame_counter(const subdevice_mode &, const void *) override
Definition: ds-device.cpp:882
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1944
void set_lr_exposure_discovery(uvc::device &device, discovery disc)
Definition: ds-private.h:417
uint32_t get_disparity_shift(const uvc::device &device)
Definition: ds-private.h:402
rate_value get_lr_gain(const uvc::device &device)
Definition: ds-private.h:400
virtual void start(rs_source source) override
Definition: ds-device.cpp:298
const native_pixel_format pf_y16
Definition: image.cpp:468
wraparound_mechanism< double > timestamp_wraparound
Definition: ds-device.cpp:761
std::vector< subdevice_mode > subdevice_modes
Definition: types.h:273
void correct_lr_auto_exposure_params(rs_device_base *device, ae_params &params)
Definition: ds-device.cpp:72
uint8_t get_lr_exposure_mode(const uvc::device &device)
Definition: ds-private.h:401
stream_request presets[RS_STREAM_NATIVE_COUNT][RS_PRESET_COUNT]
Definition: types.h:275
wraparound_mechanism< unsigned long long > frame_counter_wraparound
Definition: ds-device.cpp:762
void set_lr_auto_exposure_params(uvc::device &device, ae_params params)
Definition: ds-private.h:411
uint16_t exposure_bottom_edge
Definition: ds-private.h:303
ae_params get_lr_auto_exposure_params(const uvc::device &device, std::vector< supported_option > ae_vec)
Definition: ds-private.h:372
ds_calibration calibration
Definition: ds-private.h:247
float translation[3]
Definition: rs.h:335
uint16_t exposure_left_edge
Definition: ds-private.h:304
const uint8_t RS_STREAM_NATIVE_COUNT
Definition: types.h:27
std::vector< supported_capability > capabilities_vector
Definition: types.h:282
ds_head_content head_content
Definition: ds-private.h:246
uint32_t neighbor_thresh
Definition: ds-private.h:318
GLuint GLenum option
Definition: glext.h:5581
std::string serial
Definition: types.h:280
int stream_subdevices[RS_STREAM_NATIVE_COUNT]
Definition: types.h:271
GLint GLint bottom
Definition: glext.h:1947
std::string firmware_version
Definition: types.h:279
const native_pixel_format pf_y8
Definition: image.cpp:467
void set_emitter_state(uvc::device &device, bool state)
Definition: ds-private.cpp:392
wraparound_mechanism< double > timestamp_wraparound
Definition: ds-device.cpp:819
const GLubyte * c
Definition: glext.h:11542
GLuint counter
Definition: glext.h:5361
GLuint GLuint GLsizei count
Definition: glext.h:111
bool validate_frame(const subdevice_mode &, const void *frame) override
Definition: ds-device.cpp:768
void on_update_disparity_multiplier(double multiplier)
Definition: ds-device.cpp:49
const int STATUS_BIT_LR_STREAMING
Definition: ds-private.h:20
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
uint32_t robbins_munroe_minus_inc
Definition: ds-private.h:310
wraparound_mechanism< unsigned long long > frame_counter_wraparound
Definition: ds-device.cpp:866
uint32_t score_min_thresh
Definition: ds-private.h:313
size_t get_image_size(int width, int height) const
Definition: types.h:146
void set_options(const rs_option options[], size_t count, const double values[]) override
Definition: ds-device.cpp:110
void set_stream_intent(uvc::device &device, uint8_t &intent)
Definition: ds-private.cpp:362
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * data
Definition: glext.h:223
const char * get_camera_info(rs_camera_info info) const override
Definition: device.cpp:62
discovery get_lr_gain_discovery(const uvc::device &device)
Definition: ds-private.h:404
std::map< rs_camera_info, std::string > camera_info
Definition: types.h:284
bool supports_option(rs_option option) const override
Definition: ds-device.cpp:555
uint32_t second_peak_thresh
Definition: ds-private.h:317
void set_depth_units(uvc::device &device, uint32_t units)
Definition: ds-private.h:406
void get_options(const rs_option options[], size_t count, double values[]) override
Definition: ds-device.cpp:200
std::shared_ptr< frame_timestamp_reader > create_frame_timestamp_reader(int subdevice) const
Definition: ds-device.cpp:889
GLint left
Definition: glext.h:1947
std::vector< supported_option > options
Definition: types.h:276
virtual void disable_auto_option(int subdevice, rs_option auto_opt)
Definition: device.cpp:701
GLdouble GLdouble right
Definition: glext.h:6472
#define MAX_DS_DEFAULT_Y
Definition: ds-device.cpp:19
unsigned long long get_frame_counter(const subdevice_mode &mode, const void *frame) override
Definition: ds-device.cpp:835
unsigned long long get_frame_counter(const subdevice_mode &, const void *frame) override
Definition: ds-device.cpp:786
uint16_t exposure_right_edge
Definition: ds-private.h:305
float mean_intensity_set_point
Definition: ds-private.h:297
wraparound_mechanism< double > timestamp_wraparound
Definition: ds-device.cpp:865
const GLdouble * v
Definition: glext.h:232
GLenum mode
Definition: glext.h:1117
uint16_t exposure_top_edge
Definition: ds-private.h:302
discovery get_lr_exposure_discovery(const uvc::device &device)
Definition: ds-private.h:403
rate_value get_lr_exposure(const uvc::device &device)
Definition: ds-private.h:371
rs_source
Source: allows you to choose between available hardware subdevices.
Definition: rs.h:90
virtual bool supports_option(rs_option option) const override
Definition: device.cpp:55
const native_pixel_format pf_z16
Definition: image.cpp:471
ds_device(std::shared_ptr< uvc::device > device, const static_device_info &info, calibration_validator validator)
Definition: ds-device.cpp:23
wraparound_mechanism< unsigned long long > frame_counter_wraparound
Definition: ds-device.cpp:820
int get_pu_control(const device &device, int subdevice, rs_option option)
const native_pixel_format pf_rw16
Definition: image.cpp:460
void set_lr_gain_discovery(uvc::device &device, discovery disc)
Definition: ds-private.h:418
std::vector< std::shared_ptr< frame_timestamp_reader > > create_frame_timestamp_readers() const override
Definition: ds-device.cpp:943
void set_lr_gain(uvc::device &device, rate_value gain)
Definition: ds-private.h:420
void set_depth_params(uvc::device &device, dc_params params)
Definition: ds-private.h:410
void set_disparity_shift(uvc::device &device, uint32_t shift)
Definition: ds-private.h:416
bool validate_frame(const subdevice_mode &, const void *) override
Definition: ds-device.cpp:875
uint32_t CAMmoduleStatus
Definition: ds-private.h:435
void set_pu_control_with_retry(device &device, int subdevice, rs_option option, int value)
Definition: uvc.h:71
GLenum GLsizei GLsizei GLint * values
Definition: glext.h:1484
fisheye_timestamp_reader(int in_configured_fps, const char *fw_ver)
Definition: ds-device.cpp:766
rs_stream select_key_stream(const std::vector< rsimpl::subdevice_mode_selection > &selected_modes) override
Definition: ds-device.cpp:357
float3x3 orientation
Definition: types.h:112
GLdouble s
Definition: glext.h:231
rs_stream
Streams are different types of data provided by RealSense devices.
Definition: rs.h:33
GLsizei GLsizei GLchar * source
Definition: glext.h:672
rs_device * dev
double get_frame_timestamp(const subdevice_mode &mode, const void *frame, double actual_fps) override
Definition: ds-device.cpp:808
uint32_t magicNumber
Definition: ds-private.h:426
std::vector< interstream_rule > interstream_rules
Definition: types.h:274
void set_lr_exposure(uvc::device &device, rate_value exposure)
Definition: ds-private.h:419
std::vector< supported_option > get_ae_range_vec()
Definition: ds-device.cpp:57
unsigned long long get_frame_counter(const subdevice_mode &mode, const void *frame) override
Definition: ds-device.cpp:726
const native_pixel_format pf_yuy2
Definition: image.cpp:462
bool is_pu_control(rs_option option)
Definition: uvc.h:46
virtual void start(rs_source source) override
Definition: device.cpp:215
void get_option_range(rs_option option, double &min, double &max, double &step, double &def) override
Definition: ds-device.cpp:591
std::string read_isp_firmware_version(uvc::device &device)
Definition: ds-private.cpp:356
rs_intrinsics scale_intrinsics(const rs_intrinsics &i, int width, int height)
Definition: types.h:482
virtual void set_options(const rs_option options[], size_t count, const double values[]) override
Definition: device.cpp:661
wraparound_mechanism< double > timestamp_wraparound
Definition: ds-device.cpp:678
virtual void stop_fw_logger() override
Definition: device.cpp:311
void on_update_depth_units(uint32_t units)
Definition: ds-device.cpp:43
virtual void start_fw_logger(char fw_log_op_code, int grab_rate_in_ms, std::timed_mutex &mutex) override
Definition: device.cpp:283
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:6472
float3 position
Definition: types.h:112
std::string read_firmware_version(uvc::device &device)
Definition: ds-private.cpp:350
bool is_disparity_mode_enabled() const
Definition: ds-device.cpp:37
void on_before_start(const std::vector< subdevice_mode_selection > &selected_modes) override
Definition: ds-device.cpp:314
dc_params get_depth_params(const uvc::device &device)
Definition: ds-private.h:369
uint32_t frameStatus
Definition: ds-private.h:428
range get_min_max_depth(const uvc::device &device)
Definition: ds-private.h:366
double get_frame_timestamp(const subdevice_mode &mode, const void *frame, double) override
Definition: ds-device.cpp:852
void set_min_max_depth(uvc::device &device, range min_max)
Definition: ds-private.h:407
std::string time_to_string(double val)
Definition: ds-private.h:151
const rsimpl::stream_interface & get_stream_interface(rs_stream stream) const override
Definition: device.h:122
virtual void start_fw_logger(char fw_log_op_code, int grab_rate_in_ms, std::timed_mutex &mutex) override
Definition: ds-device.cpp:304
void set_lr_exposure_mode(uvc::device &device, uint8_t mode)
Definition: ds-private.h:415
bool is_capturing() const override
Definition: device.h:153
double get_frame_timestamp(const subdevice_mode &, const void *, double) override
Definition: ds-device.cpp:876
uint32_t frameCount
Definition: ds-private.h:427


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:17