Show a patch.

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

{
    "id": 13037,
    "url": "https://patchwork.libcamera.org/api/patches/13037/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13037/",
    "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": "<20210718185125.17472-2-david.plowman@raspberrypi.com>",
    "date": "2021-07-18T18:51:24",
    "name": "[libcamera-devel,v4,1/2] ipa: raspberrypi: Add sensitivity field to camera mode",
    "commit_ref": "d0c429c34cd37b16facaf8df0bf74614c83f5f75",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "abfd7c18061c9dad05a64ac3e608ba8308ee456b",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13037/mbox/",
    "series": [
        {
            "id": 2251,
            "url": "https://patchwork.libcamera.org/api/series/2251/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2251",
            "date": "2021-07-18T18:51:23",
            "name": "Raspberrypi: support per-mode camera sensitivities",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/2251/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13037/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13037/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 6CDB4C0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 18 Jul 2021 18:51:33 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2373368540;\n\tSun, 18 Jul 2021 20:51:32 +0200 (CEST)",
            "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n\t[IPv6:2a00:1450:4864:20::336])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E916568521\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 18 Jul 2021 20:51:30 +0200 (CEST)",
            "by mail-wm1-x336.google.com with SMTP id\n\ta23-20020a05600c2257b0290236ec98bebaso6638548wmm.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 18 Jul 2021 11:51:30 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\to19sm17459634wmc.12.2021.07.18.11.51.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 18 Jul 2021 11:51:29 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Mmq7XsnF\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=okO5up/zx0X+4DJQ5oxsTFvRqTM5be38sIC2FgZlx80=;\n\tb=Mmq7XsnFeLVYvTM/clIBTIFzjrR8eWA+zFsEEz0OySXATNU0iGplO+Rp9ocN7lM/vn\n\t2HgsBC2HMRJn/+pvxmj5KJY2Xi6TydoJ43AzynM/Y81DVU0Ent0jD0lNBHqcAZUOv/81\n\tKykt25CalZoyfwd7zQXMI7dTQvVrzY8GOrV6LMGGGg7FinU+mpqDhU99mgkka17xJjsg\n\tDWTEBHcdcGal9BJdR75uWTacjypC1URBG/SOFHvwjxL6nYyrWq1vgSJtYzTE7GQwPCcc\n\tJTQIYigVHWEaKFy919kUsdjvKE3NOJGD/+mu/8xA5VvcfG/DPyD3b5FdF83eOfd7jsE6\n\t9knw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=okO5up/zx0X+4DJQ5oxsTFvRqTM5be38sIC2FgZlx80=;\n\tb=hGDdZftGv/hyNU23Z9jB63ho7p/BwEG1C6Z9wkTBlqICByJKo5YXQIeHHneXZPb4oX\n\tpR8OtGfmy7DvwHKsGNpffoBYI/NEdNwq+vdbO4kJgPC8sLyZ/VZFyFyMMO8CHs1kDT3G\n\tK2fZUfefFG8RestnrELQptppdDwP+/Z0oRYJCz6yftn9M5aWIgPKGnhmVfNZrmeIC8LC\n\tfDDwaXzrNX940rgElrye/g/k2/8HXMRCYO+M+OOzsiUM1n9vOWgzlbx+YY2ui5QOE0BD\n\tl9zFOjT2LGRSkTrF+eAi3QibXO1OdVZMaSQQS1TBzqXaCHJPXzd0t9sgUUem/yxtejCp\n\t00Gw==",
        "X-Gm-Message-State": "AOAM530molNNK1NZ9o0ziz7wRZjnST0jXzckl7PDDfd8xilKApnbSJqi\n\tKwB+05Gq3+mP/X2n6CGiiuxX/dzYU7vMhBMr",
        "X-Google-Smtp-Source": "ABdhPJzb+PCijbghfN/J6NdWsoJo514Y7sgcYewcww1/IGNGLVGr9TSiA8kUG/oJe+89webKCKDyMA==",
        "X-Received": "by 2002:a7b:c013:: with SMTP id\n\tc19mr28053559wmb.158.1626634290425; \n\tSun, 18 Jul 2021 11:51:30 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 18 Jul 2021 19:51:24 +0100",
        "Message-Id": "<20210718185125.17472-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210718185125.17472-1-david.plowman@raspberrypi.com>",
        "References": "<20210718185125.17472-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 1/2] ipa: raspberrypi: Add sensitivity\n\tfield to camera mode",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "We use the CamHelper class to initialise it to the usual value of 1.\n\nThe CamHelper's GetModeSensitivity method can be redefined to\nimplement a different behaviour for sensors that require it.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp           | 11 +++++++++++\n src/ipa/raspberrypi/cam_helper.hpp           |  3 +++\n src/ipa/raspberrypi/controller/camera_mode.h |  2 ++\n src/ipa/raspberrypi/raspberrypi.cpp          |  6 ++++++\n 4 files changed, 22 insertions(+)",
    "diff": "diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 3c6afce7..8f64e014 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -129,6 +129,17 @@ bool CamHelper::SensorEmbeddedDataPresent() const\n \treturn false;\n }\n \n+double CamHelper::GetModeSensitivity([[maybe_unused]] const CameraMode &mode) const\n+{\n+\t/*\n+\t * Most sensors have the same sensitivity in every mode, but this\n+\t * method can be overridden for those that do not. Note that it is\n+\t * called before mode_ is set, so it must return the sensitivity\n+\t * of the mode that is passed in.\n+\t */\n+\treturn 1.0;\n+}\n+\n unsigned int CamHelper::HideFramesStartup() const\n {\n \t/*\ndiff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp\nindex 200cc83f..0643b77a 100644\n--- a/src/ipa/raspberrypi/cam_helper.hpp\n+++ b/src/ipa/raspberrypi/cam_helper.hpp\n@@ -41,6 +41,8 @@ namespace RPiController {\n //\n // A method to query if the sensor outputs embedded data that can be parsed.\n //\n+// A method to return the sensitivity of a given camera mode.\n+//\n // A parser to parse the embedded data buffers provided by some sensors (for\n // example, the imx219 does; the ov5647 doesn't). This allows us to know for\n // sure the exposure and gain of the frame we're looking at. CamHelper\n@@ -84,6 +86,7 @@ public:\n \tvirtual void GetDelays(int &exposure_delay, int &gain_delay,\n \t\t\t       int &vblank_delay) const;\n \tvirtual bool SensorEmbeddedDataPresent() const;\n+\tvirtual double GetModeSensitivity(const CameraMode &mode) const;\n \tvirtual unsigned int HideFramesStartup() const;\n \tvirtual unsigned int HideFramesModeSwitch() const;\n \tvirtual unsigned int MistrustFramesStartup() const;\ndiff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h\nindex 65888230..e2b82828 100644\n--- a/src/ipa/raspberrypi/controller/camera_mode.h\n+++ b/src/ipa/raspberrypi/controller/camera_mode.h\n@@ -41,6 +41,8 @@ struct CameraMode {\n \tlibcamera::Transform transform;\n \t// minimum and maximum fame lengths in units of lines\n \tuint32_t min_frame_length, max_frame_length;\n+\t// sensitivity of this mode\n+\tdouble sensitivity;\n };\n \n #ifdef __cplusplus\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 5cd33304..2fdb60a9 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -325,6 +325,12 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)\n \t */\n \tmode_.min_frame_length = sensorInfo.minFrameLength;\n \tmode_.max_frame_length = sensorInfo.maxFrameLength;\n+\n+\t/*\n+\t * Some sensors may have different sensitivities in different modes;\n+\t * the CamHelper will know the correct value.\n+\t */\n+\tmode_.sensitivity = helper_->GetModeSensitivity(mode_);\n }\n \n int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "1/2"
    ]
}