diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 5ff43c472..445635876 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -9559,6 +9559,8 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl if(lp.nlstr > 0 && (hspot > 150 && wspot > 150)) { NLMeans(tmp1.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, GW, GH, float (sk), multiThread); + // NLMeans(*nlm, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, GW + addsiz, GH + addsiz, float (sk), multiThread); + } if(lp.smasktyp != 0) { if(lp.enablMask && lp.recothrd != 1.f) { @@ -10230,6 +10232,9 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl if(lp.nlstr > 0) { NLMeans(bufwv.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, bfw, bfh, 1.f, multiThread); + // NLMeans(*nlm, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, bfw + addsiz, bfh + addsiz, 1.f, multiThread); + + } @@ -10896,6 +10901,7 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int BENCHFUN const int W = bfw; const int H = bfh; +// printf("W=%i H=%i\n", W, H); float gamma = gam; rtengine::GammaValues g_a; //gamma parameters double pwr = 1.0 / static_cast(gam);//default 3.0 - gamma Lab @@ -10918,7 +10924,6 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int img[y][x] = 65536.f * igammalog(img[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]); } } - // these two can be changed if needed. increasing max_patch_radius doesn't // affect performance, whereas max_search_radius *really* does // (the complexity is O(max_search_radius^2 * W * H)) @@ -10973,9 +10978,9 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int # pragma omp parallel for if (multithread) #endif for (int y = 0; y < HH; ++y) { - int yy = y <= border ? 0 : y >= H ? H-1 : y - border; + int yy = y <= border ? 0 : y - border >= H ? H-1 : y - border; for (int x = 0; x < WW; ++x) { - int xx = x <= border ? 0 : x >= W ? W-1 : x - border; + int xx = x <= border ? 0 : x - border >= W ? W-1 : x - border; float Y = img[yy][xx] / 65536.f; src[y][x] = Y; } @@ -11006,7 +11011,7 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int mask[y][x] = (1.f / (mask[y][x] * h2)) / lutfactor; } } - + // process by tiles to avoid numerical accuracy errors in the computation // of the integral image const int tile_size = 150; @@ -11120,7 +11125,7 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int } } // printf("E\n"); - + // Compute final estimate at pixel x = (x1, x2) for (int yy = start_y+border; yy < end_y-border; ++yy) { int y = yy - border;