From patchwork Tue Nov 19 12:19:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 21998 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 52133C32F1 for ; Tue, 19 Nov 2024 12:19:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3175665F0F; Tue, 19 Nov 2024 13:19:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ssxZ/Oz+"; 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 866AB658A2 for ; Tue, 19 Nov 2024 13:19:43 +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 B0C8922E for ; Tue, 19 Nov 2024 13:19:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732018763; bh=PjAz0R4d1slv9WqZ8QwEKkOMJOEMoHdXOpFHJMlTVl4=; h=From:To:Subject:Date:From; b=ssxZ/Oz+Y3pVL4SnYPXmdC0qf0VN3YomenRvjguDtDP0d2QiKSu+ka2mAXCM5tAhm 4dqw8RrHZCWG0/OejgCRB5aotT6RI5iHhFS3Bd54+SCKuSubvuL4udvzpvuRfBlD/b EV9ixAYyKRGtkt5xqh5l0X74OHO/XdmGarUlVFO0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v4 00/17] Improve linear algebra helpers in libipa Date: Tue, 19 Nov 2024 14:19:11 +0200 Message-ID: <20241119121928.30939-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. Please see individual patches for detailed changelogs. 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 | 254 ++++++++++++++++---- 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, 668 insertions(+), 266 deletions(-) create mode 100644 test/ipa/libipa/vector.cpp base-commit: d5217b16020c659145f9d6dbf5849129b8500967