summaryrefslogtreecommitdiffstats
path: root/camera/BufferSourceAdapter.cpp
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2012-05-25 14:19:01 -0500
committerDaniel Levin <dendy@ti.com>2012-07-25 08:56:42 -0500
commit8a90521bbac21c9debdfb5ad3db0bf911ed9e462 (patch)
treea07731fc783849e94303e13261cbd88f6314bd50 /camera/BufferSourceAdapter.cpp
parent92efc66c83bf5aeec1cc42ad687d3e883b5a4c92 (diff)
downloadhardware_ti_omap4-8a90521bbac21c9debdfb5ad3db0bf911ed9e462.tar.gz
hardware_ti_omap4-8a90521bbac21c9debdfb5ad3db0bf911ed9e462.tar.bz2
hardware_ti_omap4-8a90521bbac21c9debdfb5ad3db0bf911ed9e462.zip
CameraHal: Add support for BAYER reprocessing
1. Add support for allocating bitstream buffers for bayer format through buffersourceadapter 2. Add support for setting up reprocessing port (video-in) in OMXCameraAdapter for bayer format Change-Id: I0d9c1d6ec4ca09b4f9d19b36321abef0495d7405 Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Diffstat (limited to 'camera/BufferSourceAdapter.cpp')
-rw-r--r--camera/BufferSourceAdapter.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/camera/BufferSourceAdapter.cpp b/camera/BufferSourceAdapter.cpp
index 384307a..9d51e0f 100644
--- a/camera/BufferSourceAdapter.cpp
+++ b/camera/BufferSourceAdapter.cpp
@@ -37,6 +37,8 @@ static int getANWFormat(const char* parameters_format)
CAMHAL_LOGDA("RGB565 format selected");
// TODO(XXX): not defined yet
format = -1;
+ } else if (strcmp(parameters_format, CameraParameters::PIXEL_FORMAT_BAYER_RGGB) == 0) {
+ format = HAL_PIXEL_FORMAT_TI_Y16;
} else {
CAMHAL_LOGDA("Invalid format, NV12 format selected as default");
format = HAL_PIXEL_FORMAT_TI_NV12;
@@ -57,6 +59,7 @@ static int getUsageFromANW(int format)
// buffers to come from system heap
usage |= GRALLOC_USAGE_PRIVATE_0;
break;
+ case HAL_PIXEL_FORMAT_TI_Y16:
default:
// No special flags needed
break;
@@ -70,6 +73,8 @@ static const char* getFormatFromANW(int format)
case HAL_PIXEL_FORMAT_TI_NV12:
// Assuming NV12 1D is RAW or Image frame
return CameraParameters::PIXEL_FORMAT_YUV420SP;
+ case HAL_PIXEL_FORMAT_TI_Y16:
+ return CameraParameters::PIXEL_FORMAT_BAYER_RGGB;
default:
break;
}
@@ -79,6 +84,7 @@ static const char* getFormatFromANW(int format)
static CameraFrame::FrameType formatToOutputFrameType(const char* format) {
switch (getANWFormat(format)) {
case HAL_PIXEL_FORMAT_TI_NV12:
+ case HAL_PIXEL_FORMAT_TI_Y16:
// Assuming NV12 1D is RAW or Image frame
return CameraFrame::RAW_FRAME;
default:
@@ -336,7 +342,7 @@ CameraBuffer* BufferSourceAdapter::allocateBufferList(int width, int height, con
// Set window geometry
err = mBufferSource->set_buffers_geometry(mBufferSource,
width, height,
- getANWFormat(format));
+ pixFormat);
if (err != 0) {
CAMHAL_LOGE("native_window_set_buffers_geometry failed: %s (%d)", strerror(-err), -err);
@@ -447,7 +453,7 @@ CameraBuffer* BufferSourceAdapter::getBufferList(int *num) {
LOG_FUNCTION_NAME;
status_t err;
const int lnumBufs = 1;
- int format;
+ int formatSource;
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
buffer_handle_t *handle;
@@ -476,7 +482,7 @@ CameraBuffer* BufferSourceAdapter::getBufferList(int *num) {
mFramesWithCameraAdapterMap.add(handle, 0);
err = mBufferSource->get_buffer_dimension(mBufferSource, &mBuffers[0].width, &mBuffers[0].height);
- err = mBufferSource->get_buffer_format(mBufferSource, &format);
+ err = mBufferSource->get_buffer_format(mBufferSource, &formatSource);
// lock buffer
{
@@ -488,7 +494,8 @@ CameraBuffer* BufferSourceAdapter::getBufferList(int *num) {
mFrameWidth = mBuffers[0].width;
mFrameHeight = mBuffers[0].height;
- mPixelFormat = getFormatFromANW(format);
+ mPixelFormat = getFormatFromANW(formatSource);
+
mBuffers[0].format = mPixelFormat;
mBufferSourceDirection = BUFFER_SOURCE_TAP_IN;