From acfdf220ec9abb082ae8e3cc9518bfa60d201e21 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 3 Apr 2018 10:38:59 +0200 Subject: [PATCH] reverted to original method for colour propagation of fully clipped highlights The "new" one was producing artifacts in some cases -- needs further investigation --- rtengine/hilite_recon.cc | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 636ffdc80..a1f5b5e4a 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -415,7 +415,6 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b { { 1.f, 0.8660254f, -0.5f }, { 1.f, -0.8660254f, -0.5f }, { 1.f, 0.f, 1.f } }; std::unique_ptr recovered_partial; - std::unique_ptr recovered_full; if(settings->verbose) for(int c = 0; c < 3; c++) { @@ -1109,16 +1108,11 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b //now correct clipped channels if (pixel[0] > max_f[0] && pixel[1] > max_f[1] && pixel[2] > max_f[2]) { //all channels clipped - // float Y = (0.299 * clipfix[0] + 0.587 * clipfix[1] + 0.114 * clipfix[2]); - // float factor = whitept / Y; - // red[i][j] = CLIP(clipfix[0] * factor); - // green[i][j] = CLIP(clipfix[1] * factor); - // blue[i][j] = CLIP(clipfix[2] * factor); - red[i][j] = green[i][j] = blue[i][j] = whitept; - if (!recovered_full) { - recovered_full.reset(new PixelsMap(width, height)); - } - recovered_full->set(j, i); + float Y = (0.299 * clipfix[0] + 0.587 * clipfix[1] + 0.114 * clipfix[2]); + float factor = whitept / Y; + red[i][j] = CLIP(clipfix[0] * factor); + green[i][j] = CLIP(clipfix[1] * factor); + blue[i][j] = CLIP(clipfix[2] * factor); } else {//some channels clipped float notclipped[3] = {pixel[0] <= max_f[0] ? 1.f : 0.f, pixel[1] <= max_f[1] ? 1.f : 0.f, pixel[2] <= max_f[2] ? 1.f : 0.f}; @@ -1180,27 +1174,6 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } } } - - if (recovered_full) { -#ifdef _OPENMP - #pragma omp parallel -#endif - gaussianBlur(color, temp, width, height, 3.f); - -#ifdef _OPENMP - #pragma omp parallel for -#endif - for (int i = 0; i < height; ++i) { - for (int j = 0; j < width; ++j) { - int skip = recovered_full->skipIfZero(j, i); - if (skip) { - j += skip-1; - } else if (recovered_full->get(j, i)) { - color[i][j] = temp[i][j]; - } - } - } - } } }