diff options
author | Shuzhen Wang <shuzhenwang@google.com> | 2019-01-24 16:32:31 -0800 |
---|---|---|
committer | Shuzhen Wang <shuzhenwang@google.com> | 2019-02-04 18:18:09 -0800 |
commit | f43b544c0e407234643304c7bfdf658333e3dfc5 (patch) | |
tree | 12b7f0c21004993cfffbe3c4273c3ba877fc9a55 | |
parent | 77972f7c488f7a2543e47e6db1f5477d044a043d (diff) | |
download | libhardware-f43b544c0e407234643304c7bfdf658333e3dfc5.tar.gz |
Camera: Add HEIC encoding support
- Add new BlobId to specify JPEG APP segments.
- Add new gralloc usage flag for HEIC encoder.
Test: testHeic CTS test
Bug: 79465976
Change-Id: Ie70654504eecb280e3a51b60c104124035c5fbe5
-rw-r--r-- | include/hardware/camera3.h | 31 | ||||
-rw-r--r-- | include/hardware/gralloc.h | 3 |
2 files changed, 23 insertions, 11 deletions
diff --git a/include/hardware/camera3.h b/include/hardware/camera3.h index 75efa28f..03db10cd 100644 --- a/include/hardware/camera3.h +++ b/include/hardware/camera3.h @@ -196,6 +196,10 @@ * stream_configuration_counter to camera3_stream_configuration_t to address the potential * race condition between signal_stream_flush() call and configure_streams() call. * + * - Add CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID to support BLOB with only JPEG apps + * segments and thumbnail (without main image bitstream). Camera framework + * uses such stream togerther with a HAL YUV_420_888/IMPLEMENTATION_DEFINED + * stream to encode HEIC (ISO/IEC 23008-12) image. */ /** @@ -1964,21 +1968,25 @@ typedef struct camera3_stream_buffer_set { /** * camera3_jpeg_blob: * - * Transport header for compressed JPEG buffers in output streams. + * Transport header for compressed JPEG or JPEG_APP_SEGMENTS buffers in output streams. * - * To capture JPEG images, a stream is created using the pixel format + * To capture JPEG or JPEG_APP_SEGMENTS images, a stream is created using the pixel format * HAL_PIXEL_FORMAT_BLOB. The buffer size for the stream is calculated by the - * framework, based on the static metadata field android.jpeg.maxSize. Since - * compressed JPEG images are of variable size, the HAL needs to include the - * final size of the compressed image using this structure inside the output - * stream buffer. The JPEG blob ID field must be set to CAMERA3_JPEG_BLOB_ID. + * framework, based on the static metadata field android.jpeg.maxSize for JPEG, + * and android.jpeg.maxAppsSegments for JPEG_APP_SEGMENTS. * - * Transport header should be at the end of the JPEG output stream buffer. That + * Since compressed JPEG/JPEG_APP_SEGMENTS images are of variable size, the HAL needs to + * include the final size of the image using this structure inside the output + * stream buffer. The JPEG blob ID field must be set to CAMERA3_JPEG_BLOB_ID for + * JPEG and CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID for APP segments. + * + * Transport header should be at the end of the output stream buffer. That * means the jpeg_blob_id must start at byte[buffer_size - * sizeof(camera3_jpeg_blob)], where the buffer_size is the size of gralloc buffer. - * Any HAL using this transport header must account for it in android.jpeg.maxSize - * The JPEG data itself starts at the beginning of the buffer and should be - * jpeg_size bytes long. + * The blob data itself starts at the beginning of the buffer and should be + * jpeg_size bytes long. HAL using this transport header for JPEG must account for + * it in android.jpeg.maxSize. For JPEG APP segments, camera framework makes + * sure that the output stream buffer is large enough for the transport header. */ typedef struct camera3_jpeg_blob { uint16_t jpeg_blob_id; @@ -1986,7 +1994,8 @@ typedef struct camera3_jpeg_blob { } camera3_jpeg_blob_t; enum { - CAMERA3_JPEG_BLOB_ID = 0x00FF + CAMERA3_JPEG_BLOB_ID = 0x00FF, + CAMERA3_JPEG_APP_SEGMENTS_BLOB_ID = 0x0100, }; /********************************************************************** diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h index 5dafea02..b4f7e5a4 100644 --- a/include/hardware/gralloc.h +++ b/include/hardware/gralloc.h @@ -131,6 +131,9 @@ enum { * handle this flag. */ GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000U, + /* buffer will be used as input to HW HEIC image encoder */ + GRALLOC_USAGE_HW_IMAGE_ENCODER = 0x08000000U, + /* Mask of all flags which could be passed to a gralloc module for buffer * allocation. Any flags not in this mask do not need to be handled by * gralloc modules. */ |