Patch Detail
Show a patch.
GET /api/patches/27415/?format=api
{ "id": 27415, "url": "https://patchwork.libcamera.org/api/patches/27415/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27415/", "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": "<20260720-libipa-algorithms-v6-22-ececb73f97cb@ideasonboard.com>", "date": "2026-07-20T14:59:40", "name": "[v6,22/31] ipa: rkisp1: lsc: Port to use LscAlgorithm", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8da0d62b218cb6d23e8accec1b05ee72b0e54405", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27415/mbox/", "series": [ { "id": 6067, "url": "https://patchwork.libcamera.org/api/series/6067/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6067", "date": "2026-07-20T14:59:18", "name": "ipa: libipa: Introduce libipa algorithms", "version": 6, "mbox": "https://patchwork.libcamera.org/series/6067/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27415/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27415/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 CE061C333A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2026 15:00:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 371B867EB0;\n\tMon, 20 Jul 2026 17:00:16 +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 874EF67E6C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2026 16:59:53 +0200 (CEST)", "from [192.168.1.106] (mob-5-90-63-152.net.vodafone.it\n\t[5.90.63.152])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A21A82E64;\n\tMon, 20 Jul 2026 16:58:54 +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=\"OOvNjfKT\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784559535;\n\tbh=mGI35EtijXnwR3eGBLAvuPQc9uD9Epa859QBaNr5PvA=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=OOvNjfKTSZBMtFqqiq/SWKafifxSWUSegU05TUiAVZPFA7HMcCQoxW97z0aD/4IOk\n\tMmK0NTNxcUhX9tQkwO0g7dkqumTOc5c+VMK3jsZdHfxvVEEaSCU9zWtmRX9vQXWPzp\n\tG9DJDPYKJLxvPyXPEYLvhPThRzP01DWcd0BnPW+Y=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Mon, 20 Jul 2026 16:59:40 +0200", "Subject": "[PATCH v6 22/31] ipa: rkisp1: lsc: Port to use LscAlgorithm", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260720-libipa-algorithms-v6-22-ececb73f97cb@ideasonboard.com>", "References": "<20260720-libipa-algorithms-v6-0-ececb73f97cb@ideasonboard.com>", "In-Reply-To": "<20260720-libipa-algorithms-v6-0-ececb73f97cb@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org, \n\tStefan Klug <stefan.klug@ideasonboard.com>, \n\tMilan Zamazal <mzamazal@redhat.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=5909;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=mGI35EtijXnwR3eGBLAvuPQc9uD9Epa859QBaNr5PvA=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqXjfZwPOgzEKIPrWwvcYlZG7zTpXzZr+1wUQWg\n\t7WZUnUpr0yJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCal432QAKCRByNAaPFqFW\n\tPMquD/9p7RJWeD703l0Wwu5XWzjbY8PlUT3RH5KXJJ6GyJ3Bn9surwLJMISyfSoV1Ek33D5GUq6\n\tx2E0wq2nTZ87Ff9u4tw9NhrdICzF6jNTO16V3frJs2OCbOKprdIyiQjux3p7W7xRZ8AQsQ+KGt0\n\trQLD5iCcqWTTKZFTBRim5CmN3knfsRc2gkd9J6s/QHZfq4gPRqy8EAYruswYIp45yNeFIQCKC25\n\t2xGAYIkEm+ED0SELWVsRhMKIGQfiFsbjjS/gjhY1CLeYd5jBhAjqVJd4wGVKr3K9LDxao7uatId\n\tiHYA9yzUMeUuf6KGNlZXezdTZWP8B6/4fopxzahhCMN2awzSke9YINH7lMgCrgY4WgbL5Ghkguu\n\tkdQ9ETWsYIicAWSOe9GLmm4hmLjcpuNTMzl97Dl71q/CwdvtA2LFimrOYmNtAqA8ICxvZoDEVPq\n\tTvv2ab4wM2xtTJePMr8ILrR//e/L2JLknXA4oFCOaNlHudO0/2Vvm4mKClRJnU4CVAojQtQ7MF8\n\tOAo69zx9tHKcJzno6wBaOAIUIaNqMY9+Xjn/OKFkpsb4R6+CQPaG5CYHF6l7aLMi4+3xUBrW+0H\n\tr3Xnp3X/WLMv3uY0Ed9wnBGA8JPe6ZwVjbsOIgVvNj4Z+xc6v9uAed50f3ifnUF9kbU3Rblf4j8\n\tOW88eUppCWTG+gg==", "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>\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@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 f52516aa6ce7..b0d6649be4fd 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@@ -129,42 +123,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 /**\n@@ -198,13 +158,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@@ -232,19 +187,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@@ -282,7 +226,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@@ -302,7 +246,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 b9fbc7df20ca..63f0887f0838 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@@ -52,9 +55,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": [ "v6", "22/31" ] }