Add simplified Scope to local denoise

This commit is contained in:
Desmis 2017-12-18 08:50:49 +01:00
parent db03c16f45
commit 7a826a586d
16 changed files with 460 additions and 109 deletions

View File

@ -841,6 +841,7 @@ HISTORY_MSG_591;Local - Spot Excluding struc
HISTORY_MSG_592;Local - Warm Cool
HISTORY_MSG_593;Local - Noise lum detail
HISTORY_MSG_594;Local - Noise chro detail
HISTORY_MSG_595;Local - Noise Scope
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b>
HISTORY_SNAPSHOT;Snapshot
@ -1844,6 +1845,7 @@ TP_LOCALLAB_CURVEEDITOR_TONES_TOOLTIP;L=f(L), can be used with L(H) in Color and
TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP;To be active, you must check button 'Enable curves'
TP_LOCALLAB_CURVEMETHOD_TOOLTIP;'Normal', the curve L=f(L) has the same algorithm than slider lightness.\n'Super' the curve L=f(L) has an new improved algorithm, which can leeds in some cases to artifacts.
TP_LOCALLAB_EXCLUF;Excluding
TP_LOCALLAB_SENSIDEN;Scope
TP_LOCALLAB_SENSIEXCLU;Scope
TP_LOCALLAB_SENSIEXCLU_TOOLTIP;Adjust color to include in exclusion!
TP_LOCALLAB_STRUC;Structure

View File

@ -1149,6 +1149,7 @@ void Crop::update(int todo)
params.locallab.warm = parent->warms[sp];
params.locallab.noiselumdetail = parent->noiselumdetails[sp];
params.locallab.noisechrodetail = parent->noisechrodetails[sp];
params.locallab.sensiden = parent->sensidens[sp];
std::vector<double> cretie;
@ -1238,14 +1239,14 @@ void Crop::update(int todo)
parent->lhist16, hltonecurveloc2, shtonecurveloc2, tonecurveloc2,
sca);
params.locallab.huerefblur = (parent->huerefblurs[sp]) / 100.f;
params.locallab.hueref = (parent->huerefs[sp]) / 100.f;
params.locallab.chromaref = parent->chromarefs[sp];
params.locallab.lumaref = parent->lumarefs[sp];
params.locallab.sobelref = parent->sobelrefs[sp];
parent->ipf.Lab_Local(1, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2,
loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
lllocalcurve2.clear();
cclocalcurve2.clear();
sklocalcurve2.clear();
@ -1530,6 +1531,7 @@ void Crop::update(int todo)
parent->warms[sp] = params.locallab.warm = parent->warms[0];
parent->noiselumdetails[sp] = params.locallab.noiselumdetail = parent->noiselumdetails[0];
parent->noisechrodetails[sp] = params.locallab.noisechrodetail = parent->noisechrodetails[0];
parent->sensidens[sp] = params.locallab.sensiden = parent->sensidens[0];
std::vector<double> ccret;
@ -1628,12 +1630,13 @@ void Crop::update(int todo)
parent->lhist16, hltonecurveloc2, shtonecurveloc2, tonecurveloc2,
sca);
params.locallab.huerefblur = (parent->huerefblurs[sp]) / 100.f;
params.locallab.hueref = (parent->huerefs[sp]) / 100.f;
params.locallab.chromaref = parent->chromarefs[sp];
params.locallab.lumaref = parent->lumarefs[sp];
params.locallab.sobelref = parent->sobelrefs[sp];
parent->ipf.Lab_Local(1, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, loclhCurve, lochhCurve,
LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
lllocalcurve2.clear();
cclocalcurve2.clear();
@ -1889,6 +1892,7 @@ void Crop::freeAll()
reservCrop = nullptr;
}
/* if (lablocCrop ) {
delete lablocCrop;
lablocCrop = NULL;
@ -2099,6 +2103,7 @@ bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool inter
reservCrop = new LabImage(cropw, croph);
/* if (lablocCrop) {
delete lablocCrop; // labnCrop can't be resized
}

View File

@ -157,6 +157,7 @@ ImProcCoordinator::ImProcCoordinator()
noiselumcs(500, -10000),
noiselumdetails(500, -10000),
noisechrodetails(500, -10000),
sensidens(500, -10000),
noisechrofs(500, -10000),
noisechrocs(500, -10000),
mult0s(500, -10000),
@ -203,11 +204,13 @@ ImProcCoordinator::ImProcCoordinator()
strucs(500, -1000),
warms(500, -1000),
huerefs(500, -100000.f),
huerefblurs(500, -100000.f),
chromarefs(500, -100000.f),
lumarefs(500, -100000.f),
sobelrefs(500, -100000.f),
huer(0),
huerblu(0),
chromar(0),
lumar(0),
sobeler(0),
@ -859,7 +862,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
};
int maxdata = 88;//87 10016 //86 10017 //85 10016;// 82 10015//78;//73 for 10011
int maxdata = 90;//88 10019//87 10018 //86 10017 //85 10016;// 82 10015//78;//73 for 10011
if (fic0) {
//find current version mip
@ -903,7 +906,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
//initilize newues when first utilisation of Locallab. Prepare creation of Mip files
for (int sp = 1; sp < maxspot; sp++) { // spots default
int t_sp = sp;
int t_mipversion = 10019;//new value for each change
int t_mipversion = 10020;//new value for each change
int t_circrad = 18;
int t_locX = 250;
int t_locY = 250;
@ -1028,6 +1031,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
int t_noiselumdetail = 0;
//10019
int t_noisechrodetail = 0;
//10019
int t_sensiden = 30;
//all variables except locRETgainCurve 'coomon for all)
fic << "Mipversion=" << t_mipversion << '@' << endl;
@ -1123,6 +1128,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
fic << "Warm=" << t_warm << '@' << endl;
fic << "Noiselumdetail=" << t_noiselumdetail << '@' << endl;
fic << "Noisechrodetail=" << t_noisechrodetail << '@' << endl;
fic << "Sensiden=" << t_sensiden << '@' << endl;
fic << "curveReti=" << t_curvret << '@' << endl;
fic << "curveLL=" << t_curvll << '@' << endl;
@ -1377,6 +1383,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
dataspot[81][0] = warms[0] = params.locallab.warm;
dataspot[82][0] = noiselumdetails[0] = params.locallab.noiselumdetail;
dataspot[83][0] = noisechrodetails[0] = params.locallab.noisechrodetail;
dataspot[84][0] = sensidens[0] = params.locallab.sensiden;
// for all curves work around - I do not know how to do with params curves...
//curve Reti local
@ -1671,6 +1678,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
maxind = 82;
}
if (versionmip == 10019) {
maxind = 83;
}
while (getline(fich, line)) {
spotline = line;
std::size_t pos = spotline.find("=");
@ -1904,6 +1915,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
}
}
if (versionmip <= 10019) {//
for (int sp = 1; sp < maxspot; sp++) { // spots default
dataspot[84][sp] = 30;
}
}
//here we change the number of spot
if (ns < (maxspot - 1)) {
@ -1912,7 +1929,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
for (int sp = ns + 1 ; sp < maxspot; sp++) { // spots default
int t_sp = sp;
int t_mipversion = 10019;
int t_mipversion = 10020;
int t_circrad = 18;
int t_locX = 250;
int t_locY = 250;
@ -2029,6 +2046,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
int t_noiselumdetail = 0;
//10019
int t_noisechrodetail = 0;
//10020
int t_sensiden = 30;
fic << "Mipversion=" << t_mipversion << '@' << endl;
fic << "Spot=" << t_sp << '@' << endl;
@ -2120,6 +2139,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
fic << "Warm=" << t_warm << '@' << endl;
fic << "Noiselumdetail=" << t_noiselumdetail << '@' << endl;
fic << "Noisechrodetail=" << t_noisechrodetail << '@' << endl;
fic << "Sensiden=" << t_sensiden << '@' << endl;
fic << "curveReti=" << t_curvret << '@' << endl;
fic << "curveLL=" << t_curvll << '@' << endl;
@ -2221,6 +2241,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
//main algorithm for all spots
for (int sp = 1; sp < maxspot; sp++) { //spots default
params.locallab.huerefblur = dataspot[maxdata - 5][sp] / 100.;
params.locallab.hueref = dataspot[maxdata - 4][sp] / 100.;
params.locallab.chromaref = dataspot[maxdata - 3][sp];
params.locallab.lumaref = dataspot[maxdata - 2][sp];
@ -2471,6 +2492,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
params.locallab.warm = warms[sp] = dataspot[81][sp];
params.locallab.noiselumdetail = noiselumdetails[sp] = dataspot[82][sp];
params.locallab.noisechrodetail = noisechrodetails[sp] = dataspot[83][sp];
params.locallab.sensiden = sensidens[sp] = dataspot[84][sp];
int *s_datc;
@ -2681,25 +2703,29 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
lhist16, hltonecurveloc, shtonecurveloc, tonecurveloc,
sca);
double huere, chromare, lumare;
double huere, chromare, lumare, huerefblu;
double sobelre;
ipf.calc_ref(nprevl, nprevl, 0, 0, pW, pH, scale, huere, chromare, lumare, sobelre);
ipf.calc_ref(nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, huere, chromare, lumare, sobelre);
huerblu = huerefblu;
huer = huere;
chromar = chromare;
lumar = lumare ;
sobeler = sobelre;
params.locallab.huerefblur = huerblu;
params.locallab.hueref = huer;
params.locallab.chromaref = chromar;
params.locallab.lumaref = lumar;
params.locallab.sobelref = sobeler;
dataspot[maxdata - 5][sp] = huerefblurs[sp] = 100.f * params.locallab.huerefblur;
dataspot[maxdata - 4][sp] = huerefs[sp] = 100.f * params.locallab.hueref;
dataspot[maxdata - 3][sp] = chromarefs[sp] = params.locallab.chromaref;
dataspot[maxdata - 2][sp] = lumarefs[sp] = params.locallab.lumaref;
dataspot[maxdata - 1][sp] = sobelrefs[sp] = params.locallab.sobelref;
//printf("sp=%i huerefsp=%f\n", sp, huerefs[sp]);
ipf.Lab_Local(3, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve,
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
lllocalcurve.clear();
cclocalcurve.clear();
sklocalcurve.clear();
@ -2720,6 +2746,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
}
params.locallab.huerefblur = INFINITY;
params.locallab.hueref = INFINITY;
params.locallab.chromaref = INFINITY;
params.locallab.lumaref = INFINITY;
@ -3014,6 +3041,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
dataspot[81][sp] = warms[sp] = params.locallab.warm = dataspot[81][0];
dataspot[82][sp] = noiselumdetails[sp] = params.locallab.noiselumdetail = dataspot[82][0];
dataspot[83][sp] = noisechrodetails[sp] = params.locallab.noisechrodetail = dataspot[83][0];
dataspot[84][sp] = sensidens[sp] = params.locallab.sensiden = dataspot[84][0];
int *s_datc;
@ -3234,13 +3262,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
CurveFactory::curveskLocal(localskutili, params.locallab.skintonescurve, sklocalcurve, sca);
CurveFactory::curveexLocal(localexutili, params.locallab.excurve, exlocalcurve, sca);
params.locallab.huerefblur = huerefblurs[sp] / 100.;
params.locallab.hueref = huerefs[sp] / 100.;
params.locallab.chromaref = chromarefs[sp];
params.locallab.lumaref = lumarefs[sp];
params.locallab.sobelref = sobelrefs[sp];
ipf.Lab_Local(3, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve,
localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
lllocalcurve.clear();
cclocalcurve.clear();
sklocalcurve.clear();
@ -3255,7 +3283,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
for (int spe = 1; spe < maxspot; spe++) {
int t_sp = spe;
int t_mipversion = 10019;
int t_mipversion = 10020;
int t_circrad = dataspot[2][spe];
int t_locX = dataspot[3][spe];
int t_locY = dataspot[4][spe];
@ -3345,7 +3373,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
int t_warm = dataspot[81][spe];
int t_noiselumdetail = dataspot[82][spe];
int t_noisechrodetail = dataspot[83][spe];
int t_sensiden = dataspot[84][spe];
int t_huerefblur = dataspot[maxdata - 5][spe];
int t_hueref = dataspot[maxdata - 4][spe];
int t_chromaref = dataspot[maxdata - 3][spe];
int t_lumaref = dataspot[maxdata - 2][spe];
@ -3453,7 +3483,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
fou << "Warm=" << t_warm << '@' << endl;
fou << "Noiselumdetail=" << t_noiselumdetail << '@' << endl;
fou << "Noisechrodetail=" << t_noisechrodetail << '@' << endl;
fou << "Sensiden=" << t_sensiden << '@' << endl;
fou << "huerefblur=" << t_huerefblur << '@' << endl;
fou << "hueref=" << t_hueref << '@' << endl;
fou << "chromaref=" << t_chromaref << '@' << endl;
fou << "lumaref=" << t_lumaref << '@' << endl;

View File

@ -308,6 +308,7 @@ protected:
LUTi noiselumcs;
LUTi noiselumdetails;
LUTi noisechrodetails;
LUTi sensidens;
LUTi noisechrofs;
LUTi noisechrocs;
LUTi mult0s;
@ -358,11 +359,12 @@ protected:
LUTi warms;
LUTf huerefs;
LUTf huerefblurs;
LUTf chromarefs;
LUTf lumarefs;
LUTf sobelrefs;
double huer, chromar, lumar, sobeler;
double huer, huerblu, chromar, lumar, sobeler;
void startProcessing();
void process();
float colourToningSatLimit;

View File

@ -292,10 +292,10 @@ public:
//locallab
void 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);
// void calc_ref (LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huere, double &chromare, double &lumare, double &sobelref);
void calc_ref(LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huere, double &chromare, double &lumare, double &sobelref);
void calc_ref(LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &huere, double &chromare, double &lumare, double &sobelref);
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);
void Lab_Local(int call, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, double &hueref, double &chromaref, double &lumaref, double &sobelref);
void Lab_Local(int call, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref);
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 InverseBlurNoise_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy);
@ -313,8 +313,9 @@ public:
void exlabLocal(const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve);
void Exclude_Local(int sen, float **deltaso, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, LabImage * rsv, int cx, int cy);
void DeNoise_Local(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy);
//void DeNoise_Local(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy);
// void ColorLight_Local(int call, LabImage * bufcolorig, 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, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy);
void DeNoise_Local(int call, const struct local_params& lp, int levred, float hueplus, float huemoins, float hueref, float dhueden, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy);
void ColorLight_Local(int call, LabImage * bufcolorig, 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, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy);
void InverseColorLight_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref);

View File

@ -125,7 +125,7 @@ struct local_params {
int cir;
float thr;
int prox;
int chro, cont, sens, sensh, senscb, sensbn, senstm, sensex, sensexclu;
int chro, cont, sens, sensh, senscb, sensbn, senstm, sensex, sensexclu, sensden;
float ligh;
int shamo, shdamp, shiter, senssha, sensv;
double shrad;
@ -381,6 +381,8 @@ static void calcLocalParams(int oW, int oH, const LocallabParams& locallab, stru
float local_noiselc = locallab.noiselumc;
float local_noiseldetail = locallab.noiselumdetail;
float local_noisechrodetail = locallab.noisechrodetail;
int local_sensiden = locallab.sensiden;
float local_noisecf = locallab.noisechrof;
float local_noisecc = locallab.noisechroc;
float multi[5];
@ -468,6 +470,7 @@ static void calcLocalParams(int oW, int oH, const LocallabParams& locallab, stru
lp.noiselc = local_noiselc;
lp.noisecf = local_noisecf;
lp.noisecc = local_noisecc;
lp.sensden = local_sensiden;
lp.strengt = streng;
@ -1861,20 +1864,66 @@ void ImProcFunctions::addGaNoise(LabImage *lab, LabImage *dst, const float mean,
}
}
void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy)
void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, int levred, float hueplus, float huemoins, float hueref, float dhueden, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy)
{
// local denoise
//simple algo , perhaps we can improve as the others, but noise is here and not good for hue detection
// BENCHFUN
const float ach = (float)lp.trans / 100.f;
constexpr float delhu = 0.1f; //between 0.05 and 0.2
#pragma omp parallel for schedule(dynamic,16) if (multiThread)
float factnoise1 = 1.f + (lp.noisecf) / 500.f;
float factnoise2 = 1.f + (lp.noisecc) / 500.f;
constexpr float apl = (-1.f) / delhu;
const float bpl = - apl * hueplus;
constexpr float amo = 1.f / delhu;
const float bmo = - amo * huemoins;
/*
constexpr float pb = 4.f;
constexpr float pa = (1.f - pb) / 40.f;
*/
int GW = transformed->W;
int GH = transformed->H;
LabImage *origblur = nullptr;
origblur = new LabImage(GW, GH);
float radius = 2.f;
#ifdef _OPENMP
#pragma omp parallel
#endif
{
gaussianBlur(original->L, origblur->L, GW, GH, radius);
gaussianBlur(original->a, origblur->a, GW, GH, radius);
gaussianBlur(original->b, origblur->b, GW, GH, radius);
}
/*
const float ahu = 1.f / (2.8f * lp.sensden - 280.f);
const float bhu = 1.f - ahu * 2.8f * lp.sensden;
*/
#ifdef _OPENMP
#pragma omp parallel if (multiThread)
#endif
{
#ifdef __SSE2__
float atan2Buffer[transformed->W] ALIGNED16;
float sqrtBuffer[transformed->W] ALIGNED16;
vfloat c327d68v = F2V(327.68f);
#endif
#ifdef _OPENMP
#pragma omp for schedule(dynamic,16)
#endif
for (int y = 0; y < transformed->H; y++) {
const int loy = cy + y;
const bool isZone0 = loy > lp.yc + lp.ly || loy < lp.yc - lp.lyT; // whole line is zone 0 => we can skip a lot of processing
float factnoise1 = 1.f + (lp.noisecf) / 200.f;
float factnoise2 = 1.f + (lp.noisecc) / 100.f;
if (isZone0) { // outside selection and outside transition zone => no effect, keep original values
for (int x = 0; x < transformed->W; x++) {
@ -1886,15 +1935,106 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab
continue;
}
for (int x = 0; x < transformed->W; x++) {
int lox = cx + x;
#ifdef __SSE2__
int i = 0;
int zone;
float localFactor;
calcTransition(lox, loy, ach, lp, zone, localFactor);
for (; i < transformed->W - 3; i += 4) {
vfloat av = LVFU(origblur->a[y][i]);
vfloat bv = LVFU(origblur->b[y][i]);
STVF(atan2Buffer[i], xatan2f(bv, av));
STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v);
}
for (; i < transformed->W; i++) {
atan2Buffer[i] = xatan2f(origblur->b[y][i], origblur->a[y][i]);
sqrtBuffer[i] = sqrt(SQR(origblur->b[y][i]) + SQR(origblur->a[y][i])) / 327.68f;
}
#endif
for (int x = 0, lox = cx + x; x < transformed->W; x++, lox++) {
int zone = 0;
// int lox = cx + x;
int begx = int (lp.xc - lp.lxL);
int begy = int (lp.yc - lp.lyT);
float localFactor = 1.f;
calcTransition(lox, loy, ach, lp, zone, localFactor);
if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values
transformed->L[y][x] = original->L[y][x];
transformed->a[y][x] = original->a[y][x];
transformed->b[y][x] = original->b[y][x];
continue;
}
#ifdef __SSE2__
const float rhue = atan2Buffer[x];
// const float rchro = sqrtBuffer[x];
#else
const float rhue = xatan2f(origblur->b[y][x], origblur->a[y][x]);
// const float rchro = sqrt(SQR(origblur->b[y][x]) + SQR(origblur->a[y][x])) / 327.68f;
#endif
// float rL = original->L[y][x] / 327.68f;
float khu = 0.f;
// bool kzon = false;
// algo with detection of hue ==> artifacts for noisy images ==> denoise before
if (levred == 7 && lp.sensden < 90.f) { // after 90 plein effect
//hue detection
if ((hueref + dhueden) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good
if (rhue >= hueplus - delhu) {
khu = apl * rhue + bpl;
} else if (rhue < huemoins + delhu) {
khu = amo * rhue + bmo;
} else {
khu = 1.f;
}
// kzon = true;
} else if ((hueref + dhueden) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) {
if (rhue >= hueplus - delhu && rhue < hueplus) {
khu = apl * rhue + bpl;
} else if (rhue >= huemoins && rhue < huemoins + delhu) {
khu = amo * rhue + bmo;
} else {
khu = 1.f;
}
// kzon = true;
}
if ((hueref - dhueden) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) {
if (rhue >= hueplus - delhu && rhue < hueplus) {
khu = apl * rhue + bpl;
} else if (rhue >= huemoins && rhue < huemoins + delhu) {
khu = amo * rhue + bmo;
} else {
khu = 1.f;
}
// kzon = true;
} else if ((hueref - dhueden) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) {
if (rhue >= hueplus - delhu && rhue < hueplus) {
khu = apl * rhue + bpl;
} else if (rhue >= huemoins && rhue < huemoins + delhu) {
khu = amo * rhue + bmo;
} else {
khu = 1.f;
}
// kzon = true;
}
} else {
khu = 1.f;
}
switch (zone) {
case 0: { // outside selection and outside transition zone => no effect, keep original values
transformed->L[y][x] = original->L[y][x];
@ -1918,9 +2058,9 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab
}
difL *= factorx;
difa *= factorx;
difb *= factorx ;
difL *= factorx * khu;
difa *= factorx * khu;
difb *= factorx * khu;
transformed->L[y][x] = original->L[y][x] + difL;
transformed->a[y][x] = (original->a[y][x] + difa) * factnoise1 * factnoise2;
transformed->b[y][x] = (original->b[y][x] + difb) * factnoise1 * factnoise2 ;
@ -1941,18 +2081,22 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, Lab
}
difL *= khu;
difa *= khu;
difb *= khu;
transformed->L[y][x] = original->L[y][x] + difL;
transformed->a[y][x] = (original->a[y][x] + difa) * factnoise1 * factnoise2;
transformed->b[y][x] = (original->b[y][x] + difb) * factnoise1 * factnoise2;
}
}
}
}
}
}
}
delete origblur;
}
void ImProcFunctions::cat02_Local(float **buflightcat, float **buf_a_cat, float ** buf_b_cat, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy)
{
@ -6271,6 +6415,8 @@ void ImProcFunctions::ColorLight_Local(int call, LabImage * bufcolorig, float **
kzon = true;
}
//printf("khu=%f ", khu);
// realhh = hhro;
//detection of deltaE and deltaL
@ -7153,7 +7299,7 @@ void ImProcFunctions::InverseColorLight_Local(const struct local_params & lp, La
}
void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int cx, int cy, int oW, int oH, int sk, double & hueref, double & chromaref, double & lumaref, double & sobelref)
void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int cx, int cy, int oW, int oH, int sk, double & huerefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref)
{
if (params->locallab.enabled) {
//always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise
@ -7165,10 +7311,15 @@ void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int
double aveB = 0.;
double aveL = 0.;
double aveChro = 0.;
double aveAblur = 0.;
double aveBblur = 0.;
float avAblur, avBblur;
double avesobel = 0.;
// int precision for the counters
int nab = 0;
int nso = 0;
int nsb = 0;
// single precision for the result
float avA, avB, avL;
int spotSize = 0.88623f * max(1, lp.cir / sk); //18
@ -7182,6 +7333,9 @@ void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int
LabImage *sobelL;
LabImage *deltasobelL;
LabImage *origsob;
LabImage *origblur = nullptr;
LabImage *blurorig = nullptr;
int spotSi = 1 + 2 * max(1, lp.cir / sk);
if (spotSi < 5) {
@ -7189,9 +7343,54 @@ void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int
}
spotSise2 = (spotSi - 1) / 2;
origsob = new LabImage(spotSi, spotSi);
sobelL = new LabImage(spotSi, spotSi);
deltasobelL = new LabImage(spotSi, spotSi);
bool isdenoise = false;
if ((lp.noiself > 0.f || lp.noiselc > 0.f || lp.noisecf > 0.f || lp.noisecc > 0.f) && lp.denoiena) {
isdenoise = true;
}
if (isdenoise) {
origblur = new LabImage(spotSi, spotSi);
blurorig = new LabImage(spotSi, spotSi);
for (int y = max(cy, (int)(lp.yc - spotSise2)); y < min(transformed->H + cy, (int)(lp.yc + spotSise2 + 1)); y++) {
for (int x = max(cx, (int)(lp.xc - spotSise2)); x < min(transformed->W + cx, (int)(lp.xc + spotSise2 + 1)); x++) {
int yb = max(cy, (int)(lp.yc - spotSise2));
int xb = max(cx, (int)(lp.xc - spotSise2));
int z = y - yb;
int u = x - xb;
origblur->L[z][u] = original->L[y - cy][x - cx];
origblur->a[z][u] = original->a[y - cy][x - cx];
origblur->b[z][u] = original->b[y - cy][x - cx];
}
}
float radius = 2.f;
{
//No omp
gaussianBlur(origblur->L, blurorig->L, spotSi, spotSi, radius);
gaussianBlur(origblur->a, blurorig->a, spotSi, spotSi, radius);
gaussianBlur(origblur->b, blurorig->b, spotSi, spotSi, radius);
}
for (int y = 0; y < spotSi; y++) {
for (int x = 0; x < spotSi; x++) {
aveAblur += blurorig->a[y][x];
aveBblur += blurorig->b[y][x];
nsb++;
}
}
}
//ref for luma, chroma, hue
for (int y = max(cy, (int)(lp.yc - spotSize)); y < min(transformed->H + cy, (int)(lp.yc + spotSize + 1)); y++) {
@ -7250,9 +7449,30 @@ void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int
avB = aveB / 327.68f;
avL = aveL / 327.68f;
hueref = xatan2f(avB, avA); //mean hue
if (isdenoise) {
aveAblur = aveAblur / nsb;
aveBblur = aveBblur / nsb;
avAblur = aveAblur / 327.68f;
avBblur = aveBblur / 327.68f;
}
if (isdenoise) {
huerefblur = xatan2f(avBblur, avAblur);
} else {
huerefblur = 0.f;
}
// printf("hueblur=%f hue=%f\n", huerefblur, hueref);
chromaref = aveChro;
lumaref = avL;
if (isdenoise) {
delete origblur;
delete blurorig;
}
if (lumaref > 95.f) {//to avoid crash
lumaref = 95.f;
}
@ -7352,7 +7572,7 @@ void ImProcFunctions::paste_ref(LabImage * spotbuffer, LabImage * transformed, i
void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk,
const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve,
bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, double & hueref, double & chromaref, double & lumaref, double & sobelref)
bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, double & huerefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref)
{
//general call of others functions : important return hueref, chromaref, lumaref
if (params->locallab.enabled) {
@ -7438,8 +7658,7 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original,
constexpr float ared = (rtengine::RT_PI - 0.05f) / 100.f;
constexpr float bred = 0.05f;
float dhue = ared * lp.sens + bred; //delta hue lght chroma
float dhue = ared * lp.sens + bred; //delta hue vibr
float dhuev = ared * lp.sensv + bred; //delta hue vibr
@ -7457,6 +7676,9 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original,
float dhueexclu = ared * lp.sensexclu + bred; //delta hue exclude
float dhueden = ared * lp.sensden + bred; //delta hue lght chroma
constexpr float maxh = 3.5f; // 3.5 amplification contrast above mean
constexpr float maxl = 2.5f; // 3 reductio contrast under mean
@ -8499,6 +8721,17 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original,
levred = 7;
}
float hueplus = huerefblur + dhueden;
float huemoins = huerefblur - dhueden;
if (hueplus > rtengine::RT_PI) {
hueplus = huerefblur + dhueden - 2.f * rtengine::RT_PI;
}
if (huemoins < -rtengine::RT_PI) {
huemoins = huerefblur - dhueden + 2.f * rtengine::RT_PI;
}
#ifdef _OPENMP
const int numThreads = omp_get_max_threads();
#else
@ -9373,8 +9606,8 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original,
fftwf_cleanup();
DeNoise_Local(call, lp, original, transformed, tmp1, cx, cy);
// printf("huere=%f dhueden=%f huplus=%f huemoin=%f\n", hueref, dhueden, hueplus, huemoins);
DeNoise_Local(call, lp, levred, hueplus, huemoins, huerefblur, dhueden, original, transformed, tmp1, cx, cy);
} else if (call == 2) { //simpleprocess
@ -10250,7 +10483,7 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original,
fftwf_cleanup();
DeNoise_Local(call, lp, original, transformed, bufwv, cx, cy);
DeNoise_Local(call, lp, levred, hueplus, huemoins, huerefblur, dhueden, original, transformed, bufwv, cx, cy);
}
}

View File

@ -621,6 +621,8 @@ enum ProcEvent {
Evlocallabwarm = 591,
Evlocallabnoiselumdetail = 592,
Evlocallabnoisechrodetail = 593,
Evlocallabsensiden = 594,
Evlocallabhuerefblur = 595,
NUMOFEVENTS

View File

@ -2376,6 +2376,7 @@ noiselumf(0),
noiselumc(0),
noiselumdetail(0),
noisechrodetail(0),
sensiden(30),
noisechrof(0),
noisechroc(0),
sharradius(40),
@ -2415,6 +2416,7 @@ inversrad(false),
inversret(false),
inverssha(false),
hueref(1.),
huerefblur(1.),
chromaref(50.),
lumaref(50.),
sobelref(0.),
@ -2510,6 +2512,7 @@ bool LocallabParams::operator ==(const LocallabParams& other) const
&& noiselumc == other.noiselumc
&& noiselumdetail == other.noiselumdetail
&& noisechrodetail == other.noisechrodetail
&& sensiden == other.sensiden
&& noisechrof == other.noisechrof
&& noisechroc == other.noisechroc
&& sharradius == other.sharradius
@ -2540,6 +2543,7 @@ bool LocallabParams::operator ==(const LocallabParams& other) const
&& nbspot == other.nbspot
&& anbspot == other.anbspot
&& hueref == other.hueref
&& huerefblur == other.huerefblur
&& chromaref == other.chromaref
&& lumaref == other.lumaref
&& sobelref == other.sobelref
@ -3486,6 +3490,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->locallab.noiselumc, "Locallab", "noiselumc", locallab.noiselumc, keyFile);
saveToKeyfile(!pedited || pedited->locallab.noiselumdetail, "Locallab", "noiselumdetail", locallab.noiselumdetail, keyFile);
saveToKeyfile(!pedited || pedited->locallab.noisechrodetail, "Locallab", "noisechrodetail", locallab.noisechrodetail, keyFile);
saveToKeyfile(!pedited || pedited->locallab.sensiden, "Locallab", "Sensiden", locallab.sensiden, keyFile);
saveToKeyfile(!pedited || pedited->locallab.noisechrof, "Locallab", "noisechrof", locallab.noisechrof, keyFile);
saveToKeyfile(!pedited || pedited->locallab.noisechroc, "Locallab", "noisechroc", locallab.noisechroc, keyFile);
saveToKeyfile(!pedited || pedited->locallab.sharradius, "Locallab", "Sharradius", locallab.sharradius, keyFile);
@ -3509,6 +3514,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->locallab.nbspot, "Locallab", "Nbspot", locallab.nbspot, keyFile);
saveToKeyfile(!pedited || pedited->locallab.anbspot, "Locallab", "ANbspot", locallab.anbspot, keyFile);
saveToKeyfile(!pedited || pedited->locallab.hueref, "Locallab", "Hueref", locallab.hueref, keyFile);
saveToKeyfile(!pedited || pedited->locallab.huerefblur, "Locallab", "Huerefblur", locallab.huerefblur, keyFile);
saveToKeyfile(!pedited || pedited->locallab.chromaref, "Locallab", "Chromaref", locallab.chromaref, keyFile);
saveToKeyfile(!pedited || pedited->locallab.lumaref, "Locallab", "Lumaref", locallab.lumaref, keyFile);
saveToKeyfile(!pedited || pedited->locallab.sobelref, "Locallab", "Sobelref", locallab.sobelref, keyFile);
@ -4541,6 +4547,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "noiselumc", pedited, locallab.noiselumc, pedited->locallab.noiselumc);
assignFromKeyfile(keyFile, "Locallab", "noiselumdetail", pedited, locallab.noiselumdetail, pedited->locallab.noiselumdetail);
assignFromKeyfile(keyFile, "Locallab", "noisechrodetail", pedited, locallab.noisechrodetail, pedited->locallab.noisechrodetail);
assignFromKeyfile(keyFile, "Locallab", "Sensiden", pedited, locallab.sensiden, pedited->locallab.sensiden);
assignFromKeyfile(keyFile, "Locallab", "noisechrof", pedited, locallab.noisechrof, pedited->locallab.noisechrof);
assignFromKeyfile(keyFile, "Locallab", "noisechroc", pedited, locallab.noisechroc, pedited->locallab.noisechroc);
assignFromKeyfile(keyFile, "Locallab", "Sharradius", pedited, locallab.sharradius, pedited->locallab.sharradius);
@ -4565,6 +4572,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "Nbspot", pedited, locallab.nbspot, pedited->locallab.nbspot);
assignFromKeyfile(keyFile, "Locallab", "ANbspot", pedited, locallab.anbspot, pedited->locallab.anbspot);
assignFromKeyfile(keyFile, "Locallab", "Hueref", pedited, locallab.hueref, pedited->locallab.hueref);
assignFromKeyfile(keyFile, "Locallab", "Huerefblur", pedited, locallab.huerefblur, pedited->locallab.huerefblur);
assignFromKeyfile(keyFile, "Locallab", "Chromaref", pedited, locallab.chromaref, pedited->locallab.chromaref);
assignFromKeyfile(keyFile, "Locallab", "Lumaref", pedited, locallab.lumaref, pedited->locallab.lumaref);
assignFromKeyfile(keyFile, "Locallab", "Sobelref", pedited, locallab.sobelref, pedited->locallab.sobelref);

View File

@ -916,6 +916,7 @@ struct LocallabParams {
int noiselumc;
int noiselumdetail;
int noisechrodetail;
int sensiden;
int noisechrof;
int noisechroc;
int sharradius;
@ -955,6 +956,7 @@ struct LocallabParams {
bool inversret;
bool inverssha;
double hueref;
double huerefblur;
double chromaref;
double lumaref;
double sobelref;

View File

@ -620,7 +620,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, // Evlocallabstruc
LUMINANCECURVE, // Evlocallabwarm
LUMINANCECURVE, // Evlocallabnoiselumdetail
LUMINANCECURVE // Evlocallabnoisechrodetail
LUMINANCECURVE, // Evlocallabnoisechrodetail
LUMINANCECURVE, // Evlocallabsensiden
LUMINANCECURVE // Evlocallabhuerefblur
};

View File

@ -1103,7 +1103,7 @@ private:
}
ifstream fich(datalab, ios::in);
int maxdata = 88; //87 10018//86 10017//85 10016 //82;//78;//73 10011
int maxdata = 90; //88 10019 //87 10018//86 10017//85 10016 //82;//78;//73 10011
if (fich && versionmip != 0) {
std::string inser;
@ -1340,7 +1340,9 @@ private:
dataspots[81][0] = params.locallab.warm;
dataspots[82][0] = params.locallab.noiselumdetail;
dataspots[83][0] = params.locallab.noisechrodetail;
dataspots[84][0] = params.locallab.sensiden;
dataspots[maxdata - 5][0] = 100.f * params.locallab.huerefblur;
dataspots[maxdata - 4][0] = 100.f * params.locallab.hueref;
dataspots[maxdata - 3][0] = params.locallab.chromaref;
dataspots[maxdata - 2][0] = params.locallab.lumaref;
@ -1607,6 +1609,7 @@ private:
for (int sp = 1; sp < maxspot; sp++) { //spots default
params.locallab.huerefblur = INFINITY;
params.locallab.hueref = INFINITY;
params.locallab.chromaref = INFINITY;
params.locallab.lumaref = INFINITY;
@ -1811,7 +1814,9 @@ private:
params.locallab.warm = dataspots[81][sp];
params.locallab.noiselumdetail = dataspots[82][sp];
params.locallab.noisechrodetail = dataspots[83][sp];
params.locallab.sensiden = dataspots[84][sp];
params.locallab.huerefblur = ((float) dataspots[maxdata - 5][sp]) / 100.f;
params.locallab.hueref = ((float) dataspots[maxdata - 4][sp]) / 100.f;
params.locallab.chromaref = dataspots[maxdata - 3][sp];
params.locallab.lumaref = dataspots[maxdata - 2][sp];
@ -1992,17 +1997,19 @@ private:
hist16, hltonecurveloc, shtonecurveloc, tonecurveloc,
1);
double huere, chromare, lumare;
double huere, chromare, lumare, huerefblu;
double sobelre;
ipf.calc_ref(labView, labView, 0, 0, fw, fh, 1, huere, chromare, lumare, sobelre);
ipf.calc_ref(labView, labView, 0, 0, fw, fh, 1, huerefblu, huere, chromare, lumare, sobelre);
params.locallab.huerefblur = huerefblu;
params.locallab.hueref = huere;
params.locallab.chromaref = chromare;
params.locallab.lumaref = lumare;
params.locallab.sobelref = sobelre;
ipf.Lab_Local(2, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve,
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref);
lllocalcurve.clear();
cclocalcurve.clear();
sklocalcurve.clear();

View File

@ -108,9 +108,11 @@ Locallab::Locallab():
noiselumc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMCOARSE"), 0, 100, 1, 0))),
noiselumdetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMDETAIL"), 0, 100, 1, 50))),
noisechrodetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHRODETAIL"), 0, 100, 1, 50))),
sensiden(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIDEN"), 0, 100, 1, 30))),
noisechrof(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHROFINE"), 0, 100, 1, 0))),
noisechroc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHROCOARSE"), 0, 100, 1, 0))),
hueref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_HUEREF"), -3.15, 3.15, 0.01, 0))),
huerefblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_HUEREFBLUR"), -3.15, 3.15, 0.01, 0))),
chromaref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMAREF"), 0, 200, 0.01, 0))),
lumaref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMAMAREF"), 0, 100, 0.01, 0))),
sobelref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOBELREF"), 0, 100, 0.01, 0))),
@ -508,17 +510,20 @@ Locallab::Locallab():
pack_start(*anbspot);
hueref->setAdjusterListener(this);
huerefblur->setAdjusterListener(this);
chromaref->setAdjusterListener(this);
lumaref->setAdjusterListener(this);
sobelref->setAdjusterListener(this);
pack_start(*hueref);
pack_start(*huerefblur);
pack_start(*chromaref);
pack_start(*lumaref);
pack_start(*sobelref);
anbspot->hide();//keep anbspot - i used it to test diffrent algo...
hueref->hide();
huerefblur->hide();
chromaref->hide();
lumaref->hide();
sobelref->hide();
@ -644,6 +649,7 @@ Locallab::Locallab():
noiselumc->setAdjusterListener(this);
noiselumdetail->setAdjusterListener(this);
noisechrodetail->setAdjusterListener(this);
sensiden->setAdjusterListener(this);
noisechrof->setAdjusterListener(this);
@ -656,6 +662,7 @@ Locallab::Locallab():
denoisBox->pack_start(*noisechrof);
denoisBox->pack_start(*noisechroc);
denoisBox->pack_start(*noisechrodetail);
denoisBox->pack_start(*sensiden);
neutrHBox1 = Gtk::manage(new Gtk::HBox());
@ -1311,6 +1318,7 @@ void Locallab::neutral_pressed()
noisechrof->resetValue(false);
noisechroc->resetValue(false);
noisechrodetail->resetValue(false);
sensiden->resetValue(false);
}
@ -1816,12 +1824,16 @@ bool Locallab::localComputed_()
warm->setValue(nextdatasp[81]);
noiselumdetail->setValue(nextdatasp[82]);
noisechrodetail->setValue(nextdatasp[83]);
sensiden->setValue(nextdatasp[84]);
double intermed = 0.01 * (double) nextdatasp[84];
double intermedblur = 0.01 * (double) nextdatasp[85];
huerefblur->setValue(intermedblur);
double intermed = 0.01 * (double) nextdatasp[86];
hueref->setValue(intermed);
chromaref->setValue(nextdatasp[85]);
lumaref->setValue(nextdatasp[86]);
sobelref->setValue(nextdatasp[87]);
chromaref->setValue(nextdatasp[87]);
lumaref->setValue(nextdatasp[88]);
sobelref->setValue(nextdatasp[89]);
int *s_datc;
s_datc = new int[70];
@ -2105,7 +2117,7 @@ bool Locallab::localComputed_()
void Locallab::localChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat)
{
for (int i = 2; i < 88; i++) {
for (int i = 2; i < 90; i++) {
nextdatasp[i] = datasp[i][sp];
}
@ -2142,6 +2154,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
{
anbspot->hide();
hueref->hide();
huerefblur->hide();
chromaref->hide();
lumaref->hide();
sobelref->hide();
@ -2195,6 +2208,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
noisechrof->setEditedState(pedited->locallab.noisechrof ? Edited : UnEdited);
noisechroc->setEditedState(pedited->locallab.noisechroc ? Edited : UnEdited);
noisechrodetail->setEditedState(pedited->locallab.noisechrodetail ? Edited : UnEdited);
sensiden->setEditedState(pedited->locallab.sensiden ? Edited : UnEdited);
pastels->setEditedState(pedited->locallab.pastels ? Edited : UnEdited);
saturated->setEditedState(pedited->locallab.saturated ? Edited : UnEdited);
@ -2231,6 +2245,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
nbspot->setEditedState(pedited->locallab.nbspot ? Edited : UnEdited);
anbspot->setEditedState(pedited->locallab.anbspot ? Edited : UnEdited);
hueref->setEditedState(pedited->locallab.hueref ? Edited : UnEdited);
huerefblur->setEditedState(pedited->locallab.huerefblur ? Edited : UnEdited);
chromaref->setEditedState(pedited->locallab.chromaref ? Edited : UnEdited);
lumaref->setEditedState(pedited->locallab.lumaref ? Edited : UnEdited);
sobelref->setEditedState(pedited->locallab.sobelref ? Edited : UnEdited);
@ -2386,6 +2401,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
nbspot->setValue(pp->locallab.nbspot);
anbspot->setValue(pp->locallab.anbspot);
hueref->setValue(pp->locallab.hueref);
huerefblur->setValue(pp->locallab.huerefblur);
chromaref->setValue(pp->locallab.chromaref);
lumaref->setValue(pp->locallab.lumaref);
sobelref->setValue(pp->locallab.sobelref);
@ -2406,6 +2422,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
noisechrof->setValue(pp->locallab.noisechrof);
noisechroc->setValue(pp->locallab.noisechroc);
noisechrodetail->setValue(pp->locallab.noisechrodetail);
sensiden->setValue(pp->locallab.sensiden);
expcolor->setEnabled(pp->locallab.expcolor);
expexpose->setEnabled(pp->locallab.expexpose);
expvibrance->setEnabled(pp->locallab.expvibrance);
@ -2557,6 +2574,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
anbspot->hide();
hueref->hide();
huerefblur->hide();
chromaref->hide();
lumaref->hide();
sobelref->hide();
@ -2831,6 +2849,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.noiselumc = noiselumc->getIntValue();
pp->locallab.noiselumdetail = noiselumdetail->getIntValue();
pp->locallab.noisechrodetail = noisechrodetail->getIntValue();
pp->locallab.sensiden = sensiden->getIntValue();
pp->locallab.noiselumf = noiselumf->getIntValue();
pp->locallab.noisechrof = noisechrof->getIntValue();
pp->locallab.noisechroc = noisechroc->getIntValue();
@ -2871,6 +2890,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.nbspot = nbspot->getIntValue();
pp->locallab.anbspot = anbspot->getIntValue();
pp->locallab.hueref = hueref->getValue();
pp->locallab.huerefblur = huerefblur->getValue();
pp->locallab.chromaref = chromaref->getValue();
pp->locallab.lumaref = lumaref->getValue();
pp->locallab.sobelref = sobelref->getValue();
@ -2945,6 +2965,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.noiselumc = noiselumc->getEditedState();
pedited->locallab.noiselumdetail = noiselumdetail->getEditedState();
pedited->locallab.noisechrodetail = noisechrodetail->getEditedState();
pedited->locallab.sensiden = sensiden->getEditedState();
pedited->locallab.noisechrof = noisechrof->getEditedState();
pedited->locallab.noisechroc = noisechroc->getEditedState();
pedited->locallab.sharradius = sharradius->getEditedState();
@ -2984,6 +3005,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.nbspot = nbspot->getEditedState();
pedited->locallab.anbspot = anbspot->getEditedState();
pedited->locallab.hueref = hueref->getEditedState();
pedited->locallab.huerefblur = huerefblur->getEditedState();
pedited->locallab.chromaref = chromaref->getEditedState();
pedited->locallab.lumaref = lumaref->getEditedState();
pedited->locallab.sobelref = sobelref->getEditedState();
@ -3718,6 +3740,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
noiselumc->setDefault(defParams->locallab.noiselumc);
noiselumdetail->setDefault(defParams->locallab.noiselumdetail);
noisechrodetail->setDefault(defParams->locallab.noisechrodetail);
sensiden->setDefault(defParams->locallab.sensiden);
noisechrof->setDefault(defParams->locallab.noisechrof);
noisechroc->setDefault(defParams->locallab.noisechroc);
sharradius->setDefault(defParams->locallab.sharradius);
@ -3747,6 +3770,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
nbspot->setDefault(defParams->locallab.nbspot);
anbspot->setDefault(defParams->locallab.anbspot);
hueref->setDefault(defParams->locallab.hueref);
huerefblur->setDefault(defParams->locallab.huerefblur);
chromaref->setDefault(defParams->locallab.chromaref);
lumaref->setDefault(defParams->locallab.lumaref);
sobelref->setDefault(defParams->locallab.sobelref);
@ -3794,6 +3818,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
noiselumc->setDefaultEditedState(pedited->locallab.noiselumc ? Edited : UnEdited);
noiselumdetail->setDefaultEditedState(pedited->locallab.noiselumdetail ? Edited : UnEdited);
noisechrodetail->setDefaultEditedState(pedited->locallab.noisechrodetail ? Edited : UnEdited);
sensiden->setDefaultEditedState(pedited->locallab.sensiden ? Edited : UnEdited);
noisechrof->setDefaultEditedState(pedited->locallab.noisechrof ? Edited : UnEdited);
noisechroc->setDefaultEditedState(pedited->locallab.noisechroc ? Edited : UnEdited);
sharradius->setDefaultEditedState(pedited->locallab.sharradius ? Edited : UnEdited);
@ -3823,6 +3848,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
nbspot->setDefaultEditedState(pedited->locallab.nbspot ? Edited : UnEdited);
anbspot->setDefaultEditedState(pedited->locallab.anbspot ? Edited : UnEdited);
hueref->setDefaultEditedState(pedited->locallab.hueref ? Edited : UnEdited);
huerefblur->setDefaultEditedState(pedited->locallab.huerefblur ? Edited : UnEdited);
chromaref->setDefaultEditedState(pedited->locallab.chromaref ? Edited : UnEdited);
lumaref->setDefaultEditedState(pedited->locallab.lumaref ? Edited : UnEdited);
sobelref->setDefaultEditedState(pedited->locallab.sobelref ? Edited : UnEdited);
@ -3869,6 +3895,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
noiselumc->setDefaultEditedState(Irrelevant);
noiselumdetail->setDefaultEditedState(Irrelevant);
noisechrodetail->setDefaultEditedState(Irrelevant);
sensiden->setDefaultEditedState(Irrelevant);
noisechrof->setDefaultEditedState(Irrelevant);
noisechroc->setDefaultEditedState(Irrelevant);
sharradius->setDefaultEditedState(Irrelevant);
@ -3898,6 +3925,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
nbspot->setDefaultEditedState(Irrelevant);
anbspot->setDefaultEditedState(Irrelevant);
hueref->setDefaultEditedState(Irrelevant);
huerefblur->setDefaultEditedState(Irrelevant);
chromaref->setDefaultEditedState(Irrelevant);
lumaref->setDefaultEditedState(Irrelevant);
sobelref->setDefaultEditedState(Irrelevant);
@ -3933,6 +3961,7 @@ void Locallab::adjusterChanged(Adjuster * a, double newval)
updateGeometry(int (centerX->getValue()), int (centerY->getValue()), int (circrad->getValue()), (int)locY->getValue(), degree->getValue(), (int)locX->getValue(), (int)locYT->getValue(), (int)locXL->getValue());
anbspot->hide();
hueref->hide();
huerefblur->hide();
chromaref->hide();
lumaref->hide();
sobelref->hide();
@ -4046,6 +4075,8 @@ void Locallab::adjusterChanged(Adjuster * a, double newval)
listener->panelChanged(Evlocallabnoiselumdetail, noiselumdetail->getTextValue());
} else if (a == noisechrodetail) {
listener->panelChanged(Evlocallabnoisechrodetail, noisechrodetail->getTextValue());
} else if (a == sensiden) {
listener->panelChanged(Evlocallabsensiden, sensiden->getTextValue());
} else if (a == noisechrof) {
listener->panelChanged(Evlocallabnoisechrof, noisechrof->getTextValue());
} else if (a == noisechroc) {
@ -4094,6 +4125,8 @@ void Locallab::adjusterChanged(Adjuster * a, double newval)
listener->panelChanged(Evlocallabanbspot, ""); //anbspot->getTextValue());
} else if (a == hueref) {
listener->panelChanged(Evlocallabhueref, ""); //anbspot->getTextValue());
} else if (a == huerefblur) {
listener->panelChanged(Evlocallabhuerefblur, ""); //anbspot->getTextValue());
} else if (a == chromaref) {
listener->panelChanged(Evlocallabchromaref, ""); //anbspot->getTextValue());
} else if (a == lumaref) {
@ -4146,6 +4179,7 @@ void Locallab::enabledChanged()
{
anbspot->hide();
hueref->hide();
huerefblur->hide();
chromaref->hide();
lumaref->hide();
sobelref->hide();
@ -4234,6 +4268,7 @@ void Locallab::trimValues(rtengine::procparams::ProcParams * pp)
noiselumc->trimValue(pp->locallab.noiselumc);
noiselumdetail->trimValue(pp->locallab.noiselumdetail);
noisechrodetail->trimValue(pp->locallab.noisechrodetail);
sensiden->trimValue(pp->locallab.sensiden);
noisechrof->trimValue(pp->locallab.noisechrof);
noisechroc->trimValue(pp->locallab.noisechroc);
sharradius->trimValue(pp->locallab.sharradius);
@ -4263,6 +4298,7 @@ void Locallab::trimValues(rtengine::procparams::ProcParams * pp)
nbspot->trimValue(pp->locallab.nbspot);
anbspot->trimValue(pp->locallab.anbspot);
hueref->trimValue(pp->locallab.hueref);
huerefblur->trimValue(pp->locallab.huerefblur);
chromaref->trimValue(pp->locallab.chromaref);
lumaref->trimValue(pp->locallab.lumaref);
sobelref->trimValue(pp->locallab.sobelref);
@ -4289,6 +4325,7 @@ void Locallab::setBatchMode(bool batchMode)
ToolPanel::setBatchMode(batchMode);
hueref->hide();
huerefblur->hide();
chromaref->hide();
lumaref->hide();
sobelref->hide();
@ -4320,6 +4357,7 @@ void Locallab::setBatchMode(bool batchMode)
noiselumc->showEditedCB();
noiselumdetail->showEditedCB();
noisechrodetail->showEditedCB();
sensiden->showEditedCB();
noisechroc->showEditedCB();
noiselumf->showEditedCB();
sharradius->showEditedCB();
@ -4350,6 +4388,7 @@ void Locallab::setBatchMode(bool batchMode)
nbspot->showEditedCB();
anbspot->showEditedCB();
hueref->showEditedCB();
huerefblur->showEditedCB();
chromaref->showEditedCB();
lumaref->showEditedCB();
sobelref->showEditedCB();

View File

@ -117,10 +117,12 @@ private:
Adjuster* const noiselumc;
Adjuster* const noiselumdetail;
Adjuster* const noisechrodetail;
Adjuster* const sensiden;
Adjuster* const noisechrof;
Adjuster* const noisechroc;
Adjuster* const hueref;
Adjuster* const huerefblur;
Adjuster* const chromaref;
Adjuster* const lumaref;
Adjuster* const sobelref;
@ -234,7 +236,7 @@ private:
int nextdatasp[88];
int nextdatasp[90];
int nextlength;
std::string nextstr;
std::string nextstr2;

View File

@ -349,6 +349,7 @@ void ParamsEdited::set(bool v)
locallab.noiselumc = v;
locallab.noiselumdetail = v;
locallab.noisechrodetail = v;
locallab.sensiden = v;
locallab.noisechrof = v;
locallab.noisechroc = v;
locallab.sharradius = v;
@ -393,6 +394,7 @@ void ParamsEdited::set(bool v)
locallab.nbspot = v;
locallab.anbspot = v;
locallab.hueref = v;
locallab.huerefblur = v;
locallab.chromaref = v;
locallab.lumaref = v;
locallab.sobelref = v;
@ -1014,6 +1016,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.noiselumc = locallab.noiselumc && p.locallab.noiselumc == other.locallab.noiselumc;
locallab.noiselumdetail = locallab.noiselumdetail && p.locallab.noiselumdetail == other.locallab.noiselumdetail;
locallab.noisechrodetail = locallab.noisechrodetail && p.locallab.noisechrodetail == other.locallab.noisechrodetail;
locallab.sensiden = locallab.sensiden && p.locallab.sensiden == other.locallab.sensiden;
locallab.noisechrof = locallab.noisechrof && p.locallab.noisechrof == other.locallab.noisechrof;
locallab.noisechroc = locallab.noisechroc && p.locallab.noisechroc == other.locallab.noisechroc;
locallab.sharradius = locallab.sharradius && p.locallab.sharradius == other.locallab.sharradius;
@ -1043,6 +1046,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.nbspot = locallab.nbspot && p.locallab.nbspot == other.locallab.nbspot;
locallab.anbspot = locallab.anbspot && p.locallab.anbspot == other.locallab.anbspot;
locallab.hueref = locallab.hueref && p.locallab.hueref == other.locallab.hueref;
locallab.huerefblur = locallab.huerefblur && p.locallab.huerefblur == other.locallab.huerefblur;
locallab.chromaref = locallab.chromaref && p.locallab.chromaref == other.locallab.chromaref;
locallab.lumaref = locallab.lumaref && p.locallab.lumaref == other.locallab.lumaref;
locallab.sobelref = locallab.sobelref && p.locallab.sobelref == other.locallab.sobelref;
@ -2628,6 +2632,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.noisechrodetail = mods.locallab.noisechrodetail;
}
if (locallab.sensiden) {
toEdit.locallab.sensiden = mods.locallab.sensiden;
}
if (locallab.noisechrof) {
toEdit.locallab.noisechrof = mods.locallab.noisechrof;
}
@ -2744,6 +2752,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.hueref = mods.locallab.hueref;
}
if (locallab.huerefblur) {
toEdit.locallab.huerefblur = mods.locallab.huerefblur;
}
if (locallab.chromaref) {
toEdit.locallab.chromaref = mods.locallab.chromaref;
}

View File

@ -468,6 +468,7 @@ public:
bool noiselumc;
bool noiselumdetail;
bool noisechrodetail;
bool sensiden;
bool noisechrof;
bool noisechroc;
bool sharradius;
@ -503,6 +504,7 @@ public:
bool nbspot;
bool anbspot;
bool hueref;
bool huerefblur;
bool chromaref;
bool lumaref;
bool sobelref;