summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipa/rpi/controller/rpi/alsc.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp
index 3a2e8fe0..f1ccef87 100644
--- a/src/ipa/rpi/controller/rpi/alsc.cpp
+++ b/src/ipa/rpi/controller/rpi/alsc.cpp
@@ -348,9 +348,11 @@ static void copyStats(RgbyRegions &regions, StatisticsPtr &stats,
const std::vector<double> &bTable = status.b;
for (unsigned int i = 0; i < stats->awbRegions.numRegions(); i++) {
auto r = stats->awbRegions.get(i);
- r.val.rSum = static_cast<uint64_t>(r.val.rSum / rTable[i]);
- r.val.gSum = static_cast<uint64_t>(r.val.gSum / gTable[i]);
- r.val.bSum = static_cast<uint64_t>(r.val.bSum / bTable[i]);
+ if (stats->colourStatsPos == Statistics::ColourStatsPos::PostLsc) {
+ r.val.rSum = static_cast<uint64_t>(r.val.rSum / rTable[i]);
+ r.val.gSum = static_cast<uint64_t>(r.val.gSum / gTable[i]);
+ r.val.bSum = static_cast<uint64_t>(r.val.bSum / bTable[i]);
+ }
regions.set(i, r);
}
}
@@ -368,7 +370,8 @@ void Alsc::restartAsync(StatisticsPtr &stats, Metadata *imageMetadata)
* the LSC table that the pipeline applied to them.
*/
AlscStatus alscStatus;
- if (imageMetadata->get("alsc.status", alscStatus) != 0) {
+ if (stats->colourStatsPos == Statistics::ColourStatsPos::PostLsc &&
+ imageMetadata->get("alsc.status", alscStatus) != 0) {
LOG(RPiAlsc, Warning)
<< "No ALSC status found for applied gains!";
alscStatus.r.resize(config_.tableSize.width * config_.tableSize.height, 1.0);
@@ -414,6 +417,11 @@ void Alsc::prepare(Metadata *imageMetadata)
status.g = prevSyncResults_[1].data();
status.b = prevSyncResults_[2].data();
imageMetadata->set("alsc.status", status);
+ /*
+ * Put the results in the global metadata as well. This will be used by
+ * AWB to factor in the colour shading correction.
+ */
+ getGlobalMetadata().set("alsc.status", status);
}
void Alsc::process(StatisticsPtr &stats, Metadata *imageMetadata)