diff options
author | Emilian Peev <epeev@mm-sol.com> | 2012-07-18 13:40:48 +0300 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:09:17 +0200 |
commit | d38598fd9b27a2c0bde6009d210e27da4aeb5987 (patch) | |
tree | 14c6479644d3389b115efc05fe5f5f03598ed1f6 /camera | |
parent | 8e4b4bde5843edca59e7be89a496721615e79e91 (diff) | |
download | hardware_ti_omap4-d38598fd9b27a2c0bde6009d210e27da4aeb5987.zip hardware_ti_omap4-d38598fd9b27a2c0bde6009d210e27da4aeb5987.tar.gz hardware_ti_omap4-d38598fd9b27a2c0bde6009d210e27da4aeb5987.tar.bz2 |
CameraHal: Adds reprocess related PPMs
Change-Id: I019247d8175ae46be307616ae2011938f0b604b1
Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
Diffstat (limited to 'camera')
-rw-r--r-- | camera/CameraHal.cpp | 68 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCapture.cpp | 30 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXReprocess.cpp | 22 | ||||
-rw-r--r-- | camera/inc/CameraHal.h | 9 |
4 files changed, 123 insertions, 6 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 7a43cd0..0be515a 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -3159,7 +3159,7 @@ status_t CameraHal::takePicture(const char *params) @todo Define error codes if unable to switch to image capture */ -status_t CameraHal::__takePicture(const char *params) +status_t CameraHal::__takePicture(const char *params, struct timeval *captureStart) { // cancel AF state if needed (before any operation and mutex lock) if (mCameraAdapter->getState() == CameraAdapter::AF_STATE) { @@ -3180,7 +3180,11 @@ status_t CameraHal::__takePicture(const char *params) #if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS - gettimeofday(&mStartCapture, NULL); + if ( NULL == captureStart ) { + gettimeofday(&mStartCapture, NULL); + } else { + memcpy(&mStartCapture, captureStart, sizeof(struct timeval)); + } #endif @@ -3288,6 +3292,12 @@ status_t CameraHal::__takePicture(const char *params) // when we remove legacy TI parameters implementation } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture parameters set: ", &mStartCapture); + +#endif + // if we are already in the middle of a capture and using the same // tapout ST...then we just need setParameters and start image // capture to queue more shots @@ -3384,6 +3394,12 @@ status_t CameraHal::__takePicture(const char *params) } } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture buffer size queried: ", &mStartCapture); + +#endif + if (outAdapter.get()) { // Avoid locking the tapout again when reusing it if (!reuseTapout) { @@ -3417,7 +3433,14 @@ status_t CameraHal::__takePicture(const char *params) } } - if ( (NO_ERROR == ret) && ( NULL != mCameraAdapter ) ) +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture buffers allocated: ", &mStartCapture); + memcpy(&mImageBuffers->ppmStamp, &mStartCapture, sizeof(struct timeval)); + +#endif + + if ( (NO_ERROR == ret) && ( NULL != mCameraAdapter ) ) { desc.mBuffers = mImageBuffers; desc.mOffsets = mImageOffsets; @@ -3456,6 +3479,12 @@ status_t CameraHal::__takePicture(const char *params) } } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture buffers registered: ", &mStartCapture); + +#endif + if ((ret == NO_ERROR) && mBufferSourceAdapter_Out.get()) { mBufferSourceAdapter_Out->enableDisplay(0, 0, NULL); } @@ -3467,6 +3496,8 @@ status_t CameraHal::__takePicture(const char *params) //pass capture timestamp along with the camera adapter command ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_START_IMAGE_CAPTURE, (int) &mStartCapture); + CameraHal::PPM("Takepicture capture started: ", &mStartCapture); + #else ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_START_IMAGE_CAPTURE); @@ -3582,11 +3613,18 @@ status_t CameraHal::reprocess(const char *params) CameraBuffer *reprocBuffers = NULL; android::ShotParameters shotParams; const char *valStr = NULL; + struct timeval startReprocess; android::AutoMutex lock(mLock); LOG_FUNCTION_NAME; +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + gettimeofday(&startReprocess, NULL); + +#endif + // 0. Get tap in surface if (strlen(params) > 0) { android::String8 shotParams8(params); @@ -3623,11 +3661,24 @@ status_t CameraHal::reprocess(const char *params) goto exit; } + +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Got reprocess buffers: ", &startReprocess); + +#endif + // 2. Get buffer information and parse parameters { shotParams.setBurst(bufferCount); } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + memcpy(&reprocBuffers->ppmStamp, &startReprocess, sizeof(struct timeval)); + +#endif + // 3. Give buffer to camera adapter desc.mBuffers = reprocBuffers; desc.mOffsets = 0; @@ -3635,12 +3686,19 @@ status_t CameraHal::reprocess(const char *params) desc.mLength = 0; desc.mCount = (size_t) bufferCount; desc.mMaxQueueable = (size_t) bufferCount; + ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_USE_BUFFERS_REPROCESS, (int) &desc); if (ret != NO_ERROR) { CAMHAL_LOGE("Error calling camera use buffers"); goto exit; } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Reprocess buffers registered: ", &startReprocess); + +#endif + // 4. Start reprocessing ret = mBufferSourceAdapter_In->enableDisplay(0, 0, NULL); if (ret != NO_ERROR) { @@ -3649,9 +3707,9 @@ status_t CameraHal::reprocess(const char *params) } // 5. Start capturing - ret = __takePicture(shotParams.flatten().string()); + ret = __takePicture(shotParams.flatten().string(), &startReprocess); - exit: +exit: return ret; } diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp index 9fbd784..3382493 100644 --- a/camera/OMXCameraAdapter/OMXCapture.cpp +++ b/camera/OMXCameraAdapter/OMXCapture.cpp @@ -1196,6 +1196,10 @@ status_t OMXCameraAdapter::startImageCapture(bool bracketing, CachedCaptureParam } } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + CameraHal::PPM("startImageCapture bracketing configs done: ", &mStartCapture); +#endif + capData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mImagePortIndex]; //OMX shutter callback events are only available in hq mode @@ -1301,6 +1305,10 @@ status_t OMXCameraAdapter::startImageCapture(bool bracketing, CachedCaptureParam } } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + CameraHal::PPM("startImageCapture image buffers queued and capture enabled: ", &mStartCapture); +#endif + //OMX shutter callback events are only available in hq mode if ( (HIGH_QUALITY == mCapMode) || (HIGH_QUALITY_ZSL== mCapMode)) @@ -1335,6 +1343,10 @@ status_t OMXCameraAdapter::startImageCapture(bool bracketing, CachedCaptureParam } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + CameraHal::PPM("startImageCapture shutter event received: ", &mStartCapture); +#endif + return (ret | Utils::ErrorUtils::omxToAndroidError(eError)); EXIT: @@ -1797,6 +1809,12 @@ status_t OMXCameraAdapter::UseBuffersCapture(CameraBuffer * bufArr, int num) GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture image port configuration: ", &bufArr->ppmStamp); + +#endif + // Register for Image port ENABLE event ret = RegisterForEvent(mCameraAdapterParameters.mHandleComp, OMX_EventCmdComplete, @@ -1861,6 +1879,12 @@ status_t OMXCameraAdapter::UseBuffersCapture(CameraBuffer * bufArr, int num) } CAMHAL_LOGDA("Port enabled"); +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture image port enabled and buffers registered: ", &bufArr->ppmStamp); + +#endif + // Enable WB and vector shot extra data for metadata ret = setExtraData(true, mCameraAdapterParameters.mImagePortIndex, OMX_WhiteBalance); ret = setExtraData(true, mCameraAdapterParameters.mImagePortIndex, OMX_TI_LSCTable); @@ -1913,6 +1937,12 @@ status_t OMXCameraAdapter::UseBuffersCapture(CameraBuffer * bufArr, int num) } } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Takepicture extra configs on image port done: ", &bufArr->ppmStamp); + +#endif + mCaptureConfigured = true; #ifdef CAMERAHAL_USE_RAW_IMAGE_SAVING diff --git a/camera/OMXCameraAdapter/OMXReprocess.cpp b/camera/OMXCameraAdapter/OMXReprocess.cpp index 4d559ef..05ac37b 100644 --- a/camera/OMXCameraAdapter/OMXReprocess.cpp +++ b/camera/OMXCameraAdapter/OMXReprocess.cpp @@ -118,6 +118,10 @@ status_t OMXCameraAdapter::startReprocess() } } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + CameraHal::PPM("startReprocess buffers queued on video port: ", &mStartCapture); +#endif + return (ret | Utils::ErrorUtils::omxToAndroidError(eError)); EXIT: @@ -225,6 +229,12 @@ status_t OMXCameraAdapter::UseBuffersReprocess(CameraBuffer *bufArr, int num) disableImagePort(); } +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Reprocess stopping image capture and disabling image port: ", &bufArr->ppmStamp); + +#endif + portData->mNumBufs = num; // Configure @@ -272,6 +282,12 @@ status_t OMXCameraAdapter::UseBuffersReprocess(CameraBuffer *bufArr, int num) } GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Reprocess configuration done: ", &bufArr->ppmStamp); + +#endif + // Enable Port ret = RegisterForEvent(mCameraAdapterParameters.mHandleComp, OMX_EventCmdComplete, @@ -335,6 +351,12 @@ status_t OMXCameraAdapter::UseBuffersReprocess(CameraBuffer *bufArr, int num) mReprocConfigured = true; +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + CameraHal::PPM("Reprocess video port enabled and buffers registered: ", &bufArr->ppmStamp); + +#endif + return (ret | Utils::ErrorUtils::omxToAndroidError(eError)); EXIT: diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index 1aa7b7f..81b17ed 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -348,6 +348,13 @@ typedef struct _CameraBuffer { int stride; int height; const char *format; + +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + struct timeval ppmStamp; + +#endif + } CameraBuffer; void * camera_buffer_get_omx_ptr (CameraBuffer *buffer); @@ -1358,7 +1365,7 @@ private: void resetPreviewRes(android::CameraParameters *params); // Internal __takePicture function - used in public takePicture() and reprocess() - int __takePicture(const char* params); + int __takePicture(const char* params, struct timeval *captureStart = NULL); //@} status_t setTapoutLocked(struct preview_stream_ops *out); |