Patch Detail
Show a patch.
GET /api/1.1/patches/27331/?format=api
{ "id": 27331, "url": "https://patchwork.libcamera.org/api/1.1/patches/27331/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27331/", "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": "<20260708-libipa-algorithms-v5-25-0759d0359f52@ideasonboard.com>", "date": "2026-07-08T15:51:07", "name": "[v5,25/36] ipa: rkisp1: lsc: Port to use LscAlgorithm", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4b6010620d0752759898e9489479c75c72afb11d", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27331/mbox/", "series": [ { "id": 6048, "url": "https://patchwork.libcamera.org/api/1.1/series/6048/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6048", "date": "2026-07-08T15:50:42", "name": "ipa: libipa: Introduce libipa algorithms", "version": 5, "mbox": "https://patchwork.libcamera.org/series/6048/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27331/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27331/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 398FCC3332\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 8 Jul 2026 15:51:50 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF3A1660FE;\n\tWed, 8 Jul 2026 17:51:49 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EAA40660DC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 8 Jul 2026 17:51:19 +0200 (CEST)", "from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1CE593FC5;\n\tWed, 8 Jul 2026 17:50:30 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Z65170fe\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783525830;\n\tbh=AbFShManA6ICgctzKMYWXIvYMk/Czw4c5Qve0xdr//4=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=Z65170fe2ow0NqxpKoQMtnS7CZXr2X1/9ngfEteBzp+XVG/f4Edw2BuHvkQKCVxQC\n\tY6OhWdPm4zRtnjpwaMCQtNHxsUx3E8RSmiLsAZhHhglWoJ3imS9XjeHBHlJEuHQjmi\n\tQSmCJREsqH79cUYp/7hd1B/HAe+K6XYkfAWl+L/o=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Wed, 08 Jul 2026 17:51:07 +0200", "Subject": "[PATCH v5 25/36] ipa: rkisp1: lsc: Port to use LscAlgorithm", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260708-libipa-algorithms-v5-25-0759d0359f52@ideasonboard.com>", "References": "<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>", "In-Reply-To": "<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org, \n\tStefan Klug <stefan.klug@ideasonboard.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=5866;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=AbFShManA6ICgctzKMYWXIvYMk/Czw4c5Qve0xdr//4=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqTnHq6HVKXq/YdUjBGDrzzh819yve0+33xrAcR\n\tBvnE2rsca2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak5x6gAKCRByNAaPFqFW\n\tPCPUD/4uPnV51npygEBE53u9zEjlnEP4UoA4WzvuKhIxepM+Zpr1Q2z7mKsutGyg+RfzMePkbGM\n\tDWMB+lHcKTQZklQdW1SNPIWgd/3cdOIyvc8kj1PvwQ+ErPJqChNXDUmvcO3IoI165iDvXQOdeCW\n\tp43uako6gbwKQtP4Q3CCo2D3k4RuLSjUqrSjLEZYFCja04+bUc3fqK1w2L1QdP+YI8S5EVMEqHV\n\tuXW6tUEhMKHJHggexZFV3XEU6444L7URh3zMZuSp6L75fCflfLhAn2utGu2d8EF1YaRjb6GsxGX\n\tLtvM208r8iUGtDjSP7bKoTVh/mwrLyqrcoSz7c28NQhzVLEbLUIR4PkL45EBUn0eoyFztWEeQ93\n\ty21JjpLLvrUikLggFX30ohTOj56tmvlKf1jDNK3WAnemny3ZBxodUmAPEL5P9aEVtnXtGndzWxZ\n\tZlnlfaqtqIH+tUV+FYE8TZp7Oko/AQG/nBPSs7wPAgjMx70Sbuk2m4nlVGPBTdlrrL//rIqMSsD\n\t/xOgs/4A17+ZrB5Aax2wlOcnrMkJGUd04bm0SizzFxJrKBHbQSn8NVLO/rG/A4usUnRty/+kocr\n\tTh4HFbHMeY+t9wjKQ+Ni+GD6SPGGcwQbuYhPhWFn2l+WhPVeNL29r/ImML0A1xoZq/VPOhWXnT5\n\tKlZ8y5DlAzjC96Q==", "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B", "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": "Port the RkISP1 LSC algorithm to use the LscAlgorithm class by\ncomposition.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/lsc.cpp | 72 +++++----------------------------------\n src/ipa/rkisp1/algorithms/lsc.h | 13 +++----\n src/ipa/rkisp1/ipa_context.h | 10 ++----\n 3 files changed, 18 insertions(+), 77 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 7010c97db22e..0d9f1b006107 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -14,12 +14,6 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/utils.h>\n \n-#include \"libcamera/internal/value_node.h\"\n-\n-#include \"libipa/lsc_polynomial.h\"\n-#include \"libipa/lsc_table.h\"\n-#include \"linux/rkisp1-config.h\"\n-\n /**\n * \\file lsc.h\n */\n@@ -73,42 +67,8 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \txPos_ = sizesListToPositions(xSize_);\n \tyPos_ = sizesListToPositions(ySize_);\n \n-\t/* Get all defined sets to apply. */\n-\tconst ValueNode &sets = tuningData[\"sets\"];\n-\tif (!sets.isList()) {\n-\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t<< \"'sets' parameter not found in tuning file\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tint ret;\n-\n-\tstd::string type = tuningData[\"type\"].get<std::string>(\"table\");\n-\tif (type == \"table\") {\n-\t\tLOG(RkISP1Lsc, Debug) << \"Loading tabular LSC data.\";\n-\t\talgo_ = std::make_unique<LscTable>();\n-\t\tret = algo_->parseLscData(sets);\n-\t} else if (type == \"polynomial\") {\n-\t\tLOG(RkISP1Lsc, Debug) << \"Loading polynomial LSC data.\";\n-\t\t/*\n-\t\t * \\todo: Most likely the reference frame should be native_size.\n-\t\t * Let's wait how the internal discussions progress.\n-\t\t */\n-\t\talgo_ = std::make_unique<LscPolynomial>(context.sensorInfo.activeAreaSize);\n-\t\tret = algo_->parseLscData(sets);\n-\t} else {\n-\t\tLOG(RkISP1Lsc, Error) << \"Unsupported LSC data type '\"\n-\t\t\t\t << type << \"'\";\n-\t\tret = -EINVAL;\n-\t}\n-\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tcontext.ctrlMap[&controls::LensShadingCorrectionEnable] =\n-\t\tControlInfo(false, true, true);\n-\n-\treturn 0;\n+\treturn lscAlgo_.init(tuningData, context.sensorInfo.activeAreaSize,\n+\t\t\t context.ctrlMap);\n }\n \n std::vector<double> LensShadingCorrection::parseSizes(const ValueNode &tuningData,\n@@ -199,13 +159,8 @@ int LensShadingCorrection::configure(IPAContext &context,\n \t\tyGrad_[i] = std::round(32768 / ySizes_[i]);\n \t}\n \n-\tLOG(RkISP1Lsc, Debug) << \"Sample LSC data for \" << configInfo.analogCrop;\n-\tlsc::ComponentsMap shadingData = algo_->sampleForCrop(configInfo.analogCrop,\n-\t\t\t\t\t\t\t xPos_, yPos_);\n-\tsets_.setData(std::move(shadingData));\n-\n-\tcontext.activeState.lsc.enabled = true;\n-\treturn 0;\n+\treturn lscAlgo_.configure(context.activeState.lsc, configInfo.analogCrop,\n+\t\t\t\t xPos_, yPos_);\n }\n \n void LensShadingCorrection::setParameters(rkisp1_cif_isp_lsc_config &config)\n@@ -233,19 +188,8 @@ void LensShadingCorrection::queueRequest(IPAContext &context,\n \t\t\t\t\t IPAFrameContext &frameContext,\n \t\t\t\t\t const ControlList &controls)\n {\n-\tauto &lsc = context.activeState.lsc;\n-\n-\tconst auto &lscEnable = controls.get(controls::LensShadingCorrectionEnable);\n-\tif (lscEnable && *lscEnable != lsc.enabled) {\n-\t\tlsc.enabled = *lscEnable;\n-\n-\t\tLOG(RkISP1Lsc, Debug)\n-\t\t\t<< (lsc.enabled ? \"Enabling\" : \"Disabling\") << \" Lsc\";\n-\n-\t\tframeContext.lsc.update = true;\n-\t}\n-\n-\tframeContext.lsc.enabled = lsc.enabled;\n+\tlscAlgo_.queueRequest(context.activeState.lsc, frameContext.lsc,\n+\t\t\t controls);\n }\n \n /**\n@@ -283,7 +227,7 @@ void LensShadingCorrection::prepare([[maybe_unused]] IPAContext &context,\n \n \tsetParameters(*config);\n \n-\tconst lsc::Components &set = sets_.getInterpolated(quantizedCt);\n+\tconst lsc::Components &set = lscAlgo_.interpolateComponents(quantizedCt);\n \tcopyTable(*config, set);\n \n \tlastAppliedCt_ = ct;\n@@ -303,7 +247,7 @@ void LensShadingCorrection::process([[maybe_unused]] IPAContext &context,\n \t\t\t\t [[maybe_unused]] const rkisp1_stat_buffer *stats,\n \t\t\t\t ControlList &metadata)\n {\n-\tmetadata.set(controls::LensShadingCorrectionEnable, frameContext.lsc.enabled);\n+\tlscAlgo_.process(frameContext.lsc, metadata);\n }\n \n REGISTER_IPA_ALGORITHM(LensShadingCorrection, \"LensShadingCorrection\")\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex 06aa7a5f133c..e7d3091a36c5 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -7,10 +7,13 @@\n \n #pragma once\n \n-#include <memory>\n+#include <vector>\n \n-#include \"libipa/interpolator.h\"\n-#include \"libipa/lsc_base.h\"\n+#include <linux/rkisp1-config.h>\n+\n+#include \"libcamera/internal/value_node.h\"\n+\n+#include \"libipa/lsc.h\"\n \n #include \"algorithm.h\"\n \n@@ -55,9 +58,7 @@ private:\n \tunsigned int lastAppliedCt_;\n \tunsigned int lastAppliedQuantizedCt_;\n \n-\tipa::Interpolator<lsc::Components> sets_;\n-\n-\tstd::unique_ptr<LscImplementation> algo_;\n+\tLscAlgorithm lscAlgo_;\n };\n \n } /* namespace ipa::rkisp1::algorithms */\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 6698ccfd77cf..7b4346c54ed2 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -30,6 +30,7 @@\n #include \"libipa/ccm.h\"\n #include \"libipa/fc_queue.h\"\n #include \"libipa/fixedpoint.h\"\n+#include \"libipa/lsc.h\"\n \n namespace libcamera {\n \n@@ -141,9 +142,7 @@ struct IPAActiveState {\n \t\tdouble strength;\n \t} wdr;\n \n-\tstruct {\n-\t\tbool enabled;\n-\t} lsc;\n+\tipa::lsc::ActiveState lsc;\n };\n \n struct IPAFrameContext : public FrameContext {\n@@ -217,10 +216,7 @@ struct IPAFrameContext : public FrameContext {\n \t\tdouble gain;\n \t} wdr;\n \n-\tstruct {\n-\t\tbool enabled;\n-\t\tbool update;\n-\t} lsc;\n+\tipa::lsc::FrameContext lsc;\n };\n \n struct IPAContext {\n", "prefixes": [ "v5", "25/36" ] }