diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2013-12-21 17:20:02 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2014-01-03 23:33:43 +0100 |
commit | 63f28807de5f73597605fc80a0fcddae23eca833 (patch) | |
tree | ffea5567aa7df7d6fe9b61316fff82729e092413 /libcamera | |
parent | eed98830cd4def768d1d06b8208ee2daf2a16064 (diff) | |
download | device_samsung_crespo-63f28807de5f73597605fc80a0fcddae23eca833.zip device_samsung_crespo-63f28807de5f73597605fc80a0fcddae23eca833.tar.gz device_samsung_crespo-63f28807de5f73597605fc80a0fcddae23eca833.tar.bz2 |
camera: RGB565 preview format
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'libcamera')
-rwxr-xr-x | libcamera/SecCameraHWInterface.cpp | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp index a1afb88..bb4fcbc 100755 --- a/libcamera/SecCameraHWInterface.cpp +++ b/libcamera/SecCameraHWInterface.cpp @@ -179,10 +179,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); @@ -405,7 +403,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); @@ -562,37 +560,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); } @@ -1574,8 +1543,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; } @@ -1583,7 +1551,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(¤t_preview_width, |