From 7cca8a0deedaaba4121830e8c0152be9b0a07552 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Thu, 17 Feb 2022 10:30:38 -0800 Subject: [PATCH] Relax requirements on android_ycbcr to allow P010 The existing comments on android_ycbcr only allowed for formats with 8 bit channels. The P010 format has 10 bits of data packed into 16 bit channels with 6 unused bits. Bug: b/216638710 Test: none, just comment change Change-Id: I57d5825a87f0c3dbf4a47b3f88ac1f9e65ad97fe --- libsystem/include/system/graphics.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libsystem/include/system/graphics.h b/libsystem/include/system/graphics.h index 1b6060a4e..a3c23b20c 100644 --- a/libsystem/include/system/graphics.h +++ b/libsystem/include/system/graphics.h @@ -59,12 +59,14 @@ typedef android_hdr_t android_hdr; /* * Structure for describing YCbCr formats for consumption by applications. - * This is used with HAL_PIXEL_FORMAT_YCbCr_*_888. + * This is used with HAL_PIXEL_FORMAT_YCbCr_*. * * Buffer chroma subsampling is defined in the format. * e.g. HAL_PIXEL_FORMAT_YCbCr_420_888 has subsampling 4:2:0. * - * Buffers must have a 8 bit depth. + * Buffers must have a byte aligned channel depth or a byte aligned packed + * channel depth (e.g. 10 bits packed into 16 bits for + * HAL_PIXEL_FORMAT_YCbCr_P010). * * y, cb, and cr point to the first byte of their respective planes. * @@ -75,8 +77,8 @@ typedef android_hdr_t android_hdr; * cstride is the stride of the chroma planes. * * chroma_step is the distance in bytes from one chroma pixel value to the - * next. This is 2 bytes for semiplanar (because chroma values are interleaved - * and each chroma value is one byte) and 1 for planar. + * next. This is `2 * channel depth` bytes for semiplanar (because chroma + * values are interleaved) and `1 * channel depth` bytes for planar. */ struct android_ycbcr {