Patch Detail
Show a patch.
GET /api/1.1/patches/26377/?format=api
{ "id": 26377, "url": "https://patchwork.libcamera.org/api/1.1/patches/26377/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26377/", "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": "<20260327090323.2250-1-david.plowman@raspberrypi.com>", "date": "2026-03-27T09:02:43", "name": "[v2] ipa: rpi: Fix gamma lookup table generation for PiSP platform", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f31090830c4d314a9b2111578336184408db1e60", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26377/mbox/", "series": [ { "id": 5852, "url": "https://patchwork.libcamera.org/api/1.1/series/5852/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5852", "date": "2026-03-27T09:02:43", "name": "[v2] ipa: rpi: Fix gamma lookup table generation for PiSP platform", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5852/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26377/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26377/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 7CBBBBE086\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Mar 2026 09:03:35 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8E5B662CC7;\n\tFri, 27 Mar 2026 10:03:34 +0100 (CET)", "from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 18A7F62BB6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Mar 2026 10:03:33 +0100 (CET)", "by mail-wr1-x436.google.com with SMTP id\n\tffacd0b85a97d-439b9cf8cb5so1787443f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Mar 2026 02:03:33 -0700 (PDT)", "from localhost.localdomain ([2a06:61c0:f337:0:9c1f:b517:931a:3b19])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-43b919cefd7sm13953835f8f.17.2026.03.27.02.03.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Mar 2026 02:03:31 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"bFBRX3ra\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1774602212; x=1775207012;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=UEZETtG4ffw9sHAocFyZ21y9cv6n/0uCvf9GHpNh1yM=;\n\tb=bFBRX3raYDioAoCTUkm9Z9ho3DLGzER3gV5KfUqg4YQHWOOSPlNSaE3YqY1DBQaB8B\n\tmNHVTeunup0e+gP1+seSEQYRZCdTHicfuJXbsIze6irlCJ4rNIlNj+v1SG2TTsLBGPr0\n\tf44WTgG/bsOgcCX0q1HVgNIBbGpJUfNDetmhSO+KerxhehWJnYSQDXpLHxPUtrk9P10i\n\tsfqItT39JZ48H+3ODW/9UE7L/4Ysc/XkCD8enZZuXHqTQIVZGO2eZdMZuPfPOL8HBQ8i\n\t9b4ON/Qk8VI5MI5h0fAPfJgcJKftRUKHRCPmHowqDpCkZDAXDQwoIur4IMX3XWsyQ/9J\n\tjUCg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1774602212; x=1775207012;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=UEZETtG4ffw9sHAocFyZ21y9cv6n/0uCvf9GHpNh1yM=;\n\tb=QjGxhz8WdbqXaVjokpwRgOEGTQcbk30LZzpaEVyuezYfnmUHOkYDg2QZc+Nl5BnO3x\n\tNuLkGLpsf16/OHkFv8+Na31FNNbI+2LEfaAz4dV86N4cvyZ5KcO/Ce68avjlf0l4ofmI\n\t2Cu0dBeR9H1pyRAzyxrzcecJs5l6qnwXDvZRz8FdkgNBzpqvIf/1YbmcGon4K6pI0jQD\n\tWk1n9oUJEqe4pYVH1RW2JzHhzIZ0v9YrfWSuRaSAvUtwmlET7pzPgKa47SCW+A5WX6eH\n\t0huu9ZSlnYl1jHeqcy+Qb8hzCgwEsOZ3rPegYll0wTg3+VMBd27WbZWyhQJmqJYcev+6\n\tqk4Q==", "X-Gm-Message-State": "AOJu0YwxGM9zPK9L5FR+JPulIftEoOyYy7pJjRLtSrVWkaPvrnQria8L\n\tGvmNYUQkKmNQB8Yzd854/Z+SVg4lVeYFUgP1Ff8/J3rGeet0l8IatrT/0Ha/GG/S2F6hduLinWI\n\t7sk+C", "X-Gm-Gg": "ATEYQzzg0Rlh4lI7Rc6H+FwP1y2jpb5JjOJXH5OWy+VjbmEKGQiQonE24N8EjToX5Pb\n\tmHwv2sYS5ifOW92Dw+shDNHTnJGEdGjTcMyy+45qq8v/YC5daf32+bhdci9hmY5IlZUMqL/TQ7v\n\t+8S2PRFwt81B+jkb3hGQoYj8SKL2EKcS+bSFi167xT+1OsVvF1b6mvBSC70iCCHJIJr+pb1sm94\n\tT2qFeNAPWjCki/UxadBeqYeJ280RmN2XLRiorvxOIjcrqEoG+a3Jr0PD5IZGo5L4z43KlsSa6/K\n\tRodpt5yT0djl0tM9NpQRx3d/iG5S28tff9FeP8BPjblJwLCY4rNDq67yXaYsSuJIDuMQuepR6Gj\n\tQdz8uV2amoAxzXq17K+SMGeAhIz2Gdipxd6aFFw4uNfd4QxYLnyhZPHmQwlcnbahI3SrJ1Utb79\n\tvhR2gXAM74ZPH2apMR+4cgcALb6g/suai6lS+4r/SU26YF7BkpYj9Aqtq9uuiHQpLSwK/MgWRcV\n\tWhAmagxuRL/Gyd9A/7sdMt/0Czhr9bwt3Hq/w==", "X-Received": "by 2002:a05:6000:26c1:b0:43b:50bd:bca3 with SMTP id\n\tffacd0b85a97d-43b9ea1a398mr2330801f8f.1.1774602212209; \n\tFri, 27 Mar 2026 02:03:32 -0700 (PDT)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "David Plowman <david.plowman@raspberrypi.com>", "Subject": "[PATCH v2] ipa: rpi: Fix gamma lookup table generation for PiSP\n\tplatform", "Date": "Fri, 27 Mar 2026 09:02:43 +0000", "Message-ID": "<20260327090323.2250-1-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.47.3", "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": "generateLut was failing to fill in the final slope value, meaning that\nfully saturated pixels would full slightly short (the slope of the\nfinal piecewise linear segment would default to zero).\n\nThe loop is slightly reorganised to fix the problem.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/pisp/pisp.cpp | 42 +++++++++++++++++----------------------\n 1 file changed, 18 insertions(+), 24 deletions(-)", "diff": "diff --git a/src/ipa/rpi/pisp/pisp.cpp b/src/ipa/rpi/pisp/pisp.cpp\nindex ec7593ff..2abb59fa 100644\n--- a/src/ipa/rpi/pisp/pisp.cpp\n+++ b/src/ipa/rpi/pisp/pisp.cpp\n@@ -80,36 +80,30 @@ int generateLut(const ipa::Pwl &pwl, uint32_t *lut, std::size_t lutSize,\n \tif (pwl.empty())\n \t\treturn -EINVAL;\n \n-\tint lastY = 0;\n+\tint nextY = pwl.eval(0);\n \tfor (unsigned int i = 0; i < lutSize; i++) {\n-\t\tint x, y;\n-\t\tif (i < 32)\n-\t\t\tx = i * 512;\n-\t\telse if (i < 48)\n-\t\t\tx = (i - 32) * 1024 + 16384;\n+\t\tunsigned int nextI = i + 1;\n+\n+\t\tint nextX;\n+\t\tif (nextI < 32)\n+\t\t\tnextX = nextI * 512;\n+\t\telse if (nextI < 48)\n+\t\t\tnextX = (nextI - 32) * 1024 + 16384;\n \t\telse\n-\t\t\tx = std::min(65535u, (i - 48) * 2048 + 32768);\n+\t\t\tnextX = (nextI - 48) * 2048 + 32768;\n \n-\t\ty = pwl.eval(x);\n-\t\tif (y < 0 || (i && y < lastY)) {\n-\t\t\tLOG(IPARPI, Error)\n-\t\t\t\t<< \"Malformed PWL for Gamma, disabling!\";\n-\t\t\treturn -1;\n-\t\t}\n+\t\tint y = nextY;\n+\t\tnextY = pwl.eval(nextX);\n \n-\t\tif (i) {\n-\t\t\tunsigned int slope = y - lastY;\n-\t\t\tif (slope >= (1u << SlopeBits)) {\n-\t\t\t\tslope = (1u << SlopeBits) - 1;\n-\t\t\t\tLOG(IPARPI, Info)\n-\t\t\t\t\t<< (\"Maximum Gamma slope exceeded, adjusting!\");\n-\t\t\t\ty = lastY + slope;\n-\t\t\t}\n-\t\t\tlut[i - 1] |= slope << PosBits;\n+\t\tunsigned int slope = nextY - y;\n+\t\tif (slope >= (1u << SlopeBits)) {\n+\t\t\tslope = (1u << SlopeBits) - 1;\n+\t\t\tLOG(IPARPI, Info)\n+\t\t\t\t<< \"Maximum Gamma slope exceeded, adjusting!\";\n+\t\t\tnextY = y + slope;\n \t\t}\n \n-\t\tlut[i] = y;\n-\t\tlastY = y;\n+\t\tlut[i] = y | (slope << PosBits);\n \t}\n \n \treturn 0;\n", "prefixes": [ "v2" ] }