File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
examples/protonect/include/libfreenect2 Expand file tree Collapse file tree 1 file changed +12
-3
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 ,
@@ -53,13 +54,21 @@ struct LIBFREENECT2_API Frame
53
54
height (height),
54
55
bytes_per_pixel (bytes_per_pixel)
55
56
{
56
- data = new unsigned char [width * height * bytes_per_pixel];
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);
57
63
}
58
64
59
65
~Frame ()
60
66
{
61
- delete[] data ;
67
+ delete[] rawdata ;
62
68
}
69
+
70
+ protected:
71
+ unsigned char * rawdata;
63
72
};
64
73
65
74
class LIBFREENECT2_API FrameListener
You can’t perform that action at this time.
0 commit comments