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 3434namespace libfreenect2
3535{
3636
37- struct LIBFREENECT2_API Frame
37+ class LIBFREENECT2_API Frame
3838{
39+ public:
3940 enum Type
4041 {
4142 Color = 1 ,
@@ -53,13 +54,21 @@ struct LIBFREENECT2_API Frame
5354 height (height),
5455 bytes_per_pixel (bytes_per_pixel)
5556 {
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);
5763 }
5864
5965 ~Frame ()
6066 {
61- delete[] data ;
67+ delete[] rawdata ;
6268 }
69+
70+ protected:
71+ unsigned char * rawdata;
6372};
6473
6574class LIBFREENECT2_API FrameListener
You can’t perform that action at this time.
0 commit comments