@@ -246,12 +246,14 @@ int AwbAlgorithmBase::init(const ValueNode &tuningData)
*/
int AwbAlgorithmBase::configure(awb::ActiveState &state)
{
- state.manual.gains = RGB<double>{ 1.0 };
auto gains = impl_->gainsFromColourTemperature(kDefaultColourTemperature);
- if (gains)
+ if (gains) {
+ state.manual.gains = *gains;
state.automatic.gains = *gains;
- else
+ } else {
+ state.manual.gains = RGB<double>{ 1.0 };
state.automatic.gains = RGB<double>{ 1.0 };
+ }
state.autoEnabled = true;
state.manual.colourTemperature = kDefaultColourTemperature;
@@ -286,6 +288,10 @@ void AwbAlgorithmBase::queueRequest(awb::ActiveState &state,
const auto &awbEnable = controls.get(controls::AwbEnable);
if (awbEnable && *awbEnable != state.autoEnabled) {
state.autoEnabled = *awbEnable;
+ if (state.autoEnabled)
+ convergedState_ = controls::AwbStateEnum::AwbStateSearching;
+ else
+ convergedState_ = controls::AwbStateEnum::AwbStateLocked;
LOG(Awb, Debug)
<< (*awbEnable ? "Enabling" : "Disabling") << " Awb";
@@ -445,6 +451,9 @@ void AwbAlgorithmBase::process(awb::ActiveState &state,
state.automatic.colourTemperature = awbResult.colourTemperature;
state.automatic.gains = newGains;
+ if (state.autoEnabled)
+ state.manual.gains = newGains;
+
/* Populate metadata. */
metadata.set(controls::AwbEnable, frameContext.autoEnabled);
metadata.set(controls::ColourGains, { static_cast<float>(frameContext.gains.r()),
The present behaviour of the AWB algorithm is to decouple manual and automatic gains completely. If AwbEnable is set to false, this leads to a jarring transition to the (possibly default 1.0) manual gains. Instead update the manual gains with the automatic ones if we're in automatic mode so that when AwbEnable is set to false the gains are seen to "freeze" at their current values rather than revert to the last configured manual value. As this is the exact behaviour of the AwbStateLocked value of the AwbState metadata item, set that when AwbEnable == false is passed. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> --- src/ipa/libipa/awb.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)