diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index ac5480e9d..44893f2af 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -392,7 +392,7 @@ public: void dehazeloc(Imagefloat *rgb, float deha, float depth); void ToneMapFattal02(Imagefloat *rgb); void localContrast(LabImage *lab); - void localContrastloc(LabImage *lab, int scale, int rad, int amo, int darkn, int lightn, float **loctemp); + void localContrastloc(LabImage *lab, int scale, int rad, float amo, float darkn, float lightn, float **loctemp); void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread); void shadowsHighlights(LabImage *lab); void softLight(LabImage *lab); diff --git a/rtengine/iplocalcontrast.cc b/rtengine/iplocalcontrast.cc index 9f8df7add..cc54257f5 100644 --- a/rtengine/iplocalcontrast.cc +++ b/rtengine/iplocalcontrast.cc @@ -69,14 +69,14 @@ void ImProcFunctions::localContrast(LabImage *lab) } } -void ImProcFunctions::localContrastloc(LabImage *lab, int scale, int rad, int amo, int darkn, int lightn, float **loctemp) +void ImProcFunctions::localContrastloc(LabImage *lab, int scale, int rad, float amo, float darkn, float lightn, float **loctemp) { const int width = lab->W; const int height = lab->H; - const float a = (float)(amo) / 100.f; - const float dark = (float)(darkn) / 100.f; - const float light = (float)(lightn) / 100.f; + const float a = amo; + const float dark = darkn; + const float light = lightn; array2D buf(width, height); const float sigma = (float)(rad) / scale; @@ -97,7 +97,6 @@ void ImProcFunctions::localContrastloc(LabImage *lab, int scale, int rad, int am bufval *= (bufval > 0.f) ? light : dark; } - // lab->L[y][x] = std::max(0.0001f, lab->L[y][x] + bufval); loctemp[y][x] = std::max(0.0001f, lab->L[y][x] + bufval); } diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index b52fcad77..bdd889e52 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -367,7 +367,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float thre = locallab.spots.at(sp).thresh; - if (thre > 8 || thre < 0) {//to avoid artifacts if user does not clear cache with new settings. Can be suppressed after + if (thre > 8.f || thre < 0.f) {//to avoid artifacts if user does not clear cache with new settings. Can be suppressed after thre = 2.f; } @@ -442,10 +442,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float multi[5]; for (int y = 0; y < 5; y++) { - multi[y] = ((float) locallab.spots.at(sp).mult[y]) / 100.f; + multi[y] = ((float) locallab.spots.at(sp).mult[y]); } - float thresho = ((float)locallab.spots.at(sp).threshold) / 100.f; + float thresho = ((float)locallab.spots.at(sp).threshold); float chromcbdl = (float)locallab.spots.at(sp).chromacbdl; int local_chroma = locallab.spots.at(sp).chroma; @@ -477,7 +477,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall int local_transit = locallab.spots.at(sp).transit; double radius = (double) locallab.spots.at(sp).radius; double sharradius = ((double) locallab.spots.at(sp).sharradius); - double lcamount = ((double) locallab.spots.at(sp).lcamount) / 100.; + double lcamount = ((double) locallab.spots.at(sp).lcamount); double sharblurr = ((double) locallab.spots.at(sp).sharblur); int local_sensisha = locallab.spots.at(sp).sensisha; int local_sharamount = locallab.spots.at(sp).sharamount; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 001c86655..c1f67181c 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2343,7 +2343,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : spotMethod("norm"), sensiexclu(12), structexclu(0), - struc(4), + struc(4.0), shapeMethod("IND"), locX(250), locXL(250), @@ -2354,7 +2354,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : circrad(18), qualityMethod("enh"), transit(60), - thresh(2), + thresh(2.0), iter(2.0), // Color & Light expcolor(false), @@ -2456,15 +2456,15 @@ LocallabParams::LocallabSpot::LocallabSpot() : // Local Contrast expcontrast(false), lcradius(80), - lcamount(0), - lcdarkness(100), - lclightness(100), + lcamount(0.0), + lcdarkness(1.0), + lclightness(1.0), sensilc(19), // Contrast by detail levels expcbdl(false), - mult{100.0, 100.0, 100.0, 100.0, 100.0}, + mult{1.0, 1.0, 1.0, 1.0, 1.0}, chromacbdl(0), - threshold(20.0), + threshold(0.2), sensicb(15), // Denoise expdenoi(false), diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 9e07ec1c8..85929dc57 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -943,7 +943,7 @@ struct LocallabParams { Glib::ustring spotMethod; // norm, exc int sensiexclu; int structexclu; - int struc; + double struc; Glib::ustring shapeMethod; // IND, SYM, INDSL, SYMSL int locX; int locXL; @@ -954,7 +954,7 @@ struct LocallabParams { int circrad; Glib::ustring qualityMethod; // none, std, enh, enhsup, contr, sob2 int transit; - int thresh; + double thresh; double iter; // Color & Light bool expcolor; @@ -1058,9 +1058,9 @@ struct LocallabParams { // Local Contrast bool expcontrast; int lcradius; - int lcamount; - int lcdarkness; - int lclightness; + double lcamount; + double lcdarkness; + double lclightness; int sensilc; // Contrast by detail levels bool expcbdl; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 8b317058b..b9b741753 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -48,7 +48,7 @@ ControlSpotPanel::ControlSpotPanel(): sensiexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIEXCLU"), 0, 100, 1, 12))), structexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), - struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1, 12, 1, 4))), + struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1.0, 12.0, 0.1, 4.0))), locX_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH"), 0, 2250, 1, 250))), locXL_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH_L"), 0, 2250, 1, 250))), locY_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT"), 0, 2250, 1, 250))), @@ -57,8 +57,8 @@ ControlSpotPanel::ControlSpotPanel(): centerY_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))), circrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))), transit_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), - thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0, 8, 1, 2))), - iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 4., 0.1, 2.))), + thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 8.0, 0.1, 2.0))), + iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 4.0, 0.1, 2.0))), lastObject_(-1), lastCoord_(new Coord()), @@ -232,7 +232,6 @@ ControlSpotPanel::ControlSpotPanel(): artifFrame->set_tooltip_text(M("TP_LOCALLAB_ARTIF_TOOLTIP")); ToolParamBlock* const artifBox = Gtk::manage(new ToolParamBlock()); thresh_->setAdjusterListener(this); - // struc_->set_tooltip_text(M("TP_LOCALLAB_STRUC_TOOLTIP")); struc_->setAdjusterListener(this); artifBox->pack_start(*struc_); artifBox->pack_start(*thresh_); @@ -718,7 +717,7 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) } if (a == struc_) { - row[spots_.struc] = (int) struc_->getValue(); + row[spots_.struc] = struc_->getValue(); if (listener) { listener->panelChanged(EvLocallabSpotStruc, struc_->getTextValue()); @@ -823,7 +822,7 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) } if (a == thresh_) { - row[spots_.thresh] = (int) thresh_->getValue(); + row[spots_.thresh] = thresh_->getValue(); if (listener) { listener->panelChanged(EvLocallabSpotThresh, thresh_->getTextValue()); @@ -1910,7 +1909,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi sensiexclu_->setDefault((double)defSpot->sensiexclu); structexclu_->setDefault((double)defSpot->structexclu); - struc_->setDefault((double)defSpot->struc); + struc_->setDefault(defSpot->struc); locX_->setDefault((double)defSpot->locX); locXL_->setDefault((double)defSpot->locXL); locY_->setDefault((double)defSpot->locY); @@ -1919,7 +1918,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi centerY_->setDefault((double)defSpot->centerY); circrad_->setDefault((double)defSpot->circrad); transit_->setDefault((double)defSpot->transit); - thresh_->setDefault((double)defSpot->thresh); + thresh_->setDefault(defSpot->thresh); // iter_->setDefault((double)defSpot->iter); iter_->setDefault(defSpot->iter); diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index 868231dd7..c555071a8 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -49,7 +49,7 @@ public: int spotMethod; // 0 = Normal, 1 = Excluding int sensiexclu; int structexclu; - int struc; + double struc; int shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) int locX; int locXL; @@ -60,7 +60,7 @@ public: int circrad; int qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise int transit; - int thresh; + double thresh; double iter; }; @@ -261,7 +261,7 @@ private: Gtk::TreeModelColumn spotMethod; // 0 = Normal, 1 = Excluding Gtk::TreeModelColumn sensiexclu; Gtk::TreeModelColumn structexclu; - Gtk::TreeModelColumn struc; + Gtk::TreeModelColumn struc; Gtk::TreeModelColumn shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) Gtk::TreeModelColumn locX; Gtk::TreeModelColumn locXL; @@ -272,7 +272,7 @@ private: Gtk::TreeModelColumn circrad; Gtk::TreeModelColumn qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise Gtk::TreeModelColumn transit; - Gtk::TreeModelColumn thresh; + Gtk::TreeModelColumn thresh; Gtk::TreeModelColumn iter; }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 1db2e8d18..7c4f5ae25 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -128,13 +128,13 @@ Locallab::Locallab(): sensisha(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))), // Local Contrast lcradius(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_RADIUS"), 20, 200, 1, 80))), - lcamount(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_AMOUNT"), 0, 100, 1, 0))), - lcdarkness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_DARKNESS"), 0, 300, 1, 100))), - lclightness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_LIGHTNESS"), 0, 300, 1, 100))), + lcamount(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_AMOUNT"), 0, 1.0, 0.01, 0))), + lcdarkness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_DARKNESS"), 0, 3.0, 0.01, 1.0))), + lclightness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_LIGHTNESS"), 0, 3.0, 0.01, 1.0))), sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))), // Contrast by detail levels chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0))), - threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 100, 1, 20))), + threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))), sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSICB"), 0, 100, 1, 15))), // Denoise noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 1, 0))), @@ -744,7 +744,7 @@ Locallab::Locallab(): ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMACOARSEST")); } - multiplier[i] = Gtk::manage(new Adjuster(ss, 0, 400, 1, 100)); + multiplier[i] = Gtk::manage(new Adjuster(ss, 0.0, 4.0, 0.01, 1.0)); multiplier[i]->setAdjusterListener(this); } @@ -1026,7 +1026,7 @@ void Locallab::lumaneutralPressed() // printf("lumaneutralPressed\n"); for (int i = 0; i < 5; i++) { - multiplier[i]->setValue(100); + multiplier[i]->setValue(1.0); } // Raise event (only for first multiplier because associated event concerns all multipliers) @@ -1621,15 +1621,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) // Local Contrast pp->locallab.spots.at(pp->locallab.selspot).expcontrast = expcontrast->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).lcradius = lcradius->getIntValue(); - pp->locallab.spots.at(pp->locallab.selspot).lcamount = lcamount->getIntValue(); - pp->locallab.spots.at(pp->locallab.selspot).lcdarkness = lcdarkness->getIntValue(); - pp->locallab.spots.at(pp->locallab.selspot).lclightness = lclightness->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).lcamount = lcamount->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).lcdarkness = lcdarkness->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).lclightness = lclightness->getValue(); pp->locallab.spots.at(pp->locallab.selspot).sensilc = sensilc->getIntValue(); // Contrast by detail levels pp->locallab.spots.at(pp->locallab.selspot).expcbdl = expcbdl->getEnabled(); for (int i = 0; i < 5; i++) { - pp->locallab.spots.at(pp->locallab.selspot).mult[i] = multiplier[i]->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).mult[i] = multiplier[i]->getValue(); } pp->locallab.spots.at(pp->locallab.selspot).chromacbdl = chromacbdl->getIntValue(); @@ -2645,9 +2645,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe sensisha->setDefault((double)defSpot->sensisha); // Local Contrast lcradius->setDefault((double)defSpot->lcradius); - lcamount->setDefault((double)defSpot->lcamount); - lcdarkness->setDefault((double)defSpot->lcdarkness); - lclightness->setDefault((double)defSpot->lclightness); + lcamount->setDefault(defSpot->lcamount); + lcdarkness->setDefault(defSpot->lcdarkness); + lclightness->setDefault(defSpot->lclightness); sensilc->setDefault((double)defSpot->sensilc); // Contrast by detail levels