Show a patch.

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

{
    "id": 18154,
    "url": "https://patchwork.libcamera.org/api/patches/18154/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18154/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20230119104544.9456-7-naush@raspberrypi.com>",
    "date": "2023-01-19T10:45:36",
    "name": "[libcamera-devel,v1,06/14] ipa: raspberrypi: Add autofocus algorithm interface headers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6005c4e17683c7d0b527462aaa6ccef6a631636a",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18154/mbox/",
    "series": [
        {
            "id": 3715,
            "url": "https://patchwork.libcamera.org/api/series/3715/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3715",
            "date": "2023-01-19T10:45:30",
            "name": "Raspberry Pi: Camera Module 3 support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3715/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18154/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18154/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 4D458C3295\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Jan 2023 10:46:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EAF63625EB;\n\tThu, 19 Jan 2023 11:46:03 +0100 (CET)",
            "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 087DB625E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 11:45:57 +0100 (CET)",
            "by mail-wm1-x32b.google.com with SMTP id\n\tc4-20020a1c3504000000b003d9e2f72093so3268024wma.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 02:45:57 -0800 (PST)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbe12-20020a05600c1e8c00b003db06224953sm5332029wmb.41.2023.01.19.02.45.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Jan 2023 02:45:55 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674125164;\n\tbh=eACv0BMC4sIml13m6Dl1ayBXch/Gz9qY634FpBRZK7g=;\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=kdFjSAO57S52MpbPLXd18ptYuSbq09Y1RZbcO1Vg5O9E97ndl4N+dTx8liY1YoCWo\n\tqYvIEHzveRSbPH7riUrCv88VysBYPJM7o0faVmqVC85clq3R/oe/udpEaz342vL73p\n\tFGmR4J2CQjMHVU5rwUgr9hUM+4Z4ym/rzqglZSdJsZFAgD21TzCMQq3bybLHRZet5z\n\tCsT8Y15/kPLkJWs3gE7ZHNlntHAivg+DqgaiQqs9OtyGu2FW/xDKwfgXY5crD6SNyT\n\twN7yCe8UjxLYgj3yklu9RIeApxOrQYGgzzTrgZLS1R5o10+Xnn2ZU1kdW/WnyrRYZO\n\tDna+jiY70L8MQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\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=+XOYlVwonbW9GffEkAtSqcC2zDy9aGi8XiunyvhmLkE=;\n\tb=Qg897WW1xClBlcb0Q9Zb4V06hcmJSWEZ797DEVvJeOuaU+ZwiPBxicjo18DyauTlWF\n\tfSZdFOGwCw6abj/ka694V7YFBO434KvvzSioErVJaiJ7JViwVA135uIJ7KzuHhtBvU3J\n\tEGJjNdTHVdYm7Bjt+dp+6tj11ZpoeWHeY6gHs5pliigz1O38ehKWn0d751oOKfqjyO2E\n\tAB+TxLmGaJlB2+7fen62kMHekK2RygC3W90DDB4J1QIQhLV9IZda6HIqHMeBdJW6NwGi\n\tPaQs0g1LzxabBpyfoWQtd4+X36jHg+9F8uELYWQ1yLgDUTa1MhZG4+xsEgVsS3u9XGrl\n\tqCHw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Qg897WW1\"; dkim-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=+XOYlVwonbW9GffEkAtSqcC2zDy9aGi8XiunyvhmLkE=;\n\tb=1YR/Lhk6iWNLIn01FQZOgwn0+pLdhY25/CsAPtaAml9Ed33L9SSvBDsiteM5DldLs8\n\tt1cl09dWaHdhFIK9el8qTBu7tA9N8j9ndvYL4qnZnibhkQ54wQcO2mUiqO/fVYxB7v42\n\tVmNVDsnrIvLSc/fupZVkzwOiHp1LVkH4YkaPh50gyG/0Md0SUnLlVWmSMyRmFmM3rpIa\n\t+JqUmK+myOA+wvpitxAt33NK7sX3HTgcxjbD7Wyf9OyJD22Kx3Dv7Ey6pYgsUDU6eUag\n\tSncyOLFNJf/fS8dvT+2vXy9wwu/QvPfa51MIW2PW+h5N3u7ZtwRBcn+1pmMt7VsJXOwX\n\tJ7dw==",
        "X-Gm-Message-State": "AFqh2krQ8fdad78dYNZ98ZrE0MNdiKBDs23+3Ts7fneywJUfctYPJUG0\n\ttK8eeycqiDMrzM6jHUKeXwTXuTdF2ClIFEJWSdc=",
        "X-Google-Smtp-Source": "AMrXdXu9MNOB2xcnYqlqnGl5WGIOIXpakmfgEdMXuv+ACoB0NVMve2LEuf9IGNhrMngHfgjado3tyQ==",
        "X-Received": "by 2002:a05:600c:2056:b0:3db:ce8:6662 with SMTP id\n\tp22-20020a05600c205600b003db0ce86662mr7690807wmg.31.1674125155887; \n\tThu, 19 Jan 2023 02:45:55 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 19 Jan 2023 10:45:36 +0000",
        "Message-Id": "<20230119104544.9456-7-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230119104544.9456-1-naush@raspberrypi.com>",
        "References": "<20230119104544.9456-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 06/14] ipa: raspberrypi: Add autofocus\n\talgorithm interface headers",
        "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Cc": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\n\nAdd a new AfAlgorithm class that defines the interface for the Raspberry Pi\nautofocus algorithm.\n\nAdd an AfStatus structure that returns the results of the autofocus algorithm\nback to the IPA.\n\nAdd a structure for PDAF statistics provided by supported sensors for use with\nan autofocus algorithm. This structure is currently based on the IMX708's PDAF\n\"Type 1\" statistics.\n\nSigned-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/af_algorithm.h | 76 +++++++++++++++++++\n src/ipa/raspberrypi/controller/af_status.h    | 35 +++++++++\n src/ipa/raspberrypi/controller/pdaf_data.h    | 21 +++++\n 3 files changed, 132 insertions(+)\n create mode 100644 src/ipa/raspberrypi/controller/af_algorithm.h\n create mode 100644 src/ipa/raspberrypi/controller/af_status.h\n create mode 100644 src/ipa/raspberrypi/controller/pdaf_data.h",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/af_algorithm.h b/src/ipa/raspberrypi/controller/af_algorithm.h\nnew file mode 100644\nindex 000000000000..ad9b575450e3\n--- /dev/null\n+++ b/src/ipa/raspberrypi/controller/af_algorithm.h\n@@ -0,0 +1,76 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Raspberry Pi Ltd\n+ *\n+ * af_algorithm.hpp - auto focus algorithm interface\n+ */\n+#pragma once\n+\n+#include <optional>\n+\n+#include <libcamera/base/span.h>\n+\n+#include \"algorithm.h\"\n+\n+namespace RPiController {\n+\n+class AfAlgorithm : public Algorithm\n+{\n+public:\n+\tAfAlgorithm(Controller *controller)\n+\t\t: Algorithm(controller) {}\n+\n+\t/*\n+\t * An autofocus algorithm should provide the following calls.\n+\t *\n+\t * Where a ControlList combines a change of AfMode with other AF\n+\t * controls, setMode() should be called first, to ensure the\n+\t * algorithm will be in the correct state to handle controls.\n+\t *\n+\t * setLensPosition() returns true if the mode was AfModeManual and\n+\t * the lens position has changed, otherwise returns false. When it\n+\t * returns true, hwpos should be sent immediately to the lens driver.\n+\t *\n+\t * getMode() is provided mainly for validating controls.\n+\t * getLensPosition() is provided for populating DeviceStatus.\n+\t */\n+\n+\tenum AfRange { AfRangeNormal = 0,\n+\t\t       AfRangeMacro,\n+\t\t       AfRangeFull,\n+\t\t       AfRangeMax };\n+\n+\tenum AfSpeed { AfSpeedNormal = 0,\n+\t\t       AfSpeedFast,\n+\t\t       AfSpeedMax };\n+\n+\tenum AfMode { AfModeManual = 0,\n+\t\t      AfModeAuto,\n+\t\t      AfModeContinuous };\n+\n+\tenum AfPause { AfPauseImmediate = 0,\n+\t\t       AfPauseDeferred,\n+\t\t       AfPauseResume };\n+\n+\tvirtual void setRange([[maybe_unused]] AfRange range)\n+\t{\n+\t}\n+\tvirtual void setSpeed([[maybe_unused]] AfSpeed speed)\n+\t{\n+\t}\n+\tvirtual void setMetering([[maybe_unused]] bool use_windows)\n+\t{\n+\t}\n+\tvirtual void setWindows([[maybe_unused]] libcamera::Span<libcamera::Rectangle const> const &wins)\n+\t{\n+\t}\n+\tvirtual void setMode(AfMode mode) = 0;\n+\tvirtual AfMode getMode() const = 0;\n+\tvirtual bool setLensPosition(double dioptres, int32_t *hwpos) = 0;\n+\tvirtual std::optional<double> getLensPosition() const = 0;\n+\tvirtual void triggerScan() = 0;\n+\tvirtual void cancelScan() = 0;\n+\tvirtual void pause(AfPause pause) = 0;\n+};\n+\n+} // namespace RPiController\ndiff --git a/src/ipa/raspberrypi/controller/af_status.h b/src/ipa/raspberrypi/controller/af_status.h\nnew file mode 100644\nindex 000000000000..92c088126733\n--- /dev/null\n+++ b/src/ipa/raspberrypi/controller/af_status.h\n@@ -0,0 +1,35 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Raspberry Pi Ltd\n+ *\n+ * af_status.h - AF control algorithm status\n+ */\n+#pragma once\n+\n+#include <optional>\n+\n+/*\n+ * The AF algorithm should post the following structure into the image's\n+ * \"af.status\" metadata. lensSetting should control the lens.\n+ */\n+\n+enum class AfState {\n+\tIdle = 0,\n+\tScanning,\n+\tFocused,\n+\tFailed\n+};\n+\n+enum class AfPauseState {\n+\tRunning = 0,\n+\tPausing,\n+\tPaused\n+};\n+\n+struct AfStatus {\n+\t/* state for reporting */\n+\tAfState state;\n+\tAfPauseState pauseState;\n+\t/* lensSetting should be sent to the lens driver, when valid */\n+\tstd::optional<int> lensSetting;\n+};\ndiff --git a/src/ipa/raspberrypi/controller/pdaf_data.h b/src/ipa/raspberrypi/controller/pdaf_data.h\nnew file mode 100644\nindex 000000000000..03c00d72c0e8\n--- /dev/null\n+++ b/src/ipa/raspberrypi/controller/pdaf_data.h\n@@ -0,0 +1,21 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2022, Raspberry Pi Ltd\n+ *\n+ * pdaf_data.h - PDAF Metadata; for now this is\n+ * largely based on IMX708's PDAF \"Type 1\" output.\n+ */\n+#pragma once\n+\n+#include <stdint.h>\n+\n+#define PDAF_DATA_ROWS 12\n+#define PDAF_DATA_COLS 16\n+\n+struct PdafData {\n+\t/* Confidence values, in raster order, in arbitrary units */\n+\tuint16_t conf[PDAF_DATA_ROWS][PDAF_DATA_COLS];\n+\n+\t/* Phase error, in raster order, in s11 Q4 format (S.6.4) */\n+\tint16_t phase[PDAF_DATA_ROWS][PDAF_DATA_COLS];\n+};\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "06/14"
    ]
}