src/metadata.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 // Metadata attributes provided by RS4xx Depth Cameras
4 
5 #pragma once
6 
7 #include "types.h"
8 
9 #define REGISTER_MD_TYPE(A,B)\
10  template<>\
11  struct md_type_trait<A>\
12  {\
13  static const md_type type = B;\
14  };
15 
16 
17 namespace librealsense
18 {
19  template<class T>
20  struct md_type_trait;
21 
22  // Metadata tables version
24  // Intel Configuration:
25  // version 2: gpioInputData added to md_configuration (with its flag)
26  // version 3: sub_preset_info added to md_configuration (with its flag)
30 
32  enum class md_type : uint32_t
33  {
37  META_DATA_INTEL_STAT_ID = 0x80000003,
39  META_DATA_INTEL_RGB_CONTROL_ID = 0x80000005,
42  META_DATA_CAPTURE_STATS_ID = 0x00000003,
43  META_DATA_CAMERA_EXTRINSICS_ID = 0x00000004,
44  META_DATA_CAMERA_INTRINSICS_ID = 0x00000005,
47  META_DATA_CAMERA_DEBUG_ID = 0x800000FF,
48  META_DATA_HID_IMU_REPORT_ID = 0x80001001,
50  };
51 
52  static const std::map<md_type, std::string> md_type_desc =
53  {
54  { md_type::META_DATA_INTEL_DEPTH_CONTROL_ID, "Intel Depth Control"},
55  { md_type::META_DATA_INTEL_CAPTURE_TIMING_ID, "Intel Capture timing"},
56  { md_type::META_DATA_INTEL_CONFIGURATION_ID, "Intel Configuration"},
57  { md_type::META_DATA_INTEL_STAT_ID, "Intel Statistics"},
58  { md_type::META_DATA_INTEL_FISH_EYE_CONTROL_ID, "Intel Fisheye Control"},
59  { md_type::META_DATA_INTEL_RGB_CONTROL_ID, "Intel RGB Control"},
60  { md_type::META_DATA_INTEl_FE_FOV_MODEL_ID, "Intel Fisheye FOV Model"},
61  { md_type::META_DATA_CAPTURE_STATS_ID, "Capture Statistics"},
62  { md_type::META_DATA_CAMERA_EXTRINSICS_ID, "Camera Extrinsic"},
63  { md_type::META_DATA_CAMERA_INTRINSICS_ID, "Camera Intrinsic"},
64  { md_type::META_DATA_CAMERA_DEBUG_ID, "Camera Debug"},
65  { md_type::META_DATA_INTEL_L500_CAPTURE_TIMING_ID, "Intel Capture timing"},
66  { md_type::META_DATA_INTEL_L500_DEPTH_CONTROL_ID, "Intel Depth Control"},
67  { md_type::META_DATA_HID_IMU_REPORT_ID, "HID IMU Report"},
68  { md_type::META_DATA_HID_CUSTOM_TEMP_REPORT_ID, "HID Custom Temperature Report"},
69  };
70 
76  {
77  frame_counter_attribute = (1u << 0),
78  sensor_timestamp_attribute = (1u << 1),
79  readout_time_attribute = (1u << 2),
80  exposure_attribute = (1u << 3),
81  frame_interval_attribute = (1u << 4),
82  pipe_latency_attribute = (1u << 5),
83  };
84 
88  {
89  exposure_time_attribute = (1u << 0),
91  iso_speed_attribute = (1u << 2),
92  focus_state_attribute = (1u << 3),
93  lens_posiiton_attribute = (1u << 4),
94  white_balance_attribute = (1u << 5),
95  flash_attribute = (1u << 6),
96  flash_power_attribute = (1u << 7),
97  zoom_factor_attribute = (1u << 8),
98  scene_mode_attribute = (1u << 9),
99  sensor_framerate_attribute = (1u << 10),
100  };
101 
105  {
106  gain_attribute = (1u << 0),
107  exposure_attribute = (1u << 1),
108  laser_pwr_attribute = (1u << 2),
109  ae_mode_attribute = (1u << 3),
110  exposure_priority_attribute = (1u << 4),
111  roi_attribute = (1u << 5),
112  preset_attribute = (1u << 6),
113  emitter_mode_attribute = (1u << 7),
114  led_power_attribute = (1u << 8)
115  };
116 
120  {
121  laser_power = (1u << 0),
122  preset_id = (1u << 1),
123  laser_power_mode = (1u << 2),
124  };
128  {
129  gain_attribute = (1u << 0),
130  exposure_attribute = (1u << 1),
131  };
132 
136  {
137  brightness_attribute = (1u << 0),
138  contrast_attribute = (1u << 1),
139  saturation_attribute = (1u << 2),
140  sharpness_attribute = (1u << 3),
141  ae_mode_attribute = (1u << 4),
142  awb_temp_attribute = (1u << 5),
143  gain_attribute = (1u << 6),
144  backlight_comp_attribute = (1u << 7),
145  gamma_attribute = (1u << 8),
146  hue_attribute = (1u << 9),
147  manual_exp_attribute = (1u << 10),
148  manual_wb_attribute = (1u << 11),
149  power_line_frequency_attribute = (1u << 12),
150  low_light_comp_attribute = (1u << 13),
151  };
152 
156  {
157  hw_type_attribute = (1u << 0),
158  sku_id_attribute = (1u << 1),
159  cookie_attribute = (1u << 2),
160  format_attribute = (1u << 3),
161  width_attribute = (1u << 4),
162  height_attribute = (1u << 5),
163  fps_attribute = (1u << 6),
164  trigger_attribute = (1u << 7),
165  calibration_count_attribute = (1u << 8),
166  gpio_input_data_attribute = (1u << 9),
167  sub_preset_info_attribute = (1u << 10)
168  };
169 
173  {
174  left_sum_attribute = (1u << 0),
175  left_dark_count_attribute = (1u << 1),
176  left_bright_count_attribute = (1u << 2),
177  right_sum_attribute = (1u << 3),
178  right_dark_count_attribute = (1u << 4),
179  right_bright_count_attribute = (1u << 5),
180  red_frame_count_attribute = (1u << 6),
181  left_red_sum_attribute = (1u << 7),
182  left_greeen1_attribute = (1u << 8),
183  left_greeen2_attribute = (1u << 9),
184  left_blue_sum_attribute = (1u << 10),
185  right_red_sum_attribute = (1u << 11),
186  right_greeen1_attribute = (1u << 12),
187  right_greeen2_attribute = (1u << 13),
188  right_blue_sum_attribute = (1u << 14),
189  };
190 
194  {
199  };
200 
204  {
205  custom_timestamp_attirbute = (1u << 0),
206  imu_counter_attribute = (1u << 1),
207  usb_counter_attribute = (1u << 2)
208  };
209 
211  {
212  return static_cast<md_hid_imu_attributes>(static_cast<uint8_t>(l) | static_cast<uint8_t>(r));
213  }
214 
216  {
217  return l = l | r;
218  }
219 
223  {
224  source_id_attirbute = (1u << 0),
225  custom_timestamp_attirbute = (1u << 1),
226  imu_counter_attribute = (1u << 2),
227  usb_counter_attribute = (1u << 3)
228  };
229 
230 #pragma pack(push, 1)
231  // SR300 Metadata definitions
233  {
234  uint32_t uvc_timestamp; // Modify spec to align with UVC protocol
235  //******* General *****************
239  uint8_t reserved0[2];
240  //******* Configuration ***********
245  uint8_t reserved1[1];
246  //******* Controls ****************
260  uint8_t reserved2[7];
261  //******* Capture Info ************
267  uint8_t reserved3[78];
268  };
269 
271  {
272  uint32_t uvc_timestamp; // Modify spec to align with UVC protocol
273  //******* General ***************** [0:7]
277  uint8_t reserved0[2];
278  //******* Configuration *********** [8:15]
283  uint8_t reserved1[1];
284  //******* External Trigger ******** [16:23]
287  uint8_t reserved2[6];
288  //******* Controls **************** [24:31]
294  uint8_t reserved3[3];
295  //******* Capture Info ************ [32:47]
301  uint8_t reserved4[7];
302  //******* Debug Info ************ [48:127]
307  uint8_t reserved5[73];
308  };
309 
311  struct md_header
312  {
313  md_type md_type_id; // The type of the metadata struct
314  uint32_t md_size; // Actual size of metadata struct without header
315  };
316 
320  {
323  uint32_t flags; // Bit array to specify attributes that are valid
325  uint32_t sensor_timestamp; //In microsecond unit
326  uint32_t readout_time; //The readout time in microsecond unit
327  uint32_t exposure_time; //The exposure time in microsecond unit
328  uint32_t frame_interval; //The frame interval in microsecond unit
329  uint32_t pipe_latency; //The latency between start of frame to frame ready in USB buffer
330  };
331 
333 
335 
337  {
340  uint32_t flags; // Bit array to specify attributes that are valid
342  uint32_t sensor_timestamp; //In microsecond unit
343  uint32_t readout_time; //The readout time in microsecond unit
344  uint32_t exposure_time; //The exposure time in microsecond unit
345  uint32_t frame_interval; //The frame interval in microsecond unit
346  uint32_t pipe_latency; //The latency between start of frame to frame ready in USB buffer
347  };
349 
350 
353  {
362  uint32_t lens_position; // a.k.a Focus
369  };
370 
372 
373 
376  {
380  uint32_t manual_gain; // Manual gain value
381  uint32_t manual_exposure; // Manual exposure
382  uint32_t laser_power; // Laser power value
383  uint32_t auto_exposure_mode; // AE mode. When active handles both Exposure and Gain
393  };
394 
396 
397 
400  {
404  uint32_t laser_power; //value between 1 to 12
406  uint32_t laser_power_mode; //Auto or Manual laser power
407  };
408 
410 
411 
414  {
418  uint32_t manual_gain; // Manual gain value
419  uint32_t manual_exposure; // Manual exposure
420  };
421 
423 
424 
426  {
444  };
445 
447 
448  /*struct md_sub_preset_info_fields
449  {
450  uint32_t id : 4;
451  uint32_t num_of_items : 8;
452  uint32_t item_index : 8;
453  uint32_t iteration : 6;
454  uint32_t item_iteration : 6;
455  };
456 
457  union md_sub_preset_info
458  {
459  uint32_t value;
460  md_sub_preset_info_fields fields;
461  };*/
462 
463 
466  {
470  uint8_t hw_type; // IVCAM2 , RS4xx, etc'
472  uint32_t cookie; /* Place Holder enable FW to bundle cookie
473  with control state and configuration.*/
475  uint16_t width; // Requested resolution
477  uint16_t fps; // Requested FPS
478  uint16_t trigger; /* Byte <0> 0 free-running
479  1 in sync
480  2 external trigger (depth only)
481  Byte <1> configured delay (depth only)*/
485  uint8_t reserved[1];
486 
487  typedef enum sub_preset_bit_mask
488  {
489  SUB_PRESET_BIT_MASK_ID = 0xF,
490  SUB_PRESET_BIT_MASK_SEQUENCE_SIZE = 0xFF0,
491  SUB_PRESET_BIT_MASK_SEQUENCE_ID = 0xFF000,
492  SUB_PRESET_BIT_MASK_SEQUENCE_ITERATION = 0x3F00000,
493  SUB_PRESET_BIT_MASK_SEQUENCE_ITEM_ITERATION = 0xFC000000
495 
497  {
498  SUB_PRESET_BIT_OFFSET_ID = 0,
499  SUB_PRESET_BIT_OFFSET_SEQUENCE_SIZE = 4,
500  SUB_PRESET_BIT_OFFSET_SEQUENCE_ID = 12,
501  SUB_PRESET_BIT_OFFSET_ITERATION = 20,
502  SUB_PRESET_BIT_OFFSET_ITEM_ITERATION = 26
504  };
505 
507 
508 
511  {
530  };
531 
533 
535  {
538  };
539 
543  {
544  float radial_k1;
545  float radial_k2;
546  float radial_k3;
549  };
550 
553  {
558  };
559 
561 
563  {
566  };
567 
569  {
572  };
573 
575 
576  const uint8_t UVC_GUID_SIZE = 16;
578  {
579  uint8_t calibration_id[UVC_GUID_SIZE];
581  float4 orientation; // quaternion representation
582  };
583 
584  const uint8_t TRANSFORM_COUNT = 1; // TODO requires explanation
586  {
589  };
590 
592  {
595  };
596 
598 
600  {
605  };
606 
608  {
613  };
614 
616  {
621  };
622 
624  {
629  };
630 
632  {
636  };
637 
639  {
644  };
645 
647  {
651  };
652 
654  {
657  };
658 
660  {
663  };
664 
667  union md_modes
668  {
674  };
675 
679  {
682  };
683 
685 
689  {
692 
693  inline bool capture_valid() const
694  {
695  return ((header.length > platform::uvc_header_size) &&
696  (payload.header.md_size == md_capture_timing_size) &&
698  }
699  };
700 
702  {
704  uint8_t flags; // Bit array to specify attributes that are valid (limited to 7 fields)
705  uint64_t custom_timestamp; // HW Timestamp
706  uint8_t imu_counter; // IMU internal counter
707  uint8_t usb_counter; // USB-layer internal counter
708  };
709 
711 
713 
715  {
717  uint8_t flags; // Bit array to specify attributes that are valid (limited to 7 fields)
718  uint64_t custom_timestamp; // HW Timestamp
719  uint8_t imu_counter; // IMU internal counter
720  uint8_t usb_counter; // USB-layer internal counter
722  };
723 
725 
726 
729  {
732  };
733 
737  {
740  };
741 
743 
744 #pragma pack(pop)
745 }
metadata_intel_basic - a subset of the full metadata required to provide the essential sensor attribu...
Definition: src/metadata.h:688
metadata_raw - aggrevative structure that represents all the possible metadata struct types to be han...
Definition: src/metadata.h:667
mf_camera_extrinsic camera_extrinsic
Definition: src/metadata.h:594
md_intrinsic_pinhole_cam_model radial_k1
Definition: src/metadata.h:556
md_hid_types - aggrevative structure that represents the supported HID metadata struct types to be ha...
Definition: src/metadata.h:728
constexpr uint8_t metadata_hid_raw_size
Definition: src/metadata.h:742
md_hid_imu_attributes operator|(md_hid_imu_attributes l, md_hid_imu_attributes r)
Definition: src/metadata.h:210
const uint8_t INTRINSICS_MODEL_COUNT
Definition: src/metadata.h:560
md_configuration - device/stream configuration. Corresponds to FW&#39;s STMetaDataIntelConfiguration obje...
Definition: src/metadata.h:465
metadata_raw - metadata structure layout as transmitted and received by backend
Definition: src/metadata.h:678
md_configuration_attributes
md_configuration_attributes - bit mask to find active attributes, md_configuration struct ...
Definition: src/metadata.h:155
metadata_hid_raw - HID metadata structure layout populated by backend
Definition: src/metadata.h:736
constexpr uint8_t metadata_raw_size
Definition: src/metadata.h:684
constexpr uint8_t uvc_header_size
Definition: backend.h:165
md_intel_stat Corresponds to FW&#39;s STMetaDataIntelStat object
Definition: src/metadata.h:510
md_capture_stats - properties associated with optical sensor during video streaming. Corresponds to FW STMetaDataCaptureStats object
Definition: src/metadata.h:352
md_hid_custom_temp_attributes
md_hid_imu_attributes - bit mask to designate the enabled attributed, md_imu_report struct ...
Definition: src/metadata.h:222
md_rgb_control_attributes
md_rgb_control_attributes - bit mask to find active attributes, md_rgb_control struct ...
Definition: src/metadata.h:135
static const std::map< md_type, std::string > md_type_desc
Definition: src/metadata.h:52
md_header - metadata header is a integral part of all rs4XX metadata objects
Definition: src/metadata.h:311
unsigned short uint16_t
Definition: stdint.h:79
md_capture_timing intel_capture_timing
Definition: src/metadata.h:609
md_hid_report_type
md_hid_imu_attributes - bit mask to designate the enabled attributed, md_imu_report struct ...
Definition: src/metadata.h:193
unsigned char uint8_t
Definition: stdint.h:78
md_capture_timing - properties associated with sensor configuration during video streaming. Corresponds to FW STMetaDataIntelCaptureTiming object
Definition: src/metadata.h:319
md_capture_stat_attributes
md_capture_stat_attributes - bit mask to find enabled attributes in md_capture_stats ...
Definition: src/metadata.h:87
md_intrinsic_distortion_model - Distortion coefficients of sensor instrinsic
Definition: src/metadata.h:542
md_stat_attributes
md_stat_attributes - bit mask to find active attributes, md_stat struct
Definition: src/metadata.h:172
md_capture_stats intel_capture_stats
Definition: src/metadata.h:626
md_hid_imu_attributes
md_hid_imu_attributes - bit mask to designate the enabled attributed, md_imu_report struct ...
Definition: src/metadata.h:203
constexpr uint8_t metadata_imu_report_size
Definition: src/metadata.h:712
md_fisheye_control intel_fisheye_control
Definition: src/metadata.h:619
md_fisheye_mode fisheye_mode
Definition: src/metadata.h:670
md_fisheye_control_attributes
md_fisheye_control_attributes - bit mask to find active attributes, md_fisheye_control struct ...
Definition: src/metadata.h:127
md_intrinsic_distortion_model radial_k2
Definition: src/metadata.h:557
const int META_DATA_INTEL_STAT_VERSION
Definition: src/metadata.h:28
md_intel_stat metadata_intel_stat
Definition: src/metadata.h:642
md_capture_stats intel_capture_stats
Definition: src/metadata.h:610
GLdouble GLdouble r
md_camera_intrinsic intel_camera_intrinsic
Definition: src/metadata.h:635
unsigned int uint32_t
Definition: stdint.h:80
md_depth_y_normal_mode depth_y_mode
Definition: src/metadata.h:648
signed short int16_t
Definition: stdint.h:76
md_fisheye_normal_mode fisheye_mode
Definition: src/metadata.h:655
md_custom_tmp_report temperature_report
Definition: src/metadata.h:731
md_capture_timing intel_capture_timing
Definition: src/metadata.h:640
md_hid_imu_attributes operator|=(md_hid_imu_attributes l, md_hid_imu_attributes r)
Definition: src/metadata.h:215
unsigned __int64 uint64_t
Definition: stdint.h:90
md_type
md_mode - enumerates the types of metadata modes(structs) supported
Definition: src/metadata.h:32
md_rgb_normal_mode rgb_mode
Definition: src/metadata.h:661
md_calibration_mode calib_mode
Definition: src/metadata.h:662
const int META_DATA_INTEL_CAPTURE_TIMING_VERSION
Definition: src/metadata.h:29
signed char int8_t
Definition: stdint.h:75
md_configuration intel_configuration
Definition: src/metadata.h:643
md_capture_stats intel_capture_stats
Definition: src/metadata.h:641
md_depth_control - depth data-related parameters. Corresponds to FW&#39;s STMetaDataIntelDepthControl obj...
Definition: src/metadata.h:375
#define REGISTER_MD_TYPE(A, B)
Definition: src/metadata.h:9
md_fisheye_control - fisheye-related parameters. Corresponds to FW&#39;s STMetaDataIntelFishEyeControl ob...
Definition: src/metadata.h:413
const int META_DATA_INTEL_CONFIGURATION_VERSION
Definition: src/metadata.h:27
const uint8_t TRANSFORM_COUNT
Definition: src/metadata.h:584
md_configuration intel_configuration
Definition: src/metadata.h:628
md_depth_mode depth_mode
Definition: src/metadata.h:669
const int META_DATA_INTEL_DEPTH_CONTROL_VERSION
Definition: src/metadata.h:23
md_depth_control - depth data-related parameters. Corresponds to FW&#39;s STMetaDataIntelDepthControl obj...
Definition: src/metadata.h:399
md_l500_depth_control intel_depth_control
Definition: src/metadata.h:611
md_calibration_mode calib_mode
Definition: src/metadata.h:656
md_capture_timing intel_capture_timing
Definition: src/metadata.h:633
md_capture_timing intel_capture_timing
Definition: src/metadata.h:625
platform::hid_header header
Definition: src/metadata.h:738
md_calibration_mode calib_mode
Definition: src/metadata.h:649
md_depth_control_attributes
md_depth_control_attributes - bit mask to find active attributes, md_depth_control struct ...
Definition: src/metadata.h:104
md_rgb_control - Realtec RGB sensor attributes.
Definition: src/metadata.h:425
signed int int32_t
Definition: stdint.h:77
md_configuration intel_configuration
Definition: src/metadata.h:612
constexpr uint8_t md_capture_timing_size
Definition: src/metadata.h:332
platform::uvc_header header
Definition: src/metadata.h:680
md_sr300_rgb sr300_rgb_mode
Definition: src/metadata.h:673
const uint8_t UVC_GUID_SIZE
Definition: src/metadata.h:576
md_pinhole_camera_intrinsics pinhole_cam_intrinsics
Definition: src/metadata.h:571
md_l500_depth_control_attributes
md_depth_control_attributes - bit mask to find active attributes, md_depth_control struct ...
Definition: src/metadata.h:119
md_sr300_depth sr300_depth_mode
Definition: src/metadata.h:672
md_pinhole_cam_intrinsic_model - Pinhole sensor&#39;s characteristics
Definition: src/metadata.h:552
md_camera_extrinsic intel_camera_extrinsic
Definition: src/metadata.h:634
md_capture_timing_attributes
md_capture_timing_attributes - enumerate the bit offset to check a specific attribute of md_capture_t...
Definition: src/metadata.h:75


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:21