Show a patch.

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

{
    "id": 12650,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12650/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12650/",
    "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": "<20210618161807.24242-4-david.plowman@raspberrypi.com>",
    "date": "2021-06-18T16:18:07",
    "name": "[libcamera-devel,v2,3/3] libcamera: ipa: raspberrypi: Add support for ov9281 sensor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ec5ff119bde72ba6cce67707c6d143f041a43604",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12650/mbox/",
    "series": [
        {
            "id": 2152,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2152/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2152",
            "date": "2021-06-18T16:18:04",
            "name": "Support monochrome raw sensors",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2152/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12650/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12650/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 D22A5BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jun 2021 16:18:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34B2B6894A;\n\tFri, 18 Jun 2021 18:18:17 +0200 (CEST)",
            "from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F6AC68947\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jun 2021 18:18:15 +0200 (CEST)",
            "by mail-wr1-x42a.google.com with SMTP id a11so11370167wrt.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jun 2021 09:18:15 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tz5sm8908492wrp.92.2021.06.18.09.18.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 18 Jun 2021 09:18:14 -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=\"Vibopeq8\"; 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=rD2fOE2ZAq2xWCGOAoFE7nsUFVoRUOuwB3DfHfo7qIg=;\n\tb=Vibopeq8h4Zkj/GWuLVsgcdhxZrGtCvJU0SlvnjkM0ERYxhfgEZDfL5NJLBlSvaCs4\n\t2gYAa7DKbzxLmYNVU+h+ehJQAnwO097voduAlQ5i3cfpi2UMjOepQWZNKwhZ/DWHsmPw\n\t9B9V1VM1A09Oq8Lg2UZ1nkyQRI6IHnPIbm976G0oCZqpKePyEkGKh/Mo0PrRfcXzrDmG\n\t4MLCN+bCSv2/w2m4rp8FdX8jDfan2idAuj4wjskgkz6iCFwsR6XlaufrTIsmr5pYey/n\n\tXbjEunoapr0CCvcEME90R14vWCWoD84/M7DD7b2dnC80wVvZwC/wLenF/qbbFHuhKe4v\n\tCRpw==",
        "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=rD2fOE2ZAq2xWCGOAoFE7nsUFVoRUOuwB3DfHfo7qIg=;\n\tb=ejlC3uHnrPtoFR4YRORH/QP4zF/vxhthk57LhYATZ7Q+Kt/xilpSbFM48L36stvEa8\n\tWXTQvgS+lHGwCMgMKhsZ2y6Qm5KhwW/KfLVchtYzK7vPlI/2sWzyOqALEyu/Bax2FY7D\n\thEbMnTx2o6HYGpG7rAxoqyr2hRpd0XtozVi3iZXuKz8AD6215jMX5wj3pC47TAkztaJj\n\tp9W6hw9PRbn1GddajeCsKPrFReJybCS9v7QizWVp2JksrmD3CsonaWcNoA3jilUcnH0P\n\t/2lQ4Ah2gafDA8CRbq1UYo1Dq1eMeWdRMvNEj9aQGHxnnjAotUUOu2AWX6MgsjVSoT1C\n\t7fGQ==",
        "X-Gm-Message-State": "AOAM532RpK/WVEuo88pjouc2qOtwdMYiFmFRZdQFBbYjQbD/sVD83DMV\n\tajTbrq7diwcT6U7BH1U7L1dvIHT5dDby6W5k",
        "X-Google-Smtp-Source": "ABdhPJyC1eiu1Ny6fr9XtUoqc+AnCaQ/2pfbTTIcLE2s1m65Us5vC6CKjV17xrGns+RpjxfsDDkc9w==",
        "X-Received": "by 2002:a5d:6646:: with SMTP id\n\tf6mr13399404wrw.399.1624033094560; \n\tFri, 18 Jun 2021 09:18:14 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 18 Jun 2021 17:18:07 +0100",
        "Message-Id": "<20210618161807.24242-4-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210618161807.24242-1-david.plowman@raspberrypi.com>",
        "References": "<20210618161807.24242-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/3] libcamera: ipa: raspberrypi: Add\n\tsupport for ov9281 sensor",
        "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": "The necessary tuning file and CamHelper is added for the ov9281 sensor\n(which the driver names as the \"mov9281\").\n\nThe ov9281 is a 1280x800 monochrome global shutter sensor. To enable\nit, please add\n\ndtoverlay=ov9281\n\nto the /boot/config.txt file and reboot the Pi.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/cam_helper_mov9281.cpp | 65 +++++++++++++++\n src/ipa/raspberrypi/data/meson.build       |  1 +\n src/ipa/raspberrypi/data/mov9281.json      | 92 ++++++++++++++++++++++\n src/ipa/raspberrypi/meson.build            |  1 +\n 4 files changed, 159 insertions(+)\n create mode 100644 src/ipa/raspberrypi/cam_helper_mov9281.cpp\n create mode 100644 src/ipa/raspberrypi/data/mov9281.json",
    "diff": "diff --git a/src/ipa/raspberrypi/cam_helper_mov9281.cpp b/src/ipa/raspberrypi/cam_helper_mov9281.cpp\nnew file mode 100644\nindex 00000000..29519cb0\n--- /dev/null\n+++ b/src/ipa/raspberrypi/cam_helper_mov9281.cpp\n@@ -0,0 +1,65 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2021, Raspberry Pi (Trading) Limited\n+ *\n+ * cam_helper_mov9281.cpp - camera information for ov9281 sensor\n+ */\n+\n+#include <assert.h>\n+\n+#include \"cam_helper.hpp\"\n+\n+using namespace RPiController;\n+\n+class CamHelperOv9281 : public CamHelper\n+{\n+public:\n+\tCamHelperOv9281();\n+\tuint32_t GainCode(double gain) const override;\n+\tdouble Gain(uint32_t gain_code) const override;\n+\tvoid GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t       int &vblank_delay) const override;\n+\n+private:\n+\t/*\n+\t * Smallest difference between the frame length and integration time,\n+\t * in units of lines.\n+\t */\n+\tstatic constexpr int frameIntegrationDiff = 4;\n+};\n+\n+/*\n+ * OV9281 doesn't output metadata, so we have to use the \"unicam parser\" which\n+ * works by counting frames.\n+ */\n+\n+CamHelperOv9281::CamHelperOv9281()\n+\t: CamHelper(nullptr, frameIntegrationDiff)\n+{\n+}\n+\n+uint32_t CamHelperOv9281::GainCode(double gain) const\n+{\n+\treturn static_cast<uint32_t>(gain * 16.0);\n+}\n+\n+double CamHelperOv9281::Gain(uint32_t gain_code) const\n+{\n+\treturn static_cast<double>(gain_code) / 16.0;\n+}\n+\n+void CamHelperOv9281::GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t\t\tint &vblank_delay) const\n+{\n+\t/* The driver appears to behave as follows: */\n+\texposure_delay = 2;\n+\tgain_delay = 2;\n+\tvblank_delay = 2;\n+}\n+\n+static CamHelper *Create()\n+{\n+\treturn new CamHelperOv9281();\n+}\n+\n+static RegisterCamHelper reg(\"mov9281\", &Create);\ndiff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build\nindex 92ad3272..f8baab6d 100644\n--- a/src/ipa/raspberrypi/data/meson.build\n+++ b/src/ipa/raspberrypi/data/meson.build\n@@ -4,6 +4,7 @@ conf_files = files([\n     'imx219.json',\n     'imx290.json',\n     'imx477.json',\n+    'mov9281.json',\n     'ov5647.json',\n     'se327m12.json',\n     'uncalibrated.json',\ndiff --git a/src/ipa/raspberrypi/data/mov9281.json b/src/ipa/raspberrypi/data/mov9281.json\nnew file mode 100644\nindex 00000000..ecd262be\n--- /dev/null\n+++ b/src/ipa/raspberrypi/data/mov9281.json\n@@ -0,0 +1,92 @@\n+{\n+    \"rpi.black_level\":\n+    {\n+        \"black_level\": 4096\n+    },\n+    \"rpi.lux\":\n+    {\n+        \"reference_shutter_speed\": 2000,\n+        \"reference_gain\": 1.0,\n+        \"reference_aperture\": 1.0,\n+        \"reference_lux\": 800,\n+        \"reference_Y\": 20000\n+    },\n+    \"rpi.noise\":\n+    {\n+        \"reference_constant\": 0,\n+        \"reference_slope\": 2.5\n+    },\n+    \"rpi.sdn\":\n+    {\n+    },\n+    \"rpi.agc\":\n+    {\n+        \"metering_modes\":\n+        {\n+            \"centre-weighted\": {\n+                \"weights\": [4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0]\n+            }\n+        },\n+        \"exposure_modes\":\n+        {\n+            \"normal\":\n+            {\n+                \"shutter\": [ 100, 15000, 30000, 60000, 120000 ],\n+                \"gain\":    [ 1.0, 2.0,   3.0,   4.0,   6.0    ]\n+            }\n+        },\n+        \"constraint_modes\":\n+        {\n+            \"normal\":\n+            [\n+                { \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\": [ 0, 0.4, 1000, 0.4 ] }\n+            ]\n+        },\n+        \"y_target\": [ 0, 0.16, 1000, 0.165, 10000, 0.17 ]\n+    },\n+    \"rpi.alsc\":\n+    {\n+        \"n_iter\": 0,\n+        \"luminance_strength\": 1.0,\n+        \"corner_strength\": 1.5\n+    },\n+    \"rpi.contrast\":\n+    {\n+        \"ce_enable\": 0,\n+        \"gamma_curve\": [\n+            0,     0,\n+            1024,  5040,\n+            2048,  9338,\n+            3072,  12356,\n+            4096,  15312,\n+            5120,  18051,\n+            6144,  20790,\n+            7168,  23193,\n+            8192,  25744,\n+            9216,  27942,\n+            10240, 30035,\n+            11264, 32005,\n+            12288, 33975,\n+            13312, 35815,\n+            14336, 37600,\n+            15360, 39168,\n+            16384, 40642,\n+            18432, 43379,\n+            20480, 45749,\n+            22528, 47753,\n+            24576, 49621,\n+            26624, 51253,\n+            28672, 52698,\n+            30720, 53796,\n+            32768, 54876,\n+            36864, 57012,\n+            40960, 58656,\n+            45056, 59954,\n+            49152, 61183,\n+            53248, 62355,\n+            57344, 63419,\n+            61440, 64476,\n+            65535, 65535\n+        ]\n+    }\n+}\ndiff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build\nindex 230356d3..93f04e9e 100644\n--- a/src/ipa/raspberrypi/meson.build\n+++ b/src/ipa/raspberrypi/meson.build\n@@ -22,6 +22,7 @@ rpi_ipa_sources = files([\n     'cam_helper_imx219.cpp',\n     'cam_helper_imx290.cpp',\n     'cam_helper_imx477.cpp',\n+    'cam_helper_mov9281.cpp',\n     'controller/controller.cpp',\n     'controller/histogram.cpp',\n     'controller/algorithm.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/3"
    ]
}