summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Petrov <vppetrov@mm-sol.com>2012-06-19 20:17:42 +0300
committerDaniel Levin <dendy@ti.com>2012-07-25 08:56:45 -0500
commitdb88cac676bac547aaa72a5eb76ebd51fd29df9f (patch)
tree7b7250d1b05bcc3df9b4562474d02aadfa7792b4
parentda7665237a6e1bcb1d3b0e3736f2931733c55b82 (diff)
downloadhardware_ti_omap4-db88cac676bac547aaa72a5eb76ebd51fd29df9f.zip
hardware_ti_omap4-db88cac676bac547aaa72a5eb76ebd51fd29df9f.tar.gz
hardware_ti_omap4-db88cac676bac547aaa72a5eb76ebd51fd29df9f.tar.bz2
CameraHAL: Use capture data from CameraAdapter
1. Change getPictureBufferSize call to give back more data about the capture buffer that we need to allocate. 2. Use the data from getPictureBufferSize to allocate the buffer. Change-Id: I23bac42eedb9b6852eca24c207c474f3dbecced1 Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
-rw-r--r--camera/BaseCameraAdapter.cpp4
-rw-r--r--camera/CameraHal.cpp5
-rw-r--r--camera/OMXCameraAdapter/OMXCapture.cpp12
-rw-r--r--camera/V4LCameraAdapter/V4LCameraAdapter.cpp15
-rw-r--r--camera/inc/BaseCameraAdapter.h2
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h2
-rw-r--r--camera/inc/V4LCameraAdapter/V4LCameraAdapter.h2
7 files changed, 25 insertions, 17 deletions
diff --git a/camera/BaseCameraAdapter.cpp b/camera/BaseCameraAdapter.cpp
index 4a5b987..ad3ea38 100644
--- a/camera/BaseCameraAdapter.cpp
+++ b/camera/BaseCameraAdapter.cpp
@@ -1002,7 +1002,7 @@ status_t BaseCameraAdapter::sendCommand(CameraCommands operation, int value1, in
if ( NULL != frame )
{
- ret = getPictureBufferSize(frame->mLength, value2);
+ ret = getPictureBufferSize(*frame, value2);
}
else
{
@@ -1807,7 +1807,7 @@ status_t BaseCameraAdapter::getFrameDataSize(size_t &dataFrameSize, size_t buffe
return ret;
}
-status_t BaseCameraAdapter::getPictureBufferSize(size_t &length, size_t bufferCount)
+status_t BaseCameraAdapter::getPictureBufferSize(CameraFrame &frame, size_t bufferCount)
{
status_t ret = NO_ERROR;
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index 68c0493..b62f756 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -3042,10 +3042,7 @@ status_t CameraHal::__takePicture(const char *params)
if ( NO_ERROR == ret )
{
- mParameters.getPictureSize(( int * ) &frame.mWidth,
- ( int * ) &frame.mHeight);
-
- ret = allocImageBufs(frame.mWidth,
+ ret = allocImageBufs(frame.mAlignment,
frame.mHeight,
frame.mLength,
mParameters.getPictureFormat(),
diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp
index 3f3e39e..56f3fa3 100644
--- a/camera/OMXCameraAdapter/OMXCapture.cpp
+++ b/camera/OMXCameraAdapter/OMXCapture.cpp
@@ -363,7 +363,7 @@ status_t OMXCameraAdapter::setParametersCapture(const CameraParameters &params,
return ret;
}
-status_t OMXCameraAdapter::getPictureBufferSize(size_t &length, size_t bufferCount)
+status_t OMXCameraAdapter::getPictureBufferSize(CameraFrame &frame, size_t bufferCount)
{
status_t ret = NO_ERROR;
OMXCameraPortParameters *imgCaptureData = NULL;
@@ -385,17 +385,19 @@ status_t OMXCameraAdapter::getPictureBufferSize(size_t &length, size_t bufferCou
if ( ret == NO_ERROR )
{
- length = imgCaptureData->mBufSize;
+ frame.mLength = imgCaptureData->mBufSize;
+ frame.mWidth = imgCaptureData->mWidth;
+ frame.mHeight = imgCaptureData->mHeight;
+ frame.mAlignment = imgCaptureData->mStride;
+ CAMHAL_LOGDB("getPictureBufferSize: width:%u height:%u alignment:%u length:%u",
+ frame->mWidth, frame->mHeight, frame->mAlignment, frame->mLength);
}
else
{
CAMHAL_LOGEB("setFormat() failed 0x%x", ret);
- length = 0;
}
}
- CAMHAL_LOGDB("getPictureBufferSize %d", length);
-
LOG_FUNCTION_NAME_EXIT;
return ret;
diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
index df82d89..1cbc40d 100644
--- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -798,17 +798,26 @@ status_t V4LCameraAdapter::getFrameDataSize(size_t &dataFrameSize, size_t buffer
return NO_ERROR;
}
-status_t V4LCameraAdapter::getPictureBufferSize(size_t &length, size_t bufferCount)
+status_t V4LCameraAdapter::getPictureBufferSize(CameraFrame *frame, size_t bufferCount)
{
int width = 0;
int height = 0;
int bytesPerPixel = 2; // for YUV422i; default pixel format
LOG_FUNCTION_NAME;
+
+ if (frame == NULL) {
+ return BAD_VALUE;
+ }
+
mParams.getPictureSize( &width, &height );
- length = width * height * bytesPerPixel;
+ frame->mLength = width * height * bytesPerPixel;
+ frame->mWidth = width;
+ frame->mHeight = height;
+ frame->mAlignment = width * bytesPerPixel;
- CAMHAL_LOGDB("Picture size: W x H = %d x %d (size=%d bytes)",width, height, length);
+ CAMHAL_LOGDB("Picture size: W x H = %u x %u (size=%u bytes, alignment=%u bytes)",
+ frame->mWidth, frame->mHeight, frame->mLength, frame->mAlignment);
LOG_FUNCTION_NAME_EXIT;
return NO_ERROR;
}
diff --git a/camera/inc/BaseCameraAdapter.h b/camera/inc/BaseCameraAdapter.h
index c955c90..90c7304 100644
--- a/camera/inc/BaseCameraAdapter.h
+++ b/camera/inc/BaseCameraAdapter.h
@@ -138,7 +138,7 @@ protected:
virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
//API to get required picture buffers size with the current configuration in CameraParameters
- virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
+ virtual status_t getPictureBufferSize(CameraFrame &frame, size_t bufferCount);
// Should be implemented by deriving classes in order to start face detection
// ( if supported )
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index a09b008..07baf16 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -447,7 +447,7 @@ protected:
virtual status_t useBuffers(CameraMode mode, CameraBuffer * bufArr, int num, size_t length, unsigned int queueable);
virtual status_t fillThisBuffer(CameraBuffer * frameBuf, CameraFrame::FrameType frameType);
virtual status_t getFrameSize(size_t &width, size_t &height);
- virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
+ virtual status_t getPictureBufferSize(CameraFrame &frame, size_t bufferCount);
virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
virtual status_t startFaceDetection();
virtual status_t stopFaceDetection();
diff --git a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
index c9a7446..3c26bfd 100644
--- a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
+++ b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
@@ -126,7 +126,7 @@ protected:
virtual status_t useBuffers(CameraMode mode, CameraBuffer *bufArr, int num, size_t length, unsigned int queueable);
virtual status_t fillThisBuffer(CameraBuffer *frameBuf, CameraFrame::FrameType frameType);
virtual status_t getFrameSize(size_t &width, size_t &height);
- virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
+ virtual status_t getPictureBufferSize(CameraFrame *frame, size_t bufferCount);
virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
virtual void onOrientationEvent(uint32_t orientation, uint32_t tilt);
//-----------------------------------------------------------------------------