ipa: simple: awb: Use correct type in std::accumulate

The result type of the std::accumulate() call is uint64_t; let's use the
same type for the initial value (rather than the default int) to prevent
summing up the values in a different integer type.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Tested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal
2025-09-29 22:19:22 +02:00
committed by Kieran Bingham
parent 6a7fe29a18
commit 0201e11f27

View File

@@ -71,7 +71,7 @@ void Awb::process(IPAContext &context,
* rather than from the sensor range.
*/
const uint64_t nPixels = std::accumulate(
histogram.begin(), histogram.end(), 0);
histogram.begin(), histogram.end(), uint64_t(0));
const uint64_t offset = blackLevel * nPixels;
const uint64_t minValid = 1;
const uint64_t sumR = stats->sumR_ > offset / 4 ? stats->sumR_ - offset / 4 : minValid;