Merge branch 'dev' into spot-removal-tool (see #2239)

This commit is contained in:
Hombre
2017-11-25 23:30:52 +01:00
320 changed files with 17146 additions and 8522 deletions

View File

@@ -318,7 +318,7 @@ private:
int beg_tileW = wcr * tileWskip + tileWskip / 2.f - crW / 2.f;
int beg_tileH = hcr * tileHskip + tileHskip / 2.f - crH / 2.f;
PreviewProps ppP (beg_tileW, beg_tileH, crW, crH, skipP);
imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw );
imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw );
//baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve);
// we only need image reduced to 1/4 here
@@ -538,7 +538,7 @@ private:
for (int wcr = 0; wcr <= 2; wcr++) {
for (int hcr = 0; hcr <= 2; hcr++) {
PreviewProps ppP (coordW[wcr], coordH[hcr], crW, crH, 1);
imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw);
imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw);
//baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve);
@@ -698,7 +698,7 @@ private:
}
baseImg = new Imagefloat (fw, fh);
imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw);
imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.raw);
if (pl) {
pl->setProgress (0.50);
@@ -718,7 +718,7 @@ private:
LUTu aehist;
int aehistcompr;
imgsrc->getAutoExpHistogram (aehist, aehistcompr);
ipf.getAutoExp (aehist, aehistcompr, imgsrc->getDefGain(), params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh);
ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh);
}
// at this stage, we can flush the raw data to free up quite an important amount of memory
@@ -778,9 +778,9 @@ private:
// CurveFactory::denoiseLL(lldenoiseutili, denoiseParams.lcurve, Noisecurve,1);
//denoiseParams.getCurves(noiseLCurve);
// ipf.RGB_denoise(baseImg, baseImg, calclum, imgsrc->isRAW(), denoiseParams, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, lldenoiseutili);
float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi;
float nresi, highresi;
int kall = 2;
ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi);
}
@@ -810,15 +810,24 @@ private:
ipf.firstAnalysis (baseImg, params, hist16);
if (params.fattal.enabled) {
ipf.ToneMapFattal02(baseImg);
}
// perform transform (excepted resizing)
if (ipf.needsTransform()) {
Imagefloat* trImg = new Imagefloat (fw, fh);
ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(),
imgsrc->getMetaData()->getFocusDist(),
imgsrc->getMetaData()->getFNumber(),
imgsrc->getRotateDegree(), true);
delete baseImg;
baseImg = trImg;
Imagefloat* trImg = nullptr;
if (ipf.needsLuminanceOnly()) {
trImg = baseImg;
} else {
trImg = new Imagefloat (fw, fh);
}
ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh,
imgsrc->getMetaData(), imgsrc->getRotateDegree(), true);
if(trImg != baseImg) {
delete baseImg;
baseImg = trImg;
}
}
}
@@ -872,7 +881,7 @@ private:
//if(params.blackwhite.enabled) params.toneCurve.hrenabled=false;
CurveFactory::complexCurve (expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr,
params.toneCurve.curveMode, params.toneCurve.curve, params.toneCurve.curveMode2, params.toneCurve.curve2,
params.toneCurve.curve, params.toneCurve.curve2,
hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2 );
CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1);
@@ -888,13 +897,7 @@ private:
{wprof[1][0], wprof[1][1], wprof[1][2]},
{wprof[2][0], wprof[2][1], wprof[2][2]}
};
TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params.icm.working);
double wip[3][3] = {
{wiprof[0][0], wiprof[0][1], wiprof[0][2]},
{wiprof[1][0], wiprof[1][1], wiprof[1][2]},
{wiprof[2][0], wiprof[2][1], wiprof[2][2]}
};
params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, wip, opautili);
params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili);
clToningcurve (65536, 0);
CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, 1);
cl2Toningcurve (65536, 0);
@@ -933,7 +936,7 @@ private:
autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000)
DCPProfile::ApplyState as;
DCPProfile *dcpProf = imgsrc->getDCP (params.icm, currWB, as);
DCPProfile *dcpProf = imgsrc->getDCP (params.icm, as);
LUTu histToneCurve;
@@ -1080,7 +1083,7 @@ private:
CurveFactory::curveWavContL (wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1);
if (params.wavelet.enabled) {
ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, wavcontlutili, 1);
ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1);
}
wavCLVCurve.Reset();
@@ -1088,7 +1091,6 @@ private:
//Colorappearance and tone-mapping associated
int f_w = 1, f_h = 1;
int begh = 0, endh = fh;
if (params.colorappearance.tonecie || params.colorappearance.enabled) {
f_w = fw;
@@ -1096,8 +1098,7 @@ private:
}
CieImage *cieView = new CieImage (f_w, (f_h));
begh = 0;
endh = fh;
CurveFactory::curveLightBrightColor (
params.colorappearance.curve,
params.colorappearance.curve2,
@@ -1111,10 +1112,16 @@ private:
if (params.colorappearance.enabled) {
double adap;
float fnum = imgsrc->getMetaData()->getFNumber ();// F number
float fiso = imgsrc->getMetaData()->getISOSpeed () ;// ISO
float fspeed = imgsrc->getMetaData()->getShutterSpeed () ;//speed
float fcomp = imgsrc->getMetaData()->getExpComp ();//compensation + -
int imgNum = 0;
if (imgsrc->getSensorType() == ST_BAYER) {
imgNum = params.raw.bayersensor.imageNum;
} else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) {
//imgNum = params.raw.xtranssensor.imageNum;
}
float fnum = imgsrc->getMetaData()->getFNumber (imgNum); // F number
float fiso = imgsrc->getMetaData()->getISOSpeed (imgNum) ; // ISO
float fspeed = imgsrc->getMetaData()->getShutterSpeed (imgNum) ; //speed
float fcomp = imgsrc->getMetaData()->getExpComp (imgNum); //compensation + -
if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) {
adap = 2000.;
@@ -1133,18 +1140,18 @@ private:
if (params.sharpening.enabled) {
if (settings->ciecamfloat) {
float d, dj, yb;
ipf.ciecam_02float (cieView, float (adap), begh, endh, 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1);
ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1);
} else {
double dd, dj, yb;
ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, yb, 1);
double dd, dj;
ipf.ciecam_02 (cieView, adap, 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1);
}
} else {
if (settings->ciecamfloat) {
float d, dj, yb;
ipf.ciecam_02float (cieView, float (adap), begh, endh, 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1);
ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1);
} else {
double dd, dj, yb;
ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, yb, 1);
double dd, dj;
ipf.ciecam_02 (cieView, adap, 1, 2, labView, &params, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1);
}
}
}
@@ -1236,7 +1243,7 @@ private:
GammaValues ga;
// if(params.blackwhite.enabled) params.toneCurve.hrenabled=false;
readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, bwonly, &ga);
readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, &ga);
customGamma = true;
//or selected Free gamma
@@ -1250,7 +1257,7 @@ private:
// if Default gamma mode: we use the profile selected in the "Output profile" combobox;
// gamma come from the selected profile, otherwise it comes from "Free gamma" tool
readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, bwonly);
readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm);
if (settings->verbose) {
printf ("Output profile_: \"%s\"\n", params.icm.output.c_str());
@@ -1287,9 +1294,12 @@ private:
}
if (tunnelMetaData) {
readyImg->setMetadata (ii->getMetaData()->getExifData ());
// Sending back the whole first root, which won't necessarily be the selected frame number
// and may contain subframe depending on initial raw's hierarchy
readyImg->setMetadata (ii->getMetaData()->getRootExifData ());
} else {
readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc);
// ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy
readyImg->setMetadata (ii->getMetaData()->getBestExifData(imgsrc, &params.raw), params.exif, params.iptc);
}