[{"id":37960,"web_url":"https://patchwork.libcamera.org/comment/37960/","msgid":"<189e623b-ee02-4d73-8754-1843c4c4a4af@collabora.com>","date":"2026-01-26T16:03:14","subject":"Re: [PATCH v4 10/15] libcamera: ipa: simple: Apply gain matrix in\n\tawb","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Reviewed-by: Robert Mader <robert.mader@collabora.com>\n\nOn 22.01.26 17:19, Milan Zamazal wrote:\n> Now, when we have a combined matrix, we can apply AWB gains to it\n> directly in awb.cpp.\n>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   src/ipa/simple/algorithms/awb.cpp | 7 ++++++-\n>   src/ipa/simple/algorithms/lut.cpp | 5 +----\n>   2 files changed, 7 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp\n> index a391359fb..4d2f1df15 100644\n> --- a/src/ipa/simple/algorithms/awb.cpp\n> +++ b/src/ipa/simple/algorithms/awb.cpp\n> @@ -1,6 +1,6 @@\n>   /* SPDX-License-Identifier: LGPL-2.1-or-later */\n>   /*\n> - * Copyright (C) 2024, Red Hat Inc.\n> + * Copyright (C) 2024-2025 Red Hat Inc.\n>    *\n>    * Auto white balance\n>    */\n> @@ -40,6 +40,11 @@ void Awb::prepare(IPAContext &context,\n>   \t\t  [[maybe_unused]] DebayerParams *params)\n>   {\n>   \tauto &gains = context.activeState.awb.gains;\n> +\tMatrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0,\n> +\t\t\t\t\t     0, gains.g(), 0,\n> +\t\t\t\t\t     0, 0, gains.b() } };\n> +\tcontext.activeState.combinedMatrix =\n> +\t\tcontext.activeState.combinedMatrix * gainMatrix;\n>   \t/* Just report, the gains are applied in LUT algorithm. */\n>   \tframeContext.gains.red = gains.r();\n>   \tframeContext.gains.blue = gains.b();\n> diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp\n> index 9740f8c8d..d8e92c613 100644\n> --- a/src/ipa/simple/algorithms/lut.cpp\n> +++ b/src/ipa/simple/algorithms/lut.cpp\n> @@ -107,10 +107,7 @@ void Lut::prepare(IPAContext &context,\n>   \t\t\tparams->blue[i] = gammaTable[static_cast<unsigned int>(lutGains.b())];\n>   \t\t}\n>   \t} else if (context.activeState.matrixChanged || gammaUpdateNeeded) {\n> -\t\tMatrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0,\n> -\t\t\t\t\t\t     0, gains.g(), 0,\n> -\t\t\t\t\t\t     0, 0, gains.b() } };\n> -\t\tauto matrix = context.activeState.combinedMatrix * gainMatrix;\n> +\t\tauto &matrix = context.activeState.combinedMatrix;\n>   \t\tauto &red = params->redCcm;\n>   \t\tauto &green = params->greenCcm;\n>   \t\tauto &blue = params->blueCcm;","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 78497C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Jan 2026 16:03:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34BFE61FD5;\n\tMon, 26 Jan 2026 17:03:23 +0100 (CET)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ECFFF61FC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Jan 2026 17:03:20 +0100 (CET)","by mx.zohomail.com with SMTPS id 176944339583843.75398352950515;\n\tMon, 26 Jan 2026 08:03:15 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"SGj629vp\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1769443397; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=mMnxWundEBPvp51Vwx8ht0J6DD4SyzfBIIxv97UiRfXQthL0w5we02uj2vhkmK+s2bit9X6ipE3NJ58spcz2HgrdU7O2z20I+vOT2Kl0Dt1P25/pp94gLzo6hPhteNomj89BvjDzHGNuTnY24ZBje4U2D5yjE2z5F+1B1objt4I=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1769443397;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=KRz+VeKToj/x2gzQvwvtMKXoV2jR3PTEwxDwb4aDQQ8=; \n\tb=K6ttSdoLE8s5b4Vi8olzAvkRfg5kZKYHAsFT4t4+0FZdSjnyoRNzyiI5Aq9rwp3GRdb1oAcFS8WLt69n4mZdyjRWcxGTzMfwRhuUcDc3htBh/4Gz2aUNGBvAUtuHYA/SI+DRENM+3SchfTQH3ibbmv4K9yGc+8gESJmwx6s5TiY=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1769443397;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=KRz+VeKToj/x2gzQvwvtMKXoV2jR3PTEwxDwb4aDQQ8=;\n\tb=SGj629vplGk1ACrriGIBd+s1ulgGcPF5qdDG0VkZ7eVb0D+b01APF1pUtMsNYuH1\n\tKabSzjNoKmJFoQnWnyXnkz/2tITPSJaPxm0UE52Uc4L1Nr7Dvl/SQrww5YeImv9+ml9\n\t6c0AeXGWKyso8FbeJWrXaFHe2XI5sXRLcqMvOF3A=","Message-ID":"<189e623b-ee02-4d73-8754-1843c4c4a4af@collabora.com>","Date":"Mon, 26 Jan 2026 17:03:14 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v4 10/15] libcamera: ipa: simple: Apply gain matrix in\n\tawb","To":"libcamera-devel@lists.libcamera.org","References":"<20260122161935.208562-1-mzamazal@redhat.com>\n\t<20260122161935.208562-11-mzamazal@redhat.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20260122161935.208562-11-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}}]