diff --git a/rtdata/languages/default b/rtdata/languages/default index d9dc02222..64b893866 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -845,6 +845,7 @@ HISTORY_MSG_597;Local L*a*b* HISTORY_MSG_598;Local - Bottom HISTORY_MSG_599;Local - Noise bilateral HISTORY_MSG_600;Local - Noise Equal. Black-White +HISTORY_MSG_601;Local - Shape Rt-spot method HISTORY_MSG_LOCALCONTRAST_AMOUNT;Local Contrast - Amount HISTORY_MSG_LOCALCONTRAST_DARKNESS;Local Contrast - Darkness HISTORY_MSG_LOCALCONTRAST_ENABLED;Local Contrast @@ -1909,6 +1910,10 @@ TP_LOCALLAB_SENSI;Scope TP_LOCALLAB_SENSI_TOOLTIP;Adjust scope of action:\nSmall values limit action to colors very similar to those under the center spot.\nHigh values let the tool act upon a wider range of colors.\nValues smaller than 20 lead to a better algorithm. TP_LOCALLAB_SENSIH;Hue Scope TP_LOCALLAB_SENSIH_TOOLTIP;Adjust scope of action:\nSmall values limit action to colors very similar to those under the center spot.\nHigh values let the tool act upon a wider range of colors.\nValues smaller than 20 lead to a better algorithm. +TP_LOCALLAB_SHAPETYPE;Shape RT-spot area +TP_LOCALLAB_SHAPE_TOOLTIP;Rectangle is only in normal mode. +TP_LOCALLAB_ELI;Elipse +TP_LOCALLAB_RECT;Rectangle TP_LOCALLAB_SHARP;Sharpening TP_LOCALLAB_SHARRADIUS;Radius TP_LOCALLAB_SHARAMOUNT;Amount diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 0d5cc1c64..20b5b5286 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1208,6 +1208,11 @@ void Crop::update(int todo) params.locallab.bilateral = parent->bilaterals[sp]; params.locallab.noiselequal = parent->noiselequals[sp]; + if (parent->shapemets[sp] == 0) { + params.locallab.shapemethod = "ELI" ; + } else if (parent->shapemets[sp] == 1) { + params.locallab.shapemethod = "RECT" ; + } std::vector cretie; @@ -1684,6 +1689,14 @@ void Crop::update(int todo) parent->bilaterals[sp] = params.locallab.bilateral = parent->bilaterals[0]; parent->noiselequals[sp] = params.locallab.noiselequal = parent->noiselequals[0]; + if (parent->shapemets[sp] == 0) { + params.locallab.shapemethod = "ELI" ; + parent->shapemets[sp] = 0; + } else if (parent->shapemets[sp] == 1) { + params.locallab.shapemethod = "RECT" ; + parent->shapemets[sp] = 1; + } + std::vector ccret; for (int j = 0; j < parent->sizeretics[sp]; j++) { diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 551629c0c..af317d922 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -201,6 +201,7 @@ ImProcCoordinator::ImProcCoordinator() sizeskintonecurves(500, -10000), excurves(25000, -10000), sizeexcurves(500, -10000), + shapemets(500, -1000), exclumets(500, -1000), sensiexclus(500, -1000), strucs(500, -1000), @@ -875,7 +876,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) }; - int maxdata = 101; //100 10022 //99 10021 // 90 10020 //88 10019//87 10018 //86 10017 //85 10016;// 82 10015//78;//73 for 10011 + int maxdata = 102; //101 10023 //100 10022 //99 10021 // 90 10020 //88 10019//87 10018 //86 10017 //85 10016;// 82 10015//78;//73 for 10011 if (fic0) { //find current version mip @@ -919,7 +920,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 = 10023;//new value for each change + int t_mipversion = 10024;//new value for each change int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -1064,6 +1065,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) //10023 int t_noiselequal = 7; + //10024 + int t_shapemeth = 0; + //all variables except locRETgainCurve 'coomon for all) fic << "Mipversion=" << t_mipversion << '@' << endl; fic << "Spot=" << t_sp << '@' << endl; @@ -1172,6 +1176,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) fic << "Bilateral=" << t_bilateral << '@' << endl; fic << "Noiselequal=" << t_noiselequal << '@' << endl; + fic << "ShapeMethod=" << t_shapemeth << '@' << endl; fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; @@ -1485,6 +1490,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) dataspot[94][0] = bilaterals[0] = params.locallab.bilateral; dataspot[95][0] = noiselequals[0] = params.locallab.noiselequal; + if (params.locallab.shapemethod == "ELI") { + dataspot[96][0] = shapemets[0] = 0; + } else if (params.locallab.shapemethod == "RECT") { + dataspot[96][0] = shapemets[0] = 1; + } + // for all curves work around - I do not know how to do with params curves... //curve Reti local int siz = params.locallab.localTgaincurve.size(); @@ -1794,6 +1805,10 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) maxind = 93; } + if (versionmip == 10023) { + maxind = 94; + } + while (getline(fich, line)) { spotline = line; std::size_t pos = spotline.find("="); @@ -2061,6 +2076,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) } } + if (versionmip <= 10023) {// + for (int sp = 1; sp < maxspot; sp++) { // spots default + dataspot[96][sp] = 0; + + } + } + //here we change the number of spot if (ns < (maxspot - 1)) { @@ -2069,7 +2091,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 = 10023; + int t_mipversion = 10024; int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -2206,6 +2228,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) //10023 int t_noiselequal = 7; + //10024 + int t_shapemeth = 0; fic << "Mipversion=" << t_mipversion << '@' << endl; fic << "Spot=" << t_sp << '@' << endl; @@ -2311,6 +2335,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) fic << "Bilateral=" << t_bilateral << '@' << endl; fic << "Noiselequal=" << t_noiselequal << '@' << endl; + fic << "ShapeMethod=" << t_shapemeth << '@' << endl; fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; @@ -2740,6 +2765,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) params.locallab.bilateral = bilaterals[sp] = dataspot[94][sp]; params.locallab.noiselequal = noiselequals[sp] = dataspot[95][sp]; + if (dataspot[96][sp] == 0) { + shapemets[sp] = 0; + params.locallab.shapemethod = "ELI" ; + } else if (dataspot[96][sp] == 1) { + shapemets[sp] = 1; + params.locallab.shapemethod = "RECT" ; + } + int *s_datc; s_datc = new int[70]; int siz; @@ -3381,6 +3414,16 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) dataspot[94][sp] = bilaterals[sp] = params.locallab.bilateral = dataspot[94][0]; dataspot[95][sp] = noiselequals[sp] = params.locallab.noiselequal = dataspot[95][0]; + if (dataspot[96][0] == 0) { + params.locallab.shapemethod = "ELI" ; + shapemets[sp] = 0; + dataspot[96][sp] = 0; + } else if (dataspot[96][0] == 1) { + params.locallab.shapemethod = "RECT" ; + shapemets[sp] = 1; + dataspot[96][sp] = 1; + } + int *s_datc; s_datc = new int[70]; int siz; @@ -3620,7 +3663,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) for (int spe = 1; spe < maxspot; spe++) { int t_sp = spe; - int t_mipversion = 10023; + int t_mipversion = 10024; int t_circrad = dataspot[2][spe]; int t_locX = dataspot[3][spe]; int t_locY = dataspot[4][spe]; @@ -3724,6 +3767,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) int t_bilateral = dataspot[94][spe]; int t_noiselequal = dataspot[95][spe]; + int t_shapemeth = dataspot[96][spe]; int t_huerefblur = dataspot[maxdata - 5][spe]; int t_hueref = dataspot[maxdata - 4][spe]; @@ -3846,6 +3890,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) fou << "Bilateral=" << t_bilateral << '@' << endl; fou << "Noiselequal=" << t_noiselequal << '@' << endl; + fou << "ShapeMethod=" << t_shapemeth << '@' << endl; fou << "huerefblur=" << t_huerefblur << '@' << endl; fou << "hueref=" << t_hueref << '@' << endl; diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 7f20d60c8..2cfd33c11 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -355,6 +355,7 @@ protected: LUTi excurves; LUTi sizeexcurves; + LUTi shapemets; LUTi exclumets; LUTi sensiexclus; LUTi strucs; diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 4940c8ed6..bea843b7e 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -87,6 +87,28 @@ float calcLocalFactor(const float lox, const float loy, const float lcx, const f return 0.5f * (1.f + xcosf(degrad * ap + bp)); //trigo cos transition } +float calcLocalFactorrect(const float lox, const float loy, const float lcx, const float dx, const float lcy, const float dy, const float ach) +{ + float eps = 0.0001f; + float krap = fabs(dx / dy); + float kx = (lox - lcx); + float ky = (loy - lcy); + float ref = 0.f; + + if (fabs(kx / (ky + eps)) < krap) { + ref = sqrt(rtengine::SQR(dy) * (1.f + rtengine::SQR(kx / (ky + eps)))); + } else { + ref = sqrt(rtengine::SQR(dx) * (1.f + rtengine::SQR(ky / (kx + eps)))); + } + + float rad = sqrt(rtengine::SQR(kx) + rtengine::SQR(ky)); + float coef = rad / ref; + float ac = 1.f / (ach - 1.f); + float fact = ac * (coef - 1.f); + return fact; + +} + /* float calcLocalFactorinv (const float lox, const float loy, const float lcx, const float dx, const float lcy, const float dy, const float ach) { @@ -186,6 +208,7 @@ struct local_params { int strucc; int war; float adjch; + int shapmet; }; @@ -387,6 +410,12 @@ static void calcLocalParams(int oW, int oH, const LocallabParams& locallab, stru lp.excmet = 1; } + if (locallab.shapemethod == "ELI") { + lp.shapmet = 0; + } else if (locallab.shapemethod == "RECT") { + lp.shapmet = 1; + } + float local_noiself = (float)locallab.noiselumf; float local_noiselc = (float)locallab.noiselumc; float local_noiseldetail = locallab.noiselumdetail; @@ -522,6 +551,51 @@ static void calcLocalParams(int oW, int oH, const LocallabParams& locallab, stru lp.war = local_warm; } + + +static void calcTransitionrect(const float lox, const float loy, const float ach, const local_params& lp, int &zone, float &localFactor) +{ + zone = 0; + + if (lox >= lp.xc && lox < (lp.xc + lp.lx) && loy >= lp.yc && loy < lp.yc + lp.ly) { + if (lox < (lp.xc + lp.lx * ach) && loy < (lp.yc + lp.ly * ach)) { + zone = 2; + } else { + zone = 1; + localFactor = calcLocalFactorrect(lox, loy, lp.xc, lp.lx, lp.yc, lp.ly, ach); + } + + } else if (lox >= lp.xc && lox < lp.xc + lp.lx && loy < lp.yc && loy > lp.yc - lp.lyT) { + if (lox < (lp.xc + lp.lx * ach) && loy > (lp.yc - lp.lyT * ach)) { + zone = 2; + } else { + zone = 1; + localFactor = calcLocalFactorrect(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) { + if (lox > (lp.xc - lp.lxL * ach) && loy > (lp.yc - lp.lyT * ach)) { + zone = 2; + } else { + zone = 1; + localFactor = calcLocalFactorrect(lox, loy, lp.xc, lp.lxL, lp.yc, lp.lyT, ach); + } + + } else if (lox < lp.xc && lox > lp.xc - lp.lxL && loy > lp.yc && loy < lp.yc + lp.ly) { + if (lox > (lp.xc - lp.lxL * ach) && loy < (lp.yc + lp.ly * ach)) { + zone = 2; + } else { + zone = 1; + localFactor = calcLocalFactorrect(lox, loy, lp.xc, lp.lxL, lp.yc, lp.ly, ach); + } + + } + +} + + + static void calcTransition(const float lox, const float loy, const float ach, const local_params& lp, int &zone, float &localFactor) { // returns the zone (0 = outside selection, 1 = transition zone between outside and inside selection, 2 = inside selection) @@ -1971,7 +2045,14 @@ void ImProcFunctions::DeNoise_Local_imp(const struct local_params& lp, int levr int begy = int (lp.yc - lp.lyT); float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -2194,7 +2275,14 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, in int begy = int (lp.yc - lp.lyT); float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -2449,7 +2537,14 @@ void ImProcFunctions::cat02_Local(float **buflightcat, float **buf_a_cat, float int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -2838,7 +2933,14 @@ void ImProcFunctions::cbdl_Local(float ** buflight, float ** bufchrom, float **l int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -3225,7 +3327,14 @@ void ImProcFunctions::TM_Local(LabImage * tmp1, float **buflight, const float hu int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -3574,7 +3683,14 @@ void ImProcFunctions::BlurNoise_Local(int call, LabImage * tmp1, LabImage * tmp2 int begy = int (lp.yc - lp.lyT); float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values if (lp.blurmet == 0) { @@ -3867,7 +3983,14 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, LabImage int zone; float localFactor; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); switch (zone) { case 0: { // outside selection and outside transition zone => full effect, no transition @@ -4034,7 +4157,14 @@ void ImProcFunctions::Reti_Local(float **buflight, float **bufchro, const float int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -4359,7 +4489,14 @@ void ImProcFunctions::InverseBlurNoise_Local(const struct local_params & lp, Lab int zone; float localFactor; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); switch (zone) { case 0: { // outside selection and outside transition zone => full effect, no transition @@ -4543,7 +4680,14 @@ void ImProcFunctions::Contrast_Local(int call, float ** buflightc, const float h int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -4909,7 +5053,14 @@ void ImProcFunctions::InverseContrast_Local(float ave, struct local_contra & lco int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); #ifdef __SSE2__ @@ -5210,7 +5361,14 @@ void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueplus, c #endif int zone; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); //prepare shape detection float khu = 0.f; float kch = 1.f; @@ -5443,7 +5601,14 @@ void ImProcFunctions::Sharp_Local(int call, float **loctemp, const float hueplus int lox = cx + x; int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -5714,7 +5879,14 @@ void ImProcFunctions::Exclude_Local(int sen, float **deltaso, float **buflight, int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -6169,7 +6341,14 @@ void ImProcFunctions::Expose_Local(int sen, float **buflight, float **bufchro, c int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } + + // 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]; @@ -6623,7 +6802,12 @@ void ImProcFunctions::ColorLight_Local(int call, LabImage * bufcolorig, float ** int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransitionrect(lox, loy, ach, lp, zone, localFactor); + } if (zone == 0) { continue; @@ -7419,7 +7603,14 @@ void ImProcFunctions::InverseColorLight_Local(const struct local_params & lp, La int zone = 0; float localFactor = 1.f; - calcTransition(lox, loy, ach, lp, zone, localFactor); + + if (lp.shapmet == 0) { + calcTransition(lox, loy, ach, lp, zone, localFactor); + } else if (lp.shapmet == 1) { + calcTransition(lox, loy, ach, lp, zone, localFactor);//rect not good + } + + // calcTransition(lox, loy, ach, lp, zone, localFactor); #ifdef __SSE2__ diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 84efdb34b..da4374077 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -627,6 +627,7 @@ enum ProcEventCode { EvlocallablocY = 597, Evlocallabbilateral = 598, Evlocallabnoiselequal = 599, + Evlocallabshapemethod = 600, NUMOFEVENTS diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 2cc134da7..7098f2716 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2434,6 +2434,7 @@ transit(60), avoid(false), Smethod("IND"), Exclumethod("norm"), +shapemethod("ELI"), retinexMethod("high"), blurMethod("norm"), dustMethod("mov"), @@ -2493,6 +2494,7 @@ bool LocallabParams::operator ==(const LocallabParams& other) const && degree == other.degree && Smethod == other.Smethod && Exclumethod == other.Exclumethod + && shapemethod == other.shapemethod && retinexMethod == other.retinexMethod && blurMethod == other.blurMethod && dustMethod == other.dustMethod @@ -3495,6 +3497,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.degree, "Locallab", "Degree", locallab.degree, keyFile); saveToKeyfile(!pedited || pedited->locallab.Smethod, "Locallab", "Smethod", locallab.Smethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.Exclumethod, "Locallab", "Exclumethod", locallab.Exclumethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.shapemethod, "Locallab", "Shapemethod", locallab.shapemethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.retinexMethod, "Locallab", "retinexMethod", locallab.retinexMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.blurMethod, "Locallab", "BlurMethod", locallab.blurMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.dustMethod, "Locallab", "DustMethod", locallab.dustMethod, keyFile); @@ -4606,6 +4609,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Degree", pedited, locallab.degree, pedited->locallab.degree); assignFromKeyfile(keyFile, "Locallab", "Smethod", pedited, locallab.Smethod, pedited->locallab.Smethod); assignFromKeyfile(keyFile, "Locallab", "Exclumethod", pedited, locallab.Exclumethod, pedited->locallab.Exclumethod); + assignFromKeyfile(keyFile, "Locallab", "Shapemethod", pedited, locallab.shapemethod, pedited->locallab.shapemethod); assignFromKeyfile(keyFile, "Locallab", "retinexMethod", pedited, locallab.retinexMethod, pedited->locallab.retinexMethod); assignFromKeyfile(keyFile, "Locallab", "BlurMethod", pedited, locallab.blurMethod, pedited->locallab.blurMethod); assignFromKeyfile(keyFile, "Locallab", "DustMethod", pedited, locallab.dustMethod, pedited->locallab.dustMethod); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index f9e9e9689..8c0745677 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -964,6 +964,7 @@ struct LocallabParams { bool avoid; Glib::ustring Smethod; Glib::ustring Exclumethod; + Glib::ustring shapemethod; Glib::ustring retinexMethod; Glib::ustring blurMethod; Glib::ustring dustMethod; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 019a580e8..0fc436786 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -626,7 +626,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvlocallabEnabled LUMINANCECURVE, // EvlocallablocY LUMINANCECURVE, // Evlocallabbilateral - LUMINANCECURVE // Evlocallabnoiselequal + LUMINANCECURVE, // Evlocallabnoiselequal + LUMINANCECURVE // Evlocallabshapemethod }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 8a62ad150..a5215cd97 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1103,7 +1103,7 @@ private: } ifstream fich(datalab, ios::in); - int maxdata = 101; //100 10022 //99 10021 // 91 10021 //88 10019 //87 10018//86 10017//85 10016 //82;//78;//73 10011 + int maxdata = 102; //101 10023 //100 10022 //99 10021 // 91 10021 //88 10019 //87 10018//86 10017//85 10016 //82;//78;//73 10011 if (fich && versionmip != 0) { std::string inser; @@ -1399,6 +1399,12 @@ private: dataspots[94][0] = params.locallab.bilateral; dataspots[95][0] = params.locallab.noiselequal; + if (params.locallab.shapemethod == "ELI") { + dataspots[96][0] = 0; + } else if (params.locallab.shapemethod == "RECT") { + dataspots[96][0] = 1; + } + 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; @@ -1930,6 +1936,11 @@ private: params.locallab.bilateral = dataspots[94][sp]; params.locallab.noiselequal = dataspots[95][sp]; + if (dataspots[96][sp] == 0) { + params.locallab.shapemethod = "ELI" ; + } else if (dataspots[96][sp] == 1) { + params.locallab.shapemethod = "RECT" ; + } params.locallab.huerefblur = ((float) dataspots[maxdata - 5][sp]) / 100.f; params.locallab.hueref = ((float) dataspots[maxdata - 4][sp]) / 100.f; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index a2e459f67..c002cacab 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -280,6 +280,7 @@ Locallab::Locallab(): centerXbuf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTERBUF_X"), -1000, 1000, 1, 0))), centerYbuf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTERBUF_Y"), -1000, 1000, 1, 0))), + shapemethod(Gtk::manage(new MyComboBoxText())), Smethod(Gtk::manage(new MyComboBoxText())), Exclumethod(Gtk::manage(new MyComboBoxText())), @@ -313,8 +314,10 @@ Locallab::Locallab(): labqualcurv(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_QUALCURV_METHOD") + ":"))), labmS(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_STYPE") + ":"))), labmEx(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_EXCLUTYPE") + ":"))), + labmshape(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_SHAPETYPE") + ":"))), ctboxS(Gtk::manage(new Gtk::HBox())), + ctboxshape(Gtk::manage(new Gtk::HBox())), ctboxEx(Gtk::manage(new Gtk::HBox())), dhbox(Gtk::manage(new Gtk::HBox())), qualbox(Gtk::manage(new Gtk::HBox())), @@ -395,9 +398,19 @@ Locallab::Locallab(): expdenoi->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expdenoi)); enabledenoiConn = expdenoi->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expdenoi)); + + ctboxshape->pack_start(*labmshape, Gtk::PACK_SHRINK, 4); + ctboxshape->set_tooltip_markup(M("TP_LOCALLAB_SHAPE_TOOLTIP")); + ctboxEx->pack_start(*labmEx, Gtk::PACK_SHRINK, 4); ctboxEx->set_tooltip_markup(M("TP_LOCALLAB_EXCLUTYPE_TOOLTIP")); + shapemethod->append(M("TP_LOCALLAB_ELI")); + shapemethod->append(M("TP_LOCALLAB_RECT")); + shapemethod->set_active(0); + shapemethodconn = shapemethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::shapemethodChanged)); + + Exclumethod->append(M("TP_LOCALLAB_EXNORM")); Exclumethod->append(M("TP_LOCALLAB_EXECLU")); Exclumethod->set_active(0); @@ -412,6 +425,7 @@ Locallab::Locallab(): ctboxS->pack_start(*labmS, Gtk::PACK_SHRINK, 4); ctboxS->set_tooltip_markup(M("TP_LOCALLAB_STYPE_TOOLTIP")); + Smethod->append(M("TP_LOCALLAB_IND")); Smethod->append(M("TP_LOCALLAB_SYM")); Smethod->append(M("TP_LOCALLAB_INDSL")); @@ -689,6 +703,9 @@ Locallab::Locallab(): chromaref->hide(); lumaref->hide(); sobelref->hide(); + ctboxshape->pack_start(*shapemethod); + shapeBox->pack_start(*ctboxshape); + ctboxEx->pack_start(*Exclumethod); shapeBox->pack_start(*ctboxEx); @@ -702,6 +719,7 @@ Locallab::Locallab(): shapeBox->pack_start(*excluFrame); +// ctboxS->pack_start(*shapemethod); ctboxS->pack_start(*Smethod); shapeBox->pack_start(*ctboxS); @@ -1500,6 +1518,7 @@ void Locallab::updateToolState(std::vector &tpOpen) void Locallab::neutral_pressed() { Smethod->set_active(0); + shapemethod->set_active(0); Exclumethod->set_active(0); locX->resetValue(false); locXL->resetValue(false); @@ -2139,14 +2158,20 @@ bool Locallab::localComputed_() bilateral->setValue(nextdatasp[94]); noiselequal->setValue(nextdatasp[95]); - double intermedblur = 0.01 * (double) nextdatasp[96]; + if (nextdatasp[96] == 0) { + shapemethod->set_active(0); + } else if (nextdatasp[96] == 1) { + shapemethod->set_active(1); + } + + double intermedblur = 0.01 * (double) nextdatasp[97]; huerefblur->setValue(intermedblur); - double intermed = 0.01 * (double) nextdatasp[97]; + double intermed = 0.01 * (double) nextdatasp[98]; hueref->setValue(intermed); - chromaref->setValue(nextdatasp[98]); - lumaref->setValue(nextdatasp[99]); - sobelref->setValue(nextdatasp[100]); + chromaref->setValue(nextdatasp[99]); + lumaref->setValue(nextdatasp[100]); + sobelref->setValue(nextdatasp[101]); int *s_datc; s_datc = new int[70]; @@ -2348,6 +2373,10 @@ bool Locallab::localComputed_() listener->panelChanged(Evlocallabexclumethod, Exclumethod->get_active_text()); } + if (listener) {//for shape RT-spot method + listener->panelChanged(Evlocallabshapemethod, shapemethod->get_active_text()); + } + if (listener) {//for curvactiv listener->panelChanged(Evlocallabcurvactiv, M("GENERAL_ENABLED")); } @@ -2463,7 +2492,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 < 101; i++) { + for (int i = 2; i < 102; i++) { nextdatasp[i] = datasp[i][sp]; } @@ -2633,6 +2662,10 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) Smethod->set_active_text(M("GENERAL_UNCHANGED")); } + if (!pedited->locallab.shapemethod) { + shapemethod->set_active_text(M("GENERAL_UNCHANGED")); + } + if (!pedited->locallab.Exclumethod) { Exclumethod->set_active_text(M("GENERAL_UNCHANGED")); } @@ -2661,6 +2694,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) setEnabled(pp->locallab.enabled); + shapemethodconn.block(true); Smethodconn.block(true); Exclumethodconn.block(true); retinexMethodConn.block(true); @@ -2845,6 +2879,16 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) updateGeometry(pp->locallab.centerX, pp->locallab.centerY, pp->locallab.circrad, pp->locallab.locY, pp->locallab.degree, pp->locallab.locX, pp->locallab.locYT, pp->locallab.locXL); + if (pp->locallab.shapemethod == "ELI") { + shapemethod->set_active(0); + } else if (pp->locallab.shapemethod == "RECT") { + shapemethod->set_active(1); + } + + shapemethodChanged(); + shapemethodconn.block(false); + + if (pp->locallab.Smethod == "IND") { Smethod->set_active(0); } else if (pp->locallab.Smethod == "SYM") { @@ -2855,6 +2899,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) Smethod->set_active(3); } + SmethodChanged(); Smethodconn.block(false); @@ -3285,6 +3330,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) if (pedited) { pedited->locallab.degree = degree->getEditedState(); pedited->locallab.Smethod = Smethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.shapemethod = shapemethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.Exclumethod = Exclumethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.retinexMethod = retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.qualityMethod = qualityMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -3446,6 +3492,12 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.Exclumethod = "exc"; } + if (shapemethod->get_active_row_number() == 0) { + pp->locallab.shapemethod = "ELI"; + } else if (shapemethod->get_active_row_number() == 1) { + pp->locallab.shapemethod = "RECT"; + } + if (Smethod->get_active_row_number() == 0) { pp->locallab.Smethod = "IND"; } else if (Smethod->get_active_row_number() == 1) { @@ -3752,6 +3804,17 @@ void Locallab::ExclumethodChanged() } +void Locallab::shapemethodChanged() +{ + if (!batchMode) { + // + } + + + if (listener) { + listener->panelChanged(Evlocallabshapemethod, shapemethod->get_active_text()); + } +} void Locallab::SmethodChanged() { diff --git a/rtgui/locallab.h b/rtgui/locallab.h index ebf9cf935..a3087fe09 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -131,6 +131,7 @@ private: Adjuster* const centerYbuf; // Adjuster* const adjblur; + MyComboBoxText* const shapemethod; MyComboBoxText* const Smethod; MyComboBoxText* const Exclumethod; MyComboBoxText* const retinexMethod; @@ -152,8 +153,10 @@ private: Gtk::Label* const labqualcurv; Gtk::Label* const labmS; Gtk::Label* const labmEx; + Gtk::Label* const labmshape; Gtk::HBox* const ctboxS; + Gtk::HBox* const ctboxshape; Gtk::HBox* const ctboxEx; Gtk::HBox* const dhbox; @@ -235,7 +238,7 @@ private: sigc::connection enableretiConn, enablesharpConn, enablecbdlConn; sigc::connection enabledenoiConn; sigc::connection editConn, avoidConn, inversConn, cutpastConn, lastdustConn, curvactivConn, activlumConn, inversradConn, inversretConn, inversshaConn, neutralconn, neutralconn1; - sigc::connection Smethodconn, Exclumethodconn; + sigc::connection Smethodconn, shapemethodconn, Exclumethodconn; sigc::connection retinexMethodConn; sigc::connection qualityMethodConn; sigc::connection qualitycurveMethodConn; @@ -244,7 +247,7 @@ private: - int nextdatasp[101]; + int nextdatasp[102]; int nextlength; std::string nextstr; std::string nextstr2; @@ -289,6 +292,7 @@ public: void updateGeometry(const int centerX_, const int centerY_, const int circrad_, const int locY_, const double degree_, const int locX_, const int locYT_, const int locXL_, const int fullWidth = -1, const int fullHeight = -1); void SmethodChanged(); + void shapemethodChanged(); void ExclumethodChanged(); void writeOptions(std::vector &tpOpen); void updateToolState(std::vector &tpOpen); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 91c986b2b..bb289cd96 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -385,6 +385,7 @@ void ParamsEdited::set(bool v) locallab.avoid = v; locallab.Smethod = v; locallab.Exclumethod = v; + locallab.shapemethod = v; locallab.retinexMethod = v; locallab.blurMethod = v; locallab.dustMethod = v; @@ -1002,6 +1003,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.locYT = locallab.locYT && p.locallab.locYT == other.locallab.locYT; locallab.locXL = locallab.locXL && p.locallab.locXL == other.locallab.locXL; locallab.Smethod = locallab.Smethod && p.locallab.Smethod == other.locallab.Smethod; + locallab.shapemethod = locallab.shapemethod && p.locallab.shapemethod == other.locallab.shapemethod; locallab.Exclumethod = locallab.Exclumethod && p.locallab.Exclumethod == other.locallab.Exclumethod; locallab.retinexMethod = locallab.retinexMethod && p.locallab.retinexMethod == other.locallab.retinexMethod; locallab.blurMethod = locallab.blurMethod && p.locallab.blurMethod == other.locallab.blurMethod; @@ -2530,6 +2532,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.Exclumethod = mods.locallab.Exclumethod; } + if (locallab.shapemethod) { + toEdit.locallab.shapemethod = mods.locallab.shapemethod; + } + if (locallab.retinexMethod) { toEdit.locallab.retinexMethod = mods.locallab.retinexMethod; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index edc5f146d..f51d25c11 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -506,6 +506,7 @@ public: bool avoid; bool Smethod; bool Exclumethod; + bool shapemethod; bool sensiexclu; bool struc; bool retinexMethod;