From 5c6df4a59f466dc370ebbb980ad36f6096312b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Wed, 15 Nov 2023 10:13:49 +0100 Subject: [PATCH] Optimize calculating stast for debayer --- rawimage.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rawimage.cpp b/rawimage.cpp index ed176e5..262f823 100644 --- a/rawimage.cpp +++ b/rawimage.cpp @@ -177,10 +177,20 @@ void calcStats(const T *data, size_t n, size_t w, RawImage::Stats &stats) statsFunc(data[i*ch + 1], 1); statsFunc(data[i*ch + 2], 2); } - if constexpr(ch == 1) + } + if constexpr(ch == 1) + { + size_t h = (n / w) & (SIZE_MAX-1); + w &= (SIZE_MAX-1); + for(size_t y=0; y