Show a patch.

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

{
    "id": 21585,
    "url": "https://patchwork.libcamera.org/api/patches/21585/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21585/",
    "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": "<20241010134148.1788425-1-kieran.bingham@ideasonboard.com>",
    "date": "2024-10-10T13:41:48",
    "name": "ipa: rpi: Add tuning files for OV7251",
    "commit_ref": "994588fb75838b46d5eb74b916d66f0b9fc49421",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b99d070e95ca0710c83909515e1e85391b8dd781",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21585/mbox/",
    "series": [
        {
            "id": 4683,
            "url": "https://patchwork.libcamera.org/api/series/4683/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4683",
            "date": "2024-10-10T13:41:48",
            "name": "ipa: rpi: Add tuning files for OV7251",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4683/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21585/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21585/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 DA003C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Oct 2024 13:41:56 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DC5C66353A;\n\tThu, 10 Oct 2024 15:41:55 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B2EBB6353A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Oct 2024 15:41:53 +0200 (CEST)",
            "from Monstersaurus.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 87D625B2;\n\tThu, 10 Oct 2024 15:40:15 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oHJjobnJ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728567615;\n\tbh=295+IuMOlLgNyVw0Wf+dqcQiYTYjdKuaHro8Rp7BKu8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=oHJjobnJ1AyZXDFRoETKXRObuOKlZYpPpDbzxo69ASLw7SSQ3ZZSKWbdbbUC/1H1t\n\tVcLEUfz4NOunprIB0OCzL1fTvgrpuN3iYQrCZ+f6mNPJMh4gRJ0+/gO9yBecD2sk8O\n\tFyvUKePK9LVtJt/8lDaJSsSgEB+qrqgGLtYRC+fE=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Cc": "Dave Stevenson <dave.stevenson@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH] ipa: rpi: Add tuning files for OV7251",
        "Date": "Thu, 10 Oct 2024 14:41:48 +0100",
        "Message-Id": "<20241010134148.1788425-1-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "From: Dave Stevenson <dave.stevenson@raspberrypi.com>\n\nOV7251 is a mono VGA global shutter sensor that has a mainline\ndriver and works with libcamera.\nAdd the supporting files for it. The tuning is copied from OV9281.\n\nSigned-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rpi/cam_helper/cam_helper_ov7251.cpp |  66 +++++++++\n src/ipa/rpi/cam_helper/meson.build           |   1 +\n src/ipa/rpi/vc4/data/meson.build             |   1 +\n src/ipa/rpi/vc4/data/ov7251_mono.json        | 136 +++++++++++++++++++\n 4 files changed, 204 insertions(+)\n create mode 100644 src/ipa/rpi/cam_helper/cam_helper_ov7251.cpp\n create mode 100644 src/ipa/rpi/vc4/data/ov7251_mono.json",
    "diff": "diff --git a/src/ipa/rpi/cam_helper/cam_helper_ov7251.cpp b/src/ipa/rpi/cam_helper/cam_helper_ov7251.cpp\nnew file mode 100644\nindex 000000000000..7b12c44508a4\n--- /dev/null\n+++ b/src/ipa/rpi/cam_helper/cam_helper_ov7251.cpp\n@@ -0,0 +1,66 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2021, Raspberry Pi Ltd\n+ *\n+ * camera information for ov7251 sensor\n+ */\n+\n+#include <assert.h>\n+\n+#include \"cam_helper.h\"\n+\n+using namespace RPiController;\n+\n+class CamHelperOv7251 : public CamHelper\n+{\n+public:\n+\tCamHelperOv7251();\n+\tuint32_t gainCode(double gain) const override;\n+\tdouble gain(uint32_t gainCode) const override;\n+\tvoid getDelays(int &exposureDelay, int &gainDelay,\n+\t\t       int &vblankDelay, int &hblankDelay) 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+ * OV7251 doesn't output metadata, so we have to use the \"unicam parser\" which\n+ * works by counting frames.\n+ */\n+\n+CamHelperOv7251::CamHelperOv7251()\n+\t: CamHelper({}, frameIntegrationDiff)\n+{\n+}\n+\n+uint32_t CamHelperOv7251::gainCode(double gain) const\n+{\n+\treturn static_cast<uint32_t>(gain * 16.0);\n+}\n+\n+double CamHelperOv7251::gain(uint32_t gainCode) const\n+{\n+\treturn static_cast<double>(gainCode) / 16.0;\n+}\n+\n+void CamHelperOv7251::getDelays(int &exposureDelay, int &gainDelay,\n+\t\t\t\tint &vblankDelay, int &hblankDelay) const\n+{\n+\t/* The driver appears to behave as follows: */\n+\texposureDelay = 2;\n+\tgainDelay = 2;\n+\tvblankDelay = 2;\n+\thblankDelay = 2;\n+}\n+\n+static CamHelper *create()\n+{\n+\treturn new CamHelperOv7251();\n+}\n+\n+static RegisterCamHelper reg(\"ov7251\", &create);\ndiff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build\nindex 1e43f1da29cd..03e88fe082e2 100644\n--- a/src/ipa/rpi/cam_helper/meson.build\n+++ b/src/ipa/rpi/cam_helper/meson.build\n@@ -11,6 +11,7 @@ rpi_ipa_cam_helper_sources = files([\n     'cam_helper_imx519.cpp',\n     'cam_helper_imx708.cpp',\n     'cam_helper_ov64a40.cpp',\n+    'cam_helper_ov7251.cpp',\n     'cam_helper_ov9281.cpp',\n     'md_parser_smia.cpp',\n ])\ndiff --git a/src/ipa/rpi/vc4/data/meson.build b/src/ipa/rpi/vc4/data/meson.build\nindex 60477c112196..8c34a1a5faa2 100644\n--- a/src/ipa/rpi/vc4/data/meson.build\n+++ b/src/ipa/rpi/vc4/data/meson.build\n@@ -19,6 +19,7 @@ conf_files = files([\n     'ov5647.json',\n     'ov5647_noir.json',\n     'ov64a40.json',\n+    'ov7251_mono.json',\n     'ov9281_mono.json',\n     'se327m12.json',\n     'uncalibrated.json',\ndiff --git a/src/ipa/rpi/vc4/data/ov7251_mono.json b/src/ipa/rpi/vc4/data/ov7251_mono.json\nnew file mode 100644\nindex 000000000000..a9d05a01b53f\n--- /dev/null\n+++ b/src/ipa/rpi/vc4/data/ov7251_mono.json\n@@ -0,0 +1,136 @@\n+{\n+    \"version\": 2.0,\n+    \"target\": \"bcm2835\",\n+    \"algorithms\": [\n+        {\n+            \"rpi.black_level\":\n+            {\n+                \"black_level\": 4096\n+            }\n+        },\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+        },\n+        {\n+            \"rpi.noise\":\n+            {\n+                \"reference_constant\": 0,\n+                \"reference_slope\": 2.5\n+            }\n+        },\n+        {\n+            \"rpi.sdn\": { }\n+        },\n+        {\n+            \"rpi.agc\":\n+            {\n+                \"metering_modes\":\n+                {\n+                    \"centre-weighted\":\n+                    {\n+                        \"weights\":\n+                        [\n+                            4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0\n+                        ]\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, 8.0 ]\n+                    },\n+                    \"short\":\n+                    {\n+                        \"shutter\": [ 100, 5000, 10000, 20000, 30000 ],\n+                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]\n+                    },\n+                    \"long\":\n+                    {\n+                        \"shutter\": [ 1000, 30000, 60000, 90000, 120000 ],\n+                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]\n+                    }\n+                },\n+                \"constraint_modes\":\n+                {\n+                    \"normal\": [\n+                        {\n+                            \"bound\": \"LOWER\",\n+                            \"q_lo\": 0.98,\n+                            \"q_hi\": 1.0,\n+                            \"y_target\":\n+                            [\n+                                0, 0.4,\n+                                1000, 0.4\n+                            ]\n+                        }\n+                    ]\n+                },\n+                \"y_target\":\n+                [\n+                    0, 0.16,\n+                    1000, 0.165,\n+                    10000, 0.17\n+                ]\n+            }\n+        },\n+        {\n+            \"rpi.alsc\":\n+            {\n+                \"n_iter\": 0,\n+                \"luminance_strength\": 1.0,\n+                \"corner_strength\": 1.5\n+            }\n+        },\n+        {\n+            \"rpi.contrast\":\n+            {\n+                \"ce_enable\": 0,\n+                \"gamma_curve\":\n+                [\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+        }\n+    ]\n+}\n\\ No newline at end of file\n",
    "prefixes": []
}