ipa: rpi: pisp: Use a floating region to get whole image Y statistics

Floating regions are currently unused on the PiSP platform, so we can
use one of them to get an average Y value for the whole image.

If an algorithm (such as the "lux" algorithm) wants a scene-referred
estimate of absolute brightness, then this would be a better choice
than a value from Y histogram as the latter is not invariant to the
metering mode (e.g. centre-weighted, spot etc.). (So note that for the
AGC/AEC algorithm, where the metering mode is relevant, the Y
histogram is the appropriate choice.)

We also fix the loop that copies the hardware's floating region values
into our statistics structure; it was using the wrong limit which was
causing it not to do anything.

A future commit will update the lux algorithm to use this feature.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
David Plowman
2025-10-23 12:49:15 +01:00
committed by Kieran Bingham
parent 17ee3b6089
commit 3bc722b5da
+7 -1
View File
@@ -533,7 +533,7 @@ RPiController::StatisticsPtr IpaPiSP::platformProcessStats(Span<uint8_t> mem)
/* AGC region sums only get collected on floating zones. */
statistics->agcRegions.init({ 0, 0 }, PISP_FLOATING_STATS_NUM_ZONES);
for (i = 0; i < statistics->agcRegions.numRegions(); i++)
for (i = 0; i < PISP_FLOATING_STATS_NUM_ZONES; i++)
statistics->agcRegions.setFloating(i,
{ { 0, 0, 0, stats->agc.floating[i].Y_sum },
stats->agc.floating[i].counted, 0 });
@@ -1075,6 +1075,12 @@ void IpaPiSP::setStatsAndDebin()
*/
setHistogramWeights();
/* Configure the first AGC floating region to cover the whole image, for the lux algo. */
pisp_fe_floating_stats_config floatingStatsConfig = {};
floatingStatsConfig.regions[0].size_x = mode_.width;
floatingStatsConfig.regions[0].size_y = mode_.height;
fe_->SetFloatingStats(floatingStatsConfig);
pisp_be_global_config beGlobal;
be_->GetGlobal(beGlobal);