Show a patch.

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

{
    "id": 12599,
    "url": "https://patchwork.libcamera.org/api/patches/12599/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12599/",
    "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": "<20210615105139.16171-4-david.plowman@raspberrypi.com>",
    "date": "2021-06-15T10:51:39",
    "name": "[libcamera-devel,3/3] libcamera: ipa: raspberrypi: Add support for ov9281 sensor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "06784bbc95f3c0491904f5394f44b5d5e446f262",
    "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/12599/mbox/",
    "series": [
        {
            "id": 2135,
            "url": "https://patchwork.libcamera.org/api/series/2135/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2135",
            "date": "2021-06-15T10:51:36",
            "name": "Support monochrome raw sensors",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2135/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12599/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12599/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 44905C3219\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Jun 2021 10:51:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E731C6894E;\n\tTue, 15 Jun 2021 12:51:47 +0200 (CEST)",
            "from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com\n\t[IPv6:2a00:1450:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6DBF96894C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jun 2021 12:51:44 +0200 (CEST)",
            "by mail-wr1-x42e.google.com with SMTP id c5so17774053wrq.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jun 2021 03:51:44 -0700 (PDT)",
            "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:1ce1:9965:4328:89c4])\n\tby smtp.gmail.com with ESMTPSA id\n\tu15sm1796300wmq.48.2021.06.15.03.51.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 15 Jun 2021 03:51:43 -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=\"Hl8wpvfS\"; 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=y6CY5ccg+5koDNETxXS+nXi+jxkMEVLU06/K/QWwFSc=;\n\tb=Hl8wpvfSU1Q6OS/L3nMhgy1bh6eUGgrdWDwRNXyaerSOMEF4mW+IsJmjwCH/xGS7uC\n\tZHEmOky3TXJrT7UPzphDn7bovh4AfQ3C/Lik3tPRg1wS2wUCN3v1c9qF5aHC5D0uaD+n\n\tzyGCPzAxE/4OT1MmjvvoHju1pNfz6hqJf2fpAKoF1KGZlLWiy07/rvD7E5ld2ALiq9M7\n\tqOye4aJmpeO9LDyiIlioM/tHfh+BTtEth6lCIKIQfQl12o/mnHui8xo5pLWxhu2VJxAe\n\tmHA94PpHdOciA63qCAHAVjqOsoBeh+9QgFLzHf4rDoODAi4B5osnrvXFcVsqC+ft2tKH\n\tiDaA==",
        "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=y6CY5ccg+5koDNETxXS+nXi+jxkMEVLU06/K/QWwFSc=;\n\tb=iD62OwRTc/jsuuiA171hJlc3gxHyeCv6YbQ2+eK5+s1wbbFf2kHLbLXQ3P7g5ZaXhF\n\tcBuNJceMh3dKWQnllETIOrrIhpxGMXTXEw3FVp/ZLgyk9ivuYXOsOmvnLsIv0R7gwuDa\n\t4ijzJbs4N4HCgH3a7+I6cx1GKQdiPxLBr1ssS3mOdSjdirPEZMsxP8CaVjsN+HyyiiQ+\n\tVhEIFWuyDr/F4VyoFRK7owx3dIfepCV7Ph/ppDRzU+4FXX8YiHvdZl+bn5LS1imrYipE\n\t0QvJpKwIn3FNCqUg3KqxMIbV7KMlKnMGEuEm+oupB2ZVuThOp1a0W+WMpDaldGj0ApWg\n\tK1+w==",
        "X-Gm-Message-State": "AOAM533DGT64Z9PzZ+IqESnQ+JiDxIbEgOtRcsQHp6wwquQ60/JX9yBI\n\t6dk+qwQ7DHk/gy8yDJIp0gSFGhdahKXgcXOe",
        "X-Google-Smtp-Source": "ABdhPJynCD6MwZ6vvzH5q9T3HhW257EWkGUHLLel7QaYSdpWeJOzgZpPqyXi0tdeG5AB3IcIy9AU1Q==",
        "X-Received": "by 2002:adf:d1ec:: with SMTP id\n\tg12mr24717392wrd.204.1623754303966; \n\tTue, 15 Jun 2021 03:51:43 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 15 Jun 2021 11:51:39 +0100",
        "Message-Id": "<20210615105139.16171-4-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210615105139.16171-1-david.plowman@raspberrypi.com>",
        "References": "<20210615105139.16171-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 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 | 108 +++++++++++++++++++++\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, 202 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..5645c73a\n--- /dev/null\n+++ b/src/ipa/raspberrypi/cam_helper_mov9281.cpp\n@@ -0,0 +1,108 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2019, 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+\tunsigned int HideFramesStartup() const override;\n+\tunsigned int HideFramesModeSwitch() const override;\n+\tunsigned int MistrustFramesStartup() const override;\n+\tunsigned int MistrustFramesModeSwitch() 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/*\n+\t * We run this sensor in a mode where the gain delay is bumped up to\n+\t * 2. It seems to be the only way to make the delays \"predictable\".\n+\t */\n+\texposure_delay = 2;\n+\tgain_delay = 2;\n+\tvblank_delay = 2;\n+}\n+\n+unsigned int CamHelperOv9281::HideFramesStartup() const\n+{\n+\t/*\n+\t * On startup, we get a couple of under-exposed frames which\n+\t * we don't want shown.\n+\t */\n+\treturn 2;\n+}\n+\n+unsigned int CamHelperOv9281::HideFramesModeSwitch() const\n+{\n+\t/*\n+\t * After a mode switch, we get a couple of under-exposed frames which\n+\t * we don't want shown.\n+\t */\n+\treturn 2;\n+}\n+\n+unsigned int CamHelperOv9281::MistrustFramesStartup() const\n+{\n+\t/*\n+\t * First couple of frames are under-exposed and are no good for control\n+\t * algos.\n+\t */\n+\treturn 2;\n+}\n+\n+unsigned int CamHelperOv9281::MistrustFramesModeSwitch() const\n+{\n+\t/*\n+\t * First couple of frames are under-exposed even after a simple\n+\t * mode switch, and are no good for control algos.\n+\t */\n+\treturn 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 d1397a32..e384c7ce 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",
        "3/3"
    ]
}