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

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Mar 23 16:05:09 CET 2022


Hi JM,


Quoting Jean-Michel Hautbois via libcamera-devel (2022-03-23 13:36:19)
> Hello !
> 

I tried to test this, and manually added:

pi at earth:~/libcamera $ git diff
diff --git a/src/ipa/raspberrypi/data/imx519.json b/src/ipa/raspberrypi/data/imx519.json
index 2ce6a08c..471eadca 100644
--- a/src/ipa/raspberrypi/data/imx519.json
+++ b/src/ipa/raspberrypi/data/imx519.json
@@ -6,6 +6,9 @@
     "rpi.dpc":
     {
     },
+    "iob.af":
+    {
+    },
     "rpi.lux":
     {
         "reference_shutter_speed": 13841,

But I get:

[0:28:09.864859899] [1784] INFO RPI raspberrypi.cpp:750 Sensor: /base/soc/i2c0mux/i2c at 1/imx519 at 1a - Selected sensor format: 1280x720-SRGGB10_1X10 - Selected unicam format: 1280x720-pRAA
[0:28:10.097112600] [1789] DEBUG IoBAf af.cpp:164  Previous step is 0 Current step is 30
terminate called after throwing an instance of 'std::bad_any_cast'
  what():  bad any_cast
Aborted

Is there something obvious that I've missed to test?
--
Kieran

> 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 !
> 
> 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