Show a patch.

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

{
    "id": 23557,
    "url": "https://patchwork.libcamera.org/api/patches/23557/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23557/",
    "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": "<20250613100947.589875-2-stefan.klug@ideasonboard.com>",
    "date": "2025-06-13T10:09:36",
    "name": "[v2,1/4] test: ipa: Add basic Pwl test",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3c4dc0c2e05e6fe24637752641bce69690252a78",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23557/mbox/",
    "series": [
        {
            "id": 5217,
            "url": "https://patchwork.libcamera.org/api/series/5217/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5217",
            "date": "2025-06-13T10:09:35",
            "name": "ipa: pwl: Fixes for single point PWLs",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5217/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23557/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23557/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 4106FBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Jun 2025 10:10:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A1FA68DC2;\n\tFri, 13 Jun 2025 12:10:10 +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 5B70368DC2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Jun 2025 12:10:06 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:37bc:6352:9b26:2f94])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 93F7DED;\n\tFri, 13 Jun 2025 12:09:56 +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=\"FJ8owSot\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749809396;\n\tbh=bnwYQ2ouadNBlVO+t9nIbUtzf7z3iToY/oARe4JhTis=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=FJ8owSotn3+lf/1t4kWDZaUa2YOHxBs+4On5hSXTR68w0t1308dmrI5OELI55l9ji\n\tbDkqofoM3FHyzVFpLZTFccplOSOVCU1jvr3qBFzV8opwl8wfjmKbno93SFn+dFt1Cv\n\tpasVASAxzg/P2ri4zG2N/3zozAy6lc/qTiMq5TWI=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH v2 1/4] test: ipa: Add basic Pwl test",
        "Date": "Fri, 13 Jun 2025 12:09:36 +0200",
        "Message-ID": "<20250613100947.589875-2-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "In-Reply-To": "<20250613100947.589875-1-stefan.klug@ideasonboard.com>",
        "References": "<20250613100947.589875-1-stefan.klug@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": "Add a basic test for the Pwl class.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nChanges in v2:\n- Changed test to also test extrapolation\n---\n test/ipa/libipa/meson.build |  1 +\n test/ipa/libipa/pwl.cpp     | 50 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 51 insertions(+)\n create mode 100644 test/ipa/libipa/pwl.cpp",
    "diff": "diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\nindex 8c63ebd8e2f7..b2cc4b7461c1 100644\n--- a/test/ipa/libipa/meson.build\n+++ b/test/ipa/libipa/meson.build\n@@ -4,6 +4,7 @@ libipa_test = [\n     {'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']},\n     {'name': 'histogram', 'sources': ['histogram.cpp']},\n     {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n+    {'name': 'pwl', 'sources': ['pwl.cpp']},\n ]\n \n foreach test : libipa_test\ndiff --git a/test/ipa/libipa/pwl.cpp b/test/ipa/libipa/pwl.cpp\nnew file mode 100644\nindex 000000000000..d41a290a0e84\n--- /dev/null\n+++ b/test/ipa/libipa/pwl.cpp\n@@ -0,0 +1,50 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2025, Ideas on Board Oy\n+ *\n+ * PWL tests\n+ */\n+\n+#include \"../src/ipa/libipa/pwl.h\"\n+\n+#include <cmath>\n+#include <iostream>\n+#include <map>\n+#include <stdint.h>\n+#include <stdio.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+using namespace ipa;\n+\n+#define ASSERT_EQ(a, b)                                                 \\\n+\tif ((a) != (b)) {                                               \\\n+\t\tstd::cout << #a \" != \" #b \" (\" << a << \" ,\" << b << \")\" \\\n+\t\t\t  << std::endl;                                 \\\n+\t\treturn TestFail;                                        \\\n+\t}\n+\n+class PwlTest : public Test\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tPwl pwl;\n+\t\tpwl.append(0, 0);\n+\t\tpwl.append(1, 1);\n+\n+\t\tASSERT_EQ(pwl.eval(-1), -1);\n+\t\tASSERT_EQ(pwl.eval(0), 0);\n+\t\tASSERT_EQ(pwl.eval(0.5), 0.5);\n+\t\tASSERT_EQ(pwl.eval(1), 1);\n+\t\tASSERT_EQ(pwl.eval(2), 2);\n+\n+\t\tASSERT_EQ(pwl.size(), 2);\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(PwlTest)\n",
    "prefixes": [
        "v2",
        "1/4"
    ]
}