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

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

Commit Message

Milan Zamazal Feb. 2, 2026, 9:02 p.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; while CCM must be applied after
gains, the gains must be applied after the combined matrix.

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.

Fixes: 5f3cdafe0fee ("Introduce a general correction matrix")
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();