[0/8] Implement WDR algorithm
mbox series

Message ID 20250411130423.2164577-1-stefan.klug@ideasonboard.com
Headers show
Series
  • Implement WDR algorithm
Related show

Message

Stefan Klug April 11, 2025, 1:04 p.m. UTC
Hi all,

This series implements a global tone mapping algorithm for rkisp1. The
results are pretty nice and I still need to prepare a few slides with
actual images.

If you want to test this, it depends on a few other patches:

- [PATCH v3 0/2] media: rockchip: rkisp1: Add support for WDR and AWB64
https://lore.kernel.org/linux-media/20250225-awb64-v3-0-af29b1201e48@ideasonboard.com/

- [PATCH v3 00/16] Some rkisp1 awb improvements
https://patchwork.libcamera.org/project/libcamera/list/?series=5111

- [PATCH v2 0/9] Wdr preparations
https://patchwork.libcamera.org/project/libcamera/list/?series=5121

To enable the WDR algorithm the following entry needs to be present in
the tuning file:

algorithms:
  - WideDynamicRange:
      ExposureConstraint:
        MaxBrightPixels: 0.02
        yTarget: 0.95
      MinExposureValue: -4.0


The details of the algorithms are explained in patch 6/8, so I won't
repeat them here. The last two patches add debug metadata that is useful
for development. I'm still a bit undecided, if that should be mainlined.
If anyone is curious, there is a camshark branch available that
visualizes the curves and metadata:
https://gitlab.freedesktop.org/camera/camshark/-/tree/sklug/next?ref_type=heads

Best regards,
Stefan


Jai Luthra (1):
  include: linux: Add Wdr to rkisp1-config.h

Stefan Klug (7):
  tuning: rksip1: Add a static WideDynamicRange entry
  libcamera: Add PID controller class
  ipa: rkisp1: Add correction for exposure quantization
  ipa: rkisp1: Switch histogram to RGB combined mode
  ipa: rkisp1: Add WDR algorithm
  libcamera: vector: Add explicit cast and data accessor
  ipa: rkisp1: agc: Add debug controls for statistic values

 include/libcamera/internal/meson.build      |   1 +
 include/libcamera/internal/pid_controller.h |  46 ++
 include/libcamera/internal/vector.h         |  11 +
 include/linux/rkisp1-config.h               |  72 +++
 src/ipa/rkisp1/algorithms/agc.cpp           |  20 +-
 src/ipa/rkisp1/algorithms/awb.cpp           |  15 +-
 src/ipa/rkisp1/algorithms/meson.build       |   1 +
 src/ipa/rkisp1/algorithms/wdr.cpp           | 502 ++++++++++++++++++++
 src/ipa/rkisp1/algorithms/wdr.h             |  63 +++
 src/ipa/rkisp1/ipa_context.h                |  12 +
 src/ipa/rkisp1/params.cpp                   |   1 +
 src/ipa/rkisp1/params.h                     |   2 +
 src/libcamera/control_ids_debug.yaml        |  36 +-
 src/libcamera/control_ids_draft.yaml        |  67 +++
 src/libcamera/meson.build                   |   1 +
 src/libcamera/pid_controller.cpp            | 169 +++++++
 src/libcamera/vector.cpp                    |  18 +
 utils/tuning/rkisp1.py                      |   7 +-
 18 files changed, 1036 insertions(+), 8 deletions(-)
 create mode 100644 include/libcamera/internal/pid_controller.h
 create mode 100644 src/ipa/rkisp1/algorithms/wdr.cpp
 create mode 100644 src/ipa/rkisp1/algorithms/wdr.h
 create mode 100644 src/libcamera/pid_controller.cpp