ipa: rkisp1: awb: Unconditionally fill metadata
When the colour temperature estimation gets skipped, the metadata isn't populated. Fix that by filling the metadata early in the function. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
e9aea086b5
commit
29ce7b96ea
1 changed files with 10 additions and 7 deletions
|
@ -222,6 +222,12 @@ void Awb::process(IPAContext &context,
|
||||||
double redMean;
|
double redMean;
|
||||||
double blueMean;
|
double blueMean;
|
||||||
|
|
||||||
|
metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled);
|
||||||
|
metadata.set(controls::ColourGains, {
|
||||||
|
static_cast<float>(frameContext.awb.gains.red),
|
||||||
|
static_cast<float>(frameContext.awb.gains.blue)
|
||||||
|
});
|
||||||
|
|
||||||
if (rgbMode_) {
|
if (rgbMode_) {
|
||||||
greenMean = awb->awb_mean[0].mean_y_or_g;
|
greenMean = awb->awb_mean[0].mean_y_or_g;
|
||||||
redMean = awb->awb_mean[0].mean_cr_or_r;
|
redMean = awb->awb_mean[0].mean_cr_or_r;
|
||||||
|
@ -277,11 +283,15 @@ void Awb::process(IPAContext &context,
|
||||||
*/
|
*/
|
||||||
if (redMean < kMeanMinThreshold && greenMean < kMeanMinThreshold &&
|
if (redMean < kMeanMinThreshold && greenMean < kMeanMinThreshold &&
|
||||||
blueMean < kMeanMinThreshold) {
|
blueMean < kMeanMinThreshold) {
|
||||||
|
metadata.set(controls::ColourTemperature, activeState.awb.temperatureK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
activeState.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);
|
activeState.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);
|
||||||
|
|
||||||
|
/* Metadata shall contain the up to date measurement */
|
||||||
|
metadata.set(controls::ColourTemperature, activeState.awb.temperatureK);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Estimate the red and blue gains to apply in a grey world. The green
|
* Estimate the red and blue gains to apply in a grey world. The green
|
||||||
* gain is hardcoded to 1.0. Avoid divisions by zero by clamping the
|
* gain is hardcoded to 1.0. Avoid divisions by zero by clamping the
|
||||||
|
@ -308,13 +318,6 @@ void Awb::process(IPAContext &context,
|
||||||
activeState.awb.gains.automatic.blue = blueGain;
|
activeState.awb.gains.automatic.blue = blueGain;
|
||||||
activeState.awb.gains.automatic.green = 1.0;
|
activeState.awb.gains.automatic.green = 1.0;
|
||||||
|
|
||||||
metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled);
|
|
||||||
metadata.set(controls::ColourGains, {
|
|
||||||
static_cast<float>(frameContext.awb.gains.red),
|
|
||||||
static_cast<float>(frameContext.awb.gains.blue)
|
|
||||||
});
|
|
||||||
metadata.set(controls::ColourTemperature, activeState.awb.temperatureK);
|
|
||||||
|
|
||||||
LOG(RkISP1Awb, Debug) << std::showpoint
|
LOG(RkISP1Awb, Debug) << std::showpoint
|
||||||
<< "Means [" << redMean << ", " << greenMean << ", " << blueMean
|
<< "Means [" << redMean << ", " << greenMean << ", " << blueMean
|
||||||
<< "], gains [" << activeState.awb.gains.automatic.red << ", "
|
<< "], gains [" << activeState.awb.gains.automatic.red << ", "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue