[0/7] softisp: Fix Saturation and Black level handling
mbox series

Message ID 20260621-kbingham-awb-saturation-v1-0-b91ea59c6cfb@ideasonboard.com
Headers show
Series
  • softisp: Fix Saturation and Black level handling
Related show

Message

Kieran Bingham June 20, 2026, 11 p.m. UTC
These patches have floated around in various forms and versions, but
this series aims to collate the main parts of fixing black level and
saturation bugs in the SoftISP for both GPU ISP and CPU ISP.

This is predominantly fixed by splitting the AWB gains out of the CCM
which has previously been 'combined'. Combining means we do not
correctly saturate at the sensor levels when applying gains. So now we
cna do that and clamp accordingly.

To get there, I've added a new clamp operation to the Vector class (and
fixed up one usage of that in the rkisp1 ... yeah - I'm trying not to go
down rabbit holes, and focus on saturation but adding a clamp was a
previous review request ...)

I've made use of Milan's existing Black Level Correction fixes, and
picked up and applied all previous review comments and refactoring to
get here.

So far - this is tested on my x13s laptop (with an arbitrary tuning file
to make sure the CCM is tested) for both GPU and CPU ISP....

Please test if you can and I'm really keen to merge these so that
both Jacopo's and Bryan's work can be rebased on top.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
Kieran Bingham (4):
      libcamera: vector: Add clamp operation
      ipa: rkisp1: awb: Utilise clamp function
      softisp: Split AWB from Combined Matrix
      shaders: bayer: Use native matrix multiplication

Milan Zamazal (3):
      ipa: simple: Limit the black level value
      libcamera: software_isp: Fix black level application in GPU ISP
      libcamera: software_isp: Fix black level handling in CPU ISP

 include/libcamera/internal/vector.h        |  8 ++++
 src/ipa/rkisp1/algorithms/awb.cpp          |  2 +-
 src/ipa/simple/algorithms/awb.cpp          | 16 ++------
 src/ipa/simple/algorithms/blc.cpp          |  7 ++--
 src/ipa/simple/ipa_context.h               |  5 +--
 src/libcamera/shaders/bayer_1x_packed.frag | 51 +++++-------------------
 src/libcamera/shaders/bayer_unpacked.frag  | 51 +++++-------------------
 src/libcamera/software_isp/debayer_cpu.cpp | 64 ++++++++++++++----------------
 src/libcamera/software_isp/debayer_egl.cpp | 18 +++------
 src/libcamera/software_isp/debayer_egl.h   |  3 ++
 src/libcamera/vector.cpp                   |  8 ++++
 test/vector.cpp                            |  1 +
 12 files changed, 83 insertions(+), 151 deletions(-)
---
base-commit: 84e1336956a78f7b416f8bd2abf747d93ad64260
change-id: 20260620-kbingham-awb-saturation-39e26bd1b580

Best regards,