diff --git a/rtdata/languages/default b/rtdata/languages/default index 902426ee1..6fc0a27c4 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -905,6 +905,7 @@ HISTORY_MSG_657;Local - Retinex soft radius HISTORY_MSG_658;Local - CBDL soft radius HISTORY_MSG_659;L*a*b Spot transition-weakening HISTORY_MSG_660;Local - cbdl clarity +HISTORY_MSG_661;Local - cbdl contrast residual HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2043,6 +2044,8 @@ TP_LOCALLAB_MASK;Mask: TP_LOCALLAB_METHOD_TOOLTIP;'Enhanced + chroma denoise' significantly increases processing times.\nBut reduce artifacts. TP_LOCALLAB_RADIUS;Radius TP_LOCALLAB_RADMASKCOL;Radius +TP_LOCALLAB_RESID;Residual Image +TP_LOCALLAB_CONTRESID;Contrast TP_LOCALLAB_RETI;Retinex TP_LOCALLAB_TRANSMISSIONGAIN;Transmission gain TP_LOCALLAB_STREN;Strength diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index 85ac73073..21d87b1ef 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -27,6 +27,7 @@ #define RANGEFN(i) ((1000.0f / (i + 1000.0f))) #define DIRWT(i1,j1,i,j) ( domker[(i1-i)/scale+halfwin][(j1-j)/scale+halfwin] * RANGEFN(fabsf((data_fine[i1][j1]-data_fine[i][j]))) ) +#define CLIPLL(x) LIM(x,0.f,32768.f) // limit L to about L=120 probably engh ? namespace rtengine { @@ -251,7 +252,7 @@ void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, int srcwidt } -void ImProcFunctions::cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev) +void ImProcFunctions::cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const float contres, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev) { int lastlevel = maxlevelloc; @@ -354,37 +355,75 @@ void ImProcFunctions::cbdl_local_temp(float ** src, float ** loctemp, int srcwid // with the current implementation of idirpyr_eq_channel we can safely use the buffer from last level as buffer, saves some memory float ** buffer = dirpyrlo[lastlevel - 1]; - - array2D resid5(srcwidth, srcheight); +/* + // array2D resid5(srcwidth, srcheight); + array2D residbuff(srcwidth, srcheight); + #pragma omp parallel for for (int i = 0; i < srcheight; i++) { for (int j = 0; j < srcwidth; j++) { - resid5[i][j] = buffer[i][j]; + // resid5[i][j] = dirpyrlo[lastlevel - 1][i][j]; //CLIPLL(buffer[i][j]); + residbuff[i][j] = buffer[i][j]; } } + double avg = 0.f; + if(contres != 0.f) { + int ng = 0; + for (int i = 0; i < srcheight; i++) { + for (int j = 0; j < srcwidth; j++) { + avg += residbuff[i][j]; + ng++; + } + } + avg /= ng; + avg /= 32768.f; + avg = LIM01(avg); + } + float contreal = 0.3f * contres; + DiagonalCurve resid_contrast({ + DCT_NURBS, + 0, 0, + avg - avg * (0.6 - contreal / 250.0), avg - avg * (0.6 + contreal / 250.0), + avg + (1 - avg) * (0.6 - contreal / 250.0), avg + (1 - avg) * (0.6 + contreal / 250.0), + 1, 1 + }); + if(contres != 0.f) { + #pragma omp parallel for + for (int i = 0; i < srcheight; i++) + for (int j = 0; j < srcwidth; j++) { + float buf = LIM01(residbuff[i][j] / 32768.f); + buf = resid_contrast.getVal(buf); + buf *= 32768.f; + residbuff[i][j] = buf; + } + } + + */ for (int level = lastlevel - 1; level > 0; level--) { - idirpyr_eq_channel_loc(dirpyrlo[level], dirpyrlo[level - 1], buffer, srcwidth, srcheight, level, multi, dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice); + idirpyr_eq_channel_loc(dirpyrlo[level], dirpyrlo[level - 1], buffer /*residbuff*/, srcwidth, srcheight, level, multi, dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice); } scale = scalesloc[0]; - idirpyr_eq_channel_loc(dirpyrlo[0], src, buffer, srcwidth, srcheight, 0, multi, dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice); + idirpyr_eq_channel_loc(dirpyrlo[0], src, buffer/*residbuff*/, srcwidth, srcheight, 0, multi, dirpyrThreshold, nullptr, nullptr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - array2D loct(srcwidth, srcheight); - #pragma omp parallel for - for (int i = 0; i < srcheight; i++) - for (int j = 0; j < srcwidth; j++) { - loct[i][j] = CLIP(buffer[i][j]); // TODO: Really a clip necessary? - } - float clar = 0.01f * mergeL; +// array2D loct(srcwidth, srcheight); +// #pragma omp parallel for +// for (int i = 0; i < srcheight; i++) +// for (int j = 0; j < srcwidth; j++) { +// loct[i][j] = CLIPLL(residbuff[i][j]); // TODO: Really a clip necessary? +// } + + // float clar = 0.01f * mergeL; #pragma omp parallel for for (int i = 0; i < srcheight; i++) for (int j = 0; j < srcwidth; j++) { - loctemp[i][j] = (1.f + clar) * loct[i][j] - clar * resid5[i][j]; - } + // loctemp[i][j] = CLIPLL((1.f + clar) * loct[i][j] - clar * resid5[i][j]);//there is a bug ==> leads to crash in some cases but where ?? + loctemp[i][j] = CLIPLL(buffer[i][j]); + } } diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index bd69d5ea8..cb63a5e3d 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -383,7 +383,7 @@ public: float MadRgb(float * DataList, const int datalen); // pyramid wavelet - void cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale); + void cbdl_local_temp(float ** src, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const float mergeL, const float contres, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale); void idirpyr_eq_channel_loc(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[5], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice); void dirpyr_equalizer(float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scale); //Emil's directional pyramid wavelet void dirpyr_equalizercam(CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, float b_l, float t_l, float t_r, int scale); //Emil's directional pyramid wavelet diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 5f46596a7..90684f56c 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -164,6 +164,7 @@ struct local_params { float stru; int chro, cont, sens, sensh, senscb, sensbn, senstm, sensex, sensexclu, sensden, senslc, senssf, senshs; float clarityml; + float contresid; float struco; float strengrid; float struexc; @@ -468,6 +469,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall int local_dehaze = locallab.spots.at(sp).dehaz; int local_sensicb = locallab.spots.at(sp).sensicb; float local_clarityml = (float) locallab.spots.at(sp).clarityml; + float local_contresid = (float) locallab.spots.at(sp).contresid; int local_contrast = locallab.spots.at(sp).contrast; float local_lightness = (float) locallab.spots.at(sp).lightness; float labgridALowloc = locallab.spots.at(sp).labgridALow; @@ -576,7 +578,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.sensh = local_sensih; lp.dehaze = local_dehaze; lp.senscb = local_sensicb; - lp.clarityml = local_clarityml; + lp.clarityml = 0.f; //local_clarityml; + lp.contresid = 0.f; //local_contresid; lp.cont = local_contrast; lp.ligh = local_lightness; lp.lowA = labgridALowloc; @@ -1116,6 +1119,7 @@ void ImProcFunctions::exlabLocal(const local_params& lp, int bfh, int bfw, LabIm L *= shfactor; lab->L[ir][jr] = 0.5f * tonecurve[2 * L]; } + } } @@ -5511,7 +5515,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o //end TM //begin cbdl - if ((lp.mulloc[0] != 1.f || lp.mulloc[1] != 1.f || lp.mulloc[2] != 1.f || lp.mulloc[3] != 1.f || lp.mulloc[4] != 1.f || lp.clarityml != 0.f) && lp.cbdlena) { + if ((lp.mulloc[0] != 1.f || lp.mulloc[1] != 1.f || lp.mulloc[2] != 1.f || lp.mulloc[3] != 1.f || lp.mulloc[4] != 1.f || lp.clarityml != 0.f || lp.contresid != 0.f) && lp.cbdlena) { if (call <= 3) { //call from simpleprocess dcrop improcc const int ystart = std::max(static_cast(lp.yc - lp.lyT) - cy, 0); const int yend = std::min(static_cast(lp.yc + lp.ly) - cy, original->H); @@ -5545,12 +5549,16 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o loctemp->b[y - ystart][x - xstart] = origcbdl->b[y - ystart][x - xstart] = original->b[y][x]; } } - +/* if(lp.clarityml != 0.f && lp.mulloc[4] == 1.0) {//enabled last level to retrieve level 5 and residual image in case user not select level 5 lp.mulloc[4]= 1.001f; } - ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, lp.clarityml, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + if(lp.contresid != 0.f && lp.mulloc[4] == 1.0) {//enabled last level to retrieve level 5 and residual image in case user not select level 5 + lp.mulloc[4]= 1.001f; + } +*/ + ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, lp.clarityml, lp.contresid, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); float minL = loctemp->L[0][0] - origcbdl->L[0][0]; float maxL = minL; @@ -5598,15 +5606,20 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o float multc[5]; float clarich = 0.5f * lp.clarityml; +/* if(clarich > 0.f && lp.mulloc[0] == 1.f) { //to enabled in case of user select only clarity lp.mulloc[0] = 1.01f; } + if(lp.contresid != 0.f && lp.mulloc[0] == 1.f) { //to enabled in case of user select only clarity + lp.mulloc[0] = 1.01f; + } +*/ for (int lv = 0; lv < 5; lv++) { multc[lv] = rtengine::max((lp.chromacb * ((float) lp.mulloc[lv] - 1.f) / 100.f) + 1.f, 0.f); } - ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, multc, rtengine::max(lp.chromacb, 1.f), lp.threshol, clarich, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + ImProcFunctions::cbdl_local_temp(bufsh, loctemp->L, bfw, bfh, multc, rtengine::max(lp.chromacb, 1.f), lp.threshol, clarich, 0.f, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); float minC = loctemp->L[0][0] - sqrt(SQR(loctemp->a[0][0]) + SQR(loctemp->b[0][0])); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 5fbaf006a..eb0fce064 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -687,6 +687,7 @@ enum ProcEventCode { Evlocallabsoftradiuscb = 657, EvLocallabSpotTransitweak = 658, EvLocallabclarityml = 659, + EvLocallabcontresid = 660, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7ebe0ebc8..903752d05 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2498,6 +2498,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : threshold(0.2), sensicb(15), clarityml(0), + contresid(0), softradiuscb(0.0), // Denoise expdenoi(false), @@ -2689,6 +2690,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && threshold == other.threshold && sensicb == other.sensicb && clarityml == other.clarityml + && contresid == other.contresid && softradiuscb == other.softradiuscb // Denoise && expdenoi == other.expdenoi @@ -3822,6 +3824,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).threshold, "Locallab", "Threshold_" + std::to_string(i), spot.threshold, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensicb, "Locallab", "Sensicb_" + std::to_string(i), spot.sensicb, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).clarityml, "Locallab", "Clarityml_" + std::to_string(i), spot.clarityml, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).contresid, "Locallab", "Contresid_" + std::to_string(i), spot.contresid, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiuscb, "Locallab", "Softradiuscb_" + std::to_string(i), spot.softradiuscb, keyFile); // Denoise saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expdenoi, "Locallab", "Expdenoi_" + std::to_string(i), spot.expdenoi, keyFile); @@ -5101,6 +5104,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Threshold_" + std::to_string(i), pedited, spot.threshold, spotEdited.threshold); assignFromKeyfile(keyFile, "Locallab", "Sensicb_" + std::to_string(i), pedited, spot.sensicb, spotEdited.sensicb); assignFromKeyfile(keyFile, "Locallab", "Clarityml_" + std::to_string(i), pedited, spot.clarityml, spotEdited.clarityml); + assignFromKeyfile(keyFile, "Locallab", "Contresid_" + std::to_string(i), pedited, spot.contresid, spotEdited.contresid); assignFromKeyfile(keyFile, "Locallab", "Softradiuscb_" + std::to_string(i), pedited, spot.softradiuscb, spotEdited.softradiuscb); // Denoise assignFromKeyfile(keyFile, "Locallab", "Expdenoi_" + std::to_string(i), pedited, spot.expdenoi, spotEdited.expdenoi); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 7f5d159c4..dcbb7c15e 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1099,6 +1099,7 @@ struct LocallabParams { double threshold; int sensicb; int clarityml; + int contresid; double softradiuscb; // Denoise bool expdenoi; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 7d83114be..1b66d42e4 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -686,7 +686,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvLocallabsoftradiusret LUMINANCECURVE, //EvLocallabsoftradiuscb LUMINANCECURVE, // EvLocallabSpotTransitweak - LUMINANCECURVE // EvLocallabclarityml + LUMINANCECURVE, // EvLocallabclarityml + LUMINANCECURVE // EvLocallabcontresid }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 59b9cea01..aa5b21fef 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -163,6 +163,7 @@ Locallab::Locallab(): chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0))), threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))), clarityml(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARITYML"), 0, 100, 1, 0))), + contresid(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTRESID"), -100, 100, 1, 0))), sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSICB"), 0, 100, 1, 15))), softradiuscb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))), // Denoise @@ -226,6 +227,7 @@ Locallab::Locallab(): maskexpFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), maskSHFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHOW")))), gridFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABGRID")))), + residFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RESID")))), // Others defparams(nullptr), @@ -251,7 +253,6 @@ Locallab::Locallab(): // expcolor->set_tooltip_text(M("TP_LOCALLAB_EXPCOLOR_TOOLTIP")); curvactivConn = curvactiv->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::curvactivChanged)); - lightness->setAdjusterListener(this); lightness->set_tooltip_text(M("TP_LOCALLAB_EXPCOLOR_TOOLTIP")); contrast->setAdjusterListener(this); @@ -284,7 +285,6 @@ Locallab::Locallab(): gridMethodConn = gridMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::gridMethodChanged)); llCurveEditorG->setCurveListener(this); - llshape = static_cast(llCurveEditorG->addCurve(CT_Diagonal, "L(L)")); llshape->setResetCurve(DiagonalCurveType(defSpot.llcurve.at(0)), defSpot.llcurve); llshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); @@ -926,6 +926,7 @@ Locallab::Locallab(): sensicb->setAdjusterListener(this); softradiuscb->setAdjusterListener(this); clarityml->setAdjusterListener(this); + contresid->setAdjusterListener(this); ToolParamBlock* const cbdlBox = Gtk::manage(new ToolParamBlock()); Gtk::HBox* buttonBox = Gtk::manage(new Gtk::HBox(true, 10)); @@ -945,7 +946,12 @@ Locallab::Locallab(): cbdlBox->pack_start(*separator, Gtk::PACK_SHRINK, 2); cbdlBox->pack_start(*chromacbdl); cbdlBox->pack_start(*threshold); - cbdlBox->pack_start(*clarityml); + residFrame->set_label_align(0.025, 0.5); + ToolParamBlock* const residBox = Gtk::manage(new ToolParamBlock()); + residBox->pack_start(*clarityml); + residBox->pack_start(*contresid); +// residFrame->add(*residBox); + cbdlBox->pack_start(*residFrame); cbdlBox->pack_start(*softradiuscb); cbdlBox->pack_start(*sensicb); expcbdl->add(*cbdlBox); @@ -1859,6 +1865,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).threshold = threshold->getValue(); pp->locallab.spots.at(pp->locallab.selspot).sensicb = sensicb->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).clarityml = clarityml->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).contresid = contresid->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).softradiuscb = softradiuscb->getValue(); // Denoise pp->locallab.spots.at(pp->locallab.selspot).expdenoi = expdenoi->getEnabled(); @@ -2040,6 +2047,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).threshold = pe->locallab.spots.at(pp->locallab.selspot).threshold || threshold->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).sensicb = pe->locallab.spots.at(pp->locallab.selspot).sensicb || sensicb->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).clarityml = pe->locallab.spots.at(pp->locallab.selspot).clarityml || clarityml->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).contresid = pe->locallab.spots.at(pp->locallab.selspot).contresid || contresid->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).softradiuscb = pe->locallab.spots.at(pp->locallab.selspot).softradiuscb || softradiuscb->getEditedState(); // Denoise pe->locallab.spots.at(pp->locallab.selspot).expdenoi = pe->locallab.spots.at(pp->locallab.selspot).expdenoi || !expdenoi->get_inconsistent(); @@ -2223,6 +2231,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).threshold = pedited->locallab.spots.at(pp->locallab.selspot).threshold || threshold->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).sensicb = pedited->locallab.spots.at(pp->locallab.selspot).sensicb || sensicb->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).clarityml = pedited->locallab.spots.at(pp->locallab.selspot).clarityml || clarityml->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).contresid = pedited->locallab.spots.at(pp->locallab.selspot).contresid || contresid->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).softradiuscb = pedited->locallab.spots.at(pp->locallab.selspot).softradiuscb || softradiuscb->getEditedState(); // Denoise pedited->locallab.spots.at(pp->locallab.selspot).expdenoi = pedited->locallab.spots.at(pp->locallab.selspot).expdenoi || !expdenoi->get_inconsistent(); @@ -3101,6 +3110,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe threshold->setDefault(defSpot->threshold); sensicb->setDefault((double)defSpot->sensicb); clarityml->setDefault((double)defSpot->clarityml); + contresid->setDefault((double)defSpot->contresid); softradiuscb->setDefault(defSpot->softradiuscb); // Denoise noiselumf->setDefault((double)defSpot->noiselumf); @@ -3211,6 +3221,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe threshold->setDefaultEditedState(Irrelevant); sensicb->setDefaultEditedState(Irrelevant); clarityml->setDefaultEditedState(Irrelevant); + contresid->setDefaultEditedState(Irrelevant); softradiuscb->setDefaultEditedState(Irrelevant); // Denoise noiselumf->setDefaultEditedState(Irrelevant); @@ -3325,6 +3336,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe threshold->setDefaultEditedState(defSpotState->threshold ? Edited : UnEdited); sensicb->setDefaultEditedState(defSpotState->sensicb ? Edited : UnEdited); clarityml->setDefaultEditedState(defSpotState->clarityml ? Edited : UnEdited); + contresid->setDefaultEditedState(defSpotState->contresid ? Edited : UnEdited); softradiuscb->setDefaultEditedState(defSpotState->softradiuscb ? Edited : UnEdited); // Denoise noiselumf->setDefaultEditedState(defSpotState->noiselumf ? Edited : UnEdited); @@ -3904,11 +3916,21 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } if (a == clarityml) { + //contresid->setValue(0.); + if (listener) { listener->panelChanged(EvLocallabclarityml, clarityml->getTextValue()); } } + if (a == contresid) { + //clarityml->setValue(0.); + + if (listener) { + listener->panelChanged(EvLocallabcontresid, contresid->getTextValue()); + } + } + if (a == softradiuscb) { if (listener) { listener->panelChanged(Evlocallabsoftradiuscb, softradiuscb->getTextValue()); @@ -4102,6 +4124,7 @@ void Locallab::setBatchMode(bool batchMode) threshold->showEditedCB(); sensicb->showEditedCB(); clarityml->showEditedCB(); + contresid->showEditedCB(); softradiuscb->showEditedCB(); // Denoise noiselumf->showEditedCB(); @@ -4543,6 +4566,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con threshold->setValue(pp->locallab.spots.at(index).threshold); sensicb->setValue(pp->locallab.spots.at(index).sensicb); clarityml->setValue(pp->locallab.spots.at(index).clarityml); + contresid->setValue(pp->locallab.spots.at(index).contresid); softradiuscb->setValue(pp->locallab.spots.at(index).softradiuscb); // Denoise @@ -4761,6 +4785,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con threshold->setEditedState(spotState->threshold ? Edited : UnEdited); sensicb->setEditedState(spotState->sensicb ? Edited : UnEdited); clarityml->setEditedState(spotState->clarityml ? Edited : UnEdited); + contresid->setEditedState(spotState->contresid ? Edited : UnEdited); softradiuscb->setEditedState(spotState->softradiuscb ? Edited : UnEdited); // Denoise diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 73907c409..8be801bc3 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -183,6 +183,7 @@ private: Adjuster* const chromacbdl; Adjuster* const threshold; Adjuster* const clarityml; + Adjuster* const contresid; Adjuster* const sensicb; Adjuster* const softradiuscb; // Denoise @@ -263,6 +264,7 @@ private: Gtk::Frame* maskexpFrame; Gtk::Frame* maskSHFrame; Gtk::Frame* gridFrame; + Gtk::Frame* residFrame; LabGrid *labgrid; // Others /** diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 5aa0a304e..81628d65a 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1092,6 +1092,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).threshold = locallab.spots.at(j).threshold && pSpot.threshold == otherSpot.threshold; locallab.spots.at(j).sensicb = locallab.spots.at(j).sensicb && pSpot.sensicb == otherSpot.sensicb; locallab.spots.at(j).clarityml = locallab.spots.at(j).clarityml && pSpot.clarityml == otherSpot.clarityml; + locallab.spots.at(j).contresid = locallab.spots.at(j).contresid && pSpot.contresid == otherSpot.contresid; locallab.spots.at(j).softradiuscb = locallab.spots.at(j).softradiuscb && pSpot.softradiuscb == otherSpot.softradiuscb; // Denoise locallab.spots.at(j).expdenoi = locallab.spots.at(j).expdenoi && pSpot.expdenoi == otherSpot.expdenoi; @@ -3140,6 +3141,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).clarityml = mods.locallab.spots.at(i).clarityml; } + if (locallab.spots.at(i).contresid) { + toEdit.locallab.spots.at(i).contresid = mods.locallab.spots.at(i).contresid; + } + if (locallab.spots.at(i).softradiuscb) { toEdit.locallab.spots.at(i).softradiuscb = mods.locallab.spots.at(i).softradiuscb; } @@ -4291,6 +4296,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : threshold(v), sensicb(v), clarityml(v), + contresid(v), softradiuscb(v), // Denoise expdenoi(v), @@ -4474,6 +4480,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) threshold = v; sensicb = v; clarityml = v; + contresid = v; softradiuscb = v; // Denoise expdenoi = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index edf18ba0b..95691e89a 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -515,6 +515,7 @@ public: bool threshold; bool sensicb; bool clarityml; + bool contresid; bool softradiuscb; // Denoise bool expdenoi;