enabled simple mask for Color and light inverse

This commit is contained in:
Desmis 2019-08-09 18:32:09 +02:00
parent 61bb421528
commit d39eded269
12 changed files with 375 additions and 176 deletions

View File

@ -1016,7 +1016,7 @@ void Crop::update(int todo)
locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili,
locwavCurve, locwavCurve,
LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre,
parent->locallColorMask, parent->locallExpMask, parent->locallSHMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask); parent->locallColorMask, parent->locallColorMaskinv, parent->locallExpMask, parent->locallSHMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask);
} else { } else {
parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2,locallutili, parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2,locallutili,
loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
@ -1026,7 +1026,7 @@ void Crop::update(int todo)
locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili,
locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili,
locwavCurve, locwavCurve,
LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0); LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0, 0);
} }
lllocalcurve2.clear(); lllocalcurve2.clear();
lightCurveloc2.clear(); lightCurveloc2.clear();

View File

@ -203,6 +203,7 @@ ImProcCoordinator::ImProcCoordinator() :
avg(0), avg(0),
lastspotdup(false), lastspotdup(false),
locallColorMask(0), locallColorMask(0),
locallColorMaskinv(0),
locallExpMask(0), locallExpMask(0),
locallSHMask(0), locallSHMask(0),
locallcbMask(0), locallcbMask(0),
@ -986,7 +987,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili,
locwavCurve, locwavCurve,
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler,
locallColorMask, locallExpMask, locallSHMask, locallcbMask, locallretiMask, locallsoftMask, localltmMask, locallblMask); locallColorMask, locallColorMaskinv, locallExpMask, locallSHMask, locallcbMask, locallretiMask, locallsoftMask, localltmMask, locallblMask);
} else { } else {
ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
@ -995,7 +996,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili,
locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili,
locwavCurve, locwavCurve,
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0, 0, 0, 0); LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0, 0, 0, 0, 0);
} }
//recalculate references after //recalculate references after
if (params->locallab.spots.at(sp).spotMethod == "exc") { if (params->locallab.spots.at(sp).spotMethod == "exc") {

View File

@ -297,6 +297,7 @@ protected:
float avg; float avg;
bool lastspotdup; bool lastspotdup;
int locallColorMask; int locallColorMask;
int locallColorMaskinv;
int locallExpMask; int locallExpMask;
int locallSHMask; int locallSHMask;
int locallcbMask; int locallcbMask;
@ -373,9 +374,10 @@ public:
updaterThreadStart.unlock(); updaterThreadStart.unlock();
} }
void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask, int locallblMask) override void setLocallabMaskVisibility (int locallColorMask, int locallColorMaskinv, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask, int locallblMask) override
{ {
this->locallColorMask = locallColorMask; this->locallColorMask = locallColorMask;
this->locallColorMaskinv = locallColorMaskinv;
this->locallExpMask = locallExpMask; this->locallExpMask = locallExpMask;
this->locallSHMask = locallSHMask; this->locallSHMask = locallSHMask;
this->locallcbMask = locallcbMask; this->locallcbMask = locallcbMask;

View File

@ -317,7 +317,7 @@ public:
const LocCCmasktmCurve & locccmastmCurve, bool &lcmastmutili, const LocLLmasktmCurve & locllmastmCurve, bool &llmastmutili, const LocHHmasktmCurve & lochhmastmCurve, bool & lhmastmutili, const LocCCmasktmCurve & locccmastmCurve, bool &lcmastmutili, const LocLLmasktmCurve & locllmastmCurve, bool &llmastmutili, const LocHHmasktmCurve & lochhmastmCurve, bool & lhmastmutili,
const LocCCmaskblCurve & locccmasblCurve, bool &lcmasblutili, const LocLLmaskblCurve & locllmasblCurve, bool &llmasblutili, const LocHHmaskblCurve & lochhmasblCurve, bool & lhmasblutili, const LocCCmaskblCurve & locccmasblCurve, bool &lcmasblutili, const LocLLmaskblCurve & locllmasblCurve, bool &llmasblutili, const LocHHmaskblCurve & lochhmasblCurve, bool & lhmasblutili,
const LocwavCurve & locwavCurve, const LocwavCurve & locwavCurve,
bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int llColorMask, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, int llColorMask, int llColorMaskinv,
int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask); int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask);
void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk);
void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy);
@ -338,7 +338,7 @@ public:
void fftw_denoise(int GW, int GH, int max_numblox_W, int min_numblox_W, float **tmp1, array2D<float> *Lin, int numThreads, const struct local_params & lp, int chrom); void fftw_denoise(int GW, int GH, int max_numblox_W, int min_numblox_W, float **tmp1, array2D<float> *Lin, int numThreads, const struct local_params & lp, int chrom);
void ColorLight_Local(float moddE, float powdE, int call, LabImage * bufcolorig, LabImage * originalmask, float **buflight, float **bufchro, float **bufchroslid, float ** bufhh, float ** buflightslid, bool &LHutili, bool &HHutili, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, float sobelref, float ** blend2, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, LUTf & lightCurveloc, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int sk); void ColorLight_Local(float moddE, float powdE, int call, LabImage * bufcolorig, LabImage * originalmask, float **buflight, float **bufchro, float **bufchroslid, float ** bufhh, float ** buflightslid, bool &LHutili, bool &HHutili, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, float sobelref, float ** blend2, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, LUTf & lightCurveloc, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int sk);
void InverseColorLight_Local(int sp, int senstype, const struct local_params& lp, LUTf & lightCurveloc, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & exlocalcurve, LUTf & cclocalcurve, float adjustr, bool localcutili, LUTf & lllocalcurve, bool locallutili, LabImage* original, LabImage* transformed, int cx, int cy, const float hueref, const float chromaref, const float lumaref, int sk); void InverseColorLight_Local(int sp, int senstype, const struct local_params& lp, LabImage * originalmask, LUTf & lightCurveloc, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & exlocalcurve, LUTf & cclocalcurve, float adjustr, bool localcutili, LUTf & lllocalcurve, bool locallutili, LabImage* original, LabImage* transformed, int cx, int cy, const float hueref, const float chromaref, const float lumaref, int sk);
void Sharp_Local(int call, float **loctemp, int senstype, const float hueref, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk); void Sharp_Local(int call, float **loctemp, int senstype, const float hueref, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk);
// void Sharp_Local(int call, float **loctemp, int senstype, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int sk); // void Sharp_Local(int call, float **loctemp, int senstype, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int sk);

View File

@ -270,6 +270,7 @@ struct local_params {
int qualcurvemet; int qualcurvemet;
int gridmet; int gridmet;
int showmaskcolmet; int showmaskcolmet;
int showmaskcolmetinv;
int showmaskexpmet; int showmaskexpmet;
int showmaskSHmet; int showmaskSHmet;
int showmaskcbmet; int showmaskcbmet;
@ -332,6 +333,7 @@ struct local_params {
float adjch; float adjch;
int shapmet; int shapmet;
bool enaColorMask; bool enaColorMask;
bool enaColorMaskinv;
bool enaExpMask; bool enaExpMask;
bool enaSHMask; bool enaSHMask;
bool enacbMask; bool enacbMask;
@ -432,7 +434,7 @@ static void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float
static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask) static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llColorMaskinv, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask)
{ {
int w = oW; int w = oW;
int h = oH; int h = oH;
@ -510,6 +512,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
lp.linear = locallab.spots.at(sp).linear; lp.linear = locallab.spots.at(sp).linear;
lp.showmaskcolmet = llColorMask; lp.showmaskcolmet = llColorMask;
lp.showmaskcolmetinv = llColorMaskinv;
lp.showmaskexpmet = llExpMask; lp.showmaskexpmet = llExpMask;
lp.showmaskSHmet = llSHMask; lp.showmaskSHmet = llSHMask;
lp.showmaskcbmet = llcbMask; lp.showmaskcbmet = llcbMask;
@ -518,6 +521,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
lp.showmasktmmet = lltmMask; lp.showmasktmmet = lltmMask;
lp.showmaskblmet = llblMask; lp.showmaskblmet = llblMask;
lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;// Exposure mask is deactivated if Color & Light mask is visible lp.enaColorMask = locallab.spots.at(sp).enaColorMask && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
lp.enaColorMaskinv = locallab.spots.at(sp).enaColorMask && llColorMaskinv == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;// Exposure mask is deactivated if Color & Light mask is visible lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;// Exposure mask is deactivated if Color & Light mask is visible
lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 ; lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 ;
lp.enacbMask = locallab.spots.at(sp).enacbMask && llcbMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0; lp.enacbMask = locallab.spots.at(sp).enacbMask && llcbMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;
@ -836,8 +840,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
lp.threshol = thresho; lp.threshol = thresho;
lp.chromacb = chromcbdl; lp.chromacb = chromcbdl;
lp.colorena = locallab.spots.at(sp).expcolor && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0; // Color & Light tool is deactivated if Exposure mask is visible or SHMask lp.colorena = locallab.spots.at(sp).expcolor && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0; // Color & Light tool is deactivated if Exposure mask is visible or SHMask
lp.blurena = locallab.spots.at(sp).expblur; lp.blurena = locallab.spots.at(sp).expblur && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && llColorMask == 0;
lp.tonemapena = locallab.spots.at(sp).exptonemap; lp.tonemapena = locallab.spots.at(sp).exptonemap && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && llColorMask == 0;
lp.retiena = locallab.spots.at(sp).expreti && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llColorMask == 0; lp.retiena = locallab.spots.at(sp).expreti && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llColorMask == 0;
lp.sharpena = locallab.spots.at(sp).expsharp; lp.sharpena = locallab.spots.at(sp).expsharp;
lp.lcena = locallab.spots.at(sp).expcontrast; lp.lcena = locallab.spots.at(sp).expcontrast;
@ -2316,6 +2320,138 @@ static void showmask(const local_params& lp, int xstart, int ystart, int cx, int
} }
} }
void maskcalccol(int bfw, int bfh, int xstart, int ystart, int sk, int cx, int cy, LabImage* bufcolorig, LabImage* bufmaskblurcol, LabImage* originalmaskcol, LabImage* original, LabImage * transformed, int inv, const struct local_params & lp,
const LocCCmaskCurve & locccmasCurve, bool & lcmasutili, const LocLLmaskCurve & locllmasCurve, bool & llmasutili, const LocHHmaskCurve & lochhmasCurve, bool &lhmasutili, bool multiThread,
bool enaMask, bool showmaske, bool deltaE, bool modmask, bool zero, bool modif)
{
array2D<float> ble(bfw, bfh);
array2D<float> guid(bfw, bfh);
float meanfab, fab;
mean_fab(xstart, ystart, bfw, bfh, bufcolorig, original, fab, meanfab, lp.chromacol);
if (deltaE || modmask || enaMask || showmaske) {
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int y = 0; y < bfh; y++) {
for (int x = 0; x < bfw; x++) {
bufmaskblurcol->L[y][x] = original->L[y + ystart][x + xstart];
bufmaskblurcol->a[y][x] = original->a[y + ystart][x + xstart];
bufmaskblurcol->b[y][x] = original->b[y + ystart][x + xstart];
}
}
#ifdef _OPENMP
#pragma omp parallel
#endif
{
#ifdef __SSE2__
float atan2Buffer[bfw] ALIGNED64;
#endif
#ifdef _OPENMP
#pragma omp for schedule(dynamic, 16)
#endif
for (int ir = 0; ir < bfh; ir++) {
#ifdef __SSE2__
if (lochhmasCurve && lhmasutili) {
int i = 0;
for (; i < bfw - 3; i += 4) {
STVF(atan2Buffer[i], xatan2f(LVFU(bufcolorig->b[ir][i]), LVFU(bufcolorig->a[ir][i])));
}
for (; i < bfw; i++) {
atan2Buffer[i] = xatan2f(bufcolorig->b[ir][i], bufcolorig->a[ir][i]);
}
}
#endif
for (int jr = 0; jr < bfw; jr++) {
float kmaskL = 0.f;
float kmaskC = 0.f;
float kmaskHL = 0.f;
float kmaskH = 0.f;
if (locllmasCurve && llmasutili) {
kmaskL = 32768.f * LIM01(1.f - locllmasCurve[(500.f / 32768.f) * bufcolorig->L[ir][jr]]);
}
if (!deltaE && locccmasCurve && lcmasutili) {
kmaskC = LIM01(1.f - locccmasCurve[500.f * (0.0001f + sqrt(SQR(bufcolorig->a[ir][jr]) + SQR(bufcolorig->b[ir][jr])) / fab)]);
}
if (lochhmasCurve && lhmasutili) {
#ifdef __SSE2__
const float huema = atan2Buffer[jr];
#else
const float huema = xatan2f(bufcolorig->b[ir][jr], bufcolorig->a[ir][jr]);
#endif
float h = Color::huelab_to_huehsv2(huema);
h += 1.f / 6.f;
if (h > 1.f) {
h -= 1.f;
}
const float valHH = LIM01(1.f - lochhmasCurve[500.f * h]);
if (!deltaE) {
kmaskH = valHH;
}
kmaskHL = 32768.f * valHH;
}
bufmaskblurcol->L[ir][jr] = CLIPLOC(kmaskL + kmaskHL);
bufmaskblurcol->a[ir][jr] = CLIPC(kmaskC + kmaskH);
bufmaskblurcol->b[ir][jr] = CLIPC(kmaskC + kmaskH);
ble[ir][jr] = bufmaskblurcol->L[ir][jr] / 32768.f;
guid[ir][jr] = bufcolorig->L[ir][jr] / 32768.f;
}
}
}
if (lp.radmacol > 0.f) {
guidedFilter(guid, ble, ble, lp.radmacol * 10.f / sk, 0.001, multiThread, 4);
}
LUTf lutTonemaskexp(65536);
calcGammaLut(lp.gammacol, lp.slomacol, lutTonemaskexp);
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int ir = 0; ir < bfh; ir++) {
for (int jr = 0; jr < bfw; jr++) {
bufmaskblurcol->L[ir][jr] = lutTonemaskexp[LIM01(ble[ir][jr]) * 65536.f];
}
}
}
const float radiusb = 1.f / sk;
if (deltaE || modmask || enaMask || showmaske) {
#ifdef _OPENMP
#pragma omp parallel
#endif
{
gaussianBlur(bufmaskblurcol->L, bufmaskblurcol->L, bfw, bfh, radiusb);
gaussianBlur(bufmaskblurcol->a, bufmaskblurcol->a, bfw, bfh, 1.f + (0.5f * lp.radmacol) / sk);
gaussianBlur(bufmaskblurcol->b, bufmaskblurcol->b, bfw, bfh, 1.f + (0.5f * lp.radmacol) / sk);
}
if (zero || modif || modmask || deltaE || enaMask) {
originalmaskcol->CopyFrom(transformed);
blendmask(lp, xstart, ystart, cx, cy, bfw, bfh, bufcolorig, original, bufmaskblurcol, originalmaskcol, lp.blendmacol, inv);
}
}
}
void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, const float lumaref, const float chromaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk) void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueref, const float lumaref, const float chromaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk)
{ {
@ -3358,7 +3494,7 @@ void ImProcFunctions::transit_shapedetect(int senstype, const LabImage *bufexpor
} }
} }
void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct local_params & lp, LUTf & lightCurveloc, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & exlocalcurve, LUTf & cclocalcurve, float adjustr, bool localcutili, LUTf & lllocalcurve, bool locallutili, LabImage * original, LabImage * transformed, int cx, int cy, const float hueref, const float chromaref, const float lumaref, int sk) void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct local_params & lp, LabImage * originalmask, LUTf & lightCurveloc, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & exlocalcurve, LUTf & cclocalcurve, float adjustr, bool localcutili, LUTf & lllocalcurve, bool locallutili, LabImage * original, LabImage * transformed, int cx, int cy, const float hueref, const float chromaref, const float lumaref, int sk)
{ {
// BENCHFUN // BENCHFUN
float ach = (float)lp.trans / 100.f; float ach = (float)lp.trans / 100.f;
@ -3525,10 +3661,25 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct
float kab = 1.f; float kab = 1.f;
balancedeltaE(kL, kab); balancedeltaE(kL, kab);
LabImage *origblur = new LabImage(GW, GH); std::unique_ptr<LabImage> origblur(new LabImage(GW, GH));
std::unique_ptr<LabImage> origblurmask;
const bool usemaskcol = (lp.enaColorMaskinv) && senstype == 0;
const bool usemaskall = (usemaskcol);
float radius = 3.f / sk; float radius = 3.f / sk;
if (usemaskall) {
origblurmask.reset(new LabImage(GW, GH));
#ifdef _OPENMP
#pragma omp parallel if (multiThread)
#endif
{
gaussianBlur(originalmask->L, origblurmask->L, GW, GH, radius);
gaussianBlur(originalmask->a, origblurmask->a, GW, GH, radius);
gaussianBlur(originalmask->b, origblurmask->b, GW, GH, radius);
}
}
if (senstype == 1) { if (senstype == 1) {
radius = (2.f + 0.2f * lp.blurexp) / sk; radius = (2.f + 0.2f * lp.blurexp) / sk;
@ -3556,6 +3707,7 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct
#pragma omp parallel if (multiThread) #pragma omp parallel if (multiThread)
#endif #endif
{ {
const LabImage *maskptr = usemaskall ? origblurmask.get() : origblur.get();
const int limscope = 80; const int limscope = 80;
const float mindE = 2.f + MINSCOPE * varsens * lp.thr; const float mindE = 2.f + MINSCOPE * varsens * lp.thr;
const float maxdE = 5.f + MAXSCOPE * varsens * (1 + 0.1f * lp.thr); const float maxdE = 5.f + MAXSCOPE * varsens * (1 + 0.1f * lp.thr);
@ -3587,7 +3739,8 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct
origblur->b[y][x] = 0.01f; origblur->b[y][x] = 0.01f;
} }
float dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL)); // float dE = sqrt(kab * SQR(refa - origblur->a[y][x] / 327.68f) + kab * SQR(refb - origblur->b[y][x] / 327.68f) + kL * SQR(lumaref - rL));
float dE = sqrt(kab * SQR(refa - maskptr->a[y][x] / 327.68f) + kab * SQR(refb - maskptr->b[y][x] / 327.68f) + kL * SQR(lumaref - maskptr->L[y][x] / 327.68f));
float reducdE = 0.f; float reducdE = 0.f;
calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, varsens, reducdE); calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, varsens, reducdE);
@ -3755,7 +3908,6 @@ void ImProcFunctions::InverseColorLight_Local(int sp, int senstype, const struct
} }
} }
} }
delete origblur;
if (senstype == 1 || senstype == 2) { if (senstype == 1 || senstype == 2) {
delete temp; delete temp;
@ -3772,7 +3924,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform
if (params->locallab.enabled) { if (params->locallab.enabled) {
//always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise //always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise
struct local_params lp; struct local_params lp;
calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0, 0, 0, 0, 0); calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0, 0, 0, 0, 0, 0);
int begy = lp.yc - lp.lyT; int begy = lp.yc - lp.lyT;
int begx = lp.xc - lp.lxL; int begx = lp.xc - lp.lxL;
int yEn = lp.yc + lp.ly; int yEn = lp.yc + lp.ly;
@ -5099,7 +5251,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
const LocCCmasktmCurve & locccmastmCurve, bool & lcmastmutili, const LocLLmasktmCurve & locllmastmCurve, bool & llmastmutili, const LocHHmasktmCurve & lochhmastmCurve, bool & lhmastmutili, const LocCCmasktmCurve & locccmastmCurve, bool & lcmastmutili, const LocLLmasktmCurve & locllmastmCurve, bool & llmastmutili, const LocHHmasktmCurve & lochhmastmCurve, bool & lhmastmutili,
const LocCCmaskblCurve & locccmasblCurve, bool & lcmasblutili, const LocLLmaskblCurve & locllmasblCurve, bool & llmasblutili, const LocHHmaskblCurve & lochhmasblCurve, bool & lhmasblutili, const LocCCmaskblCurve & locccmasblCurve, bool & lcmasblutili, const LocLLmaskblCurve & locllmasblCurve, bool & llmasblutili, const LocHHmaskblCurve & lochhmasblCurve, bool & lhmasblutili,
const LocwavCurve & locwavCurve, const LocwavCurve & locwavCurve,
bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, int llColorMask, bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double & chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, int llColorMask, int llColorMaskinv,
int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask) int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask)
{ {
/* comment on processus deltaE /* comment on processus deltaE
@ -5130,7 +5282,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
int del = 3; // to avoid crash with [loy - begy] and [lox - begx] and bfh bfw // with gtk2 [loy - begy-1] [lox - begx -1 ] and del = 1 int del = 3; // to avoid crash with [loy - begy] and [lox - begx] and bfh bfw // with gtk2 [loy - begy-1] [lox - begx -1 ] and del = 1
struct local_params lp; struct local_params lp;
calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask, llSHMask, llcbMask, llretiMask, llsoftMask, lltmMask, llblMask); calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llColorMaskinv, llExpMask, llSHMask, llcbMask, llretiMask, llsoftMask, lltmMask, llblMask);
const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip
int strred = 1;//(lp.strucc - 1); int strred = 1;//(lp.strucc - 1);
@ -7327,7 +7479,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
} else if (lp.invsh && (lp.highlihs > 0.f || lp.shadowhs > 0.f) && call < 3 && lp.hsena) { } else if (lp.invsh && (lp.highlihs > 0.f || lp.shadowhs > 0.f) && call < 3 && lp.hsena) {
float adjustr = 2.f; float adjustr = 2.f;
InverseColorLight_Local(sp, 2, lp, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk); InverseColorLight_Local(sp, 2, lp, nullptr, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk);
} }
@ -8774,7 +8926,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
//inverse //inverse
else if (lp.invex && (lp.expcomp != 0.0 || lp.war != 0 || (exlocalcurve && localexutili)) && lp.exposena) { else if (lp.invex && (lp.expcomp != 0.0 || lp.war != 0 || (exlocalcurve && localexutili)) && lp.exposena) {
float adjustr = 2.f; float adjustr = 2.f;
InverseColorLight_Local(sp, 1, lp, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk); InverseColorLight_Local(sp, 1, lp, nullptr, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk);
} }
@ -8939,148 +9091,71 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
for (int y = ystart; y < yend ; y++) { for (int y = ystart; y < yend ; y++) {
for (int x = xstart; x < xend; x++) { for (int x = xstart; x < xend; x++) {
transformed->L[y][x] = blend2[y - ystart][x - xstart]; const int lox = cx + x;
const int loy = cy + y;
int zone = 0;
float localFactor = 1.f;
const float achm = lp.trans / 100.f;
if (lp.shapmet == 0) {
calcTransition(lox, loy, achm, lp, zone, localFactor);
} else if (lp.shapmet == 1) {
calcTransitionrect(lox, loy, achm, lp, zone, localFactor);
}
if (zone > 0) {
transformed->L[y][x] = CLIP(blend2[y - ystart][x - xstart]);
transformed->a[y][x] = 0.f; transformed->a[y][x] = 0.f;
transformed->b[y][x] = 0.f; transformed->b[y][x] = 0.f;
} }
} }
}
return; return;
} }
} }
array2D<float> ble(bfw, bfh); int inv = 0;
array2D<float> guid(bfw, bfh); bool showmaske = false;
float meanfab, fab; bool enaMask = false;
bool deltaE = false;
bool modmask = false;
bool zero = false;
bool modif = false;
mean_fab(xstart, ystart, bfw, bfh, bufcolorig.get(), original, fab, meanfab, lp.chromacol); if (lp.showmaskcolmet == 3) {
showmaske = true;
if (lp.showmaskcolmet == 2 || lp.enaColorMask || lp.showmaskcolmet == 3 || lp.showmaskcolmet == 5) {
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int y = 0; y < bfh; y++) {
for (int x = 0; x < bfw; x++) {
bufmaskblurcol->L[y][x] = original->L[y + ystart][x + xstart];
bufmaskblurcol->a[y][x] = original->a[y + ystart][x + xstart];
bufmaskblurcol->b[y][x] = original->b[y + ystart][x + xstart];
}
} }
#ifdef _OPENMP if (lp.enaColorMask) {
#pragma omp parallel enaMask = true;
#endif
{
#ifdef __SSE2__
float atan2Buffer[bfw] ALIGNED64;
#endif
#ifdef _OPENMP
#pragma omp for schedule(dynamic, 16)
#endif
for (int ir = 0; ir < bfh; ir++) {
#ifdef __SSE2__
if (lochhmasCurve && lhmasutili) {
int i = 0;
for (; i < bfw - 3; i += 4) {
STVF(atan2Buffer[i], xatan2f(LVFU(bufcolorig->b[ir][i]), LVFU(bufcolorig->a[ir][i])));
} }
for (; i < bfw; i++) { if (lp.showmaskcolmet == 5) {
atan2Buffer[i] = xatan2f(bufcolorig->b[ir][i], bufcolorig->a[ir][i]); deltaE = true;
}
} }
#endif if (lp.showmaskcolmet == 2) {
modmask = true;
for (int jr = 0; jr < bfw; jr++) {
float kmaskL = 0.f;
float kmaskC = 0.f;
float kmaskHL = 0.f;
float kmaskH = 0.f;
if (locllmasCurve && llmasutili) {
kmaskL = 32768.f * LIM01(1.f - locllmasCurve[(500.f / 32768.f) * bufcolorig->L[ir][jr]]);
} }
if (lp.showmaskcolmet != 5 && locccmasCurve && lcmasutili) { if (lp.showmaskcolmet == 1) {
kmaskC = LIM01(1.f - locccmasCurve[500.f * (0.0001f + sqrt(SQR(bufcolorig->a[ir][jr]) + SQR(bufcolorig->b[ir][jr])) / fab)]); modif = true;
} }
if (lochhmasCurve && lhmasutili) { if (lp.showmaskcolmet == 0) {
#ifdef __SSE2__ zero = true;
const float huema = atan2Buffer[jr];
#else
const float huema = xatan2f(bufcolorig->b[ir][jr], bufcolorig->a[ir][jr]);
#endif
float h = Color::huelab_to_huehsv2(huema);
h += 1.f / 6.f;
if (h > 1.f) {
h -= 1.f;
} }
const float valHH = LIM01(1.f - lochhmasCurve[500.f * h]); maskcalccol(bfw, bfh, xstart, ystart, sk, cx, cy, bufcolorig.get(), bufmaskblurcol.get(), originalmaskcol.get(), original, transformed, inv, lp,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, multiThread,
enaMask, showmaske, deltaE, modmask, zero, modif);
if (lp.showmaskcolmet != 5) { if (lp.showmaskcolmet == 3) {
kmaskH = valHH;
}
kmaskHL = 32768.f * valHH;
}
bufmaskblurcol->L[ir][jr] = CLIPLOC(kmaskL + kmaskHL);
bufmaskblurcol->a[ir][jr] = CLIPC(kmaskC + kmaskH);
bufmaskblurcol->b[ir][jr] = CLIPC(kmaskC + kmaskH);
ble[ir][jr] = bufmaskblurcol->L[ir][jr] / 32768.f;
guid[ir][jr] = bufcolorig->L[ir][jr] / 32768.f;
}
}
}
if (lp.radmacol > 0.f) {
guidedFilter(guid, ble, ble, lp.radmacol * 10.f / sk, 0.001, multiThread, 4);
}
LUTf lutTonemaskexp(65536);
calcGammaLut(lp.gammacol, lp.slomacol, lutTonemaskexp);
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int ir = 0; ir < bfh; ir++) {
for (int jr = 0; jr < bfw; jr++) {
bufmaskblurcol->L[ir][jr] = lutTonemaskexp[LIM01(ble[ir][jr]) * 65536.f];
}
}
}
const float radiusb = 1.f / sk;
if (lp.showmaskcolmet == 2 || lp.enaColorMask || lp.showmaskcolmet == 3 || lp.showmaskcolmet == 5) {
#ifdef _OPENMP
#pragma omp parallel
#endif
{
gaussianBlur(bufmaskblurcol->L, bufmaskblurcol->L, bfw, bfh, radiusb);
gaussianBlur(bufmaskblurcol->a, bufmaskblurcol->a, bfw, bfh, 1.f + (0.5f * lp.radmacol) / sk);
gaussianBlur(bufmaskblurcol->b, bufmaskblurcol->b, bfw, bfh, 1.f + (0.5f * lp.radmacol) / sk);
}
if (lp.showmaskcolmet == 0 || lp.showmaskcolmet == 1 || lp.showmaskcolmet == 2 || lp.showmaskcolmet == 4 || lp.showmaskcolmet == 5 || lp.enaColorMask) {
originalmaskcol->CopyFrom(transformed);
blendmask(lp, xstart, ystart, cx, cy, bfw, bfh, bufcolorig.get(), original, bufmaskblurcol.get(), originalmaskcol.get(), lp.blendmacol, 0);
} else if (lp.showmaskcolmet == 3) {
showmask(lp, xstart, ystart, cx, cy, bfw, bfh, bufcolorig.get(), transformed, bufmaskblurcol.get(), 0); showmask(lp, xstart, ystart, cx, cy, bfw, bfh, bufcolorig.get(), transformed, bufmaskblurcol.get(), 0);
return; return;
}
} }
if (lp.showmaskcolmet == 4) { if (lp.showmaskcolmet == 4) {
@ -9225,7 +9300,63 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
adjustr = 1.8f; adjustr = 1.8f;
} }
InverseColorLight_Local(sp, 0, lp, lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk); std::unique_ptr<LabImage> bufmaskblurcol;
std::unique_ptr<LabImage> originalmaskcol;
std::unique_ptr<LabImage> bufcolorig;
int GW = transformed->W;
int GH = transformed->H;
bufcolorig.reset(new LabImage(GW, GH));
if (lp.enaColorMaskinv || lp.showmaskcolmetinv == 1) {
bufmaskblurcol.reset(new LabImage(GW, GH, true));
originalmaskcol.reset(new LabImage(GW, GH));
}
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int y = 0; y < GH ; y++) {
for (int x = 0; x < GW; x++) {
bufcolorig->L[y][x] = original->L[y][x];
}
}
int inv = 1;
bool showmaske = false;
bool enaMask = false;
bool deltaE = false;
bool modmask = false;
bool zero = false;
bool modif = false;
// printf("showmaskcolmetinv=%i\n", lp.showmaskcolmetinv);
if (lp.showmaskcolmetinv == 1) {
showmaske = true;
}
if (lp.enaColorMaskinv) {
enaMask = true;
}
if (lp.showmaskcolmetinv == 0) {
zero = true;
}
maskcalccol(GW, GH, 0, 0, sk, cx, cy, bufcolorig.get(), bufmaskblurcol.get(), originalmaskcol.get(), original, transformed, inv, lp,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, multiThread,
enaMask, showmaske, deltaE, modmask, zero, modif);
if (lp.showmaskcolmetinv == 1) {
showmask(lp, 0, 0, cx, cy, GW, GH, bufcolorig.get(), transformed, bufmaskblurcol.get(), inv);
return;
}
if (lp.showmaskcolmetinv == 0 || lp.enaColorMaskinv) {
InverseColorLight_Local(sp, 0, lp, originalmaskcol.get(), lightCurveloc, hltonecurveloc, shtonecurveloc, tonecurveloc, exlocalcurve, cclocalcurve, adjustr, localcutili, lllocalcurve, locallutili, original, transformed, cx, cy, hueref, chromaref, lumaref, sk);
}
} }
// Gamut and Munsell control - very important do not desactivated to avoid crash // Gamut and Munsell control - very important do not desactivated to avoid crash

View File

@ -761,6 +761,7 @@ enum ProcEventCode {
Evlocallabitera = 731, Evlocallabitera = 731,
Evlocallabguidbl = 732, Evlocallabguidbl = 732,
Evlocallabepsbl = 733, Evlocallabepsbl = 733,
EvlocallabshowmaskcolMethodinv = 734,
NUMOFEVENTS NUMOFEVENTS
}; };

View File

@ -760,7 +760,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, // EvlocallabmedMethod LUMINANCECURVE, // EvlocallabmedMethod
LUMINANCECURVE, // Evlocallabitera LUMINANCECURVE, // Evlocallabitera
LUMINANCECURVE, // Evlocallabguidbl LUMINANCECURVE, // Evlocallabguidbl
LUMINANCECURVE // Evlocallabepsbl LUMINANCECURVE, // Evlocallabepsbl
LUMINANCECURVE // EvlocallabshowmaskcolMethodinv
}; };

View File

@ -507,7 +507,7 @@ public:
virtual void updateUnLock() = 0; virtual void updateUnLock() = 0;
virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask, int locallblMask) = 0; virtual void setLocallabMaskVisibility(int locallColorMask, int locallColorMaskinv, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask, int locallblMask) = 0;
/** Creates and returns a Crop instance that acts as a window on the image /** Creates and returns a Crop instance that acts as a window on the image
* @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber * @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber

View File

@ -1217,7 +1217,7 @@ private:
locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili,
locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili,
locwavCurve, locwavCurve,
LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0); LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// Clear local curves // Clear local curves

View File

@ -361,6 +361,7 @@ Locallab::Locallab():
qualitycurveMethod(Gtk::manage(new MyComboBoxText())), qualitycurveMethod(Gtk::manage(new MyComboBoxText())),
gridMethod(Gtk::manage(new MyComboBoxText())), gridMethod(Gtk::manage(new MyComboBoxText())),
showmaskcolMethod(Gtk::manage(new MyComboBoxText())), showmaskcolMethod(Gtk::manage(new MyComboBoxText())),
showmaskcolMethodinv(Gtk::manage(new MyComboBoxText())),
//Exposure //Exposure
showmaskexpMethod(Gtk::manage(new MyComboBoxText())), showmaskexpMethod(Gtk::manage(new MyComboBoxText())),
expMethod(Gtk::manage(new MyComboBoxText())), expMethod(Gtk::manage(new MyComboBoxText())),
@ -556,6 +557,18 @@ Locallab::Locallab():
showmaskcolMethodConn = showmaskcolMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskcolMethodChanged)); showmaskcolMethodConn = showmaskcolMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskcolMethodChanged));
showmaskcolMethodinv->append(M("TP_LOCALLAB_SHOWMNONE"));
showmaskcolMethodinv->append(M("TP_LOCALLAB_SHOWMASK"));
showmaskcolMethodinv->set_active(0);
if (showtooltip) {
showmaskcolMethodinv->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP"));
}
showmaskcolMethodConninv = showmaskcolMethodinv->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskcolMethodChangedinv));
enaColorMaskConn = enaColorMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaColorMaskChanged)); enaColorMaskConn = enaColorMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaColorMaskChanged));
maskCurveEditorG->setCurveListener(this); maskCurveEditorG->setCurveListener(this);
@ -629,6 +642,7 @@ Locallab::Locallab():
colorBox->pack_start(*invers); colorBox->pack_start(*invers);
ToolParamBlock* const maskcolBox = Gtk::manage(new ToolParamBlock()); ToolParamBlock* const maskcolBox = Gtk::manage(new ToolParamBlock());
maskcolBox->pack_start(*showmaskcolMethod, Gtk::PACK_SHRINK, 4); maskcolBox->pack_start(*showmaskcolMethod, Gtk::PACK_SHRINK, 4);
maskcolBox->pack_start(*showmaskcolMethodinv, Gtk::PACK_SHRINK, 4);
maskcolBox->pack_start(*enaColorMask, Gtk::PACK_SHRINK, 0); maskcolBox->pack_start(*enaColorMask, Gtk::PACK_SHRINK, 0);
maskcolBox->pack_start(*maskCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor maskcolBox->pack_start(*maskCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor
maskcolBox->pack_start(*blendmaskcol, Gtk::PACK_SHRINK, 0); maskcolBox->pack_start(*blendmaskcol, Gtk::PACK_SHRINK, 0);
@ -3949,12 +3963,35 @@ void Locallab::showmaskcolMethodChanged()
} }
} }
void Locallab::showmaskcolMethodChangedinv()
{
// printf("showmaskcolMethodChanged\n");
// When one mask state is changed, other masks are deactivated
disableListener();
showmaskcolMethod->set_active(0);
showmaskexpMethod->set_active(0);
showmaskSHMethod->set_active(0);
showmaskcbMethod->set_active(0);
showmaskretiMethod->set_active(0);
showmasksoftMethod->set_active(0);
showmasktmMethod->set_active(0);
showmaskblMethod->set_active(0);
enableListener();
if (listener) {
listener->panelChanged(EvlocallabshowmaskcolMethodinv, "");
}
}
void Locallab::showmaskexpMethodChanged() void Locallab::showmaskexpMethodChanged()
{ {
// printf("showmaskexpMethodChanged\n"); // printf("showmaskexpMethodChanged\n");
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskcbMethod->set_active(0); showmaskcbMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
@ -4002,6 +4039,7 @@ void Locallab::showmaskSHMethodChanged()
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
showmaskcbMethod->set_active(0); showmaskcbMethod->set_active(0);
@ -4022,6 +4060,7 @@ void Locallab::showmaskcbMethodChanged()
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
@ -4042,6 +4081,7 @@ void Locallab::showmaskblMethodChanged()
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
@ -4064,6 +4104,7 @@ void Locallab::showmasktmMethodChanged()
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
@ -4084,6 +4125,7 @@ void Locallab::showmaskretiMethodChanged()
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
@ -4103,6 +4145,7 @@ void Locallab::showmasksoftMethodChanged()
// When one mask state is changed, other masks are deactivated // When one mask state is changed, other masks are deactivated
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
@ -4121,6 +4164,7 @@ void Locallab::resetMaskVisibility()
// printf("resetMaskVisibility\n"); // printf("resetMaskVisibility\n");
disableListener(); disableListener();
showmaskcolMethodinv->set_active(0);
showmaskcolMethod->set_active(0); showmaskcolMethod->set_active(0);
showmaskexpMethod->set_active(0); showmaskexpMethod->set_active(0);
showmaskSHMethod->set_active(0); showmaskSHMethod->set_active(0);
@ -4134,6 +4178,7 @@ void Locallab::resetMaskVisibility()
Locallab::llMaskVisibility* Locallab::getMaskVisibility() Locallab::llMaskVisibility* Locallab::getMaskVisibility()
{ {
llMaskVisibility* maskStruct = new llMaskVisibility(); llMaskVisibility* maskStruct = new llMaskVisibility();
maskStruct->colorMaskinv = showmaskcolMethodinv->get_active_row_number();
maskStruct->colorMask = showmaskcolMethod->get_active_row_number(); maskStruct->colorMask = showmaskcolMethod->get_active_row_number();
maskStruct->expMask = showmaskexpMethod->get_active_row_number(); maskStruct->expMask = showmaskexpMethod->get_active_row_number();
maskStruct->SHMask = showmaskSHMethod->get_active_row_number(); maskStruct->SHMask = showmaskSHMethod->get_active_row_number();
@ -4366,8 +4411,9 @@ void Locallab::inversChanged()
strengthgrid->hide(); strengthgrid->hide();
blurcolde->show(); blurcolde->show();
softradiuscol->show(); softradiuscol->show();
showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode showmaskcolMethod->show(); // Being able to change Color & Light mask visibility is useless in batch mode
gridFrame->hide(); gridFrame->hide();
showmaskcolMethodinv->hide(); // Being able to change Color & Light mask visibility is useless in batch mode
} else if (invers->get_active()) { } else if (invers->get_active()) {
sensi->show(); sensi->show();
llCurveEditorG->show(); llCurveEditorG->show();
@ -4375,13 +4421,14 @@ void Locallab::inversChanged()
curvactiv->hide(); curvactiv->hide();
qualitycurveMethod->hide(); qualitycurveMethod->hide();
labqualcurv->hide(); labqualcurv->hide();
expmaskcol->hide(); expmaskcol->show();
structcol->hide(); structcol->hide();
blurcolde->show(); blurcolde->show();
gridFrame->hide(); gridFrame->hide();
strengthgrid->hide(); strengthgrid->hide();
softradiuscol->hide(); softradiuscol->hide();
showmaskcolMethod->hide();
showmaskcolMethodinv->show();
} else { } else {
sensi->show(); sensi->show();
llCurveEditorG->show(); llCurveEditorG->show();
@ -4394,9 +4441,12 @@ void Locallab::inversChanged()
blurcolde->show(); blurcolde->show();
gridFrame->show(); gridFrame->show();
softradiuscol->show(); softradiuscol->show();
showmaskcolMethodinv->hide();
showmaskcolMethod->show();
if (batchMode) { if (batchMode) {
showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode
showmaskcolMethodinv->hide(); // Being able to change Color & Light mask visibility is useless in batch mode
} }
} }
@ -6402,6 +6452,7 @@ void Locallab::setBatchMode(bool batchMode)
// In batch mode, being able to change mask visibility is useless // In batch mode, being able to change mask visibility is useless
showmaskcolMethod->hide(); showmaskcolMethod->hide();
showmaskcolMethodinv->hide();
showmaskexpMethod->hide(); showmaskexpMethod->hide();
showmaskSHMethod->hide(); showmaskSHMethod->hide();
showmaskcbMethod->hide(); showmaskcbMethod->hide();
@ -6550,6 +6601,7 @@ void Locallab::enableListener()
gridMethodConn.block(false); gridMethodConn.block(false);
inversConn.block(false); inversConn.block(false);
showmaskcolMethodConn.block(false); showmaskcolMethodConn.block(false);
showmaskcolMethodConninv.block(false);
enaColorMaskConn.block(false); enaColorMaskConn.block(false);
// Exposure // Exposure
enableexposeConn.block(false); enableexposeConn.block(false);
@ -6620,6 +6672,7 @@ void Locallab::disableListener()
gridMethodConn.block(true); gridMethodConn.block(true);
inversConn.block(true); inversConn.block(true);
showmaskcolMethodConn.block(true); showmaskcolMethodConn.block(true);
showmaskcolMethodConninv.block(true);
enaColorMaskConn.block(true); enaColorMaskConn.block(true);
// Exposure // Exposure
enableexposeConn.block(true); enableexposeConn.block(true);
@ -7309,16 +7362,19 @@ void Locallab::updateSpecificGUIState()
expmaskcol->show(); expmaskcol->show();
structcol->show(); structcol->show();
softradiuscol->show(); softradiuscol->show();
showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode showmaskcolMethod->show(); // Being able to change Color & Light mask visibility is useless in batch mode
showmaskcolMethodinv->hide();
gridFrame->hide(); gridFrame->hide();
} else if (invers->get_active()) { } else if (invers->get_active()) {
HCurveEditorG->hide(); HCurveEditorG->hide();
qualitycurveMethod->hide(); qualitycurveMethod->hide();
labqualcurv->hide(); labqualcurv->hide();
expmaskcol->hide(); expmaskcol->show();
softradiuscol->hide(); softradiuscol->hide();
structcol->hide(); structcol->hide();
gridFrame->hide(); gridFrame->hide();
showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode
showmaskcolMethodinv->show();
} else { } else {
HCurveEditorG->show(); HCurveEditorG->show();
qualitycurveMethod->show(); qualitycurveMethod->show();
@ -7327,9 +7383,12 @@ void Locallab::updateSpecificGUIState()
structcol->show(); structcol->show();
gridFrame->show(); gridFrame->show();
softradiuscol->show(); softradiuscol->show();
showmaskcolMethod->show(); // Being able to change Color & Light mask visibility is useless in batch mode
showmaskcolMethodinv->hide();
if (batchMode) { if (batchMode) {
showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode showmaskcolMethod->hide(); // Being able to change Color & Light mask visibility is useless in batch mode
showmaskcolMethodinv->hide(); // Being able to change Color & Light mask visibility is useless in batch mode
} }
} }

View File

@ -332,6 +332,8 @@ private:
sigc::connection gridMethodConn; sigc::connection gridMethodConn;
MyComboBoxText* const showmaskcolMethod; MyComboBoxText* const showmaskcolMethod;
sigc::connection showmaskcolMethodConn; sigc::connection showmaskcolMethodConn;
MyComboBoxText* const showmaskcolMethodinv;
sigc::connection showmaskcolMethodConninv;
//Exposure //Exposure
MyComboBoxText* const showmaskexpMethod; MyComboBoxText* const showmaskexpMethod;
sigc::connection showmaskexpMethodConn; sigc::connection showmaskexpMethodConn;
@ -443,6 +445,7 @@ private:
void qualitycurveMethodChanged(); void qualitycurveMethodChanged();
void gridMethodChanged(); void gridMethodChanged();
void showmaskcolMethodChanged(); void showmaskcolMethodChanged();
void showmaskcolMethodChangedinv();
//Exposure //Exposure
void showmaskexpMethodChanged(); void showmaskexpMethodChanged();
void expMethodChanged(); void expMethodChanged();
@ -498,6 +501,7 @@ public:
// Mask visibility management functions // Mask visibility management functions
struct llMaskVisibility { struct llMaskVisibility {
int colorMask; int colorMask;
int colorMaskinv;
int expMask; int expMask;
int SHMask; int SHMask;
int cbMask; int cbMask;

View File

@ -474,10 +474,10 @@ void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const
} }
// Manage Locallab mask visibility // Manage Locallab mask visibility
if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskcolMethodinv ||event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod
|| event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod || event == rtengine::EvlocallabshowmasktmMethod || event == rtengine::EvlocallabshowmaskblMethod) { || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod || event == rtengine::EvlocallabshowmasktmMethod || event == rtengine::EvlocallabshowmaskblMethod) {
Locallab::llMaskVisibility* maskStruc = locallab->getMaskVisibility(); Locallab::llMaskVisibility* maskStruc = locallab->getMaskVisibility();
ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask, maskStruc->tmMask, maskStruc->blMask); ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->colorMaskinv, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask, maskStruc->tmMask, maskStruc->blMask);
} }
ipc->endUpdateParams(changeFlags); // starts the IPC processing ipc->endUpdateParams(changeFlags); // starts the IPC processing
@ -585,7 +585,7 @@ void ToolPanelCoordinator::profileChange(
// Reset Locallab mask visibility when a picture is loaded // Reset Locallab mask visibility when a picture is loaded
if (event == rtengine::EvPhotoLoaded) { if (event == rtengine::EvPhotoLoaded) {
locallab->resetMaskVisibility(); locallab->resetMaskVisibility();
ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0, 0, 0); ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0, 0, 0, 0);
} }
// start the IPC processing // start the IPC processing