File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
examples/protonect/include/libfreenect2 Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 34
34
namespace libfreenect2
35
35
{
36
36
37
- struct LIBFREENECT2_API Frame
37
+ class LIBFREENECT2_API Frame
38
38
{
39
+ public:
39
40
enum Type
40
41
{
41
42
Color = 1 ,
@@ -46,22 +47,28 @@ struct LIBFREENECT2_API Frame
46
47
uint32_t timestamp;
47
48
uint32_t sequence;
48
49
size_t width, height, bytes_per_pixel;
49
- unsigned char * rawdata;
50
50
unsigned char * data;
51
51
52
52
Frame (size_t width, size_t height, size_t bytes_per_pixel) :
53
53
width (width),
54
54
height (height),
55
55
bytes_per_pixel (bytes_per_pixel)
56
56
{
57
- rawdata = new unsigned char [width * height * bytes_per_pixel + 128 ];
58
- data = (unsigned char *)((unsigned long long )(rawdata+64 ) & (unsigned long long )(0xFFFFFFFFFFFFFFC0ULL ));
57
+ const size_t alignment = 64 ;
58
+ size_t space = width * height * bytes_per_pixel + alignment;
59
+ rawdata = new unsigned char [space];
60
+ uintptr_t ptr = reinterpret_cast <uintptr_t >(rawdata);
61
+ uintptr_t aligned = (ptr - 1u + alignment) & -alignment;
62
+ data = reinterpret_cast <unsigned char *>(aligned);
59
63
}
60
64
61
65
~Frame ()
62
66
{
63
67
delete[] rawdata;
64
68
}
69
+
70
+ protected:
71
+ unsigned char * rawdata;
65
72
};
66
73
67
74
class LIBFREENECT2_API FrameListener
You can’t perform that action at this time.
0 commit comments