[v1,00/11] Add Bayesian AWB algorithm to libipa and rkisp1
mbox series

Message ID 20250109115412.356768-1-stefan.klug@ideasonboard.com
Headers show
Series
  • Add Bayesian AWB algorithm to libipa and rkisp1
Related show

Message

Stefan Klug Jan. 9, 2025, 11:53 a.m. UTC
The Bayesian AWB algorithm improves the AWB performance by taking prior
likelihoods for a colour temperature given a measured lux level into
account.

The algorithm was first implemented by RaspberryPi and is documented in
the RaspberryPi camera guide. This series takes that implementation and
adapts it for the use on libipa and the rkisp1 pipeline. It still keeps
the grey world algorithm as a fallback or as a simple alternative that
does not require any tuning.

Patches 1-2 add small utility functions in lipia.

Patches 3-7 prepare for the bayes AWB integration. First some base
classes are added to be able to implement different AWB algorithms with
a common interface. Then the grey world algorithm from rkisp1 is moved
into libipa.

Patches 8-10 add the bayes AWB algorithm to libtuning and libipa and
integrate it into the rkisp1 IPA.

Patch 13 is a small fix to start the camera with better default gains.

The integration of the actual lux measurements from the Lux algorithm is
missing in this series and will be added in an upcoming version.

Best regards,
Stefan

Stefan Klug (11):
  libipa: interpolator: Add accessor to internal data
  libipa: pwl: Add clear() function
  libipa: Add AWB algorithm base class
  libipa: awb: Add helper functions for AWB mode support
  libipa: Add grey world AWB algorithm
  ipa: rkisp1: Move calculation of RGB means into own function
  ipa: rkisp1: Use grey world algorithm from libipa
  libtuning: module: awb: Add bayes AWB support
  libipa: Add bayesian AWB algorithm
  ipa: rkisp1: Add support for bayes AWB algorithm from libipa
  ipa: rkisp1: awb: Apply gains based on default colour temperature on
    start

 src/ipa/libipa/awb.cpp                       | 237 ++++++++++
 src/ipa/libipa/awb.h                         |  63 +++
 src/ipa/libipa/awb_bayes.cpp                 | 457 +++++++++++++++++++
 src/ipa/libipa/awb_bayes.h                   |  67 +++
 src/ipa/libipa/awb_grey.cpp                  | 114 +++++
 src/ipa/libipa/awb_grey.h                    |  35 ++
 src/ipa/libipa/interpolator.cpp              |  10 +-
 src/ipa/libipa/interpolator.h                |   5 +
 src/ipa/libipa/meson.build                   |   6 +
 src/ipa/libipa/pwl.cpp                       |   5 +
 src/ipa/libipa/pwl.h                         |   1 +
 src/ipa/rkisp1/algorithms/awb.cpp            | 171 ++++---
 src/ipa/rkisp1/algorithms/awb.h              |   7 +-
 utils/tuning/config-example.yaml             |  34 +-
 utils/tuning/libtuning/modules/awb/awb.py    |  16 +-
 utils/tuning/libtuning/modules/awb/rkisp1.py |  21 +-
 16 files changed, 1178 insertions(+), 71 deletions(-)
 create mode 100644 src/ipa/libipa/awb.cpp
 create mode 100644 src/ipa/libipa/awb.h
 create mode 100644 src/ipa/libipa/awb_bayes.cpp
 create mode 100644 src/ipa/libipa/awb_bayes.h
 create mode 100644 src/ipa/libipa/awb_grey.cpp
 create mode 100644 src/ipa/libipa/awb_grey.h