I copy the YV12 frame in the callback passed to TangoService_connectOnFrameAvailable() via:
uint8_t* dest_buffer = destination_tango_image->data;
int src_offset = buffer->stride;
int dest_offset = 0;
// copy Y channel
static const int height = buffer->height;
static const int width = buffer->width;
static const int stride = buffer->stride;
for(int i = 0; i < height; i++) {
memcpy(dest_buffer + dest_offset, buffer->data + src_offset, width);
src_offset += stride;
dest_offset += width;
}
// copy V channel
static const int half_width = width / 2;
static const int half_height = height / 2;
static const int half_stride = stride / 2;
for(int i = 0; i < half_height; i++) {
memcpy(dest_buffer + dest_offset, buffer->data + src_offset, half_width);
src_offset += half_stride;
dest_offset += half_width;
}
// copy U channel
for(int i = 0; i < half_height; i++) {
memcpy(dest_buffer + dest_offset, buffer->data + src_offset, half_width);
src_offset += half_stride;
dest_offset += half_width;
}
After doing this, I've tried displaying the YV12 image in vooya and also (following a previous answer here) displaying it after converting to RGBA. However, in both instances I see some artifacts in the top left and entire bottom of the image. Here is an example:
Is there a problem with how I'm copying the data? Or is this a problem with TangoService_connectOnFrameAvailable()? Or a problem with the tablet's camera?