From patchwork Mon Nov 18 22:16:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 21960 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 84F01C32EA for ; Mon, 18 Nov 2024 22:16:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 80088658F0; Mon, 18 Nov 2024 23:16:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bZsTl4wO"; 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 2D14E658DC for ; Mon, 18 Nov 2024 23:16:28 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E4F3D6DE for ; Mon, 18 Nov 2024 23:16:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1731968171; bh=RESjoNLU88QaPWBYuz/SfcmoA8DALIcrRGAEp5Cgn/Q=; h=From:To:Subject:Date:From; b=bZsTl4wOyGManNlwTJoIpelYBMuLvqpxogz2WFilNo2bwcioahMtKvEFmW5LjSAZ3 B4m6kbLcawT8HdBHyRNzzeMeGB7oWiV1QTlFns4Ml9NJ6kr4XOgCb+w354x48mUZBf Uw0uZzdPp6jvXYDfMy9ZwPWhMHSPDD6jT6Oh7uE4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v3 00/17] Improve linear algebra helpers in libipa Date: Tue, 19 Nov 2024 00:16:01 +0200 Message-ID: <20241118221618.13953-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 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" Hello, This patch series tries to simplify IPA linear algebra calculations by improving the Vector class API. Patches 01/17 to 10/17 start by improving the Vector class, and patch 11/17 adds a unit test for the class. Patche 12/17 follows with migrating the IPU3 IPA module to replace its custom RGB class with the generic version, enabling usage of the new RGB class in the libipa API in patch 13/17. Patches 14/17 to 16/17 are further code simpflications thanks to the new helpers. Finally, patch 17/17 is a drive-by extension of a comment to record information I discovered while working on the series. Further usage of the RGB, Vector and Matrix classes are likely possible. In particular, I have limited changes to the Raspberry Pi IPA module to the minimum required due to the updates in colours.h. Compared to v1, the series has been rebased on conflicting changes from Dan that introduced src/ipa/libipa/colours.{cpp,h}. Please see individual patches for detailed changelogs. Please note the patches have been compile-tested and unit-tested only. Laurent Pinchart (17): ipa: libipa: vector: Add mutable x(), y() and z() accessors ipa: libipa: vector: Add r(), g() and b() accessors ipa: libipa: vector: Add scalar constructor ipa: libipa: vector: Add copy constructor and assignment operator ipa: libipa: vector: Rename the dot product operator*() to dot() ipa: libipa: vector: Generalize arithmetic operators ipa: libipa: vector: Add missing binary arithemtic operators ipa: libipa: vector: Add compound assignment operators ipa: libipa: vector: Add element-wise min() and max() functions ipa: libipa: vector: Add sum() function test: libipa: Add Vector class test ipa: ipu3: awb: Replace Awb::RGB class with ipa::RGB ipa: libipa: colour: Use the RGB class to model RGB values ipa: libipa: colour: Use Vector and Matrix for linear algebra ipa: rkisp1: awb: Use RGB class to store colour gains ipa: rkisp1: awb: Use Vector and Matrix for linear algebra ipa: rkisp1: awb: Expand comment src/ipa/ipu3/algorithms/agc.cpp | 14 +- src/ipa/ipu3/algorithms/awb.cpp | 37 +-- src/ipa/ipu3/algorithms/awb.h | 18 +- src/ipa/libipa/colours.cpp | 40 ++-- src/ipa/libipa/colours.h | 6 +- src/ipa/libipa/vector.cpp | 264 ++++++++++++++++++--- src/ipa/libipa/vector.h | 258 ++++++++++++++++---- src/ipa/rkisp1/algorithms/awb.cpp | 127 +++++----- src/ipa/rkisp1/ipa_context.cpp | 31 +-- src/ipa/rkisp1/ipa_context.h | 20 +- src/ipa/rpi/controller/rpi/agc_channel.cpp | 21 +- test/ipa/libipa/meson.build | 2 + test/ipa/libipa/vector.cpp | 100 ++++++++ 13 files changed, 672 insertions(+), 266 deletions(-) create mode 100644 test/ipa/libipa/vector.cpp base-commit: d5217b16020c659145f9d6dbf5849129b8500967