diff --git a/rtdata/languages/default b/rtdata/languages/default index cbcbd142c..7f3f6ca3f 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -827,6 +827,7 @@ HISTORY_MSG_576;Local - Centerbuf HISTORY_MSG_577;Local - adjblur HISTORY_MSG_578;Local - cut past HISTORY_MSG_579;Local - cbdl chroma +HISTORY_MSG_580;Local - Blur method HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -1802,7 +1803,11 @@ TP_LOCALLAB_ADJBLUR;Adjust and Blur TP_LOCALLAB_ARTIF;Reduce artifacts - Improve algoritm TP_LOCALLAB_ARTIF_TOOLTIP;Only active for Color-light, Exposure, Retinex, Vibrance, ToneMapping, CBDL. TP_LOCALLAB_AVOID;Avoid color shift +TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\nInverse - Inverse blur and noise without scope and whithout enhanced algorithm.\nSymmetric - inverse blur and noise with all settings. Be careful some results may be curious TP_LOCALLAB_BLUFR;Blur & Noise +TP_LOCALLAB_BLNORM;Normal +TP_LOCALLAB_BLINV;Inverse +TP_LOCALLAB_BLSYM;Symmetric TP_LOCALLAB_CENTER_X;Center X TP_LOCALLAB_CENTER_Y;Center Y TP_LOCALLAB_CBDL;Contrast by detail levels diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 4641f3ca0..13b3ff753 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1036,6 +1036,28 @@ void Crop::update (int todo) params.locallab.chromacbdl = parent->chromacbdls[sp]; + if (parent->lastdusts[sp] == 0) { + params.locallab.lastdust = false; + } else { + params.locallab.lastdust = true; + } + + if (parent->blurmets[sp] == 0) { + params.locallab.blurMethod = "norm" ; + } else if (parent->blurmets[sp] == 1) { + params.locallab.blurMethod = "inv" ; + } else if (parent->blurmets[sp] == 2) { + params.locallab.blurMethod = "enh" ; + } + + if (parent->dustmets[sp] == 0) { + params.locallab.dustMethod = "cop" ; + } else if (parent->dustmets[sp] == 1) { + params.locallab.dustMethod = "mov" ; + } else if (parent->dustmets[sp] == 2) { + params.locallab.dustMethod = "pas" ; + } + std::vector cretie; for (int j = 0; j < parent->sizeretics[sp]; j++) { @@ -1371,6 +1393,37 @@ void Crop::update (int todo) parent->chromacbdls[sp] = params.locallab.chromacbdl = parent->chromacbdls[0]; + if (parent->lastdusts[0] == 0) { + params.locallab.lastdust = false; + parent->lastdusts[sp] = 0; + } else { + params.locallab.lastdust = true; + parent->lastdusts[sp] = 1; + + } + + if (parent->blurmets[sp] == 0) { + params.locallab.blurMethod = "norm" ; + parent->qualitycurves[sp] = 0; + } else if (parent->blurmets[sp] == 1) { + params.locallab.blurMethod = "inv" ; + parent->blurmets[sp] = 1; + } else if (parent->blurmets[sp] == 2) { + params.locallab.blurMethod = "sym" ; + parent->blurmets[sp] = 2; + } + + if (parent->dustmets[sp] == 0) { + params.locallab.dustMethod = "cop" ; + parent->dustmets[sp] = 0; + } else if (parent->dustmets[sp] == 1) { + params.locallab.dustMethod = "mov" ; + parent->dustmets[sp] = 1; + } else if (parent->dustmets[sp] == 2) { + params.locallab.dustMethod = "pas" ; + parent->dustmets[sp] = 2; + } + std::vector ccret; for (int j = 0; j < parent->sizeretics[sp]; j++) { diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 857080bfc..edd3e858e 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -108,6 +108,9 @@ ImProcCoordinator::ImProcCoordinator () centerybufs (500, -10000), adjblurs (500, -10000), cutpasts (500, -10000), + lastdusts (500, -10000), + blurmets (500, -10000), + dustmets (500, -10000), locx (500, -10000), locy (500, -10000), @@ -839,7 +842,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) }; - int maxdata = 78;//73 for 10011 + int maxdata = 81;//78;//73 for 10011 if (fic0) { //find current version mip @@ -883,7 +886,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 = 10013;//new value for each change + int t_mipversion = 10014;//new value for each change int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -992,6 +995,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //10013 int t_chromacbdl = 0; + //10014 + int t_lastdust = 0; + int t_blurMethod = 0; + int t_dustMethod = 1; + + //all variables except locRETgainCurve 'coomon for all) fic << "Mipversion=" << t_mipversion << '@' << endl; fic << "Spot=" << t_sp << '@' << endl; @@ -1076,6 +1085,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic << "Chromacbdl=" << t_chromacbdl << '@' << endl; + fic << "Lastdust=" << t_lastdust << '@' << endl; + fic << "BlurMethod=" << t_blurMethod << '@' << endl; + fic << "DustMethod=" << t_dustMethod << '@' << endl; + fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; fic << "curveLH=" << t_curvlh << '@' << endl; @@ -1294,8 +1307,34 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) dataspot[73][0] = cutpasts[0] = 1; } + dataspot[74][0] = chromacbdls[0] = params.locallab.chromacbdl; + if (!params.locallab.lastdust) { + dataspot[75][0] = lastdusts[0] = 0; + } else { + dataspot[75][0] = lastdusts[0] = 1; + } + + if (params.locallab.blurMethod == "norm") { + dataspot[76][0] = blurmets[0] = 0; + } else if (params.locallab.blurMethod == "inv") { + dataspot[76][0] = blurmets[0] = 1; + } else if (params.locallab.blurMethod == "sym") { + dataspot[76][0] = blurmets[0] = 2; + } + + if (params.locallab.dustMethod == "cop") { + dataspot[77][0] = dustmets[0] = 0; + } else if (params.locallab.dustMethod == "mov") { + dataspot[77][0] = dustmets[0] = 1; + } else if (params.locallab.dustMethod == "pas") { + dataspot[77][0] = dustmets[0] = 2; + } + + + + // for all curves work around - I do not know how to do with params curves... //curve Reti local int siz = params.locallab.localTgaincurve.size(); @@ -1569,6 +1608,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) maxind = 74; } + if (versionmip == 10013) { + maxind = 77; + } + while (getline (fich, line)) { spotline = line; std::size_t pos = spotline.find ("="); @@ -1766,6 +1809,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } + if (versionmip <= 10013) {// + for (int sp = 1; sp < maxspot; sp++) { // spots default + dataspot[75][sp] = 0; + dataspot[76][sp] = 0; + dataspot[77][sp] = 1; + + } + } + //here we change the number of spot if (ns < (maxspot - 1)) { @@ -1774,7 +1826,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 = 10013; + int t_mipversion = 10014; int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -1875,6 +1927,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //10013 int t_chromacbdl = 0; + //10014 + int t_lastdust = 0; + int t_blurMethod = 0; + int t_dustMethod = 1; + fic << "Mipversion=" << t_mipversion << '@' << endl; fic << "Spot=" << t_sp << '@' << endl; fic << "Circrad=" << t_circrad << '@' << endl; @@ -1955,6 +2012,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic << "Cutpast=" << t_cutpast << '@' << endl; fic << "Chromacbdl=" << t_chromacbdl << '@' << endl; + fic << "Lastdust=" << t_lastdust << '@' << endl; + fic << "BlurMethod=" << t_blurMethod << '@' << endl; + fic << "DustMethod=" << t_dustMethod << '@' << endl; fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; @@ -2263,6 +2323,36 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) params.locallab.chromacbdl = chromacbdls[sp] = dataspot[74][sp]; + if (dataspot[75][sp] == 0) { + lastdusts[sp] = 0; + params.locallab.lastdust = false; + } else { + lastdusts[sp] = 1; + params.locallab.lastdust = true; + } + + if (dataspot[76][sp] == 0) { + blurmets[sp] = 0; + params.locallab.blurMethod = "norm" ; + } else if (dataspot[76][sp] == 1) { + blurmets[sp] = 1; + params.locallab.blurMethod = "inv" ; + } else if (dataspot[76][sp] == 2) { + blurmets[sp] = 2; + params.locallab.blurMethod = "sym" ; + } + + if (dataspot[77][sp] == 0) { + dustmets[sp] = 0; + params.locallab.dustMethod = "cop" ; + } else if (dataspot[76][sp] == 1) { + dustmets[sp] = 1; + params.locallab.dustMethod = "mov" ; + } else if (dataspot[77][sp] == 2) { + dustmets[sp] = 2; + params.locallab.dustMethod = "pas" ; + } + int *s_datc; s_datc = new int[70]; int siz; @@ -2745,6 +2835,44 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) dataspot[74][sp] = chromacbdls[sp] = params.locallab.chromacbdl = dataspot[74][0]; + if (dataspot[75][0] == 0) { + params.locallab.lastdust = false; + dataspot[75][sp] = 0; + lastdusts[sp] = 0; + } else { + params.locallab.lastdust = true; + dataspot[75][sp] = 1; + lastdusts[sp] = 1; + } + + if (dataspot[76][0] == 0) { + params.locallab.blurMethod = "norm" ; + blurmets[sp] = 0; + dataspot[76][sp] = 0; + } else if (dataspot[76][0] == 1) { + params.locallab.blurMethod = "inv" ; + blurmets[sp] = 1; + dataspot[76][sp] = 1; + } else if (dataspot[76][0] == 2) { + params.locallab.blurMethod = "sym" ; + blurmets[sp] = 2; + dataspot[76][sp] = 2; + } + + if (dataspot[77][0] == 0) { + params.locallab.dustMethod = "cop" ; + dustmets[sp] = 0; + dataspot[77][sp] = 0; + } else if (dataspot[77][0] == 1) { + params.locallab.dustMethod = "mov" ; + dustmets[sp] = 1; + dataspot[77][sp] = 1; + } else if (dataspot[77][0] == 2) { + params.locallab.dustMethod = "pas" ; + dustmets[sp] = 2; + dataspot[77][sp] = 2; + } + int *s_datc; s_datc = new int[70]; int siz; @@ -2983,7 +3111,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int spe = 1; spe < maxspot; spe++) { int t_sp = spe; - int t_mipversion = 10013; + int t_mipversion = 10014; int t_circrad = dataspot[2][spe]; int t_locX = dataspot[3][spe]; int t_locY = dataspot[4][spe]; @@ -3063,6 +3191,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_chromacbdl = dataspot[74][spe]; + int t_lastdust = dataspot[75][spe]; + int t_blurMethod = dataspot[76][spe]; + int t_dustMethod = dataspot[77][spe]; + int t_hueref = dataspot[maxdata - 3][spe]; int t_chromaref = dataspot[maxdata - 2][spe]; int t_lumaref = dataspot[maxdata - 1][spe]; @@ -3159,6 +3291,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fou << "Cutpast=" << t_cutpast << '@' << endl; fou << "Chromacbdl=" << t_chromacbdl << '@' << endl; + fou << "Lastdust=" << t_lastdust << '@' << endl; + fou << "BlurMethod=" << t_blurMethod << '@' << endl; + fou << "DustMethod=" << t_dustMethod << '@' << endl; fou << "hueref=" << t_hueref << '@' << endl; fou << "chromaref=" << t_chromaref << '@' << endl; @@ -3302,9 +3437,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) const FramesMetaData* metaData = imgsrc->getMetaData(); int imgNum = 0; + if (imgsrc->isRAW()) { if (imgsrc->getSensorType() == ST_BAYER) { - imgNum = rtengine::LIM(params.raw.bayersensor.imageNum, 0, metaData->getFrameCount() - 1); + imgNum = rtengine::LIM (params.raw.bayersensor.imageNum, 0, metaData->getFrameCount() - 1); } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { //imgNum = rtengine::LIM(params.raw.xtranssensor.imageNum, 0, metaData->getFrameCount() - 1); } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 0e8117c9a..9939c5c85 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -255,6 +255,10 @@ protected: LUTi centerybufs; LUTi adjblurs; LUTi cutpasts; + LUTi lastdusts; + LUTi blurmets; + LUTi dustmets; + LUTi locx; LUTi locy; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 831d0479b..c0cda4b71 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -303,7 +303,7 @@ public: void InverseReti_Local (const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); void Contrast_Local (int call, float ave, LabImage * bufcontorig, float ** buflightc, float moy, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, float pm, struct local_contra &lco, float lumaref, float av, const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); void cbdl_Local (int call, int sp, float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int chro); - void BlurNoise_Local (int call, int sp, LabImage* tmp1, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void BlurNoise_Local (int call, int sp, LabImage* tmp1, LabImage* tmp2, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); void TM_Local (int call, int sp, LabImage* tmp1, float ** buflight, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); static void strcurv_data (std::string retistr, int *s_datc, int &siz); void InverseContrast_Local (float ave, const struct local_contra& lco, const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index efe59aa4f..ccc5ded6b 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -75,6 +75,24 @@ float calcLocalFactor (const float lox, const float loy, const float lcx, const } +float calcLocalFactorinv (const float lox, const float loy, const float lcx, const float dx, const float lcy, const float dy, const float ach) +{ +//elipse x2/a2 + y2/b2=1 +//transition elipsoidal +//x==>lox y==>loy +// a==> dx b==>dy + + float kelip = dx / dy; + float belip = sqrt ((rtengine::SQR ((lox - lcx) / kelip) + rtengine::SQR (loy - lcy))); //determine position ellipse ==> a and b + float aelip = belip * kelip; + float degrad = aelip / dx; + float ap = rtengine::RT_PI / (ach); +// float bp = rtengine::RT_PI - ap; + return 0.5f * (1.f + xcosf (degrad * ap)); //trigo cos transition + +} + + } namespace rtengine @@ -110,6 +128,7 @@ struct local_params { float str; int qualmet; int qualcurvemet; + int blurmet; float noiself; float noiselc; float noisecf; @@ -188,6 +207,14 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str lp.qualcurvemet = 2; } + if (locallab.blurMethod == "norm") { + lp.blurmet = 0; + } else if (locallab.blurMethod == "inv") { + lp.blurmet = 1; + } else if (locallab.blurMethod == "sym") { + lp.blurmet = 2; + } + float local_noiself = locallab.noiselumf; float local_noiselc = locallab.noiselumc; float local_noisecf = locallab.noisechrof; @@ -365,6 +392,65 @@ static void calcTransition (const float lox, const float loy, const float ach, c } } +static void calcTransitioninv (const float lox, const float loy, const float ach, const local_params& lp, int &zone, float &localFactor) +{ + // returns the zone (0 = outside selection, 1 = zone between outside and inside selection, 2 = inside selection with transition) + // and a factor to calculate the transition in case zone == 2 + + zone = 0; + + if (lox >= lp.xc && lox < (lp.xc + lp.lx) && loy >= lp.yc && loy < lp.yc + lp.ly) { + float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lx)) + SQR ((loy - lp.yc) / (ach * lp.ly)); + zone = zoneVal < 1.f ? 2 : 0; + + if (!zone) { + zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lx)) + SQR ((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; + } + + if (zone == 2) { + localFactor = calcLocalFactorinv (lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach); + } + + } else if (lox >= lp.xc && lox < lp.xc + lp.lx && loy < lp.yc && loy > lp.yc - lp.lyT) { + float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lx)) + SQR ((loy - lp.yc) / (ach * lp.lyT)); + zone = zoneVal < 1.f ? 2 : 0; + + if (!zone) { + zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lx)) + SQR ((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; + } + + if (zone == 2) { + localFactor = calcLocalFactorinv (lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach); + } + + } else if (lox < lp.xc && lox > lp.xc - lp.lxL && loy <= lp.yc && loy > lp.yc - lp.lyT) { + float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lxL)) + SQR ((loy - lp.yc) / (ach * lp.lyT)); + zone = zoneVal < 1.f ? 2 : 0; + + if (!zone) { + zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lxL)) + SQR ((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; + } + + if (zone == 2) { + localFactor = calcLocalFactorinv (lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach); + } + + } else if (lox < lp.xc && lox > lp.xc - lp.lxL && loy > lp.yc && loy < lp.yc + lp.ly) { + float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lxL)) + SQR ((loy - lp.yc) / (ach * lp.ly)); + zone = zoneVal < 1.f ? 2 : 0; + + if (!zone) { + zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lxL)) + SQR ((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; + } + + if (zone == 2) { + localFactor = calcLocalFactorinv (lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach); + } + + } +} + + void ImProcFunctions::strcurv_data (std::string retistr, int *s_datc, int &siz) { std::string delim[69] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", @@ -2072,7 +2158,7 @@ void ImProcFunctions::TM_Local (int call, int sp, LabImage * tmp1, float **bufli -void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, LabImage * tmp2, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { //local BLUR BENCHFUN @@ -2116,13 +2202,26 @@ void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, float if (isZone0) { // outside selection and outside transition zone => no effect, keep original values for (int x = 0; x < transformed->W; x++) { - transformed->L[y][x] = original->L[y][x]; + if (lp.blurmet == 0) { + transformed->L[y][x] = original->L[y][x]; + } + + if (lp.blurmet == 2) { + transformed->L[y][x] = tmp2->L[y][x]; + } } if (!lp.actsp) { for (int x = 0; x < transformed->W; x++) { - transformed->a[y][x] = original->a[y][x]; - transformed->b[y][x] = original->b[y][x]; + if (lp.blurmet == 0) { + transformed->a[y][x] = original->a[y][x]; + transformed->b[y][x] = original->b[y][x]; + } + + if (lp.blurmet == 2) { + transformed->a[y][x] = tmp2->a[y][x]; + transformed->b[y][x] = tmp2->b[y][x]; + } } } @@ -2158,11 +2257,24 @@ void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, float 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]; + if (lp.blurmet == 0) { + transformed->L[y][x] = original->L[y][x]; + } + + if (lp.blurmet == 2) { + transformed->L[y][x] = tmp2->L[y][x]; + } if (!lp.actsp) { - transformed->a[y][x] = original->a[y][x]; - transformed->b[y][x] = original->b[y][x]; + if (lp.blurmet == 0) { + transformed->a[y][x] = original->a[y][x]; + transformed->b[y][x] = original->b[y][x]; + } + + if (lp.blurmet == 2) { + transformed->a[y][x] = tmp2->a[y][x]; + transformed->b[y][x] = tmp2->b[y][x]; + } } continue; @@ -2340,17 +2452,29 @@ void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, float difL *= factorx * (100.f + realstr) / 100.f; difL *= kch * fach; - transformed->L[y][x] = original->L[y][x] + difL; + if (lp.blurmet == 0) { + transformed->L[y][x] = original->L[y][x] + difL; + } + if (lp.blurmet == 2) { + transformed->L[y][x] = tmp2->L[y][x] - difL; + } if (!lp.actsp) { difa *= factorx * (100.f + realstrch * falu) / 100.f; difb *= factorx * (100.f + realstrch * falu) / 100.f; difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + if (lp.blurmet == 0) { + transformed->a[y][x] = CLIPC (original->a[y][x] + difa); + transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + } + + if (lp.blurmet == 2) { + transformed->a[y][x] = CLIPC (tmp2->a[y][x] - difa); + transformed->b[y][x] = CLIPC (tmp2->b[y][x] - difb); + } } break; @@ -2373,8 +2497,13 @@ void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, float difL *= (100.f + realstr) / 100.f; difL *= kch * fach; - transformed->L[y][x] = original->L[y][x] + difL; + if (lp.blurmet == 0) { + transformed->L[y][x] = original->L[y][x] + difL; + } + if (lp.blurmet == 2) { + transformed->L[y][x] = tmp2->L[y][x] - difL; + } if (!lp.actsp) { difa *= (100.f + realstrch * falu) / 100.f; @@ -2382,8 +2511,15 @@ void ImProcFunctions::BlurNoise_Local (int call, int sp, LabImage * tmp1, float difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + if (lp.blurmet == 0) { + transformed->a[y][x] = CLIPC (original->a[y][x] + difa); ; + transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + } + + if (lp.blurmet == 2) { + transformed->a[y][x] = CLIPC (tmp2->a[y][x] - difa); + transformed->b[y][x] = CLIPC (tmp2->b[y][x] - difb); + } } } @@ -5305,6 +5441,7 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** if (((radius >= 1.5 * GAUSS_SKIP && lp.rad > 1.) || lp.stren > 0.1) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image LabImage *tmp1 = nullptr; + LabImage *tmp2 = nullptr; LabImage *bufgb = nullptr; float **buflight = nullptr; float **bufchro = nullptr; @@ -5317,7 +5454,8 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** int bfw = int (lp.lx + lp.lxL) + del; float *orig[bfh] ALIGNED16; - if (call <= 3 && !lp.invrad) { + // if (call <= 3 && !lp.invrad) { + if (call <= 3 && lp.blurmet != 1) { bufgb = new LabImage (bfw, bfh); buflight = new float*[bfh]; @@ -5373,6 +5511,22 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** } tmp1 = new LabImage (bfw, bfh); + + if (lp.blurmet == 2) { + tmp2 = new LabImage (transformed->W, transformed->H); +#ifdef _OPENMP + #pragma omp parallel +#endif + { + gaussianBlur (original->L, tmp2->L, GW, GH, radius); + gaussianBlur (original->a, tmp2->a, GW, GH, radius); + gaussianBlur (original->b, tmp2->b, GW, GH, radius); + + } + + + } + #ifdef _OPENMP #pragma omp parallel #endif @@ -5403,7 +5557,8 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** addGaNoise (tmp1, tmp1, mean, variance, sk) ; } - if (!lp.invrad) { //blur and noise (center) + // if (!lp.invrad) { //blur and noise (center) + if (lp.blurmet != 1) { //blur and noise (center) float hueplus = hueref + dhuebn; float huemoins = hueref - dhuebn; @@ -5448,7 +5603,7 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** bufchro[ir][jr] = rch; } - BlurNoise_Local (call, sp, tmp1, buflight, bufchro, hueplus, huemoins, hueref, dhuebn, chromaref, lumaref, lp, original, transformed, cx, cy); + BlurNoise_Local (call, sp, tmp1, tmp2, buflight, bufchro, hueplus, huemoins, hueref, dhuebn, chromaref, lumaref, lp, original, transformed, cx, cy); } else { @@ -5456,7 +5611,9 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** } - if (call <= 3 && !lp.invrad) { + // if (call <= 3 && !lp.invrad) { + if (call <= 3 && lp.blurmet != 1) { + delete bufgb; for (int i = 0; i < bfh; i++) { @@ -5476,6 +5633,11 @@ void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** } delete tmp1; + + if (lp.blurmet == 2) { + delete tmp2; + } + } // } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 64d5748b9..6d401a28b 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -606,6 +606,9 @@ enum ProcEvent { Evlocallabadjblur = 576, Evlocallabcutpast = 577, Evlocallabchromacbdl = 578, + EvlocallabblurMethod = 579, + EvlocallabdustMethod = 580, + Evlocallablastdust = 581, NUMOFEVENTS diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index ebc8fc546..87d693634 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1033,8 +1033,11 @@ void LocallabParams::setDefaults() avoid = false; Smethod = "IND"; retinexMethod = "high"; + blurMethod = "norm"; + dustMethod = "mov"; invers = false; cutpast = false; + lastdust = false; curvactiv = false; activlum = false; radius = 1; @@ -2970,6 +2973,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_boolean ("Locallab", "Cutpast", locallab.cutpast); } + if (!pedited || pedited->locallab.lastdust) { + keyFile.set_boolean ("Locallab", "Lastdust", locallab.lastdust); + } + if (!pedited || pedited->locallab.curvactiv) { keyFile.set_boolean ("Locallab", "Curvactiv", locallab.curvactiv); } @@ -3002,6 +3009,14 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_string ("Locallab", "retinexMethod", locallab.retinexMethod); } + if (!pedited || pedited->locallab.blurMethod) { + keyFile.set_string ("Locallab", "BlurMethod", locallab.blurMethod); + } + + if (!pedited || pedited->locallab.dustMethod) { + keyFile.set_string ("Locallab", "DustMethod", locallab.dustMethod); + } + if (!pedited || pedited->locallab.qualityMethod) { keyFile.set_string ("Locallab", "qualityMethod", locallab.qualityMethod); } @@ -4781,6 +4796,14 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Locallab", "Lastdust")) { + locallab.lastdust = keyFile.get_boolean ("Locallab", "Lastdust"); + + if (pedited) { + pedited->locallab.lastdust = true; + } + } + if (keyFile.has_key ("Locallab", "Curvactiv")) { locallab.curvactiv = keyFile.get_boolean ("Locallab", "Curvactiv"); @@ -4846,6 +4869,22 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Locallab", "BlurMethod")) { + locallab.blurMethod = keyFile.get_string ("Locallab", "BlurMethod"); + + if (pedited) { + pedited->locallab.blurMethod = true; + } + } + + if (keyFile.has_key ("Locallab", "DustMethod")) { + locallab.dustMethod = keyFile.get_string ("Locallab", "DustMethod"); + + if (pedited) { + pedited->locallab.dustMethod = true; + } + } + if (keyFile.has_key ("Locallab", "qualityMethod")) { locallab.qualityMethod = keyFile.get_string ("Locallab", "qualityMethod"); @@ -9959,6 +9998,7 @@ bool ProcParams::operator== (const ProcParams& other) && locallab.avoid == other.locallab.avoid && locallab.invers == other.locallab.invers && locallab.cutpast == other.locallab.cutpast + && locallab.lastdust == other.locallab.lastdust && locallab.curvactiv == other.locallab.curvactiv && locallab.activlum == other.locallab.activlum && locallab.inversrad == other.locallab.inversrad @@ -9967,6 +10007,8 @@ bool ProcParams::operator== (const ProcParams& other) && locallab.degree == other.locallab.degree && locallab.Smethod == other.locallab.Smethod && locallab.retinexMethod == other.locallab.retinexMethod + && locallab.blurMethod == other.locallab.blurMethod + && locallab.dustMethod == other.locallab.dustMethod && locallab.qualityMethod == other.locallab.qualityMethod && locallab.qualitycurveMethod == other.locallab.qualitycurveMethod && locallab.locY == other.locallab.locY diff --git a/rtengine/procparams.h b/rtengine/procparams.h index cdc168dd2..e2c8556de 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -998,8 +998,11 @@ public: bool avoid; Glib::ustring Smethod; Glib::ustring retinexMethod; + Glib::ustring blurMethod; + Glib::ustring dustMethod; bool invers; bool cutpast; + bool lastdust; bool curvactiv; bool activlum; bool inversrad; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 9b27dbe95..2df3d53b3 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -605,7 +605,10 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabcenterbuf LUMINANCECURVE, //Evlocallabadjblur LUMINANCECURVE, //Evlocallabcutpast - LUMINANCECURVE //Evlocallabchromacbdl + LUMINANCECURVE, //Evlocallabchromacbdl + LUMINANCECURVE, //EvlocallabblurMethod + LUMINANCECURVE, //EvlocallabdustMethod + LUMINANCECURVE //Evlocallablastdust }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index f56f2f6dd..167209af7 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1102,7 +1102,7 @@ private: } ifstream fich (datalab, ios::in); - int maxdata = 78;//73 10011 + int maxdata = 81;//78;//73 10011 if (fich && versionmip != 0) { std::string inser; @@ -1305,6 +1305,28 @@ private: dataspots[74][0] = params.locallab.chromacbdl; + if (!params.locallab.lastdust) { + dataspots[75][0] = 0; + } else { + dataspots[75][0] = 1; + } + + if (params.locallab.blurMethod == "norm") { + dataspots[76][0] = 0; + } else if (params.locallab.blurMethod == "inv") { + dataspots[76][0] = 1; + } else if (params.locallab.blurMethod == "sym") { + dataspots[76][0] = 2; + } + + if (params.locallab.dustMethod == "cop") { + dataspots[77][0] = 0; + } else if (params.locallab.dustMethod == "mov") { + dataspots[77][0] = 1; + } else if (params.locallab.dustMethod == "pas") { + dataspots[77][0] = 2; + } + dataspots[maxdata - 3][0] = 100.f * params.locallab.hueref; dataspots[maxdata - 2][0] = params.locallab.chromaref; dataspots[maxdata - 1][0] = params.locallab.lumaref; @@ -1739,6 +1761,28 @@ private: params.locallab.chromacbdl = dataspots[74][sp]; + if (dataspots[75][sp] == 0) { + params.locallab.lastdust = false; + } else { + params.locallab.lastdust = true; + } + + if (dataspots[76][sp] == 0) { + params.locallab.blurMethod = "norm" ; + } else if (dataspots[76][sp] == 1) { + params.locallab.blurMethod = "inv" ; + } else if (dataspots[76][sp] == 2) { + params.locallab.blurMethod = "sym" ; + } + + if (dataspots[77][sp] == 0) { + params.locallab.dustMethod = "cop" ; + } else if (dataspots[77][sp] == 1) { + params.locallab.dustMethod = "mov" ; + } else if (dataspots[77][sp] == 2) { + params.locallab.dustMethod = "pas" ; + } + params.locallab.hueref = ((float) dataspots[maxdata - 3][sp]) / 100.f; params.locallab.chromaref = dataspots[maxdata - 2][sp]; params.locallab.lumaref = dataspots[maxdata - 1][sp]; @@ -2073,11 +2117,13 @@ private: if (params.colorappearance.enabled) { double adap; int imgNum = 0; + if (imgsrc->getSensorType() == ST_BAYER) { imgNum = params.raw.bayersensor.imageNum; } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { //imgNum = params.raw.xtranssensor.imageNum; } + float fnum = imgsrc->getMetaData()->getFNumber (imgNum); // F number float fiso = imgsrc->getMetaData()->getISOSpeed (imgNum) ; // ISO float fspeed = imgsrc->getMetaData()->getShutterSpeed (imgNum) ; //speed @@ -2259,7 +2305,7 @@ private: readyImg->setMetadata (ii->getMetaData()->getRootExifData ()); } else { // ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy - readyImg->setMetadata (ii->getMetaData()->getBestExifData(imgsrc, ¶ms.raw), params.exif, params.iptc); + readyImg->setMetadata (ii->getMetaData()->getBestExifData (imgsrc, ¶ms.raw), params.exif, params.iptc); } diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 30870f001..dbb2f453a 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -116,6 +116,8 @@ Locallab::Locallab (): retinexMethod (Gtk::manage (new MyComboBoxText ())), qualityMethod (Gtk::manage (new MyComboBoxText ())), qualitycurveMethod (Gtk::manage (new MyComboBoxText ())), + blurMethod (Gtk::manage (new MyComboBoxText ())), + dustMethod (Gtk::manage (new MyComboBoxText ())), artifFrame (Gtk::manage (new Gtk::Frame (M ("TP_LOCALLAB_ARTIF")))), shapeFrame (Gtk::manage (new Gtk::Frame (M ("TP_LOCALLAB_SHFR")))), @@ -152,6 +154,7 @@ Locallab::Locallab (): inversret (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_INVERS")))), inverssha (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_INVERS")))), cutpast (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_CUTPAST")))), + lastdust (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_LASTDUST")))), draggedPointOldAngle (-1000.) { @@ -403,6 +406,10 @@ Locallab::Locallab (): cutpast->set_tooltip_text (M ("TP_LOCALLAB_CUTPAST_TOOLTIP")); //tone mapping local + lastdust->set_active (false); + lastdustConn = lastdust->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::lastdustChanged) ); + lastdust->set_tooltip_text (M ("TP_LOCALLAB_LASTDUST_TOOLTIP")); + stren->setAdjusterListener (this); gamma->setAdjusterListener (this); @@ -622,6 +629,12 @@ Locallab::Locallab (): ToolParamBlock* const colorBox = Gtk::manage (new ToolParamBlock()); ToolParamBlock* const dustBox = Gtk::manage (new ToolParamBlock()); + dustMethod->append (M ("TP_LOCALLAB_DSCOP")); + dustMethod->append (M ("TP_LOCALLAB_DSMOV")); + dustMethod->append (M ("TP_LOCALLAB_DSPAS")); + dustMethod->set_active (0); + dustMethodConn = dustMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::dustMethodChanged) ); + dustMethod->set_tooltip_markup (M ("TP_LOCALLAB_BLMETHOD_TOOLTIP")); superBox->pack_start (*lightness); superBox->pack_start (*contrast); @@ -632,13 +645,15 @@ Locallab::Locallab (): colorBox->pack_start (*sensi); dustFrame->set_label_align (0.025, 0.5); + dustBox->pack_start (*dustMethod); + dustBox->pack_start (*lastdust); dustBox->pack_start (*cutpast); dustBox->pack_start (*centerXbuf); dustBox->pack_start (*centerYbuf); dustBox->pack_start (*adjblur); dustFrame->add (*dustBox); -// colorBox->pack_start (*dustFrame); + // colorBox->pack_start (*dustFrame); centerXbuf->hide(); centerYbuf->hide(); @@ -746,13 +761,22 @@ Locallab::Locallab (): ToolParamBlock* const blurrBox = Gtk::manage (new ToolParamBlock()); + blurMethod->append (M ("TP_LOCALLAB_BLNORM")); + blurMethod->append (M ("TP_LOCALLAB_BLINV")); + blurMethod->append (M ("TP_LOCALLAB_BLSYM")); + blurMethod->set_active (0); + blurMethodConn = blurMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::blurMethodChanged) ); + blurMethod->set_tooltip_markup (M ("TP_LOCALLAB_BLMETHOD_TOOLTIP")); blurrBox->pack_start (*radius); blurrBox->pack_start (*strength); blurrBox->pack_start (*sensibn); + blurrBox->pack_start (*blurMethod); + + blurrBox->pack_start (*activlum); - blurrBox->pack_start (*inversrad); +// blurrBox->pack_start (*inversrad); expblur->add (*blurrBox); expblur->setLevel (2); pack_start (*expblur); @@ -1178,6 +1202,8 @@ void Locallab::neutral_pressed () centerXbuf->resetValue (false); centerYbuf->resetValue (false); adjblur->resetValue (false); + blurMethod->set_active (0); + dustMethod->set_active (1); qualityMethod->set_active (0); qualitycurveMethod->set_active (0); @@ -1193,6 +1219,7 @@ void Locallab::neutral_pressed () sensibn->resetValue (false); invers->set_active (false); cutpast->set_active (false); + lastdust->set_active (false); curvactiv->set_active (false); inversrad->set_active (false); inversret->set_active (false); @@ -1702,6 +1729,28 @@ bool Locallab::localComputed_ () chromacbdl->setValue (nextdatasp[74]); + if (nextdatasp[75] == 0) { + lastdust->set_active (false); + } else { + lastdust->set_active (true); + } + + if (nextdatasp[76] == 0) { + blurMethod->set_active (0); + } else if (nextdatasp[76] == 1) { + blurMethod->set_active (1); + } else if (nextdatasp[76] == 2) { + blurMethod->set_active (2); + } + + if (nextdatasp[77] == 0) { + dustMethod->set_active (0); + } else if (nextdatasp[77] == 1) { + dustMethod->set_active (1); + } else if (nextdatasp[77] == 2) { + dustMethod->set_active (2); + } + double intermed = 0.01 * (double) nextdatasp[75]; hueref->setValue (intermed); chromaref->setValue (nextdatasp[76]); @@ -1891,6 +1940,18 @@ bool Locallab::localComputed_ () listener->panelChanged (Evlocallabcutpast, M ("GENERAL_ENABLED")); } + if (listener) {//for cutpast + listener->panelChanged (Evlocallablastdust, M ("GENERAL_ENABLED")); + } + + if (listener) {//for blur method + listener->panelChanged (EvlocallabblurMethod, blurMethod->get_active_text ()); + } + + if (listener) {//for dust method + listener->panelChanged (EvlocallabdustMethod, dustMethod->get_active_text ()); + } + if (listener) {//for curvactiv listener->panelChanged (Evlocallabcurvactiv, M ("GENERAL_ENABLED")); } @@ -1973,7 +2034,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 < 78; i++) { + for (int i = 2; i < 81; i++) { nextdatasp[i] = datasp[i][sp]; } @@ -2105,6 +2166,7 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) activlum->set_inconsistent (multiImage && !pedited->locallab.activlum); invers->set_inconsistent (multiImage && !pedited->locallab.invers); cutpast->set_inconsistent (multiImage && !pedited->locallab.cutpast); + lastdust->set_inconsistent (multiImage && !pedited->locallab.lastdust); curvactiv->set_inconsistent (multiImage && !pedited->locallab.curvactiv); inversrad->set_inconsistent (multiImage && !pedited->locallab.inversrad); inverssha->set_inconsistent (multiImage && !pedited->locallab.inverssha); @@ -2134,6 +2196,14 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) retinexMethod->set_active_text (M ("GENERAL_UNCHANGED")); } + if (!pedited->locallab.blurMethod) { + blurMethod->set_active_text (M ("GENERAL_UNCHANGED")); + } + + if (!pedited->locallab.dustMethod) { + dustMethod->set_active_text (M ("GENERAL_UNCHANGED")); + } + if (!pedited->locallab.qualityMethod) { qualityMethod->set_active_text (M ("GENERAL_UNCHANGED")); } @@ -2150,6 +2220,8 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) retinexMethodConn.block (true); qualityMethodConn.block (true); qualitycurveMethodConn.block (true); + blurMethodConn.block (true); + dustMethodConn.block (true); avoidConn.block (true); avoid->set_active (pp->locallab.avoid); @@ -2163,6 +2235,10 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) cutpastConn.block (true); cutpast->set_active (pp->locallab.cutpast); cutpastConn.block (false); + lastdustConn.block (true); + lastdust->set_active (pp->locallab.lastdust); + lastdustConn.block (false); + curvactivConn.block (true); curvactiv->set_active (pp->locallab.curvactiv); curvactivConn.block (false); @@ -2297,6 +2373,7 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) lastavoid = pp->locallab.avoid; lastinvers = pp->locallab.invers; lastcutpast = pp->locallab.cutpast; + lastlastdust = pp->locallab.lastdust; lastcurvactiv = pp->locallab.curvactiv; lastinversrad = pp->locallab.inversrad; lastinversret = pp->locallab.inversret; @@ -2304,6 +2381,7 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) activlumChanged(); inversChanged(); cutpastChanged(); + lastdustChanged(); curvactivChanged(); inversradChanged(); inversretChanged(); @@ -2335,6 +2413,28 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) retinexMethodChanged (); retinexMethodConn.block (false); + if (pp->locallab.blurMethod == "norm") { + blurMethod->set_active (0); + } else if (pp->locallab.blurMethod == "inv") { + blurMethod->set_active (1); + } else if (pp->locallab.blurMethod == "sym") { + blurMethod->set_active (2); + } + + blurMethodChanged (); + blurMethodConn.block (false); + + if (pp->locallab.dustMethod == "cop") { + dustMethod->set_active (0); + } else if (pp->locallab.dustMethod == "mov") { + dustMethod->set_active (1); + } else if (pp->locallab.dustMethod == "pas") { + dustMethod->set_active (2); + } + + dustMethodChanged (); + dustMethodConn.block (false); + if (pp->locallab.qualityMethod == "std") { qualityMethod->set_active (0); } else if (pp->locallab.qualityMethod == "enh") { @@ -2657,6 +2757,7 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pp->locallab.activlum = activlum->get_active(); pp->locallab.invers = invers->get_active(); pp->locallab.cutpast = cutpast->get_active(); + pp->locallab.lastdust = lastdust->get_active(); pp->locallab.curvactiv = curvactiv->get_active(); pp->locallab.inversrad = inversrad->get_active(); pp->locallab.inversret = inversret->get_active(); @@ -2710,6 +2811,8 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pedited->locallab.retinexMethod = retinexMethod->get_active_text() != M ("GENERAL_UNCHANGED"); pedited->locallab.qualityMethod = qualityMethod->get_active_text() != M ("GENERAL_UNCHANGED"); pedited->locallab.qualitycurveMethod = qualitycurveMethod->get_active_text() != M ("GENERAL_UNCHANGED"); + pedited->locallab.blurMethod = blurMethod->get_active_text() != M ("GENERAL_UNCHANGED"); + pedited->locallab.dustMethod = dustMethod->get_active_text() != M ("GENERAL_UNCHANGED"); pedited->locallab.locY = locY->getEditedState (); pedited->locallab.locX = locX->getEditedState (); pedited->locallab.locYT = locYT->getEditedState (); @@ -2759,6 +2862,7 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pedited->locallab.avoid = !avoid->get_inconsistent(); pedited->locallab.invers = !invers->get_inconsistent(); pedited->locallab.cutpast = !cutpast->get_inconsistent(); + pedited->locallab.lastdust = !lastdust->get_inconsistent(); pedited->locallab.curvactiv = !curvactiv->get_inconsistent(); pedited->locallab.activlum = !activlum->get_inconsistent(); pedited->locallab.inversret = !inversret->get_inconsistent(); @@ -2816,6 +2920,22 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pp->locallab.retinexMethod = "high"; } + if (blurMethod->get_active_row_number() == 0) { + pp->locallab.blurMethod = "norm"; + } else if (blurMethod->get_active_row_number() == 1) { + pp->locallab.blurMethod = "inv"; + } else if (blurMethod->get_active_row_number() == 2) { + pp->locallab.blurMethod = "sym"; + } + + if (dustMethod->get_active_row_number() == 0) { + pp->locallab.dustMethod = "cop"; + } else if (dustMethod->get_active_row_number() == 1) { + pp->locallab.dustMethod = "mov"; + } else if (dustMethod->get_active_row_number() == 2) { + pp->locallab.dustMethod = "pas"; + } + if (qualityMethod->get_active_row_number() == 0) { pp->locallab.qualityMethod = "std"; } else if (qualityMethod->get_active_row_number() == 1) { @@ -3054,6 +3174,36 @@ void Locallab::retinexMethodChanged() } } +void Locallab::blurMethodChanged() +{ + if (!batchMode) { + + } + + if (blurMethod->get_active_row_number() == 0 || blurMethod->get_active_row_number() == 2) { + sensibn->show(); + } else { + sensibn->hide(); + } + + if (listener) { + listener->panelChanged (EvlocallabblurMethod, blurMethod->get_active_text ()); + } +} + + +void Locallab::dustMethodChanged() +{ + if (!batchMode) { + + } + + + if (listener) { + listener->panelChanged (EvlocallabdustMethod, dustMethod->get_active_text ()); + } +} + void Locallab::qualityMethodChanged() { if (!batchMode) { @@ -3225,6 +3375,33 @@ void Locallab::cutpastChanged () } } +void Locallab::lastdustChanged () +{ + + if (batchMode) { + if (lastdust->get_inconsistent()) { + lastdust->set_inconsistent (false); + lastdustConn.block (true); + lastdust->set_active (false); + lastdustConn.block (false); + } else if (lastlastdust) { + lastdust->set_inconsistent (true); + } + + lastlastdust = lastdust->get_active (); + } + + + if (listener) { + if (getEnabled()) { + listener->panelChanged (Evlocallablastdust, M ("GENERAL_ENABLED")); + } else { + listener->panelChanged (Evlocallablastdust, M ("GENERAL_DISABLED")); + } + } +} + + void Locallab::curvactivChanged () { diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 0fb63c141..5e372da75 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -125,6 +125,8 @@ private: MyComboBoxText* const retinexMethod; MyComboBoxText* const qualityMethod; MyComboBoxText* const qualitycurveMethod; + MyComboBoxText* const blurMethod; + MyComboBoxText* const dustMethod; Gtk::Frame* const artifFrame; @@ -162,6 +164,7 @@ private: Gtk::CheckButton* const inversret; Gtk::CheckButton* const inverssha; Gtk::CheckButton* const cutpast; + Gtk::CheckButton* const lastdust; Gtk::Button* neutral; Gtk::HBox* neutrHBox; @@ -207,15 +210,17 @@ private: sigc::connection enablecolorConn, enableexposeConn, enablevibranceConn, enableblurConn, enabletonemapConn; sigc::connection enableretiConn, enablesharpConn, enablecbdlConn; sigc::connection enabledenoiConn; - sigc::connection editConn, avoidConn, inversConn, cutpastConn, curvactivConn, activlumConn, inversradConn, inversretConn, inversshaConn, neutralconn, neutralconn1; + sigc::connection editConn, avoidConn, inversConn, cutpastConn, lastdustConn, curvactivConn, activlumConn, inversradConn, inversretConn, inversshaConn, neutralconn, neutralconn1; sigc::connection Smethodconn; sigc::connection retinexMethodConn; sigc::connection qualityMethodConn; sigc::connection qualitycurveMethodConn; + sigc::connection blurMethodConn; + sigc::connection dustMethodConn; - int nextdatasp[78]; + int nextdatasp[81]; int nextlength; std::string nextstr; std::string nextstr2; @@ -242,7 +247,7 @@ private: double draggedlocYTOffset; double draggedlocXLOffset; rtengine::Coord draggedCenter; - bool lastavoid, lastinvers, lastcutpast, lastinversrad, lastinversret, lastactivlum, lastinverssha, lastcurvactiv; + bool lastavoid, lastinvers, lastcutpast, lastlastdust, lastinversrad, lastinversret, lastactivlum, lastinverssha, lastcurvactiv; int lastanbspot; void editToggled (); @@ -277,6 +282,8 @@ public: void inversretChanged (); void inversshaChanged (); void cutpastChanged (); + void lastdustChanged (); + void curveChanged (CurveEditor* ce); void autoOpenCurve (); void 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); @@ -285,6 +292,8 @@ public: bool localretComputed_ (); void setEditProvider (EditDataProvider* provider); void retinexMethodChanged(); + void blurMethodChanged(); + void dustMethodChanged(); void qualityMethodChanged(); void qualitycurveMethodChanged(); void lumaneutralPressed (); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 86190f3f5..43de8aab8 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -367,8 +367,11 @@ void ParamsEdited::set (bool v) locallab.avoid = v; locallab.Smethod = v; locallab.retinexMethod = v; + locallab.blurMethod = v; + locallab.dustMethod = v; locallab.invers = v; locallab.cutpast = v; + locallab.lastdust = v; locallab.curvactiv = v; locallab.activlum = v; locallab.inversrad = v; @@ -950,6 +953,7 @@ void ParamsEdited::initFrom (const std::vector locallab.avoid = locallab.avoid && p.locallab.avoid == other.locallab.avoid; locallab.invers = locallab.invers && p.locallab.invers == other.locallab.invers; locallab.cutpast = locallab.cutpast && p.locallab.cutpast == other.locallab.cutpast; + locallab.lastdust = locallab.lastdust && p.locallab.lastdust == other.locallab.lastdust; locallab.curvactiv = locallab.curvactiv && p.locallab.curvactiv == other.locallab.curvactiv; locallab.activlum = locallab.activlum && p.locallab.activlum == other.locallab.activlum; locallab.inversrad = locallab.inversrad && p.locallab.inversrad == other.locallab.inversrad; @@ -962,6 +966,8 @@ void ParamsEdited::initFrom (const std::vector locallab.locXL = locallab.locXL && p.locallab.locXL == other.locallab.locXL; locallab.Smethod = locallab.Smethod && p.locallab.Smethod == other.locallab.Smethod; locallab.retinexMethod = locallab.retinexMethod && p.locallab.retinexMethod == other.locallab.retinexMethod; + locallab.blurMethod = locallab.blurMethod && p.locallab.blurMethod == other.locallab.blurMethod; + locallab.dustMethod = locallab.dustMethod && p.locallab.dustMethod == other.locallab.dustMethod; locallab.centerX = locallab.centerX && p.locallab.centerX == other.locallab.centerX; locallab.centerY = locallab.centerY && p.locallab.centerY == other.locallab.centerY; locallab.circrad = locallab.circrad && p.locallab.circrad == other.locallab.circrad; @@ -2381,6 +2387,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.locallab.cutpast = mods.locallab.cutpast; } + if (locallab.lastdust) { + toEdit.locallab.lastdust = mods.locallab.lastdust; + } + if (locallab.curvactiv) { toEdit.locallab.curvactiv = mods.locallab.curvactiv; } @@ -2429,6 +2439,14 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.locallab.retinexMethod = mods.locallab.retinexMethod; } + if (locallab.blurMethod) { + toEdit.locallab.blurMethod = mods.locallab.blurMethod; + } + + if (locallab.dustMethod) { + toEdit.locallab.dustMethod = mods.locallab.dustMethod; + } + if (locallab.qualityMethod) { toEdit.locallab.qualityMethod = mods.locallab.qualityMethod; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index b29709db0..8fe0b84ef 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -479,6 +479,8 @@ public: bool avoid; bool Smethod; bool retinexMethod; + bool blurMethod; + bool dustMethod; bool str; bool neigh; bool nbspot; @@ -490,6 +492,7 @@ public: bool activlum; bool invers; bool cutpast; + bool lastdust; bool curvactiv; bool inversrad; bool inversret;