[libcamera-devel] [PATCH] ipa: ipu3: agc: Remove the saturation ratio test

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Wed Nov 3 14:04:45 CET 2021


When the histogram is calculated, we check if a cell is saturated or not
before cumulating its green value. This is wrong, and it can lead to an
empty histogram in case of a fully saturated frame.

This case is reported in bug #84.
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
---
 src/ipa/ipu3/algorithms/agc.cpp | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index b5d736c1..7ac8dfb2 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -124,16 +124,14 @@ void Agc::measureBrightness(const ipu3_uapi_stats_3a *stats,
 					&stats->awb_raw_buffer.meta_data[cellPosition]
 				);
 
-			if (cell->sat_ratio == 0) {
-				uint8_t gr = cell->Gr_avg;
-				uint8_t gb = cell->Gb_avg;
-				/*
-				 * Store the average green value to estimate the
-				 * brightness. Even the overexposed pixels are
-				 * taken into account.
-				 */
-				hist[(gr + gb) / 2]++;
-			}
+			uint8_t gr = cell->Gr_avg;
+			uint8_t gb = cell->Gb_avg;
+			/*
+			* Store the average green value to estimate the
+			* brightness. Even the overexposed pixels are
+			* taken into account.
+			*/
+			hist[(gr + gb) / 2]++;
 		}
 	}
 
-- 
2.32.0



More information about the libcamera-devel mailing list