From patchwork Tue Apr 7 22:01:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 26490 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 1E333C32BB for ; Tue, 7 Apr 2026 22:03:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5674D62DCB; Wed, 8 Apr 2026 00:02:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EQBReuJ0"; 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 AD5B762CF8 for ; Wed, 8 Apr 2026 00:02:42 +0200 (CEST) Received: from [192.168.0.204] (ams.linuxembedded.co.uk [209.38.108.23]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 037D224A2; Wed, 8 Apr 2026 00:01:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1775599275; bh=uE5srgoqwc7FrlNaVkAEvYLUx5VbJENakieXKN38U1c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EQBReuJ0zcRSv6laA4r0SM25lDm2Drq5S/GDtPRLrdpOM9QlkncWFXqRakW4Qt/ft ritwBuZAKku1+zYQFIYwxB9ZYWE4LIaHk5s7ONb5+18fy1F0YO47BDWJ1iolRNcqz8 x3zTGXsziMwja7K9vepdTSXj52lWMtXzZkF4LDk4= From: Kieran Bingham Date: Tue, 07 Apr 2026 23:01:11 +0100 Subject: [PATCH 08/13] ipa: libipa: Awb: Provide common context storage MIME-Version: 1.0 Message-Id: <20260407-kbingham-awb-split-v1-8-a39af3f4dc20@ideasonboard.com> References: <20260407-kbingham-awb-split-v1-0-a39af3f4dc20@ideasonboard.com> In-Reply-To: <20260407-kbingham-awb-split-v1-0-a39af3f4dc20@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775599360; l=4445; i=kieran.bingham@ideasonboard.com; s=20260204; h=from:subject:message-id; bh=uE5srgoqwc7FrlNaVkAEvYLUx5VbJENakieXKN38U1c=; b=1Ml/X+qdCuE6CW74C+D9CYmssT0Dkn1wyIu4kJyA2NOO1/yX+5BW5fy1QLxJCiJP27TSmjva6 i8rDBBcPvF8DFwlKlSMZLuUq7xCdvO8bagl+ff7d5c/oF+m7/C1cKDH X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=IOxS2C6nWHNjLfkDR71Iesk904i6wJDfEERqV7hDBdY= 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" Expose a common structure for storing Awb Session configuration, Active state and Frame Context data. Signed-off-by: Kieran Bingham --- src/ipa/libipa/awb.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++ src/ipa/libipa/awb.h | 26 ++++++++++++++++++++++++ src/ipa/rkisp1/ipa_context.h | 28 ++++++++------------------ 3 files changed, 81 insertions(+), 20 deletions(-) diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp index 214bac8b56a6ca7b0ac9954f0aa742cd613e6141..f215bea0b59483eadf95572f073928a4eb1275f4 100644 --- a/src/ipa/libipa/awb.cpp +++ b/src/ipa/libipa/awb.cpp @@ -22,6 +22,53 @@ LOG_DEFINE_CATEGORY(Awb) namespace ipa { +/** + * \struct awb::Session + * \brief Session-wide AWB configuration + * + * \var awb::Session::enabled + * \brief True when AWB processing is enabled for the session + */ + +/** + * \struct awb::ActiveState + * \brief Active AWB state shared across frames + * + * \var awb::ActiveState::manual + * \brief The most recent manually requested AWB state + * + * \var awb::ActiveState::automatic + * \brief The most recent automatically calculated AWB state + * + * \var awb::ActiveState::autoEnabled + * \brief True when automatic AWB is currently selected + */ + +/** + * \struct awb::ActiveState::AwbState + * \brief AWB gains and colour temperature for one operating mode + * + * \var awb::ActiveState::AwbState::gains + * \brief The white balance gains for this AWB state + * + * \var awb::ActiveState::AwbState::temperatureK + * \brief The colour temperature for this AWB state, in Kelvin + */ + +/** + * \struct awb::FrameContext + * \brief Per-frame AWB state applied to a captured frame + * + * \var awb::FrameContext::gains + * \brief The white balance gains applied to the frame + * + * \var awb::FrameContext::autoEnabled + * \brief True when the frame uses automatic AWB + * + * \var awb::FrameContext::temperatureK + * \brief The colour temperature used for the frame, in Kelvin + */ + /** * \class AwbResult * \brief The result of an AWB calculation diff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h index f4a86038635f984ac03b1e466c0fcd4e6d5e22bd..764be849270bcd42ecdf67aea3d13afa170c7499 100644 --- a/src/ipa/libipa/awb.h +++ b/src/ipa/libipa/awb.h @@ -20,6 +20,32 @@ namespace libcamera { namespace ipa { +namespace awb { + +struct Session { + bool enabled; +}; + +struct ActiveState { + struct AwbState { + RGB gains; + unsigned int temperatureK; + }; + + AwbState manual; + AwbState automatic; + + bool autoEnabled; +}; + +struct FrameContext { + RGB gains; + bool autoEnabled; + unsigned int temperatureK; +}; + +} /* namespace awb */ + struct AwbResult { RGB gains; double colourTemperature; diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index 63a6f2b7d884bfff2553175fa32e45ae747fb4c7..85a8ea3acc1fd75ff6b49576800ab7615cebce2c 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -25,6 +25,7 @@ #include "libcamera/internal/vector.h" #include "libipa/agc_mean_luminance.h" +#include "libipa/awb.h" #include "libipa/camera_sensor_helper.h" #include "libipa/fc_queue.h" #include "libipa/fixedpoint.h" @@ -49,15 +50,16 @@ struct IPAHwSettings { bool compand; }; +struct RKISP1AwbSession : public ipa::awb::Session { + struct rkisp1_cif_isp_window measureWindow; +}; + struct IPASessionConfiguration { struct { struct rkisp1_cif_isp_window measureWindow; } agc; - struct { - struct rkisp1_cif_isp_window measureWindow; - bool enabled; - } awb; + struct RKISP1AwbSession awb; struct { bool supported; @@ -103,17 +105,7 @@ struct IPAActiveState { utils::Duration maxFrameDuration; } agc; - struct { - struct AwbState { - RGB gains; - unsigned int temperatureK; - }; - - AwbState manual; - AwbState automatic; - - bool autoEnabled; - } awb; + ipa::awb::ActiveState awb; struct { Matrix manual; @@ -175,11 +167,7 @@ struct IPAFrameContext : public FrameContext { bool autoGainModeChange; } agc; - struct { - RGB gains; - bool autoEnabled; - unsigned int temperatureK; - } awb; + ipa::awb::FrameContext awb; struct { BrightnessQ brightness;