summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/api1/client2
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2014-09-12 16:47:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-12 16:47:25 +0000
commitf2a74aad5efc01e5b9939c7cbbfde058ce64bfec (patch)
treea0258812cdfdf2bc289d4c3da8fcb579a3ecad69 /services/camera/libcameraservice/api1/client2
parent095da43dfe840f28d8c026710644a97d9b7805bf (diff)
parentdec84fb1c687509c3125acac76e0af80e4e0afbd (diff)
downloadframeworks_av-f2a74aad5efc01e5b9939c7cbbfde058ce64bfec.zip
frameworks_av-f2a74aad5efc01e5b9939c7cbbfde058ce64bfec.tar.gz
frameworks_av-f2a74aad5efc01e5b9939c7cbbfde058ce64bfec.tar.bz2
Merge "Camera2: improve ZSL candidate selection logic" into lmp-dev
Diffstat (limited to 'services/camera/libcameraservice/api1/client2')
-rw-r--r--services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp29
-rw-r--r--services/camera/libcameraservice/api1/client2/ZslProcessor3.h2
2 files changed, 29 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp
index 227b169..fa65b74 100644
--- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp
+++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp
@@ -457,6 +457,23 @@ void ZslProcessor3::dumpZslQueue(int fd) const {
}
}
+bool ZslProcessor3::isFixedFocusMode(uint8_t afMode) const {
+ switch (afMode) {
+ case ANDROID_CONTROL_AF_MODE_AUTO:
+ case ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO:
+ case ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE:
+ case ANDROID_CONTROL_AF_MODE_MACRO:
+ return false;
+ break;
+ case ANDROID_CONTROL_AF_MODE_OFF:
+ case ANDROID_CONTROL_AF_MODE_EDOF:
+ return true;
+ default:
+ ALOGE("%s: unknown focus mode %d", __FUNCTION__, afMode);
+ return false;
+ }
+}
+
nsecs_t ZslProcessor3::getCandidateTimestampLocked(size_t* metadataIdx) const {
/**
* Find the smallest timestamp we know about so far
@@ -502,8 +519,16 @@ nsecs_t ZslProcessor3::getCandidateTimestampLocked(size_t* metadataIdx) const {
continue;
}
- // Check AF state if device has focuser
- if (mHasFocuser) {
+ entry = frame.find(ANDROID_CONTROL_AF_MODE);
+ if (entry.count == 0) {
+ ALOGW("%s: ZSL queue frame has no AF mode field!",
+ __FUNCTION__);
+ continue;
+ }
+ uint8_t afMode = entry.data.u8[0];
+
+ // Check AF state if device has focuser and focus mode isn't fixed
+ if (mHasFocuser && !isFixedFocusMode(afMode)) {
// Make sure the candidate frame has good focus.
entry = frame.find(ANDROID_CONTROL_AF_STATE);
if (entry.count == 0) {
diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.h b/services/camera/libcameraservice/api1/client2/ZslProcessor3.h
index 8894364..2975f7c 100644
--- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.h
+++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.h
@@ -133,6 +133,8 @@ class ZslProcessor3 :
void dumpZslQueue(int id) const;
nsecs_t getCandidateTimestampLocked(size_t* metadataIdx) const;
+
+ bool isFixedFocusMode(uint8_t afMode) const;
};