summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-12-23 22:23:50 +0100
committerPaul Kocialkowski <contact@paulk.fr>2014-01-03 23:31:50 +0100
commitfe7cc6059dc206cab46715847e6d5bc5cfdb1c59 (patch)
treec6b4b435140294282816c7aad3b8bd795868161a
parent6b01bcce3fff53b3a7b5e4ab7cc37fb1b65c6231 (diff)
downloaddevice_samsung_aries-common-fe7cc6059dc206cab46715847e6d5bc5cfdb1c59.zip
device_samsung_aries-common-fe7cc6059dc206cab46715847e6d5bc5cfdb1c59.tar.gz
device_samsung_aries-common-fe7cc6059dc206cab46715847e6d5bc5cfdb1c59.tar.bz2
camera: RGB565 preview format
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rwxr-xr-xlibcamera/SecCameraHWInterface.cpp46
1 files changed, 7 insertions, 39 deletions
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index 8f24990..c34b94c 100755
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -183,10 +183,8 @@ void CameraHardwareSec::initDefaultParameters(int cameraId)
ALOGE("getSnapshotMaxSize fail (%d / %d) \n",
snapshot_max_width, snapshot_max_height);
String8 previewColorString;
- previewColorString = CameraParameters::PIXEL_FORMAT_YUV420SP;
- previewColorString.append(",");
- previewColorString.append(CameraParameters::PIXEL_FORMAT_YUV420P);
- p.setPreviewFormat(CameraParameters::PIXEL_FORMAT_YUV420SP);
+ previewColorString = CameraParameters::PIXEL_FORMAT_RGB565;
+ p.setPreviewFormat(CameraParameters::PIXEL_FORMAT_RGB565);
p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS, previewColorString.string());
p.set(CameraParameters::KEY_VIDEO_FRAME_FORMAT, CameraParameters::PIXEL_FORMAT_YUV420P);
p.setPreviewSize(preview_max_width, preview_max_height);
@@ -422,7 +420,7 @@ status_t CameraHardwareSec::setPreviewWindow(preview_stream_ops *w)
int preview_width;
int preview_height;
mParameters.getPreviewSize(&preview_width, &preview_height);
- int hal_pixel_format = HAL_PIXEL_FORMAT_YV12;
+ int hal_pixel_format = HAL_PIXEL_FORMAT_RGB_565;
const char *str_preview_format = mParameters.getPreviewFormat();
ALOGV("%s: preview format %s", __func__, str_preview_format);
@@ -579,37 +577,8 @@ int CameraHardwareSec::previewThread()
0, 0, width, height, &vaddr)) {
char *frame = ((char *)mPreviewHeap->data) + offset;
- // the code below assumes YUV, not RGB
- {
- int h;
- char *src = frame;
- char *ptr = (char *)vaddr;
-
- // Copy the Y plane, while observing the stride
- for (h = 0; h < height; h++) {
- memcpy(ptr, src, width);
- ptr += stride;
- src += width;
- }
-
- {
- // U
- char *v = ptr;
- ptr += stride * height / 4;
- for (h = 0; h < height / 2; h++) {
- memcpy(ptr, src, width / 2);
- ptr += stride / 2;
- src += width / 2;
- }
- // V
- ptr = v;
- for (h = 0; h < height / 2; h++) {
- memcpy(ptr, src, width / 2);
- ptr += stride / 2;
- src += width / 2;
- }
- }
- }
+ // Copy RGB565 frame
+ memcpy(vaddr, frame, width * height * 2);
mGrallocHal->unlock(mGrallocHal, *buf_handle);
}
@@ -1393,8 +1362,7 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
ALOGV("%s : new_preview_width x new_preview_height = %dx%d, format = %s",
__func__, new_preview_width, new_preview_height, new_str_preview_format);
- if (strcmp(new_str_preview_format, CameraParameters::PIXEL_FORMAT_YUV420SP) &&
- strcmp(new_str_preview_format, CameraParameters::PIXEL_FORMAT_YUV420P)) {
+ if (strcmp(new_str_preview_format, CameraParameters::PIXEL_FORMAT_RGB565)) {
ALOGE("Unsupported preview color format: %s", new_str_preview_format);
return BAD_VALUE;
}
@@ -1402,7 +1370,7 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
if (0 < new_preview_width && 0 < new_preview_height &&
new_str_preview_format != NULL &&
isSupportedPreviewSize(new_preview_width, new_preview_height)) {
- int new_preview_format = V4L2_PIX_FMT_YUV420;
+ int new_preview_format = V4L2_PIX_FMT_RGB565;
int current_preview_width, current_preview_height, current_frame_size;
mSecCamera->getPreviewSize(&current_preview_width,