From patchwork Wed Mar 23 13:36:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 15514 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 50653C0F1B for ; Wed, 23 Mar 2022 13:36:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6ED68604D5; Wed, 23 Mar 2022 14:36:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648042588; bh=LqZRP45lUVjzLVS6N0v6YA+UVE9sUV6T7S+YXPhmWgM=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Mzwb7hSzyMLoKV4+Pm9ypdOeqwHz9IrwipXcJjXcixWo4l1hR9YgwJjqfW6Af0WXT mGcnS1DZuj/HcT9rgABITXXljQ+ohzGi20GtSsOEo+wSEtWX2I/yG3SQ1k02e343T8 tNItii/lCclkSFMqP3bKFvOJRGOFO96Ug/O1GPDcWi0ywh7XW6ViE7NuBEfGR2HK5J 1Zlog02aYST6+1ZEZss9+YWw0/BRUpfTLEkn8IEdbyvh7+JtiGdC/6bhjW4UFnkOYd Ptrwdi/17smDld29Azx02o99FP5NwJHExtJmvu4sBuKwIOzD0GirZcu6KZR+hQycTb EnLt6b3SnUzNw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BFA12604C4 for ; Wed, 23 Mar 2022 14:36:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TRBQA1m7"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:2e05:b10:1542:d51b]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C7C8FFD; Wed, 23 Mar 2022 14:36:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648042586; bh=LqZRP45lUVjzLVS6N0v6YA+UVE9sUV6T7S+YXPhmWgM=; h=From:To:Cc:Subject:Date:From; b=TRBQA1m7llObQn0XFgscT/WNOMbEoXaVvW2dg6Npp//y4gQ4cY92q4pjdEwaedpu3 G1Iz1N5x4Wm01/CQfG64ACuaf2F1TOywrNeUN+exf7gMWdG2xAswjr9LhPHa4+zHgP pDgj+eBbwZf5aKOE5vfsa8G1SLNhE+EwjUZb7BTw= To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Mar 2022 14:36:19 +0100 Message-Id: <20220323133622.61593-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 0/3] RPi: Introduce AF algorithm X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 ! 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