[libcamera-devel] [PATCH v1 0/6] IPA RkISP1 awb and misc improvements

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Thu Dec 2 19:04:04 CET 2021


Hello,

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

First, the imx219 is a non linear CMOS sensor and its channels are
compressed. In order to have a better exposed output frame, we need to
apply a deGamma curve on the raw pixels, which is done by a simple
look-up table on the ISP side. The values are taken from the imx219.json
tuning file in the RPi IPA.

The next algorithm is the black level correction. The output is washed
out if no black correction is applied. Again, use the tuning values from
the imx219 data file in RPi.

Now, we 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.

Next, the color correction matric needs to be a bit modified as the
default one is a simple identity matrix. A very simple estimation uses
the red and blue gains calculated but a real tuning file would be
better, based on color temperature as the imx219 data file.

Last patch 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.

I wanted to post captured images for each of those algorithm to see the
evolution but I accidentaly broke my sd card connector... and I am now
stuck until I can repair it... :-(

Jean-Michel Hautbois (6):
  ipa: rkisp1: Introduce sensor degamma
  ipa: rkisp1: Use frame index
  ipa: rkisp1: Introduce Black Level Correction
  ipa: rkisp1: Introduce AWB
  ipa: rkisp1: Introduce crosstalk correction
  ipa: rkisp1: agc: Introduce histogram calculation

 src/ipa/rkisp1/algorithms/agc.cpp     |  92 +++++++++++++---
 src/ipa/rkisp1/algorithms/agc.h       |   4 +-
 src/ipa/rkisp1/algorithms/awb.cpp     | 149 ++++++++++++++++++++++++++
 src/ipa/rkisp1/algorithms/awb.h       |  33 ++++++
 src/ipa/rkisp1/algorithms/blc.cpp     |  55 ++++++++++
 src/ipa/rkisp1/algorithms/blc.h       |  30 ++++++
 src/ipa/rkisp1/algorithms/ctk.cpp     |  59 ++++++++++
 src/ipa/rkisp1/algorithms/ctk.h       |  30 ++++++
 src/ipa/rkisp1/algorithms/meson.build |   4 +
 src/ipa/rkisp1/algorithms/sdg.cpp     |  49 +++++++++
 src/ipa/rkisp1/algorithms/sdg.h       |  30 ++++++
 src/ipa/rkisp1/ipa_context.cpp        |  33 ++++++
 src/ipa/rkisp1/ipa_context.h          |  19 ++++
 src/ipa/rkisp1/rkisp1.cpp             |  19 ++--
 14 files changed, 583 insertions(+), 23 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
 create mode 100644 src/ipa/rkisp1/algorithms/ctk.cpp
 create mode 100644 src/ipa/rkisp1/algorithms/ctk.h
 create mode 100644 src/ipa/rkisp1/algorithms/sdg.cpp
 create mode 100644 src/ipa/rkisp1/algorithms/sdg.h

-- 
2.32.0



More information about the libcamera-devel mailing list