@@ -47,20 +47,20 @@ class LIBFREENECT2_API Frame
4747 /* * Available types of frames. */
4848 enum Type
4949 {
50- Color = 1 , // /< 1920x1080 32-bit BGRX.
50+ Color = 1 , // /< 1920x1080
5151 Ir = 2 , // /< 512x424 float. Range is [0.0, 65535.0].
5252 Depth = 4 // /< 512x424 float, unit: millimeter. Non-positive, NaN, and infinity are invalid or missing data.
5353 };
5454
55- /* * (Proposed for 0.2) Pixel format. */
55+ /* * Pixel format. */
5656 enum Format
5757 {
58- BGRX,
59- RGBX,
60- Gray,
61- Float,
62- // Note that if format is 'raw' then 'bytes_per_pixel' actually contains the number of bytes
63- Raw
58+ Invalid = 0 , // /< Invalid format.
59+ Raw = 1 , // /< Raw bitstream. 'bytes_per_pixel' defines the number of bytes
60+ Float = 2 , // /< A 4-byte float per pixel
61+ BGRX = 4 , // /< 4 bytes of B, G, R, and unused per pixel
62+ RGBX = 5 , // /< 4 bytes of R, G, B, and unused per pixel
63+ Gray = 6 , // /< 1 byte of gray per pixel
6464 };
6565
6666 size_t width; // /< Length of a line (in pixels).
@@ -72,39 +72,17 @@ class LIBFREENECT2_API Frame
7272 float exposure; // /< From 0.5 (very bright) to ~60.0 (fully covered)
7373 float gain; // /< From 1.0 (bright) to 1.5 (covered)
7474 float gamma; // /< From 1.0 (bright) to 6.4 (covered)
75- uint32_t status; // /< Reserved. To be defined in 0.2 .
76- Format format; // /< Reserved. To be defined in 0.2 .
75+ uint32_t status; // /< zero if ok; non-zero for errors .
76+ Format format; // /< Byte format. Informative only, doesn't indicate errors .
7777
7878 /* * Construct a new frame.
7979 * @param width Width in pixel
8080 * @param height Height in pixel
8181 * @param bytes_per_pixel Bytes per pixel
8282 * @param data_ Memory to store frame data. If `NULL`, new memory is allocated.
8383 */
84- Frame (size_t width, size_t height, size_t bytes_per_pixel, unsigned char *data_ = NULL ) :
85- width (width),
86- height (height),
87- bytes_per_pixel (bytes_per_pixel),
88- data (data_),
89- exposure (0 .f),
90- gain (0 .f),
91- gamma (0 .f),
92- rawdata (NULL )
93- {
94- if (data_)
95- return ;
96- const size_t alignment = 64 ;
97- size_t space = width * height * bytes_per_pixel + alignment;
98- rawdata = new unsigned char [space];
99- uintptr_t ptr = reinterpret_cast <uintptr_t >(rawdata);
100- uintptr_t aligned = (ptr - 1u + alignment) & -alignment;
101- data = reinterpret_cast <unsigned char *>(aligned);
102- }
103-
104- virtual ~Frame ()
105- {
106- delete[] rawdata;
107- }
84+ Frame (size_t width, size_t height, size_t bytes_per_pixel, unsigned char *data_ = NULL );
85+ virtual ~Frame ();
10886
10987 protected:
11088 unsigned char * rawdata; // /< Unaligned start of #data.
0 commit comments