Saving of Locallab tool parameters in .pp3 file

- Control spot panel parameters are now saved in .pp3 file
- Control spot curved are now visible when Locallab tool panel is
active, not visible otherwise

Limitations:
- Other Locallab tool parameters aren't saved in .pp3 file yet
- Locallab tools are temporary deactivated (time to end procparam
update)
This commit is contained in:
Pandagrapher 2018-07-26 19:20:33 +02:00
parent 74dd3a6a10
commit a31393adb1
21 changed files with 2913 additions and 2817 deletions

View File

@ -741,6 +741,25 @@ HISTORY_MSG_490;DRC - Amount
HISTORY_MSG_491;White Balance
HISTORY_MSG_492;RGB Curves
HISTORY_MSG_493;L*a*b* Adjustments
HISTORY_MSG_495;L*a*b Spot created
HISTORY_MSG_496;L*a*b Spot deleted
HISTORY_MSG_497;L*a*b Spot selected
HISTORY_MSG_498;L*a*b Spot name
HISTORY_MSG_499;L*a*b Spot visibility
HISTORY_MSG_500;L*a*b Spot shape
HISTORY_MSG_501;L*a*b Spot method
HISTORY_MSG_502;L*a*b Spot shape method
HISTORY_MSG_503;L*a*b Spot locX
HISTORY_MSG_504;L*a*b Spot locXL
HISTORY_MSG_505;L*a*b Spot locY
HISTORY_MSG_506;L*a*b Spot locYT
HISTORY_MSG_507;L*a*b Spot center
HISTORY_MSG_508;L*a*b Spot circrad
HISTORY_MSG_509;L*a*b Spot quality method
HISTORY_MSG_510;L*a*b Spot transit
HISTORY_MSG_511;L*a*b Spot thresh
HISTORY_MSG_512;L*a*b Spot iter
HISTORY_MSG_CLAMPOOG;Out-of-gamut color clipping
HISTORY_MSG_LOCLOCX;Local - Right
HISTORY_MSG_LOCCENTER;Local - Center

View File

@ -52,7 +52,7 @@ extern const Settings* settings;
Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow)
: PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), reservCrop(nullptr),
cropImg (nullptr), shbuf_real(nullptr), transCrop (nullptr), cieCrop (nullptr), shbuffer(nullptr),
cropImg(nullptr), shbuf_real(nullptr), transCrop(nullptr), cieCrop(nullptr), shbuffer(nullptr),
updating(false), newUpdatePending(false), skip(10),
cropx(0), cropy(0), cropw(-1), croph(-1),
trafx(0), trafy(0), trafw(-1), trafh(-1),
@ -823,7 +823,7 @@ void Crop::update(int todo)
DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as);
LUTu histToneCurve;
parent->ipf.rgbProc (baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve,
parent->ipf.rgbProc(baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve,
params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, parent->colourToningSatLimit, parent->colourToningSatLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->opautili, parent->clToningcurve, parent->cl2Toningcurve,
parent->customToneCurve1, parent->customToneCurve2, parent->beforeToneCurveBW, parent->afterToneCurveBW, rrm, ggm, bbm,
parent->bwAutoR, parent->bwAutoG, parent->bwAutoB, dcpProf, as, histToneCurve);
@ -890,6 +890,8 @@ void Crop::update(int todo)
// bool tyty = false;
int maxspot = settings->nspot + 1;
// TODO Locallab
/*
if (needslocal) {
// if (tyty ) {
@ -1775,6 +1777,7 @@ void Crop::update(int todo)
}
}
*/
// int moderetinex;
// parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1);
@ -1800,7 +1803,7 @@ void Crop::update(int todo)
if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) {
parent->ipf.MLmicrocontrast(labnCrop);
parent->ipf.sharpening (labnCrop, params.sharpening, parent->sharpMask);
parent->ipf.sharpening(labnCrop, params.sharpening, parent->sharpMask);
}
}
@ -1929,8 +1932,8 @@ void Crop::update(int todo)
}
float d, dj, yb; // not used after this block
parent->ipf.ciecam_02float (cieCrop, float (adap), 1, 2, labnCrop, &params, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3,
dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1, parent->sharpMask);
parent->ipf.ciecam_02float(cieCrop, float (adap), 1, 2, labnCrop, &params, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3,
dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1, parent->sharpMask);
} else {
// CIECAM is disabled, we free up its image buffer to save some space
if (cieCrop) {
@ -2036,7 +2039,8 @@ void Crop::freeAll()
}
PipetteBuffer::flush();
}
}
cropAllocated = false;
}
@ -2228,7 +2232,8 @@ bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool inter
if (shbuffer) {
delete [] shbuffer;
}
}
if (shbuf_real) {
delete [] shbuf_real;
}

View File

@ -41,8 +41,8 @@ extern const Settings* settings;
ImProcCoordinator::ImProcCoordinator()
: orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), reserv(nullptr), fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr),
ncie (nullptr), imgsrc (nullptr), lastAwbEqual (0.), lastAwbTempBias (0.0), ipf (&params, true), monitorIntent (RI_RELATIVE),
softProof (false), gamutCheck (false), sharpMask(false), scale (10), highDetailPreprocessComputed (false), highDetailRawComputed (false),
ncie(nullptr), imgsrc(nullptr), lastAwbEqual(0.), lastAwbTempBias(0.0), ipf(&params, true), monitorIntent(RI_RELATIVE),
softProof(false), gamutCheck(false), sharpMask(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false),
allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), coordX(0), coordY(0), localX(0), localY(0),
ctColorCurve(),
hltonecurve(65536),
@ -280,6 +280,7 @@ DetailedCrop* ImProcCoordinator::createCrop(::EditDataProvider *editDataProvider
// cropCall: calling crop, used to prevent self-updates ...doesn't seem to be used
void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
{
printf("updatePreviewImage\n");
MyMutex::MyLock processingLock(mProcessing);
int numofphases = 14;
@ -358,7 +359,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
// If high detail (=100%) is newly selected, do a demosaic update, since the last was just with FAST
if (imageTypeListener) {
imageTypeListener->imageTypeChanged (imgsrc->isRAW(), imgsrc->getSensorType() == ST_BAYER, imgsrc->getSensorType() == ST_FUJI_XTRANS, imgsrc->isMono());
imageTypeListener->imageTypeChanged(imgsrc->isRAW(), imgsrc->getSensorType() == ST_BAYER, imgsrc->getSensorType() == ST_FUJI_XTRANS, imgsrc->isMono());
}
if ((todo & M_RAW)
@ -696,7 +697,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
DCPProfile::ApplyState as;
DCPProfile *dcpProf = imgsrc->getDCP(params.icm, as);
ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params.toneCurve.saturation,
ipf.rgbProc(oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params.toneCurve.saturation,
rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, dcpProf, as, histToneCurve);
if (params.blackwhite.enabled && params.blackwhite.autoc && abwListener) {
@ -774,7 +775,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
int maxspot = settings->nspot + 1;
progress("Applying Color Boost...", 100 * readyphase / numofphases);
// TODO Locallab
if (params.locallab.enabled) {
/*
* This file is part of RawTherapee.
@ -796,7 +797,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
* 2017 2018 Jacques Desmis <jdesmis@gmail.com>
*/
/*
//*********************************************************
//advertissment
//we can probably put all these function outside main process
@ -807,43 +808,55 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
//there are probably errors...
//***********************************************************
bool isascii = true;
// Get image file MD5
std::string mdfive = getMD5(imgsrc->getFileName());
// Check if new image file has been loaded
bool newimage = false;
Glib::ustring datainterm = imgsrc->getFileName() + ".ii";//extansion ii arbitrary to test if mip file is possible
ofstream finterm(datainterm, ios::out);
if (finterm.fail()) {
printf("Non ascii Mip file possible..switch to Profiles\n");
isascii = false;
} else {
printf("ascii Mip file possible!\n");
if (prevmdfive == "" || prevmdfive != mdfive) {
printf("New image loaded\n");
newimage = true;
prevmdfive = mdfive;
}
finterm.close();
// Check if destination folder is writable and get .mip file path
if (newimage) { // To avoid systematic access to hard disk
bool isascii = true;
Glib::ustring datainterm = imgsrc->getFileName() + ".ii";//extansion ii arbitrary to test if mip file is possible
if (isascii == true) {
if (std::remove(datainterm.c_str()) != 0) {
perror("Error deleting test ii file");
ofstream finterm(datainterm, ios::out);
if (finterm.fail()) {
printf("Non ascii Mip file possible..switch to Profiles\n");
isascii = false;
} else {
puts("Test ii file successfully deleted");
printf("ascii Mip file possible!\n");
}
finterm.close();
if (isascii == true) {
if (std::remove(datainterm.c_str()) != 0) {
perror("Error deleting test ii file");
} else {
puts("Test ii file successfully deleted");
}
}
Glib::ustring pop = options.cacheBaseDir + "/mip/";
if (options.mip == MI_opt || !isascii) {
datal = pop + Glib::path_get_basename(imgsrc->getFileName() + "." + mdfive + ".mip");
}
if (options.mip == MI_prev && isascii) {//&& isascii
datal = imgsrc->getFileName() + ".mip";
}
}
Glib::ustring pop = options.cacheBaseDir + "/mip/";
Glib::ustring datal;
if (options.mip == MI_opt || !isascii) {
datal = pop + Glib::path_get_basename(imgsrc->getFileName() + "." + mdfive + ".mip");
}
if (options.mip == MI_prev && isascii) {//&& isascii
datal = imgsrc->getFileName() + ".mip";
}
printf("mip files in=%s\n", datal.c_str());
*/
/*
//test to see if wofstream and wifstream works with NON ASCII, but it's bad
wofstream test(datal, ios::out);
@ -851,9 +864,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
else ("ca va bien\n");
test.close();
*/
/*
ifstream fic0(datal, ios::in);
printf("mip files in=%s\n", datal.c_str());
// if(! fic0.fail()) {
float **shbuffer = nullptr;
versionmip = 0;
@ -1223,7 +1236,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
skinstr = new std::string[maxspot];
pthstr = new std::string[maxspot];
exstr = new std::string[maxspot];
*/
/*
//******************************************************************
//initialize data[xx][0] and Lut cache with params
//******************************************************************
@ -1765,8 +1779,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
maxind = 69;
}
// I have forgotten 10010 ==> probably crash...but now it's passed...
//enabled this code after...
// I have forgotten 10010 ==> probably crash...but now it's passed...
//enabled this code after...
if (versionmip == 10011) {
maxind = 70;
}
@ -3277,7 +3291,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
psthresholds[sp * 500] = s_datcps[0];
psthresholds[sp * 500 + 1] = s_datcps[1];
// printf("B 0=%i 1=%i\n", s_datcps[0], s_datcps[1]);
// printf("B 0=%i 1=%i\n", s_datcps[0], s_datcps[1]);
std::string ps_str2 = "";
ps_str2 = ps_str2 + std::to_string(s_datcps[0]) + delim[0] + std::to_string(s_datcps[1]) + delim[1];
@ -3655,25 +3669,25 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
delete [] pthstr;
delete [] exstr;
}
}
//*************************************************************
// end locallab
//*************************************************************
//*************************************************************
// end locallab
//*************************************************************
histCCurve.clear();
histLCurve.clear();
ipf.chromiLuminanceCurve(nullptr, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve);
ipf.vibrance(nprevl);
histCCurve.clear();
histLCurve.clear();
ipf.chromiLuminanceCurve(nullptr, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve);
ipf.vibrance(nprevl);
if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) {
if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) {
ipf.EPDToneMap(nprevl, 5, scale);
}
}
// for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled
readyphase++;
// for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled
readyphase++;
/* Issue 2785, disabled some 1:1 tools
/* Issue 2785, disabled some 1:1 tools
if (scale==1) {
if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)){
progress ("Denoising luminance impulse...",100*readyphase/numofphases);
@ -3711,8 +3725,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
delete [] buffer;
readyphase++;
}
}
*/
*/
}
if (params.dirpyrequalizer.cbdlMethod == "aft") {
if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled))) {
progress("Pyramid wavelet...", 100 * readyphase / numofphases);
@ -4205,7 +4220,7 @@ void ImProcCoordinator::getSoftProofing(bool & softProof, bool & gamutCheck)
gamutCheck = this->gamutCheck;
}
void ImProcCoordinator::setSharpMask (bool sharpMask)
void ImProcCoordinator::setSharpMask(bool sharpMask)
{
this->sharpMask = sharpMask;
}

View File

@ -242,6 +242,8 @@ protected:
bool HHutili;
bool curveutili;
std::string prevmdfive;
Glib::ustring datal;
int **dataspot;
int maxdata;
std::string *retistr;
@ -252,6 +254,7 @@ protected:
std::string *skinstr;
std::string *pthstr;
std::string *exstr;
std::string *name;
LUTi circrads;
LUTi centerx;
@ -467,7 +470,7 @@ public:
void getMonitorProfile(Glib::ustring& profile, RenderingIntent& intent) const;
void setSoftProofing(bool softProof, bool gamutCheck);
void getSoftProofing(bool &softProof, bool &gamutCheck);
void setSharpMask (bool sharpMask);
void setSharpMask(bool sharpMask);
bool updateTryLock()
{
return updaterThreadStart.trylock();

View File

@ -47,7 +47,8 @@
#undef CLIPD
#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f)
namespace {
namespace
{
using namespace rtengine;
@ -183,7 +184,7 @@ void proPhotoBlue(float *rtemp, float *gtemp, float *btemp, int istart, int tH,
float g = gtemp[ti * tileSize + tj + k];
float b = btemp[ti * tileSize + tj + k];
if ((r == 0.0f || g == 0.0f) && rtengine::min(r, g, b) >= 0.f) {
float h, s, v;
Color::rgb2hsv(r, g, b, h, s, v);
@ -215,19 +216,22 @@ void customToneCurve(const ToneCurve &customToneCurve, ToneCurveParams::TcMode c
{
if (curveMode == ToneCurveParams::TcMode::STD) { // Standard
const StandardToneCurve& userToneCurve = static_cast<const StandardToneCurve&> (customToneCurve);
const StandardToneCurve& userToneCurve = static_cast<const StandardToneCurve&>(customToneCurve);
for (int i = istart, ti = 0; i < tH; i++, ti++) {
userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], &gtemp[ti * tileSize], &btemp[ti * tileSize]);
}
} else if (curveMode == ToneCurveParams::TcMode::FILMLIKE) { // Adobe like
const AdobeToneCurve& userToneCurve = static_cast<const AdobeToneCurve&> (customToneCurve);
const AdobeToneCurve& userToneCurve = static_cast<const AdobeToneCurve&>(customToneCurve);
for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
userToneCurve.Apply(rtemp[ti * tileSize + tj], gtemp[ti * tileSize + tj], btemp[ti * tileSize + tj]);
}
}
} else if (curveMode == ToneCurveParams::TcMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels
const SatAndValueBlendingToneCurve& userToneCurve = static_cast<const SatAndValueBlendingToneCurve&> (customToneCurve);
const SatAndValueBlendingToneCurve& userToneCurve = static_cast<const SatAndValueBlendingToneCurve&>(customToneCurve);
for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
userToneCurve.Apply(rtemp[ti * tileSize + tj], gtemp[ti * tileSize + tj], btemp[ti * tileSize + tj]);
@ -235,6 +239,7 @@ void customToneCurve(const ToneCurve &customToneCurve, ToneCurveParams::TcMode c
}
} else if (curveMode == ToneCurveParams::TcMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted
const WeightedStdToneCurve& userToneCurve = static_cast<const WeightedStdToneCurve&>(customToneCurve);
for (int i = istart, ti = 0; i < tH; i++, ti++) {
userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], &gtemp[ti * tileSize], &btemp[ti * tileSize]);
}
@ -248,6 +253,7 @@ void customToneCurve(const ToneCurve &customToneCurve, ToneCurveParams::TcMode c
}
} else if (curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { // apply curve while keeping color appearance constant
const PerceptualToneCurve& userToneCurve = static_cast<const PerceptualToneCurve&>(customToneCurve);
for (int i = istart, ti = 0; i < tH; i++, ti++) {
userToneCurve.BatchApply(0, tW - jstart, &rtemp[ti * tileSize], &gtemp[ti * tileSize], &btemp[ti * tileSize], ptcApplyState);
}
@ -295,6 +301,7 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R
if (monitorTransform) {
cmsDeleteTransform(monitorTransform);
}
gamutWarning.reset(nullptr);
monitorTransform = nullptr;
@ -323,20 +330,24 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R
if (softProof) {
cmsHPROFILE oprof = nullptr;
RenderingIntent outIntent;
flags = cmsFLAGS_SOFTPROOFING | cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE;
if (!settings->printerProfile.empty()) {
oprof = ICCStore::getInstance()->getProfile(settings->printerProfile);
if (settings->printerBPC) {
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
}
outIntent = settings->printerIntent;
} else {
oprof = ICCStore::getInstance()->getProfile(params->icm.output);
if (params->icm.outputBPC) {
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
}
outIntent = params->icm.outputIntent;
}
@ -361,9 +372,11 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R
if (gamutCheck) {
gamutprof = oprof;
if (params->icm.outputBPC) {
gamutbpc = cmsFLAGS_BLACKPOINTCOMPENSATION;
}
gamutintent = outIntent;
}
}
@ -379,9 +392,11 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R
// softProofCreated = true;
// }
gamutprof = monitor;
if (settings->monitorBPC) {
gamutbpc = cmsFLAGS_BLACKPOINTCOMPENSATION;
}
gamutintent = monitorIntent;
}
@ -392,7 +407,7 @@ void ImProcFunctions::updateColorProfiles(const Glib::ustring& monitorProfile, R
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
}
monitorTransform = cmsCreateTransform (iprof, TYPE_Lab_FLT, monitor, TYPE_RGB_FLT, monitorIntent, flags);
monitorTransform = cmsCreateTransform(iprof, TYPE_Lab_FLT, monitor, TYPE_RGB_FLT, monitorIntent, flags);
}
if (gamutCheck && gamutprof) {
@ -473,8 +488,8 @@ void ImProcFunctions::firstAnalysis(const Imagefloat* const original, const Proc
void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params,
const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2, const ColorAppearance & customColCurve3,
LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt,
bool showSharpMask)
LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt,
bool showSharpMask)
{
if (params->colorappearance.enabled) {
@ -1495,7 +1510,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
Ciecam02::jch2xyz_ciecam02float(xx, yy, zz,
J, C, h,
xw2, yw2, zw2,
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
float x, y, z;
x = xx * 655.35f;
y = yy * 655.35f;
@ -1661,7 +1676,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
const bool hotbad = params->dirpyrequalizer.skinprotect != 0.0;
lab->deleteLab();
ImProcFunctions::badpixcam (ncie, artifact / scale, 5, 2, chrom, hotbad); //enabled remove artifacts for cbDL
ImProcFunctions::badpixcam(ncie, artifact / scale, 5, 2, chrom, hotbad); //enabled remove artifacts for cbDL
lab->reallocLab();
}
@ -1669,7 +1684,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
if (params->colorappearance.badpixsl > 0 && execsharp) {
int mode = params->colorappearance.badpixsl;
lab->deleteLab();
ImProcFunctions::badpixcam (ncie, 3.0, 10, mode, 0, true);//for bad pixels CIECAM
ImProcFunctions::badpixcam(ncie, 3.0, 10, mode, 0, true); //for bad pixels CIECAM
lab->reallocLab();
}
@ -1688,7 +1703,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
if (params->sharpening.enabled)
if (execsharp) {
float **buffer = lab->L; // We can use the L-buffer from lab as buffer to save some memory
ImProcFunctions::sharpeningcam (ncie, buffer, showSharpMask); // sharpening adapted to CIECAM
ImProcFunctions::sharpeningcam(ncie, buffer, showSharpMask); // sharpening adapted to CIECAM
}
//if(params->dirpyrequalizer.enabled) if(execsharp) {
@ -1828,7 +1843,7 @@ void ImProcFunctions::ciecam_02float(CieImage* ncie, float adap, int pW, int pwb
Ciecam02::jch2xyz_ciecam02float(xx, yy, zz,
ncie->J_p[i][j], ncie_C_p, ncie->h_p[i][j],
xw2, yw2, zw2,
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
c2, nc2, gamu, pow1n, nbbj, ncbj, flj, czj, dj, awj);
float x = (float)xx * 655.35f;
float y = (float)yy * 655.35f;
float z = (float)zz * 655.35f;
@ -2028,15 +2043,15 @@ filmlike_clip(float *r, float *g, float *b)
void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve)
{
rgbProc (working, lab, pipetteBuffer, hltonecurve, shtonecurve, tonecurve, sat, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, asIn, histToneCurve);
rgbProc(working, lab, pipetteBuffer, hltonecurve, shtonecurve, tonecurve, sat, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, asIn, histToneCurve);
}
// Process RGB image and convert to LAB space
void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve)
{
BENCHFUN
@ -2464,6 +2479,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
if (OOG(r) || OOG(g) || OOG(b)) {
filmlike_clip(&r, &g, &b);
}
rtemp[ti * TS + tj] = r;
gtemp[ti * TS + tj] = g;
btemp[ti * TS + tj] = b;
@ -2480,6 +2496,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
if (OOG(max(r, g, b)) && !OOG(min(r, g, b))) {
filmlike_clip(&r, &g, &b);
}
setUnlessOOG(rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], r, g, b);
}
}
@ -2504,7 +2521,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
float tmpr[4] ALIGNED16;
float tmpg[4] ALIGNED16;
float tmpb[4] ALIGNED16;
for (int i = istart, ti = 0; i < tH; i++, ti++) {
int j = jstart, tj = 0;
#ifdef __SSE2__
@ -2514,6 +2531,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
STVF(tmpr[0], tonecurve(LVF(rtemp[ti * TS + tj])));
STVF(tmpg[0], tonecurve(LVF(gtemp[ti * TS + tj])));
STVF(tmpb[0], tonecurve(LVF(btemp[ti * TS + tj])));
for (int k = 0; k < 4; ++k) {
setUnlessOOG(rtemp[ti * TS + tj + k], gtemp[ti * TS + tj + k], btemp[ti * TS + tj + k], tmpr[k], tmpg[k], tmpb[k]);
}
@ -2648,17 +2666,17 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
bool neg = false;
bool more_rgb = false;
//gamut control : Lab values are in gamut
Color::gamutLchonly (HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
Color::gamutLchonly(HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
#else
//gamut control : Lab values are in gamut
Color::gamutLchonly (HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f);
Color::gamutLchonly(HH, sincosval, Lpro, Chpro, r, g, b, wip, highlight, 0.15f, 0.96f);
#endif
//end of gamut control
} else {
float x_, y_, z_;
//calculate RGB with L_2 and old value of a and b
Color::Lab2XYZ(L_2, a_1, b_1, x_, y_, z_) ;
Color::xyz2rgb (x_, y_, z_, r, g, b, wip);
Color::xyz2rgb(x_, y_, z_, r, g, b, wip);
}
setUnlessOOG(rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], r, g, b);
@ -2679,11 +2697,13 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
if (sat != 0 || hCurveEnabled || sCurveEnabled || vCurveEnabled) {
const float satby100 = sat / 100.f;
for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
float h, s, v;
Color::rgb2hsvtc(rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], h, s, v);
h /= 6.f;
if (sat > 0) {
s = std::max(0.f, intp(satby100, 1.f - SQR(SQR(1.f - std::min(s, 1.0f))), s));
} else { /*if (sat < 0)*/
@ -2727,7 +2747,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
valparam *= (1.f - SQR(SQR(1.f - min(s, 1.0f))));
if (valparam > 0.00001f) {
v = (1.f - valparam) * v + valparam * (1.f - SQR (1.f - min (v, 1.0f))); // SQR (SQR to increase action and avoid artifacts
v = (1.f - valparam) * v + valparam * (1.f - SQR(1.f - min(v, 1.0f))); // SQR (SQR to increase action and avoid artifacts
if (v < 0) {
v = 0;
@ -2783,6 +2803,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
const float kbh = bh / (rh + gh + bh);
strProtect = pow_F(strProtect, 0.4f);
constexpr int mode = 0;
for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
toning2col(rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj], iplow, iphigh, krl, kgl, kbl, krh, kgh, kbh, SatLow, SatHigh, balanS, balanH, reducac, mode, preser, strProtect);
@ -2795,6 +2816,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
constexpr float reducac = 0.3f;
constexpr int mode = 0;
strProtect = pow_F(strProtect, 0.4f);
for (int i = istart, ti = 0; i < tH; i++, ti++) {
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
const float r = rtemp[ti * TS + tj];
@ -2881,7 +2903,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
// Luminance = (0.299f*r + 0.587f*g + 0.114f*b)
float s, l;
Color::rgb2slfloat (r, g, b, s, l);
Color::rgb2slfloat(r, g, b, s, l);
float l_ = Color::gammatab_srgb1[l * 65535.f];
@ -2896,9 +2918,9 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
ctColorCurve.getVal(l_, r2, g2, b2); // get the color from the color curve
float h2, s2, l2;
Color::rgb2hslfloat (r2, g2, b2, h2, s2, l2); // transform this new color to hsl
Color::rgb2hslfloat(r2, g2, b2, h2, s2, l2); // transform this new color to hsl
Color::hsl2rgbfloat (h2, s + ((1.f - s) * (1.f - l) * 0.7f), l, r2, g2, b2);
Color::hsl2rgbfloat(h2, s + ((1.f - s) * (1.f - l) * 0.7f), l, r2, g2, b2);
rtemp[ti * TS + tj] = r + (r2 - r) * opacity; // merge the color to the old color, depending on the opacity
gtemp[ti * TS + tj] = g + (g2 - g) * opacity;
@ -3113,9 +3135,9 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
Color::rgbxyz(sourceR, sourceG, sourceB, x, y, z, v_work2xyz);
Color::xyz2rgb(x, y, z, sourceR, sourceG, sourceB, v_xyz2clut);
STVF (clutr[tj], sourceR);
STVF (clutg[tj], sourceG);
STVF (clutb[tj], sourceB);
STVF(clutr[tj], sourceR);
STVF(clutg[tj], sourceG);
STVF(clutb[tj], sourceB);
}
#endif
@ -3127,7 +3149,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
float x, y, z;
Color::rgbxyz(sourceR, sourceG, sourceB, x, y, z, wprof);
Color::xyz2rgb (x, y, z, clutr[tj], clutg[tj], clutb[tj], xyz2clut);
Color::xyz2rgb(x, y, z, clutr[tj], clutg[tj], clutb[tj], xyz2clut);
}
} else {
memcpy(clutr, &rtemp[ti * TS], sizeof(float) * TS);
@ -3174,9 +3196,9 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
#ifdef __SSE2__
for (; j < tW - 3; j += 4, tj += 4) {
vfloat sourceR = LVF (clutr[tj]);
vfloat sourceG = LVF (clutg[tj]);
vfloat sourceB = LVF (clutb[tj]);
vfloat sourceR = LVF(clutr[tj]);
vfloat sourceG = LVF(clutg[tj]);
vfloat sourceB = LVF(clutb[tj]);
vfloat x;
vfloat y;
@ -3184,9 +3206,9 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
Color::rgbxyz(sourceR, sourceG, sourceB, x, y, z, v_clut2xyz);
Color::xyz2rgb(x, y, z, sourceR, sourceG, sourceB, v_xyz2work);
STVF (clutr[tj], sourceR);
STVF (clutg[tj], sourceG);
STVF (clutb[tj], sourceB);
STVF(clutr[tj], sourceR);
STVF(clutg[tj], sourceG);
STVF(clutb[tj], sourceB);
}
#endif
@ -3230,6 +3252,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
for (int i = istart, ti = 0; i < tH; i++, ti++) {
Color::RGB2Lab(&rtemp[ti * TS], &gtemp[ti * TS], &btemp[ti * TS], &(lab->L[i][jstart]), &(lab->a[i][jstart]), &(lab->b[i][jstart]), toxyz, tW - jstart);
}
if (hasColorToningLabGrid) {
colorToningLabGrid(lab, jstart, tW, istart, tH, false);
}
@ -3333,7 +3356,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
for (int j = 0; j < tW; j++) {
//mix channel
tmpImage->r (i, j) = tmpImage->g (i, j) = tmpImage->b (i, j) = /*CLIP*/ ((bwr * tmpImage->r (i, j) + bwg * tmpImage->g (i, j) + bwb * tmpImage->b (i, j)) * kcorec);
tmpImage->r(i, j) = tmpImage->g(i, j) = tmpImage->b(i, j) = /*CLIP*/ ((bwr * tmpImage->r(i, j) + bwg * tmpImage->g(i, j) + bwb * tmpImage->b(i, j)) * kcorec);
#ifndef __SSE2__
@ -3411,9 +3434,9 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
for (int i = 0; i < tH; i++) {
for (int j = 0; j < tW; j++) {
const float r = tmpImage->r (i, j);
const float g = tmpImage->g (i, j);
const float b = tmpImage->b (i, j);
const float r = tmpImage->r(i, j);
const float g = tmpImage->g(i, j);
const float b = tmpImage->b(i, j);
const float lumbefore = 0.299f * r + 0.587f * g + 0.114f * b;
@ -3611,6 +3634,7 @@ void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer
for (int i = 0; i < tH; i++) {
Color::RGB2Lab(tmpImage->r(i), tmpImage->g(i), tmpImage->b(i), lab->L[i], lab->a[i], lab->b[i], toxyz, tW);
if (hasColorToningLabGrid) {
colorToningLabGrid(lab, 0, tW, i, i + 1, false);
}
@ -3757,11 +3781,11 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
if (v > v0) {
float aa, bb, cc;
secondeg_end (reducac, v0, aa, bb, cc);
secondeg_end(reducac, v0, aa, bb, cc);
kl = aa * v * v + bb * v + cc; //verified ==> exact
} else {
float aab, bbb;
secondeg_begin (0.7f, v0, aab, bbb);
secondeg_begin(0.7f, v0, aab, bbb);
kl = aab * v * v + bbb * v;
}
} else { //bw coefficient to preserve same results as before for satlimtopacity = 0.5 (default)
@ -3769,6 +3793,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
rlob = strProtect; //0.5
rlm = strProtect * 2.2f; //1.1
rlh = strProtect * 2.4f; //1.2
if (v > 0.15f) {
kl = (-1.f / 0.85f) * v + 1.f / 0.85f; //Low light ==> decrease action after v=0.15
}
@ -3776,6 +3801,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
{
const float corr = 20000.f * RedLow * kl * rlo;
if (RedLow > 0.f) {
g -= corr;
b -= corr;
@ -3790,6 +3816,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
{
const float corr = 20000.f * GreenLow * kl * rlo;
if (GreenLow > 0.f) {
r -= corr;
b -= corr;
@ -3846,6 +3873,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
g -= 20000.f * RedM;
b -= 20000.f * RedM;
}
// r = CLIP(r);
// g = CLIP(g);
// b = CLIP(b);
@ -3863,6 +3891,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
g += 10000.f * GreenM;
b -= 20000.f * GreenM;
}
// r = CLIP(r);
// g = CLIP(g);
// b = CLIP(b);
@ -3880,6 +3909,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
g -= 20000.f * BlueM;
b += 10000.f * BlueM;
}
// r = CLIP(r);
// g = CLIP(g);
// b = CLIP(b);
@ -3891,6 +3921,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
secondeg_begin(reducac, v00, aa0, bb0);
float kh;
if (v > v00) { //max action
kh = (1.f - v) / (1.f - v00); //High tones
} else {
@ -3959,7 +3990,7 @@ void ImProcFunctions::toningsmh(float r, float g, float b, float &ro, float &go,
* @param balanH [0..1] balance for highlights (same slider than for balanS)
* @param reducac value of the reduction in the middle of the range for second degree, increase or decrease action
**/
void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float krl, float kgl, float kbl, float krh, float kgh, float kbh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect)
void ImProcFunctions::toning2col(float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float krl, float kgl, float kbl, float krh, float kgh, float kbh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect)
{
const float lumbefore = 0.299f * r + 0.587f * g + 0.114f * b;
const float v = max(r, g, b) / 65535.f;
@ -3978,15 +4009,18 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
if (SatLow > 0.f) {
float kl = 1.f;
if (v > iplow) {
kl = aa * v * v + bb * v + cc;
} else if (mode == 0) {
kl = aab * v * v + bbb * v;
}
const float kmgb = min(r, g, b);
if (kmgb < 20000.f) {
//I have tested ...0.85 compromise...
kl *= pow_F ((kmgb / 20000.f), 0.85f);
kl *= pow_F((kmgb / 20000.f), 0.85f);
}
const float factor = 20000.f * SatLow * kl * rlo * balanS;
@ -4023,6 +4057,7 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
if (SatHigh > 0.f) {
float kh = 1.f;
if (v > iphigh) {
kh = (1.f - v) / (1.f - iphigh); //Low light ==> decrease action after iplow
} else {
@ -4030,11 +4065,13 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
}
const float kmgb = max(r, g, b);
if (kmgb > 45535.f) {
constexpr float cora = 1.f / (45535.f - 65535.f);
constexpr float corb = 1.f - cora * 45535.f;
kh *= kmgb * cora + corb;
}
const float factor = 20000.f * SatHigh * kh * rlh * balanH;
r += factor * (krh > 0.f ? krh : 0.f);
g += factor * (kgh > 0.f ? kgh : 0.f);
@ -4046,6 +4083,7 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
}
float preserv = 1.f;
if (preser == 1) {
float lumafter = 0.299f * r + 0.587f * g + 0.114f * b;
preserv = lumbefore / lumafter;
@ -4071,10 +4109,10 @@ void ImProcFunctions::labtoning(float r, float g, float b, float &ro, float &go,
ro = CLIP(r);
go = CLIP(g);
bo = CLIP(b);
float realL;
float h, s, l;
Color::rgb2hsl (ro, go, bo, h, s, l);
Color::rgb2hsl(ro, go, bo, h, s, l);
float x2, y2, z2;
float xl, yl, zl;
@ -4145,7 +4183,7 @@ void ImProcFunctions::luminanceCurve(LabImage* lold, LabImage* lnew, LUTf & curv
void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve, LUTf & lhskcurve, LUTf & clcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLCurve)
void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve, LUTf & lhskcurve, LUTf & clcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLCurve)
{
if (!params->labCurve.enabled) {
if (params->blackwhite.enabled && !params->colorToning.enabled) {
@ -4155,6 +4193,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
}
}
}
return;
}
@ -4539,7 +4578,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
float aprov1 = Chprov2 * sincosval.y;
float bprov1 = Chprov2 * sincosval.x;
float fy = (Color::c1By116 * Lprov1 ) + Color::c16By116;
float fy = (Color::c1By116 * Lprov1) + Color::c16By116;
float fx = (0.002f * aprov1) + fy;
float fz = fy - (0.005f * bprov1);
@ -5038,44 +5077,44 @@ void ImProcFunctions::defringe(LabImage* lab)
if (params->defringe.enabled && lab->W >= 8 && lab->H >= 8)
{
PF_correct_RT (lab, params->defringe.radius, params->defringe.threshold);
PF_correct_RT(lab, params->defringe.radius, params->defringe.threshold);
}
}
void ImProcFunctions::defringecam(CieImage* ncie)
{
if (params->defringe.enabled && ncie->W >= 8 && ncie->H >= 8) {
PF_correct_RTcam (ncie, params->defringe.radius, params->defringe.threshold);
PF_correct_RTcam(ncie, params->defringe.radius, params->defringe.threshold);
}
}
void ImProcFunctions::badpixcam (CieImage* ncie, double rad, int thr, int mode, float chrom, bool hotbad)
void ImProcFunctions::badpixcam(CieImage* ncie, double rad, int thr, int mode, float chrom, bool hotbad)
{
if (ncie->W >= 8 && ncie->H >= 8) {
Badpixelscam (ncie, rad, thr, mode, chrom, hotbad);
Badpixelscam(ncie, rad, thr, mode, chrom, hotbad);
}
}
void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, float chrom)
void ImProcFunctions::badpixlab(LabImage* lab, double rad, int thr, float chrom)
{
if (lab->W >= 8 && lab->H >= 8) {
BadpixelsLab (lab, rad, thr, chrom);
BadpixelsLab(lab, rad, thr, chrom);
}
}
void ImProcFunctions::dirpyrequalizer(LabImage* lab, int scale)
{
if (params->dirpyrequalizer.enabled && lab->W >= 8 && lab->H >= 8) {
float b_l = static_cast<float> (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.f;
float t_l = static_cast<float> (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.f;
float t_r = static_cast<float> (params->dirpyrequalizer.hueskin.getTopRight()) / 100.f;
float b_l = static_cast<float>(params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.f;
float t_l = static_cast<float>(params->dirpyrequalizer.hueskin.getTopLeft()) / 100.f;
float t_r = static_cast<float>(params->dirpyrequalizer.hueskin.getTopRight()) / 100.f;
// if (params->dirpyrequalizer.algo=="FI") choice=0;
// else if(params->dirpyrequalizer.algo=="LA") choice=1;
if (params->dirpyrequalizer.gamutlab && params->dirpyrequalizer.skinprotect != 0) {
constexpr float artifact = 4.f;
constexpr float chrom = 50.f;
ImProcFunctions::badpixlab (lab, artifact / scale, 5, chrom); //for artifacts
ImProcFunctions::badpixlab(lab, artifact / scale, 5, chrom); //for artifacts
}
//dirpyrLab_equalizer(lab, lab, params->dirpyrequalizer.mult);
@ -5187,12 +5226,19 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid
void ImProcFunctions::EPDToneMaplocal(LabImage *lab, LabImage *tmp1, unsigned int Iterates, int skip)
{
// TODO Locallab
/*
float stren = ((float)params->locallab.stren) / 100.f;
float edgest = ((float)params->locallab.estop) / 100.f;
float sca = ((float)params->locallab.scaltm) / 10.f;
float gamm = ((float)params->locallab.gamma) / 100.f;
float rew = ((float)params->locallab.rewei);
*/
float stren = 0.f;
float edgest = 0.f;
float sca = 0.f;
float gamm = 0.f;
float rew = 0.f;
//Pointers to whole data and size of it.
float *L = lab->L[0];
float *a = lab->a[0];
@ -5798,7 +5844,7 @@ void ImProcFunctions::rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::
}
}
void ImProcFunctions::lab2rgb (const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace)
void ImProcFunctions::lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace)
{
TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(workingSpace);
const float wip[3][3] = {
@ -5879,6 +5925,7 @@ void ImProcFunctions::colorToningLabGrid(LabImage *lab, int xstart, int xend, in
#ifdef _OPENMP
#pragma omp parallel for if (multiThread)
#endif
for (int y = ystart; y < yend; ++y) {
for (int x = xstart; x < xend; ++x) {
lab->a[y][x] += lab->L[y][x] * a_scale + a_base;

File diff suppressed because it is too large Load Diff

View File

@ -804,6 +804,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
{
// TODO Locallab
/*
BENCHFUN
bool py = true;
@ -872,9 +874,9 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
const double shradius = mapmet == 4 ? 40 : 40.;
constexpr int it = 1;//in case of !!
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp parallel for
#endif
#endif
for (int i = 0; i < H_L; i++)
for (int j = 0; j < W_L; j++) {
@ -901,9 +903,9 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
float *buffer = new float[W_L * H_L];
for (int scale = scal - 1; scale >= 0; scale--) {
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp parallel
#endif
#endif
{
if (scale == scal - 1)
@ -914,9 +916,9 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
// out was modified in last iteration => restore it
if (((mapmet == 4)) && it == 1) {
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp for
#endif
#endif
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
@ -931,9 +933,9 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
if ((mapmet == 4) && it == 1 && scale > 0)
{
// out will be modified => store it for use in next iteration. We even don't need a new buffer because 'buffer' is free after gaussianBlur :)
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp for
#endif
#endif
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
@ -956,9 +958,9 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
if ((mapmet == 4) && it == 1) {
#ifdef _OPENMP
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
#endif
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
@ -974,20 +976,20 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
}
#ifdef __SSE2__
#ifdef __SSE2__
vfloat pondv = F2V(pond);
vfloat limMinv = F2V(ilimD);
vfloat limMaxv = F2V(limD);
#endif
#ifdef _OPENMP
#endif
#ifdef _OPENMP
#pragma omp parallel for
#endif
#endif
for (int i = 0; i < H_L; i++) {
int j = 0;
#ifdef __SSE2__
#ifdef __SSE2__
if (useHslLin) { //keep in case of ??
for (; j < W_L - 3; j += 4) {
@ -999,7 +1001,7 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
}
}
#endif
#endif
if (useHslLin) {
for (; j < W_L; j++) {
@ -1067,173 +1069,173 @@ void ImProcFunctions::MSRLocal(float** luminance, float** templ, const float* co
// luminance[i][j] *= (-1.f + 4.f * wavRETCcurve[absciss]); //new transmission
}
*/
// median filter on transmission ==> reduce artifacts
bool ty = false;
*//*
// median filter on transmission ==> reduce artifacts
bool ty = false;
if (ty) {//not used here to simplify interface
int wid = W_L;
int hei = H_L;
float *tmL[hei] ALIGNED16;
float *tmLBuffer = new float[wid * hei];
int borderL = 1;
for (int i = 0; i < hei; i++) {
tmL[i] = &tmLBuffer[i * wid];
}
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = borderL; i < hei - borderL; i++) {
// float pp[9], temp;
for (int j = borderL; j < wid - borderL; j++) {
tmL[i][j] = median(luminance[i][j], luminance[i - 1][j], luminance[i + 1][j], luminance[i][j + 1], luminance[i][j - 1], luminance[i - 1][j - 1], luminance[i - 1][j + 1], luminance[i + 1][j - 1], luminance[i + 1][j + 1]); //3x3
}
}
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = borderL; i < hei - borderL; i++) {
for (int j = borderL; j < wid - borderL; j++) {
luminance[i][j] = tmL[i][j];
}
}
delete [] tmLBuffer;
if (ty) {//not used here to simplify interface
int wid = W_L;
int hei = H_L;
float *tmL[hei] ALIGNED16;
float *tmLBuffer = new float[wid * hei];
int borderL = 1;
for (int i = 0; i < hei; i++) {
tmL[i] = &tmLBuffer[i * wid];
}
// I call mean_stddv2 instead of mean_stddv ==> logBetaGain
// mean_stddv( luminance, mean, stddv, W_L, H_L, 1.f, maxtr, mintr);
mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr);
}
float epsil = 0.1f;
mini = mean - vart * stddv;
if (mini < mintr) {
mini = mintr + epsil;
}
maxi = mean + vart * stddv;
if (maxi > maxtr) {
maxi = maxtr - epsil;
}
delta = maxi - mini;
//printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
if (!delta) {
delta = 1.0f;
}
float cdfactor = 32768.f / delta;
maxCD = -9999999.f;
minCD = 9999999.f;
//prepare work for curve gain
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel for
#endif
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
luminance[i][j] = luminance[i][j] - mini;
for (int i = borderL; i < hei - borderL; i++) {
// float pp[9], temp;
for (int j = borderL; j < wid - borderL; j++) {
tmL[i][j] = median(luminance[i][j], luminance[i - 1][j], luminance[i + 1][j], luminance[i][j + 1], luminance[i][j - 1], luminance[i - 1][j - 1], luminance[i - 1][j + 1], luminance[i + 1][j - 1], luminance[i + 1][j + 1]); //3x3
}
}
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = borderL; i < hei - borderL; i++) {
for (int j = borderL; j < wid - borderL; j++) {
luminance[i][j] = tmL[i][j];
}
}
delete [] tmLBuffer;
}
mean = 0.f;
stddv = 0.f;
// I call mean_stddv2 instead of mean_stddv ==> logBetaGain
// mean_stddv( luminance, mean, stddv, W_L, H_L, 1.f, maxtr, mintr);
mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr);
float asig = 0.f, bsig = 0.f, amax = 0.f, bmax = 0.f, amin = 0.f, bmin = 0.f;
// bool gaincurve = false; //wavRETgainCcurve
const bool hasWavRetGainCurve = locRETgainCcurve && mean != 0.f && stddv != 0.f;
if (hasWavRetGainCurve) { //if curve
asig = 0.166666f / stddv;
bsig = 0.5f - asig * mean;
amax = 0.333333f / (maxtr - mean - stddv);
bmax = 1.f - amax * maxtr;
amin = 0.333333f / (mean - stddv - mintr);
bmin = -amin * mintr;
asig *= 500.f;
bsig *= 500.f;
amax *= 500.f;
bmax *= 500.f;
amin *= 500.f;
bmin *= 500.f;
cdfactor *= 2.f;
}
const float maxclip = (chrome == 0 ? 32768.f : 50000.f);
float str = strength * (chrome == 0 ? 1.f : chrT);
#ifdef _OPENMP
#pragma omp parallel
#endif
{
// float absciss;
float cdmax = -999999.f, cdmin = 999999.f;
float gan = 0.5f;
#ifdef _OPENMP
#pragma omp for schedule(dynamic,16)
#endif
for (int i = 0; i < H_L; i ++)
for (int j = 0; j < W_L; j++) {
if (hasWavRetGainCurve) {
float absciss;
if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) {
absciss = asig * luminance[i][j] + bsig;
} else if (luminance[i][j] >= mean) {
absciss = amax * luminance[i][j] + bmax;
} else {
absciss = amin * luminance[i][j] + bmin;
}
gan = locRETgainCcurve[absciss]; //new gain function transmission
}
float cd = gan * cdfactor * luminance[i][j] + offse;
cdmax = cd > cdmax ? cd : cdmax;
cdmin = cd < cdmin ? cd : cdmin;
luminance[i][j] = LIM(cd, 0.f, maxclip) * str + (1.f - str) * originalLuminance[i][j];
// templ[i][j] = LIM( cd, 0.f, maxclip ) * str + (1.f - str) * originalLuminance[i][j];
// luminance[i][j] = LIM( cd, 0.f, maxclip );
}
#ifdef _OPENMP
#pragma omp critical
#endif
{
maxCD = maxCD > cdmax ? maxCD : cdmax;
minCD = minCD < cdmin ? minCD : cdmin;
}
}
Tmean = mean;
Tsigma = stddv;
Tmin = mintr;
Tmax = maxtr;
}
float epsil = 0.1f;
mini = mean - vart * stddv;
if (mini < mintr) {
mini = mintr + epsil;
}
maxi = mean + vart * stddv;
if (maxi > maxtr) {
maxi = maxtr - epsil;
}
delta = maxi - mini;
//printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
if (!delta) {
delta = 1.0f;
}
float cdfactor = 32768.f / delta;
maxCD = -9999999.f;
minCD = 9999999.f;
//prepare work for curve gain
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = 0; i < H_L; i++) {
for (int j = 0; j < W_L; j++) {
luminance[i][j] = luminance[i][j] - mini;
}
}
mean = 0.f;
stddv = 0.f;
// I call mean_stddv2 instead of mean_stddv ==> logBetaGain
mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr);
float asig = 0.f, bsig = 0.f, amax = 0.f, bmax = 0.f, amin = 0.f, bmin = 0.f;
// bool gaincurve = false; //wavRETgainCcurve
const bool hasWavRetGainCurve = locRETgainCcurve && mean != 0.f && stddv != 0.f;
if (hasWavRetGainCurve) { //if curve
asig = 0.166666f / stddv;
bsig = 0.5f - asig * mean;
amax = 0.333333f / (maxtr - mean - stddv);
bmax = 1.f - amax * maxtr;
amin = 0.333333f / (mean - stddv - mintr);
bmin = -amin * mintr;
asig *= 500.f;
bsig *= 500.f;
amax *= 500.f;
bmax *= 500.f;
amin *= 500.f;
bmin *= 500.f;
cdfactor *= 2.f;
}
const float maxclip = (chrome == 0 ? 32768.f : 50000.f);
float str = strength * (chrome == 0 ? 1.f : chrT);
#ifdef _OPENMP
#pragma omp parallel
#endif
{
// float absciss;
float cdmax = -999999.f, cdmin = 999999.f;
float gan = 0.5f;
#ifdef _OPENMP
#pragma omp for schedule(dynamic,16)
#endif
for (int i = 0; i < H_L; i ++)
for (int j = 0; j < W_L; j++) {
if (hasWavRetGainCurve) {
float absciss;
if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) {
absciss = asig * luminance[i][j] + bsig;
} else if (luminance[i][j] >= mean) {
absciss = amax * luminance[i][j] + bmax;
} else {
absciss = amin * luminance[i][j] + bmin;
}
gan = locRETgainCcurve[absciss]; //new gain function transmission
}
float cd = gan * cdfactor * luminance[i][j] + offse;
cdmax = cd > cdmax ? cd : cdmax;
cdmin = cd < cdmin ? cd : cdmin;
luminance[i][j] = LIM(cd, 0.f, maxclip) * str + (1.f - str) * originalLuminance[i][j];
// templ[i][j] = LIM( cd, 0.f, maxclip ) * str + (1.f - str) * originalLuminance[i][j];
// luminance[i][j] = LIM( cd, 0.f, maxclip );
}
#ifdef _OPENMP
#pragma omp critical
#endif
{
maxCD = maxCD > cdmax ? maxCD : cdmax;
minCD = minCD < cdmin ? minCD : cdmin;
}
}
Tmean = mean;
Tsigma = stddv;
Tmin = mintr;
Tmax = maxtr;
}
}
*/
}
}

View File

@ -521,6 +521,24 @@ enum ProcEventCode {
EvRGBEnabled = 491,
EvLEnabled = 492,
// EvPixelShiftOneGreen = 493, can be reused
EvLocallabSpotCreated = 494,
EvLocallabSpotDeleted = 495,
EvLocallabSpotSelected = 496,
EvLocallabSpotName = 497,
EvLocallabSpotVisibility = 498,
EvLocallabSpotShape = 499,
EvLocallabSpotSpotMethod = 500,
EvLocallabSpotShapeMethod = 501,
EvLocallabSpotLocX = 502,
EvLocallabSpotLocXL = 503,
EvLocallabSpotLocY = 504,
EvLocallabSpotLocYT = 505,
EvLocallabSpotCenter = 506,
EvLocallabSpotCircrad = 507,
EvLocallabSpotQualityMethod = 508,
EvLocallabSpotTransit = 509,
EvLocallabSpotThresh = 510,
EvLocallabSpotIter = 511,
NUMOFEVENTS

View File

@ -330,9 +330,9 @@ curveMode(ToneCurveParams::TcMode::STD),
saturation(0),
shcompr(50),
hlcompr(0),
hlcomprthresh(33),
histmatching(false),
clampOOG(true)
hlcomprthresh(33),
histmatching(false),
clampOOG(true)
{
}
@ -645,11 +645,11 @@ colorCurve{
0.25
},
satProtectionThreshold(30),
saturatedOpacity(80),
strength(50),
balance(0),
hlColSat(60, 80, false),
shadowsColSat(80, 208, false),
saturatedOpacity(80),
strength(50),
balance(0),
hlColSat(60, 80, false),
shadowsColSat(80, 208, false),
clcurve{
DCT_NURBS,
0.00,
@ -681,11 +681,11 @@ greenhigh(0.0),
bluehigh(0.0),
satlow(0.0),
sathigh(0.0),
lumamode(true),
labgridALow(0.0),
labgridBLow(0.0),
labgridAHigh(0.0),
labgridBHigh(0.0)
lumamode(true),
labgridALow(0.0),
labgridBLow(0.0),
labgridAHigh(0.0),
labgridBHigh(0.0)
{
}
@ -1849,7 +1849,7 @@ autoc(false),
enabledcc(true),
enabled(false),
filter("None"),
setting("RGB-Rel"),
setting("RGB-Rel"),
method("Desaturation"),
mixerRed(33),
mixerOrange(33),
@ -2091,7 +2091,7 @@ enabled(false),
expfinal(false),
exptoning(false),
expnoise(false),
Lmethod(4),
Lmethod(4),
CLmethod("all"),
Backmethod("grey"),
Tilesmethod("full"),
@ -2261,6 +2261,28 @@ void WaveletParams::getCurves(
}
LocallabParams::LocallabParams() :
enabled(false),
nbspot(0),
selspot(0),
// Control spot settings
id(),
name(),
isvisible(),
shape(),
spotMethod(),
shapeMethod(),
locX(),
locXL(),
locY(),
locYT(),
centerX(),
centerY(),
circrad(),
qualityMethod(),
transit(),
thresh(),
iter(),
llcurve{
DCT_NURBS,
0.0,
@ -2368,7 +2390,8 @@ HHcurve{
},
skintonescurve {
DCT_Linear
},
}
/*
enabled(false),
degree(0),
locY(250),
@ -2477,67 +2500,72 @@ expdenoi(false),
threshold(20),
chromacbdl(0),
spotduplicated(false)
*/
{
}
bool LocallabParams::operator ==(const LocallabParams& other) const
{
return
enabled == other.enabled
&& avoid == other.avoid
&& invers == other.invers
&& spotduplicated == other.spotduplicated
&& cutpast == other.cutpast
&& lastdust == other.lastdust
&& curvactiv == other.curvactiv
&& activlum == other.activlum
&& inversrad == other.inversrad
&& inversret == other.inversret
&& inverssha == other.inverssha
&& degree == other.degree
&& Smethod == other.Smethod
&& Exclumethod == other.Exclumethod
&& shapemethod == other.shapemethod
&& retinexMethod == other.retinexMethod
&& blurMethod == other.blurMethod
&& dustMethod == other.dustMethod
&& qualityMethod == other.qualityMethod
&& qualitycurveMethod == other.qualitycurveMethod
&& locY == other.locY
&& nbspot == other.nbspot
&& selspot == other.selspot
// Control spot settings
&& id == other.id
&& name == other.name
&& isvisible == other.isvisible
&& shape == other.shape
&& spotMethod == other.spotMethod
&& shapeMethod == other.shapeMethod
&& locX == other.locX
&& locYT == other.locYT
&& locXL == other.locXL
&& locY == other.locY
&& locYT == other.locYT
&& centerX == other.centerX
&& centerY == other.centerY
&& circrad == other.circrad
&& centerXbuf == other.centerXbuf
&& centerYbuf == other.centerYbuf
&& adjblur == other.adjblur
&& thres == other.thres
&& proxi == other.proxi
&& lightness == other.lightness
&& contrast == other.contrast
&& chroma == other.chroma
&& warm == other.warm
&& expcomp == other.expcomp
&& hlcompr == other.hlcompr
&& hlcomprthresh == other.hlcomprthresh
&& shcompr == other.shcompr
&& black == other.black
&& pastels == other.pastels
&& sensiv == other.sensiv
&& saturated == other.saturated
&& psthreshold == other.psthreshold
&& qualityMethod == other.qualityMethod
&& transit == other.transit
&& thresh == other.thresh
&& iter == other.iter;
/*
&& qualityMethod == other.qualityMethod
&& qualitycurveMethod == other.qualitycurveMethod
&& locY == other.locY
&& locX == other.locX
&& locYT == other.locYT
&& locXL == other.locXL
&& centerX == other.centerX
&& centerY == other.centerY
&& circrad == other.circrad
&& centerXbuf == other.centerXbuf
&& centerYbuf == other.centerYbuf
&& adjblur == other.adjblur
&& thres == other.thres
&& proxi == other.proxi
&& lightness == other.lightness
&& contrast == other.contrast
&& chroma == other.chroma
&& warm == other.warm
&& expcomp == other.expcomp
&& hlcompr == other.hlcompr
&& hlcomprthresh == other.hlcomprthresh
&& shcompr == other.shcompr
&& black == other.black
&& pastels == other.pastels
&& sensiv == other.sensiv
&& saturated == other.saturated
&& psthreshold == other.psthreshold
&& [this, &other]() -> bool {
for (unsigned int i = 0; i < 5; ++i)
{
if (mult[i] != other.mult[i]) {
return false;
}
for (unsigned int i = 0; i < 5; ++i)
{
if (mult[i] != other.mult[i]) {
return false;
}
}
return true;
return true;
}()
&& protectskins == other.protectskins
&& avoidcolorshift == other.avoidcolorshift
@ -2602,7 +2630,11 @@ bool LocallabParams::operator ==(const LocallabParams& other) const
&& llcurve == other.llcurve
&& cccurve == other.cccurve
&& LHcurve == other.LHcurve
&& HHcurve == other.HHcurve;
&& HHcurve == other.HHcurve
&& id == other.id
&& name == other.name
&& isvisible == other.isvisible;
*/
}
@ -3079,6 +3111,9 @@ void ProcParams::setDefaults()
int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bool fnameAbsolute, ParamsEdited* pedited)
{
// TODO Locallab printf
printf("Save to .pp3 file\n");
if (fname.empty() && fname2.empty()) {
return 0;
}
@ -3473,6 +3508,31 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
// Locallab
saveToKeyfile(!pedited || pedited->locallab.enabled, "Locallab", "Enabled", locallab.enabled, keyFile);
saveToKeyfile(!pedited || pedited->locallab.nbspot, "Locallab", "Nbspot", locallab.nbspot, keyFile);
saveToKeyfile(!pedited || pedited->locallab.selspot, "Locallab", "Selspot", locallab.selspot, keyFile);
for (int i = 0; i < locallab.nbspot; i++) {
// Control spot settings
saveToKeyfile(!pedited || pedited->locallab.id, "Locallab", "Id_" + std::to_string(i), locallab.id.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.name, "Locallab", "Name_" + std::to_string(i), locallab.name.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.isvisible, "Locallab", "Isvisible_" + std::to_string(i), locallab.isvisible.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.shape, "Locallab", "Shape_" + std::to_string(i), locallab.shape.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.spotMethod, "Locallab", "SpotMethod_" + std::to_string(i), locallab.spotMethod.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.shapeMethod, "Locallab", "ShapeMethod_" + std::to_string(i), locallab.shapeMethod.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.locX, "Locallab", "LocX_" + std::to_string(i), locallab.locX.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.locXL, "Locallab", "LocXL_" + std::to_string(i), locallab.locXL.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.locY, "Locallab", "LocY_" + std::to_string(i), locallab.locY.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.locYT, "Locallab", "LocYT_" + std::to_string(i), locallab.locYT.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.centerX, "Locallab", "CenterX_" + std::to_string(i), locallab.centerX.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.centerY, "Locallab", "CenterY_" + std::to_string(i), locallab.centerY.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.circrad, "Locallab", "Circrad_" + std::to_string(i), locallab.circrad.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.qualityMethod, "Locallab", "QualityMethod_" + std::to_string(i), locallab.qualityMethod.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.transit, "Locallab", "Transit_" + std::to_string(i), locallab.transit.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.thresh, "Locallab", "Thresh_" + std::to_string(i), locallab.thresh.at(i), keyFile);
saveToKeyfile(!pedited || pedited->locallab.iter, "Locallab", "Iter_" + std::to_string(i), locallab.iter.at(i), keyFile);
}
/*
saveToKeyfile(!pedited || pedited->locallab.expcolor, "Locallab", "Expcolor", locallab.expcolor, keyFile);
saveToKeyfile(!pedited || pedited->locallab.expexpose, "Locallab", "Expexpose", locallab.expexpose, keyFile);
saveToKeyfile(!pedited || pedited->locallab.expvibrance, "Locallab", "Expvibrance", locallab.expvibrance, keyFile);
@ -3590,8 +3650,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->locallab.scaltm, "Locallab", "Scaltm", locallab.scaltm, keyFile);
saveToKeyfile(!pedited || pedited->locallab.rewei, "Locallab", "Rewei", locallab.rewei, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spotduplicated, "Locallab", "Spotduplicated", locallab.spotduplicated, keyFile);
saveToKeyfile(!pedited || pedited->locallab.id, "Locallab", "Id", locallab.id, keyFile);
saveToKeyfile(!pedited || pedited->locallab.name, "Locallab", "Name", locallab.name, keyFile);
saveToKeyfile(!pedited || pedited->locallab.isvisible, "Locallab", "Isvisible", locallab.isvisible, keyFile);
*/
// Post-crop vignette
saveToKeyfile(!pedited || pedited->pcvignette.enabled, "PCVignette", "Enabled", pcvignette.enabled, keyFile);
@ -3998,6 +4060,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Exposure", "Curve", pedited, toneCurve.curve, pedited->toneCurve.curve);
assignFromKeyfile(keyFile, "Exposure", "Curve2", pedited, toneCurve.curve2, pedited->toneCurve.curve2);
}
assignFromKeyfile(keyFile, "Exposure", "HistogramMatching", pedited, toneCurve.histmatching, pedited->toneCurve.histmatching);
assignFromKeyfile(keyFile, "Exposure", "ClampOOG", pedited, toneCurve.clampOOG, pedited->toneCurve.clampOOG);
}
@ -4204,14 +4267,17 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
if (keyFile.has_group("Sharpening")) {
assignFromKeyfile(keyFile, "Sharpening", "Enabled", pedited, sharpening.enabled, pedited->sharpening.enabled);
if (ppVersion >= 334) {
assignFromKeyfile(keyFile, "Sharpening", "Contrast", pedited, sharpening.contrast, pedited->sharpening.contrast);
} else {
sharpening.contrast = 0;
if (pedited) {
pedited->sharpening.contrast = true;
}
}
assignFromKeyfile(keyFile, "Sharpening", "Radius", pedited, sharpening.radius, pedited->sharpening.radius);
assignFromKeyfile(keyFile, "Sharpening", "Amount", pedited, sharpening.amount, pedited->sharpening.amount);
@ -4255,14 +4321,17 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "SharpenMicro", "Enabled", pedited, sharpenMicro.enabled, pedited->sharpenMicro.enabled);
assignFromKeyfile(keyFile, "SharpenMicro", "Matrix", pedited, sharpenMicro.matrix, pedited->sharpenMicro.matrix);
assignFromKeyfile(keyFile, "SharpenMicro", "Strength", pedited, sharpenMicro.amount, pedited->sharpenMicro.amount);
if (ppVersion >= 334) {
assignFromKeyfile(keyFile, "SharpenMicro", "Contrast", pedited, sharpenMicro.contrast, pedited->sharpenMicro.contrast);
} else {
sharpenMicro.contrast = 0;
if (pedited) {
pedited->sharpenMicro.contrast = true;
}
}
assignFromKeyfile(keyFile, "SharpenMicro", "Uniformity", pedited, sharpenMicro.uniformity, pedited->sharpenMicro.uniformity);
}
@ -4443,7 +4512,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "FattalToneMapping", "Anchor", pedited, fattal.anchor, pedited->fattal.anchor);
}
if (keyFile.has_group ("Shadows & Highlights") && ppVersion >= 333) {
if (keyFile.has_group("Shadows & Highlights") && ppVersion >= 333) {
assignFromKeyfile(keyFile, "Shadows & Highlights", "Enabled", pedited, sh.enabled, pedited->sh.enabled);
assignFromKeyfile(keyFile, "Shadows & Highlights", "Highlights", pedited, sh.highlights, pedited->sh.highlights);
assignFromKeyfile(keyFile, "Shadows & Highlights", "HighlightTonalWidth", pedited, sh.htonalwidth, pedited->sh.htonalwidth);
@ -4599,6 +4668,52 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
if (keyFile.has_group("Locallab")) {
assignFromKeyfile(keyFile, "Locallab", "Enabled", pedited, locallab.enabled, pedited->locallab.enabled);
assignFromKeyfile(keyFile, "Locallab", "Nbspot", pedited, locallab.nbspot, pedited->locallab.nbspot);
assignFromKeyfile(keyFile, "Locallab", "Selspot", pedited, locallab.selspot, pedited->locallab.selspot);
// Resize locallab settings if required
if (locallab.nbspot > (int)locallab.id.size()) {
locallab.id.resize(locallab.nbspot);
locallab.name.resize(locallab.nbspot);
locallab.isvisible.resize(locallab.nbspot);
locallab.shape.resize(locallab.nbspot);
locallab.spotMethod.resize(locallab.nbspot);
locallab.shapeMethod.resize(locallab.nbspot);
locallab.locX.resize(locallab.nbspot);
locallab.locXL.resize(locallab.nbspot);
locallab.locY.resize(locallab.nbspot);
locallab.locYT.resize(locallab.nbspot);
locallab.centerX.resize(locallab.nbspot);
locallab.centerY.resize(locallab.nbspot);
locallab.circrad.resize(locallab.nbspot);
locallab.qualityMethod.resize(locallab.nbspot);
locallab.transit.resize(locallab.nbspot);
locallab.thresh.resize(locallab.nbspot);
locallab.iter.resize(locallab.nbspot);
}
for (int i = 0; i < locallab.nbspot; i++) {
// Control spot settings
assignFromKeyfile(keyFile, "Locallab", "Id_" + std::to_string(i), pedited, locallab.id.at(i), pedited->locallab.id);
assignFromKeyfile(keyFile, "Locallab", "Name_" + std::to_string(i), pedited, locallab.name.at(i), pedited->locallab.name);
assignFromKeyfile(keyFile, "Locallab", "Isvisible_" + std::to_string(i), pedited, locallab.isvisible.at(i), pedited->locallab.isvisible);
assignFromKeyfile(keyFile, "Locallab", "Shape_" + std::to_string(i), pedited, locallab.shape.at(i), pedited->locallab.shape);
assignFromKeyfile(keyFile, "Locallab", "SpotMethod_" + std::to_string(i), pedited, locallab.spotMethod.at(i), pedited->locallab.spotMethod);
assignFromKeyfile(keyFile, "Locallab", "ShapeMethod_" + std::to_string(i), pedited, locallab.shapeMethod.at(i), pedited->locallab.shapeMethod);
assignFromKeyfile(keyFile, "Locallab", "LocX_" + std::to_string(i), pedited, locallab.locX.at(i), pedited->locallab.locX);
assignFromKeyfile(keyFile, "Locallab", "LocXL_" + std::to_string(i), pedited, locallab.locXL.at(i), pedited->locallab.locXL);
assignFromKeyfile(keyFile, "Locallab", "LocY_" + std::to_string(i), pedited, locallab.locY.at(i), pedited->locallab.locY);
assignFromKeyfile(keyFile, "Locallab", "LocYT_" + std::to_string(i), pedited, locallab.locYT.at(i), pedited->locallab.locYT);
assignFromKeyfile(keyFile, "Locallab", "CenterX_" + std::to_string(i), pedited, locallab.centerX.at(i), pedited->locallab.centerX);
assignFromKeyfile(keyFile, "Locallab", "CenterY_" + std::to_string(i), pedited, locallab.centerY.at(i), pedited->locallab.centerY);
assignFromKeyfile(keyFile, "Locallab", "Circrad_" + std::to_string(i), pedited, locallab.circrad.at(i), pedited->locallab.circrad);
assignFromKeyfile(keyFile, "Locallab", "QualityMethod_" + std::to_string(i), pedited, locallab.qualityMethod.at(i), pedited->locallab.qualityMethod);
assignFromKeyfile(keyFile, "Locallab", "Transit_" + std::to_string(i), pedited, locallab.transit.at(i), pedited->locallab.transit);
assignFromKeyfile(keyFile, "Locallab", "Thresh_" + std::to_string(i), pedited, locallab.thresh.at(i), pedited->locallab.thresh);
assignFromKeyfile(keyFile, "Locallab", "Iter_" + std::to_string(i), pedited, locallab.iter.at(i), pedited->locallab.iter);
}
/*
assignFromKeyfile(keyFile, "Locallab", "Expcolor", pedited, locallab.expcolor, pedited->locallab.expcolor);
assignFromKeyfile(keyFile, "Locallab", "Expcbdl", pedited, locallab.expcbdl, pedited->locallab.expcbdl);
assignFromKeyfile(keyFile, "Locallab", "Expexpose", pedited, locallab.expexpose, pedited->locallab.expexpose);
@ -4733,7 +4848,10 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "Threshold", pedited, locallab.threshold, pedited->locallab.threshold);
assignFromKeyfile(keyFile, "Locallab", "Chromacbdl", pedited, locallab.chromacbdl, pedited->locallab.chromacbdl);
assignFromKeyfile(keyFile, "Locallab", "Spotduplicated", pedited, locallab.spotduplicated, pedited->locallab.spotduplicated);
assignFromKeyfile(keyFile, "Locallab", "Id", pedited, locallab.id, pedited->locallab.id);
assignFromKeyfile(keyFile, "Locallab", "Name", pedited, locallab.name, pedited->locallab.name);
assignFromKeyfile(keyFile, "Locallab", "Isvisible", pedited, locallab.isvisible, pedited->locallab.isvisible);
*/
}
@ -4862,15 +4980,18 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Wavelet", "Lipst", pedited, wavelet.lipst, pedited->wavelet.lipst);
assignFromKeyfile(keyFile, "Wavelet", "AvoidColorShift", pedited, wavelet.avoid, pedited->wavelet.avoid);
assignFromKeyfile(keyFile, "Wavelet", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr);
if (ppVersion < 331) { // wavelet.Lmethod was a string before version 331
Glib::ustring temp;
assignFromKeyfile(keyFile, "Wavelet", "LevMethod", pedited, temp, pedited->wavelet.Lmethod);
if (!temp.empty()) {
wavelet.Lmethod = std::stoi(temp);
}
} else {
assignFromKeyfile(keyFile, "Wavelet", "LevMethod", pedited, wavelet.Lmethod, pedited->wavelet.Lmethod);
}
assignFromKeyfile(keyFile, "Wavelet", "ChoiceLevMethod", pedited, wavelet.CLmethod, pedited->wavelet.CLmethod);
assignFromKeyfile(keyFile, "Wavelet", "BackMethod", pedited, wavelet.Backmethod, pedited->wavelet.Backmethod);
assignFromKeyfile(keyFile, "Wavelet", "TilesMethod", pedited, wavelet.Tilesmethod, pedited->wavelet.Tilesmethod);
@ -5337,12 +5458,15 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "RAW Bayer", "PreBlack3", pedited, raw.bayersensor.black3, pedited->raw.bayersensor.exBlack3);
assignFromKeyfile(keyFile, "RAW Bayer", "PreTwoGreen", pedited, raw.bayersensor.twogreen, pedited->raw.bayersensor.exTwoGreen);
assignFromKeyfile(keyFile, "RAW Bayer", "LineDenoise", pedited, raw.bayersensor.linenoise, pedited->raw.bayersensor.linenoise);
if (keyFile.has_key("RAW Bayer", "LineDenoiseDirection")) {
raw.bayersensor.linenoiseDirection = RAWParams::BayerSensor::LineNoiseDirection(keyFile.get_integer("RAW Bayer", "LineDenoiseDirection"));
if (pedited) {
pedited->raw.bayersensor.linenoiseDirection = true;
}
}
assignFromKeyfile(keyFile, "RAW Bayer", "GreenEqThreshold", pedited, raw.bayersensor.greenthresh, pedited->raw.bayersensor.greenEq);
assignFromKeyfile(keyFile, "RAW Bayer", "DCBIterations", pedited, raw.bayersensor.dcb_iterations, pedited->raw.bayersensor.dcbIterations);
assignFromKeyfile(keyFile, "RAW Bayer", "DCBEnhance", pedited, raw.bayersensor.dcb_enhance, pedited->raw.bayersensor.dcbEnhance);
@ -5358,9 +5482,11 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
}
assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftEperIso", pedited, raw.bayersensor.pixelShiftEperIso, pedited->raw.bayersensor.pixelShiftEperIso);
if (ppVersion < 332) {
raw.bayersensor.pixelShiftEperIso += 1.0;
}
assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftSigma", pedited, raw.bayersensor.pixelShiftSigma, pedited->raw.bayersensor.pixelShiftSigma);
assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftShowMotion", pedited, raw.bayersensor.pixelShiftShowMotion, pedited->raw.bayersensor.pixelShiftShowMotion);
assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftShowMotionMaskOnly", pedited, raw.bayersensor.pixelShiftShowMotionMaskOnly, pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly);
@ -5375,12 +5501,14 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
if (ppVersion < 336) {
if (keyFile.has_key("RAW Bayer", "pixelShiftLmmse")) {
bool useLmmse = keyFile.get_boolean ("RAW Bayer", "pixelShiftLmmse");
bool useLmmse = keyFile.get_boolean("RAW Bayer", "pixelShiftLmmse");
if (useLmmse) {
raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::LMMSE);
} else {
raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::AMAZE);
}
if (pedited) {
pedited->raw.bayersensor.pixelShiftDemosaicMethod = true;
}

View File

@ -899,6 +899,28 @@ struct GradientParams {
* Parameters of the Local Lab
*/
struct LocallabParams {
bool enabled;
int nbspot;
int selspot;
// Control spot settings
std::vector<int> id;
std::vector<Glib::ustring> name;
std::vector<int> isvisible;
std::vector<Glib::ustring> shape; // ELI, RECT
std::vector<Glib::ustring> spotMethod; // norm, exc
std::vector<Glib::ustring> shapeMethod; // IND, SYM, INDSL, SYMSL
std::vector<int> locX;
std::vector<int> locXL;
std::vector<int> locY;
std::vector<int> locYT;
std::vector<int> centerX;
std::vector<int> centerY;
std::vector<int> circrad;
std::vector<Glib::ustring> qualityMethod; // std, enh, enhden
std::vector<int> transit;
std::vector<int> thresh;
std::vector<int> iter;
std::vector<double> llcurve;
std::vector<double> cccurve;
std::vector<double> excurve;
@ -908,6 +930,7 @@ struct LocallabParams {
std::vector<double> HHcurve;
std::vector<double> skintonescurve;
/*
bool enabled;
double degree;
int locY;
@ -1009,8 +1032,12 @@ struct LocallabParams {
bool expdenoi;
double threshold;
int chromacbdl;
bool spotduplicated;
bool spotduplicated;
int id;
Glib::ustring name;
bool isvisible;
*/
LocallabParams();
bool operator ==(const LocallabParams& other) const;

View File

@ -74,7 +74,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
0, // EvLDNEdgeTolerance: obsolete,
0, // EvCDNEnabled:obsolete,
0, // free entry
RGBCURVE|M_AUTOEXP, // EvDCPToneCurve,
RGBCURVE | M_AUTOEXP, // EvDCPToneCurve,
ALLNORAW, // EvDCPIlluminant,
RETINEX, // EvSHEnabled,
RGBCURVE, // EvSHHighlights,
@ -419,8 +419,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DIRPYREQUALIZER, // EvWavgreenlow
DIRPYREQUALIZER, // EvWavbluelow
DIRPYREQUALIZER, // EvWavNeutral
RGBCURVE|M_AUTOEXP, // EvDCPApplyLookTable,
RGBCURVE|M_AUTOEXP, // EvDCPApplyBaselineExposureOffset,
RGBCURVE | M_AUTOEXP, // EvDCPApplyLookTable,
RGBCURVE | M_AUTOEXP, // EvDCPApplyBaselineExposureOffset,
ALLNORAW, // EvDCPApplyHueSatMap
DIRPYREQUALIZER, // EvWavenacont
DIRPYREQUALIZER, // EvWavenachrom
@ -519,7 +519,25 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
HDR, // EvTMFattalAmount
ALLNORAW, // EvWBEnabled
RGBCURVE, // EvRGBEnabled
LUMINANCECURVE // EvLEnabled
LUMINANCECURVE, // EvLEnabled
LUMINANCECURVE, // EvLocallabSpotCreated
LUMINANCECURVE, // EvLocallabSpotDeleted
M_VOID, // EvLocallabSpotSelected
M_VOID, // EvLocallabSpotName
M_VOID, // EvLocallabSpotVisibility
LUMINANCECURVE, // EvLocallabSpotShape
LUMINANCECURVE, // EvLocallabSpotSpotMethod
LUMINANCECURVE, // EvLocallabSpotShapeMethod
LUMINANCECURVE, // EvLocallabSpotLocX
LUMINANCECURVE, // EvLocallabSpotLocXL
LUMINANCECURVE, // EvLocallabSpotLocY
LUMINANCECURVE, // EvLocallabSpotLocYT
LUMINANCECURVE, // EvLocallabSpotCenter
LUMINANCECURVE, // EvLocallabSpotCircrad
LUMINANCECURVE, // EvLocallabSpotQualityMethod
LUMINANCECURVE, // EvLocallabSpotTransit
LUMINANCECURVE, // EvLocallabSpotThresh
LUMINANCECURVE // EvLocallabSpotIter
};

View File

@ -966,7 +966,7 @@ private:
LUTu histToneCurve;
ipf.rgbProc (baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve);
ipf.rgbProc(baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve);
if (settings->verbose) {
printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob);
@ -1040,6 +1040,8 @@ private:
// bool localcutili = false;
reservView->CopyFrom(labView);
// TODO Locallab
/*
if (params.locallab.enabled) {
MyTime t1, t2;
t1.set();
@ -2208,6 +2210,7 @@ private:
}
}
*/
delete reservView;
reservView = nullptr;
@ -2242,7 +2245,7 @@ private:
}
if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) {
ipf.sharpening (labView, params.sharpening);
ipf.sharpening(labView, params.sharpening);
}
@ -2325,7 +2328,7 @@ private:
float CAMMean = NAN;
float d, dj, yb;
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);
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);
}
delete cieView;
@ -2375,13 +2378,14 @@ private:
}
if (labResize) { // resize lab data
if(labView->W != imw || labView->H != imh) {
if (labView->W != imw || labView->H != imh) {
// resize image
tmplab = new LabImage (imw, imh);
ipf.Lanczos (labView, tmplab, tmpScale);
tmplab = new LabImage(imw, imh);
ipf.Lanczos(labView, tmplab, tmpScale);
delete labView;
labView = tmplab;
}
cw = labView->W;
ch = labView->H;
@ -2391,7 +2395,8 @@ private:
labView->L[i][j] = labView->L[i][j] < 0.f ? 0.f : labView->L[i][j];
}
}
ipf.sharpening (labView, params.prsharpening);
ipf.sharpening(labView, params.prsharpening);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -16,17 +16,82 @@
class ControlSpotPanel:
public ToolParamBlock,
public AdjusterListener,
public EditSubscriber
public EditSubscriber,
public FoldableToolPanel
{
public:
/** A SpotRow structure allows exchanges from and to ControlSpotClass */
struct SpotRow {
int id; // Control spot id
Glib::ustring name;
bool isvisible;
int shape; // 0 = Ellipse, 1 = Rectangle
int spotMethod; // 0 = Normal, 1 = Excluding
int shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders)
int locX;
int locXL;
int locY;
int locYT;
int centerX;
int centerY;
int circrad;
int qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise
int transit;
int thresh;
int iter;
};
/** A SpotEdited structure allows exchanges of spot panel widgets edited states from and to ControlSpotClass */
struct SpotEdited {
bool addbutton;
bool deletebutton;
bool treeview;
bool name;
bool isvisible;
bool shape;
bool spotMethod;
bool shapeMethod;
bool locX;
bool locXL;
bool locY;
bool locYT;
bool centerX;
bool centerY;
bool circrad;
bool qualityMethod;
bool transit;
bool thresh;
bool iter;
};
// Constructor and management functions
ControlSpotPanel();
void setEditProvider(EditDataProvider* provider);
int getEventType();
SpotRow* getSpot(int id);
std::vector<int>* getSpotIdList();
int getSelectedSpot();
void setSelectedSpot(int id);
// Control spot creation functions
int getNewId();
void addControlSpot(SpotRow* newSpot);
// Control spot update function
int updateControlSpot(SpotRow* spot);
// Control spot delete function
void deleteControlSpot(int id);
// Panel widgets edited states management functions
SpotEdited* getEditedStates();
void setEditedStates(SpotEdited* se);
private:
// cell renderer
void render_id (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
void render_name (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
void render_isvisible (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
void render_id(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
void render_name(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
void render_isvisible(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
void on_button_add();
void on_button_delete();
@ -40,7 +105,9 @@ private:
void controlspotChanged();
void shapeChanged();
void shapeMethodeChanged();
void spotMethodChanged();
void shapeMethodChanged();
void qualityMethodChanged();
void updateParamVisibility();
void adjusterChanged(Adjuster* a, double newval);
void disableParamlistener(bool cond);
@ -85,7 +152,7 @@ private:
public Gtk::Dialog
{
public:
RenameDialog (const Glib::ustring &actualname, Gtk::Window &parent);
RenameDialog(const Glib::ustring &actualname, Gtk::Window &parent);
Glib::ustring get_new_name();
private:
@ -97,12 +164,16 @@ private:
// Child widgets
Gtk::ScrolledWindow scrolledwindow_;
Gtk::TreeView treeview_;
sigc::connection treeviewconn_;
Glib::RefPtr<Gtk::ListStore> treemodel_;
Gtk::ButtonBox buttonbox_;
Gtk::Button button_add_;
sigc::connection buttonaddconn_;
Gtk::Button button_delete_;
sigc::connection buttondeleteconn_;
Gtk::Button button_rename_;
sigc::connection buttonrenameconn_;
MyComboBoxText* const shape_;
sigc::connection shapeconn_;
@ -126,6 +197,8 @@ private:
int lastObject_;
rtengine::Coord* lastCoord_;
int eventType; // 0 = No event, 1 = Spot creation event, 2 = Spot deletion event, 3 = Spot selection event
};
#endif // _CONTROLSPOTPANEL_H_

File diff suppressed because it is too large Load Diff

View File

@ -24,14 +24,12 @@ class Locallab :
public FoldableToolPanel,
public rtengine::localListener,
public CurveListener,
public EditSubscriber,
public ColorProvider,
public ThresholdCurveProvider,
public ThresholdAdjusterListener
{
private:
rtengine::ProcEvent EvLocenacolor;//548
rtengine::ProcEvent EvLocenaexpose;//572
rtengine::ProcEvent EvLocenavibrance;//563
@ -140,7 +138,8 @@ private:
rtengine::ProcEvent Evlocallabbilateral;// = 598,
rtengine::ProcEvent Evlocallabnoiselequal;// = 599,
rtengine::ProcEvent Evlocallabshapemethod;// = 600,
rtengine::ProcEvent Evlocallabspotduplicated;
rtengine::ProcEvent Evlocallabspotduplicated;// = 601
rtengine::ProcEvent Evlocallabspotcreated;// = 602
IdleRegister idle_register;
@ -159,33 +158,14 @@ private:
MyExpander* const expsharp;
MyExpander* const expcbdl;
MyExpander* const expdenoi;
MyExpander* const expsettings;
ControlSpotPanel* const expsettings;
CurveEditorGroup* const LocalcurveEditorgainT;
CurveEditorGroup* const LocalcurveEditorgainTrab;
CurveEditorGroup* const llCurveEditorG;
ControlSpotPanel *spotPanel;
Gtk::HBox *editHBox;
Gtk::ToggleButton* edit;
Adjuster* nbspot;
Adjuster* multiplier[5];
Adjuster* const anbspot;
Adjuster* const locX;
Adjuster* const locXL;
Adjuster* const degree;
Adjuster* const locY;
Adjuster* const locYT;
Adjuster* const centerX;
Adjuster* const centerY;
Adjuster* const circrad;
Adjuster* const sensiexclu;
Adjuster* const struc;
Adjuster* const thres;
Adjuster* const proxi;
Adjuster* const lightness;
Adjuster* const contrast;
Adjuster* const chroma;
@ -196,16 +176,10 @@ private:
Adjuster* const hlcomprthresh;
Adjuster* const black;
Adjuster* const shcompr;
/*
Adjuster* const lightnessex;
Adjuster* const contrastex;
Adjuster* const chromaex;
*/
Adjuster* const sensiex;
Adjuster* const radius;
Adjuster* const strength;
Adjuster* const sensibn;
Adjuster* const transit;
Adjuster* const stren;
Adjuster* const gamma;
Adjuster* const estop;
@ -237,38 +211,24 @@ private:
Adjuster* const sobelref;
Adjuster* const centerXbuf;
Adjuster* const centerYbuf;
// Adjuster* const adjblur;
MyComboBoxText* const shapemethod;
MyComboBoxText* const Smethod;
MyComboBoxText* const Exclumethod;
MyComboBoxText* const retinexMethod;
MyComboBoxText* const qualityMethod;
MyComboBoxText* const qualitycurveMethod;
MyComboBoxText* const blurMethod;
MyComboBoxText* const dustMethod;
Gtk::Frame* const excluFrame;
Gtk::Frame* const artifFrame;
Gtk::Frame* const shapeFrame;
Gtk::Frame* const superFrame;
Gtk::Frame* const dustFrame;
Gtk::Frame* const wavFrame;
Gtk::Label* const labmdh;
Gtk::Label* const labqual;
Gtk::Label* const labqualcurv;
Gtk::Label* const labmS;
Gtk::Label* const labmEx;
Gtk::Label* const labmshape;
Gtk::HBox* const ctboxS;
Gtk::HBox* const ctboxshape;
Gtk::HBox* const ctboxEx;
Gtk::HBox* const dhbox;
Gtk::HBox* const qualbox;
Gtk::HBox* const qualcurvbox;
Gtk::CheckButton* const avoid;
@ -281,7 +241,6 @@ private:
Gtk::CheckButton* const cutpast;
Gtk::CheckButton* const lastdust;
Gtk::CheckButton* spotduplicated;
Gtk::Label* labspotdup;
Gtk::Button* neutral;
@ -328,25 +287,20 @@ private:
sigc::connection ashiftconn;
sigc::connection pastsattogconn;
sigc::connection lumaneutralPressedConn;
sigc::connection lumacontrastPlusPressedConn;
sigc::connection lumacontrastMinusPressedConn;
sigc::connection enablecolorConn, enableexposeConn, enablevibranceConn, enableblurConn, enabletonemapConn;
sigc::connection enableretiConn, enablesharpConn, enablecbdlConn;
sigc::connection enabledenoiConn;
sigc::connection editConn, avoidConn, inversConn, cutpastConn, lastdustConn, curvactivConn, activlumConn, inversradConn, inversretConn, inversshaConn, neutralconn, neutralconn1;
sigc::connection Smethodconn, shapemethodconn, Exclumethodconn, spotduplicatedConn;
sigc::connection avoidConn, inversConn, cutpastConn, lastdustConn, curvactivConn, activlumConn, inversradConn, inversretConn, inversshaConn, neutralconn, neutralconn1;
sigc::connection retinexMethodConn;
sigc::connection qualityMethodConn;
sigc::connection qualitycurveMethodConn;
sigc::connection blurMethodConn;
sigc::connection dustMethodConn;
bool lastspotduplicated;
int nextdatasp[102];
int nextlength;
bool nextspotdup;
@ -367,18 +321,32 @@ private:
std::string nextex_str;
std::string nextex_str2;
double draggedPointOldAngle;
double draggedPointAdjusterAngle;
double draggedFeatherOffset;
double draggedlocYOffset;
double draggedlocXOffset;
double draggedlocYTOffset;
double draggedlocXLOffset;
rtengine::Coord draggedCenter;
bool lastavoid, lastinvers, lastcutpast, lastlastdust, lastinversrad, lastinversret, lastactivlum, lastinverssha, lastcurvactiv;
int lastanbspot;
void editToggled();
// To be deleted
Adjuster* const locX;
Adjuster* const locXL;
Adjuster* const degree;
Adjuster* const locY;
Adjuster* const locYT;
Adjuster* const centerX;
Adjuster* const centerY;
Adjuster* const circrad;
Adjuster* const sensiexclu;
Adjuster* const struc;
Adjuster* nbspot;
MyComboBoxText* const shapemethod;
MyComboBoxText* const Smethod;
MyComboBoxText* const Exclumethod;
Gtk::CheckButton* spotduplicated;
Adjuster* const thres;
Adjuster* const proxi;
Adjuster* const transit;
MyComboBoxText* const qualityMethod;
// To be deleted ??
Adjuster* const anbspot;
public:
@ -391,10 +359,9 @@ public:
void setBatchMode(bool batchMode);
void updateGeometry(const int centerX_, const int centerY_, const int circrad_, const int locY_, const double degree_, const int locX_, const int locYT_, const int locXL_, const int fullWidth = -1, const int fullHeight = -1);
void SmethodChanged();
void shapemethodChanged();
void ExclumethodChanged();
void SmethodChanged(); // TODO To be deleted
void shapemethodChanged(); // TODO To be deleted
void ExclumethodChanged(); // TODO To be deleted
void writeOptions(std::vector<int> &tpOpen);
void updateToolState(std::vector<int> &tpOpen);
@ -424,10 +391,12 @@ public:
bool localComputed_();
bool localretComputed_();
void setEditProvider(EditDataProvider* provider);
void subscribe();
void unsubscribe();
void retinexMethodChanged();
void blurMethodChanged();
void dustMethodChanged();
void qualityMethodChanged();
void qualityMethodChanged(); // TODO To be deleted
void qualitycurveMethodChanged();
void lumaneutralPressed();
void lumacontrastPlusPressed();
@ -439,12 +408,6 @@ public:
void pastsattog_toggled();
std::vector<double> getCurvePoints(ThresholdSelector* tAdjuster) const;
// EditSubscriber interface
CursorShape getCursor(int objectID);
bool mouseOver(int modifierKey);
bool button1Pressed(int modifierKey);
bool button1Released();
bool drag1(int modifierKey);
void switchOffEditMode();
void setListener(ToolPanelListener* tpl);
};

View File

@ -325,6 +325,27 @@ void ParamsEdited::set(bool v)
gradient.centerX = v;
gradient.centerY = v;
locallab.enabled = v;
locallab.nbspot = v;
locallab.selspot = v;
locallab.id = v;
locallab.name = v;
locallab.isvisible = v;
locallab.shape = v;
locallab.spotMethod = v;
locallab.shapeMethod = v;
locallab.locX = v;
locallab.locXL = v;
locallab.locY = v;
locallab.locYT = v;
locallab.centerX = v;
locallab.centerY = v;
locallab.circrad = v;
locallab.qualityMethod = v;
locallab.transit = v;
locallab.thresh = v;
locallab.iter = v;
/*
locallab.expcolor = v;
locallab.expexpose = v;
locallab.expvibrance = v;
@ -439,7 +460,10 @@ void ParamsEdited::set(bool v)
locallab.skintonescurve = v;
locallab.sensiv = v;
locallab.spotduplicated = v;
locallab.id = v;
locallab.name = v;
locallab.isvisible = v;
*/
pcvignette.enabled = v;
pcvignette.strength = v;
@ -994,7 +1018,30 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
gradient.strength = gradient.strength && p.gradient.strength == other.gradient.strength;
gradient.centerX = gradient.centerX && p.gradient.centerX == other.gradient.centerX;
gradient.centerY = gradient.centerY && p.gradient.centerY == other.gradient.centerY;
locallab.enabled = locallab.enabled && p.locallab.enabled == other.locallab.enabled;
locallab.nbspot = locallab.nbspot && p.locallab.nbspot == other.locallab.nbspot;
locallab.selspot = locallab.selspot && p.locallab.selspot == other.locallab.selspot;
// Control spot settings
locallab.id = locallab.id && p.locallab.id == other.locallab.id;
locallab.name = locallab.name && p.locallab.name == other.locallab.name;
locallab.isvisible = locallab.isvisible && p.locallab.isvisible == other.locallab.isvisible;
locallab.shape = locallab.shape && p.locallab.shape == other.locallab.shape;
locallab.spotMethod = locallab.spotMethod && p.locallab.spotMethod == other.locallab.spotMethod;
locallab.shapeMethod = locallab.shapeMethod && p.locallab.shapeMethod == other.locallab.shapeMethod;
locallab.locX = locallab.locX && p.locallab.locX == other.locallab.locX;
locallab.locXL = locallab.locXL && p.locallab.locXL == other.locallab.locXL;
locallab.locY = locallab.locY && p.locallab.locY == other.locallab.locY;
locallab.locYT = locallab.locYT && p.locallab.locYT == other.locallab.locYT;
locallab.centerX = locallab.centerX && p.locallab.centerX == other.locallab.centerX;
locallab.centerY = locallab.centerY && p.locallab.centerY == other.locallab.centerY;
locallab.circrad = locallab.circrad && p.locallab.circrad == other.locallab.circrad;
locallab.qualityMethod = locallab.qualityMethod && p.locallab.qualityMethod == other.locallab.qualityMethod;
locallab.transit = locallab.transit && p.locallab.transit == other.locallab.transit;
locallab.thresh = locallab.thresh && p.locallab.thresh == other.locallab.thresh;
locallab.iter = locallab.iter && p.locallab.iter == other.locallab.iter;
/*
locallab.avoid = locallab.avoid && p.locallab.avoid == other.locallab.avoid;
locallab.invers = locallab.invers && p.locallab.invers == other.locallab.invers;
locallab.cutpast = locallab.cutpast && p.locallab.cutpast == other.locallab.cutpast;
@ -1109,8 +1156,8 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.skintonescurve = locallab.skintonescurve && p.locallab.skintonescurve == other.locallab.skintonescurve;
locallab.sensiv = locallab.sensiv && p.locallab.sensiv == other.locallab.sensiv;
locallab.spotduplicated = locallab.spotduplicated && p.locallab.spotduplicated == other.locallab.spotduplicated;
*/
pcvignette.enabled = pcvignette.enabled && p.pcvignette.enabled == other.pcvignette.enabled;
pcvignette.strength = pcvignette.strength && p.pcvignette.strength == other.pcvignette.strength;
pcvignette.feather = pcvignette.feather && p.pcvignette.feather == other.pcvignette.feather;
@ -1423,7 +1470,7 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (toneCurve.clampOOG) {
toEdit.toneCurve.clampOOG = mods.toneCurve.clampOOG;
}
if (retinex.enabled) {
toEdit.retinex.enabled = mods.retinex.enabled;
}
@ -1770,12 +1817,15 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (colorToning.labgridALow) {
toEdit.colorToning.labgridALow = mods.colorToning.labgridALow;
}
if (colorToning.labgridBLow) {
toEdit.colorToning.labgridBLow = mods.colorToning.labgridBLow;
}
if (colorToning.labgridAHigh) {
toEdit.colorToning.labgridAHigh = mods.colorToning.labgridAHigh;
}
if (colorToning.labgridBHigh) {
toEdit.colorToning.labgridBHigh = mods.colorToning.labgridBHigh;
}
@ -2301,7 +2351,8 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (fattal.amount) {
toEdit.fattal.amount = mods.fattal.amount;
}
}
if (fattal.anchor) {
toEdit.fattal.anchor = mods.fattal.anchor;
}
@ -2458,6 +2509,84 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.enabled = mods.locallab.enabled;
}
if (locallab.nbspot) {
toEdit.locallab.nbspot = mods.locallab.nbspot;
}
if (locallab.selspot) {
toEdit.locallab.selspot = mods.locallab.selspot;
}
// Control spot settings
if (locallab.id) {
toEdit.locallab.id = mods.locallab.id;
}
if (locallab.name) {
toEdit.locallab.name = mods.locallab.name;
}
if (locallab.isvisible) {
toEdit.locallab.isvisible = mods.locallab.isvisible;
}
if (locallab.shape) {
toEdit.locallab.shape = mods.locallab.shape;
}
if (locallab.spotMethod) {
toEdit.locallab.spotMethod = mods.locallab.spotMethod;
}
if (locallab.shapeMethod) {
toEdit.locallab.shapeMethod = mods.locallab.shapeMethod;
}
if (locallab.locX) {
toEdit.locallab.locX = mods.locallab.locX;
}
if (locallab.locXL) {
toEdit.locallab.locXL = mods.locallab.locXL;
}
if (locallab.locY) {
toEdit.locallab.locY = mods.locallab.locY;
}
if (locallab.locYT) {
toEdit.locallab.locYT = mods.locallab.locYT;
}
if (locallab.centerX) {
toEdit.locallab.centerX = mods.locallab.centerX;
}
if (locallab.centerY) {
toEdit.locallab.centerY = mods.locallab.centerY;
}
if (locallab.circrad) {
toEdit.locallab.circrad = mods.locallab.circrad;
}
if (locallab.qualityMethod) {
toEdit.locallab.qualityMethod = mods.locallab.qualityMethod;
}
if (locallab.transit) {
toEdit.locallab.transit = mods.locallab.transit;
}
if (locallab.thresh) {
toEdit.locallab.thresh = mods.locallab.thresh;
}
if (locallab.iter) {
toEdit.locallab.iter = mods.locallab.iter;
}
/*
if (locallab.expcolor) {
toEdit.locallab.expcolor = mods.locallab.expcolor;
}
@ -2685,7 +2814,7 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (locallab.spotduplicated) {
toEdit.locallab.spotduplicated = mods.locallab.spotduplicated;
}
if (locallab.sensiex) {
toEdit.locallab.sensiex = mods.locallab.sensiex;
}
@ -2895,6 +3024,7 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (locallab.chromacbdl) {
toEdit.locallab.chromacbdl = mods.locallab.chromacbdl;
}
*/
if (pcvignette.enabled) {
toEdit.pcvignette.enabled = mods.pcvignette.enabled;
@ -3249,7 +3379,7 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
if (raw.bayersensor.linenoiseDirection) {
toEdit.raw.bayersensor.linenoiseDirection = mods.raw.bayersensor.linenoiseDirection;
}
if (raw.bayersensor.pdafLinesFilter) {
toEdit.raw.bayersensor.pdafLinesFilter = mods.raw.bayersensor.pdafLinesFilter;
}

View File

@ -455,9 +455,31 @@ public:
};
class LocallabParamsEdited
{
// TODO To be manage by vector<bool>
public:
bool enabled;
bool nbspot;
bool selspot;
// Control spot settings
bool id;
bool name;
bool isvisible;
bool shape;
bool spotMethod;
bool shapeMethod;
bool locX;
bool locXL;
bool locY;
bool locYT;
bool centerX;
bool centerY;
bool circrad;
bool qualityMethod;
bool transit;
bool thresh;
bool iter;
/*
bool degree;
bool locY;
bool locX;
@ -567,7 +589,11 @@ public:
bool pastsattog;
bool skintonescurve;
bool sensiv;
bool spotduplicated;
bool spotduplicated;
bool id;
bool name;
bool isvisible;
*/
};
@ -913,7 +939,8 @@ public:
};
class MetaDataParamsEdited {
class MetaDataParamsEdited
{
public:
bool mode;
};

View File

@ -1,11 +1,13 @@
#pragma once
// This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes
#define PPVERSION 336
#define PPVERSION 337
#define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified
/*
Log of version changes
337 2018-07-26
Added Locallab tool parameters
336 2018-06-01
new demosaic method combobox for pixelshift
335 2018-05-30

View File

@ -28,7 +28,7 @@
using namespace rtengine::procparams;
ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChanged(false), editDataProvider(nullptr)
ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChanged(false), editDataProvider(nullptr), photoLoadedOnce(false)
{
exposurePanel = Gtk::manage(new ToolVBox());
@ -36,7 +36,7 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
colorPanel = Gtk::manage(new ToolVBox());
transformPanel = Gtk::manage(new ToolVBox());
rawPanel = Gtk::manage(new ToolVBox());
advancedPanel = Gtk::manage (new ToolVBox ());
advancedPanel = Gtk::manage(new ToolVBox());
locallabPanel = Gtk::manage(new ToolVBox());
coarse = Gtk::manage(new CoarsePanel());
@ -107,7 +107,7 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
addPanel(colorPanel, blackwhite);
addPanel(exposurePanel, shadowshighlights);
addPanel(detailsPanel, sharpening);
addPanel (detailsPanel, localContrast);
addPanel(detailsPanel, localContrast);
addPanel(detailsPanel, sharpenEdge);
addPanel(detailsPanel, sharpenMicro);
addPanel(colorPanel, hsvequalizer);
@ -116,16 +116,16 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
addPanel(colorPanel, colortoning);
addPanel(exposurePanel, epd);
addPanel(exposurePanel, fattal);
addPanel (advancedPanel, retinex);
addPanel(advancedPanel, retinex);
addPanel(exposurePanel, pcvignette);
addPanel(exposurePanel, gradient);
addPanel(exposurePanel, lcurve);
addPanel (advancedPanel, colorappearance);
addPanel(advancedPanel, colorappearance);
addPanel(detailsPanel, impulsedenoise);
addPanel(detailsPanel, dirpyrdenoise);
addPanel(detailsPanel, defringe);
addPanel(detailsPanel, dirpyrequalizer);
addPanel (advancedPanel, wavelet);
addPanel(advancedPanel, wavelet);
addPanel(locallabPanel, locallab);
addPanel(transformPanel, crop);
addPanel(transformPanel, resize);
@ -166,7 +166,7 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
colorPanelSW = Gtk::manage(new MyScrolledWindow());
transformPanelSW = Gtk::manage(new MyScrolledWindow());
rawPanelSW = Gtk::manage(new MyScrolledWindow());
advancedPanelSW = Gtk::manage (new MyScrolledWindow ());
advancedPanelSW = Gtk::manage(new MyScrolledWindow());
locallabPanelSW = Gtk::manage(new MyScrolledWindow());
updateVScrollbars(options.hideTPVScrollbar);
@ -191,9 +191,9 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
colorPanel->pack_start(*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
colorPanel->pack_start(*vbPanelEnd[2], Gtk::PACK_SHRINK, 4);
advancedPanelSW->add (*advancedPanel);
advancedPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
advancedPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);
advancedPanelSW->add(*advancedPanel);
advancedPanel->pack_start(*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
advancedPanel->pack_start(*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);
locallabPanelSW->add(*locallabPanel);
locallabPanel->pack_start(*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
@ -213,7 +213,7 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
toiE = Gtk::manage(new TextOrIcon("exposure.png", M("MAIN_TAB_EXPOSURE"), M("MAIN_TAB_EXPOSURE_TOOLTIP"), type));
toiD = Gtk::manage(new TextOrIcon("detail.png", M("MAIN_TAB_DETAIL"), M("MAIN_TAB_DETAIL_TOOLTIP"), type));
toiC = Gtk::manage(new TextOrIcon("colour.png", M("MAIN_TAB_COLOR"), M("MAIN_TAB_COLOR_TOOLTIP"), type));
toiW = Gtk::manage (new TextOrIcon ("atom.png", M ("MAIN_TAB_ADVANCED"), M ("MAIN_TAB_ADVANCED_TOOLTIP"), type));
toiW = Gtk::manage(new TextOrIcon("atom.png", M("MAIN_TAB_ADVANCED"), M("MAIN_TAB_ADVANCED_TOOLTIP"), type));
toiL = Gtk::manage(new TextOrIcon("openhand.png", M("MAIN_TAB_LOCALLAB"), M("MAIN_TAB_LOCALLAB_TOOLTIP"), type));
toiT = Gtk::manage(new TextOrIcon("transform.png", M("MAIN_TAB_TRANSFORM"), M("MAIN_TAB_TRANSFORM_TOOLTIP"), type));
@ -223,7 +223,7 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
toolPanelNotebook->append_page(*exposurePanelSW, *toiE);
toolPanelNotebook->append_page(*detailsPanelSW, *toiD);
toolPanelNotebook->append_page(*colorPanelSW, *toiC);
toolPanelNotebook->append_page (*advancedPanelSW, *toiW);
toolPanelNotebook->append_page(*advancedPanelSW, *toiW);
toolPanelNotebook->append_page(*locallabPanelSW, *toiL);
toolPanelNotebook->append_page(*transformPanelSW, *toiT);
toolPanelNotebook->append_page(*rawPanelSW, *toiR);
@ -234,6 +234,9 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
toolPanelNotebook->set_scrollable();
toolPanelNotebook->show_all();
notebookconn = toolPanelNotebook->signal_switch_page().connect(
sigc::mem_fun(*this, &ToolPanelCoordinator::notebookPageChanged));
for (auto toolPanel : toolPanels) {
toolPanel->setListener(this);
}
@ -252,6 +255,19 @@ ToolPanelCoordinator::ToolPanelCoordinator(bool batch) : ipc(nullptr), hasChange
toolBar->setToolBarListener(this);
}
void ToolPanelCoordinator::notebookPageChanged(Gtk::Widget* page, guint page_num)
{
// Locallab spot curves are set visible if at least one photo has been loaded (to avoid
// segfault) and locallab panel is active
if (photoLoadedOnce) {
if (page == locallabPanelSW) {
locallab->subscribe();
} else {
locallab->unsubscribe();
}
}
}
void ToolPanelCoordinator::addPanel(Gtk::Box* where, FoldableToolPanel* panel, int level)
{
@ -269,18 +285,22 @@ ToolPanelCoordinator::~ToolPanelCoordinator()
closeImage();
// When deleting toolPanelNotebook, pages removal activates notebookPageChanged function
// which is responsible of segfault if listener isn't deactivated before
notebookconn.block(true);
delete toolPanelNotebook;
delete toolBar;
}
void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans, bool isMono)
void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtrans, bool isMono)
{
if (isRaw) {
if (isBayer) {
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
self->rawPanelSW->set_sensitive (true);
self->rawPanelSW->set_sensitive(true);
self->sensorxtrans->FoldableToolPanel::hide();
self->sensorbayer->FoldableToolPanel::show();
self->preprocess->FoldableToolPanel::show();
@ -289,12 +309,11 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
return FALSE;
};
idle_register.add(func, this);
}
else if (isXtrans) {
} else if (isXtrans) {
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
self->rawPanelSW->set_sensitive (true);
self->rawPanelSW->set_sensitive(true);
self->sensorxtrans->FoldableToolPanel::show();
self->sensorbayer->FoldableToolPanel::hide();
self->preprocess->FoldableToolPanel::show();
@ -303,12 +322,11 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
return FALSE;
};
idle_register.add(func, this);
}
else if (isMono) {
} else if (isMono) {
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
self->rawPanelSW->set_sensitive (true);
self->rawPanelSW->set_sensitive(true);
self->sensorbayer->FoldableToolPanel::hide();
self->sensorxtrans->FoldableToolPanel::hide();
self->preprocess->FoldableToolPanel::hide();
@ -321,7 +339,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
self->rawPanelSW->set_sensitive (true);
self->rawPanelSW->set_sensitive(true);
self->sensorbayer->FoldableToolPanel::hide();
self->sensorxtrans->FoldableToolPanel::hide();
self->preprocess->FoldableToolPanel::hide();
@ -335,7 +353,7 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
self->rawPanelSW->set_sensitive (false);
self->rawPanelSW->set_sensitive(false);
return FALSE;
};
@ -347,6 +365,9 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
void ToolPanelCoordinator::panelChanged(rtengine::ProcEvent event, const Glib::ustring& descr)
{
// TODO Locallab printf
printf("panelChanged\n");
printf("panelChanged event: %d\n", (int)event);
if (!ipc) {
return;
@ -385,7 +406,6 @@ void ToolPanelCoordinator::panelChanged(rtengine::ProcEvent event, const Glib::u
int fw, fh;
ipc->getInitialImage()->getImageSource()->getFullSize(fw, fh, tr);
gradient->updateGeometry(params->gradient.centerX, params->gradient.centerY, params->gradient.feather, params->gradient.degree, fw, fh);
locallab->updateGeometry(params->locallab.centerX, params->locallab.centerY, params->locallab.circrad, params->locallab.locY, params->locallab.degree, params->locallab.locX, params->locallab.locYT, params->locallab.locXL, fw, fh);
}
// some transformations make the crop change for convenience
@ -412,10 +432,33 @@ void ToolPanelCoordinator::panelChanged(rtengine::ProcEvent event, const Glib::u
for (auto paramcListener : paramcListeners) {
paramcListener->procParamsChanged(params, event, descr);
}
// Locallab spot curves are set visible if at least one photo has been loaded (to avoid
// segfault) and locallab panel is active
// When a new photo is loaded, Locallab spot curves need to be set visible again
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
if (self->photoLoadedOnce && (self->toolPanelNotebook->get_nth_page(self->toolPanelNotebook->get_current_page()) == self->locallabPanelSW))
{
self->locallab->subscribe();
}
return FALSE;
};
if (event == rtengine::EvPhotoLoaded) {
idle_register.add(func, this);
}
photoLoadedOnce = true;
}
void ToolPanelCoordinator::profileChange(const PartialProfile *nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited)
{
// TODO Locallab printf
printf("profileChanged\n");
printf("profileChanged event: %d\n", (int)event);
int fw, fh, tr;
@ -480,8 +523,6 @@ void ToolPanelCoordinator::profileChange(const PartialProfile *nparams, rtengine
if (event == rtengine::EvPhotoLoaded || event == rtengine::EvProfileChanged || event == rtengine::EvHistoryBrowsed || event == rtengine::EvCTRotate) {
// updating the "on preview" geometry
gradient->updateGeometry(params->gradient.centerX, params->gradient.centerY, params->gradient.feather, params->gradient.degree, fw, fh);
locallab->updateGeometry(params->locallab.centerX, params->locallab.centerY, params->locallab.circrad, params->locallab.locY, params->locallab.degree, params->locallab.locX, params->locallab.locYT, params->locallab.locXL, fw, fh);
}
// start the IPC processing
@ -496,6 +537,26 @@ void ToolPanelCoordinator::profileChange(const PartialProfile *nparams, rtengine
for (auto paramcListener : paramcListeners) {
paramcListener->procParamsChanged(params, event, descr);
}
// Locallab spot curves are set visible if at least one photo has been loaded (to avoid
// segfault) and locallab panel is active
// When a new photo is loaded, Locallab spot curves need to be set visible again
const auto func = [](gpointer data) -> gboolean {
ToolPanelCoordinator* const self = static_cast<ToolPanelCoordinator*>(data);
if (self->photoLoadedOnce && (self->toolPanelNotebook->get_nth_page(self->toolPanelNotebook->get_current_page()) == self->locallabPanelSW))
{
self->locallab->subscribe();
}
return FALSE;
};
if (event == rtengine::EvPhotoLoaded) {
idle_register.add(func, this);
}
photoLoadedOnce = true;
}
void ToolPanelCoordinator::setDefaults(ProcParams* defparams)
@ -685,9 +746,10 @@ void ToolPanelCoordinator::sharpMaskSelected(bool sharpMask)
if (!ipc) {
return;
}
ipc->beginUpdateParams ();
ipc->beginUpdateParams();
ipc->setSharpMask(sharpMask);
ipc->endUpdateParams (rtengine::EvShrEnabled);
ipc->endUpdateParams(rtengine::EvShrEnabled);
}
@ -876,7 +938,7 @@ bool ToolPanelCoordinator::handleShortcutKey(GdkEventKey* event)
return true;
case GDK_KEY_w:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num (*advancedPanelSW));
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*advancedPanelSW));
return true;
case GDK_KEY_o:
@ -901,7 +963,7 @@ void ToolPanelCoordinator::updateVScrollbars(bool hide)
colorPanelSW->set_policy(Gtk::POLICY_AUTOMATIC, policy);
transformPanelSW->set_policy(Gtk::POLICY_AUTOMATIC, policy);
rawPanelSW->set_policy(Gtk::POLICY_AUTOMATIC, policy);
advancedPanelSW->set_policy (Gtk::POLICY_AUTOMATIC, policy);
advancedPanelSW->set_policy(Gtk::POLICY_AUTOMATIC, policy);
locallabPanelSW->set_policy(Gtk::POLICY_AUTOMATIC, policy);
for (auto currExp : expList) {

View File

@ -194,10 +194,13 @@ protected:
void foldThemAll(GdkEventButton* event);
void updateVScrollbars(bool hide);
void updateTabsHeader(bool useIcons);
void notebookPageChanged(Gtk::Widget* page, guint page_num);
private:
EditDataProvider *editDataProvider;
sigc::connection notebookconn;
bool photoLoadedOnce; // Used to indicated that a photo has been loaded yet
public:
@ -223,7 +226,7 @@ public:
// toolpanellistener interface
void panelChanged(rtengine::ProcEvent event, const Glib::ustring& descr);
void imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans, bool isMono = false);
void imageTypeChanged(bool isRaw, bool isBayer, bool isXtrans, bool isMono = false);
// profilechangelistener interface
void profileChange(const rtengine::procparams::PartialProfile* nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited = nullptr);
void setDefaults(rtengine::procparams::ProcParams* defparams);
@ -285,7 +288,7 @@ public:
// imageareatoollistener interface
void spotWBselected(int x, int y, Thumbnail* thm = nullptr);
void sharpMaskSelected (bool sharpMask);
void sharpMaskSelected(bool sharpMask);
void cropSelectionReady();
void rotateSelectionReady(double rotate_deg, Thumbnail* thm = nullptr);
ToolBar* getToolBar()
@ -306,7 +309,7 @@ public:
void toolSelected(ToolMode tool);
void editModeSwitchedOff();
void setEditProvider (EditDataProvider *provider);
void setEditProvider(EditDataProvider *provider);
private:
IdleRegister idle_register;