From patchwork Wed Jul 8 15:50: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: 27308 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 F3A09C3261 for ; Wed, 8 Jul 2026 15:51:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8230166094; Wed, 8 Jul 2026 17:51:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bGpz7MPy"; 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 1BB6A61451 for ; Wed, 8 Jul 2026 17:51:12 +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 CA015EAA; Wed, 8 Jul 2026 17:50:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1783525822; bh=BIHsi+/Ew4Cqz6CANnM1yZWqpfV9zUOaFMhaBDLmnvs=; h=From:Subject:Date:To:Cc:From; b=bGpz7MPy9kxrZqA3kN/e0bBA74Vf2JZL8ojutDQhDW/kSDq+b3QGU+LsRSNoPwI9b 831HAHfdKZzLBnU5LVqaJEDFSZ8b4NVZmofAWlxwt4MR0t5bYQhewrlihS5JKFIH8H 7C17AhtEwYNeVb6Ym8BTVvWwNP4w6k0UGeeRvTVQ= From: Jacopo Mondi Subject: [PATCH v5 00/36] ipa: libipa: Introduce libipa algorithms Date: Wed, 08 Jul 2026 17:50:42 +0200 Message-Id: <20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIANNxTmoC/33OO27DMAyA4asEmqtCpl5mpt6j6CDZVEwgsQIpM FoEvnvlLM3gdPwJ8CPvolJhquJ4uItCC1fOcwv7dhDDFOYTSR5bC1DglOusPHPka5DhfMqFb9O lSovOuTgEFSCJtnctlPj7YX5+tZ643nL5eZxYum36n7Z0UklCgwNqbwDog0cKNc8xhzK+D/kiN nSBJwj0HgQNSuiN1qkDMq8g/Qd55fYg3SB0vbc+Kt3H+AIyz1C/B5ntI0WISWkLaHagdV1/ASW S5fiUAQAA X-Change-ID: 20260615-libipa-algorithms-59666bca0a2f To: libcamera-devel@lists.libcamera.org, Stefan Klug Cc: Jacopo Mondi , Kieran Bingham , Daniel Scally , Robert Mader , Laurent Pinchart X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7208; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=BIHsi+/Ew4Cqz6CANnM1yZWqpfV9zUOaFMhaBDLmnvs=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqTnHfCQ9I4pa/tmhbFSSpqgzOzsa8dKiH6GLZO 1QhHlQ47mqJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak5x3wAKCRByNAaPFqFW PNv7D/9H6EaNksJwBsFC3HJoQMR+dgWMoeNVq56CzuODx+7hosu+QU/dtxVBeIW/pv45YmLZ8De +VTldg8wowMtEUzASbmtJLGWkhN2EhvoAWj60OYM9JB4VBi4U4snOk2vgOaD33hRoR5jbPk7RV7 o8vacasa98BV8NlYUWRYy9KkHWHfSJi3yUfhzbKvcNNN34mtDFXWkD2/LLkJbJ33O1OQxk/yRLr hxlKBzlDKJvmpJRqfLQjtf+GVqa9toPfwwWFFjtnk1AfW3fpYdQXeVYhKzVCJ2zk7Rbxx3hBMRH RCKOppSpQ0WfLKIsbPX5utu2nCB38qg5nHWfvJdIu1JaMB7iJwuZAFE18YebMNsGybeRlQlo+zv /kbMPTCQpd0TZL1HNiiJTQWLUpgZ5yYGMPnu08V0XdBDr6HjAbbZGQIYaH4gpcAeTAasQTK2kR6 nYZAzqGtZW80gGy11eSEV5wpI5upTIP5gZNZTknBeVbCBp+wLlXXZtkWoeuvUjoUdxtApX+W70V 22YwIqMGf3AAfgUolg+OzuA4wcnqeE6UjGTVAn9MDOfUJnigd/PqxnYzMLNr45NLnNVWLDGfzqW 0+ERqPImb6D/nfP889QPw75tzlD/ExjUNt+0OC6arv53P2knW4c0ldsdxTqxyYaDRyqQh9mYPgN z5IJoKGWLqeY4iA== 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" This series introduces the first algorithms in libipa: Awb, Lsc and Ccm. As most of the implementations of the common algorithms derive from RkISP1 it wasn't possible to separate the algorithm introduction with the RkISP1 IPA modifications to maintain bisectability. This series contains: - Awb (Grey and Bayes) - RkISP1 - Simple - Mali-C55 - Ccm - RkISP1 - Simple - Mali-C55 - Lsc (grid and polynomial) - RkISP1 - Mali-C55 Tested on RkISP1 with imx219 (Grey world awb and grid-based LSC) and on Mali-C55 with imx708 (Bayes AWB and grid-based LSC). More test on Simple and with polynomial LSC would be helpful :) Signed-off-by: Jacopo Mondi --- 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 - Link to v4: https://lore.kernel.org/r/20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com 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 (33): 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: rksip1: lsc: Make parseSizes() a class function ipa: libipa: lsc: Introduce lsc::ActiveState ipa: libipa: lsc: Introduce lsc::FrameContext 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: Template LscAlgorithm with register format ipa: libipa: lsc_base: Describe the function of lsc_base ipa: libipa: lsc: Template lsc::Components ipa: libipa: lsc: Rename sampleForCrop to resampleLscData ipa: libipa: lsc: Specialize Interpolator for uint8_t ipa: mali-c55: Add sensorInfo to IPAContext ipa: mali-c55: Port to use LscAlgorithm Kieran Bingham (2): ipa: simple: awb: Port to use libipa AwbAlgorithm ipa: simple: 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 | 311 +++++++++++++++ src/ipa/libipa/lsc.h | 137 +++++++ src/ipa/libipa/lsc_base.cpp | 178 +++++++++ src/ipa/libipa/lsc_base.h | 90 +++++ src/ipa/libipa/lsc_polynomial.cpp | 177 ++++++++- src/ipa/libipa/lsc_polynomial.h | 152 +++++--- src/ipa/libipa/lsc_table.cpp | 40 ++ src/ipa/libipa/lsc_table.h | 118 ++++++ 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 | 156 +++++--- 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 | 432 +++------------------ src/ipa/rkisp1/algorithms/lsc.h | 41 +- src/ipa/rkisp1/ipa_context.h | 49 +-- src/ipa/simple/algorithms/awb.cpp | 141 +++++-- src/ipa/simple/algorithms/awb.h | 29 ++ src/ipa/simple/algorithms/blc.cpp | 2 +- src/ipa/simple/algorithms/ccm.cpp | 72 ++-- src/ipa/simple/algorithms/ccm.h | 23 +- src/ipa/simple/ipa_context.h | 15 +- src/libcamera/software_isp/debayer_cpu.cpp | 12 +- 44 files changed, 2945 insertions(+), 1127 deletions(-) --- base-commit: 709ad59a8d90af3570be1c8d02dee0ec9e011954 change-id: 20260615-libipa-algorithms-59666bca0a2f Best regards,