Permalink
Browse files

Optimization for camera viewfinder(no software color conversions)

  • Loading branch information...
1 parent 3467b74 commit 56b6f6d456b022686d8a081977f57ff43e4caa05 @Ganster41 committed Nov 1, 2012
Showing with 6 additions and 35 deletions.
  1. +6 −35 libcamera/cameraHal.cpp
View
@@ -220,11 +220,6 @@ CameraHAL_HandlePreviewData(const android::sp<android::IMemory>& dataPtr,
ssize_t offset;
size_t size;
int32_t previewFormat = MDP_Y_CBCR_H2V2;
-#ifdef HWA
- int32_t destFormat = MDP_RGBX_8888;
-#else
- int32_t destFormat = MDP_RGBA_8888;
-#endif
android::status_t retVal;
android::sp<android::IMemoryHeap> mHeap = dataPtr->getMemory(&offset,
@@ -241,11 +236,7 @@ CameraHAL_HandlePreviewData(const android::sp<android::IMemory>& dataPtr,
GRALLOC_USAGE_SW_READ_OFTEN);
retVal = mWindow->set_buffers_geometry(mWindow,
previewWidth, previewHeight,
-#ifdef HWA
- HAL_PIXEL_FORMAT_RGBX_8888
-#else
- HAL_PIXEL_FORMAT_RGBA_8888
-#endif
+ HAL_PIXEL_FORMAT_YCrCb_420_SP
);
if (retVal == NO_ERROR) {
int32_t stride;
@@ -256,33 +247,13 @@ CameraHAL_HandlePreviewData(const android::sp<android::IMemory>& dataPtr,
if (retVal == NO_ERROR) {
retVal = mWindow->lock_buffer(mWindow, bufHandle);
if (retVal == NO_ERROR) {
- private_handle_t const *privHandle =
- reinterpret_cast<private_handle_t const *>(*bufHandle);
- if (!CameraHAL_CopyBuffers_Hw(mHeap->getHeapID(), privHandle->fd,
+ private_handle_t const *privHandle =
+ reinterpret_cast<private_handle_t const *>(*bufHandle);
+ CameraHAL_CopyBuffers_Hw(mHeap->getHeapID(), privHandle->fd,
offset, privHandle->offset,
- previewFormat, destFormat,
+ previewFormat, previewFormat,
0, 0, previewWidth,
- previewHeight)) {
- void *bits;
- android::Rect bounds;
- android::GraphicBufferMapper &mapper =
- android::GraphicBufferMapper::get();
-
- bounds.left = 0;
- bounds.top = 0;
- bounds.right = previewWidth;
- bounds.bottom = previewHeight;
-
- mapper.lock(*bufHandle, GRALLOC_USAGE_SW_READ_OFTEN, bounds,
- &bits);
- LOGV("CameraHAL_HPD: w:%d h:%d bits:%p",
- previewWidth, previewHeight, bits);
- CameraHal_Decode_Sw((unsigned int *)bits, (char *)mHeap->base() + offset,
- previewWidth, previewHeight);
-
- // unlock buffer before sending to display
- mapper.unlock(*bufHandle);
- }
+ previewHeight);
mWindow->enqueue_buffer(mWindow, bufHandle);
LOGV("CameraHAL_HandlePreviewData: enqueued buffer\n");

0 comments on commit 56b6f6d

Please sign in to comment.