Patch Detail
Show a patch.
GET /api/patches/26727/?format=api
{ "id": 26727, "url": "https://patchwork.libcamera.org/api/patches/26727/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26727/", "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": "<20260512123619.120068-5-mzamazal@redhat.com>", "date": "2026-05-12T12:36:08", "name": "[RFC,v5,04/10] ipa: simple: Add LSC algorithm", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "29fe6889aa2b495a1645ee9d2c6e357b4576438d", "submitter": { "id": 177, "url": "https://patchwork.libcamera.org/api/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26727/mbox/", "series": [ { "id": 5936, "url": "https://patchwork.libcamera.org/api/series/5936/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5936", "date": "2026-05-12T12:36:04", "name": "LSC for SoftISP simple pipeline", "version": 5, "mbox": "https://patchwork.libcamera.org/series/5936/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26727/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26727/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 8B12EBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 May 2026 12:36:51 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 398996302A;\n\tTue, 12 May 2026 14:36:51 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B8CA63025\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 May 2026 14:36:49 +0200 (CEST)", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-515-pabwlV_iP6uMUIz2_YJZiQ-1;\n\tTue, 12 May 2026 08:36:45 -0400", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.17])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 70AE51800359; Tue, 12 May 2026 12:36:43 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.50.44])\n\tby mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id D98371944B20; Tue, 12 May 2026 12:36:40 +0000 (UTC)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"LfBRY+LS\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1778589408;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=WUNXChHuHrlFUDYMtTImEq0u+lDAfNwvjPCkXaMNHXY=;\n\tb=LfBRY+LS2fZioTlgyayQZQsarfwK9bnGBgcz//b+LBv9PiyerfejkKmkS/z0QnvekTDuUY\n\tZjD9T6IadFk4WDnJy6vDSstPLh9hwJKuxLuMWyNPR7vrHjm9kwKVRTQvAwfDwzNoR3/q5w\n\tvPGdTQBiAACtZGMlSoaIpdRR86bmJ6k=", "X-MC-Unique": "pabwlV_iP6uMUIz2_YJZiQ-1", "X-Mimecast-MFC-AGG-ID": "pabwlV_iP6uMUIz2_YJZiQ_1778589404", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Xander Pronk <xander.c.pronk@gmail.com>,\n\tBryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tRick ten Wolde <rick_libcamera@wolde.info>,\n\tMilan Zamazal <mzamazal@redhat.com>", "Subject": "[RFC PATCH v5 04/10] ipa: simple: Add LSC algorithm", "Date": "Tue, 12 May 2026 14:36:08 +0200", "Message-ID": "<20260512123619.120068-5-mzamazal@redhat.com>", "In-Reply-To": "<20260512123619.120068-1-mzamazal@redhat.com>", "References": "<20260512123619.120068-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "MnKsU66G3yx4yG1DT9kAd2bTJyRl1FuSYnsQHppsB6Q_1778589404", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true", "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: Xander Pronk <xander.c.pronk@gmail.com>\n\nThe lens shading algorithm uses grid-based interpolation. The grid\nvalues are specified in a tuning file as multiplication factors for each\nof the RGB colours.\n\nThe interpolated grid is transformed to an array to be used as an RGB\ntexture in debayering.\n\nCo-developed-by: Rick ten Wolde <rick_libcamera@wolde.info>\nSigned-off-by: Rick ten Wolde <rick_libcamera@wolde.info>\nSigned-off-by: Xander Pronk <xander.c.pronk@gmail.com>\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/ipa/simple/algorithms/lsc.cpp | 63 +++++++++++++++++++++++++++\n src/ipa/simple/algorithms/lsc.h | 41 +++++++++++++++++\n src/ipa/simple/algorithms/meson.build | 1 +\n 3 files changed, 105 insertions(+)\n create mode 100644 src/ipa/simple/algorithms/lsc.cpp\n create mode 100644 src/ipa/simple/algorithms/lsc.h", "diff": "diff --git a/src/ipa/simple/algorithms/lsc.cpp b/src/ipa/simple/algorithms/lsc.cpp\nnew file mode 100644\nindex 000000000..fac774481\n--- /dev/null\n+++ b/src/ipa/simple/algorithms/lsc.cpp\n@@ -0,0 +1,63 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Lens shading correction\n+ */\n+\n+#include \"lsc.h\"\n+\n+#include <libcamera/base/log.h>\n+\n+#include \"awb.h\"\n+\n+namespace libcamera {\n+\n+namespace ipa::soft::algorithms {\n+\n+LOG_DEFINE_CATEGORY(IPASoftLsc)\n+\n+int Lsc::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)\n+{\n+\tint retR = lscR_.readYaml(tuningData[\"sets\"], \"ct\", \"r\");\n+\tint retG = lscG_.readYaml(tuningData[\"sets\"], \"ct\", \"g\");\n+\tint retB = lscB_.readYaml(tuningData[\"sets\"], \"ct\", \"b\");\n+\n+\tif (retR < 0 || retG < 0 || retB < 0) {\n+\t\tLOG(IPASoftLsc, Error)\n+\t\t\t<< \"Failed to parse 'lsc' parameter from tuning file.\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int Lsc::configure([[maybe_unused]] IPAContext &context,\n+\t\t [[maybe_unused]] const IPAConfigInfo &configInfo)\n+{\n+\treturn 0;\n+}\n+\n+void Lsc::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n+\t\t [[maybe_unused]] IPAFrameContext &frameContext, DebayerParams *params)\n+{\n+\tunsigned int ct =\n+\t\tcontext.activeState.awb.temperatureK.value_or(kDefaultTemperature);\n+\n+\tconst LscMatrix matrixR = lscR_.getInterpolated(ct);\n+\tconst LscMatrix matrixG = lscG_.getInterpolated(ct);\n+\tconst LscMatrix matrixB = lscB_.getInterpolated(ct);\n+\n+\tDebayerParams::LscLookupTable lut;\n+\tconstexpr unsigned int gridSize = DebayerParams::kLscGridSize;\n+\tfor (unsigned int i = 0, j = 0; i < gridSize * gridSize; i++) {\n+\t\tlut[j++] = matrixR.data()[i];\n+\t\tlut[j++] = matrixG.data()[i];\n+\t\tlut[j++] = matrixB.data()[i];\n+\t}\n+\tparams->lscLut = lut;\n+}\n+\n+REGISTER_IPA_ALGORITHM(Lsc, \"Lsc\")\n+\n+} /* namespace ipa::soft::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/lsc.h b/src/ipa/simple/algorithms/lsc.h\nnew file mode 100644\nindex 000000000..16950c5af\n--- /dev/null\n+++ b/src/ipa/simple/algorithms/lsc.h\n@@ -0,0 +1,41 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Lens shading correction\n+ */\n+\n+#pragma once\n+\n+#include \"libcamera/internal/matrix.h\"\n+\n+#include <libipa/interpolator.h>\n+\n+#include \"algorithm.h\"\n+\n+namespace libcamera {\n+\n+namespace ipa::soft::algorithms {\n+\n+class Lsc : public Algorithm\n+{\n+public:\n+\tLsc() = default;\n+\t~Lsc() = default;\n+\n+\tint init(IPAContext &context, const ValueNode &tuningData) override;\n+\tint configure(IPAContext &context,\n+\t\t const IPAConfigInfo &configInfo) override;\n+\tvoid prepare(IPAContext &context,\n+\t\t const uint32_t frame,\n+\t\t IPAFrameContext &frameContext,\n+\t\t DebayerParams *params) override;\n+\n+private:\n+\tusing LscMatrix = Matrix<float, DebayerParams::kLscGridSize, DebayerParams::kLscGridSize>;\n+\tInterpolator<LscMatrix> lscR_;\n+\tInterpolator<LscMatrix> lscG_;\n+\tInterpolator<LscMatrix> lscB_;\n+};\n+\n+} /* namespace ipa::soft::algorithms */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/simple/algorithms/meson.build b/src/ipa/simple/algorithms/meson.build\nindex 73c637220..c9f6e5590 100644\n--- a/src/ipa/simple/algorithms/meson.build\n+++ b/src/ipa/simple/algorithms/meson.build\n@@ -6,4 +6,5 @@ soft_simple_ipa_algorithms = files([\n 'agc.cpp',\n 'blc.cpp',\n 'ccm.cpp',\n+ 'lsc.cpp',\n ])\n", "prefixes": [ "RFC", "v5", "04/10" ] }