Show a patch.

GET /api/1.1/patches/18394/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18394,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18394/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18394/",
    "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": "<20230314144834.85193-4-dse@thaumatec.com>",
    "date": "2023-03-14T14:48:27",
    "name": "[libcamera-devel,v4,03/10] ipa: Add base class defining AF algorithm interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5eec3cd28a01b70897abbdc4b98271b81ea9085c",
    "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/18394/mbox/",
    "series": [
        {
            "id": 3805,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3805/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3805",
            "date": "2023-03-14T14:48:24",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3805/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18394/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18394/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 30DE6BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Mar 2023 14:49:59 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C91B662719;\n\tTue, 14 Mar 2023 15:49:58 +0100 (CET)",
            "from mail-lj1-x236.google.com (mail-lj1-x236.google.com\n\t[IPv6:2a00:1450:4864:20::236])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 36B2D626D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 15:49:53 +0100 (CET)",
            "by mail-lj1-x236.google.com with SMTP id z5so16269893ljc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 07:49:53 -0700 (PDT)",
            "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tq25-20020a2eb4b9000000b00295a35f30e1sm470961ljm.115.2023.03.14.07.49.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Mar 2023 07:49:52 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678805398;\n\tbh=4WWmNqxEa3En1IFm6A+aBBWoe6pYCuvi8WpsS7o4Y6I=;\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:Cc:\n\tFrom;\n\tb=pJcUSeXZscgNgAJ638bPYSEoqg6WmLHinAfwEmvA98GWj+ZxOFH9oCselg0YZh52o\n\tAb8jFV0Y1M9cJILRBFeuhFrtRy08XH0D9sQy4JATdQfVLWyLPxO466MFG9oE5QYdpz\n\trWLKsdquzRJJ+WzoJB/JFWQTg7uzPdAJGW36QbYkIxSBY6KBc/fcMzUccy7sXuyZQf\n\twTIKqCj4hL8dZkOhuwRc3k+p3Q7NlHBJ+YYrD/N4I5gvSpiu/6yKaEH2fQr5OTWNti\n\thJB0xuSw4k4aqvnMiJJMHG4aDjb/NmtIrUqab7QCw5Kb5tSTHGlnw4cyOCoBb+/nLR\n\teOTRYt3ep5UzA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1678805392;\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=Tf4a27wHPohwI3ltcrQGkT73Z2E4q3f/GsXTtml4cGg=;\n\tb=F7vPqWbkbGZsVidBUbxQo9ca8Hvs2k+Ip2vZFsKfmFc4Kbjgpl/gMnzA/gCz9cc+Gk\n\t4zWe6jw2yX10PPPGJcrLahcTfkOZhM1A6Zho6Rx91sglJqk0joQlcOBt+Lw2wqYaFsrC\n\tymtEARmXmjKo2sRsZ7EK79/Zr/yaVWNIfRj5mgnXr2cBS6bZ8H6cfdiqP2xhk2pvrqG/\n\tfPUTq22/DliFnRksxwOf49m193ANP0LC9qd2ROf22DA8+WyhYxXHrzu+mi+tezW65T2I\n\tTw543LwhYZVMfNZ09CglYKjIfbpUBG/FEeUdv9QImBlEcKErCB0GTPYXbM5JA0UJnOuz\n\twmJA=="
        ],
        "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=\"F7vPqWbk\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1678805392;\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=Tf4a27wHPohwI3ltcrQGkT73Z2E4q3f/GsXTtml4cGg=;\n\tb=1ElTtEEfqfdsf0RvGrmIV7Ogm8SC1xE+SSknqzd1dFLKQ37Q0gr2JmnWUV1RJ/NjD4\n\t0ugxD3fgtPpWf976KYQV80ra6rVsr4z72e5pfTe3Hi381bZ44ngfZGZPDcp8m6lYt06X\n\thL5mGO/Im2IWgMpjeyp/Eo7qlO6y4+D/jVl28xzyVvEKYLUs/+xbbk5gMUtzKHQpF/Y/\n\t3YdPcCGtXUeR7V9MgCHGUAwVNal5ysUse3gKgm5a+BVvVbUPWjuoxRc2rtmyWqQp1qEq\n\tAWQlxWBfG9yu8cwYtONAsgo6G0RFMIQRZlc9BAL1Hz9NAZExtXgOl9M0SxGOav8b5Wha\n\tuaAg==",
        "X-Gm-Message-State": "AO0yUKXKxI0MiAP0rspei8TQiOI6KXEyQwrSSCnTV/bnclxEBq52hdjo\n\tGyzHmfd/72sGp4v3dkHBE84r7Kx2wJNpFVqI9B4=",
        "X-Google-Smtp-Source": "AK7set+YJduw8TJ3RBbr8dvOpvu+HO88O2u1ZX2GBbVd/XPCYVTBrzpy0+4eFOwStaZinm8Cbhh6WA==",
        "X-Received": "by 2002:a2e:be06:0:b0:295:9c2e:7324 with SMTP id\n\tz6-20020a2ebe06000000b002959c2e7324mr15562460ljq.4.1678805392437; \n\tTue, 14 Mar 2023 07:49:52 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 14 Mar 2023 15:48:27 +0100",
        "Message-Id": "<20230314144834.85193-4-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230314144834.85193-1-dse@thaumatec.com>",
        "References": "<20230314144834.85193-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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>",
        "Cc": "jacopo.mondi@ideasonboard.com",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Define common interface with basic methods that should be supported\nby the Auto Focus algorithms. Interface methods match the AF controls\nthat can be set in the frame request.\nCommon implementation of controls parsing is provided, so the AF\nalgorithms deriving from this interface should be able to reuse it.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n src/ipa/libipa/algorithms/af.cpp      | 155 ++++++++++++++++++++++++++\n src/ipa/libipa/algorithms/af.h        |  41 +++++++\n src/ipa/libipa/algorithms/meson.build |   9 ++\n src/ipa/libipa/meson.build            |   6 +\n 4 files changed, 211 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..2052080f\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af.cpp\n@@ -0,0 +1,155 @@\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::ipa::common::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+ * \\copybrief libcamera::controls::AfMode\n+ * \\param[in] mode AF mode\n+ *\n+ * \\copydetails libcamera::controls::AfMode\n+ */\n+\n+/**\n+ * \\fn Af::setRange()\n+ * \\copybrief libcamera::controls::AfRange\n+ * \\param[in] range AF range\n+ *\n+ * \\copydetails libcamera::controls::AfRange\n+ */\n+\n+/**\n+ * \\fn Af::setSpeed()\n+ * \\copybrief libcamera::controls::AfSpeed\n+ * \\param[in] speed Lens move speed\n+ *\n+* \\copydetails libcamera::controls::AfSpeed\n+ */\n+\n+/**\n+ * \\fn Af::setMeteringMode()\n+ * \\copybrief libcamera::controls::AfMetering\n+ * \\param[in] metering AF metering mode\n+ *\n+ * \\copydetails libcamera::controls::AfMetering\n+ */\n+\n+/**\n+ * \\fn Af::setWindows()\n+ * \\copybrief libcamera::controls::AfWindows\n+ * \\param[in] windows AF windows\n+ *\n+ * \\copydetails libcamera::controls::AfWindows\n+ */\n+\n+/**\n+ * \\fn Af::setTrigger()\n+ * \\copybrief libcamera::controls::AfTrigger\n+ * \\param[in] trigger Trigger mode\n+ *\n+ * \\copydetails libcamera::controls::AfTrigger\n+ */\n+\n+/**\n+ * \\fn Af::setPause()\n+ * \\copybrief libcamera::controls::AfPause\n+ * \\param[in] pause Pause mode\n+ *\n+ * \\copydetails libcamera::controls::AfPause\n+ */\n+\n+/**\n+ * \\fn Af::setLensPosition()\n+ * \\copybrief libcamera::controls::LensPosition\n+ * \\param[in] lensPosition Lens position\n+ *\n+ * \\copydetails libcamera::controls::LensPosition\n+ */\n+\n+/**\n+ * \\fn Af::state()\n+ * \\copybrief libcamera::controls::AfState\n+ * \\return AF state\n+ *\n+ * \\copydetails libcamera::controls::AfState\n+ */\n+\n+/**\n+ * \\fn Af::pauseState()\n+ * \\copybrief libcamera::controls::AfPauseState\n+ * \\return AF pause state\n+ *\n+ * \\copydetails libcamera::controls::AfPauseState\n+ */\n+\n+} /* namespace libcamera::ipa::common::algorithms */\ndiff --git a/src/ipa/libipa/algorithms/af.h b/src/ipa/libipa/algorithms/af.h\nnew file mode 100644\nindex 00000000..1428902c\n--- /dev/null\n+++ b/src/ipa/libipa/algorithms/af.h\n@@ -0,0 +1,41 @@\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+#pragma once\n+\n+#include <libcamera/control_ids.h>\n+\n+namespace libcamera::ipa::common::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 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..7602976c\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.h',\n+])\n+\n+common_ipa_algorithms_sources = files([\n+    'af.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",
        "v4",
        "03/10"
    ]
}