From e2154f9feb53ccc3196b5028fbb7c27b1cdd636c Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Mon, 18 Feb 2019 15:25:35 +0100 Subject: [PATCH 1/2] Fix a race in get_dark_channel() --- rtengine/ipdehaze.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/ipdehaze.cc b/rtengine/ipdehaze.cc index 97c1883c9..2129b1f92 100644 --- a/rtengine/ipdehaze.cc +++ b/rtengine/ipdehaze.cc @@ -66,7 +66,7 @@ int get_dark_channel(const array2D &R, const array2D &G, const arr int npatches = 0; #ifdef _OPENMP - #pragma omp parallel for if (multithread) + #pragma omp parallel for reduction(+:npatches) if (multithread) #endif for (int y = 0; y < H; y += patchsize) { int pH = min(y+patchsize, H); From 8d8aeb00a740f27af72bcacff2163df369b5020c Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Mon, 18 Feb 2019 16:56:39 +0100 Subject: [PATCH 2/2] Fix segfault when dehaze depth map is enabled --- rtengine/ipdehaze.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/ipdehaze.cc b/rtengine/ipdehaze.cc index 2129b1f92..c9b1a3cdb 100644 --- a/rtengine/ipdehaze.cc +++ b/rtengine/ipdehaze.cc @@ -311,7 +311,7 @@ void ImProcFunctions::dehaze(Imagefloat *img) } float mt = max(t[y][x], t0, tl + teps, tu + teps); if (params->dehaze.showDepthMap) { - img->r(y, x) = img->g(y, x) = img->b(y, x) = 1.f - mt; + img->r(y, x) = img->g(y, x) = img->b(y, x) = LIM01(1.f - mt); } else { float r = (rgb[0] - ambient[0]) / mt + ambient[0]; float g = (rgb[1] - ambient[1]) / mt + ambient[1];