From 03efc48bc51e00c0bf34bb3bb7b0311ab1ff925f Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 5 Apr 2018 11:22:19 +0200 Subject: [PATCH] tentative fix for #4481 --- rtengine/ipsharpen.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index 37780c37c..505dd5db9 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -106,7 +106,7 @@ void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, int W, i for (int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { - tmpI[i][j] = luminance[i][j]; + tmpI[i][j] = max(luminance[i][j], 0.f); } } @@ -122,6 +122,11 @@ void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, int W, i if (!needdamp) { // apply gaussian blur and divide luminance by result of gaussian blur gaussianBlur (tmpI, tmp, W, H, sigma, nullptr, GAUSS_DIV, luminance); + for (int i = 0; i < H; i++) { + for(int j = 0; j < W; j++) { + tmp[i][j] = max(tmp[i][j], 0.f); + } + } } else { // apply gaussian blur + damping gaussianBlur (tmpI, tmp, W, H, sigma);