{"id":26490,"url":"https://patchwork.libcamera.org/api/1.1/patches/26490/?format=json","web_url":"https://patchwork.libcamera.org/patch/26490/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260407-kbingham-awb-split-v1-8-a39af3f4dc20@ideasonboard.com>","date":"2026-04-07T22:01:11","name":"[08/13] ipa: libipa: Awb: Provide common context storage","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"7c3826091c2925cce6c8b974c784541720eb0375","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26490/mbox/","series":[{"id":5874,"url":"https://patchwork.libcamera.org/api/1.1/series/5874/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5874","date":"2026-04-07T22:01:03","name":"ipa: simple: Convert to libipa AWB implementation","version":1,"mbox":"https://patchwork.libcamera.org/series/5874/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26490/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26490/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1E333C32BB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Apr 2026 22:03:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5674D62DCB;\n\tWed,  8 Apr 2026 00:02:52 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD5B762CF8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Apr 2026 00:02:42 +0200 (CEST)","from [192.168.0.204] (ams.linuxembedded.co.uk [209.38.108.23])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 037D224A2;\n\tWed,  8 Apr 2026 00:01:14 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"EQBReuJ0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775599275;\n\tbh=uE5srgoqwc7FrlNaVkAEvYLUx5VbJENakieXKN38U1c=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=EQBReuJ0zcRSv6laA4r0SM25lDm2Drq5S/GDtPRLrdpOM9QlkncWFXqRakW4Qt/ft\n\tritwBuZAKku1+zYQFIYwxB9ZYWE4LIaHk5s7ONb5+18fy1F0YO47BDWJ1iolRNcqz8\n\tx3zTGXsziMwja7K9vepdTSXj52lWMtXzZkF4LDk4=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Date":"Tue, 07 Apr 2026 23:01:11 +0100","Subject":"[PATCH 08/13] ipa: libipa: Awb: Provide common context storage","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","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 <kieran.bingham@ideasonboard.com>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1775599360; l=4445;\n\ti=kieran.bingham@ideasonboard.com; s=20260204;\n\th=from:subject:message-id; \n\tbh=uE5srgoqwc7FrlNaVkAEvYLUx5VbJENakieXKN38U1c=;\n\tb=1Ml/X+qdCuE6CW74C+D9CYmssT0Dkn1wyIu4kJyA2NOO1/yX+5BW5fy1QLxJCiJP27TSmjva6\n\ti8rDBBcPvF8DFwlKlSMZLuUq7xCdvO8bagl+ff7d5c/oF+m7/C1cKDH","X-Developer-Key":"i=kieran.bingham@ideasonboard.com; a=ed25519;\n\tpk=IOxS2C6nWHNjLfkDR71Iesk904i6wJDfEERqV7hDBdY=","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Expose a common structure for storing Awb Session configuration, Active\nstate and Frame Context data.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/libipa/awb.cpp       | 47 ++++++++++++++++++++++++++++++++++++++++++++\n src/ipa/libipa/awb.h         | 26 ++++++++++++++++++++++++\n src/ipa/rkisp1/ipa_context.h | 28 ++++++++------------------\n 3 files changed, 81 insertions(+), 20 deletions(-)","diff":"diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp\nindex 214bac8b56a6ca7b0ac9954f0aa742cd613e6141..f215bea0b59483eadf95572f073928a4eb1275f4 100644\n--- a/src/ipa/libipa/awb.cpp\n+++ b/src/ipa/libipa/awb.cpp\n@@ -22,6 +22,53 @@ LOG_DEFINE_CATEGORY(Awb)\n \n namespace ipa {\n \n+/**\n+ * \\struct awb::Session\n+ * \\brief Session-wide AWB configuration\n+ *\n+ * \\var awb::Session::enabled\n+ * \\brief True when AWB processing is enabled for the session\n+ */\n+\n+/**\n+ * \\struct awb::ActiveState\n+ * \\brief Active AWB state shared across frames\n+ *\n+ * \\var awb::ActiveState::manual\n+ * \\brief The most recent manually requested AWB state\n+ *\n+ * \\var awb::ActiveState::automatic\n+ * \\brief The most recent automatically calculated AWB state\n+ *\n+ * \\var awb::ActiveState::autoEnabled\n+ * \\brief True when automatic AWB is currently selected\n+ */\n+\n+/**\n+ * \\struct awb::ActiveState::AwbState\n+ * \\brief AWB gains and colour temperature for one operating mode\n+ *\n+ * \\var awb::ActiveState::AwbState::gains\n+ * \\brief The white balance gains for this AWB state\n+ *\n+ * \\var awb::ActiveState::AwbState::temperatureK\n+ * \\brief The colour temperature for this AWB state, in Kelvin\n+ */\n+\n+/**\n+ * \\struct awb::FrameContext\n+ * \\brief Per-frame AWB state applied to a captured frame\n+ *\n+ * \\var awb::FrameContext::gains\n+ * \\brief The white balance gains applied to the frame\n+ *\n+ * \\var awb::FrameContext::autoEnabled\n+ * \\brief True when the frame uses automatic AWB\n+ *\n+ * \\var awb::FrameContext::temperatureK\n+ * \\brief The colour temperature used for the frame, in Kelvin\n+ */\n+\n /**\n  * \\class AwbResult\n  * \\brief The result of an AWB calculation\ndiff --git a/src/ipa/libipa/awb.h b/src/ipa/libipa/awb.h\nindex f4a86038635f984ac03b1e466c0fcd4e6d5e22bd..764be849270bcd42ecdf67aea3d13afa170c7499 100644\n--- a/src/ipa/libipa/awb.h\n+++ b/src/ipa/libipa/awb.h\n@@ -20,6 +20,32 @@ namespace libcamera {\n \n namespace ipa {\n \n+namespace awb {\n+\n+struct Session {\n+\tbool enabled;\n+};\n+\n+struct ActiveState {\n+\tstruct AwbState {\n+\t\tRGB<double> gains;\n+\t\tunsigned int temperatureK;\n+\t};\n+\n+\tAwbState manual;\n+\tAwbState automatic;\n+\n+\tbool autoEnabled;\n+};\n+\n+struct FrameContext {\n+\tRGB<double> gains;\n+\tbool autoEnabled;\n+\tunsigned int temperatureK;\n+};\n+\n+} /* namespace awb */\n+\n struct AwbResult {\n \tRGB<double> gains;\n \tdouble colourTemperature;\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 63a6f2b7d884bfff2553175fa32e45ae747fb4c7..85a8ea3acc1fd75ff6b49576800ab7615cebce2c 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -25,6 +25,7 @@\n #include \"libcamera/internal/vector.h\"\n \n #include \"libipa/agc_mean_luminance.h\"\n+#include \"libipa/awb.h\"\n #include \"libipa/camera_sensor_helper.h\"\n #include \"libipa/fc_queue.h\"\n #include \"libipa/fixedpoint.h\"\n@@ -49,15 +50,16 @@ struct IPAHwSettings {\n \tbool compand;\n };\n \n+struct RKISP1AwbSession : public ipa::awb::Session {\n+\tstruct rkisp1_cif_isp_window measureWindow;\n+};\n+\n struct IPASessionConfiguration {\n \tstruct {\n \t\tstruct rkisp1_cif_isp_window measureWindow;\n \t} agc;\n \n-\tstruct {\n-\t\tstruct rkisp1_cif_isp_window measureWindow;\n-\t\tbool enabled;\n-\t} awb;\n+\tstruct RKISP1AwbSession awb;\n \n \tstruct {\n \t\tbool supported;\n@@ -103,17 +105,7 @@ struct IPAActiveState {\n \t\tutils::Duration maxFrameDuration;\n \t} agc;\n \n-\tstruct {\n-\t\tstruct AwbState {\n-\t\t\tRGB<double> gains;\n-\t\t\tunsigned int temperatureK;\n-\t\t};\n-\n-\t\tAwbState manual;\n-\t\tAwbState automatic;\n-\n-\t\tbool autoEnabled;\n-\t} awb;\n+\tipa::awb::ActiveState awb;\n \n \tstruct {\n \t\tMatrix<float, 3, 3> manual;\n@@ -175,11 +167,7 @@ struct IPAFrameContext : public FrameContext {\n \t\tbool autoGainModeChange;\n \t} agc;\n \n-\tstruct {\n-\t\tRGB<double> gains;\n-\t\tbool autoEnabled;\n-\t\tunsigned int temperatureK;\n-\t} awb;\n+\tipa::awb::FrameContext awb;\n \n \tstruct {\n \t\tBrightnessQ brightness;\n","prefixes":["08/13"]}