summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-10-06 13:04:01 -0500
committerIliyan Malchev <malchev@google.com>2011-10-07 12:29:22 -0700
commit57ae28cf48dedcabc10e389f44212d32e52c8b85 (patch)
tree66a4711e50eadcf03b3196c46e8de88a5b9b3915
parent400635333ccefbc1a59b26561ca73dbc39a27116 (diff)
downloadhardware_ti_omap4-57ae28cf48dedcabc10e389f44212d32e52c8b85.zip
hardware_ti_omap4-57ae28cf48dedcabc10e389f44212d32e52c8b85.tar.gz
hardware_ti_omap4-57ae28cf48dedcabc10e389f44212d32e52c8b85.tar.bz2
omap4xxx: camera: only set CameraAreas if changed
Partial fix for b/5371242 Add logic to compare areas for metering and focus before calling SetConfig for the respective indices so we only set the areas if the areas have changed Change-Id: Id6b55e3d8e78557f45b92a5afefdb8298450da61 Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r--camera/CameraHalUtilClasses.cpp23
-rw-r--r--camera/OMXCameraAdapter/OMX3A.cpp12
-rw-r--r--camera/OMXCameraAdapter/OMXFocus.cpp12
-rw-r--r--camera/inc/CameraHal.h5
4 files changed, 43 insertions, 9 deletions
diff --git a/camera/CameraHalUtilClasses.cpp b/camera/CameraHalUtilClasses.cpp
index c8e5eff..3074bc4 100644
--- a/camera/CameraHalUtilClasses.cpp
+++ b/camera/CameraHalUtilClasses.cpp
@@ -334,6 +334,29 @@ status_t CameraArea::parseAreas(const char *area,
return ret;
}
+bool CameraArea::areAreasDifferent(Vector< sp<CameraArea> > &area1,
+ Vector< sp<CameraArea> > &area2) {
+ if (area1.size() != area2.size()) {
+ return true;
+ }
+
+ // not going to care about sorting order for now
+ for (int i = 0; i < area1.size(); i++) {
+ if (!area1.itemAt(i)->compare(area2.itemAt(i))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CameraArea::compare(const sp<CameraArea> &area) {
+ return ((mTop == area->mTop) && (mLeft == area->mLeft) &&
+ (mBottom == area->mBottom) && (mRight == area->mRight) &&
+ (mWeight == area->mWeight));
+}
+
+
/*--------------------CameraArea Class ENDS here-----------------------------*/
};
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp
index 89d76fc..a42371a 100644
--- a/camera/OMXCameraAdapter/OMX3A.cpp
+++ b/camera/OMXCameraAdapter/OMX3A.cpp
@@ -271,15 +271,21 @@ status_t OMXCameraAdapter::setParameters3A(const CameraParameters &params,
str = params.get(CameraParameters::KEY_METERING_AREAS);
if ( (str != NULL) ) {
size_t MAX_METERING_AREAS;
+ Vector< sp<CameraArea> > tempAreas;
+
MAX_METERING_AREAS = atoi(params.get(CameraParameters::KEY_MAX_NUM_METERING_AREAS));
Mutex::Autolock lock(mMeteringAreasLock);
- mMeteringAreas.clear();
+ ret = CameraArea::parseAreas(str, ( strlen(str) + 1 ), tempAreas);
+
+ CAMHAL_LOGVB("areAreasDifferent? = %d",
+ CameraArea::areAreasDifferent(mMeteringAreas, tempAreas));
- ret = CameraArea::parseAreas(str, ( strlen(str) + 1 ), mMeteringAreas);
+ if ( (NO_ERROR == ret) && CameraArea::areAreasDifferent(mMeteringAreas, tempAreas) ) {
+ mMeteringAreas.clear();
+ mMeteringAreas = tempAreas;
- if ( NO_ERROR == ret ) {
if ( MAX_METERING_AREAS >= mMeteringAreas.size() ) {
CAMHAL_LOGDB("Setting Metering Areas %s",
params.get(CameraParameters::KEY_METERING_AREAS));
diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp
index 066627f..0014013 100644
--- a/camera/OMXCameraAdapter/OMXFocus.cpp
+++ b/camera/OMXCameraAdapter/OMXFocus.cpp
@@ -40,22 +40,24 @@ status_t OMXCameraAdapter::setParametersFocus(const CameraParameters &params,
{
status_t ret = NO_ERROR;
const char *str = NULL;
- Mutex::Autolock lock(mFocusAreasLock);
+ Vector< sp<CameraArea> > tempAreas;
size_t MAX_FOCUS_AREAS;
-
LOG_FUNCTION_NAME;
+ Mutex::Autolock lock(mFocusAreasLock);
+
str = params.get(CameraParameters::KEY_FOCUS_AREAS);
MAX_FOCUS_AREAS = atoi(params.get(CameraParameters::KEY_MAX_NUM_FOCUS_AREAS));
- mFocusAreas.clear();
if ( NULL != str ) {
- ret = CameraArea::parseAreas(str, ( strlen(str) + 1 ), mFocusAreas);
+ ret = CameraArea::parseAreas(str, ( strlen(str) + 1 ), tempAreas);
}
- if ( NO_ERROR == ret ) {
+ if ( (NO_ERROR == ret) && CameraArea::areAreasDifferent(mFocusAreas, tempAreas) ) {
+ mFocusAreas.clear();
+ mFocusAreas = tempAreas;
if ( MAX_FOCUS_AREAS < mFocusAreas.size() ) {
CAMHAL_LOGEB("Focus areas supported %d, focus areas set %d",
MAX_FOCUS_AREAS,
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index 68f5cac..fae9d8b 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -162,6 +162,8 @@ public:
return mWeight;
}
+ bool compare(const sp<CameraArea> &area);
+
static status_t parseAreas(const char *area,
size_t areaLength,
Vector< sp<CameraArea> > &areas);
@@ -172,8 +174,9 @@ public:
ssize_t right,
ssize_t weight);
-private:
+ static bool areAreasDifferent(Vector< sp<CameraArea> > &, Vector< sp<CameraArea> > &);
+protected:
static const ssize_t TOP = -1000;
static const ssize_t LEFT = -1000;
static const ssize_t BOTTOM = 1000;