Patch Detail
Show a patch.
GET /api/1.1/patches/18510/?format=api
{ "id": 18510, "url": "https://patchwork.libcamera.org/api/1.1/patches/18510/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18510/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20230331081930.19289-4-dse@thaumatec.com>", "date": "2023-03-31T08:19:23", "name": "[libcamera-devel,v6,03/10] ipa: Add base class defining AF algorithm interface", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4f52af11af9c107f94b22e9e2b405e704738e5c5", "submitter": { "id": 126, "url": "https://patchwork.libcamera.org/api/1.1/people/126/?format=api", "name": "Daniel Semkowicz", "email": "dse@thaumatec.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18510/mbox/", "series": [ { "id": 3831, "url": "https://patchwork.libcamera.org/api/1.1/series/3831/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3831", "date": "2023-03-31T08:19:21", "name": "ipa: rkisp1: Add autofocus algorithm", "version": 6, "mbox": "https://patchwork.libcamera.org/series/3831/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18510/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18510/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 D25EFC329E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Mar 2023 08:19:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 152A362767;\n\tFri, 31 Mar 2023 10:19:55 +0200 (CEST)", "from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com\n\t[IPv6:2a00:1450:4864:20::12e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A41162742\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 10:19:49 +0200 (CEST)", "by mail-lf1-x12e.google.com with SMTP id c29so27905491lfv.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 01:19:49 -0700 (PDT)", "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tt1-20020ac24c01000000b004e84a8c3d86sm281459lfq.42.2023.03.31.01.19.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 31 Mar 2023 01:19:48 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680250795;\n\tbh=hddsXWR2vySXjVpsnZ93ib9JXqd0WuueVyXpXXwMAIg=;\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=InR8s/ms3HKvAIa5bOtGKC8w3wgSvAYSsT4Zfiwgu0oDTAH+RrOCiIHiITCZoTZUO\n\tjLeJ6KCX8dsGEw4fsBNAPrt9986xSavWBVE+aoF9RlIStruHkwOA5b78a9BjbEdU/O\n\tDepvKPMku1tZbAtDe0lYSDOKwJXilGd+MwkXVMv8qzs/1AWf6pB/du+09hlrd/nVCk\n\t7YdHa6s4GbYilI3NH4lfyxoJY2pLggxg0i95+nuSkY5iAFpa6AcEY7PqxJp9TaIrGR\n\ti1+9hpn56t9uCsL7GNs6Z/auFnTcBBoJngWzaMv51r4U7QHZUS5ATmuagGCPLrqb09\n\tJ8Z++EVMfe7DA==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1680250788;\n\tx=1682842788; \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=0vjSIcrrdh6zimT8RPShagomw5h++foc4CCMLhkKG50=;\n\tb=GFqxRz6ARcwppcy/nd1I82yb70ASUoklnz78O7wjUPdgqE0MUiK60kd3jj+vvuS3c5\n\tqpYFZ2E7XAEyAHSD6AfsLE9k6QvBEaVGAZb6LQU92TSmTVOHvw3hxTdGlUdfr3q3DQwU\n\t2/OzjhtlIDZfpNCWloNsmw+27bPCvipHLPnCkiDeSMvKKCbdg925N89ERy31UfYBGdzO\n\tu4lOPDeW0sMQGV/KA7fqWBpbMLtHPMAGObJfSLmpIUXpXWRWuOubD1agT+0tTS65z6RO\n\t13P73i4RDl6yhUg2HauaLTMGOWL/Y8b4qFtAPFjSCcVnYJfz78SDPKHswojfRbBY3DCc\n\tD3Sw==" ], "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=\"GFqxRz6A\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1680250788; x=1682842788;\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=0vjSIcrrdh6zimT8RPShagomw5h++foc4CCMLhkKG50=;\n\tb=rFFNOddB9EKHrYQwD2dUap/YzfE4Z1hOP5b2fwK2tV7d8gL/1NJOicVgv9UFduWGyO\n\ttQmvV+YzWXnGbrq++fwaeCfbRl6q34isADf+McAoGgDxTi/QRex2WfKZrUBV9KyAdJr7\n\t1ePOA6x8IwA1wXpMptKOtV6gQ/VrDl+a5bCkTwgM5dU+HIB6LqUuMFLyDc2DLYvUEA9d\n\t33joGroK69W/Q4wV+qVqm1W92AVBvKfB6w4z+XCz2OCbtLEBTyHjTjBdzbkgiO2XndTq\n\tFEcsdiVxKgQJmbGqsKPpfCgEZN4QW8dj3oF0NnS2wxIKbGyLzN9zw2Xnm1GmfxizM4Ry\n\tjIxg==", "X-Gm-Message-State": "AAQBX9dWPOOg/yl5S4VJMLleHpkvrSEyJR0O0sVJ8Gh5lLL4YtWA5hE6\n\tskIPuBP5P5zzP2mE6RtD1wu/ehLBQ9SmAVoamSPf5Q==", "X-Google-Smtp-Source": "AKy350Z1ISVxuzW5Txws0lxFTK5jUukRI9XoexXbTKfPV6QWt3xF629JwEQbo1ERMHQ2NOeWXgbELQ==", "X-Received": "by 2002:ac2:494f:0:b0:4eb:2523:e929 with SMTP id\n\to15-20020ac2494f000000b004eb2523e929mr2228196lfi.43.1680250788593; \n\tFri, 31 Mar 2023 01:19:48 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 31 Mar 2023 10:19:23 +0200", "Message-Id": "<20230331081930.19289-4-dse@thaumatec.com>", "X-Mailer": "git-send-email 2.39.2", "In-Reply-To": "<20230331081930.19289-1-dse@thaumatec.com>", "References": "<20230331081930.19289-1-dse@thaumatec.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 03/10] 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 pure virtual methods that should be\nimplemented by the Auto Focus algorithm implementations.\nInterface methods match the AF controls that can be set in the frame\nrequest. Common implementation of controls parsing is provided,\nso the AF algorithms deriving from this interface should be able\nto reuse it.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n src/ipa/libipa/algorithms/af.cpp | 159 ++++++++++++++++++++++++++\n src/ipa/libipa/algorithms/af.h | 46 ++++++++\n src/ipa/libipa/algorithms/meson.build | 9 ++\n src/ipa/libipa/meson.build | 6 +\n 4 files changed, 220 insertions(+)\n create mode 100644 src/ipa/libipa/algorithms/af.cpp\n create mode 100644 src/ipa/libipa/algorithms/af.h\n create mode 100644 src/ipa/libipa/algorithms/meson.build", "diff": "diff --git a/src/ipa/libipa/algorithms/af.cpp b/src/ipa/libipa/algorithms/af.cpp\nnew file mode 100644\nindex 00000000..0808aa3f\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af.cpp\n@@ -0,0 +1,159 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Theobroma Systems\n+ *\n+ * af.cpp - Autofocus control algorithm interface\n+ */\n+\n+#include \"af.h\"\n+\n+/**\n+ * \\file af.h\n+ * \\brief AF algorithm common interface\n+ */\n+\n+namespace libcamera {\n+\n+namespace ipa::algorithms {\n+\n+/**\n+ * \\class Af\n+ * \\brief Common interface for auto-focus algorithms\n+ *\n+ * The Af class defines a standard interface for IPA auto focus algorithms.\n+ */\n+\n+/**\n+ * \\brief Provide control values to the algorithm\n+ * \\param[in] controls The list of user controls\n+ *\n+ * This method should be called in the libcamera::ipa::Algorithm::queueRequest()\n+ * method of the platform layer.\n+ */\n+void Af::queueRequest(const ControlList &controls)\n+{\n+\tusing namespace controls;\n+\n+\tfor (auto const &[id, value] : controls) {\n+\t\tswitch (id) {\n+\t\tcase AF_MODE: {\n+\t\t\tsetMode(static_cast<AfModeEnum>(value.get<int32_t>()));\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase AF_RANGE: {\n+\t\t\tsetRange(static_cast<AfRangeEnum>(value.get<int32_t>()));\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase AF_SPEED: {\n+\t\t\tsetSpeed(static_cast<AfSpeedEnum>(value.get<int32_t>()));\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase AF_METERING: {\n+\t\t\tsetMeteringMode(static_cast<AfMeteringEnum>(value.get<int32_t>()));\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase AF_WINDOWS: {\n+\t\t\tsetWindows(value.get<Span<const Rectangle>>());\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase AF_TRIGGER: {\n+\t\t\tsetTrigger(static_cast<AfTriggerEnum>(value.get<int32_t>()));\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase AF_PAUSE: {\n+\t\t\tsetPause(static_cast<AfPauseEnum>(value.get<int32_t>()));\n+\t\t\tbreak;\n+\t\t}\n+\t\tcase LENS_POSITION: {\n+\t\t\tsetLensPosition(value.get<float>());\n+\t\t\tbreak;\n+\t\t}\n+\t\tdefault:\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+}\n+\n+/**\n+ * \\fn Af::setMode()\n+ * \\brief Set auto focus mode\n+ * \\param[in] mode AF mode\n+ *\n+ * \\sa libcamera::controls::AfMode\n+ */\n+\n+/**\n+ * \\fn Af::setRange()\n+ * \\brief Set the range of focus distances that is scanned\n+ * \\param[in] range AF range\n+ *\n+ * \\sa libcamera::controls::AfRange\n+ */\n+\n+/**\n+ * \\fn Af::setSpeed()\n+ * \\brief Set how fast algorithm should move the lens\n+ * \\param[in] speed Lens move speed\n+ *\n+* \\sa libcamera::controls::AfSpeed\n+ */\n+\n+/**\n+ * \\fn Af::setMeteringMode()\n+ * \\brief Set AF metering mode\n+ * \\param[in] metering AF metering mode\n+ *\n+ * \\sa libcamera::controls::AfMetering\n+ */\n+\n+/**\n+ * \\fn Af::setWindows()\n+ * \\brief Set AF windows\n+ * \\param[in] windows AF windows\n+ *\n+ * \\sa libcamera::controls::AfWindows\n+ */\n+\n+/**\n+ * \\fn Af::setTrigger()\n+ * \\brief Starts or cancels the autofocus scan\n+ * \\param[in] trigger Trigger mode\n+ *\n+ * \\sa libcamera::controls::AfTrigger\n+ */\n+\n+/**\n+ * \\fn Af::setPause()\n+ * \\brief Pause the autofocus while in AfModeContinuous mode\n+ * \\param[in] pause Pause mode\n+ *\n+ * \\sa libcamera::controls::AfPause\n+ */\n+\n+/**\n+ * \\fn Af::setLensPosition()\n+ * \\brief Set the lens position while in AfModeManual\n+ * \\param[in] lensPosition Lens position\n+ *\n+ * \\sa libcamera::controls::LensPosition\n+ */\n+\n+/**\n+ * \\fn Af::state()\n+ * \\brief Get the current state of the AF algorithm\n+ * \\return AF state\n+ *\n+ * \\sa libcamera::controls::AfState\n+ */\n+\n+/**\n+ * \\fn Af::pauseState()\n+ * \\brief Get the current pause state of the AF algorithm\n+ * \\return AF pause state\n+ *\n+ * \\sa libcamera::controls::AfPauseState\n+ */\n+\n+} /* namespace ipa::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/libipa/algorithms/af.h b/src/ipa/libipa/algorithms/af.h\nnew file mode 100644\nindex 00000000..47c919fe\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af.h\n@@ -0,0 +1,46 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2023, Theobroma Systems\n+ *\n+ * af.h - Autofocus control algorithm interface\n+ */\n+\n+#pragma once\n+\n+#include <libcamera/control_ids.h>\n+\n+namespace libcamera {\n+\n+namespace ipa::algorithms {\n+\n+class Af\n+{\n+public:\n+\tvirtual ~Af() = default;\n+\n+\tvoid queueRequest(const ControlList &controls);\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 state() = 0;\n+\n+\tvirtual controls::AfPauseStateEnum pauseState() = 0;\n+};\n+\n+} /* namespace ipa::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/libipa/algorithms/meson.build b/src/ipa/libipa/algorithms/meson.build\nnew file mode 100644\nindex 00000000..3df4798f\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+libipa_algorithms_headers = files([\n+ 'af.h',\n+])\n+\n+libipa_algorithms_sources = files([\n+ 'af.cpp',\n+])\ndiff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build\nindex 016b8e0e..134c2dba 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 += libipa_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 += libipa_algorithms_sources\n+\n libipa_includes = include_directories('..')\n \n libipa = static_library('ipa', [libipa_sources, libipa_headers],\n", "prefixes": [ "libcamera-devel", "v6", "03/10" ] }