Fixed RL deconvolution problem with negative lightness channel
see issue 868
This commit is contained in:
@@ -39,19 +39,19 @@ namespace rtengine {
|
|||||||
extern Settings* settings;
|
extern Settings* settings;
|
||||||
|
|
||||||
void ImProcFunctions::dcdamping (float** aI, float** aO, float damping, int W, int H) {
|
void ImProcFunctions::dcdamping (float** aI, float** aO, float damping, int W, int H) {
|
||||||
|
const float dampingFac=2.0/(damping*damping);
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp for
|
#pragma omp for
|
||||||
#endif
|
#endif
|
||||||
for (int i=0; i<H; i++)
|
for (int i=0; i<H; i++)
|
||||||
for (int j=0; j<W; j++) {
|
for (int j=0; j<W; j++) {
|
||||||
float I = aI[i][j];
|
float I = aI[i][j];
|
||||||
float O = (float)aO[i][j];
|
float O = aO[i][j];
|
||||||
if (O==0.0 || I==0.0) {
|
if (O<=0.0 || I<=0.0) {
|
||||||
aI[i][j] = 0.0;
|
aI[i][j] = 0.0;
|
||||||
continue;
|
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 = MIN(U,1.0);
|
||||||
U = U*U*U*U*(5.0-U*4.0);
|
U = U*U*U*U*(5.0-U*4.0);
|
||||||
aI[i][j] = (O - I) / I * U + 1.0;
|
aI[i][j] = (O - I) / I * U + 1.0;
|
||||||
|
Reference in New Issue
Block a user