Show a patch.

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

{
    "id": 23030,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23030/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23030/",
    "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": "<20250326080034.1733385-3-paul.elder@ideasonboard.com>",
    "date": "2025-03-26T08:00:32",
    "name": "[v2,2/3] test: ipa: libipa: Add CameraSensorHelper Gain Model tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "c0f1290d5523ec5d44f8c0ad6f317d872a67090b",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": {
        "id": 49,
        "url": "https://patchwork.libcamera.org/api/1.1/users/49/?format=api",
        "username": "stefan",
        "first_name": "Stefan",
        "last_name": "Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/23030/mbox/",
    "series": [
        {
            "id": 5081,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5081/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5081",
            "date": "2025-03-26T08:00:30",
            "name": "libipa: Fix CameraSensorHelper gain helpers",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5081/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23030/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23030/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 8D387C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 08:00:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 36FA86895E;\n\tWed, 26 Mar 2025 09:00:50 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 145B968952\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 09:00:48 +0100 (CET)",
            "from neptunite.flets-east.jp (unknown\n\t[IPv6:2404:7a81:160:2100:7402:917d:ea0c:6d4c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2992E99F;\n\tWed, 26 Mar 2025 08:58:58 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Q/GJGGEZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742975940;\n\tbh=ZLlCj5BtvNnBwa3s/U1+UcbUZDL7OgMTE+FlKyPtWdY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Q/GJGGEZXX/j/Di9oXw8CNKuTHK0QbBbIOmQ+mEeGtckFiJuVVTNzGrX0KGQrx8OO\n\t0aeRwpO/RogPhBBg4Dq3mgN5DO0xX3rr6m2We2rAz2dtH8oR30dtvyQKkfZfHk8yTY\n\tDhL+fMoLmARdWiqGZ91ExaEqGvxN8AQmCxjLvziw=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH v2 2/3] test: ipa: libipa: Add CameraSensorHelper Gain Model\n\ttests",
        "Date": "Wed, 26 Mar 2025 17:00:32 +0900",
        "Message-ID": "<20250326080034.1733385-3-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.2",
        "In-Reply-To": "<20250326080034.1733385-1-paul.elder@ideasonboard.com>",
        "References": "<20250326080034.1733385-1-paul.elder@ideasonboard.com>",
        "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: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nIntroduce a test that validates conversion of the gain model\nin each CameraSensorHelper.\n\nIt should be expected that if a gainCode produces a given gain\nvalue, then converting that gain back should produce the same\nresult.\n\nThis test fails on the following CameraSensorHelpers:\n - imx219 imx258 imx283 imx290 imx296 imx327 imx335 imx477\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nDiscussion points:\n- Should we duplicate the min/max gain values for all the sensors in the\n  CameraSensorHelpers? (instead of using 0~240 that comes from the\n  imx283) Is it fine to duplicate it anyway because we're already\n  duplicating a lot of other sensor propery values?\n- Should we restrict the test to a specific set of sensors so that we\n  don't have to deal with breaking tests from, for example, sensors that\n  use gains of different Q formats or non-continuous ranges etc? Or\n  should we test everything and diligently fix the test for every new\n  sensor so that we're sure that nothing breaks?\n\nChanges in v2:\n- recover from bitrot\n---\n test/ipa/camera_sensor_helper.cpp | 69 +++++++++++++++++++++++++++++++\n test/ipa/meson.build              |  1 +\n 2 files changed, 70 insertions(+)\n create mode 100644 test/ipa/camera_sensor_helper.cpp",
    "diff": "diff --git a/test/ipa/camera_sensor_helper.cpp b/test/ipa/camera_sensor_helper.cpp\nnew file mode 100644\nindex 000000000000..2d37628f87c4\n--- /dev/null\n+++ b/test/ipa/camera_sensor_helper.cpp\n@@ -0,0 +1,69 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2024, Ideas on Board Oy.\n+ */\n+\n+#include \"libipa/camera_sensor_helper.h\"\n+\n+#include <iostream>\n+#include <string.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+using namespace libcamera::ipa;\n+\n+class CameraSensorHelperTest : public Test\n+{\n+protected:\n+\tint testGainModel(std::string model)\n+\t{\n+\t\tint ret = TestPass;\n+\n+\t\tstd::unique_ptr<CameraSensorHelper> camHelper_;\n+\n+\t\tcamHelper_ = CameraSensorHelperFactoryBase::create(model);\n+\t\tif (!camHelper_) {\n+\t\t\tstd::cout\n+\t\t\t\t<< \"Failed to create camera sensor helper for \"\n+\t\t\t\t<< model;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tfor (unsigned int i = 0; i < 240; i++) {\n+\t\t\tfloat gain = camHelper_->gain(i);\n+\t\t\tuint32_t gainCode = camHelper_->gainCode(gain);\n+\n+\t\t\tif (i != gainCode) {\n+\t\t\t\tstd::cout << model << \": Gain conversions failed: \"\n+\t\t\t\t\t  << i << \" : \" << gain << \" : \"\n+\t\t\t\t\t  << gainCode << std::endl;\n+\n+\t\t\t\tret = TestFail;\n+\t\t\t}\n+\t\t};\n+\n+\t\treturn ret;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tunsigned int failures = 0;\n+\n+\t\tstd::vector<CameraSensorHelperFactoryBase *> factories;\n+\n+\t\tfor (auto factory : CameraSensorHelperFactoryBase::factories()) {\n+\t\t\tconst std::string &model = factory->name();\n+\n+\t\t\tcout << \"Testing CameraSensorHelper for \" << model << endl;\n+\n+\t\t\tif (testGainModel(factory->name()) == TestFail)\n+\t\t\t\tfailures++;\n+\t\t}\n+\n+\t\treturn failures ? TestFail : TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(CameraSensorHelperTest)\ndiff --git a/test/ipa/meson.build b/test/ipa/meson.build\nindex ceed15ba660a..98aff58b8a1a 100644\n--- a/test/ipa/meson.build\n+++ b/test/ipa/meson.build\n@@ -3,6 +3,7 @@\n subdir('libipa')\n \n ipa_test = [\n+    {'name': 'camera_sensor_helper', 'sources': ['camera_sensor_helper.cpp']},\n     {'name': 'ipa_module_test', 'sources': ['ipa_module_test.cpp']},\n     {'name': 'ipa_interface_test', 'sources': ['ipa_interface_test.cpp']},\n ]\n",
    "prefixes": [
        "v2",
        "2/3"
    ]
}