Show a patch.

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

{
    "id": 25019,
    "url": "https://patchwork.libcamera.org/api/patches/25019/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25019/",
    "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": "<20251113122450.287633-6-kieran.bingham@ideasonboard.com>",
    "date": "2025-11-13T12:24:40",
    "name": "[v3,05/14] ipa: libipa: fixedpoint: Fix unsigned usage",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8b23a39c0ce22e03aa6fa04cf48c55e1049c7eb9",
    "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/25019/mbox/",
    "series": [
        {
            "id": 5587,
            "url": "https://patchwork.libcamera.org/api/series/5587/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5587",
            "date": "2025-11-13T12:24:35",
            "name": "libipa: Introduce a Quantized type",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5587/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25019/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25019/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 B76E6C3317\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Nov 2025 12:25:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DFC2160AB6;\n\tThu, 13 Nov 2025 13:25:04 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6BEBF60A8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Nov 2025 13:24:55 +0100 (CET)",
            "from Monstersaurus.infra.iob\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 5B0785B2;\n\tThu, 13 Nov 2025 13:22:55 +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=\"co+jC0Ex\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763036575;\n\tbh=jppbxziEJfqgH9JUWpwgow58yHcZLYodV+ld/Kaoxh4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=co+jC0Ex3SfFBswTN6qwiNo6vy4gj11wv0u/S82mqIMFgoQmoq0lMlztJQTIEs9xU\n\tMi0cl5ncIQDYNMn6PgyCGJZ9N1/IUb/AegvEeMOtFgtyb6HPlg5C7dvcjmMMNsXFvJ\n\tU9oCJ6/UwgWbLnQjku+dP6UpwINLFNcszUx3eeuU=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH v3 05/14] ipa: libipa: fixedpoint: Fix unsigned usage",
        "Date": "Thu, 13 Nov 2025 12:24:40 +0000",
        "Message-ID": "<20251113122450.287633-6-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.50.1",
        "In-Reply-To": "<20251113122450.287633-1-kieran.bingham@ideasonboard.com>",
        "References": "<20251113122450.287633-1-kieran.bingham@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": "The fixedToFloatingPoint does not support unsigned Q types, and\nincorrectly sign-extends all values which have the top most bit set in\nthe quantized values.\n\nFix this by ensuring that only signed types perform sign extension, and\nsimplify the calcuation for unsigned types.\n\nConvert the storage of the test cases to signed types to correctly\nrepresent their intended purpose, to prevent test failures.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/libipa/fixedpoint.h    | 3 +++\n test/ipa/libipa/fixedpoint.cpp | 6 +++---\n 2 files changed, 6 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/fixedpoint.h b/src/ipa/libipa/fixedpoint.h\nindex baf5dbfa6bf8..c3ee6b2ed69f 100644\n--- a/src/ipa/libipa/fixedpoint.h\n+++ b/src/ipa/libipa/fixedpoint.h\n@@ -51,6 +51,9 @@ constexpr R fixedToFloatingPoint(T number)\n \tstatic_assert(sizeof(int) >= sizeof(T));\n \tstatic_assert(I + F <= sizeof(T) * 8);\n \n+\tif constexpr (std::is_unsigned_v<T>)\n+\t\treturn static_cast<R>(number) / static_cast<R>(1 << F);\n+\n \t/*\n \t * Recreate the upper bits in case of a negative number by shifting the sign\n \t * bit from the fixed point to the first bit of the unsigned and then right shifting\ndiff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\nindex 935412771851..3f2d9ac97fe5 100644\n--- a/test/ipa/libipa/fixedpoint.cpp\n+++ b/test/ipa/libipa/fixedpoint.cpp\n@@ -70,7 +70,7 @@ protected:\n \t\t * The second 7.992 test is to test that unused bits don't\n \t\t * affect the result.\n \t\t */\n-\t\tstd::map<double, uint16_t> testCases = {\n+\t\tstd::map<double, int16_t> testCases = {\n \t\t\t{ 7.992, 0x3ff },\n \t\t\t{   0.2, 0x01a },\n \t\t\t{  -0.2, 0x7e6 },\n@@ -83,14 +83,14 @@ protected:\n \n \t\tint ret;\n \t\tfor (const auto &testCase : testCases) {\n-\t\t\tret = testSingleFixedPoint<4, 7, uint16_t>(testCase.first,\n+\t\t\tret = testSingleFixedPoint<4, 7, int16_t>(testCase.first,\n \t\t\t\t\t\t\t\t   testCase.second);\n \t\t\tif (ret != TestPass)\n \t\t\t\treturn ret;\n \t\t}\n \n \t\t/* Special case with a superfluous one in the unused bits */\n-\t\tret = testFixedToFloat<4, 7, uint16_t, double>(0xbff, 7.992);\n+\t\tret = testFixedToFloat<4, 7, int16_t, double>(0xbff, 7.992);\n \t\tif (ret != TestPass)\n \t\t\treturn ret;\n \n",
    "prefixes": [
        "v3",
        "05/14"
    ]
}