/* * This file is part of RawTherapee. * * Copyright (c) 2004-2010 Gabor Horvath * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * RawTherapee is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ #include #include #include #include #undef THREAD_PRIORITY_NORMAL #define MAXVAL 0xffff #define CLIP(a) ((a)>0?((a)r[i][j] + lumi[1]*img->g[i][j] + lumi[2]*img->b[i][j]; map[i][j] = CLIP(val); } #ifdef _OPENMP #pragma omp parallel #endif { if (!hq) { AlignedBuffer* buffer = new AlignedBuffer (MAX(W,H)); gaussHorizontal (map, map, buffer, W, H, radius, multiThread); gaussVertical (map, map, buffer, W, H, radius, multiThread); delete buffer; } else { #if 0 // the new OpenMP method does not need thread number specific code. // #ifdef _OPENMP #pragma omp parallel if (multiThread) { int tid = omp_get_thread_num(); int nthreads = omp_get_num_threads(); int blk = H/nthreads; if (tid (map, buffer, W, H, 8000, radius, tid*blk, (tid+1)*blk); else bilateral (map, buffer, W, H, 8000, radius, tid*blk, H); } #else bilateral (map, buffer, W, H, 8000, radius, 0, H); #endif // anti-alias filtering the result #ifdef _OPENMP #pragma omp for #endif for (int i=0; i0 && j>0 && i max) max = val; _avg = 1.0/n * val + (1.0 - 1.0/n) * _avg; n++; } avg = (int) _avg; } void SHMap::forceStat (unsigned short max_, unsigned short min_, unsigned short avg_) { max = max_; min = min_; avg = avg_; }}