From f1522e94dfaedcde26280eb6387f2c6f2de66fd7 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Fri, 19 Apr 2024 14:56:10 +0900 Subject: ipa: rkisp1: agc: Fix histogram construction 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 these 4 bits when construction the histogram. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Daniel Scally Reviewed-by: Laurent Pinchart --- src/ipa/rkisp1/algorithms/agc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index c1333b59..50e0690f 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -277,7 +277,9 @@ 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 }); + /* The lower 4 bits are fractional and meant to be discarded. */ + Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins }, + [](uint32_t x) { return x >> 4; }); expMeans_ = { params->ae.exp_mean, context.hw->numAeCells }; /* -- cgit v1.2.1