{"id":18142,"url":"https://patchwork.libcamera.org/api/1.1/patches/18142/?format=json","web_url":"https://patchwork.libcamera.org/patch/18142/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20230119084112.20564-4-dse@thaumatec.com>","date":"2023-01-19T08:41:07","name":"[libcamera-devel,v3,3/8] ipa: Add base class defining AF algorithm interface","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"8982367172d42d575fb3496d998f8179a171f57b","submitter":{"id":126,"url":"https://patchwork.libcamera.org/api/1.1/people/126/?format=json","name":"Daniel Semkowicz","email":"dse@thaumatec.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18142/mbox/","series":[{"id":3714,"url":"https://patchwork.libcamera.org/api/1.1/series/3714/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3714","date":"2023-01-19T08:41:04","name":"ipa: rkisp1: Add autofocus algorithm","version":3,"mbox":"https://patchwork.libcamera.org/series/3714/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18142/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18142/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 E0EB8C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Jan 2023 08:42:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 89974625F5;\n\tThu, 19 Jan 2023 09:42:13 +0100 (CET)","from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FF70625D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 09:42:10 +0100 (CET)","by mail-wm1-x335.google.com with SMTP id m15so900450wms.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 00:42:10 -0800 (PST)","from localhost.localdomain (ip092042140082.rev.nessus.at.\n\t[92.42.140.82]) by smtp.gmail.com with ESMTPSA id\n\tj10-20020a05600c074a00b003db0ee277b2sm3935754wmn.5.2023.01.19.00.42.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Jan 2023 00:42:09 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674117733;\n\tbh=y3vF8V8I3AUjjNn+AFv2YT48BWnRplFjpI7zOyj/uWw=;\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=VlcMB4RW5/lTxsHyKtIsV28EwkUuAuilwVR/iKPX9iTNrMiVhjLGeenWay5Hf3R71\n\tWF6VccxNEmbJyhS6rha+Qc4Q3f9ll3a76DQeTvV1PGxEmSBYCsL7Rf7r1NDPWV8Ogr\n\tCJPoN7S9pCz02lD8dZZzuvWSlxTYDgQvipfFrp0h+C/GR61v5px8h95xe1MB2lvCcD\n\t31X8KQKTcE9JQqVQkUKRvMNlGrWEE5nOWbxCPwZHomBPZu/hmH04mjZN4+ks5R8l6f\n\t5e/46p0/OiFYJ21CHJ5g8J75tTOOWoN0zJ9fjwiSyUYiXBM3nCUYesFd3EibQTgLAL\n\thxSSlulLstpLA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Xm49jR5et7fNPrzF0NIG3A+f0aOzkc1oiwUtbL9VUBg=;\n\tb=BltcjWGNEKiKttvTJwsFXyVAh7Kt2ucu4MFXdB4+BGD1RYw9gZRrCXYsjx0ld0Dl5K\n\tj1TlKVMBfjOxI/LhR/1ickVLvTAGIo2jUXddVchHVfWveYOV3r5T4SOd9CluM2n+lfub\n\tZt2v2gzhZZTMyMxxnzmnUfAK+QAyGuQ7i28u0aqEZJMqJO5crPBRQ9CJxDk38VLO91NX\n\tpFwUk5Va/amfs1kh4yK2mbWeSZikyLgJRupgFUqwJ1h1XlU0R85oyE9ZxgLX0DAVHxYF\n\t7HxhRW2OrsL80H9xBjl21riwg/oAdFgEOVccFibGDdTnfvQ0Cn3EhGZ/Kxf9LLae6vSt\n\tbBFQ=="],"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=\"BltcjWGN\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=Xm49jR5et7fNPrzF0NIG3A+f0aOzkc1oiwUtbL9VUBg=;\n\tb=tjb8SOJb49ew1kOSXV3OtDw0roQwtgFbSvE/T2NnebDiQrla1YmKKf1Nf43Xcj3yBY\n\tydXr0AB0A98ax+uP1Rpkiee3MZKNjN+jnbfTBCVmh6aEfB9XhUhJkGaBFuXKJJkt5gzj\n\tNV1EtZjaoBIhscz6vg2CWvn6ltclc7uT61sDxy+9I2E90yPX/GoiQhXhMqLUY+rBgo2b\n\t8nIyXV0sl1fg5PsOsxB85iu+1EQifwMqTsQwPF1sjJniMGUbltp7V+f1wvAcKdf624vB\n\tvv4ZalYMhx4AruVyWNGAeAPw0monN7oIAdmdiFvOm61KSeNPcssFQTO1mCQSpFIVHZl3\n\tWasQ==","X-Gm-Message-State":"AFqh2krnxpmmrirTVnazFitTuC0vbj9q9fSK+HvgGaXq9173lAYWi2G5\n\tZH8+B9lDaUBKG5IE0SY98Xiy7oXyNcAUVUSxXoE=","X-Google-Smtp-Source":"AMrXdXujQzmcyAN+bIbLFMQ5hZEi0yJVcCYPC7THWY4HWEMMCMZQKwuSzG6D2QqZnIp7Sq1zzcKocg==","X-Received":"by 2002:a05:600c:1c2a:b0:3cf:d0b1:8aa1 with SMTP id\n\tj42-20020a05600c1c2a00b003cfd0b18aa1mr9371352wms.0.1674117729729; \n\tThu, 19 Jan 2023 00:42:09 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 19 Jan 2023 09:41:07 +0100","Message-Id":"<20230119084112.20564-4-dse@thaumatec.com>","X-Mailer":"git-send-email 2.39.0","In-Reply-To":"<20230119084112.20564-1-dse@thaumatec.com>","References":"<20230119084112.20564-1-dse@thaumatec.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 3/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_interface.cpp | 92 ++++++++++++++++++++++\n src/ipa/libipa/algorithms/af_interface.h   | 41 ++++++++++\n src/ipa/libipa/algorithms/meson.build      |  9 +++\n src/ipa/libipa/meson.build                 |  6 ++\n 4 files changed, 148 insertions(+)\n create mode 100644 src/ipa/libipa/algorithms/af_interface.cpp\n create mode 100644 src/ipa/libipa/algorithms/af_interface.h\n create mode 100644 src/ipa/libipa/algorithms/meson.build","diff":"diff --git a/src/ipa/libipa/algorithms/af_interface.cpp b/src/ipa/libipa/algorithms/af_interface.cpp\nnew file mode 100644\nindex 00000000..af341d13\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af_interface.cpp\n@@ -0,0 +1,92 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Theobroma Systems\n+ *\n+ * af_interface.cpp - Autofocus control algorithm interface\n+ */\n+\n+#include \"af_interface.h\"\n+\n+/**\n+ * \\file af_interface.h\n+ * \\brief AF algorithm common interface\n+ */\n+\n+namespace libcamera::ipa::common::algorithms {\n+\n+/**\n+ * \\class AfInterface\n+ * \\brief Common interface for auto-focus algorithms\n+ * \\tparam Module The IPA module type for this class of algorithms\n+ *\n+ * The AfInterface class defines a standard interface for IPA auto focus\n+ * algorithms.\n+ */\n+\n+/**\n+ * \\fn AfInterface::setMode()\n+ * \\brief Set auto focus mode\n+ * \\param[in] mode AF mode\n+ */\n+\n+/**\n+ * \\fn AfInterface::setRange()\n+ * \\brief set the range of focus distances that is scanned\n+ * \\param[in] range AF range\n+ */\n+\n+/**\n+ * \\fn AfInterface::setSpeed()\n+ * \\brief Set how fast algorithm should move the lens\n+ * \\param[in] speed Lens move speed\n+ */\n+\n+/**\n+ * \\fn AfInterface::setMeteringMode()\n+ * \\brief Set AF metering mode\n+ * \\param[in] metering AF metering mode\n+ */\n+\n+/**\n+ * \\fn AfInterface::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 AfInterface::setTrigger()\n+ * \\brief Starts or cancels the autofocus scan\n+ * \\param[in] trigger Trigger mode\n+ */\n+\n+/**\n+ * \\fn AfInterface::setPause()\n+ * \\brief Pause the autofocus while in AfModeContinuous mode.\n+ * \\param[in] pause Pause mode\n+ */\n+\n+/**\n+ * \\fn AfInterface::setLensPosition()\n+ * \\brief Set the lens position while in AfModeManual\n+ * \\param[in] lensPosition Lens position\n+ */\n+\n+/**\n+ * \\fn AfInterface::getState()\n+ * \\brief Get the current state of the AF algorithm\n+ * \\return AF state\n+ */\n+\n+/**\n+ * \\fn AfInterface::getPauseState()\n+ * \\brief Get the current pause state of the AF algorithm.\n+ * \\return AF pause state\n+ *\n+ * Only applicable in continuous (AfModeContinuous) mode. In other modes,\n+ * AfPauseStateRunning is always returned.\n+ */\n+\n+} /* namespace libcamera::ipa::common::algorithms */\ndiff --git a/src/ipa/libipa/algorithms/af_interface.h b/src/ipa/libipa/algorithms/af_interface.h\nnew file mode 100644\nindex 00000000..b6b7bea6\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af_interface.h\n@@ -0,0 +1,41 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Theobroma Systems\n+ *\n+ * af_interface.h - Autofocus control algorithm interface\n+ */\n+#pragma once\n+\n+#include <libcamera/control_ids.h>\n+\n+namespace libcamera::ipa::common::algorithms {\n+\n+class AfInterface\n+{\n+public:\n+\tAfInterface() = default;\n+\n+\tvirtual ~AfInterface() {}\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 setMeteringMode(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+\tvirtual controls::AfStateEnum getState() = 0;\n+\n+\tvirtual controls::AfPauseStateEnum getPauseState() = 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..0a1f18fa\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_interface.h',\n+])\n+\n+common_ipa_algorithms_sources = files([\n+    'af_interface.cpp',\n+])\ndiff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build\nindex 016b8e0e..0cfc551a 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@@ -8,6 +10,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@@ -16,6 +20,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","v3","3/8"]}