diff --git a/rtdata/languages/default b/rtdata/languages/default index e78002452..cfddc51f8 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1004,6 +1004,9 @@ HISTORY_MSG_763;Local - Blur Laplacian mask HISTORY_MSG_764;Local - Solve PDE Laplacian mask HISTORY_MSG_765;Local - deNoise Detail threshold HISTORY_MSG_766;Local - Blur Fast Fourier +HISTORY_MSG_767;Local - Grain Iso +HISTORY_MSG_768;Local - Grain Strength +HISTORY_MSG_769;Local - Grain Scale HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2079,7 +2082,7 @@ TP_LOCALLAB_BILATERAL;Bilateral filter TP_LOCALLAB_MASK_TOOLTIP;You can enable multiple masks for a single tool, this requires activating another tool (but without using the tool : sliders to 0,...) where is the mask you want to activate.\nMasks with this ability are marked '+'\nThe number indicates the order of use of the masks.\n\nYou can combine the mask associated with the tool with an inverse mask.\nIn this case the new tool associated with the mask must be selected in inverse; you must use the tool with very small values (ex Exposure 0.01) TP_LOCALLAB_CHROMASK_TOOLTIP;You can use this slider to desaturated background (inverse mask - curve near 0).\nAlso to attenuate or enhance the action of a mask on the chroma TP_LOCALLAB_BLENDMASKCOL;Blend -TP_LOCALLAB_BLUR;Gaussian Blur and Noise +TP_LOCALLAB_BLUR;Gaussian Blur - Noise - Grain TP_LOCALLAB_BLUMETHOD_TOOLTIP;To blur the background and isolate the foreground:\n*Blur the background by a RT-spot fully covering the image (high values for scope and transition) - normal or inverse.\n*Isolate the foreground by one or more excluding RT-spot with the tools you want (increse scope), you can use a mask to enhance and amplify the effects TP_LOCALLAB_BLMED;Median TP_LOCALLAB_BLGUID;Guided Filter Luminance @@ -2087,7 +2090,11 @@ TP_LOCALLAB_GUIDBL;Soft radius TP_LOCALLAB_EPSBL;Detail TP_LOCALLAB_SCALERETI;Scale 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;Smooth - Blur & Noise +TP_LOCALLAB_BLUFR;Smooth - Blur - Noise - Grain +TP_LOCALLAB_GRAINFRA;Film Grain 1:1 +TP_LOCALLAB_ISOGR;Coarseness (ISO) +TP_LOCALLAB_STRENGR;Strength +TP_LOCALLAB_SCALEGR;Scale TP_LOCALLAB_BLURDE;Blur Shape detection TP_LOCALLAB_BLNORM;Normal TP_LOCALLAB_BLINV;Inverse diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 565ff4eb0..872ce6da0 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -85,6 +85,7 @@ set(RTENGINESOURCEFILES impulse_denoise.cc init.cc ipdehaze.cc + ipgrain.cc iplab2rgb.cc iplocallab.cc iplabregions.cc diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 1b1260c27..737ca125f 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -203,6 +203,7 @@ public: void fftw_tile_blur(int GW, int GH, int tilssize , int max_numblox_W, int min_numblox_W, float **tmp1, int numThreads, double radius); void maskforretinex(int sp, int before, float ** luminance, float ** out, int W_L, int H_L, int skip, const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread); + void filmGrain(Imagefloat *rgb, int isogr, int strengr, int scalegr, int bfw, int bfh); void MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, int llretiMask, LabImage * transformed, bool retiMasktmap, bool retiMask); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 14d51c600..b0ac0e2ea 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -5444,6 +5444,7 @@ void ImProcFunctions::fftw_denoise(int GW, int GH, int max_numblox_W, int min_nu const int detail_thresh = lp.detailthr; array2D mask; float scalea = 1.f; + if (detail_thresh > 0) { mask(GW, GH); float thr = log2lin(float(detail_thresh) / 200.f, 100.f); @@ -6832,7 +6833,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bool blurz = false; - if (((radius >= 1.5 * GAUSS_SKIP && lp.rad > 1.) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 1 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { + if (((radius > 1.5 * GAUSS_SKIP) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 1 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { blurz = true; } @@ -7023,7 +7024,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } - if (((radius >= 1.5 * GAUSS_SKIP && lp.rad > 1.) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image + if (((radius > 1.5 * GAUSS_SKIP && lp.rad > 1.6) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image std::unique_ptr tmp1; std::unique_ptr tmp2; const int ystart = std::max(static_cast(lp.yc - lp.lyT) - cy, 0); @@ -7033,6 +7034,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const int bfh = yend - ystart; const int bfw = xend - xstart; bool fft = params->locallab.spots.at(sp).fftwbl; + int isogr = params->locallab.spots.at(sp).isogr; + int strengr = params->locallab.spots.at(sp).strengr; + int scalegr = params->locallab.spots.at(sp).scalegr; if (bfw >= mSP && bfh >= mSP) { @@ -7079,7 +7083,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } - if (lp.blurmet == 0 && lp.blmet == 0 && radius >= (1.5 * GAUSS_SKIP)) { + if (lp.blurmet == 0 && lp.blmet == 0 && radius > (1.5 * GAUSS_SKIP) && lp.rad > 1.6) { #ifdef _OPENMP #pragma omp parallel #endif @@ -7091,13 +7095,13 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o ImProcFunctions::fftw_convol_blur2(tmp1->b, tmp1->b, bfw, bfh, radius, 0, 0); } else { - gaussianBlur(tmp1->L, tmp1->L, bfw, bfh, radius); + gaussianBlur(tmp1->L, tmp1->L, bfw, bfh, radius); gaussianBlur(tmp1->a, tmp1->a, bfw, bfh, radius); gaussianBlur(tmp1->b, tmp1->b, bfw, bfh, radius); } } - } else if (lp.blurmet == 1 && lp.blmet == 0 && radius >= (1.5 * GAUSS_SKIP)) { + } else if (lp.blurmet == 1 && lp.blmet == 0 && radius > (1.5 * GAUSS_SKIP) && lp.rad > 1.6) { #ifdef _OPENMP #pragma omp parallel @@ -7118,13 +7122,50 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } - + //add noise if (tmp1.get() && lp.stren > 0.1f && lp.blmet == 0) { float mean = 0.f;//0 best result float variance = lp.stren ; addGaNoise(tmp1.get(), tmp1.get(), mean, variance, sk) ; } + //add grain + if (lp.blmet == 0 && strengr > 0) { + int wi = bfw; + int he = bfh; + + if (lp.blurmet == 1) { + wi = GW; + he = GH; + } + + if (tmp1.get()) { + Imagefloat *tmpImage = nullptr; + tmpImage = new Imagefloat(wi, he); + + for (int y = 0; y < he ; y++) { + for (int x = 0; x < wi; x++) { + tmpImage->g(y, x) = tmp1->L[y][x]; + tmpImage->r(y, x) = tmp1->a[y][x]; + tmpImage->b(y, x) = tmp1->b[y][x]; + } + } + + + filmGrain(tmpImage, isogr, strengr, scalegr, wi, he); + + for (int y = 0; y < he ; y++) { + for (int x = 0; x < wi; x++) { + tmp1->L[y][x] = tmpImage->g(y, x); + tmp1->a[y][x] = tmpImage->r(y, x); + tmp1->b[y][x] = tmpImage->b(y, x); + } + } + + delete tmpImage; + } + } + Median medianTypeL = Median::TYPE_3X3_STRONG; Median medianTypeAB = Median::TYPE_3X3_STRONG; @@ -7204,18 +7245,21 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { LL[y][x] = tmp1->L[y][x]; } } + int r = max(int(lp.guidb / sk), 1); - + const float epsil = 0.001f * std::pow(2, - lp.epsb); rtengine::guidedFilterLog(10.f, LL, r, epsil, multiThread); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { tmp1->L[y][x] = LL[y][x]; @@ -7236,22 +7280,25 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o tmp2->L[y][x] = original->L[y][x]; } } + array2D LLI(GW, GH); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < GH ; y++) { for (int x = 0; x < GW; x++) { LLI[y][x] = tmp1->L[y][x]; } } - + int r = max(int(lp.guidb / sk), 1); const float epsil = 0.001f * std::pow(2, - lp.epsb); rtengine::guidedFilterLog(10.f, LLI, r, epsil, multiThread); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int y = 0; y < GH ; y++) { for (int x = 0; x < GW; x++) { tmp1->L[y][x] = LLI[y][x]; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 45eb8c2a4..123a27adc 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -793,6 +793,9 @@ enum ProcEventCode { Evlocallablaplac = 763, Evlocallabdetailthr = 764, Evlocallabfftwbl = 765, + Evlocallabisogr = 766, + Evlocallabstrengr = 767, + Evlocallabscalegr = 768, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f7091b1f5..6f5bf8ea7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2545,6 +2545,9 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensibn(40), itera(1), guidbl(0), + isogr(400), + strengr(0), + scalegr(100), epsbl(0), blMethod("guid"), blurMethod("norm"), @@ -2824,6 +2827,9 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensibn == other.sensibn && itera == other.itera && guidbl == other.guidbl + && isogr == other.isogr + && strengr == other.strengr + && scalegr == other.scalegr && epsbl == other.epsbl && blMethod == other.blMethod && blurMethod == other.blurMethod @@ -4089,6 +4095,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensibn, "Locallab", "Sensibn_" + std::to_string(i), spot.sensibn, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).itera, "Locallab", "Iteramed_" + std::to_string(i), spot.itera, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).guidbl, "Locallab", "Guidbl_" + std::to_string(i), spot.guidbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).isogr, "Locallab", "Isogr_" + std::to_string(i), spot.isogr, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strengr, "Locallab", "Strengr_" + std::to_string(i), spot.strengr, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).scalegr, "Locallab", "Scalegr_" + std::to_string(i), spot.scalegr, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).epsbl, "Locallab", "Epsbl_" + std::to_string(i), spot.epsbl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blMethod, "Locallab", "BlMethod_" + std::to_string(i), spot.blMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurMethod, "Locallab", "BlurMethod_" + std::to_string(i), spot.blurMethod, keyFile); @@ -5481,6 +5490,9 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sensibn_" + std::to_string(i), pedited, spot.sensibn, spotEdited.sensibn); assignFromKeyfile(keyFile, "Locallab", "Iteramed_" + std::to_string(i), pedited, spot.itera, spotEdited.itera); assignFromKeyfile(keyFile, "Locallab", "Guidbl_" + std::to_string(i), pedited, spot.guidbl, spotEdited.guidbl); + assignFromKeyfile(keyFile, "Locallab", "Isogr_" + std::to_string(i), pedited, spot.isogr, spotEdited.isogr); + assignFromKeyfile(keyFile, "Locallab", "Strengr_" + std::to_string(i), pedited, spot.strengr, spotEdited.strengr); + assignFromKeyfile(keyFile, "Locallab", "Scalegr_" + std::to_string(i), pedited, spot.scalegr, spotEdited.scalegr); assignFromKeyfile(keyFile, "Locallab", "Epsbl_" + std::to_string(i), pedited, spot.epsbl, spotEdited.epsbl); assignFromKeyfile(keyFile, "Locallab", "BlMethod_" + std::to_string(i), pedited, spot.blMethod, spotEdited.blMethod); assignFromKeyfile(keyFile, "Locallab", "BlurMethod_" + std::to_string(i), pedited, spot.blurMethod, spotEdited.blurMethod); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index cb78ff180..631df2e37 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1094,6 +1094,9 @@ struct LocallabParams { int sensibn; int itera; int guidbl; + int isogr; + int strengr; + int scalegr; int epsbl; Glib::ustring blMethod; Glib::ustring blurMethod; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 74ee8c1cd..8789b1a10 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -792,7 +792,10 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallablapmaskbl LUMINANCECURVE, //Evlocallablaplac LUMINANCECURVE, //Evlocallabdetailthr - LUMINANCECURVE //Evlocallabfftwbl + LUMINANCECURVE, //Evlocallabfftwbl + LUMINANCECURVE, //Evlocallabisogr + LUMINANCECURVE, //Evlocallabstrengr + LUMINANCECURVE //Evlocallabscalegr }; namespace rtengine diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 8635e6beb..91d45c8de 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -255,6 +255,9 @@ Locallab::Locallab(): gammaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.05, 5.0, 0.01, 1.))), slomaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), lapmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), + isogr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ISOGR"), 20, 6400, 1, 400))), + strengr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGR"), 0, 100, 1, 0))), + scalegr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCALEGR"), 0, 100, 1, 100))), // Tone Mapping stren(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STREN"), -0.5, 2.0, 0.01, 0.5))), gamma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAM"), 0.4, 4.0, 0.11, 1.0))), @@ -430,6 +433,7 @@ Locallab::Locallab(): retitoolFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RETITOOLFRA")))), residFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RESID")))), clariFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CLARIFRA")))), + grainFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRAINFRA")))), // retiBox(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CLARIFRA")))), retiBox(Gtk::manage(new ToolParamBlock())), maskretiBox(Gtk::manage(new ToolParamBlock())), @@ -1962,6 +1966,9 @@ Locallab::Locallab(): } sensibn->setAdjusterListener(this); + isogr->setAdjusterListener(this); + strengr->setAdjusterListener(this); + scalegr->setAdjusterListener(this); itera->setAdjusterListener(this); guidbl->setAdjusterListener(this); @@ -2076,11 +2083,23 @@ Locallab::Locallab(): expmaskbl->add(*maskblBox, false); panel->pack_start(*expmaskbl); + + grainFrame->set_label_align(0.025, 0.5); + ToolParamBlock* const grainBox = Gtk::manage(new ToolParamBlock()); + grainBox->pack_start(*isogr); + grainBox->pack_start(*strengr); + grainBox->pack_start(*scalegr); + + grainFrame->add(*grainBox); + + + ToolParamBlock* const blurrBox = Gtk::manage(new ToolParamBlock()); blurrBox->pack_start(*blMethod); blurrBox->pack_start(*fftwbl, Gtk::PACK_SHRINK, 0); blurrBox->pack_start(*radius); blurrBox->pack_start(*strength); + blurrBox->pack_start(*grainFrame); blurrBox->pack_start(*medMethod); blurrBox->pack_start(*itera); blurrBox->pack_start(*guidbl); @@ -3216,6 +3235,9 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).itera = itera->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).guidbl = guidbl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).epsbl = epsbl->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).isogr = isogr->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).strengr = strengr->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).scalegr = scalegr->getIntValue(); if (blMethod->get_active_row_number() == 0) { pp->locallab.spots.at(pp->locallab.selspot).blMethod = "blur"; @@ -3533,6 +3555,9 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).strength = pe->locallab.spots.at(pp->locallab.selspot).strength || strength->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).sensibn = pe->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).itera = pe->locallab.spots.at(pp->locallab.selspot).itera || itera->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).isogr = pe->locallab.spots.at(pp->locallab.selspot).isogr || isogr->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).strengr = pe->locallab.spots.at(pp->locallab.selspot).strengr || strengr->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).scalegr = pe->locallab.spots.at(pp->locallab.selspot).scalegr || scalegr->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).guidbl = pe->locallab.spots.at(pp->locallab.selspot).guidbl || guidbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).epsbl = pe->locallab.spots.at(pp->locallab.selspot).epsbl || epsbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).blMethod = pe->locallab.spots.at(pp->locallab.selspot).blMethod || blMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -3816,6 +3841,9 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).strength = pedited->locallab.spots.at(pp->locallab.selspot).strength || strength->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).sensibn = pedited->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).itera = pedited->locallab.spots.at(pp->locallab.selspot).itera || itera->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).isogr = pedited->locallab.spots.at(pp->locallab.selspot).isogr || isogr->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).strengr = pedited->locallab.spots.at(pp->locallab.selspot).strengr || strengr->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).scalegr = pedited->locallab.spots.at(pp->locallab.selspot).scalegr || scalegr->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).guidbl = pedited->locallab.spots.at(pp->locallab.selspot).guidbl || guidbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).epsbl = pedited->locallab.spots.at(pp->locallab.selspot).epsbl || epsbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).blMethod = pedited->locallab.spots.at(pp->locallab.selspot).blMethod || blMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -4355,6 +4383,10 @@ void Locallab::blMethodChanged() fftwbl->show(); strength->show(); itera->hide(); + grainFrame->show(); + isogr->show(); + strengr->show(); + scalegr->show(); medMethod->hide(); guidbl->hide(); epsbl->hide(); @@ -4362,6 +4394,10 @@ void Locallab::blMethodChanged() } else if (blMethod->get_active_row_number() == 1) { radius->hide(); fftwbl->hide(); + grainFrame->hide(); + isogr->hide(); + strengr->hide(); + scalegr->hide(); strength->hide(); itera->show(); medMethod->show(); @@ -4372,6 +4408,10 @@ void Locallab::blMethodChanged() radius->hide(); fftwbl->hide(); strength->hide(); + grainFrame->hide(); + isogr->hide(); + strengr->hide(); + scalegr->hide(); itera->hide(); medMethod->hide(); guidbl->show(); @@ -5682,6 +5722,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe strength->setDefault((double)defSpot->strength); sensibn->setDefault((double)defSpot->sensibn); itera->setDefault((double)defSpot->itera); + isogr->setDefault((double)defSpot->isogr); + strengr->setDefault((double)defSpot->strengr); + scalegr->setDefault((double)defSpot->scalegr); guidbl->setDefault((double)defSpot->guidbl); epsbl->setDefault((double)defSpot->epsbl); blendmaskbl->setDefault((double)defSpot->blendmaskbl); @@ -5855,6 +5898,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe strength->setDefaultEditedState(Irrelevant); sensibn->setDefaultEditedState(Irrelevant); itera->setDefaultEditedState(Irrelevant); + isogr->setDefaultEditedState(Irrelevant); + strengr->setDefaultEditedState(Irrelevant); + scalegr->setDefaultEditedState(Irrelevant); guidbl->setDefaultEditedState(Irrelevant); epsbl->setDefaultEditedState(Irrelevant); blendmaskbl->setDefaultEditedState(Irrelevant); @@ -6032,6 +6078,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe strength->setDefaultEditedState(defSpotState->strength ? Edited : UnEdited); sensibn->setDefaultEditedState(defSpotState->sensibn ? Edited : UnEdited); itera->setDefaultEditedState(defSpotState->itera ? Edited : UnEdited); + isogr->setDefaultEditedState(defSpotState->isogr ? Edited : UnEdited); + strengr->setDefaultEditedState(defSpotState->strengr ? Edited : UnEdited); + scalegr->setDefaultEditedState(defSpotState->scalegr ? Edited : UnEdited); guidbl->setDefaultEditedState(defSpotState->guidbl ? Edited : UnEdited); epsbl->setDefaultEditedState(defSpotState->epsbl ? Edited : UnEdited); blendmaskbl->setDefaultEditedState(defSpotState->blendmaskbl ? Edited : UnEdited); @@ -6596,6 +6645,24 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == isogr) { + if (listener) { + listener->panelChanged(Evlocallabisogr, isogr->getTextValue()); + } + } + + if (a == strengr) { + if (listener) { + listener->panelChanged(Evlocallabstrengr, strengr->getTextValue()); + } + } + + if (a == scalegr) { + if (listener) { + listener->panelChanged(Evlocallabscalegr, scalegr->getTextValue()); + } + } + if (a == guidbl) { if (listener) { listener->panelChanged(Evlocallabguidbl, guidbl->getTextValue()); @@ -7280,6 +7347,9 @@ void Locallab::setBatchMode(bool batchMode) strength->showEditedCB(); sensibn->showEditedCB(); itera->showEditedCB(); + isogr->showEditedCB(); + strengr->showEditedCB(); + scalegr->showEditedCB(); guidbl->showEditedCB(); epsbl->showEditedCB(); blendmaskbl->showEditedCB(); @@ -7866,6 +7936,9 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con strength->setValue(pp->locallab.spots.at(index).strength); sensibn->setValue(pp->locallab.spots.at(index).sensibn); itera->setValue(pp->locallab.spots.at(index).itera); + isogr->setValue(pp->locallab.spots.at(index).isogr); + strengr->setValue(pp->locallab.spots.at(index).strengr); + scalegr->setValue(pp->locallab.spots.at(index).scalegr); guidbl->setValue(pp->locallab.spots.at(index).guidbl); epsbl->setValue(pp->locallab.spots.at(index).epsbl); @@ -8221,6 +8294,9 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con strength->setEditedState(spotState->strength ? Edited : UnEdited); sensibn->setEditedState(spotState->sensibn ? Edited : UnEdited); itera->setEditedState(spotState->itera ? Edited : UnEdited); + isogr->setEditedState(spotState->isogr ? Edited : UnEdited); + strengr->setEditedState(spotState->strengr ? Edited : UnEdited); + scalegr->setEditedState(spotState->scalegr ? Edited : UnEdited); guidbl->setEditedState(spotState->guidbl ? Edited : UnEdited); epsbl->setEditedState(spotState->epsbl ? Edited : UnEdited); @@ -8584,6 +8660,10 @@ void Locallab::updateSpecificGUIState() fftwbl->show(); strength->show(); itera->hide(); + isogr->show(); + grainFrame->show(); + strengr->show(); + scalegr->show(); medMethod->hide(); guidbl->hide(); epsbl->hide(); @@ -8592,6 +8672,10 @@ void Locallab::updateSpecificGUIState() radius->hide(); fftwbl->hide(); strength->hide(); + grainFrame->hide(); + isogr->hide(); + strengr->hide(); + scalegr->hide(); itera->show(); medMethod->show(); guidbl->hide(); @@ -8601,6 +8685,10 @@ void Locallab::updateSpecificGUIState() radius->hide(); fftwbl->hide(); strength->hide(); + isogr->hide(); + grainFrame->hide(); + strengr->hide(); + scalegr->hide(); itera->hide(); medMethod->hide(); guidbl->show(); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 04865fb07..d1c6b6c0f 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -203,6 +203,9 @@ private: Adjuster* const gammaskbl; Adjuster* const slomaskbl; Adjuster* const lapmaskbl; + Adjuster* const isogr; + Adjuster* const strengr; + Adjuster* const scalegr; // Tone Mapping Adjuster* const stren; Adjuster* const gamma; @@ -427,6 +430,7 @@ private: Gtk::Frame* retitoolFrame; Gtk::Frame* residFrame; Gtk::Frame* clariFrame; + Gtk::Frame* grainFrame; ToolParamBlock * retiBox; ToolParamBlock * maskretiBox; LabGrid *labgrid; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 4a0e85970..1bbf90146 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1086,6 +1086,8 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensibn = locallab.spots.at(j).sensibn && pSpot.sensibn == otherSpot.sensibn; locallab.spots.at(j).itera = locallab.spots.at(j).itera && pSpot.itera == otherSpot.itera; locallab.spots.at(j).guidbl = locallab.spots.at(j).guidbl && pSpot.guidbl == otherSpot.guidbl; + locallab.spots.at(j).isogr = locallab.spots.at(j).isogr && pSpot.isogr == otherSpot.isogr; + locallab.spots.at(j).strengr = locallab.spots.at(j).strengr && pSpot.strengr == otherSpot.strengr; locallab.spots.at(j).epsbl = locallab.spots.at(j).epsbl && pSpot.epsbl == otherSpot.epsbl; locallab.spots.at(j).blMethod = locallab.spots.at(j).blMethod && pSpot.blMethod == otherSpot.blMethod; locallab.spots.at(j).blurMethod = locallab.spots.at(j).blurMethod && pSpot.blurMethod == otherSpot.blurMethod; @@ -3211,6 +3213,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).guidbl = mods.locallab.spots.at(i).guidbl; } + if (locallab.spots.at(i).isogr) { + toEdit.locallab.spots.at(i).isogr = mods.locallab.spots.at(i).isogr; + } + + if (locallab.spots.at(i).strengr) { + toEdit.locallab.spots.at(i).strengr = mods.locallab.spots.at(i).strengr; + } + + if (locallab.spots.at(i).scalegr) { + toEdit.locallab.spots.at(i).scalegr = mods.locallab.spots.at(i).scalegr; + } + if (locallab.spots.at(i).epsbl) { toEdit.locallab.spots.at(i).epsbl = mods.locallab.spots.at(i).epsbl; } @@ -4838,6 +4852,9 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : strength(v), sensibn(v), itera(v), + isogr(v), + strengr(v), + scalegr(v), guidbl(v), epsbl(v), blMethod(v), @@ -5114,6 +5131,9 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) strength = v; sensibn = v; itera = v; + isogr = v; + strengr = v; + scalegr = v; guidbl = v; epsbl = v; blMethod = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 477fb134f..2d4f52e9f 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -503,6 +503,9 @@ public: bool strength; bool sensibn; bool itera; + bool isogr; + bool strengr; + bool scalegr; bool guidbl; bool epsbl; bool blMethod;