From patchwork Wed Jul 8 15:50:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 27323 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 C1655C3261 for ; Wed, 8 Jul 2026 15:51:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 49B0A660E9; Wed, 8 Jul 2026 17:51:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NWMWxTtY"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E0C4C66094 for ; Wed, 8 Jul 2026 17:51:16 +0200 (CEST) Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 064303FA5; Wed, 8 Jul 2026 17:50:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1783525827; bh=FI6u9HiVyZE3mGOS+nR17xOPN1xl6wtQAM1eP5szdPw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NWMWxTtYA9rhYlBwHItlw4Lf2mdty2Jex06SviJQviV83r0dcNQkdB5Nsb82sICnP jteCDvovNGr7BNOdVthxmgSCJobtqvHJqD+7kL2/X8qZ4TjHBr13CLNBj+7rhiB46Q 4O0mKywQRBW79Y/gCSv6a4aq/jw7elOmX7qLz0Jk= From: Jacopo Mondi Date: Wed, 08 Jul 2026 17:50:57 +0200 Subject: [PATCH v5 15/36] ipa: libipa: lsc: Move Interpolator to lsc_base MIME-Version: 1.0 Message-Id: <20260708-libipa-algorithms-v5-15-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, Stefan Klug Cc: Jacopo Mondi , Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3329; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=FI6u9HiVyZE3mGOS+nR17xOPN1xl6wtQAM1eP5szdPw=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqTnHlmC/PICoFh418AoklK0rWHV8yG89KsFeIq 0E0GqwZoFSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak5x5QAKCRByNAaPFqFW PPqHEACz9xQBBJZ9CserFVgnC8pEwV5VoZ6tfKTcId9F1IpNOwuSXxoJ98743k9SWDvk+ahlJSk dI3yAkS6EqOcB8jP83q65JvZW7aATHs/q08Tu5gkifEp1EKZ+/Y10QS/UPdW5I9wJiClk55YuX/ XSKaZYgOv/GvtSHQ56cCKmIrcBaq89vdq5oj88qmgSVQ3uIWiGpH82Hyi8AiTCPJdITXhYbO9Dn z4/NoxZmRGba7AbutSpF6U/p11pxU1kchWesAmGL6n9XmkZ04kaA7QL934tnEg7IXpWC7Ah3uPE 8+Jkv9mQbaq5eXs5f0U+5Jyyb7QDs924dOdJL4YX4k11zh4dktu+Gzm4H4+FBF4bWJh8keubMDD HbcQB6wPXtBX1yMuss4I5ywMXT3xoA6zeI7FqGGILQ0ReMZjoRLwoV/NqTFkOUq+R0gWC+lMmBS rwZN/TCtDx3vzjAK4kFWGvBOwBgUm5JGoeqZqydl4Q+5OP14EyRPmwQhTeGYnjQOTy28bTbXTLt Qp9+lC6Ti3CxqEgwX6wiNPrOPEweYb7RwEMFYLrIPmE17mAYhdc9oh+J37aNmpEfpZI9MqBQlnf 5Mz2HJj9/BfLBgelsqZG5mUffgB/V0pi65W7RzAVd5XtE9Wu86FgAe6whX4GylAMaii7uORYQzy 2qCuQh8Ymh37QSg== 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" Move the Interpolator: specialization from the RkISP1 IPA to the lsc_base header. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/libipa/lsc_base.cpp | 15 +++++++++++++++ src/ipa/libipa/lsc_base.h | 21 +++++++++++++++++++++ src/ipa/rkisp1/algorithms/lsc.cpp | 27 --------------------------- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/ipa/libipa/lsc_base.cpp b/src/ipa/libipa/lsc_base.cpp index d05075b988d7..945020794b57 100644 --- a/src/ipa/libipa/lsc_base.cpp +++ b/src/ipa/libipa/lsc_base.cpp @@ -49,6 +49,21 @@ namespace lsc { } /* namespace lsc */ +#ifndef __DOXYGEN__ +template<> +void Interpolator:: + interpolate(const lsc::Components &a, + const lsc::Components &b, + lsc::Components &dest, + double lambda) +{ + interpolateVector(a.r, b.r, dest.r, lambda); + interpolateVector(a.gr, b.gr, dest.gr, lambda); + interpolateVector(a.gb, b.gb, dest.gb, lambda); + interpolateVector(a.b, b.b, dest.b, lambda); +} +#endif + /** * \class LscImplementation * \brief Pure virtual base class for LSC algorithm implementations diff --git a/src/ipa/libipa/lsc_base.h b/src/ipa/libipa/lsc_base.h index 93f819d3c2af..51cc35888209 100644 --- a/src/ipa/libipa/lsc_base.h +++ b/src/ipa/libipa/lsc_base.h @@ -18,6 +18,8 @@ #include "libcamera/internal/value_node.h" +#include "interpolator.h" + namespace libcamera { namespace ipa { @@ -35,6 +37,25 @@ using ComponentsMap = std::map; } /* namespace lsc */ +#ifndef __DOXYGEN__ +template +void interpolateVector(const std::vector &a, const std::vector &b, + std::vector &dest, double lambda) +{ + ASSERT(a.size() == b.size()); + dest.resize(a.size()); + for (size_t i = 0; i < a.size(); i++) + dest[i] = a[i] * (1.0 - lambda) + b[i] * lambda; +} + +template<> +void Interpolator:: + interpolate(const lsc::Components &a, + const lsc::Components &b, + lsc::Components &dest, + double lambda); +#endif /* __DOXYGEN__ */ + class LscImplementation { public: diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp index 84d2b1d3bdac..8d92ee89cdaf 100644 --- a/src/ipa/rkisp1/algorithms/lsc.cpp +++ b/src/ipa/rkisp1/algorithms/lsc.cpp @@ -25,33 +25,6 @@ namespace libcamera { -namespace ipa { - -template -void interpolateVector(const std::vector &a, const std::vector &b, - std::vector &dest, double lambda) -{ - ASSERT(a.size() == b.size()); - dest.resize(a.size()); - for (size_t i = 0; i < a.size(); i++) - dest[i] = a[i] * (1.0 - lambda) + b[i] * lambda; -} - -template<> -void Interpolator:: - interpolate(const lsc::Components &a, - const lsc::Components &b, - lsc::Components &dest, - double lambda) -{ - interpolateVector(a.r, b.r, dest.r, lambda); - interpolateVector(a.gr, b.gr, dest.gr, lambda); - interpolateVector(a.gb, b.gb, dest.gb, lambda); - interpolateVector(a.b, b.b, dest.b, lambda); -} - -} /* namespace ipa */ - namespace ipa::rkisp1::algorithms {