From patchwork Wed Mar 19 16:11:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22978 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 03368C32FE for ; Wed, 19 Mar 2025 16:11:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4A977687FA; Wed, 19 Mar 2025 17:11:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZJUr01uj"; 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 1889A687FA for ; Wed, 19 Mar 2025 17:11:57 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:760:e5ca:4814:99c7]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1F73B55A; Wed, 19 Mar 2025 17:10:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742400614; bh=kwxhQozAvJ2V5t+2fR369MU6/hY3k+gDyK2F/DC+AZA=; h=From:To:Cc:Subject:Date:From; b=ZJUr01ujd9l3AWb0yGPZl3gfGfyg6xQHEr+bd4ACFySZFFcZeJsTWQeH2cL7Sqfn5 jixODzbknBU5NWPMShMCiToHJPT/zH08NDhf6ZOXILJW4VxrxlaCCiXAIjnc3LfPwL 61FeTFURzLzWb8WFtbycjd/Ko7nra2+EQt1ccwl4= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 00/17] Some rkisp1 awb improvements Date: Wed, 19 Mar 2025 17:11:05 +0100 Message-ID: <20250319161152.63625-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 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" Hi all, This series contains a few fixes that greatly improve and stabilize the AWB handling on rkisp1. After the feedback from the first version, some parts were rewritten and Laurent added a generic matrix inverse function. Patches 1-8 add utility functions to Vector and Matrix. The rest fixes some bugs and generally improves the AWB on rkisp1. Please see the individual patches for details. Best regards, Stefan Changes in v2: - Replaced the matrix cast() and inverse() functions by better alternatives - Added a manual CCM control - Some small fixes (see logs in individual patches) Laurent Pinchart (2): libcamera: matrix: Extend multiplication operator to heterogenous types libcamera: vector: Extend matrix multiplication operator to heterogenous types Stefan Klug (15): libcamera: matrix: Replace SFINAE with static_asserts libcamera: matrix: Make most functions constexpr libcamera: matrix: Add a Span based constructor libcamera: vector: Add a Span based constructor libcamera: matrix: Add inverse() function test: Add minimal test for Matrix ipa: rkisp1: Refactor automatic/manual structure in IPAActiveState ipa: rkisp1: ccm/lsc: Fix CCM/LSC based on manual color temperature ipa: rkisp1: Implement manual ColourCorrectionMatrix control libipa: awb: Make result of gainsFromColourTemp optional ipa: rkisp1: awb: Use gains from color temperature curve ipa: rkisp1: Damp color temperature regulation ipa: rkisp1: awb: Set rgb mean limits to 180 ipa: rkisp1: awb: Take the CCM into account for the AWB gains calculation ipa: rkisp1: awb: Avoid division by zero include/libcamera/internal/matrix.h | 82 ++++++------- include/libcamera/internal/vector.h | 21 ++-- src/ipa/libipa/awb.cpp | 2 +- src/ipa/libipa/awb.h | 2 +- src/ipa/libipa/awb_bayes.cpp | 4 +- src/ipa/libipa/awb_bayes.h | 2 +- src/ipa/libipa/awb_grey.cpp | 6 +- src/ipa/libipa/awb_grey.h | 2 +- src/ipa/rkisp1/algorithms/awb.cpp | 79 ++++++++----- src/ipa/rkisp1/algorithms/ccm.cpp | 63 ++++++++-- src/ipa/rkisp1/algorithms/ccm.h | 6 + src/ipa/rkisp1/algorithms/lsc.cpp | 6 +- src/ipa/rkisp1/ipa_context.h | 15 ++- src/libcamera/matrix.cpp | 175 +++++++++++++++++++++++++++- src/libcamera/vector.cpp | 13 ++- test/matrix.cpp | 53 +++++++++ test/meson.build | 1 + 17 files changed, 427 insertions(+), 105 deletions(-) create mode 100644 test/matrix.cpp