[v2] libcamera: ipa: simple: Fix multiplication order in Awb
diff mbox series

Message ID 20260203115326.10421-1-mzamazal@redhat.com
State New
Headers show
Series
  • [v2] libcamera: ipa: simple: Fix multiplication order in Awb
Related show

Commit Message

Milan Zamazal Feb. 3, 2026, 11:53 a.m. UTC
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 <mzamazal@redhat.com>
---
 src/ipa/simple/algorithms/awb.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp
index 6fdaacaba..4ed1be289 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();