From ef754f7593811182f0bfc640ea7a64b0130d7fd0 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 18 Feb 2017 16:01:41 +0100 Subject: [PATCH] LCP vignetting correction only works with undemosaiced raw files. fixes #3702 --- rtengine/rawimagesource.cc | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 049c509f5..5d4f51934 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -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; + } + } } } }