simpleprocess.cc : be cppcheck clean

This commit is contained in:
Ingo Weyrich 2020-02-27 14:54:17 +01:00
parent 19b6e4ca68
commit 4590607ea5

View File

@ -68,7 +68,7 @@ public:
pl(pl), pl(pl),
flush(flush), flush(flush),
// internal state // internal state
ii(nullptr), initialImage(nullptr),
imgsrc(nullptr), imgsrc(nullptr),
fw(0), fw(0),
fh(0), fh(0),
@ -97,6 +97,7 @@ public:
hlcomprthresh(0), hlcomprthresh(0),
baseImg(nullptr), baseImg(nullptr),
labView(nullptr), labView(nullptr),
ctColorCurve(),
autili(false), autili(false),
butili(false) butili(false)
{ {
@ -150,10 +151,10 @@ private:
pl->setProgress(0.0); pl->setProgress(0.0);
} }
ii = job->initialImage; initialImage = job->initialImage;
if (!ii) { if (!initialImage) {
ii = InitialImage::load(job->fname, job->isRaw, &errorCode); initialImage = InitialImage::load(job->fname, job->isRaw, &errorCode);
if (errorCode) { if (errorCode) {
delete job; delete job;
@ -164,7 +165,7 @@ private:
procparams::ProcParams& params = job->pparams; procparams::ProcParams& params = job->pparams;
// acquire image from imagesource // acquire image from imagesource
imgsrc = ii->getImageSource(); imgsrc = initialImage->getImageSource();
tr = getCoarseBitMask(params.coarse); tr = getCoarseBitMask(params.coarse);
@ -245,7 +246,6 @@ private:
if (params.retinex.enabled) { //enabled Retinex if (params.retinex.enabled) { //enabled Retinex
LUTf cdcurve(65536, 0); LUTf cdcurve(65536, 0);
LUTf mapcurve(65536, 0); LUTf mapcurve(65536, 0);
LUTu dummy;
RetinextransmissionCurve dehatransmissionCurve; RetinextransmissionCurve dehatransmissionCurve;
RetinexgaintransmissionCurve dehagaintransmissionCurve; RetinexgaintransmissionCurve dehagaintransmissionCurve;
bool dehacontlutili = false; bool dehacontlutili = false;
@ -921,11 +921,11 @@ private:
if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") { if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") {
const int cw = baseImg->getWidth(); const int cw = baseImg->getWidth();
const int ch = baseImg->getHeight(); const int ch = baseImg->getHeight();
cmsHTRANSFORM dummy = nullptr; cmsHTRANSFORM dummyTransForm = nullptr;
// put gamma TRC to 1 // put gamma TRC to 1
ipf.workingtrc(baseImg, baseImg, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310, dummy, true, false, false); ipf.workingtrc(baseImg, baseImg, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310, dummyTransForm, true, false, false);
//adjust TRC //adjust TRC
ipf.workingtrc(baseImg, baseImg, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope, dummy, false, true, false); ipf.workingtrc(baseImg, baseImg, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope, dummyTransForm, false, true, false);
} }
} }
@ -1155,9 +1155,7 @@ private:
ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1);
unshar->CopyFrom(labView); unshar->CopyFrom(labView);
params.wavelet.CLmethod = provis; params.wavelet.CLmethod = provis;
}
if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") {
WaveParams.expcontrast = false; WaveParams.expcontrast = false;
WaveParams.expchroma = false; WaveParams.expchroma = false;
WaveParams.expedge = false; WaveParams.expedge = false;
@ -1402,9 +1400,6 @@ private:
} }
} }
cmsHPROFILE jprof = nullptr;
constexpr bool customGamma = false;
constexpr bool useLCMS = false;
bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili && !params.colorappearance.enabled; bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili && !params.colorappearance.enabled;
///////////// Custom output gamma has been removed, the user now has to create ///////////// Custom output gamma has been removed, the user now has to create
@ -1453,12 +1448,12 @@ private:
case MetaDataParams::TUNNEL: case MetaDataParams::TUNNEL:
// Sending back the whole first root, which won't necessarily be the selected frame number // 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 // and may contain subframe depending on initial raw's hierarchy
readyImg->setMetadata(ii->getMetaData()->getRootExifData()); readyImg->setMetadata(initialImage->getMetaData()->getRootExifData());
break; break;
case MetaDataParams::EDIT: case MetaDataParams::EDIT:
// ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy // 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); readyImg->setMetadata(initialImage->getMetaData()->getBestExifData(imgsrc, &params.raw), params.exif, params.iptc);
break; break;
default: // case MetaDataParams::STRIP default: // case MetaDataParams::STRIP
@ -1468,13 +1463,6 @@ private:
// Setting the output curve to readyImg // Setting the output curve to readyImg
if (customGamma) {
if (!useLCMS) {
// use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16 w/ gamma
ProfileContent pc(jprof);
readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size());
}
} else {
// use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma // use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma
if (!params.icm.outputProfile.empty() && params.icm.outputProfile != ColorManagementParams::NoICMString) { if (!params.icm.outputProfile.empty() && params.icm.outputProfile != ColorManagementParams::NoICMString) {
@ -1498,14 +1486,13 @@ private:
// No ICM // No ICM
readyImg->setOutputProfile(nullptr, 0); readyImg->setOutputProfile(nullptr, 0);
} }
}
// t2.set(); // t2.set();
// if( settings->verbose ) // if( settings->verbose )
// printf("Total:- %d usec\n", t2.etime(t1)); // printf("Total:- %d usec\n", t2.etime(t1));
if (!job->initialImage) { if (!job->initialImage) {
ii->decreaseRef(); initialImage->decreaseRef();
} }
delete job; delete job;
@ -1669,7 +1656,7 @@ private:
// internal state // internal state
std::unique_ptr<ImProcFunctions> ipf_p; std::unique_ptr<ImProcFunctions> ipf_p;
InitialImage *ii; InitialImage *initialImage;
ImageSource *imgsrc; ImageSource *imgsrc;
int fw; int fw;
int fh; int fh;