diff options
Diffstat (limited to 'src/ipa/libipa/algorithms/af_hill_climbing.h')
-rw-r--r-- | src/ipa/libipa/algorithms/af_hill_climbing.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ipa/libipa/algorithms/af_hill_climbing.h b/src/ipa/libipa/algorithms/af_hill_climbing.h index db9fc058..e251f3eb 100644 --- a/src/ipa/libipa/algorithms/af_hill_climbing.h +++ b/src/ipa/libipa/algorithms/af_hill_climbing.h @@ -29,7 +29,7 @@ public: lensPosition_(0), bestPosition_(0), currentContrast_(0.0), previousContrast_(0.0), maxContrast_(0.0), maxStep_(0), coarseCompleted_(false), fineCompleted_(false), - lowStep_(0), highStep_(kMaxFocusSteps) + lowStep_(0), highStep_(kMaxFocusSteps), framesToSkip_(0) { } @@ -92,6 +92,9 @@ protected: { currentContrast_ = currentContrast; + if (shouldSkipFrame()) + return lensPosition_; + /* If we are in a paused state, we won't process the stats */ if (pauseState_ == libcamera::controls::AfPauseStatePaused) return lensPosition_; @@ -113,6 +116,12 @@ protected: return lensPosition_; } + void setFramesToSkip(uint32_t n) + { + if (n > framesToSkip_) + framesToSkip_ = n; + } + private: void afCoarseScan() { @@ -191,6 +200,7 @@ private: coarseCompleted_ = false; fineCompleted_ = false; maxContrast_ = 0.0; + setFramesToSkip(1); } bool afIsOutOfFocus() @@ -206,6 +216,16 @@ private: return false; } + bool shouldSkipFrame() + { + if (framesToSkip_ > 0) { + framesToSkip_--; + return true; + } + + return false; + } + controls::AfModeEnum mode_; controls::AfStateEnum state_; controls::AfPauseStateEnum pauseState_; @@ -229,6 +249,7 @@ private: uint32_t lowStep_; uint32_t highStep_; + uint32_t framesToSkip_; /* * Maximum focus steps of the VCM control |