[PATCH v2] ipa: rkisp1: agc: Fix histogram construction

Paul Elder paul.elder at ideasonboard.com
Fri Apr 19 07:58:49 CEST 2024


This histogram reported by the rkisp1 hardware is 20 bits, where the
upper 16 bits are meaningful integer data and the lower 4 bits are
fractional and meant to be discarded. Remove thse 4 bits when
construction the histogram.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
This was meant to be in the same series as "[PATCH v2] ipa: libipa:
histogram: Add transform parameter to constructor"

This depends on v2 of "Centralise Agc into libipa".

Changes in v2:
- use a lambda function instead of the rshift parameter
---
 src/ipa/rkisp1/algorithms/agc.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index 27b6f2c1..26526f5e 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -278,7 +278,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
 	const rkisp1_cif_isp_stat *params = &stats->params;
 	ASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);
 
-	Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins });
+	Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },
+		       [](uint32_t x) { return x >> 4; });
 	expMeans_ = { params->ae.exp_mean, context.hw->numAeCells };
 
 	/*
-- 
2.39.2



More information about the libcamera-devel mailing list