@@ -235,6 +235,7 @@ int AwbAlgorithmBase::init(const ValueNode &tuningData)
ControlInfo(kMinColourTemperature, kMaxColourTemperature,
kDefaultColourTemperature);
controls_[&controls::AwbEnable] = ControlInfo(false, true);
+ controls_[&controls::AwbTrigger] = ControlInfo(false, true);
return parseModeConfigs(tuningData, controls::AwbAuto);
}
@@ -308,6 +309,13 @@ void AwbAlgorithmBase::queueRequest(awb::ActiveState &state,
currentMode_ = &it->second;
}
+ auto trigger = controls.get(controls::AwbTrigger);
+ if (trigger && *trigger && !state.autoEnabled) {
+ lockedCount_ = 0;
+ convergedState_ = controls::AwbStateEnum::AwbStateSearching;
+ rescanning_ = true;
+ }
+
frameContext.autoEnabled = state.autoEnabled;
if (frameContext.autoEnabled)
@@ -447,13 +455,21 @@ void AwbAlgorithmBase::process(awb::ActiveState &state,
RGB<double> newGains = awbResult.gains * speed +
state.automatic.gains * (1 - speed);
- updateConvergedState(state.automatic.gains, newGains);
+ if (state.autoEnabled || rescanning_)
+ updateConvergedState(state.automatic.gains, newGains);
state.automatic.colourTemperature = awbResult.colourTemperature;
state.automatic.gains = newGains;
if (state.autoEnabled)
state.manual.gains = newGains;
+ if (rescanning_ &&
+ convergedState_ == controls::AwbStateEnum::AwbStateConverged) {
+ state.manual.gains = newGains;
+ rescanning_ = false;
+ convergedState_ = controls::AwbStateEnum::AwbStateLocked;
+ }
+
/* Populate metadata. */
metadata.set(controls::AwbEnable, frameContext.autoEnabled);
metadata.set(controls::ColourGains, { static_cast<float>(frameContext.gains.r()),
@@ -112,6 +112,7 @@ private:
controls::AwbStateEnum convergedState_;
RGB<double> convergedGains_;
unsigned int lockedCount_;
+ bool rescanning_;
};
template<typename Q>
Add the AwbTrigger control, which works when AwbEnable == false and allows the algorithm to settle into the Converged state before updating the manual gains and applying them. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> --- src/ipa/libipa/awb.cpp | 18 +++++++++++++++++- src/ipa/libipa/awb.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-)