diff options
author | Emilian Peev <epeev@mm-sol.com> | 2012-07-26 12:23:09 +0300 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:09:17 +0200 |
commit | 768f0facca72fc96dcc15ba2a914acecf2dd51f0 (patch) | |
tree | 34179306189b68690a526ea448b77c03299387f7 | |
parent | 8dbacd8e4529b3eebbb28726e50861b268f6a392 (diff) | |
download | hardware_ti_omap4-768f0facca72fc96dcc15ba2a914acecf2dd51f0.zip hardware_ti_omap4-768f0facca72fc96dcc15ba2a914acecf2dd51f0.tar.gz hardware_ti_omap4-768f0facca72fc96dcc15ba2a914acecf2dd51f0.tar.bz2 |
CameraHal: Add support for reprocessing with buffer borders
- The header of the processed buffer should be
set correctly in order for the camera component
to properly match the start of the valid data.
Depends on frameworks/av change I788dd738:
http://review.omapzoom.org/#/c/29677/
Depends on hardware/libhardware change Ie37ab311:
http://review.omapzoom.org/#/c/29676/
Change-Id: I003b7cfae41ddf6bb46661e0803a4fb1b60a99e6
Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
-rw-r--r-- | camera/BufferSourceAdapter.cpp | 6 | ||||
-rw-r--r-- | camera/CameraHal.cpp | 12 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXReprocess.cpp | 8 | ||||
-rw-r--r-- | camera/inc/CameraHal.h | 3 |
4 files changed, 27 insertions, 2 deletions
diff --git a/camera/BufferSourceAdapter.cpp b/camera/BufferSourceAdapter.cpp index 67fb339..a595b4b 100644 --- a/camera/BufferSourceAdapter.cpp +++ b/camera/BufferSourceAdapter.cpp @@ -653,6 +653,10 @@ CameraBuffer* BufferSourceAdapter::getBufferList(int *num) { err = extendedOps()->get_buffer_dimension(mBufferSource, &mBuffers[0].width, &mBuffers[0].height); err = extendedOps()->get_buffer_format(mBufferSource, &formatSource); + int t, l, r, b, w, h; + err = extendedOps()->get_crop(mBufferSource, &l, &t, &r, &b); + err = extendedOps()->get_current_size(mBufferSource, &w, &h); + // lock buffer { void *y_uv[2]; @@ -666,6 +670,8 @@ CameraBuffer* BufferSourceAdapter::getBufferList(int *num) { mPixelFormat = getFormatFromANW(formatSource); mBuffers[0].format = mPixelFormat; + mBuffers[0].actual_size = CameraHal::calculateBufferSize(mPixelFormat, w, h); + mBuffers[0].offset = t * w + l * CameraHal::getBPP(mPixelFormat); mBufferSourceDirection = BUFFER_SOURCE_TAP_IN; return mBuffers; diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 0be515a..53f4963 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -91,6 +91,16 @@ static int dummy_get_id(preview_stream_ops_t*, char *data, unsigned int dataSize static int dummy_get_buffer_count(preview_stream_ops_t*, int *count) { return INVALID_OPERATION; } + +static int dummy_get_crop(preview_stream_ops_t*, + int *, int *, int *, int *) { + return INVALID_OPERATION; +} + +static int dummy_get_current_size(preview_stream_ops_t*, + int *, int *) { + return INVALID_OPERATION; +} #endif #ifdef OMAP_ENHANCEMENT @@ -102,6 +112,8 @@ static preview_stream_extended_ops_t dummyPreviewStreamExtendedOps = { dummy_set_metadata, dummy_get_id, dummy_get_buffer_count, + dummy_get_crop, + dummy_get_current_size, #endif }; #endif diff --git a/camera/OMXCameraAdapter/OMXReprocess.cpp b/camera/OMXCameraAdapter/OMXReprocess.cpp index c720c2b..9057c1c 100644 --- a/camera/OMXCameraAdapter/OMXReprocess.cpp +++ b/camera/OMXCameraAdapter/OMXReprocess.cpp @@ -109,8 +109,10 @@ status_t OMXCameraAdapter::startReprocess() android::AutoMutex lock(mBurstLock); for ( int index = 0 ; index < portData->mMaxQueueable ; index++ ) { - CAMHAL_LOGDB("Queuing buffer on video input port - %p", - portData->mBufferHeader[index]->pBuffer); + CAMHAL_LOGDB("Queuing buffer on video input port - %p, offset: %d, length: %d", + portData->mBufferHeader[index]->pBuffer, + portData->mBufferHeader[index]->nOffset, + portData->mBufferHeader[index]->nFilledLen); portData->mStatus[index] = OMXCameraPortParameters::FILL; eError = OMX_EmptyThisBuffer(mCameraAdapterParameters.mHandleComp, (OMX_BUFFERHEADERTYPE*)portData->mBufferHeader[index]); @@ -323,6 +325,8 @@ status_t OMXCameraAdapter::UseBuffersReprocess(CameraBuffer *bufArr, int num) pBufferHdr->nVersion.s.nVersionMinor = 1 ; pBufferHdr->nVersion.s.nRevision = 0; pBufferHdr->nVersion.s.nStep = 0; + pBufferHdr->nOffset = bufArr[index].offset; + pBufferHdr->nFilledLen = bufArr[index].actual_size; portData->mBufferHeader[index] = pBufferHdr; } diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index 81b17ed..c7ac257 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -355,6 +355,9 @@ typedef struct _CameraBuffer { #endif + /* These are for buffers which include borders */ + int offset; // where valid data starts + int actual_size; // size of the entire buffer with borders } CameraBuffer; void * camera_buffer_get_omx_ptr (CameraBuffer *buffer); |