From patchwork Wed Aug 5 16:13:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 27647 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 8C304C3348 for ; Wed, 5 Aug 2026 16:13:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1F7F56818D; Wed, 5 Aug 2026 18:13:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IiPKhfT3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 62FBF68164 for ; Wed, 5 Aug 2026 18:13:40 +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 63A912B5C; Wed, 5 Aug 2026 18:12:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1785946349; bh=EIoRTYcRxBXUh/gCEob8/0V/PQOEtmC11Bd6tGcGu5A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IiPKhfT3jI+4+Mv4WSc9Ws0wquMVFZKaV9F4QwcsU04pEy4aCOAN7H3cUpa2udXpU bE1MqJ/Oi/lXjJRKRIekP7L+qln7CJKQ4dLtu6PbPUXScTNhie4pq1elEI3hKcuhWX 7N9TW8TyB5Z9LlCGhjWBLAGgOTNrqtGMBZLJ4tU8= From: Jacopo Mondi Date: Wed, 05 Aug 2026 18:13:06 +0200 Subject: [PATCH v7 24/32] ipa: libipa: lsc: Document Components parsing MIME-Version: 1.0 Message-Id: <20260805-libipa-algorithms-v7-24-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 , Kieran Bingham X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4373; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=EIoRTYcRxBXUh/gCEob8/0V/PQOEtmC11Bd6tGcGu5A=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqc2EhMH6SJkKBp+o6RNsehjgtMjuOVy2o0ZigK 9CKJN6GYRuJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCanNhIQAKCRByNAaPFqFW PIh7EACUOuy6eIBfsRNjBCEm4q0/qJ1Z0PxsHS7n+08ypmUn0vXsH3f2+0mNBTNaEY/HbzJe2xI bid69DMRDH8TAMFpE8W6l1w2x5N0kVZ1aZ9UfeA8u/iqPRMcbLP30UaPDGRFMR8QVOlxxvkVs3Y 31rUnaT9biPkpcFMJHFFrWIVXj8LHJdLhziQndgWdPmbPX6SbE8N6HsJ6X6gcenwCf7ln9D899Q Dv3QWQJJpXX6ujmtFtV9JeMIPHnmtyt3Zm4ctx59tGhVusTwLSOToPglhHEuWEjXOQL+0vOMfl7 N09NRapgjsYsi2Z2ppoHgbaSpA45I7Np3k8qHMQku1KcvSMYJlTFaqRT7SvAtmuozPr/rjPzkIu U8kBrKSmqQbY9WXx+S/PHU4B/SXCPu/QxCwzc4Pf8Pg5x4X5UtgQF9DEVAjXiUBiNxURZb1GdHA Le/Bj3YgAX5BmAaymqMJuTiy6vumh4YJkW5XVvKuzKS0mPpRqiLpg/P/gEOVh2wboprhi6DEFSa wR3TdwhiXuGNgZPOfjtzFAeH1oNnsLRxeB/neLGt7unJDygAhAcI/ntdWtzUFF+UOxPiPa4eYEv WJHAN2UpJhR5fFCFnSVX6WxMo4E1Ng09hYpkIIvJ6MPTliJ5U1E6+5od+Y+YK4sJB6QfE9cRCu0 xSTdFXrwUny9u9w== 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" Document with examples how different IPA modules parse the tuning file depending on the number of colour channels they support. Signed-off-by: Jacopo Mondi Reviewed-by: Stefan Klug Reviewed-by: Kieran Bingham --- src/ipa/libipa/lsc.cpp | 111 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/src/ipa/libipa/lsc.cpp b/src/ipa/libipa/lsc.cpp index 831f6b003df1..32626049a2e2 100644 --- a/src/ipa/libipa/lsc.cpp +++ b/src/ipa/libipa/lsc.cpp @@ -68,6 +68,117 @@ namespace lsc { * tables are indexed by colour temperature with per-colour-components vectors * of gain values or polynomial coefficients. * + * The colour components names are IPA-implementation specific and depend on the + * ISP LSC engine design. Some LSC engine support 4 colour components (r, gr, + * gb, b), some only support 3 colour components (r, g, b). The name (and + * number) of the expected colour components shall be provided to + * LscAlgorithm::init() using the LscDescriptor::keys field. + * + * Example of a tabular lens shading tuning file with 'r', 'g' and 'b' colour + * components. The gain table has been omitted here, but the expected number + * of entries has to be equal to + * LscDescriptor::numHSamples * LscDescriptor::numVSamples. + * + * \code{.yaml} + * - Lsc: + * sets: + * - ct: 2500 + * r: [ + * .. gains table omitted.. + * ] + * g: [ + * .. gains table omitted.. + * ] + * b: [ + * .. gains table omitted.. + * ] + * - ct: 6500 + * r: [ + * .. gains table omitted.. + * ] + * g: [ + * .. gains table omitted.. + * ] + * b: [ + * .. gains table omitted.. + * ] + * \endcode + * + * Example of a polynomial lens shading tuning file with 'r', 'gr', 'gb' and 'b' + * colour components: + * + * \code{.yaml} + * - Lsc: + * type: "polynomial" + * sets: + * - ct: 2500 + * r: + * cx: 0.5006571711950275 + * cy: 0.510093737499277 + * k0: 1.5393282208428813 + * k1: -1.1434559757908016 + * k2: 4.332602305814554 + * k3: 0.0 + * k4: 0.0 + * gr: + * cx: 0.5009320529087338 + * cy: 0.511208038949085 + * k0: 1.5634738574805407 + * k1: -1.5623484259968348 + * k2: 4.846686073656501 + * k3: 0.0 + * k4: 0.0 + * gb: + * cx: 0.5012013290343839 + * cy: 0.5128251541578288 + * k0: 1.526147944919103 + * k1: -1.4316976083689723 + * k2: 4.792604063222728 + * k3: 0.0 + * k4: 0.0 + * b: + * cx: 0.49864139511067784 + * cy: 0.5162095081739346 + * k0: 1.0405245474038738 + * k1: 0.05618339879447103 + * k2: 1.8792813594001752 + * k3: 0.0 + * k4: 0.0 + * - ct: 6000 + * r: + * cx: 0.5006202239353942 + * cy: 0.5099531318307661 + * k0: 1.4702946023945032 + * k1: -0.8893767547927631 + * k2: 3.920547732201387 + * k3: 0.0 + * k4: 0.0 + * gr: + * cx: 0.500907874178317 + * cy: 0.511084916024106 + * k0: 1.5336172760559457 + * k1: -1.39964026514435 + * k2: 4.565487728954618 + * k3: 0.0 + * k4: 0.0 + * gb: + * cx: 0.5011898608900477 + * cy: 0.5126797906745105 + * k0: 1.5013145790354843 + * k1: -1.2747407173754124 + * k2: 4.514682876897286 + * k3: 0.0 + * k4: 0.0 + * b: + * cx: 0.4987561413116136 + * cy: 0.5159619420778772 + * k0: 1.0102986422191802 + * k1: 0.13263449763985727 + * k2: 1.686556107316064 + * k3: 0.0 + * k4: 0.0 + * \endcode + * * At LscAlgorithm::configure() time the LSC tables are re-sampled on the * sensor's crop rectangle in use to adapt them to the configuration in use for * a streaming session. Polynomial LSC tables support re-sampling and can be