Show a patch.

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

{
    "id": 25018,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/25018/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25018/",
    "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": "<20251113122450.287633-5-kieran.bingham@ideasonboard.com>",
    "date": "2025-11-13T12:24:39",
    "name": "[v3,04/14] test: libipa: Provide FixedPoint Quantized tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "02e9a79ef63787d850285f0f0ec03c3cd2f5f9ec",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25018/mbox/",
    "series": [
        {
            "id": 5587,
            "url": "https://patchwork.libcamera.org/api/1.1/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/25018/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25018/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 39B44C32DC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Nov 2025 12:25:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C034E60AAF;\n\tThu, 13 Nov 2025 13:25:02 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3826D60A85\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 1CC67C67;\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=\"i6nCi33T\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763036575;\n\tbh=P8Oza+S/qhIhxkbujIYMN9qXuvyCUgWcmMAihaRZznA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=i6nCi33TKUNV7hZfIpfcDu9dFrInwGLPfJQAIfI2j59suiBfNtkwGX1Svp5Ya8gEJ\n\tjXadNZ/S4R9xqVWTgcRMZNdc4odT6ZQNTfofcVBQMjKpTexm4Hdbczh5QFWrHmvWQ5\n\t2OHAJfIK9EHMlJuYxOG41OOX64cHlgLf1w+fR1Tc=",
        "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 04/14] test: libipa: Provide FixedPoint Quantized tests",
        "Date": "Thu, 13 Nov 2025 12:24:39 +0000",
        "Message-ID": "<20251113122450.287633-5-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": "Validate the new fixed-point Quantized types with tests covering Q1.7,\nUQ1.7, Q12.4 and UQ12.4 types.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nv3:\n\n- Rename quantized_type to QuantizedType\n\n test/ipa/libipa/fixedpoint.cpp | 120 +++++++++++++++++++++++++++++++--\n 1 file changed, 116 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\nindex 99eb662ddf4e..935412771851 100644\n--- a/test/ipa/libipa/fixedpoint.cpp\n+++ b/test/ipa/libipa/fixedpoint.cpp\n@@ -5,12 +5,14 @@\n  * Fixed / Floating point utility tests\n  */\n \n+#include \"../src/ipa/libipa/fixedpoint.h\"\n+\n #include <cmath>\n #include <iostream>\n #include <map>\n #include <stdint.h>\n \n-#include \"../src/ipa/libipa/fixedpoint.h\"\n+#include <libcamera/base/utils.h>\n \n #include \"test.h\"\n \n@@ -95,14 +97,124 @@ protected:\n \t\treturn TestPass;\n \t}\n \n-\tint run()\n+\ttemplate<typename Q>\n+\tint quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n \t{\n-\t\t/* fixed point conversion test */\n-\t\tif (testFixedPoint() != TestPass)\n+\t\tQ q(input);\n+\t\tusing T = typename Q::QuantizedType;\n+\n+\t\tcerr << \"  Checking \" << input << \" == \" << q.toString() << std::endl;\n+\n+\t\tT quantized = q.quantized();\n+\t\tif (quantized != expected) {\n+\t\t\tcerr << \"    ** Q Expected \" << input\n+\t\t\t     << \" to quantize to \" << utils::hex(expected)\n+\t\t\t     << \", got \" << utils::hex(quantized)\n+\t\t\t     << \" - (\" << q.toString() << \")\"\n+\t\t\t     << std::endl;\n+\t\t\treturn 1;\n+\t\t}\n+\n+\t\tif ((std::abs(q.value() - value)) > 0.0001f) {\n+\t\t\tcerr << \"    ** V Expected \" << input\n+\t\t\t     << \" to quantize to \" << value\n+\t\t\t     << \", got \" << q.value()\n+\t\t\t     << \" - (\" << q.toString() << \")\"\n+\t\t\t     << std::endl;\n+\t\t\treturn 1;\n+\t\t}\n+\n+\t\treturn 0;\n+\t}\n+\n+\ttemplate<typename Q>\n+\tint introduce(std::string type)\n+\t{\n+\t\tusing T = typename Q::QuantizedType;\n+\n+\t\tstd::cerr << std::endl;\n+\n+\t\tcerr << type << \"(\" << Q::TraitsType::min << \" .. \" << Q::TraitsType::max << \") \"\n+\t\t     << \" Min: \" << Q(Q::TraitsType::min).toString()\n+\t\t     << \" -- Max: \" << Q(Q::TraitsType::max).toString()\n+\t\t     << \" Step:\" << Q(T(1)).value()\n+\t\t     << std::endl;\n+\n+\t\tif (Q::TraitsType::min > Q::TraitsType::max) {\n+\t\t\tcerr << \"    *** \" << type\n+\t\t\t     << \" Min (\" << Q::TraitsType::min\n+\t\t\t     << \") must be less than max (\"\n+\t\t\t     << Q::TraitsType::max << \")\" << std::endl;\n+\t\t\treturn 1;\n+\t\t}\n+\n+\t\treturn 0;\n+\t}\n+\n+\tint testFixedPointQuantizers()\n+\t{\n+\t\tunsigned int fails = 0;\n+\n+\t\t/* clang-format off */\n+\n+\t\t/* Q1_7(-1 .. 0.992188)  Min: [0x80:-1] -- Max: [0x7f:0.992188] Step:0.0078125*/\n+\t\tfails += introduce<Q1_7>(\"Q1_7\");\n+\t\tfails += quantizedCheck<Q1_7>(-1.000f, 0b1'0000000, -1.0f);\t\t/* Min */\n+\t\tfails += quantizedCheck<Q1_7>(-0.992f, 0b1'0000001, -0.992188f);\t/* Min + 1 step */\n+\t\tfails += quantizedCheck<Q1_7>(-0.006f, 0b1'1111111, -0.0078125f);\t/* -1 step */\n+\t\tfails += quantizedCheck<Q1_7>( 0.000f, 0b0'0000000,  0.0f);\t\t/* Zero */\n+\t\tfails += quantizedCheck<Q1_7>( 0.008f, 0b0'0000001,  0.0078125f);\t/* +1 step */\n+\t\tfails += quantizedCheck<Q1_7>( 0.992f, 0b0'1111111,  0.992188f);\t/* Max */\n+\n+\t\t/* UQ1_7(0 .. 1.99219)  Min: [0x00:0] -- Max: [0xff:1.99219] Step:0.0078125 */\n+\t\tfails += introduce<UQ1_7>(\"UQ1_7\");\n+\t\tfails += quantizedCheck<UQ1_7>(0.0f,   0b0'0000000, 0.0f);\t\t/* Min / Zero */\n+\t\tfails += quantizedCheck<UQ1_7>(1.0f,   0b1'0000000, 1.0f);\t\t/* Mid */\n+\t\tfails += quantizedCheck<UQ1_7>(1.992f, 0b1'1111111, 1.99219f);\t\t/* Max */\n+\n+\t\t/* Q12.4(-2048 .. 2047.94)  Min: [0x8000:-2048] -- Max: [0x7fff:2047.94] Step:0.0625 */\n+\t\tintroduce<Q12_4>(\"Q12_4\");\n+\t\tfails += quantizedCheck<Q12_4>(0.0f, 0b000000000000'0000, 0.0f);\n+\t\tfails += quantizedCheck<Q12_4>(7.5f, 0b000000000111'1000, 7.5f);\n+\n+\t\t/* UQ12_4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625 */\n+\t\tintroduce<UQ12_4>(\"UQ12_4\");\n+\t\tfails += quantizedCheck<UQ12_4>(0.0f, 0b000000000000'0000, 0.0f);\n+\t\tfails += quantizedCheck<UQ12_4>(7.5f, 0b000000000111'1000, 7.5f);\n+\n+\t\t/* Validate that exceeding limits clamps to type range */\n+\t\tcerr << std::endl << \"Range validation:\" << std::endl;\n+\t\tfails += quantizedCheck<Q1_7>(-100.0f, 0b1'0000000, -1.0f);\n+\t\tfails += quantizedCheck<Q1_7>(+100.0f, 0b0'1111111, 0.992188f);\n+\t\tfails += quantizedCheck<UQ1_7>(-100.0f, 0b0'0000000, 0.0f);\n+\t\tfails += quantizedCheck<UQ1_7>(+100.0f, 0b1'1111111, 1.99219f);\n+\n+\t\t/* clang-format on */\n+\n+\t\tstd::cerr << std::endl;\n+\n+\t\tif (fails > 0) {\n+\t\t\tcerr << \"Fixed point quantizer tests failed: \"\n+\t\t\t     << std::dec << fails << \" failures.\" << std::endl;\n \t\t\treturn TestFail;\n+\t\t}\n \n \t\treturn TestPass;\n \t}\n+\n+\tint run()\n+\t{\n+\t\tunsigned int fails = 0;\n+\n+\t\t/* fixed point conversion test */\n+\t\tif (testFixedPoint() != TestPass)\n+\t\t\tfails++;\n+\n+\t\tif (testFixedPointQuantizers() != TestPass)\n+\t\t\tfails++;\n+\n+\t\treturn fails ? TestFail : TestPass;\n+\t}\n };\n \n TEST_REGISTER(FixedPointUtilsTest)\n",
    "prefixes": [
        "v3",
        "04/14"
    ]
}