From cabbf8c229464eb52c90a0ebf19606026793bba9 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Fri, 3 Jan 2020 20:23:34 +0100 Subject: [PATCH] guidedfilter: direct copy when no rescaling is needed, copied from ART --- rtengine/guidedfilter.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rtengine/guidedfilter.cc b/rtengine/guidedfilter.cc index 6b2adb773..ad3beec51 100644 --- a/rtengine/guidedfilter.cc +++ b/rtengine/guidedfilter.cc @@ -106,7 +106,18 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 const auto f_subsample = [multithread](array2D &d, const array2D &s) -> void { - rescaleBilinear(s, d, multithread); + if (d.width() == s.width() && d.height() == s.height()) { +#ifdef _OPENMP + #pragma omp parallel for if (multithread) +#endif + for (int y = 0; y < s.height(); ++y) { + for (int x = 0; x < s.width(); ++x) { + d[y][x] = s[y][x]; + } + } + } else { + rescaleBilinear(s, d, multithread); + } }; const auto f_mean =