diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2023-10-13 08:48:30 +0100 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2023-10-18 11:01:22 +0100 |
commit | 0be32012ef378ad22b2715a2bddee0acfce33f92 (patch) | |
tree | 83a7d5789b751f44659630a7cdeb84a0d03820e7 /src/ipa/rpi | |
parent | 56ca5091debff3a74a9ff146ee6a15eda47047bc (diff) |
ipa: rpi: Prepare ALSC for PiSP support
Prepare the ALSC algorithm to support the PiSP hardware. The key change
is to avoid factoring out the WB correction in the AWB zone statistics.
Add the ALSC correction to the global metadata so that AWB can use it to
factor the gains back in for the AWB calculations.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi')
-rw-r--r-- | src/ipa/rpi/controller/rpi/alsc.cpp | 16 |
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 ®ions, 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) |