clip negative output of demosaicers to zero, #5561

This commit is contained in:
Ingo Weyrich
2019-12-12 18:45:18 +01:00
parent a2dd906115
commit b2218d05dd
10 changed files with 105 additions and 113 deletions

View File

@@ -400,11 +400,11 @@ void RawImageSource::eahd_demosaic ()
int vc = homv[imx][j];
if (hc > vc) {
green[i - 1][j] = gh[(i - 1) % 4][j];
green[i - 1][j] = std::max(0.f, gh[(i - 1) % 4][j]);
} else if (hc < vc) {
green[i - 1][j] = gv[(i - 1) % 4][j];
green[i - 1][j] = std::max(0.f, gv[(i - 1) % 4][j]);
} else {
green[i - 1][j] = (gh[(i - 1) % 4][j] + gv[(i - 1) % 4][j]) / 2;
green[i - 1][j] = std::max(0.f, (gh[(i - 1) % 4][j] + gv[(i - 1) % 4][j]) / 2);
}
}
}
@@ -421,11 +421,11 @@ void RawImageSource::eahd_demosaic ()
int vc = homv[(i - 1) % 3][j];
if (hc > vc) {
green[i - 1][j] = gh[(i - 1) % 4][j];
green[i - 1][j] = std::max(0.f, gh[(i - 1) % 4][j]);
} else if (hc < vc) {
green[i - 1][j] = gv[(i - 1) % 4][j];
green[i - 1][j] = std::max(0.f, gv[(i - 1) % 4][j]);
} else {
green[i - 1][j] = (gh[(i - 1) % 4][j] + gv[(i - 1) % 4][j]) / 2;
green[i - 1][j] = std::max(0.f, (gh[(i - 1) % 4][j] + gv[(i - 1) % 4][j]) / 2);
}
}