Patch Detail
Show a patch.
GET /api/1.1/patches/27289/?format=api
{ "id": 27289, "url": "https://patchwork.libcamera.org/api/1.1/patches/27289/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27289/", "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-v4-24-f0e99f035294@ideasonboard.com>", "date": "2026-07-08T09:25:11", "name": "[v4,24/35] 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/27289/mbox/", "series": [ { "id": 6046, "url": "https://patchwork.libcamera.org/api/1.1/series/6046/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6046", "date": "2026-07-08T09:24:47", "name": "ipa: libipa: Introduce libipa algorithms", "version": 4, "mbox": "https://patchwork.libcamera.org/series/6046/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27289/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27289/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 2BADDC3338\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 8 Jul 2026 09:25:39 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D46AC66094;\n\tWed, 8 Jul 2026 11:25:37 +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 788E466074\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 8 Jul 2026 11:25:12 +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 D077CE9C;\n\tWed, 8 Jul 2026 11:24:22 +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=\"PX21CSKF\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783502662;\n\tbh=AbFShManA6ICgctzKMYWXIvYMk/Czw4c5Qve0xdr//4=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=PX21CSKFjfpJ45gRv3wGjgIllUKDJ/7hrDf4qyA/nevthHap7XacNGDmljOdiRGPA\n\tIIPEV2oiOn8R+Hsche5iKGEXiKF1BgLBi0bRi9enJs78XH55TDnPtXliD7uvNWGnzh\n\t/Tvd4/Ag2Mn9oaJBlwm1Adqe4/hrk2qX+djNHNq0=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Wed, 08 Jul 2026 11:25:11 +0200", "Subject": "[PATCH v4 24/35] 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-v4-24-f0e99f035294@ideasonboard.com>", "References": "<20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com>", "In-Reply-To": "<20260708-libipa-algorithms-v4-0-f0e99f035294@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/ZANAwAKAXI0Bo8WoVY8AcsmYgBqThdvPJr9jrXXPkdDZZbJcEWDhZ6I3VRgwv812\n\tBCO08eoBK6JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak4XbwAKCRByNAaPFqFW\n\tPBLLD/0cZ94FCqUEqDOvHAZiPwAWrSVoBoBoTQjAf3k1nurKke6cyr9sMN3nT0txBTEIfpgfZ4c\n\t15N/qrfb3tcbuj5nyxVvxoPHIqcWdV1JVDIfLKcBiBegOyS4M4j0z5USCAe7irgiCMfr+uBEjY9\n\tXwSTvqv3jRMNbutqVvxGEyK6xqQLTJ0z8Xj0FDbr6/T2fRMXzrDliUhTYG/t6fUvpDieuFysu3+\n\txPCYS11BynYA0MbkTSOIlTB42cAjBvTzJbGOXCJkhA3BIgZRcysFS9nho7JytTjc2kEeIObtWrY\n\tag49szIdKVQdMDmqYtW+uwJ++m6Y/qi3QsNRNWH5W2RPskBJmMJ90vXx4HxGbmbvK8/8ghPhjC8\n\t+5CtuI4TtbE5i8OYTZEJxCIOeFycPSktz9HSTwGZPzAbaNSC7D7h9JyduKHbCDDGBMPK7QaiAKE\n\t6qJulazQ6JAljAi9yIeE3ooDx/EAR/REe1nI46PHyvC7Ipt8M4XHEwiqfT7snAQEKX+TNSoZ83f\n\tXESIv1+lYoWNcO5PP2SdVgH8DJnx0r+tuoSsOxSrxXJHHXysgEqaAKzA5Evm0I66AmUqAg62glO\n\t9/BDr46jCamOpMrskPdGREfjQgCXT7JLu5hzA4WCY35D9WO2JOiXjD24Dn6gSxbcft2Pey03o6I\n\t+a/eKeTSNsaUAYQ==", "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": [ "v4", "24/35" ] }