{"id":16483,"url":"https://patchwork.libcamera.org/api/patches/16483/?format=json","web_url":"https://patchwork.libcamera.org/patch/16483/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220630143543.39599-2-dse@thaumatec.com>","date":"2022-06-30T14:35:36","name":"[libcamera-devel,1/8] ipa: Add base class defining AF algorithm interface","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"61c6f349cfbd0172f3155f7c0731276eda2c152d","submitter":{"id":126,"url":"https://patchwork.libcamera.org/api/people/126/?format=json","name":"Daniel Semkowicz","email":"dse@thaumatec.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16483/mbox/","series":[{"id":3239,"url":"https://patchwork.libcamera.org/api/series/3239/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3239","date":"2022-06-30T14:35:35","name":"ipa: rkisp1: Add autofocus algorithm","version":1,"mbox":"https://patchwork.libcamera.org/series/3239/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16483/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16483/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 49A43BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 14:35:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F3D1B65633;\n\tThu, 30 Jun 2022 16:35:54 +0200 (CEST)","from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC16565633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 16:35:51 +0200 (CEST)","by mail-wr1-x42f.google.com with SMTP id v14so27588240wra.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 07:35:51 -0700 (PDT)","from localhost.localdomain (ip092042140082.rev.nessus.at.\n\t[92.42.140.82]) by smtp.gmail.com with ESMTPSA id\n\tr5-20020a05600c320500b0039db500714fsm6405945wmp.6.2022.06.30.07.35.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 30 Jun 2022 07:35:50 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656599755;\n\tbh=6vuxPUsFppSJnT7Dl58T841m9nlsFUiJheooK2pk4Jo=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=WCk6GGjBRb9A5e2J1m5PP6WnfmJZBolYvwJLVBkIcB4MJ+B2CXDiotcCpttVyrgwG\n\tNSdHa7Oybu+dgfQR2y2CT6ZiJ/p9YkaKbUzrnM6U3jow8FsMQgLAA/gQQlHoYRNdLV\n\t7yrqfwYwWhj8squzk5FLgkMeQAmix+bl5V5GoJwqNl6yUMckwV6liYHUZrxEpOM8Z8\n\t0YxE7d6Yye41nOB+Yepew2DaMenUd5Ts+ub3gSVeLsyXZfO3Ix2VROEGMDfhfSbQ0V\n\tb11YJGxpmbOtDJ4OaQfy3+pqImsRzZAWeQGMx6uip0GoNJMY0KiRh2QUCa71cEFSxy\n\tUBSXJdgSxSehA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=s9hXRdoqeXHWPH716obtEfzwRxtV5yA4ljxL4a2zDs0=;\n\tb=xTVj8s70Sc8u4qsU0D5et4tq5eCLPNLFEx+M+k9lasnM3G11vCTeWPK4XXlBqtxBLC\n\taN8O//fN8CXmgyRbe9QoOpKiwPNxDvnnTan/fBG/h1uSJdc52YwVnrp7ycfeFZkplf8S\n\tpycX7OVEKcBuM5fzT4UMsSnYvDoXbGU1W/p8Ns74PGCoOkDcHPq6K1tBVtYbJi1RNjIH\n\tZPEBbzOEnTZbmH19g/mxdKqghZBk0L2hozFz90LpuQNUkyM/wtbbgl71zbBMnG1TnR3D\n\t5Dp3OZzoEvdXeD6I33egiy+Sj7AJfT46uscOB3r23Jf0+bt4fvyYxgWeM0Yg1Vn7X/AK\n\tMDXA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"xTVj8s70\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=s9hXRdoqeXHWPH716obtEfzwRxtV5yA4ljxL4a2zDs0=;\n\tb=F4b6MKZTQ96XMvD0y5qqoSrB6kjEICCFgTVA+c+8iFw8xWo4U/AgvA9z46LWdnmRCj\n\t+bM19eXd83T11DRdOT+OchXD9iNRUl1x1N6KX8EuNcSycsVVxC2WsDBlC2JtHFUPhWVJ\n\tNFsHd3os/RWBvvAE3Akm2ekBwW3B7kEK/yc/AfCxCvoDaELcBjreM6vRXzO8Q9/OVMTo\n\tBA1OMDZDXuMas2Ys1B2Me+yhk27Lxpep0ujsAKN7o1L1epJ6U2gSsbEVPTQI/3rSfADn\n\tJWDeqs0UpF/gDbyetsxQMVi/nwZZkV06hpSM3kR64QKlTtDkuPrSyO0DFyYV46zrG4U6\n\tLltg==","X-Gm-Message-State":"AJIora/6hlHFpQ3N/F+W42eRx6LDD1HHyrbBuLfGd34AabCzKaXHrWcN\n\tQ/AFlxOG6+0Zfo2r3fQlb6lmw2LWNb+OgQ==","X-Google-Smtp-Source":"AGRyM1tZIkgZYXu3aDCo43nuaE7SfxWcl+f/yPE+i95qaCKlTXokDkEpdGb4KsGV8kTQvMotbXEUKA==","X-Received":"by 2002:adf:f34c:0:b0:21b:9938:b7d0 with SMTP id\n\te12-20020adff34c000000b0021b9938b7d0mr8636965wrp.215.1656599751654; \n\tThu, 30 Jun 2022 07:35:51 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 30 Jun 2022 16:35:36 +0200","Message-Id":"<20220630143543.39599-2-dse@thaumatec.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220630143543.39599-1-dse@thaumatec.com>","References":"<20220630143543.39599-1-dse@thaumatec.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/8] ipa: Add base class defining AF\n\talgorithm interface","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Daniel Semkowicz <dse@thaumatec.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Define common interface with basic functions that should be supported\nby Auto Focus algorithms.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n src/ipa/libipa/algorithms/af_algorithm.cpp | 77 ++++++++++++++++++++++\n src/ipa/libipa/algorithms/af_algorithm.h   | 39 +++++++++++\n src/ipa/libipa/algorithms/meson.build      |  9 +++\n src/ipa/libipa/meson.build                 |  6 ++\n 4 files changed, 131 insertions(+)\n create mode 100644 src/ipa/libipa/algorithms/af_algorithm.cpp\n create mode 100644 src/ipa/libipa/algorithms/af_algorithm.h\n create mode 100644 src/ipa/libipa/algorithms/meson.build","diff":"diff --git a/src/ipa/libipa/algorithms/af_algorithm.cpp b/src/ipa/libipa/algorithms/af_algorithm.cpp\nnew file mode 100644\nindex 00000000..1c4d981a\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af_algorithm.cpp\n@@ -0,0 +1,77 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Theobroma Systems\n+ *\n+ * af_algorithm.cpp - autofocus algorithm interface\n+ */\n+\n+#include \"af_algorithm.h\"\n+\n+/**\n+ * \\file af_algorithm.h\n+ * \\brief AF algorithm common interface\n+ */\n+\n+namespace libcamera::ipa::common::algorithms {\n+\n+/**\n+ * \\class AfAlgorithm\n+ * \\brief Common interface for auto-focus algorithms\n+ * \\tparam Module The IPA module type for this class of algorithms\n+ *\n+ * The AfAlgorithm class defines a standard interface for IPA auto focus\n+ * algorithms.\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setMode()\n+ * \\brief Set auto focus mode\n+ * \\param[in] mode AF mode\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setRange()\n+ * \\brief set the range of focus distances that is scanned\n+ * \\param[in] range AF range\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setSpeed()\n+ * \\brief Set how fast algorithm should move the lens\n+ * \\param[in] speed Lens move speed\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setMetering()\n+ * \\brief Set AF metering mode\n+ * \\param[in] metering AF metering mode\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setWindows()\n+ * \\brief Set AF windows\n+ * \\param[in] windows AF windows\n+ *\n+ * Sets the focus windows used by the AF algorithm when AfMetering is set\n+ * to AfMeteringWindows.\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setTrigger()\n+ * \\brief Starts or cancels the autofocus scan\n+ * \\param[in] trigger Trigger mode\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setPause()\n+ * \\brief Pause the autofocus while in AfModeContinuous mode.\n+ * \\param[in] pause Pause mode\n+ */\n+\n+/**\n+ * \\fn AfAlgorithm::setLensPosition()\n+ * \\brief Set the lens position while in AfModeManual\n+ * \\param[in] lensPosition Lens position\n+ */\n+\n+} /* namespace libcamera::ipa::common::algorithms */\ndiff --git a/src/ipa/libipa/algorithms/af_algorithm.h b/src/ipa/libipa/algorithms/af_algorithm.h\nnew file mode 100644\nindex 00000000..89db591b\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af_algorithm.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Theobroma Systems\n+ *\n+ * af_algorithm.h - autofocus algorithm interface\n+ */\n+#pragma once\n+\n+#include <libcamera/control_ids.h>\n+\n+#include \"../algorithm.h\"\n+\n+namespace libcamera::ipa::common::algorithms {\n+\n+template<typename Module>\n+class AfAlgorithm : public Algorithm<Module>\n+{\n+public:\n+\tAfAlgorithm() = default;\n+\tvirtual ~AfAlgorithm() {}\n+\n+\tvirtual void setMode(controls::AfModeEnum mode) = 0;\n+\n+\tvirtual void setRange(controls::AfRangeEnum range) = 0;\n+\n+\tvirtual void setSpeed(controls::AfSpeedEnum speed) = 0;\n+\n+\tvirtual void setMetering(controls::AfMeteringEnum metering) = 0;\n+\n+\tvirtual void setWindows(Span<const Rectangle> windows) = 0;\n+\n+\tvirtual void setTrigger(controls::AfTriggerEnum trigger) = 0;\n+\n+\tvirtual void setPause(controls::AfPauseEnum pause) = 0;\n+\n+\tvirtual void setLensPosition(float lensPosition) = 0;\n+};\n+\n+} /* namespace libcamera::ipa::common::algorithms */\ndiff --git a/src/ipa/libipa/algorithms/meson.build b/src/ipa/libipa/algorithms/meson.build\nnew file mode 100644\nindex 00000000..ab8da13a\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/meson.build\n@@ -0,0 +1,9 @@\n+# SPDX-License-Identifier: CC0-1.0\n+\n+common_ipa_algorithms_headers = files([\n+    'af_algorithm.h',\n+])\n+\n+common_ipa_algorithms_sources = files([\n+    'af_algorithm.cpp',\n+])\ndiff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build\nindex fb894bc6..1fc3fd56 100644\n--- a/src/ipa/libipa/meson.build\n+++ b/src/ipa/libipa/meson.build\n@@ -1,5 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n+subdir('algorithms')\n+\n libipa_headers = files([\n     'algorithm.h',\n     'camera_sensor_helper.h',\n@@ -7,6 +9,8 @@ libipa_headers = files([\n     'module.h',\n ])\n \n+libipa_headers += common_ipa_algorithms_headers\n+\n libipa_sources = files([\n     'algorithm.cpp',\n     'camera_sensor_helper.cpp',\n@@ -14,6 +18,8 @@ libipa_sources = files([\n     'module.cpp',\n ])\n \n+libipa_sources += common_ipa_algorithms_sources\n+\n libipa_includes = include_directories('..')\n \n libipa = static_library('ipa', [libipa_sources, libipa_headers],\n","prefixes":["libcamera-devel","1/8"]}