Skip to content
Snippets Groups Projects
Commit 76835be6 authored by Roman Kiryanov's avatar Roman Kiryanov
Browse files

Mark YUV camera buffers as interleaved


HAL_PIXEL_FORMAT_YCbCr_420_888 does not specify the exact
buffer layout. EmulatedFakeCamera3.cpp uses interleaved
UV planes, while other places place them separately.

Bug: 130295800
Bug: 129974968
Test: run cts -m CtsCameraTestCases \
      -t android.hardware.camera2.cts.ImageReaderTest#teutYUVResolutions
Merged-In: If3a495aa794d9ab09288b7b92be7258a07cc077d
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
Change-Id: I33f6777b5cca6f4fa0c61ac3db994230d6b6efb0
parent 3624615b
Branches
No related tags found
No related merge requests found
......@@ -31,7 +31,8 @@
enum EmulatorFrameworkFormat {
FRAMEWORK_FORMAT_GL_COMPATIBLE = 0,
FRAMEWORK_FORMAT_YV12 = 1,
FRAMEWORK_FORMAT_YUV_420_888 = 2,
FRAMEWORK_FORMAT_YUV_420_888 = 2, // (Y+)(U+)(V+)
FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED = 3, // (Y+)(UV)+
};
//
......
......@@ -622,7 +622,13 @@ static int gralloc_alloc(alloc_device_t* dev,
// We are going to use RGB888 on the host
glFormat = GL_RGB;
glType = GL_UNSIGNED_BYTE;
if (usage & (GRALLOC_USAGE_HW_CAMERA_READ | GRALLOC_USAGE_HW_CAMERA_WRITE)) {
// EmulatedFakeCamera3.cpp assumes it is NV21
selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED;
} else {
selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888;
}
break;
default:
ALOGE("gralloc_alloc: Unknown format %d", format);
......@@ -1360,12 +1366,21 @@ static int gralloc_lock_ycbcr(gralloc_module_t const* module,
cStep = 1;
break;
case HAL_PIXEL_FORMAT_YCbCr_420_888:
if (cb->emuFrameworkFormat == FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED) {
yStride = cb->width;
cStride = cb->width;
yOffset = 0;
vOffset = yStride * cb->height;
uOffset = vOffset + 1;
cStep = 2;
} else {
yStride = cb->width;
cStride = yStride / 2;
yOffset = 0;
uOffset = cb->height * yStride;
vOffset = uOffset + cStride * cb->height / 2;
cStep = 1;
}
break;
default:
ALOGE("gralloc_lock_ycbcr unexpected internal format %x",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment