[libcamera-devel,v2,00/11] ipa: rkisp1: Add autofocus algorithm
mbox series

Message ID 20220713084317.24268-1-dse@thaumatec.com
Headers show
Series
  • ipa: rkisp1: Add autofocus algorithm
Related show

Message

Daniel Semkowicz July 13, 2022, 8:43 a.m. UTC
Hello,

The following set of patches introduces an autofocus algorithm for
rkisp1 platforms. As there are common parts of code in the IPU3, RPi and
now they would be repeated in rkisp1, I tried to separate the main
control part of the AF algorithm in the new AfHillClimbing class.

These changes make use of the freshly introduced algorithm registration
mechanism. As there was a missing part for the easy way to get the
specific algorithm from the dynamically loaded list, I added
getAlgorithm<AlgoType>() method to the Module class that. It was
implemented in the fastest way to get it working, but I think we should
improve it later. Maybe it would be good to extend algorithm creation
and store also the name of corresponding algorithm to allow calling it
by name instead of type. Especially that algorithms are loaded from
tuning file by name.

I am not sure if the directory structure I have chosen for the common
code is a good place, so please correct me if I should place it
somewhere else.

Doxygen documentation part should be, for sure, more detailed, but I
firstly want to wait for your comments about the code, just in case if
there were any changes to the design.

These changes depend on the "libcamera: rkisp1: Add lens control"
changes that are still in the review process.
Link: https://patchwork.libcamera.org/project/libcamera/list/?series=3228

Changes in v2:
- Skip frames in some situations to ensure correct AF calculation
  (Add patches: 9-11)

I am waiting for your comments :)

Best regards
Daniel Semkowicz

Daniel Semkowicz (11):
  ipa: Add base class defining AF algorithm interface
  ipa: Add class that implements base AF control algorithm
  ipa: rkisp1: Add AF algorithm basing on common AfHillClimbing class
  pipeline: rkisp1: Add basic AF controls to the supported controls list
  ipa: module: Add getAlgorithm() method
  ipa: rkisp1: Pass requests setting AF controls to the AF algorithm
  ipa: rkisp1: Add OV5675 tuning file
  ipa: rkisp1: Add "Windows" Metering mode to auto focus algorithm
  ipa: af_hill_climb: Skip the first frame after triggering auto focus
  ipa: rkisp1: af: Skip few frames after changing lens position
  ipa: rkisp1: af: Skip one frame after changing the AF window

 src/ipa/libipa/algorithms/af_algorithm.cpp    |  78 +++++
 src/ipa/libipa/algorithms/af_algorithm.h      |  41 +++
 .../libipa/algorithms/af_hill_climbing.cpp    |  97 +++++++
 src/ipa/libipa/algorithms/af_hill_climbing.h  | 272 ++++++++++++++++++
 src/ipa/libipa/algorithms/meson.build         |  11 +
 src/ipa/libipa/meson.build                    |   6 +
 src/ipa/libipa/module.cpp                     |   7 +
 src/ipa/libipa/module.h                       |  17 ++
 src/ipa/rkisp1/algorithms/af.cpp              | 136 +++++++++
 src/ipa/rkisp1/algorithms/af.h                |  44 +++
 src/ipa/rkisp1/algorithms/meson.build         |   1 +
 src/ipa/rkisp1/data/meson.build               |   1 +
 src/ipa/rkisp1/data/ov5675.yaml               |  12 +
 src/ipa/rkisp1/rkisp1.cpp                     |  72 ++++-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  12 +-
 15 files changed, 801 insertions(+), 6 deletions(-)
 create mode 100644 src/ipa/libipa/algorithms/af_algorithm.cpp
 create mode 100644 src/ipa/libipa/algorithms/af_algorithm.h
 create mode 100644 src/ipa/libipa/algorithms/af_hill_climbing.cpp
 create mode 100644 src/ipa/libipa/algorithms/af_hill_climbing.h
 create mode 100644 src/ipa/libipa/algorithms/meson.build
 create mode 100644 src/ipa/rkisp1/algorithms/af.cpp
 create mode 100644 src/ipa/rkisp1/algorithms/af.h
 create mode 100644 src/ipa/rkisp1/data/ov5675.yaml