google project tango - Size of data field in TangoImageBuffer -


i trying memcpy of tangoimagebuffer data field, which, if image yuv, according me should (buffer->width * buffer->height * 3 * sizeof(uint8_t)) (sizeof kicks, know 1), makes segfault. if copy height*width bytes works, , height*width*2, seem getting valid data, don't know size should field be.

my (relevant) code:

void onimagecallback(void *context, tangocameraid id, const tangoimagebuffer *buffer) {   memcpy(img_struct->image_buffer->getbuffer(), buffer->data, buffer->width * buffer->height * 3 * sizeof(uint8_t))); } 

where image_buffer java bytebuffer wrapping class using in c++, inside allocating memory calling new specified size (which in case same trying memcpy), , jobject reference doing env->newglobalref(env->newdirectbytebuffer(buffer, this->buffersize));, this->buffersize equals (buffer->width * buffer->height * 3 * sizeof(uint8_t))

i pretty sure allocating right amount of memory, have used memcopying xyzij buffer in other function (with correspondent size difference, floats) , works fine (yet have tried overallocating), know problem not destination being small.

in case information might add question, using regular color camera, height should 1280 , width 720 if recall correctly.

edit: upon manually looking maximum amount of data copy without getting segfault, seems tops on 1384448 (i.e. works, 1384449 segfaults), 1.5 times size in pixels of image, adding confusion.

the pixel format documented yv12 aka yuv420sp. has full resolution y 2x2 subsampling u , v, u , v both have 1/4 many samples y. total number of samples width*height*(1 + 1/4 + 1/4) = 1.5*width*height.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -