[libcamera-devel] [RFC PATCH 0/3] RPi: Introduce AF algorithm

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Wed Mar 23 14:38:56 CET 2022


Hello !

I proposed to add the lens controls with ancillary links support in a
previous series [1] but it seems more interesting to have it on top of
an AF algorithm.

The first patch in this series introduces Kate's algorithm used by the
IPU3IPA which is a contrast-based one. I adapted it a bit, as the
statistics on RPi are not the same, and I simplified it a bit, using
only one of the filters and all the regions (ie, it calculates a focus
on the scene, and not only on the center of this scene).

This is posted as a RFC, as it lacks a few things:
- Kieran mentionned that the entityControls in the RPi pipeline handler
  should be emplaced into a map using an enum. I tried to do it, but I
  am no jinja2 expert, and it takes me too much time for something
  supposed to be easy :-). Help appreciated here (;-) ;-)).
- The algorithm is not using any controls while David proposed those in
  [3]. I am planning to do it, at least to pass a region and send back
  the focus lens position but -ENOTIME yet.

David, Naushir, Laurent, Kieran, I am not sure about the copyrights and
licenses, please comment :-).

Thanks !

---
[1]: https://patchwork.libcamera.org/project/libcamera/list/?series=2969 
[2]: https://patchwork.libcamera.org/project/libcamera/list/?series=2957

Jean-Michel Hautbois (3):
  ipa: raspberrypi: Introduce an autofocus algorithm
  libcamera: raspberrypi: Control the lens from pipeline
  ipa: raspberrypi: Control the lens position

 include/libcamera/ipa/raspberrypi.mojom       |   1 +
 .../raspberrypi/controller/af_algorithm.hpp   |  20 ++
 src/ipa/raspberrypi/controller/af_status.h    |  31 +++
 src/ipa/raspberrypi/controller/focus_status.h |   3 +
 src/ipa/raspberrypi/controller/iob/af.cpp     | 231 ++++++++++++++++++
 src/ipa/raspberrypi/controller/iob/af.h       |  55 +++++
 src/ipa/raspberrypi/meson.build               |   1 +
 src/ipa/raspberrypi/raspberrypi.cpp           |  36 ++-
 .../pipeline/raspberrypi/raspberrypi.cpp      |  17 ++
 9 files changed, 393 insertions(+), 2 deletions(-)
 create mode 100644 src/ipa/raspberrypi/controller/af_algorithm.hpp
 create mode 100644 src/ipa/raspberrypi/controller/af_status.h
 create mode 100644 src/ipa/raspberrypi/controller/iob/af.cpp
 create mode 100644 src/ipa/raspberrypi/controller/iob/af.h

-- 
2.32.0



More information about the libcamera-devel mailing list