Patch Detail
Show a patch.
GET /api/1.1/patches/26525/?format=api
{ "id": 26525, "url": "https://patchwork.libcamera.org/api/1.1/patches/26525/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26525/", "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": "<20260420183949.110548-5-mzamazal@redhat.com>", "date": "2026-04-20T18:39:42", "name": "[RFC,v2,4/8] ipa: simple: Add LSC algorithm", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "55cc243f55ebdc2488ad364c0725fd5eb8848096", "submitter": { "id": 177, "url": "https://patchwork.libcamera.org/api/1.1/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26525/mbox/", "series": [ { "id": 5883, "url": "https://patchwork.libcamera.org/api/1.1/series/5883/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5883", "date": "2026-04-20T18:39:38", "name": "LSC for SoftISP simple pipeline", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5883/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26525/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26525/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 3CC62BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Apr 2026 18:40:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EDBA662EE8;\n\tMon, 20 Apr 2026 20:40:15 +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 67DE462EE1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Apr 2026 20:40:14 +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-353-ahUBH6KmOFO_7Y3qpId2MQ-1;\n\tMon, 20 Apr 2026 14:40:08 -0400", "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.93])\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 C7757180034D; Mon, 20 Apr 2026 18:40:07 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.16])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 76BAD180047F; Mon, 20 Apr 2026 18:40:05 +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=\"GY2Fe+VG\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1776710413;\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=Bnw9nfH1ZhpnFRoEbZjS/FiSg/RZ0hfGasNhk6TuCFQ=;\n\tb=GY2Fe+VGzwYd3JervV43w3rVnoXgU/TbXutTYHDyT/o0JR1DozbZAU+llQLycvSdlcadUT\n\tlOAyU23ZjIA06v1gaeA0RmDv8GOvwJwpluJcK0HQmZDSbMTq0+ELkTp1/U50LeTRcfQXFc\n\tT3T8LwuMlKwrIljPn8K9IDjd/CKm6fc=", "X-MC-Unique": "ahUBH6KmOFO_7Y3qpId2MQ-1", "X-Mimecast-MFC-AGG-ID": "ahUBH6KmOFO_7Y3qpId2MQ_1776710407", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Xander Pronk <xander.c.pronk@gmail.com>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tRick ten Wolde <rick_libcamera@wolde.info>,\n\tMilan Zamazal <mzamazal@redhat.com>", "Subject": "[RFC PATCH v2 4/8] ipa: simple: Add LSC algorithm", "Date": "Mon, 20 Apr 2026 20:39:42 +0200", "Message-ID": "<20260420183949.110548-5-mzamazal@redhat.com>", "In-Reply-To": "<20260420183949.110548-1-mzamazal@redhat.com>", "References": "<20260420183949.110548-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "xdR2TpDEx15_2UJWYB4ssRSGLqqkZa8UBqWXje-J9ps_1776710407", "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.\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..9588dc95d\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 YamlObject &tuningData)\n+{\n+\tint ret_r = lscR.readYaml(tuningData[\"grids\"], \"ct\", \"r\");\n+\tint ret_g = lscG.readYaml(tuningData[\"grids\"], \"ct\", \"g\");\n+\tint ret_b = lscB.readYaml(tuningData[\"grids\"], \"ct\", \"b\");\n+\n+\tif (ret_r < 0 || ret_g < 0 || ret_b < 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..9afdac0de\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 YamlObject &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<uint8_t, 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", "v2", "4/8" ] }