From bb2e6d0833adad9a1678c169fef74e9f7c211c73 Mon Sep 17 00:00:00 2001 From: Milan Zamazal Date: Tue, 3 Feb 2026 12:53:26 +0100 Subject: [PATCH] libcamera: ipa: simple: Fix multiplication order in Awb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The matrix multiplication in Awb is swapped: the gains should be applied after combinedMatrix, i.e. on the left side. The mistake happened when `ccm' was replaced with combinedMatrix and gainMatrix multiplication was moved to Awb. While CCM must be applied after gains, the gains must be applied after the combined matrix, which no longer corresponds to CCM in Awb. Since there is currently no algorithm modifying combinedMatrix before Awb, combinedMatrix is an identity matrix there and the wrong order doesn't influence the output at the moment. Signed-off-by: Milan Zamazal Reviewed-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/ipa/simple/algorithms/awb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp index 6fdaacab..4ed1be28 100644 --- a/src/ipa/simple/algorithms/awb.cpp +++ b/src/ipa/simple/algorithms/awb.cpp @@ -44,7 +44,7 @@ void Awb::prepare(IPAContext &context, 0, gains.g(), 0, 0, 0, gains.b() } }; context.activeState.combinedMatrix = - context.activeState.combinedMatrix * gainMatrix; + gainMatrix * context.activeState.combinedMatrix; frameContext.gains.red = gains.r(); frameContext.gains.blue = gains.b();