diff options
author | Zhijun He <zhijunhe@google.com> | 2014-07-01 04:15:09 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2014-07-07 08:01:06 -0700 |
commit | d1988a98ed69db8c33b77b5c085ab91d22ef3bbc (patch) | |
tree | 32ba532dc3781e7f647a01928dc32b4b2558f197 /media/jni/android_media_ImageReader.cpp | |
parent | 30d5195fc1bb6f13e1b294cc3cbec9ef5837ed8d (diff) | |
download | frameworks_base-d1988a98ed69db8c33b77b5c085ab91d22ef3bbc.zip frameworks_base-d1988a98ed69db8c33b77b5c085ab91d22ef3bbc.tar.gz frameworks_base-d1988a98ed69db8c33b77b5c085ab91d22ef3bbc.tar.bz2 |
Add RAW10 image format
- Add RAW10 format in ImageFormat
- Add ImageReader support for this format
Bug: 15989722
Change-Id: Ic38ae596d5a472e990389d1fa221a82bea97b715
Diffstat (limited to 'media/jni/android_media_ImageReader.cpp')
-rw-r--r-- | media/jni/android_media_ImageReader.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp index ad7ee7a..35317e1 100644 --- a/media/jni/android_media_ImageReader.cpp +++ b/media/jni/android_media_ImageReader.cpp @@ -267,7 +267,7 @@ static void Image_setBuffer(JNIEnv* env, jobject thiz, // graphics.h, need convert to the one defined in graphics.h here. static int Image_getPixelFormat(JNIEnv* env, int format) { - int jpegFormat, rawSensorFormat; + int jpegFormat; jfieldID fid; ALOGV("%s: format = 0x%x", __FUNCTION__, format); @@ -413,6 +413,16 @@ static void Image_getLockedBufferInfo(JNIEnv* env, CpuConsumer::LockedBuffer* bu pData = buffer->data; dataSize = buffer->stride * buffer->height * bytesPerPixel; break; + case HAL_PIXEL_FORMAT_RAW10: + // Single plane 10bpp bayer data. + ALOG_ASSERT(idx == 0, "Wrong index: %d", idx); + LOG_ALWAYS_FATAL_IF(buffer->width % 4, + "Width is not multiple of 4 %d", buffer->width); + LOG_ALWAYS_FATAL_IF(buffer->height % 2, + "Height is not even %d", buffer->height); + pData = buffer->data; + dataSize = buffer->width * buffer->height * 10 / 8; + break; case HAL_PIXEL_FORMAT_RGBA_8888: case HAL_PIXEL_FORMAT_RGBX_8888: // Single plane, 32bpp. @@ -470,7 +480,9 @@ static jint Image_imageGetPixelStride(JNIEnv* env, CpuConsumer::LockedBuffer* bu pixelStride = 1; break; case HAL_PIXEL_FORMAT_BLOB: - // Used for JPEG data, single plane, row and pixel strides are 0 + case HAL_PIXEL_FORMAT_RAW10: + // Blob is used for JPEG data, RAW10 is used for 10-bit raw data, they are + // single plane, row and pixel strides are 0. ALOG_ASSERT(idx == 0, "Wrong index: %d", idx); pixelStride = 0; break; @@ -523,7 +535,9 @@ static jint Image_imageGetRowStride(JNIEnv* env, CpuConsumer::LockedBuffer* buff rowStride = (idx == 0) ? buffer->stride : ALIGN(buffer->stride / 2, 16); break; case HAL_PIXEL_FORMAT_BLOB: - // Used for JPEG data, single plane, row and pixel strides are 0 + case HAL_PIXEL_FORMAT_RAW10: + // Blob is used for JPEG data, RAW10 is used for 10-bit raw data, they are + // single plane, row and pixel strides are 0. ALOG_ASSERT(idx == 0, "Wrong index: %d", idx); rowStride = 0; break; |