Merge pull request #3703 from Beep6581/lcpvignette_fix

LCP vignetting correction only works with undemosaiced raw files. fix…
This commit is contained in:
Ingo Weyrich
2017-02-19 17:39:01 +01:00
committed by GitHub

View File

@@ -1769,14 +1769,31 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
if (pLCPProf) { // don't check focal length to allow distortion correction for lenses without chip, also pass dummy focal length 1 in case of 0
LCPMapper map(pLCPProf, max(idata->getFocalLen(), 1.0), idata->getFocalLen35mm(), idata->getFocusDist(), idata->getFNumber(), true, false, W, H, coarse, -1);
if (ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS || ri->get_colors() == 1) {
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel for
#endif
for (int y = 0; y < H; y++) {
for (int x = 0; x < W; x++) {
if (rawData[y][x] > 0) {
rawData[y][x] *= map.calcVignetteFac(x, y);
for (int y = 0; y < H; y++) {
for (int x = 0; x < W; x++) {
if (rawData[y][x] > 0) {
rawData[y][x] *= map.calcVignetteFac(x, y);
}
}
}
} else if(ri->get_colors() == 3) {
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int y = 0; y < H; y++) {
for (int x = 0; x < W; x++) {
float vignFactor = map.calcVignetteFac(x, y);
for(int c = 0;c < 3; ++c) {
if (rawData[y][3 * x + c] > 0) {
rawData[y][3 * x + c] *= vignFactor;
}
}
}
}
}