From patchwork Wed Aug 5 16:13:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 27649 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AFF43C334A for ; Wed, 5 Aug 2026 16:13:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4157368178; Wed, 5 Aug 2026 18:13:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VUO/vHu4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E34E68143 for ; Wed, 5 Aug 2026 18:13:43 +0200 (CEST) Received: from [192.168.125.177] (mob-109-113-25-35.net.vodafone.it [109.113.25.35]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AABE03AE4; Wed, 5 Aug 2026 18:12:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1785946353; bh=u9V2JQQr/lPa1Mq/Jr0a/zN5b1A53nax81FRD0HfLtU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VUO/vHu4HtC6QH3pGvxac8zIXiySAPCW58IW81yDftvvx4V9w2iJVtI6af1YGmpAa 4GlkUt3/pjv1AcsA2kuVVLtcKLeaw0gxY58BpD3DcqwmidYwgk4hkZYzanIwpRKT2+ ACEy6yKiQ5BHzoyRndF2l7ZmX/uitq7x2wrftB/w= From: Jacopo Mondi Date: Wed, 05 Aug 2026 18:13:11 +0200 Subject: [PATCH v7 29/32] ipa: libipa: lsc: Re-sort LscAlgorithmBase documentation MIME-Version: 1.0 Message-Id: <20260805-libipa-algorithms-v7-29-7425b5b795d4@ideasonboard.com> References: <20260805-libipa-algorithms-v7-0-7425b5b795d4@ideasonboard.com> In-Reply-To: <20260805-libipa-algorithms-v7-0-7425b5b795d4@ideasonboard.com> To: libcamera-devel@lists.libcamera.org, Stefan Klug , Milan Zamazal Cc: Jacopo Mondi X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=6732; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=u9V2JQQr/lPa1Mq/Jr0a/zN5b1A53nax81FRD0HfLtU=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqc2EiBKf3Y5S3cpZARC9ZusmHEl3vjyMHioNb2 afQwmFnZ/qJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCanNhIgAKCRByNAaPFqFW PJ1dD/sHz/j7GhS+cghsIfoljtP3WbQbfphnUl/qJEC9DXvGI2iJmSxLpOvVcFlyo2D3AidrAQZ OHBcZDNUvNRE5ZNboaQF7uiH+MJnZrMMB7M7Wz4gxQT41qWmPC5MAjEdga/SL+rLiQdHbOEd4fb Dmvfunbr0MeLdeMFb67Wh/m9UodOmV0UAPT8LpepIccNDyH12hc/MEAhuZni3elHEIllRFHurDs Vk/nK4s4NA9iWPapjDwKgxz5Aa/8yIFsRENSPD3BjwbNM8UfCy34ibZ3r3zl4fEC4apzXuNfse+ LeUY6vZ5DJvvYG895ZKk0ISA++SBqxNsoF+KOqajwGKAXTG/nf2DU1MKJ4ZlVtNuijAB1pC0wwA 8ySSEWMBn+RDxFS4Y4w8OKAPb8WzElQr657I312neZSiygpLRxFbxKRxyaxSStZq13Y823L54nv CB5K6Z77y62aBcC1xSyQNXS5GXYY+E6ilNUPmDCJhBZtwlQLCrIww61qSpEyq8f0Z1eq07z3Hd0 ZzAGqTVQ9mJRVITEZNFL+IqO7s2Ba3LiRscn04su85d3RvUOYgl6vbWHhi6wOF1aR5W2s8YY5p9 bI6061lcb//XgY7dio3Fkt8s+pU6CYDB1CW+IKw93AffKNp9MS/wYYxPjVwopOBC1e0fywUwm4q +4f9mB8mJyAydEQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The documentation had not been resorted in the previous patch to keep the diff short. Re-sort the documentation of the LscAlgorithmBase and LscAlgorithm classes to match the declaration order. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/libipa/lsc.cpp | 168 ++++++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/src/ipa/libipa/lsc.cpp b/src/ipa/libipa/lsc.cpp index bb02290fc9ad..a8b89bcedf57 100644 --- a/src/ipa/libipa/lsc.cpp +++ b/src/ipa/libipa/lsc.cpp @@ -111,6 +111,90 @@ void Interpolator>:: * Base class for LscAlgorithm for non-templated functions implementation */ +/** + * \param[in] tuningData The tuning data + * \param[in] controls The IPA list of supported controls + * \param[in] descriptor The LSC engine descriptor + * + * Parse \a tuningData according to the settings specified in \a descriptor to + * populate the LSC data and registers LSC controls in \a controls. + * + * \return 0 on success, a negative error code otherwise + */ +int LscAlgorithmBase::init(const ValueNode &tuningData, ControlInfoMap::Map &controls, + const LscDescriptor &descriptor) +{ + polynomial_ = false; + + std::string type = tuningData["type"].get("table"); + if (type == "table") { + impl_ = std::make_unique(); + LOG(Lsc, Debug) << "Using table-based Lsc"; + } else if (type == "polynomial") { + impl_ = std::make_unique(); + polynomial_ = true; + LOG(Lsc, Debug) << "Using polynomial Lsc"; + } else { + LOG(Lsc, Error) << "Unsupported Lsc algorithm '" + << type << "'"; + return -EINVAL; + } + + const ValueNode &yamlSets = tuningData["sets"]; + if (!yamlSets.isList()) { + LOG(Lsc, Error) << "'sets' parameter not found in tuning file"; + return -EINVAL; + } + + int ret = impl_->parseLscData(yamlSets, descriptor); + if (ret) + return ret; + + controls[&controls::LensShadingCorrectionEnable] = + ControlInfo(false, true, true); + + return 0; +} + +/** + * \brief Queue a request to the lsc algorithm + * \param[in] state The lsc active state + * \param[in] context The lsc frame context + * \param[in] controls The list of controls associated with a Request + * + * Queue a new list of \a controls to the lsc algorithm. + * The only supported control is controls::LensShadingCorrectionEnable. + */ +void LscAlgorithmBase::queueRequest(lsc::ActiveState &state, + lsc::FrameContext &context, + const ControlList &controls) +{ + const auto &lscEnable = controls.get(controls::LensShadingCorrectionEnable); + if (lscEnable && *lscEnable != state.enabled) { + state.enabled = *lscEnable; + + LOG(Lsc, Debug) + << (state.enabled ? "Enabling" : "Disabling") << " Lsc"; + + context.update = true; + } + + context.enabled = state.enabled; +} + +/** + * \brief Populate the list of lsc metadata + * \param[in] context The lsc frame context + * \param[in] metadata The list of metadata + * + * Populates the list of \a metadata with controls handled by the LscAlgorithm + * class. The only supported metadata is controls::LensShadingCorrectionEnable. + */ +void LscAlgorithmBase::process(lsc::FrameContext &context, ControlList &metadata) +{ + metadata.set(controls::LensShadingCorrectionEnable, context.enabled); +} + /** * \var LscAlgorithmBase::impl_ * \brief The LSC algorithm implementation @@ -287,51 +371,6 @@ void Interpolator>:: * can retrieve them using LscAlgorithm::getComponents(). */ -/** - * \param[in] tuningData The tuning data - * \param[in] controls The IPA list of supported controls - * \param[in] descriptor The LSC engine descriptor - * - * Parse \a tuningData according to the settings specified in \a descriptor to - * populate the LSC data and registers LSC controls in \a controls. - * - * \return 0 on success, a negative error code otherwise - */ -int LscAlgorithmBase::init(const ValueNode &tuningData, ControlInfoMap::Map &controls, - const LscDescriptor &descriptor) -{ - polynomial_ = false; - - std::string type = tuningData["type"].get("table"); - if (type == "table") { - impl_ = std::make_unique(); - LOG(Lsc, Debug) << "Using table-based Lsc"; - } else if (type == "polynomial") { - impl_ = std::make_unique(); - polynomial_ = true; - LOG(Lsc, Debug) << "Using polynomial Lsc"; - } else { - LOG(Lsc, Error) << "Unsupported Lsc algorithm '" - << type << "'"; - return -EINVAL; - } - - const ValueNode &yamlSets = tuningData["sets"]; - if (!yamlSets.isList()) { - LOG(Lsc, Error) << "'sets' parameter not found in tuning file"; - return -EINVAL; - } - - int ret = impl_->parseLscData(yamlSets, descriptor); - if (ret) - return ret; - - controls[&controls::LensShadingCorrectionEnable] = - ControlInfo(false, true, true); - - return 0; -} - /** * \fn LscAlgorithm::configure() * \brief Re-sample and quantize LSC data @@ -361,45 +400,6 @@ int LscAlgorithmBase::init(const ValueNode &tuningData, ControlInfoMap::Map &con * \return 0 on success, a negative error code otherwise */ -/** - * \brief Queue a request to the lsc algorithm - * \param[in] state The lsc active state - * \param[in] context The lsc frame context - * \param[in] controls The list of controls associated with a Request - * - * Queue a new list of \a controls to the lsc algorithm. - * The only supported control is controls::LensShadingCorrectionEnable. - */ -void LscAlgorithmBase::queueRequest(lsc::ActiveState &state, - lsc::FrameContext &context, - const ControlList &controls) -{ - const auto &lscEnable = controls.get(controls::LensShadingCorrectionEnable); - if (lscEnable && *lscEnable != state.enabled) { - state.enabled = *lscEnable; - - LOG(Lsc, Debug) - << (state.enabled ? "Enabling" : "Disabling") << " Lsc"; - - context.update = true; - } - - context.enabled = state.enabled; -} - -/** - * \brief Populate the list of lsc metadata - * \param[in] context The lsc frame context - * \param[in] metadata The list of metadata - * - * Populates the list of \a metadata with controls handled by the LscAlgorithm - * class. The only supported metadata is controls::LensShadingCorrectionEnable. - */ -void LscAlgorithmBase::process(lsc::FrameContext &context, ControlList &metadata) -{ - metadata.set(controls::LensShadingCorrectionEnable, context.enabled); -} - /** * \fn LscAlgorithm::interpolateComponents * \brief Interpolate the LSC tables for a given colour temperature