[libcamera-devel,v2,0/4] IPA RkISP1 awb and misc improvements
mbox series

Message ID 20220223104824.25723-1-jeanmichel.hautbois@ideasonboard.com
Headers show
Series
  • IPA RkISP1 awb and misc improvements
Related show

Message

Jean-Michel Hautbois Feb. 23, 2022, 10:48 a.m. UTC
Hello,

This series introduces several algorithms or tuning parameters for the
RkISP1 IPA.

The first algorithm is the black level correction. The output is washed
out if no black correction is applied. It uses the tuning values from
the imx219 data file in RPi.

Patch 3/4 introduces the histogram IQ mean estimation as for the IPU3
and uses the maximum of the relative luminance gain and the iqMean gain
to determine the shutter speed and analogue gain to apply.

Now, patch 4/4 can estimate the AWB gains to apply on the red and blue
channels. The RkISP1 could theoretically give us the red, green and blue
mean values for the current frame, but the kernel seems to lack support
for this. Use the YCrCb estimation instead, and convert the values to
RGB before estimating the gains. We don't have a grid of average values,
only a global mean for each channel.

I have removed two algorithms from this series: sensor degamma and
crosstalk matrix. Those need a bit more work (sdg curve may be the wrong
one according to the previous review, and the crosstalk matrix is not a
tuned one).

I have made some captures (qcam seems to invert width and height when
saving the image though):

[1]: agc only (current master): https://snipboard.io/dFO23J.jpg
[2]: [1] with histogram and black level: https://snipboard.io/fd9zC2.jpg
[3]: [2] with awb: https://snipboard.io/Sp9Ei6.jpg

This is the state with this v2 series applied on top of master.

And for the record, I picked the previous sdg and ctk algorithms to
capture with those:
[4]: [3] with sensor degamma: https://snipboard.io/5QO46g.jpg
[5]: [4] with crosstalk matrix: https://snipboard.io/tDOV7l.jpg

Jean-Michel Hautbois (4):
  ipa: rkisp1: Use frame index
  ipa: rkisp1: Introduce Black Level Correction
  ipa: rkisp1: agc: Introduce histogram calculation
  ipa: rkisp1: Introduce AWB

 src/ipa/rkisp1/algorithms/agc.cpp     | 102 ++++++++++++++---
 src/ipa/rkisp1/algorithms/agc.h       |   4 +-
 src/ipa/rkisp1/algorithms/awb.cpp     | 155 ++++++++++++++++++++++++++
 src/ipa/rkisp1/algorithms/awb.h       |  33 ++++++
 src/ipa/rkisp1/algorithms/blc.cpp     |  57 ++++++++++
 src/ipa/rkisp1/algorithms/blc.h       |  30 +++++
 src/ipa/rkisp1/algorithms/meson.build |   2 +
 src/ipa/rkisp1/ipa_context.cpp        |  36 ++++++
 src/ipa/rkisp1/ipa_context.h          |  19 ++++
 src/ipa/rkisp1/rkisp1.cpp             |  15 ++-
 10 files changed, 428 insertions(+), 25 deletions(-)
 create mode 100644 src/ipa/rkisp1/algorithms/awb.cpp
 create mode 100644 src/ipa/rkisp1/algorithms/awb.h
 create mode 100644 src/ipa/rkisp1/algorithms/blc.cpp
 create mode 100644 src/ipa/rkisp1/algorithms/blc.h