From patchwork Wed Mar 23 16:01:41 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: 15525 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 2AA7CC0F1B for ; Wed, 23 Mar 2022 16:01:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F29F632E2; Wed, 23 Mar 2022 17:01:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648051311; bh=lmXaKk/h92pWA3EB7jtH/S1ZyC4jIPDVvusZ6FKa/XY=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=v1QaXQJpoX5JXEVBimz0Jz8motKI+bsibUfPJJcKpt1TAQkF6wDTVWOSI/3R+Bdcd debIRZsMKBU0ksvDLPYaITn54euvTwcywl5oadQeraLwEel/C3veiNY6Fy/n9jMYm2 JmoC77d1IMmhajqLXAeevYBM4pTVFvGiYiQ/sEhYY29806LX5MLyuTs1t9DTo8HcaY +9DwvF6bhUk90ABI4XFpdcxIhjujbz6ZIpE6sRf+o54y2ZUvZWqyVsniSJmLzpu84s tGxaZ9qDzjQrzsBvWL4Rv+MeZJH78Uwsp7uy1TdvOAPaDq2ROcollqUMtSXks/gHMT wp2nGfj+R/d1w== 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 8E92F604C4 for ; Wed, 23 Mar 2022 17:01:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="B37J4P9r"; 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 21BBE9DE; Wed, 23 Mar 2022 17:01:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648051309; bh=lmXaKk/h92pWA3EB7jtH/S1ZyC4jIPDVvusZ6FKa/XY=; h=From:To:Cc:Subject:Date:From; b=B37J4P9rVxc5O9jhgRqHChW65SWhYnLUWw/VoyKGhYk7qq+MP8s/UZ0D3jVesQAvo PpLC1tja8CFZ3pBJGpmCud/Jg7hYYL0e1w4h0Ln15eU2UBDFSqdABlnLvgPnMHzKb1 5BwL9DW8/gBV0WH+wFH7VqN42dPtcXTJUWNu6q78= To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Mar 2022 17:01:41 +0100 Message-Id: <20220323160145.90606-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 0/4] 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. In v2, I also included the namespace renaming, I wanted it in v1 but missed it... 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 (4): ipa: RPi: Move the IPA to the ipa::RPi namespace 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 | 84 +++++-- .../pipeline/raspberrypi/raspberrypi.cpp | 17 ++ 9 files changed, 423 insertions(+), 20 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