Add contrast curve to mask 5 Retinex

This commit is contained in:
Desmis 2019-10-15 16:22:27 +02:00
parent 94bd0a7d60
commit edbfe1a1fd
16 changed files with 138 additions and 23 deletions

View File

@ -1011,6 +1011,7 @@ HISTORY_MSG_770;Local - Color Mask contrast curve
HISTORY_MSG_771;Local - Exp Mask contrast curve
HISTORY_MSG_772;Local - SH Mask contrast curve
HISTORY_MSG_773;Local - TM Mask contrast curve
HISTORY_MSG_774;Local - Reti Mask contrast curve
HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors
HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction
HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction

View File

@ -890,10 +890,12 @@ void Crop::update(int todo)
bool localmaskexputili = parent->localmaskexputili;
bool localmaskSHutili = parent->localmaskSHutili;
bool localmasktmutili = parent->localmasktmutili;
bool localmaskretiutili = parent->localmaskretiutili;
LUTf lmasklocalcurve2(65536, 0);
LUTf lmaskexplocalcurve2(65536, 0);
LUTf lmaskSHlocalcurve2(65536, 0);
LUTf lmasktmlocalcurve2(65536, 0);
LUTf lmaskretilocalcurve2(65536, 0);
LUTf hltonecurveloc2(65536, 0); //65536
LUTf shtonecurveloc2(65536, 0);
LUTf tonecurveloc2(65536, 0);
@ -1001,6 +1003,8 @@ void Crop::update(int todo)
CurveFactory::curvemaskLocal(localmaskSHutili, params.locallab.spots.at(sp).LmaskSHcurve, lmaskSHlocalcurve2, sca);
localmasktmutili = false;
CurveFactory::curvemaskLocal(localmasktmutili, params.locallab.spots.at(sp).Lmasktmcurve, lmasktmlocalcurve2, sca);
localmaskretiutili = false;
CurveFactory::curvemaskLocal(localmaskretiutili, params.locallab.spots.at(sp).Lmaskreticurve, lmaskretilocalcurve2, sca);
double ecomp = params.locallab.spots.at(sp).expcomp;
@ -1043,6 +1047,7 @@ void Crop::update(int todo)
lmaskexplocalcurve2, localmaskexputili,
lmaskSHlocalcurve2, localmaskSHutili,
lmasktmlocalcurve2, localmasktmutili,
lmaskretilocalcurve2, localmaskretiutili,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
@ -1064,6 +1069,7 @@ void Crop::update(int todo)
lmaskexplocalcurve2, localmaskexputili,
lmaskSHlocalcurve2, localmaskSHutili,
lmasktmlocalcurve2, localmasktmutili,
lmaskretilocalcurve2, localmaskretiutili,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
@ -1083,6 +1089,7 @@ void Crop::update(int todo)
lmaskexplocalcurve2.clear();
lmaskSHlocalcurve2.clear();
lmasktmlocalcurve2.clear();
lmaskretilocalcurve2.clear();
hltonecurveloc2.clear();
shtonecurveloc2.clear();
tonecurveloc2.clear();

View File

@ -175,6 +175,7 @@ ImProcCoordinator::ImProcCoordinator() :
lmaskexplocalcurve(65536, 0),
lmaskSHlocalcurve(65536, 0),
lmasktmlocalcurve(65536, 0),
lmaskretilocalcurve(65536, 0),
locallutili(false),
localcutili(false),
localexutili(false),
@ -185,6 +186,7 @@ ImProcCoordinator::ImProcCoordinator() :
localmaskexputili(false),
localmaskSHutili(false),
localmasktmutili(false),
localmaskretiutili(false),
lcmasexputili(false),
lhmasexputili(false),
llmasexputili(false),
@ -929,6 +931,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
localmaskexputili = false;
localmaskSHutili = false;
localmasktmutili = false;
localmaskretiutili = false;
lcmasSHutili = false;
lhmasSHutili = false;
llmasSHutili = false;
@ -980,6 +983,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
CurveFactory::curvemaskLocal(localmaskexputili, params->locallab.spots.at(sp).Lmaskexpcurve, lmaskexplocalcurve, sca);
CurveFactory::curvemaskLocal(localmaskSHutili, params->locallab.spots.at(sp).LmaskSHcurve, lmaskSHlocalcurve, sca);
CurveFactory::curvemaskLocal(localmasktmutili, params->locallab.spots.at(sp).Lmasktmcurve, lmasktmlocalcurve, sca);
CurveFactory::curvemaskLocal(localmaskretiutili, params->locallab.spots.at(sp).Lmaskreticurve, lmaskretilocalcurve, sca);
double ecomp = params->locallab.spots.at(sp).expcomp;
double black = params->locallab.spots.at(sp).black;
double hlcompr = params->locallab.spots.at(sp).hlcompr;
@ -1037,6 +1041,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
lmaskexplocalcurve, localmaskexputili,
lmaskSHlocalcurve, localmaskSHutili,
lmasktmlocalcurve, localmasktmutili,
lmaskretilocalcurve, localmaskretiutili,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
@ -1057,6 +1062,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
lmaskexplocalcurve, localmaskexputili,
lmaskSHlocalcurve, localmaskSHutili,
lmasktmlocalcurve, localmasktmutili,
lmaskretilocalcurve, localmaskretiutili,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
@ -1083,6 +1089,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
lmaskexplocalcurve.clear();
lmaskSHlocalcurve.clear();
lmasktmlocalcurve.clear();
lmaskretilocalcurve.clear();
hltonecurveloc.clear();
shtonecurveloc.clear();
tonecurveloc.clear();

View File

@ -237,6 +237,7 @@ protected:
LUTf lmaskexplocalcurve;
LUTf lmaskSHlocalcurve;
LUTf lmasktmlocalcurve;
LUTf lmaskretilocalcurve;
// LUTu lhist16loc;
LocretigainCurve locRETgainCurve;
LocretitransCurve locRETtransCurve;
@ -276,6 +277,7 @@ protected:
bool localmaskexputili;
bool localmaskSHutili;
bool localmasktmutili;
bool localmaskretiutili;
bool lcmasexputili;
bool lhmasexputili;
bool llmasexputili;

View File

@ -205,12 +205,22 @@ public:
void fftw_convol_blur(float *input, float *output, int bfw, int bfh, float radius, int fftkern, int algo);
void fftw_convol_blur2(float **input2, float **output2, int bfw, int bfh, float radius, int fftkern, int algo);
void fftw_tile_blur(int GW, int GH, int tilssize , int max_numblox_W, int min_numblox_W, float **tmp1, int numThreads, double radius);
void maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip, const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, bool retiMasktmap, bool retiMask,
float rad, float lap, bool pde, float gamm, float slop, float chro, float blend, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread);
void maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili,
int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread);
void filmGrain(Imagefloat *rgb, int isogr, int strengr, int scalegr, int bfw, int bfh);
void MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, 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,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, LabImage * transformed, bool retiMasktmap, bool retiMask);
void MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, float** templ, const float* const *originalLuminance,
const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve,
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,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
LabImage * transformed, bool retiMasktmap, bool retiMask);
void calc_ref(int sp, LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &chromarefblur, double &lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, float &avg);
void copy_ref(LabImage* spotbuffer, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot);
void paste_ref(LabImage* spotbuffer, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp);
@ -219,6 +229,7 @@ public:
LUTf & lmaskexplocalcurve, bool & localmaskexputili,
LUTf & lmaskSHlocalcurve, bool & localmaskSHutili,
LUTf & lmasktmlocalcurve, bool & localmasktmutili,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
const LocCCmaskCurve & locccmasCurve, bool & lcmasutili, const LocLLmaskCurve & locllmasCurve, bool & llmasutili, const LocHHmaskCurve & lochhmasCurve, bool & lhmasutili,
const LocCCmaskCurve & locccmasexpCurve, bool &lcmasexputili, const LocLLmaskCurve & locllmasexpCurve, bool &llmasexputili, const LocHHmaskCurve & lochhmasexpCurve, bool & lhmasexputili,
const LocCCmaskCurve & locccmasSHCurve, bool &lcmasSHutili, const LocLLmaskCurve & locllmasSHCurve, bool &llmasSHutili, const LocHHmaskCurve & lochhmasSHCurve, bool & lhmasSHutili,

View File

@ -6716,6 +6716,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
LUTf & lmaskexplocalcurve, bool & localmaskexputili,
LUTf & lmaskSHlocalcurve, bool & localmaskSHutili,
LUTf & lmasktmlocalcurve, bool & localmasktmutili,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
const LocCCmaskCurve & locccmasCurve, bool & lcmasutili, const LocLLmaskCurve & locllmasCurve, bool & llmasutili, const LocHHmaskCurve & lochhmasCurve, bool & lhmasutili,
const LocCCmaskCurve & locccmasexpCurve, bool & lcmasexputili, const LocLLmaskCurve & locllmasexpCurve, bool & llmasexputili, const LocHHmaskCurve & lochhmasexpCurve, bool & lhmasexputili,
const LocCCmaskCurve & locccmasSHCurve, bool & lcmasSHutili, const LocLLmaskCurve & locllmasSHCurve, bool & llmasSHutili, const LocHHmaskCurve & lochhmasSHCurve, bool & lhmasSHutili,
@ -9255,8 +9256,11 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
bool fftw = lp.ftwreti;
//fftw = false;
//for Retinex Mask are incorporated in MSR
ImProcFunctions::MSRLocal(sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1, Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask);
ImProcFunctions::MSRLocal(sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1,
Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask,
lmaskretilocalcurve, localmaskretiutili,
transformed, lp.enaretiMasktmap, lp.enaretiMask);
#ifdef _OPENMP
#pragma omp parallel for
#endif
@ -9383,8 +9387,11 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
bool fftw = false;
if (params->locallab.spots.at(sp).chrrt > 40.f) { //second step active Retinex Chroma
ImProcFunctions::MSRLocal(sp, fftw, 0, nullptr, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1, Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask);
ImProcFunctions::MSRLocal(sp, fftw, 0, nullptr, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1,
Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask,
lmaskretilocalcurve, localmaskretiutili,
transformed, lp.enaretiMasktmap, lp.enaretiMask);
}
if (!lp.invret && call == 1) {
@ -9760,8 +9767,11 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
bool fftw = lp.ftwreti;
//for Retinex Mask are incorporated in MSR
ImProcFunctions::MSRLocal(sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1, Wd, Hd, bfwr, bfhr, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask);
ImProcFunctions::MSRLocal(sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1,
Wd, Hd, bfwr, bfhr, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask,
lmaskretilocalcurve, localmaskretiutili,
transformed, lp.enaretiMasktmap, lp.enaretiMask);
#ifdef _OPENMP
#pragma omp parallel for
@ -9902,8 +9912,11 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
bool fftw = false;
if (params->locallab.spots.at(sp).chrrt > 40.f) { //second step active Retinex Chroma
ImProcFunctions::MSRLocal(sp, fftw, 0, nullptr, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1, Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask);
ImProcFunctions::MSRLocal(sp, fftw, 0, nullptr, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1,
Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask,
lmaskretilocalcurve, localmaskretiutili,
transformed, lp.enaretiMasktmap, lp.enaretiMask);
}
if (!lp.invret && call == 2) {

View File

@ -850,8 +850,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
}
void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip, const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, bool retiMasktmap, bool retiMask,
float rad, float lap, bool pde, float gamm, float slop, float chro, float blend, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread)
void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili,
int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread)
{
array2D<float> loctemp(W_L, H_L);
array2D<float> ble(W_L, H_L);
@ -952,6 +955,18 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo
bufmaskblurreti->L[ir][jr] = lutTonemaskreti[L_];
}
if (lmaskretilocalcurve && localmaskretiutili) {
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#endif
for (int ir = 0; ir < H_L; ir++)
for (int jr = 0; jr < W_L; jr++) {
bufmaskblurreti->L[ir][jr] = 0.5f * lmaskretilocalcurve[2.f * bufmaskblurreti->L[ir][jr]];
}
}
if (lap > 0.f) {
float *datain = new float[H_L * W_L];
float *data_tmp = new float[H_L * W_L];
@ -1079,8 +1094,14 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo
}
void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, int bfwr, int bfhr, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, 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,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, LabImage * transformed, bool retiMasktmap, bool retiMask)
void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, float** templ, const float* const *originalLuminance,
const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve,
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,
const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask,
LUTf & lmaskretilocalcurve, bool & localmaskretiutili,
LabImage * transformed, bool retiMasktmap, bool retiMask)
{
BENCHFUN
bool py = true;
@ -1611,8 +1632,11 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabI
if (lum == 1 && (llretiMask == 3 || llretiMask == 0 || llretiMask == 2 || llretiMask == 4)) { //only mask with luminance on last scale
int before = 1;
maskforretinex(sp, before, luminance, nullptr, W_L, H_L, skip, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, retiMasktmap, retiMask,
rad, lap, pde, gamm, slop, chro, blend, bufreti, bufmask, buforig, buforigmas, multiThread);
maskforretinex(sp, before, luminance, nullptr, W_L, H_L, skip,
locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, retiMasktmap, retiMask,
rad, lap, pde, gamm, slop, chro, blend,
lmaskretilocalcurve, localmaskretiutili,
bufreti, bufmask, buforig, buforigmas, multiThread);
}
//mask does not interfered with datas displayed

View File

@ -800,6 +800,7 @@ enum ProcEventCode {
EvlocallabLmaskexpshape = 770,
EvlocallabLmaskSHshape = 771,
EvlocallabLmasktmshape = 772,
EvlocallabLmaskretishape = 773,
NUMOFEVENTS
};

View File

@ -2626,6 +2626,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
limd(8.0),
cliptm(1.0),
fftwreti(false),
Lmaskreticurve{(double)DCT_NURBS, 0.0, 0.0, 1.0, 1.0},
// Sharpening
expsharp(false),
sharcontrast(20),
@ -2912,6 +2913,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
&& limd == other.limd
&& cliptm == other.cliptm
&& fftwreti == other.fftwreti
&& Lmaskreticurve == other.Lmaskreticurve
// Sharpening
&& expsharp == other.expsharp
&& sharcontrast == other.sharcontrast
@ -4184,6 +4186,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).limd, "Locallab", "Limd_" + std::to_string(i), spot.limd, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).cliptm, "Locallab", "Cliptm_" + std::to_string(i), spot.cliptm, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).fftwreti, "Locallab", "Fftwreti_" + std::to_string(i), spot.fftwreti, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).Lmaskreticurve, "Locallab", "LmaskretiCurve_" + std::to_string(i), spot.Lmaskreticurve, keyFile);
// Sharpening
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expsharp, "Locallab", "Expsharp_" + std::to_string(i), spot.expsharp, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sharcontrast, "Locallab", "Sharcontrast_" + std::to_string(i), spot.sharcontrast, keyFile);
@ -5583,6 +5586,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "Limd_" + std::to_string(i), pedited, spot.limd, spotEdited.limd);
assignFromKeyfile(keyFile, "Locallab", "Cliptm_" + std::to_string(i), pedited, spot.cliptm, spotEdited.cliptm);
assignFromKeyfile(keyFile, "Locallab", "Fftwreti_" + std::to_string(i), pedited, spot.fftwreti, spotEdited.fftwreti);
assignFromKeyfile(keyFile, "Locallab", "LmaskretiCurve_" + std::to_string(i), pedited, spot.Lmaskreticurve, spotEdited.Lmaskreticurve);
// Sharpening
assignFromKeyfile(keyFile, "Locallab", "Expsharp_" + std::to_string(i), pedited, spot.expsharp, spotEdited.expsharp);
assignFromKeyfile(keyFile, "Locallab", "Sharcontrast_" + std::to_string(i), pedited, spot.sharcontrast, spotEdited.sharcontrast);

View File

@ -1175,6 +1175,7 @@ struct LocallabParams {
double limd;
double cliptm;
bool fftwreti;
std::vector<double> Lmaskreticurve;
// Sharpening
bool expsharp;
int sharcontrast;

View File

@ -799,7 +799,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, //EvlocallabLmaskshape
LUMINANCECURVE, //EvlocallabLmaskexpshape
LUMINANCECURVE, //EvlocallabLmaskSHshape
LUMINANCECURVE //EvlocallabLmasktmshape
LUMINANCECURVE, //EvlocallabLmasktmshape
LUMINANCECURVE //EvlocallabLmaskretishape
};
namespace rtengine

View File

@ -1128,6 +1128,7 @@ private:
LUTf lmaskexplocalcurve(65536, 0);
LUTf lmaskSHlocalcurve(65536, 0);
LUTf lmasktmlocalcurve(65536, 0);
LUTf lmaskretilocalcurve(65536, 0);
// int maxspot = 1;
float** shbuffer = nullptr;
@ -1154,6 +1155,7 @@ private:
bool localmaskexputili = false;
bool localmaskSHutili = false;
bool localmasktmutili = false;
bool localmaskretiutili = false;
bool lcmasexputili = false;
bool lhmasexputili = false;
bool llmasexputili = false;
@ -1206,6 +1208,7 @@ private:
CurveFactory::curvemaskLocal(localmaskexputili, params.locallab.spots.at(sp).Lmaskexpcurve, lmaskexplocalcurve, 1);
CurveFactory::curvemaskLocal(localmaskSHutili, params.locallab.spots.at(sp).LmaskSHcurve, lmaskSHlocalcurve, 1);
CurveFactory::curvemaskLocal(localmasktmutili, params.locallab.spots.at(sp).Lmasktmcurve, lmasktmlocalcurve, 1);
CurveFactory::curvemaskLocal(localmaskretiutili, params.locallab.spots.at(sp).Lmaskreticurve, lmaskretilocalcurve, 1);
//provisory
double ecomp = params.locallab.spots.at(sp).expcomp;
double black = params.locallab.spots.at(sp).black;
@ -1244,6 +1247,7 @@ private:
lmaskexplocalcurve, localmaskexputili,
lmaskSHlocalcurve, localmaskSHutili,
lmasktmlocalcurve, localmasktmutili,
lmaskretilocalcurve, localmaskretiutili,
locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili,
locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili,
locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili,
@ -1264,6 +1268,8 @@ private:
lmasklocalcurve.clear();
lmaskexplocalcurve.clear();
lmaskSHlocalcurve.clear();
lmasktmlocalcurve.clear();
lmaskretilocalcurve.clear();
shtonecurveloc.clear();
tonecurveloc.clear();
lightCurveloc.clear();

View File

@ -175,6 +175,7 @@ Locallab::Locallab():
LocalcurveEditortransT(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONMAP"))),
LocalcurveEditorgainT(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONGAIN"))),
maskretiCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))),
mask2retiCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))),
//Local contrast
LocalcurveEditorwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAV"))),
@ -1366,10 +1367,7 @@ Locallab::Locallab():
Lmasktmshape->setBottomBarBgGradient(mLmasktmshape);
Lmasktmshape->setLeftBarBgGradient(mLmasktmshape);
mask2tmCurveEditorG->curveListComplete();
enatmMaskConn = enatmMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enatmMaskChanged));
enatmMaskaftConn = enatmMaskaft->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enatmMaskaftChanged));
@ -1594,6 +1592,22 @@ Locallab::Locallab():
HHmaskretishape->setBottomBarColorProvider(this, 6);
maskretiCurveEditorG->curveListComplete();
mask2retiCurveEditorG->setCurveListener(this);
Lmaskretishape = static_cast<DiagonalCurveEditor*>(mask2retiCurveEditorG->addCurve(CT_Diagonal, "L(L)"));
Lmaskretishape->setResetCurve(DiagonalCurveType(defSpot.Lmaskreticurve.at(0)), defSpot.Lmaskreticurve);
if (showtooltip) {
Lmaskretishape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP"));
}
std::vector<GradientMilestone> mLmaskretishape;
mLmaskretishape.push_back(GradientMilestone(0., 0., 0., 0.));
mLmaskretishape.push_back(GradientMilestone(1., 1., 1., 1.));
Lmaskretishape->setBottomBarBgGradient(mLmaskretishape);
Lmaskretishape->setLeftBarBgGradient(mLmaskretishape);
mask2retiCurveEditorG->curveListComplete();
enaretiMaskConn = enaretiMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaretiMaskChanged));
enaretiMasktmapConn = enaretiMasktmap->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaretiMasktmapChanged));
@ -1645,6 +1659,7 @@ Locallab::Locallab():
maskretiBox->pack_start(*chromaskreti, Gtk::PACK_SHRINK, 0);
maskretiBox->pack_start(*gammaskreti, Gtk::PACK_SHRINK, 0);
maskretiBox->pack_start(*slomaskreti, Gtk::PACK_SHRINK, 0);
maskretiBox->pack_start(*mask2retiCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor
expmaskreti->add(*maskretiBox, false);
ToolParamBlock* const auxBox = Gtk::manage(new ToolParamBlock());
@ -2299,6 +2314,7 @@ Locallab::~Locallab()
delete masktmCurveEditorG;
delete maskblCurveEditorG;
delete maskretiCurveEditorG;
delete mask2retiCurveEditorG;
delete maskcbCurveEditorG;
}
void Locallab::foldAllButMe(GdkEventButton* event, MyExpander *expander)
@ -3426,6 +3442,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.spots.at(pp->locallab.selspot).limd = limd->getValue();
pp->locallab.spots.at(pp->locallab.selspot).cliptm = cliptm->getValue();
pp->locallab.spots.at(pp->locallab.selspot).fftwreti = fftwreti->get_active();
pp->locallab.spots.at(pp->locallab.selspot).Lmaskreticurve = Lmaskretishape->getCurve();
// Sharpening
pp->locallab.spots.at(pp->locallab.selspot).expsharp = expsharp->getEnabled();
pp->locallab.spots.at(pp->locallab.selspot).sharcontrast = sharcontrast->getIntValue();
@ -3720,6 +3737,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pe->locallab.spots.at(pp->locallab.selspot).limd = pe->locallab.spots.at(pp->locallab.selspot).limd || limd->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).cliptm = pe->locallab.spots.at(pp->locallab.selspot).cliptm || cliptm->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).fftwreti = pe->locallab.spots.at(pp->locallab.selspot).fftwreti || !fftwreti->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).Lmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).Lmaskreticurve || !Lmaskretishape->isUnChanged();
// Sharpening
pe->locallab.spots.at(pp->locallab.selspot).expsharp = pe->locallab.spots.at(pp->locallab.selspot).expsharp || !expsharp->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).sharcontrast = pe->locallab.spots.at(pp->locallab.selspot).sharcontrast || sharcontrast->getEditedState();
@ -4012,6 +4030,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.spots.at(pp->locallab.selspot).limd = pedited->locallab.spots.at(pp->locallab.selspot).limd || limd->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).cliptm = pedited->locallab.spots.at(pp->locallab.selspot).cliptm || cliptm->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).fftwreti = pedited->locallab.spots.at(pp->locallab.selspot).fftwreti || !fftwreti->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).Lmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).Lmaskreticurve || !Lmaskretishape->isUnChanged();
// Sharpening
pedited->locallab.spots.at(pp->locallab.selspot).expsharp = pedited->locallab.spots.at(pp->locallab.selspot).expsharp || !expsharp->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).sharcontrast = pedited->locallab.spots.at(pp->locallab.selspot).sharcontrast || sharcontrast->getEditedState();
@ -4410,6 +4429,12 @@ void Locallab::curveChanged(CurveEditor* ce)
}
}
if (ce == Lmaskretishape) {
if (listener) {
listener->panelChanged(EvlocallabLmaskretishape, M("HISTORY_CUSTOMCURVE"));
}
}
}
// Local contrast
@ -8169,6 +8194,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
limd->setValue(pp->locallab.spots.at(index).limd);
cliptm->setValue(pp->locallab.spots.at(index).cliptm);
fftwreti->set_active(pp->locallab.spots.at(index).fftwreti);
Lmaskretishape->setCurve(pp->locallab.spots.at(index).Lmaskreticurve);
// Sharpening
expsharp->setEnabled(pp->locallab.spots.at(index).expsharp);
@ -8513,6 +8539,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
limd->setEditedState(spotState->limd ? Edited : UnEdited);
cliptm->setEditedState(spotState->cliptm ? Edited : UnEdited);
fftwreti->set_inconsistent(multiImage && !spotState->fftwreti);
Lmaskretishape->setUnChanged(!spotState->Lmaskreticurve);
// Sharpening
expsharp->set_inconsistent(!spotState->expsharp);

View File

@ -118,6 +118,8 @@ private:
CurveEditorGroup* const LocalcurveEditortransT;
CurveEditorGroup* const LocalcurveEditorgainT;
CurveEditorGroup* const maskretiCurveEditorG;
CurveEditorGroup* const mask2retiCurveEditorG;
DiagonalCurveEditor* Lmaskretishape;
FlatCurveEditor* cTtransshape;
FlatCurveEditor* cTgainshape;
FlatCurveEditor* CCmaskretishape;

View File

@ -1166,6 +1166,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.spots.at(j).limd = locallab.spots.at(j).limd && pSpot.limd == otherSpot.limd;
locallab.spots.at(j).cliptm = locallab.spots.at(j).cliptm && pSpot.cliptm == otherSpot.cliptm;
locallab.spots.at(j).fftwreti = locallab.spots.at(j).fftwreti && pSpot.fftwreti == otherSpot.fftwreti;
locallab.spots.at(j).Lmaskreticurve = locallab.spots.at(j).Lmaskreticurve && pSpot.Lmaskreticurve == otherSpot.Lmaskreticurve;
// Sharpening
locallab.spots.at(j).expsharp = locallab.spots.at(j).expsharp && pSpot.expsharp == otherSpot.expsharp;
locallab.spots.at(j).sharcontrast = locallab.spots.at(j).sharcontrast && pSpot.sharcontrast == otherSpot.sharcontrast;
@ -3535,6 +3536,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.spots.at(i).fftwreti = mods.locallab.spots.at(i).fftwreti;
}
if (locallab.spots.at(i).Lmaskreticurve) {
toEdit.locallab.spots.at(i).Lmaskreticurve = mods.locallab.spots.at(i).Lmaskreticurve;
}
// Sharpening
if (locallab.spots.at(i).expsharp) {
toEdit.locallab.spots.at(i).expsharp = mods.locallab.spots.at(i).expsharp;
@ -4954,6 +4959,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) :
limd(v),
cliptm(v),
fftwreti(v),
Lmaskreticurve(v),
// Sharpening
expsharp(v),
sharcontrast(v),
@ -5237,6 +5243,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v)
limd = v;
cliptm = v;
fftwreti = v;
Lmaskreticurve = v;
// Sharpening
expsharp = v;
sharcontrast = v;

View File

@ -585,6 +585,7 @@ public:
bool limd;
bool cliptm;
bool fftwreti;
bool Lmaskreticurve;
// Sharpening
bool expsharp;
bool sharcontrast;