Show a patch.

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

{
    "id": 18509,
    "url": "https://patchwork.libcamera.org/api/patches/18509/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18509/",
    "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": "<20230331081930.19289-3-dse@thaumatec.com>",
    "date": "2023-03-31T08:19:22",
    "name": "[libcamera-devel,v6,02/10] ipa: rkisp1: Add lens limits to the session config",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9bd4f62a71ae9d30b168bc247b3c677dd42eddaa",
    "submitter": {
        "id": 126,
        "url": "https://patchwork.libcamera.org/api/people/126/?format=api",
        "name": "Daniel Semkowicz",
        "email": "dse@thaumatec.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18509/mbox/",
    "series": [
        {
            "id": 3831,
            "url": "https://patchwork.libcamera.org/api/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/18509/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18509/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 8144EC329D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Mar 2023 08:19:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2E10262724;\n\tFri, 31 Mar 2023 10:19:54 +0200 (CEST)",
            "from mail-lf1-x131.google.com (mail-lf1-x131.google.com\n\t[IPv6:2a00:1450:4864:20::131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F0AD562724\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 10:19:48 +0200 (CEST)",
            "by mail-lf1-x131.google.com with SMTP id q16so27863204lfe.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 01:19:48 -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.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 31 Mar 2023 01:19:47 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680250794;\n\tbh=VUG4UFjzIQCeqV4WxyY3nTBPu3yS2LvNEUV/9j13dF0=;\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=Uz2oXma9PqJwMOLfViQZKcZb4Pxzon17U/oTiAeA760KX3uOKtxZbT+uJEqsSKndf\n\tlrruzckPQsPEpOgjiaxv558TQ+RTnrzpX2QmnNfdcayiGbbh+FWa5MrmN11tknD94I\n\t5W2GYxZWbcy/3PqaisDLNV77XSxD5UM2kXUEwobLgErP26Redv8wc4WJ69OxbBFGZI\n\tBXqraFqUUyzEI6ugeS76wAASrMgoaFkZCGmFQ8NYM0p0v6PQHAKX9ZC79rQBrFV7l7\n\tKhX/Px/q60aaXI0wyrxrw/MSZiiX+BlZnxFC+PlPGKZsd79LjL6trt85IcejnPGBeF\n\t4cXZhJIMA3+YA==",
            "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=J1b/IOB9ADFX+04pgjf6PbC5dFg/NgQJ2Yx90sri+kU=;\n\tb=6gOvMZPre612Ot5Qk2NnnuUgVBt+kKWCoqZE+A372ISKJJRCBfmd2qTLIF91ejr7o9\n\tytmmjmQvK/F0n+dHX0iwp14VsO+Yt1rqnJV0QU38cf6DLamMAdop0bTx+obo3yB8u++f\n\t8E3xGaR9qpHU6vL9MRtCPKbVxGZcdsmQXFW9QsAvmrDzcZhvBNcmw7ZDDTcL2nNh2BZg\n\tzFwX5YaYymQ666cj0aqv0Io5KU0mkKDcoFS8H+vy7pZbz6DskD+tdyROHsN5RBUbc8ol\n\tSbgTAx6ITPopiKrE0OwdzBR6ufH3vVsu95JlYC/o3I7xGfSIgtx+qLZtsy96sknpl61w\n\tf7Mw=="
        ],
        "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=\"6gOvMZPr\"; \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=J1b/IOB9ADFX+04pgjf6PbC5dFg/NgQJ2Yx90sri+kU=;\n\tb=K9H+mdFQ26Owl1McSCNWLdITHKdCjmVQAjRc9Z29hIU20DMY/vhiFHhfiiEvvBRpFW\n\tDrhu5DFRSt0nbGHTEqHmI8rU94IRHHs1mA6WmoBaeZHbR05WrdtE3278ke43wkjEH/x/\n\tBYwHTt/mCuaZbtFQR2GNVl2xVpt/gfB8Anc7SggexOl3Ow4/a/jZuStwoymnZTjn8Fwc\n\t9crwDXcfiaMUQW0ODP4FXCJ/3qLqOqcYO5k/rj0qhlCsRKi6U9JHQGix7XVKwOPL/PHh\n\tUvU5KIp5Gl2LnWKLpKjgh4N7kmh1PQWn/JRRhRMLqII/yPVAFvpUsuseJD+H4atLw97/\n\tud4A==",
        "X-Gm-Message-State": "AAQBX9f0JVBOvwV3/bHYREpeT+FlPYvyrNNV/QxCHSgmtQv4Rv7aZpFT\n\teHjbsBT4opR0RQiQN1Qpx44Q/37NtP+lONZSpHPIPQ==",
        "X-Google-Smtp-Source": "AKy350YhfL62OPs61OKTiSesHBgpnH8rk5py+PO8xzKk+uUfd92q+EESdGoQhiKaQOLxS0Oz3OlssA==",
        "X-Received": "by 2002:ac2:522e:0:b0:4ea:f6ad:2977 with SMTP id\n\ti14-20020ac2522e000000b004eaf6ad2977mr7626143lfl.38.1680250788099; \n\tFri, 31 Mar 2023 01:19:48 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 31 Mar 2023 10:19:22 +0200",
        "Message-Id": "<20230331081930.19289-3-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 02/10] ipa: rkisp1: Add lens limits to\n\tthe session config",
        "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": "Add information about focus lens position limits to the IPA session\nconfiguration. These information can then be used by IPA algorithms\nto know which focus positions are valid.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n src/ipa/rkisp1/ipa_context.cpp | 17 +++++++++++++++++\n src/ipa/rkisp1/ipa_context.h   |  9 +++++++++\n src/ipa/rkisp1/rkisp1.cpp      | 23 ++++++++++++++++++++++-\n 3 files changed, 48 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 9bbf3684..aea99299 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -14,6 +14,18 @@\n \n namespace libcamera::ipa::rkisp1 {\n \n+/**\n+ * \\struct LensConfiguration\n+ * \\brief Lens-specific parameters\n+ *\n+ * \\var LensConfiguration::minFocusPosition\n+ * \\brief Minimum position supported by the camera focus lens\n+ *\n+ * \\var LensConfiguration::maxFocusPosition\n+ * \\brief Maximum position supported by the camera focus lens\n+ *\n+ */\n+\n /**\n  * \\struct IPASessionConfiguration\n  * \\brief Session configuration for the IPA module\n@@ -89,6 +101,11 @@ namespace libcamera::ipa::rkisp1 {\n  * \\brief Sensor output resolution\n  */\n \n+/**\n+ * \\var IPASessionConfiguration::lens\n+ * \\brief Contains lens-specific parameters if lens was detected\n+ */\n+\n /**\n  * \\var IPASessionConfiguration::raw\n  * \\brief Indicates if the camera is configured to capture raw frames\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex b9b20653..65b3fbfe 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -8,6 +8,8 @@\n \n #pragma once\n \n+#include <optional>\n+\n #include <linux/rkisp1-config.h>\n \n #include <libcamera/base/utils.h>\n@@ -20,6 +22,11 @@ namespace libcamera {\n \n namespace ipa::rkisp1 {\n \n+struct LensConfiguration {\n+\tint32_t minFocusPosition = 0;\n+\tint32_t maxFocusPosition = 0;\n+};\n+\n struct IPASessionConfiguration {\n \tstruct {\n \t\tstruct rkisp1_cif_isp_window measureWindow;\n@@ -45,6 +52,8 @@ struct IPASessionConfiguration {\n \t\tSize size;\n \t} sensor;\n \n+\tstd::optional<LensConfiguration> lens;\n+\n \tstruct {\n \t\trkisp1_cif_isp_version revision;\n \t} hw;\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex d338d374..292768cf 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -164,9 +164,21 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \tcontext_.configuration.sensor.lineDuration = sensorInfo.minLineLength\n \t\t\t\t\t\t   * 1.0s / sensorInfo.pixelRate;\n \n-\tif (!lensControls.empty())\n+\tif (!lensControls.empty()) {\n \t\tlensControls_ = lensControls;\n \n+\t\tconst ControlInfo &focusAbsolute =\n+\t\t\tlensControls_->at(V4L2_CID_FOCUS_ABSOLUTE);\n+\n+\t\tLOG(IPARkISP1, Debug)\n+\t\t\t<< \"Focus lens: \" << focusAbsolute.toString();\n+\n+\t\tcontext_.configuration.lens = {\n+\t\t\t.minFocusPosition = focusAbsolute.min().get<int32_t>(),\n+\t\t\t.maxFocusPosition = focusAbsolute.max().get<int32_t>()\n+\t\t};\n+\t}\n+\n \t/* Load the tuning data file. */\n \tFile file(settings.configurationFile);\n \tif (!file.open(File::OpenModeFlag::ReadOnly)) {\n@@ -234,6 +246,13 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\t<< \"Exposure: [\" << minExposure << \", \" << maxExposure\n \t\t<< \"], gain: [\" << minGain << \", \" << maxGain << \"]\";\n \n+\t/*\n+\t * Save the existing lens configuration and restore it after context\n+\t * reset. It does not change since init().\n+\t */\n+\tconst std::optional<LensConfiguration> lensConfig =\n+\t\tcontext_.configuration.lens;\n+\n \t/* Clear the IPA context before the streaming session. */\n \tcontext_.configuration = {};\n \tcontext_.activeState = {};\n@@ -272,6 +291,8 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\t\treturn format.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n \t\t});\n \n+\tcontext_.configuration.lens = lensConfig;\n+\n \tfor (auto const &a : algorithms()) {\n \t\tAlgorithm *algo = static_cast<Algorithm *>(a.get());\n \n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "02/10"
    ]
}