Hello, first of all thanks for the great project. The code works smooth on lots of devices but for some devices it encodes colors wrong. For example Xiaomi 9T.
I look your cpp code and i think there is a typo in line 103 i think it should be, because the Xiaomi 9T enters this block when i modified it.
bbuf_uIn == bbuf_vIn + 1 instead of 'bbuf_vIn == bbuf_uIn + 1'
and i read your comment and tried to modify the code block as follows. But it does not solve the problem.
} else if (vPixelStride == 2 && uPixelStride == 2 && uRowStride == vRowStride && bbuf_uIn == bbuf_vIn + 1) { isNV21 = false; // The cb/cr planes happened to be laid out in exact NV12 form // in memory; if the destination API can use NV12 in addition to // NV21 do something similar as above, but using cbPtr instead of crPtr. // If not, remove this clause and use the generic code below. for (int y = 0; y < (imgHeight + 1) / 2; y++) memcpy(chromaBuf + y * chromaBufStride, bbuf_uIn + y * uRowStride, static_cast<size_t>(chromaBufStride)); }
My preview is 640 * 480 and here is my values for Xiaomi 9T:
y pixelStride: 1
y rowStride: 1024
u pixelStride: 2
u rowStride: 1024
v pixelStride: 2
v pixelStride: 1024
colorFormat: 35
For other devices
y pixelStride: 1
y rowStride: 640
u pixelStride: 2
u rowStride: 640
v pixelStride: 2
v pixelStride: 640
colorFormat: 35
I think there is a padding and the u and v planes order is different for the Xiaomi 9T, i was before using this code to convert frames to bitmap, it works for bitmap but not for video recording i think it requires I420 encoding.
But now i need to create video from frames. Can you please help ?
Best Regards ...
Hello, first of all thanks for the great project. The code works smooth on lots of devices but for some devices it encodes colors wrong. For example Xiaomi 9T.
I look your cpp code and i think there is a typo in line 103 i think it should be, because the Xiaomi 9T enters this block when i modified it.
bbuf_uIn == bbuf_vIn + 1instead of 'bbuf_vIn == bbuf_uIn + 1'and i read your comment and tried to modify the code block as follows. But it does not solve the problem.
} else if (vPixelStride == 2 && uPixelStride == 2 && uRowStride == vRowStride && bbuf_uIn == bbuf_vIn + 1) { isNV21 = false; // The cb/cr planes happened to be laid out in exact NV12 form // in memory; if the destination API can use NV12 in addition to // NV21 do something similar as above, but using cbPtr instead of crPtr. // If not, remove this clause and use the generic code below. for (int y = 0; y < (imgHeight + 1) / 2; y++) memcpy(chromaBuf + y * chromaBufStride, bbuf_uIn + y * uRowStride, static_cast<size_t>(chromaBufStride)); }My preview is 640 * 480 and here is my values for Xiaomi 9T:
y pixelStride: 1
y rowStride: 1024
u pixelStride: 2
u rowStride: 1024
v pixelStride: 2
v pixelStride: 1024
colorFormat: 35
For other devices
y pixelStride: 1
y rowStride: 640
u pixelStride: 2
u rowStride: 640
v pixelStride: 2
v pixelStride: 640
colorFormat: 35
I think there is a padding and the u and v planes order is different for the Xiaomi 9T, i was before using this code to convert frames to bitmap, it works for bitmap but not for video recording i think it requires I420 encoding.
But now i need to create video from frames. Can you please help ?
Best Regards ...