[libcamera-devel] [PATCH v2 00/13] ipa: ipu3: Fix AGC bugs

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Wed Oct 20 17:45:54 CEST 2021


Hello,

I did not know how to title this series, so I have decided to make it
appealing somehow :-). There will probably be another patch series on
top to remove all the exposure in a number of lines and use only time
values in AGC, and it should include the usage of VBLANK too, as we are
now limiting the exposure time to the current VBLANK and not modifying
it at all.

Changes in v2:
- using a structure in IPASessionConfiguration to store the
  sensor limits and pass those to the AGC
- most of the corrections asked are applied, including the nicer
  division between exposure and gain proposal from Laurent :-)
- the analogue gain set in the driver might be off the limits we would
  expect (minimum of 0 or more than 16 for instance) so it is clamped.


There are multiple things here. First, we want to use the saturation
ratio included in the AWB statistics. To make it relevant, we need to
set a threshold to decide what is a saturated cell (patch 1/13) and use
this ratio to avoid including too much saturated cells in the Grey World
computation (3/13).

While debugging it, it appeared we are not setting the frameContext
variables before IPAIPU3::start() is called, while we are setting
controls in it which use the frameContext (2/13).

We have a small patch 4/13 which is here to lower the limit under which
we are not calculating the red and blue gains for white balance.

Then, from patch 5/13 to 13/13 it is multiple fixes like renaming
variables, changing the way the exposure and gains are calculated, etc.

All of those should make the algorithm easier to follow, and the
documentation should be added on top of that, in the coming shortly v2
of "Document IPU3 IPA".

Jean-Michel Hautbois (13):
  ipa: ipu3: awb: Set a threshold for the green saturation
  ipa: ipu3: set frameContext before controls
  ipa: ipu3: awb: Use saturation under 90%
  ipa: ipu3: awb: Change minimal green threshold value
  ipa: ipu3: agc: Rename exposure values properly
  ipa: ipu3: agc: Change exposure limits
  ipa: ipu3: agc: Change analogue gain limits
  ipa: ipu3: agc: Simplify division of exposure/gain
  ipa: ipu3: agc: Rename gains properly
  ipa: ipu3: agc: Introduce previous exposure value
  ipa: ipu3: agc: Remove condition on exposure correction
  ipa: ipu3: agc: Remove unused variables
  ipa: ipu3: Use sensor limits for analogue gain

 src/ipa/ipu3/algorithms/agc.cpp | 142 ++++++++++++++++----------------
 src/ipa/ipu3/algorithms/agc.h   |  11 ++-
 src/ipa/ipu3/algorithms/awb.cpp |  59 +++++++++++--
 src/ipa/ipu3/algorithms/awb.h   |   1 +
 src/ipa/ipu3/ipa_context.h      |   9 ++
 src/ipa/ipu3/ipu3.cpp           |  64 ++++++++++++--
 6 files changed, 197 insertions(+), 89 deletions(-)

-- 
2.32.0



More information about the libcamera-devel mailing list