diff options
author | Keith Deacon <kdeacon@ti.com> | 2012-09-21 15:19:40 -0500 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 18:41:19 +0200 |
commit | a2051510fb28c0b856b18b91dca25754aec22256 (patch) | |
tree | c29ccbff0c40d160502745c39967af08e6a42a95 /camera/OMXCameraAdapter | |
parent | 79ac1ba7c42c87c1440ac18d965e9b96d2f84a95 (diff) | |
parent | 2c972b6d5469e5833e2229bc3d9cacf1be9dca98 (diff) | |
download | hardware_ti_omap4-a2051510fb28c0b856b18b91dca25754aec22256.zip hardware_ti_omap4-a2051510fb28c0b856b18b91dca25754aec22256.tar.gz hardware_ti_omap4-a2051510fb28c0b856b18b91dca25754aec22256.tar.bz2 |
Merge p-jb-release into d-jb-release
Change-Id: Iec5798f854fdcac8bdbe6f5ab2ef8d17c7224696
Diffstat (limited to 'camera/OMXCameraAdapter')
-rw-r--r-- | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 95 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXFD.cpp | 30 |
2 files changed, 52 insertions, 73 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index 5ad1c65..e63cf02 100644 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -1841,6 +1841,46 @@ status_t OMXCameraAdapter::switchToLoaded(bool bPortEnableRequired) { } GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); + if ( !bPortEnableRequired ) { + OMXCameraPortParameters *mCaptureData , *mPreviewData, *measurementData; + mCaptureData = mPreviewData = measurementData = NULL; + + mPreviewData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mPrevPortIndex]; + mCaptureData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mImagePortIndex]; + measurementData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mMeasurementPortIndex]; + + ///Free the OMX Buffers + for ( int i = 0 ; i < mPreviewData->mNumBufs ; i++ ) { + eError = OMX_FreeBuffer(mCameraAdapterParameters.mHandleComp, + mCameraAdapterParameters.mPrevPortIndex, + mPreviewData->mBufferHeader[i]); + + if(eError!=OMX_ErrorNone) { + CAMHAL_LOGEB("OMX_FreeBuffer - %x", eError); + } + GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); + } + + if ( mMeasurementEnabled ) { + + for ( int i = 0 ; i < measurementData->mNumBufs ; i++ ) { + eError = OMX_FreeBuffer(mCameraAdapterParameters.mHandleComp, + mCameraAdapterParameters.mMeasurementPortIndex, + measurementData->mBufferHeader[i]); + if(eError!=OMX_ErrorNone) { + CAMHAL_LOGEB("OMX_FreeBuffer - %x", eError); + } + GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); + } + + { + android::AutoMutex lock(mPreviewDataBufferLock); + mPreviewDataBuffersAvailable.clear(); + } + + } + } + CAMHAL_LOGDA("Switching IDLE->LOADED state"); ret = mSwitchToLoadedSem.WaitTimeout(OMX_CMD_TIMEOUT); @@ -1875,6 +1915,11 @@ status_t OMXCameraAdapter::switchToLoaded(bool bPortEnableRequired) { EXIT: CAMHAL_LOGEB("Exiting function %s because of ret %d eError=%x", __FUNCTION__, ret, eError); + { + android::AutoMutex lock(mPreviewBufferLock); + ///Clear all the available preview buffers + mPreviewBuffersAvailable.clear(); + } performCleanupAfterError(); LOG_FUNCTION_NAME_EXIT; return (ret | Utils::ErrorUtils::omxToAndroidError(eError)); @@ -2439,43 +2484,6 @@ status_t OMXCameraAdapter::stopPreview() { } mTunnelDestroyed = false; - OMXCameraPortParameters *mCaptureData , *mPreviewData, *measurementData; - mCaptureData = mPreviewData = measurementData = NULL; - - mPreviewData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mPrevPortIndex]; - mCaptureData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mImagePortIndex]; - measurementData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mMeasurementPortIndex]; - - ///Free the OMX Buffers - for ( int i = 0 ; i < mPreviewData->mNumBufs ; i++ ) { - eError = OMX_FreeBuffer(mCameraAdapterParameters.mHandleComp, - mCameraAdapterParameters.mPrevPortIndex, - mPreviewData->mBufferHeader[i]); - - if(eError!=OMX_ErrorNone) { - CAMHAL_LOGEB("OMX_FreeBuffer - %x", eError); - } - GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); - } - - if ( mMeasurementEnabled ) { - - for ( int i = 0 ; i < measurementData->mNumBufs ; i++ ) { - eError = OMX_FreeBuffer(mCameraAdapterParameters.mHandleComp, - mCameraAdapterParameters.mMeasurementPortIndex, - measurementData->mBufferHeader[i]); - if(eError!=OMX_ErrorNone) { - CAMHAL_LOGEB("OMX_FreeBuffer - %x", eError); - } - GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); - } - - { - android::AutoMutex lock(mPreviewDataBufferLock); - mPreviewDataBuffersAvailable.clear(); - } - - } { android::AutoMutex lock(mPreviewBufferLock); @@ -2485,7 +2493,6 @@ status_t OMXCameraAdapter::stopPreview() { switchToLoaded(); - mFirstTimeInit = true; mPendingCaptureSettings = 0; mFramesWithDucati = 0; @@ -2495,18 +2502,6 @@ status_t OMXCameraAdapter::stopPreview() { LOG_FUNCTION_NAME_EXIT; return (ret | Utils::ErrorUtils::omxToAndroidError(eError)); - -EXIT: - CAMHAL_LOGEB("Exiting function %s because of ret %d eError=%x", __FUNCTION__, ret, eError); - { - android::AutoMutex lock(mPreviewBufferLock); - ///Clear all the available preview buffers - mPreviewBuffersAvailable.clear(); - } - performCleanupAfterError(); - LOG_FUNCTION_NAME_EXIT; - return (ret | Utils::ErrorUtils::omxToAndroidError(eError)); - } status_t OMXCameraAdapter::setSensorOverclock(bool enable) diff --git a/camera/OMXCameraAdapter/OMXFD.cpp b/camera/OMXCameraAdapter/OMXFD.cpp index 08e5a60..1a482b2 100644 --- a/camera/OMXCameraAdapter/OMXFD.cpp +++ b/camera/OMXCameraAdapter/OMXFD.cpp @@ -24,13 +24,6 @@ #include "CameraHal.h" #include "OMXCameraAdapter.h" -// constants used for face smooth filtering -static const int HorizontalFilterThreshold = 40; -static const int VerticalFilterThreshold = 40; -static const int HorizontalFaceSizeThreshold = 30; -static const int VerticalFaceSizeThreshold = 30; - - namespace Ti { namespace Camera { @@ -463,24 +456,15 @@ status_t OMXCameraAdapter::encodeFaceCoordinates(const OMX_FACEDETECTIONTYPE *fa int tempSizeY = (faceDetectionLastOutput[j].rect[trans_bot] - faceDetectionLastOutput[j].rect[trans_top] ) ; - if ( (abs(tempCenterX - centerX) < HorizontalFilterThreshold) && - (abs(tempCenterY - centerY) < VerticalFilterThreshold) ) - { - // Found Face. It did not move too far. - // Now check size of rectangle compare to last output - if ( (abs (tempSizeX -sizeX) < HorizontalFaceSizeThreshold) && - (abs (tempSizeY -sizeY) < VerticalFaceSizeThreshold) ) - { - // Rectangle is almost same as last time - // Output exactly what was done for this face last time. - faces[i] = faceDetectionLastOutput[j]; + if ( ( tempCenterX == centerX) && + ( tempCenterY == centerY) ) { + // Found Face. + // Now check size of rectangle + // compare to last output. + if ( ( tempSizeX == sizeX ) && + ( tempSizeY == sizeY ) ) { faceChanged = false; } - else - { - // TODO(XXX): Rectangle size changed but position is same. - // Possibly we can apply just positional correctness. - } } } // Send face detection data after some face coordinate changes |