From patchwork Wed Aug 5 16:12:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 27623 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 7E2E7C3308 for ; Wed, 5 Aug 2026 16:13:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 64FAE68129; Wed, 5 Aug 2026 18:13:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DtXhHt5N"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B194568117 for ; Wed, 5 Aug 2026 18:13:24 +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 707455B3; Wed, 5 Aug 2026 18:12:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1785946334; bh=bLK7GW7ZcrHN/LK+eL27oNFQi/IajI7gWQ6TavQyk0o=; h=From:Subject:Date:To:Cc:From; b=DtXhHt5NR3brdsmNw7fDkBdUOY8rWzBFwNat/d8IZmgAernS/AAZDqtoKl/6VyY13 ra45rhqhivy+xURgpqtte913IAFFI2xN0vSP4Kx+Q8S12fwTriREaOERAWJTQHt9oi 48R2Mh7pE2kTSVCrpspUTjovapg1ZYiUW4l6GKnc= From: Jacopo Mondi Subject: [PATCH v7 00/32] ipa: libipa: Introduce libipa algorithms Date: Wed, 05 Aug 2026 18:12:42 +0200 Message-Id: <20260805-libipa-algorithms-v7-0-7425b5b795d4@ideasonboard.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAPpgc2oC/4XQS27DIBAG4KtErEuFh5enq96j6gLwECMlJoLIa hX57sXZ1Au7Xf4jzTePB6tUElX2dnqwQnOqKU8t2JcTC6ObzsTT0DIDAUaYTvNL8unmuLucc0n 38Vq5RmOMD044iKz13QrF9PU0Pz5bHlO95/L9HDF3a/Uvbe644IQKA0qrAOg9DeRqnnx2ZXgN+ cpWdIYNBHIPggZFtErK2AGpI0j+QlaYPUg2CE1vtfVC9t4fQGoL9XuQWjcShBiF1IDqANL/Qrp BwmocmoNRwwFkNhCIPciszw4UvJXtVWHvtGVZfgBGTzn8JgIAAA== X-Change-ID: 20260615-libipa-algorithms-59666bca0a2f To: libcamera-devel@lists.libcamera.org, Stefan Klug , Milan Zamazal Cc: Jacopo Mondi , Kieran Bingham , Daniel Scally , Robert Mader , Laurent Pinchart X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=7183; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=bLK7GW7ZcrHN/LK+eL27oNFQi/IajI7gWQ6TavQyk0o=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqc2EY3WTo5fVtDlN9kuimqfHyYb32nSCHSBYLS keatlnAdQ+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCanNhGAAKCRByNAaPFqFW PIV/EACrkUi5CakwlksJrIrKKUPgN2J0/1RcuO6TvQ47kYpkdjXOB+vGcefWiGVwNN1N27eCB8v PKwJgEbqIT9BDv/EI58lWt5Ap2/9fZavkUgw9GllhcKUbvsvqQT9UK7UGTKx2PoIsyQXk/noFa9 pM1ZWNczq+lzAG3VEiDCwpQ7mdMETYw10pcsafbQItblGICRNa/z1eRHIT3WL4vQp5I1O/ddmbl Bi9xhHCNOfGAsLE3eipbfvDJ58gDy9dZL2QHpr/LgJ0RwGofeg+v39DPhiuCV4bS3My1lJH0zVo ytMJeDFl+I34IVuNjky9ThMns8ObTX/FHLJ9Pt3dojq4SVJhTeppLQfwjiD2V+SWDzi8AXjhja4 l5+SQILHFBUVwib7DuX+j+mRlaibZGo3tNiDCenYt0EmKdkfP+fbPb9gW+Nf+Jo0WmZ9OnKherJ n5gjg6Uog/oIanZdBtx5QzkUvRTIrTKqxvEvV3MAbZiodnTJM9LPfQvzDhvKMoLoSByUcGG9Tul 9QVVSylSq2sZWtVwFBwp9UjRpl+qGE3mYMj6uEVGW7UaFbqwc1vXGRzxwtgKvGZ9enr1ewYnbQI aEmMJbBXeG/B7+1zI4+3iNPB659+bnYSENfp7SFqJEVntsvvFblHcCrWI+9az6LF0ymzEUnGNeI b9sya9HJeD891NA== 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" v7 builds on v6 but removes the requirement for IPA modules to define their own Interpolatator overloads. The interface for IPA modules is similar to v5, but the quantization of gain values happens in LscAlgorithm like in v6. I think this is a nice compromise, and I hope we can move forwards with this and merge it soon. Milan: I haven't take you Simple patches (as I promised to) because your series has other commits that I know not much about. However, rebasing should hopefully be simple enough ? Sorry for pulling you in too many directions! Signed-off-by: Jacopo Mondi --- Changes in v7: - Address Barnabas' comments on using try_emplace and avoid copies when populating maps - Move Components<> and ComponentsMap<> outside of LscAlgorithm to avoid IPA to define their own Interpolator::interpolate<> overloads Changes in v6: - Address comments received on v5, mostly on documentation - Remove templating of LscPolynomial and perform quantization in LscAlgorithm Changes in v5: - Add "ipa: libipa: lsc_polynomial: Fix polynomial parsing error" to fix and exiting potential issue with Polynomial parsing - Fix Simple, which I broke in v4, thanks Milan Changes in v4: - s/awb/AWB in comments everywhere, same for CCM and LSC - Awb: changelog per patch - Make AwbStats pure virtual and move stats parsing logic to the IPA modules - Reduce comments/renames to reduce patch size and comments - Collect tags Changes in v3: - Address comments on Awb from Stefan: - Introduce AwbImplementation::Result - Move AwbStats implementation to IPAs - Drop AwbStats::rg()/bg() and re-implement AwbGray accordingly - Fix Saturation bug in Simple Ccm algorithm - Fix Simple Ccm gain limits using Q<2, 8> - Update Mali CCM and Gamma to latest uAPI patch version - Fix Mali CCM gain masking as reported by Dan - Break down libIPA Lsc implementation as requested by Stefan Changes in v2: - Introduce awb::Context to simplify ActiveState and FrameContext definition - Add mali uAPI header for CCM and Gamma - Do not rename Mali functions for hardware configuration in awb and lsc - Spelling and documentation --- Jacopo Mondi (29): ipa: libipa: awb: Reimplement AwbAlgorithm ipa: mali-c55: awb: Port to use libipa AwbAlgorithm ipa: libipa: Add CcmAlgorithm to libipa ipa: rkisp1: ccm: Port to use CcmAlgorithm include: linux: mali-c55: Update to support CCM and Gamma ipa: mali-c55: Implement Ccm algorithm ipa: rkisp1: lsc: Re-architecture Lsc support ipa: libipa: Introduce lsc_base.h ipa: libipa: lsc_polynomial: Fix polynomial parsing error ipa: libipa: lsc_polynomial: Rename LscPolynomial ipa: libipa: lsc_polynomial: Do not inline functions ipa: libipa: lsc: Move Interpolator to lsc_base ipa: rkisp1: lsc: Remove rogue empty line ipa: libipa: lsc_polynomial: Move LscPolynomial from RkISP1 ipa: libipa: lsc_table: Move LscTable from RkISP1 ipa: libipa: lsc_base: Add sampleForCrop documentation ipa: libipa: lsc: Introduce LscAlgorithm ipa: libipa: lsc: Move sizesListToPositions() back to rkisp1 ipa: rkisp1: lsc: Port to use LscAlgorithm ipa: libipa: lsc: Make Components a map<> ipa: libipa: lsc: Document Components parsing ipa: libipa: lsc_polynomial: Remove sensorSize_ ipa: libipa: lsc: Document LscDescriptor::sensorSize usage ipa: libipa: lsc: Quantize gains in IPA ipa: libipa: lsc: Quantize gains in LscAlgorithm ipa: libipa: lsc: Re-sort LscAlgorithmBase documentation ipa: mali-c55: Add sensorInfo to IPAContext ipa: mali-c55: Port to use LscAlgorithm ipa: libipa: lsc: Specialize Interpolator for uint8_t Kieran Bingham (2): ipa: simple: awb: Port to use libipa AwbAlgorithm ipa: simple: Port to use libipa CcmAlgorithm Laurent Pinchart (1): ipa: libipa: lsc_polynomial: Don't inline ValueNode accessor .../internal/software_isp/debayer_params.h | 4 +- include/linux/media/arm/mali-c55-config.h | 86 +++- src/ipa/libipa/awb.cpp | 418 ++++++++++++++++--- src/ipa/libipa/awb.h | 100 ++++- src/ipa/libipa/awb_bayes.cpp | 52 +-- src/ipa/libipa/awb_bayes.h | 12 +- src/ipa/libipa/awb_grey.cpp | 16 +- src/ipa/libipa/awb_grey.h | 6 +- src/ipa/libipa/ccm.cpp | 245 +++++++++++ src/ipa/libipa/ccm.h | 77 ++++ src/ipa/libipa/lsc.cpp | 447 +++++++++++++++++++++ src/ipa/libipa/lsc.h | 137 +++++++ src/ipa/libipa/lsc_base.cpp | 138 +++++++ src/ipa/libipa/lsc_base.h | 52 +++ src/ipa/libipa/lsc_polynomial.cpp | 202 +++++++++- src/ipa/libipa/lsc_polynomial.h | 100 ++--- src/ipa/libipa/lsc_table.cpp | 117 ++++++ src/ipa/libipa/lsc_table.h | 55 +++ src/ipa/libipa/meson.build | 8 + src/ipa/mali-c55/algorithms/awb.cpp | 223 +++++----- src/ipa/mali-c55/algorithms/awb.h | 28 +- src/ipa/mali-c55/algorithms/ccm.cpp | 173 ++++++++ src/ipa/mali-c55/algorithms/ccm.h | 66 +++ src/ipa/mali-c55/algorithms/lsc.cpp | 160 +++++--- src/ipa/mali-c55/algorithms/lsc.h | 32 +- src/ipa/mali-c55/algorithms/meson.build | 1 + src/ipa/mali-c55/ipa_context.cpp | 3 + src/ipa/mali-c55/ipa_context.h | 20 +- src/ipa/mali-c55/mali-c55.cpp | 2 + src/ipa/mali-c55/params.h | 2 + src/ipa/rkisp1/algorithms/awb.cpp | 191 ++------- src/ipa/rkisp1/algorithms/awb.h | 18 +- src/ipa/rkisp1/algorithms/ccm.cpp | 97 +---- src/ipa/rkisp1/algorithms/ccm.h | 17 +- src/ipa/rkisp1/algorithms/lsc.cpp | 428 +++----------------- src/ipa/rkisp1/algorithms/lsc.h | 38 +- src/ipa/rkisp1/ipa_context.h | 49 +-- src/ipa/simple/algorithms/awb.cpp | 140 +++++-- src/ipa/simple/algorithms/awb.h | 28 ++ src/ipa/simple/algorithms/blc.cpp | 2 +- src/ipa/simple/algorithms/ccm.cpp | 74 ++-- src/ipa/simple/algorithms/ccm.h | 22 +- src/ipa/simple/ipa_context.h | 15 +- src/libcamera/software_isp/debayer_cpu.cpp | 12 +- 44 files changed, 2976 insertions(+), 1137 deletions(-) --- base-commit: 93bed4da915c8c88d68d1a286048f10147cc831a change-id: 20260615-libipa-algorithms-59666bca0a2f Best regards, -- Jacopo Mondi