diff options
author | Alex Ray <aray@google.com> | 2013-03-19 01:41:32 -0700 |
---|---|---|
committer | Alex Ray <aray@google.com> | 2013-04-09 15:09:35 -0700 |
commit | e13f15ab55d957976bc66f314c3f58090e903207 (patch) | |
tree | a86c91101ac17ee1ef553c4000ab0a85ebb0f2a5 /include | |
parent | 7716aef138e8029357a7b3dc6a73b41f4de4b0ad (diff) | |
download | system_core-e13f15ab55d957976bc66f314c3f58090e903207.zip system_core-e13f15ab55d957976bc66f314c3f58090e903207.tar.gz system_core-e13f15ab55d957976bc66f314c3f58090e903207.tar.bz2 |
graphics: add Android flexible YCbCr format
Change-Id: I3f6676873febc793f7a4a5e06892cd9fadb35665
Diffstat (limited to 'include')
-rw-r--r-- | include/system/graphics.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/include/system/graphics.h b/include/system/graphics.h index ab064db..ed493f5 100644 --- a/include/system/graphics.h +++ b/include/system/graphics.h @@ -17,6 +17,8 @@ #ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H #define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H +#include <stdint.h> + #ifdef __cplusplus extern "C" { #endif @@ -188,12 +190,64 @@ enum { */ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22, + /* + * Android flexible YCbCr formats + * + * This format allows platforms to use an efficient YCbCr/YCrCb buffer + * layout, while still describing the buffer layout in a way accessible to + * the CPU in a device-independent manner. While called YCbCr, it can be + * used to describe formats with either chromatic ordering, as well as + * whole planar or semiplanar layouts. + * + * struct android_ycbcr (below) is the the struct used to describe it. + * + * This format must be accepted by the gralloc module when + * USAGE_HW_CAMERA_WRITE and USAGE_SW_READ_* are set. + * + * This format is locked for use by gralloc's (*lock_ycbcr) method, and + * locking with the (*lock) method will return an error. + */ + HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, + /* Legacy formats (deprecated), used by ImageFormat.java */ HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 }; +/* + * Structure for describing YCbCr formats for consumption by applications. + * This is used with HAL_PIXEL_FORMAT_YCbCr_*_888. + * + * 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. + * + * @y, @cb, and @cr point to the first byte of their respective planes. + * + * Stride describes the distance in bytes from the first value of one row of + * the image to the first value of the next row. It includes the width of the + * image plus padding. + * @ystride is the stride of the luma plane. + * @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. + */ + +struct android_ycbcr { + void *y; + void *cb; + void *cr; + size_t ystride; + size_t cstride; + size_t chroma_step; + + /** reserved for future use, set to 0 by gralloc's (*lock_ycbcr)() */ + uint32_t reserved[8]; +}; /** * Transformation definitions |