diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2014-09-10 15:14:18 -0700 |
---|---|---|
committer | Yin-Chia Yeh <yinchiayeh@google.com> | 2014-09-11 10:05:27 -0700 |
commit | dec84fb1c687509c3125acac76e0af80e4e0afbd (patch) | |
tree | 0877082ab93f823fdd79721e83b3d343263bb2ec /services | |
parent | 4bcbb07be57947ea1421519094f73577b1e263e6 (diff) | |
download | frameworks_av-dec84fb1c687509c3125acac76e0af80e4e0afbd.zip frameworks_av-dec84fb1c687509c3125acac76e0af80e4e0afbd.tar.gz frameworks_av-dec84fb1c687509c3125acac76e0af80e4e0afbd.tar.bz2 |
Camera2: improve ZSL candidate selection logic
1. Clear ZSL queue when focus mode is changed and autoFocus is
cancelled.
2. Do not check focus state is focus mode is fixed.
Bug: 17185356
Change-Id: I2cb10fb457b080f0db950c894e56995f638e147b
Diffstat (limited to 'services')
3 files changed, 38 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index 36a93b2..6f4a507 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -1291,6 +1291,9 @@ status_t Camera2Client::cancelAutoFocus() { return OK; } + if (l.mParameters.zslMode) { + mZslProcessor->clearZslQueue(); + } } syncWithDevice(); @@ -1379,8 +1382,14 @@ status_t Camera2Client::setParameters(const String8& params) { SharedParameters::Lock l(mParameters); + Parameters::focusMode_t focusModeBefore = l.mParameters.focusMode; res = l.mParameters.set(params); if (res != OK) return res; + Parameters::focusMode_t focusModeAfter = l.mParameters.focusMode; + + if (l.mParameters.zslMode && focusModeAfter != focusModeBefore) { + mZslProcessor->clearZslQueue(); + } res = updateRequests(l.mParameters); diff --git a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp index 2d31275..608550b 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.cpp @@ -454,6 +454,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 @@ -499,8 +516,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 daa352b..76707fa 100644 --- a/services/camera/libcameraservice/api1/client2/ZslProcessor3.h +++ b/services/camera/libcameraservice/api1/client2/ZslProcessor3.h @@ -132,6 +132,8 @@ class ZslProcessor3 : void dumpZslQueue(int id) const; nsecs_t getCandidateTimestampLocked(size_t* metadataIdx) const; + + bool isFixedFocusMode(uint8_t afMode) const; }; |