Fixed RL deconvolution problem with negative lightness channel

see issue 868
This commit is contained in:
Oliver Duis
2011-07-31 22:53:40 +02:00
parent 9992bac727
commit 2d5b96a880

View File

@@ -39,19 +39,19 @@ namespace rtengine {
extern Settings* settings;
void ImProcFunctions::dcdamping (float** aI, float** aO, float damping, int W, int H) {
const float dampingFac=2.0/(damping*damping);
#ifdef _OPENMP
#pragma omp for
#endif
for (int i=0; i<H; i++)
for (int j=0; j<W; j++) {
float I = aI[i][j];
float O = (float)aO[i][j];
if (O==0.0 || I==0.0) {
float O = aO[i][j];
if (O<=0.0 || I<=0.0) {
aI[i][j] = 0.0;
continue;
}
float U = -(O * log(I/O) - I + O) * 2.0 / (damping*damping);
float U = -(O * log(I/O) - I + O) * dampingFac;
U = MIN(U,1.0);
U = U*U*U*U*(5.0-U*4.0);
aI[i][j] = (O - I) / I * U + 1.0;