[v3,0/8] Centralise Agc into libipa
mbox series

Message ID 20240424124917.1250837-1-dan.scally@ideasonboard.com
Headers show
Series
  • Centralise Agc into libipa
Related show

Message

Dan Scally April 24, 2024, 12:49 p.m. UTC
Hello all

Version 3 of the centralised AGC series. As before the series **does** alter the
calculated shutter time and gain for both the IPU3 and RkISP1 compared to their
bespoke implementations, for two reasons:

1. A bug in the way they were implemented meant that an over-exposed image was
   corrected more slowly than an under-exposed one. This is fixed and will
   improve both IPAs' response to a too-bright image.
2. The default kRelativeLuminanceTarget is centrally set to 0.16 which matches
   the value from the IPU3 implementation. In the RkISP1 implementation that
   value was set to 0.4 with a \todo to see why they were different.
   
Without those two changes, the shutter time and gain calculated after this
series matches those calculated by their independent implementations. The second
point still requires some discussion I believe; it could be that the different
mechanisms through which we estimate luminance (which are enforced by the
different statistics we get from the hardware) means we can't have a single
target and need to have one for each algorithm...or perhaps I'm missing
something.

Thanks
Dan

Daniel Scally (7):
  ipa: libipa: Allow creation of empty Histogram
  libcamera: controls: Generate enum value-name maps
  ipa: libipa: Add AgcMeanLuminance base class
  ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance
  ipa: ipu3: Remove bespoke AGC functions from IPU3
  ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance
  ipa: rkisp1: Remove bespoke Agc functions

Paul Elder (1):
  ipa: libipa: Add ExposureModeHelper

 include/libcamera/control_ids.h.in      |   2 +
 include/libcamera/property_ids.h.in     |   2 +
 src/ipa/ipu3/algorithms/agc.cpp         | 282 ++++-------
 src/ipa/ipu3/algorithms/agc.h           |  27 +-
 src/ipa/ipu3/ipa_context.cpp            |   3 +
 src/ipa/ipu3/ipa_context.h              |   5 +
 src/ipa/ipu3/ipu3.cpp                   |   3 +-
 src/ipa/libipa/agc_mean_luminance.cpp   | 590 ++++++++++++++++++++++++
 src/ipa/libipa/agc_mean_luminance.h     |  90 ++++
 src/ipa/libipa/exposure_mode_helper.cpp | 246 ++++++++++
 src/ipa/libipa/exposure_mode_helper.h   |  53 +++
 src/ipa/libipa/histogram.cpp            |   9 +
 src/ipa/libipa/histogram.h              |   1 +
 src/ipa/libipa/meson.build              |   4 +
 src/ipa/rkisp1/algorithms/agc.cpp       | 274 +++--------
 src/ipa/rkisp1/algorithms/agc.h         |  16 +-
 src/ipa/rkisp1/ipa_context.h            |   5 +
 src/ipa/rkisp1/rkisp1.cpp               |   3 +-
 utils/gen-controls.py                   |  19 +
 19 files changed, 1207 insertions(+), 427 deletions(-)
 create mode 100644 src/ipa/libipa/agc_mean_luminance.cpp
 create mode 100644 src/ipa/libipa/agc_mean_luminance.h
 create mode 100644 src/ipa/libipa/exposure_mode_helper.cpp
 create mode 100644 src/ipa/libipa/exposure_mode_helper.h