[v2] ipa: ipu3: agc: Fix swapped green and blue gains in luminance estimate
diff mbox series

Message ID 20260908161805.335568-1-dmanresa@gmail.com
State New
Headers show
Series
  • [v2] ipa: ipu3: agc: Fix swapped green and blue gains in luminance estimate
Related show

Commit Message

D. Manresa Sept. 8, 2026, 4:18 p.m. UTC
The AWB gains passed to the AGC traits are built as { red, blue, green },
but the RGB vector expects { red, green, blue }. The luminance estimate
therefore weights the blue statistics with the green gain and the green
statistics with the blue gain, which biases the exposure whenever the two
gains differ (on an OV5670 they are 1.0 and ~1.8).

Pass the gains in RGB order.

Signed-off-by: D. Manresa <dmanresa@gmail.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
---
Changes in v2:
- Rebase on current master (the bug is still present after the
  AgcAlgorithm port).
- Add Dan's Reviewed-by.

 src/ipa/ipu3/algorithms/agc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index 57cfb32..dd4f1ab 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -224,8 +224,8 @@  void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
 			rgbTriples_,
 			{{
 				context.activeState.awb.gains.red,
-				context.activeState.awb.gains.blue,
 				context.activeState.awb.gains.green,
+				context.activeState.awb.gains.blue,
 			}},
 			bdsGrid_,
 		},