[0/5] Fix and improve full image Y statistics
mbox series

Message ID 20251017102704.3887-1-david.plowman@raspberrypi.com
Headers show
Series
  • Fix and improve full image Y statistics
Related show

Message

David Plowman Oct. 17, 2025, 10:05 a.m. UTC
Hi

This small set of patches improves the calculation of the scene
average Y value as used by the "lux" algorithm.

The previous calculation had some problems, most glaringly that it
wasn't invariant to the AGC metering mode - and the whole point of the
"lux" algorithm is supposed to be to calculate a purely scene
dependent number!

So we update both VC4 and PiSP platforms to have a "floating
statistics region" where we can accumulate a full image Y value. We
actually have hardware for this on the PiSP, but for VC4 we are able
to "synthesize" such a floating region from the other statistics that
we have.

These changes are good in themselves, but were also motivated by
wanting more reliable lux measurements for the forthcoming neural
network AWB algorithm.

A couple of other minor related things are fixed in passing, such as
making the lux algorithm use the camera mode sensitivity correctly (as
it was simply being ignored).

Thanks!

David

David Plowman (5):
  ipa: rpi: Fix the set function for floating statistics regions
  ipa: rpi: lux: Handle camera mode sensitivity correctly
  ipa: rpi: pisp: Use a floating region to get whole image Y statistics
  ipa: rpi: vc4: Use a floating statistics region for a full image Y sum
  ipa: rpi: lux: Use floating statistics region to obtain the current Y
    value

 src/ipa/rpi/controller/region_stats.h |  2 +-
 src/ipa/rpi/controller/rpi/lux.cpp    | 24 +++++++++++++++----
 src/ipa/rpi/controller/rpi/lux.h      |  3 +++
 src/ipa/rpi/pisp/pisp.cpp             |  8 ++++++-
 src/ipa/rpi/vc4/vc4.cpp               | 33 +++++++++++++++++++++++++--
 5 files changed, 62 insertions(+), 8 deletions(-)