summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
authorJeong-Seok Yang <jseok.yang@samsung.com>2010-10-22 15:32:33 -0700
committerSimon Wilson <simonwilson@google.com>2010-10-24 17:00:05 -0700
commit8db623bddf9e6daa8e687f9f4c175603a81426dc (patch)
treea92cb0487f915a2d89f62283df62948ed25017d9 /libcamera
parentf2130bc090352d31627c6b141a574b303cfb02fe (diff)
downloaddevice_samsung_crespo-8db623bddf9e6daa8e687f9f4c175603a81426dc.zip
device_samsung_crespo-8db623bddf9e6daa8e687f9f4c175603a81426dc.tar.gz
device_samsung_crespo-8db623bddf9e6daa8e687f9f4c175603a81426dc.tar.bz2
libcamera: Add EXIF thumbnail on capturing image of front camera
Add thumbnail image in EXIF on capturing image of front camera Change-Id: I4f6f4eca5c29f397f793ea6a802997a2d2c65dc7 Signed-off-by: Jeong-Seok Yang <jseok.yang@samsung.com>
Diffstat (limited to 'libcamera')
-rw-r--r--libcamera/SecCamera.cpp14
-rw-r--r--libcamera/SecCamera.h8
-rw-r--r--libcamera/SecCameraHWInterface.cpp35
3 files changed, 35 insertions, 22 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index d235f06..c394ecb 100644
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -1560,9 +1560,17 @@ void SecCamera::getPostViewConfig(int *width, int *height, int *size)
void SecCamera::getThumbnailConfig(int *width, int *height, int *size)
{
- *width = BACK_CAMERA_THUMBNAIL_WIDTH;
- *height = BACK_CAMERA_THUMBNAIL_HEIGHT;
- *size = BACK_CAMERA_THUMBNAIL_WIDTH * BACK_CAMERA_THUMBNAIL_HEIGHT * BACK_CAMERA_THUMBNAIL_BPP / 8;
+ if (m_camera_id == CAMERA_ID_BACK) {
+ *width = BACK_CAMERA_THUMBNAIL_WIDTH;
+ *height = BACK_CAMERA_THUMBNAIL_HEIGHT;
+ *size = BACK_CAMERA_THUMBNAIL_WIDTH * BACK_CAMERA_THUMBNAIL_HEIGHT
+ * BACK_CAMERA_THUMBNAIL_BPP / 8;
+ } else {
+ *width = FRONT_CAMERA_THUMBNAIL_WIDTH;
+ *height = FRONT_CAMERA_THUMBNAIL_HEIGHT;
+ *size = FRONT_CAMERA_THUMBNAIL_WIDTH * FRONT_CAMERA_THUMBNAIL_HEIGHT
+ * FRONT_CAMERA_THUMBNAIL_BPP / 8;
+ }
}
#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
diff --git a/libcamera/SecCamera.h b/libcamera/SecCamera.h
index cdfd102..30cad23 100644
--- a/libcamera/SecCamera.h
+++ b/libcamera/SecCamera.h
@@ -120,6 +120,10 @@ namespace android {
#define VGA_SNAPSHOT_WIDTH 640
#define VGA_SNAPSHOT_HEIGHT 480
+#define VGA_THUMBNAIL_WIDTH 160
+#define VGA_THUMBNAIL_HEIGHT 120
+#define VGA_THUMBNAIL_BPP 16
+
#define MAX_BACK_CAMERA_PREVIEW_WIDTH JOIN(BACK_CAM,_PREVIEW_WIDTH)
#define MAX_BACK_CAMERA_PREVIEW_HEIGHT JOIN(BACK_CAM,_PREVIEW_HEIGHT)
#define MAX_BACK_CAMERA_SNAPSHOT_WIDTH JOIN(BACK_CAM,_SNAPSHOT_WIDTH)
@@ -137,6 +141,10 @@ namespace android {
#define MAX_FRONT_CAMERA_SNAPSHOT_WIDTH JOIN(FRONT_CAM,_SNAPSHOT_WIDTH)
#define MAX_FRONT_CAMERA_SNAPSHOT_HEIGHT JOIN(FRONT_CAM,_SNAPSHOT_HEIGHT)
+#define FRONT_CAMERA_THUMBNAIL_WIDTH JOIN(FRONT_CAM,_THUMBNAIL_WIDTH)
+#define FRONT_CAMERA_THUMBNAIL_HEIGHT JOIN(FRONT_CAM,_THUMBNAIL_HEIGHT)
+#define FRONT_CAMERA_THUMBNAIL_BPP JOIN(FRONT_CAM,_THUMBNAIL_BPP)
+
#define DEFAULT_JPEG_THUMBNAIL_WIDTH 256
#define DEFAULT_JPEG_THUMBNAIL_HEIGHT 192
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index f5e79a4..eccc881 100644
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -1122,9 +1122,11 @@ int CameraHardwareSec::pictureThread()
&JpegImageSize, JpegHeap->base(), PostviewHeap->base());
}
- scaleDownYuv422((char *)PostviewHeap->base(), mPostViewWidth, mPostViewHeight,
- (char *)ThumbnailHeap->base(), mThumbWidth, mThumbHeight);
+ } else {
+ JpegImageSize = static_cast<int>(output_size);
}
+ scaleDownYuv422((char *)PostviewHeap->base(), mPostViewWidth, mPostViewHeight,
+ (char *)ThumbnailHeap->base(), mThumbWidth, mThumbHeight);
#ifdef POSTVIEW_CALLBACK
sp<MemoryBase> postview = new MemoryBase(PostviewHeap, 0, postviewHeapSize);
@@ -1187,28 +1189,23 @@ PostviewOverlayEnd:
}
#endif
if (mMsgEnabled & CAMERA_MSG_COMPRESSED_IMAGE) {
- if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK) {
- sp<MemoryHeapBase> ExifHeap = new MemoryHeapBase(EXIF_FILE_SIZE + JPG_STREAM_BUF_SIZE);
- JpegExifSize = mSecCamera->getExif((unsigned char *)ExifHeap->base(),
- (unsigned char *)ThumbnailHeap->base());
+ sp<MemoryHeapBase> ExifHeap = new MemoryHeapBase(EXIF_FILE_SIZE + JPG_STREAM_BUF_SIZE);
+ JpegExifSize = mSecCamera->getExif((unsigned char *)ExifHeap->base(),
+ (unsigned char *)ThumbnailHeap->base());
- LOGE("JpegExifSize=%d", JpegExifSize);
+ LOGV("JpegExifSize=%d", JpegExifSize);
- if (JpegExifSize < 0)
- return UNKNOWN_ERROR;
+ if (JpegExifSize < 0)
+ return UNKNOWN_ERROR;
- unsigned char *ExifStart = (unsigned char *)JpegHeap->base() + 2;
- unsigned char *ImageStart = ExifStart + JpegExifSize;
+ unsigned char *ExifStart = (unsigned char *)JpegHeap->base() + 2;
+ unsigned char *ImageStart = ExifStart + JpegExifSize;
- memmove(ImageStart, ExifStart, JpegImageSize - 2);
- memcpy(ExifStart, ExifHeap->base(), JpegExifSize);
- sp<MemoryBase> mem = new MemoryBase(JpegHeap, 0, JpegImageSize + JpegExifSize);
+ memmove(ImageStart, ExifStart, JpegImageSize - 2);
+ memcpy(ExifStart, ExifHeap->base(), JpegExifSize);
+ sp<MemoryBase> mem = new MemoryBase(JpegHeap, 0, JpegImageSize + JpegExifSize);
- mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);
- } else {
- sp<MemoryBase> mem = new MemoryBase(JpegHeap , 0, output_size);
- mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);
- }
+ mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);
}
LOG_TIME_END(0)