[RFC,v2,0/8] LSC for SoftISP simple pipeline
mbox series

Message ID 20260420183949.110548-1-mzamazal@redhat.com
Headers show
Series
  • LSC for SoftISP simple pipeline
Related show

Message

Milan Zamazal April 20, 2026, 6:39 p.m. UTC
Hi everyone,

Over the last few months we (students from THUAS) have been working on adding LSC support to
the SoftISP simple pipline. These patches are the result of those
efforts. The project was under the supervision of Hans de Goede.

There are patches to both the GpuISP and some scrips for generating the
corrections tables.

The changes to the GpuISP are integrated as an algorithm, including
automatically choosing a correction table based on the measured colour
temperature.

The current version of the LSC textures make use of the type GLubyte instead of float. This is because we could not get floating points values to play nice with the shader. The result is that the LSC factors ranging from 1.0 to 4.0 are maped to 0 to 255.

The last patch (HACK: Add test LSC to src/ipa/simple/data/uncalibrated.yaml) adds sample data to uncalibrated.yaml file for testing, and is a reference of how the tables should (currently) be structured.

Regards,
Xander Pronk,
Rick ten Wolde,
Derek Gielen,
Aron Dosti.

v2 by Milan Zamazal:

- Remaining issues from the reviews (hopefully) addressed.
- Especially there is only a single texture now and LSC is fully
  conditional.
- Major cleanup, hacks removed or replaced, typo fixes, cosmetic
  changes, making linters happy, etc.
- See
  https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056883.html
  for an example how to add the grid data.

It’s posted as RFC because:

- It’s not yet completely tested although it seems to be working in my
  environment.
- The GPU ISP is going to be changed to multipass soon, which may
  require significant changes in this patch series.

Derek Gielen (1):
  utils/tuning: Add LSC scripts

Milan Zamazal (2):
  ipa: simple: Introduce default temperature value
  libcamera: software_isp: Pass LSC availability to debayering

Xander Pronk (5):
  libcamera: software_isp: egl: Add gl_scale_param to createTexture2D()
  libcamera: software_isp: Add LSC data to DebayerParams
  ipa: simple: Add LSC algorithm
  libcamera: shaders: Add LSC support
  libcamera: software_isp: debayer_egl: Add LSC support

 include/libcamera/internal/egl.h              |   3 +-
 .../internal/software_isp/debayer_params.h    |   5 +
 .../internal/software_isp/software_isp.h      |   1 +
 include/libcamera/ipa/soft.mojom              |   4 +-
 src/ipa/simple/algorithms/awb.cpp             |   4 +-
 src/ipa/simple/algorithms/awb.h               |   4 +-
 src/ipa/simple/algorithms/ccm.cpp             |   5 +-
 src/ipa/simple/algorithms/lsc.cpp             |  65 ++++++++++
 src/ipa/simple/algorithms/lsc.h               |  41 ++++++
 src/ipa/simple/algorithms/meson.build         |   1 +
 src/ipa/simple/ipa_context.h                  |   3 +-
 src/ipa/simple/soft_simple.cpp                |   7 +-
 src/libcamera/egl.cpp                         |   8 +-
 src/libcamera/shaders/bayer_1x_packed.frag    |   8 ++
 src/libcamera/shaders/bayer_unpacked.frag     |   8 ++
 src/libcamera/software_isp/debayer.cpp        |  19 +++
 src/libcamera/software_isp/debayer.h          |   3 +-
 src/libcamera/software_isp/debayer_cpu.cpp    |   3 +-
 src/libcamera/software_isp/debayer_cpu.h      |   3 +-
 src/libcamera/software_isp/debayer_egl.cpp    |  31 ++++-
 src/libcamera/software_isp/debayer_egl.h      |   9 +-
 src/libcamera/software_isp/software_isp.cpp   |   5 +-
 utils/tuning/exportTuningToLscShader.py       | 120 ++++++++++++++++++
 utils/tuning/generate_lsc_map_plot.py         |  76 +++++++++++
 24 files changed, 415 insertions(+), 21 deletions(-)
 create mode 100644 src/ipa/simple/algorithms/lsc.cpp
 create mode 100644 src/ipa/simple/algorithms/lsc.h
 create mode 100644 utils/tuning/exportTuningToLscShader.py
 create mode 100644 utils/tuning/generate_lsc_map_plot.py