diff --git a/rtdata/languages/default b/rtdata/languages/default index c773e48a4..c4a771e0d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -788,6 +788,17 @@ HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength HISTORY_MSG_TM_FATTAL_ANCHOR;DRC - Anchor HISTORY_MSG_TRANS_Method;Geometry - Method +HISTORY_MSG_WAVCLARI;Clarity +HISTORY_MSG_WAVUSHAMET;Clarity method +HISTORY_MSG_WAVMERGEL;Merge L +HISTORY_MSG_WAVMERGEC;Merge C +HISTORY_MSG_WAVSIGMA;Sigma +HISTORY_MSG_WAVSOFTRAD;Soft radius clarity +HISTORY_MSG_WAVSOFTRADEND;Soft radius final +HISTORY_MSG_WAVSHOWMASK;Show wavelet mask +HISTORY_MSG_WAVEDGS;Edge stopping +HISTORY_MSG_WAVSCALE;Scale +HISTORY_MSG_WAVRADIUS;Radius Shadows-Highlight HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -2116,10 +2127,12 @@ TP_WAVELET_CH3;Link contrast levels TP_WAVELET_CHCU;Curve TP_WAVELET_CHR;Chroma-contrast link strength TP_WAVELET_CHRO;Saturated/pastel threshold +TP_WAVELET_CHROMAFRAME;Chroma TP_WAVELET_CHRO_TOOLTIP;Sets the wavelet level which will be the threshold between saturated and pastel colors.\n1-x: saturated\nx-9: pastel\n\nIf the value exceeds the amount of wavelet levels you are using then it will be ignored. TP_WAVELET_CHR_TOOLTIP;Adjusts chroma as a function of "contrast levels" and "chroma-contrast link strength" TP_WAVELET_CHSL;Sliders TP_WAVELET_CHTYPE;Chrominance method +TP_WAVELET_CLARI;Sharp-mask and Clarity TP_WAVELET_COLORT;Opacity Red-Green TP_WAVELET_COMPCONT;Contrast TP_WAVELET_COMPGAMMA;Compression gamma @@ -2202,6 +2215,8 @@ TP_WAVELET_MEDGREINF;First level TP_WAVELET_MEDI;Reduce artifacts in blue sky TP_WAVELET_MEDILEV;Edge detection TP_WAVELET_MEDILEV_TOOLTIP;When you enable Edge Detection, it is recommanded:\n- to disabled low contrast levels to avoid artifacts,\n- to use high values of gradient sensitivity.\n\nYou can modulate the strength with 'refine' from Denoise and Refine. +TP_WAVELET_MERGEL;Merge Luma +TP_WAVELET_MERGEC;Merge Chroma TP_WAVELET_NEUTRAL;Neutral TP_WAVELET_NOIS;Denoise TP_WAVELET_NOISE;Denoise and Refine @@ -2216,19 +2231,22 @@ TP_WAVELET_OPACITYWL;Final local contrast TP_WAVELET_OPACITYWL_TOOLTIP;Modify the final local contrast at the end of the wavelet treatment.\n\nThe left side represents the smallest local contrast, progressing to the largest local contrast on the right. TP_WAVELET_PASTEL;Pastel chroma TP_WAVELET_PROC;Process +TP_WAVELET_RADIUS;Radius Shadows - Highlight TP_WAVELET_RE1;Reinforced TP_WAVELET_RE2;Unchanged TP_WAVELET_RE3;Reduced -TP_WAVELET_RESCHRO;Chroma +TP_WAVELET_RESCHRO;Intensity TP_WAVELET_RESCON;Shadows TP_WAVELET_RESCONH;Highlights TP_WAVELET_RESID;Residual Image TP_WAVELET_SAT;Saturated chroma TP_WAVELET_SETTINGS;Wavelet Settings +TP_WAVELET_SIGMA;Sigma TP_WAVELET_SKIN;Skin targetting/protection TP_WAVELET_SKIN_TOOLTIP;At -100 skin-tones are targetted.\nAt 0 all tones are treated equally.\nAt +100 skin-tones are protected while all other tones are affected. TP_WAVELET_SKY;Sky targetting/protection TP_WAVELET_SKY_TOOLTIP;At -100 sky-tones are targetted.\nAt 0 all tones are treated equally.\nAt +100 sky-tones are protected while all other tones are affected. +TP_WAVELET_SOFTRAD;Soft Radius TP_WAVELET_STREN;Strength TP_WAVELET_STRENGTH;Strength TP_WAVELET_SUPE;Extra @@ -2244,9 +2262,19 @@ TP_WAVELET_TILESIZE;Tiling method TP_WAVELET_TILESLIT;Little tiles TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. TP_WAVELET_TMSTRENGTH;Compression strength -TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. +TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. TP_WAVELET_TMTYPE;Compression method +TP_WAVELET_TMEDGS;Edge stopping +TP_WAVELET_TMSCALE;Scale TP_WAVELET_TON;Toning +TP_WAVELET_USHARP;Clarity method +TP_WAVELET_USH;None +TP_WAVELET_USH_TOOLTIP;If you select Sharp-mask, wavelet settings will be automatically positioned :\nBackground=black, Process=below, level=3...you can change level between 1 and 4.\n\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level between 5 and 10 and wavelet levels. +TP_WAVELET_SHA;Sharp mask +TP_WAVELET_SHOWMASK;Show wavelet 'mask' +TP_WAVELET_CLA;Clarity +TP_WAVELET_USHARP;Sharp method +TP_WAVELET_USHARP_TOOLTIP;Origin : the source file is the file before Wavelet.\nWavelet : the source file is the file including wavelet threatment TP_WBALANCE_AUTO;Auto TP_WBALANCE_STUDLABEL_TOOLTIP;Display calculated Student correlation\nThe lower the student value, the better the correlation\nValues below 0.002 are excellent\nValues below 0.005 are very good\nValues below 0.01 are good\nValues below 0.05 are good enough\nValues above 0.5 are poor\nVery good Student test results does not mean that the WB is good, if the illuminant is non-standard the results are erratic. TP_WBALANCE_STUDLABEL;Student Itcwb: %1 diff --git a/rtengine/cplx_wavelet_filter_coeffs.h b/rtengine/cplx_wavelet_filter_coeffs.h index 6287fc03b..5d191e50c 100644 --- a/rtengine/cplx_wavelet_filter_coeffs.h +++ b/rtengine/cplx_wavelet_filter_coeffs.h @@ -48,7 +48,11 @@ const float Daub4_anal16[2][16] ALIGNED16 = {//Daub 14 {0.f, 0.f, 0.055049715f, 0.28039564f, 0.515574245f, 0.33218624f, -0.10175691f, -0.158417505f, 0.05042335f, 0.057001725f, -0.026891225f, -0.01171997f, 0.008874895f, 0.0003037575f, -0.0012739524f, 0.0002501134f}, { -0.0002501134f, -0.0012739524f, -0.0003037575f, 0.008874895f, 0.01171997f , -0.026891225f, -0.057001725f, 0.05042335f, 0.158417505f, -0.10175691f, -0.33218624f, 0.515574245f, -0.28039564f, 0.055049715f, 0.f, 0.f} }; - -// if necessary ?? we can add D20 !! +/* +const double Daub4_anal22[2][22] ALIGNED16 = {//Daub 20 + {0., 0., 0.01885858, 0.13306109, 0.37278754, 0.48681406, 0.19881887, -0.1766681, -0.13855494, 0.09006372, 0.0658015, -0.05048328, -0.02082962, 0.0234849, 0.0025502185, -0.0075895, 0.0009866625, 0.0014088433, -0.00048497392, -0.0000823545, 0.00006617718, -0.000009379205}, + {0.000009379205, -0.00006617718, 0.0000823545, 0.00048497392, -0.0014088433, -0.0009866627, 0.0075895, -0.0025502185, -0.0234849, 0.02082962, 0.05048328, -0.0658015, -0.09006372, 0.13855494, 0.1766681, -0.19881887, -0.48681406, -0.37278754, -0.13306109, -0.01885858, 0., 0.} +}; +*/ } diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 77392a552..b9594a709 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -30,8 +30,9 @@ #include "procparams.h" #include "refreshmap.h" #include "rt_math.h" - +#include "color.h" #include "../rtgui/editcallbacks.h" +#include "guidedfilter.h" namespace { @@ -50,7 +51,7 @@ namespace rtengine Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) : PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), - cropImg (nullptr), transCrop (nullptr), cieCrop (nullptr), + cropImg(nullptr), transCrop(nullptr), cieCrop(nullptr), updating(false), newUpdatePending(false), skip(10), cropx(0), cropy(0), cropw(-1), croph(-1), trafx(0), trafy(0), trafw(-1), trafh(-1), @@ -815,6 +816,7 @@ void Crop::update(int todo) parent->ipf.workingtrc(workingCrop, workingCrop, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope, parent->getCustomTransformOut(), false, true, true); } } + double rrm, ggm, bbm; DCPProfileApplyState as; DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as); @@ -824,6 +826,7 @@ void Crop::update(int todo) params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, parent->colourToningSatLimit, parent->colourToningSatLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->opautili, parent->clToningcurve, parent->cl2Toningcurve, parent->customToneCurve1, parent->customToneCurve2, parent->beforeToneCurveBW, parent->afterToneCurveBW, rrm, ggm, bbm, parent->bwAutoR, parent->bwAutoG, parent->bwAutoB, dcpProf, as, histToneCurve); + if (workingCrop != baseCrop) { delete workingCrop; } @@ -880,8 +883,8 @@ void Crop::update(int todo) parent->ipf.MLsharpen(labnCrop); if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - parent->ipf.MLmicrocontrast (labnCrop); - parent->ipf.sharpening (labnCrop, params.sharpening, parent->sharpMask); + parent->ipf.MLmicrocontrast(labnCrop); + parent->ipf.sharpening(labnCrop, params.sharpening, parent->sharpMask); } } @@ -971,15 +974,183 @@ void Crop::update(int todo) LUTf wavclCurve; params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); + LabImage *unshar = nullptr; + Glib::ustring provis; + LabImage *provradius = nullptr; + bool procont = WaveParams.expcontrast; + bool prochro = WaveParams.expchroma; + bool proedge = WaveParams.expedge; + bool profin = WaveParams.expfinal; + bool proton = WaveParams.exptoning; + bool pronois = WaveParams.expnoise; + + if(WaveParams.showmask) { + // WaveParams.showmask = false; + // WaveParams.expclari = true; + } + + + if (WaveParams.softrad > 0.f) { + provradius = new LabImage(labnCrop->W, labnCrop->H); + provradius->CopyFrom(labnCrop); + } + + + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + + unshar = new LabImage(labnCrop->W, labnCrop->H); + provis = params.wavelet.CLmethod; + params.wavelet.CLmethod = "all"; + parent->ipf.ip_wavelet(labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); + unshar->CopyFrom(labnCrop); + + params.wavelet.CLmethod = provis; + + } + + if (!WaveParams.expclari && WaveParams.CLmethod != "all") { + params.wavelet.CLmethod = "all"; + params.wavelet.Backmethod = "grey"; + } + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + WaveParams.expcontrast = false; + WaveParams.expchroma = false; + WaveParams.expedge = false; + WaveParams.expfinal = false; + WaveParams.exptoning = false; + WaveParams.expnoise = false; + } parent->ipf.ip_wavelet(labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + WaveParams.expcontrast = procont; + WaveParams.expchroma = prochro; + WaveParams.expedge = proedge; + WaveParams.expfinal = profin; + WaveParams.exptoning = proton; + WaveParams.expnoise = pronois; + if (WaveParams.softrad > 0.f) { + array2D ble(labnCrop->W, labnCrop->H); + array2D guid(labnCrop->W, labnCrop->H); + Imagefloat *tmpImage = nullptr; + tmpImage = new Imagefloat(labnCrop->W, labnCrop->W); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < labnCrop->H ; ir++) + for (int jr = 0; jr < labnCrop->W; jr++) { + float X, Y, Z; + float L = provradius->L[ir][jr]; + float a = provradius->a[ir][jr]; + float b = provradius->b[ir][jr]; + Color::Lab2XYZ(L, a, b, X, Y, Z); + + guid[ir][jr] = Y / 32768.f; + float La = labnCrop->L[ir][jr]; + float aa = labnCrop->a[ir][jr]; + float ba = labnCrop->b[ir][jr]; + Color::Lab2XYZ(La, aa, ba, X, Y, Z); + tmpImage->r(ir, jr) = X; + tmpImage->g(ir, jr) = Y; + tmpImage->b(ir, jr) = Z; + ble[ir][jr] = Y / 32768.f; + } + double epsilmax = 0.0001; + double epsilmin = 0.00001; + double aepsil = (epsilmax - epsilmin) / 90.f; + double bepsil = epsilmax - 100.f * aepsil; + double epsil = aepsil * WaveParams.softrad + bepsil; + + float blur = 10.f / skip * (0.0001f + 0.8f * WaveParams.softrad); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < labnCrop->H; ir++) + for (int jr = 0; jr < labnCrop->W; jr++) { + float X = tmpImage->r(ir, jr); + float Y = 32768.f * ble[ir][jr]; + float Z = tmpImage->b(ir, jr); + float L, a, b; + Color::XYZ2Lab(X, Y, Z, L, a, b); + labnCrop->L[ir][jr] = L; + } + delete tmpImage; + } + + } + + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + + float mL = (float)(WaveParams.mergeL / 100.f); + float mC = (float)(WaveParams.mergeC / 100.f); + float mL0; + float mC0; + float background = 0.f; + int show = 0; + + if ((WaveParams.CLmethod == "one" || WaveParams.CLmethod == "inf") && WaveParams.Backmethod == "black") { + mL0 = mC0 = 0.f; + mL = -1.5f * mL; + mC = -mC; + background = 12000.f; + show = 0; + } else if (WaveParams.CLmethod == "sup" && WaveParams.Backmethod == "resid") { + mL0 = mL; + mC0 = mC; + background = 0.f; + show = 0; + } else { + mL0 = mL = mC0 = mC = 0.f; + background = 0.f; + show = 0; + } + + float indic = 1.f; + if(WaveParams.showmask){ + mL0 = mC0 = -1.f; + indic = -1.f; + mL = fabs(mL); + mC = fabs(mC); + show = 1; + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int x = 0; x < labnCrop->H; x++) + for (int y = 0; y < labnCrop->W; y++) { + labnCrop->L[x][y] = LIM((1.f + mL0) * (unshar->L[x][y]) + show * background - mL * indic * labnCrop->L[x][y], 0.f, 32768.f); + labnCrop->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * indic * labnCrop->a[x][y]; + labnCrop->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * indic * labnCrop->b[x][y]; + } + + delete unshar; + unshar = NULL; + if (WaveParams.softrad > 0.f) { + delete provradius; + provradius = NULL; + } + + + } + + } parent->ipf.softLight(labnCrop); - // } - - // } if (params.colorappearance.enabled) { float fnum = parent->imgsrc->getMetaData()->getFNumber(); // F number float fiso = parent->imgsrc->getMetaData()->getISOSpeed() ; // ISO diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index dfa7b7291..d8d38e14a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -36,6 +36,7 @@ #include "lcp.h" #include "procparams.h" #include "refreshmap.h" +#include "guidedfilter.h" #include "../rtgui/options.h" @@ -55,12 +56,12 @@ ImProcCoordinator::ImProcCoordinator() : fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), - ncie (nullptr), - imgsrc (nullptr), - lastAwbEqual (0.), - lastAwbTempBias (0.0), + ncie(nullptr), + imgsrc(nullptr), + lastAwbEqual(0.), + lastAwbTempBias(0.0), lastAwbauto(""), - monitorIntent (RI_RELATIVE), + monitorIntent(RI_RELATIVE), softProof(false), gamutCheck(false), sharpMask(false), @@ -195,12 +196,12 @@ ImProcCoordinator::~ImProcCoordinator() imgsrc->decreaseRef(); - if(customTransformIn) { + if (customTransformIn) { cmsDeleteTransform(customTransformIn); customTransformIn = nullptr; } - if(customTransformOut) { + if (customTransformOut) { cmsDeleteTransform(customTransformOut); customTransformOut = nullptr; } @@ -282,9 +283,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) imgsrc->setCurrentFrame(params->raw.bayersensor.imageNum); imgsrc->preprocess(rp, params->lensProf, params->coarse); + if (flatFieldAutoClipListener && rp.ff_AutoClipControl) { flatFieldAutoClipListener->flatFieldAutoClipValueChanged(imgsrc->getFlatFieldAutoClipValue()); } + imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw); highDetailPreprocessComputed = highDetailNeeded; @@ -330,8 +333,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) printf("Demosaic X-Trans image with using method: %s\n", rp.xtranssensor.method.c_str()); } } - if(imgsrc->getSensorType() == ST_BAYER) { - if(params->raw.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { + + if (imgsrc->getSensorType() == ST_BAYER) { + if (params->raw.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { imgsrc->setBorder(params->raw.bayersensor.border); } else { imgsrc->setBorder(std::max(params->raw.bayersensor.border, 2)); @@ -339,6 +343,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { imgsrc->setBorder(params->raw.xtranssensor.border); } + bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicAutoContrast : params->raw.xtranssensor.dualDemosaicAutoContrast; double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicContrast : params->raw.xtranssensor.dualDemosaicContrast; imgsrc->demosaic(rp, autoContrast, contrastThreshold, params->pdsharpening.enabled); @@ -346,6 +351,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (imgsrc->getSensorType() == ST_BAYER && bayerAutoContrastListener && autoContrast) { bayerAutoContrastListener->autoContrastChanged(contrastThreshold); } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS && xtransAutoContrastListener && autoContrast) { + xtransAutoContrastListener->autoContrastChanged(autoContrast ? contrastThreshold : -1.0); } // if a demosaic happened we should also call getimage later, so we need to set the M_INIT flag @@ -647,7 +653,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } } - if (todo & (M_AUTOEXP | M_RGBCURVE)) { + if (todo & (M_AUTOEXP | M_RGBCURVE)) { if (params->icm.workingTRC == "Custom") { //exec TRC IN free if (oprevi == orig_prev) { oprevi = new Imagefloat(pW, pH); @@ -659,17 +665,21 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") { const int cw = oprevi->getWidth(); const int ch = oprevi->getHeight(); + // put gamma TRC to 1 - if(customTransformIn) { + if (customTransformIn) { cmsDeleteTransform(customTransformIn); customTransformIn = nullptr; } + ipf.workingtrc(oprevi, oprevi, cw, ch, -5, params->icm.workingProfile, 2.4, 12.92310, customTransformIn, true, false, true); + //adjust TRC - if(customTransformOut) { + if (customTransformOut) { cmsDeleteTransform(customTransformOut); customTransformOut = nullptr; } + ipf.workingtrc(oprevi, oprevi, cw, ch, 5, params->icm.workingProfile, params->icm.workingTRCGamma, params->icm.workingTRCSlope, customTransformOut, false, true, true); } } @@ -677,7 +687,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if ((todo & M_RGBCURVE) || (todo & M_CROP)) { - // if (hListener) oprevi->calcCroppedHistogram(params, scale, histCropped); + // if (hListener) oprevi->calcCroppedHistogram(params, scale, histCropped); //complexCurve also calculated pre-curves histogram depending on crop CurveFactory::complexCurve(params->toneCurve.expcomp, params->toneCurve.black / 65535.0, @@ -771,7 +781,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) DCPProfileApplyState as; DCPProfile *dcpProf = imgsrc->getDCP(params->icm, as); - ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params->toneCurve.saturation, + ipf.rgbProc(oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params->toneCurve.saturation, rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, as, histToneCurve); if (params->blackwhite.enabled && params->blackwhite.autoc && abwListener) { @@ -856,17 +866,222 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) wavcontlutili = false; CurveFactory::curveWavContL(wavcontlutili, params->wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16); - if ((params->wavelet.enabled)) { WaveletParams WaveParams = params->wavelet; WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); - int kall = 0; + LabImage *unshar = nullptr; + Glib::ustring provis; + LabImage *provradius = nullptr; + bool procont = WaveParams.expcontrast; + bool prochro = WaveParams.expchroma; + bool proedge = WaveParams.expedge; + bool profin = WaveParams.expfinal; + bool proton = WaveParams.exptoning; + bool pronois = WaveParams.expnoise; + + if(WaveParams.showmask) { + // WaveParams.showmask = false; + // WaveParams.expclari = true; + } + + if (WaveParams.softrad > 0.f) { + provradius = new LabImage(pW, pH); + provradius->CopyFrom(nprevl); + } + + + + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + unshar = new LabImage(pW, pH); + provis = params->wavelet.CLmethod; + params->wavelet.CLmethod = "all"; + ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); + + unshar->CopyFrom(nprevl); + + params->wavelet.CLmethod = provis; + + } + + if (!WaveParams.expclari && WaveParams.CLmethod != "all") { + params->wavelet.CLmethod = "all"; + params->wavelet.Backmethod = "grey"; + } + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + WaveParams.expcontrast = false; + WaveParams.expchroma = false; + WaveParams.expedge = false; + WaveParams.expfinal = false; + WaveParams.exptoning = false; + WaveParams.expnoise = false; + } + ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + WaveParams.expcontrast = procont; + WaveParams.expchroma = prochro; + WaveParams.expedge = proedge; + WaveParams.expfinal = profin; + WaveParams.exptoning = proton; + WaveParams.expnoise = pronois; + + if (WaveParams.softrad > 0.f) { + array2D ble(pW, pH); + array2D guid(pW, pH); + Imagefloat *tmpImage = nullptr; + tmpImage = new Imagefloat(pW, pH); +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < pH; ir++) + for (int jr = 0; jr < pW; jr++) { + float X, Y, Z; + float L = provradius->L[ir][jr]; + float a = provradius->a[ir][jr]; + float b = provradius->b[ir][jr]; + Color::Lab2XYZ(L, a, b, X, Y, Z); + + guid[ir][jr] = Y / 32768.f; + float La = nprevl->L[ir][jr]; + float aa = nprevl->a[ir][jr]; + float ba = nprevl->b[ir][jr]; + Color::Lab2XYZ(La, aa, ba, X, Y, Z); + tmpImage->r(ir, jr) = X; + tmpImage->g(ir, jr) = Y; + tmpImage->b(ir, jr) = Z; + ble[ir][jr] = Y / 32768.f; + } + double epsilmax = 0.0001; + double epsilmin = 0.00001; + double aepsil = (epsilmax - epsilmin) / 90.f; + double bepsil = epsilmax - 100.f * aepsil; + double epsil = aepsil * WaveParams.softrad + bepsil; + + float blur = 10.f / scale * (0.0001f + 0.8f * WaveParams.softrad); + // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < pH; ir++) + for (int jr = 0; jr < pW; jr++) { + float X = tmpImage->r(ir, jr); + float Y = 32768.f * ble[ir][jr]; + float Z = tmpImage->b(ir, jr); + float L, a, b; + Color::XYZ2Lab(X, Y, Z, L, a, b); + nprevl->L[ir][jr] = L; + } + delete tmpImage; + + } + + } + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + float mL = (float)(WaveParams.mergeL / 100.f); + float mC = (float)(WaveParams.mergeC / 100.f); + float mL0; + float mC0; + float background = 0.f; + int show = 0; + + + + if ((WaveParams.CLmethod == "one" || WaveParams.CLmethod == "inf") && WaveParams.Backmethod == "black") { + mL0 = mC0 = 0.f; + mL = - 1.5f * mL; + mC = -mC; + background = 12000.f; + show = 0; + } else if (WaveParams.CLmethod == "sup" && WaveParams.Backmethod == "resid") { + mL0 = mL; + mC0 = mC; + background = 0.f; + show = 0; + } else { + mL0 = mL = mC0 = mC = 0.f; + background = 0.f; + show = 0; + } + float indic = 1.f; + + if(WaveParams.showmask){ + mL0 = mC0 = -1.f; + indic = -1.f; + mL = fabs(mL); + mC = fabs(mC); + show = 1; + } +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int x = 0; x < pH; x++) + for (int y = 0; y < pW; y++) { + nprevl->L[x][y] = LIM((1.f + mL0) * (unshar->L[x][y]) + show * background - mL * indic * nprevl->L[x][y], 0.f, 32768.f); + nprevl->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * indic * nprevl->a[x][y]; + nprevl->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * indic * nprevl->b[x][y]; + } + + delete unshar; + unshar = NULL; +/* + if (WaveParams.softrad > 0.f) { + array2D ble(pW, pH); + array2D guid(pW, pH); +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < pH; ir++) + for (int jr = 0; jr < pW; jr++) { + ble[ir][jr] = (nprevl->L[ir][jr] - provradius->L[ir][jr]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + } + double epsilmax = 0.001; + double epsilmin = 0.0001; + double aepsil = (epsilmax - epsilmin) / 90.f; + double bepsil = epsilmax - 100.f * aepsil; + double epsil = aepsil * WaveParams.softrad + bepsil; + + float blur = 10.f / scale * (0.001f + 0.8f * WaveParams.softrad); + // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < pH; ir++) + for (int jr = 0; jr < pW; jr++) { + nprevl->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; + } + } +*/ + if (WaveParams.softrad > 0.f) { + delete provradius; + provradius = NULL; + } + + + } + } - ipf.softLight(nprevl); + ipf.softLight(nprevl); if (params->colorappearance.enabled) { // L histo and Chroma histo for ciecam @@ -1018,6 +1233,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) hListener->histogramChanged(histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma, histLRETI); } } + if (orig_prev != oprevi) { delete oprevi; oprevi = nullptr; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 7ade3e92c..9fe16769c 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -3658,7 +3658,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer delete vCurve; } - shadowsHighlights(lab); + // shadowsHighlights(lab); + shadowsHighlights(lab, params->sh.enabled, params->sh.lab,params->sh.highlights ,params->sh.shadows, params->sh.radius, scale, params->sh.htonalwidth, params->sh.stonalwidth); if (params->localContrast.enabled) { // Alberto's local contrast diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 6538bd6b1..39a229c7e 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -270,7 +270,8 @@ public: void ToneMapFattal02(Imagefloat *rgb); void localContrast(LabImage *lab); void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread); - void shadowsHighlights(LabImage *lab); + //void shadowsHighlights(LabImage *lab); + void shadowsHighlights(LabImage *lab, bool ena, int labmode, int hightli, int shado, int rad, int scal, int hltonal, int shtonal); void softLight(LabImage *lab); void labColorCorrectionRegions(LabImage *lab); diff --git a/rtengine/ipshadowshighlights.cc b/rtengine/ipshadowshighlights.cc index 5d5be57e9..0eb3df9c5 100644 --- a/rtengine/ipshadowshighlights.cc +++ b/rtengine/ipshadowshighlights.cc @@ -31,22 +31,22 @@ #include "procparams.h" #include "sleef.h" -namespace rtengine +namespace rtengine { +//modifications to pass parameters needs by locallab, to avoid 2 functions - no change in process - J.Desmis march 2019 +void ImProcFunctions::shadowsHighlights(LabImage *lab, bool ena, int labmode, int hightli, int shado, int rad, int scal, int hltonal, int shtonal) { - -void ImProcFunctions::shadowsHighlights(LabImage *lab) -{ - if (!params->sh.enabled || (!params->sh.highlights && !params->sh.shadows)){ + if (!ena || (!hightli && !shado)){ return; } const int width = lab->W; const int height = lab->H; - const bool lab_mode = params->sh.lab; + const bool lab_mode = labmode; array2D mask(width, height); array2D L(width, height); - const float radius = params->sh.radius * 10 / scale; +// const float radius = params->sh.radius * 10 / scale; + const float radius = float(rad) * 10 / scal; LUTf f(lab_mode ? 32768 : 65536); TMatrix ws = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); @@ -193,12 +193,12 @@ void ImProcFunctions::shadowsHighlights(LabImage *lab) } }; - if (params->sh.highlights > 0) { - apply(params->sh.highlights * 0.7, params->sh.htonalwidth, true); + if (hightli > 0) { + apply(hightli * 0.7, hltonal, true); } - if (params->sh.shadows > 0) { - apply(params->sh.shadows * 0.6, params->sh.stonalwidth, false); + if (shado > 0) { + apply(shado * 0.6, shtonal, false); } } diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 0e621b254..b9a8132e4 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -3,7 +3,7 @@ // // // -// code dated: December , 2014 +// code dated: 9 , 2019 // // Ipwaveletcc is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ // // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// * 2014 Jacques Desmis +// * 2014 - 2019 Jacques Desmis // * 2014 Ingo Weyrich // @@ -43,7 +43,8 @@ #include "rtengine.h" #include "sleef.h" #include "../rtgui/options.h" - +#include "guidedfilter.h" +#include "imagefloat.h" #ifdef _OPENMP #include #endif @@ -55,6 +56,7 @@ namespace rtengine struct cont_params { float mul[10]; + float sigm; int chrom; int chro; int contrast; @@ -62,6 +64,7 @@ struct cont_params { float thH; float conres; float conresH; + float radius; float chrores; float hueres; float sky; @@ -141,38 +144,46 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const // init variables to display Munsell corrections MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo(); #endif - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.workingProfile); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.workingProfile); const double wip[3][3] = { {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, {wiprof[2][0], wiprof[2][1], wiprof[2][2]} }; const short int imheight = lab->H, imwidth = lab->W; + LabImage *provradius = nullptr; + + if (waparams.softradend > 0.f && params->wavelet.expfinal) { + provradius = new LabImage(lab->W, lab->H); + provradius->CopyFrom(lab); + } + struct cont_params cp; + cp.avoi = params->wavelet.avoid; - if(params->wavelet.Medgreinf == "more") { + if (params->wavelet.Medgreinf == "more") { cp.reinforce = 1; } - if(params->wavelet.Medgreinf == "none") { + if (params->wavelet.Medgreinf == "none") { cp.reinforce = 2; } - if(params->wavelet.Medgreinf == "less") { + if (params->wavelet.Medgreinf == "less") { cp.reinforce = 3; } - if(params->wavelet.NPmethod == "none") { + if (params->wavelet.NPmethod == "none") { cp.lip3 = false; } - if(params->wavelet.NPmethod == "low") { + if (params->wavelet.NPmethod == "low") { cp.lip3 = true; cp.neigh = 0; } - if(params->wavelet.NPmethod == "high") { + if (params->wavelet.NPmethod == "high") { cp.lip3 = true; cp.neigh = 1; } @@ -184,29 +195,30 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.tonemap = false; cp.bam = false; - if(params->wavelet.tmrs == 0) { + if (params->wavelet.tmrs == 0) { cp.tonemap = false; } else { cp.tonemap = true; } - if(params->wavelet.TMmethod == "cont") { + if (params->wavelet.TMmethod == "cont") { cp.contmet = 1; - } else if(params->wavelet.TMmethod == "tm") { + } else if (params->wavelet.TMmethod == "tm") { cp.contmet = 2; } - if(params->wavelet.BAmethod != "none") { + if (params->wavelet.BAmethod != "none") { cp.bam = true; } - if(params->wavelet.BAmethod == "sli") { + if (params->wavelet.BAmethod == "sli") { cp.BAmet = 1; } - if(params->wavelet.BAmethod == "cur") { + if (params->wavelet.BAmethod == "cur") { cp.BAmet = 2; } + cp.sigm = params->wavelet.sigma; cp.tmstrength = params->wavelet.tmrs; //cp.tonemap = params->wavelet.tmr; @@ -218,15 +230,15 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.toningena = params->wavelet.exptoning; cp.noiseena = params->wavelet.expnoise; - if(params->wavelet.Backmethod == "black") { + if (params->wavelet.Backmethod == "black") { cp.backm = 0; } - if(params->wavelet.Backmethod == "grey") { + if (params->wavelet.Backmethod == "grey") { cp.backm = 1; } - if(params->wavelet.Backmethod == "resid") { + if (params->wavelet.Backmethod == "resid") { cp.backm = 2; } @@ -238,7 +250,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.edgsens = 60.f; cp.edgampl = 10.f; - if(cp.lipp) { + if (cp.lipp) { cp.edgsens = (float) params->wavelet.edgesensi; cp.edgampl = (float) params->wavelet.edgeampli; } @@ -249,7 +261,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const static const float scales[10] = {1.f, 2.f, 4.f, 8.f, 16.f, 32.f, 64.f, 128.f, 256.f, 512.f}; float scaleskip[10]; - for(int sc = 0; sc < 10; sc++) { + for (int sc = 0; sc < 10; sc++) { scaleskip[sc] = scales[sc] / skip; } @@ -259,23 +271,23 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const //int DaubLen = settings->daubech ? 8 : 6; int DaubLen; - if(params->wavelet.daubcoeffmethod == "2_") { + if (params->wavelet.daubcoeffmethod == "2_") { DaubLen = 4; } - if(params->wavelet.daubcoeffmethod == "4_") { + if (params->wavelet.daubcoeffmethod == "4_") { DaubLen = 6; } - if(params->wavelet.daubcoeffmethod == "6_") { + if (params->wavelet.daubcoeffmethod == "6_") { DaubLen = 8; } - if(params->wavelet.daubcoeffmethod == "10_") { + if (params->wavelet.daubcoeffmethod == "10_") { DaubLen = 12; } - if(params->wavelet.daubcoeffmethod == "14_") { + if (params->wavelet.daubcoeffmethod == "14_") { DaubLen = 16; } @@ -284,11 +296,11 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const // if(params->wavelet.CHSLmethod=="CU") cp.CHSLmet=2; cp.EDmet = 1; - if(params->wavelet.EDmethod == "SL") { + if (params->wavelet.EDmethod == "SL") { cp.EDmet = 1; } - if(params->wavelet.EDmethod == "CU") { + if (params->wavelet.EDmethod == "CU") { cp.EDmet = 2; } @@ -308,29 +320,29 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.CHmet = 0; cp.HSmet = false; - if(params->wavelet.CHmethod == "with") { + if (params->wavelet.CHmethod == "with") { cp.CHmet = 1; } - if(params->wavelet.CHmethod == "link") { + if (params->wavelet.CHmethod == "link") { cp.CHmet = 2; } - if(params->wavelet.HSmethod == "with") { + if (params->wavelet.HSmethod == "with") { cp.HSmet = true; } cp.strength = min(1.f, max(0.f, ((float)params->wavelet.strength / 100.f))); - for(int m = 0; m < maxmul; m++) { + for (int m = 0; m < maxmul; m++) { cp.mulC[m] = waparams.ch[m]; } - if(waOpacityCurveRG) { + if (waOpacityCurveRG) { cp.opaRG = true; } - if(cp.opaRG) { + if (cp.opaRG) { cp.mulopaRG[0] = 200.f * (waOpacityCurveRG[0] - 0.5f); cp.mulopaRG[1] = 200.f * (waOpacityCurveRG[62] - 0.5f); cp.mulopaRG[2] = 200.f * (waOpacityCurveRG[125] - 0.5f); @@ -341,16 +353,16 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.mulopaRG[7] = 200.f * (waOpacityCurveRG[438] - 0.5f); cp.mulopaRG[8] = 200.f * (waOpacityCurveRG[500] - 0.5f); } else { - for(int level = 0; level < 9; level++) { + for (int level = 0; level < 9; level++) { cp.mulopaRG[level] = 0.f; } } - if(waOpacityCurveBY) { + if (waOpacityCurveBY) { cp.opaBY = true; } - if(cp.opaBY) { + if (cp.opaBY) { cp.mulopaBY[0] = 200.f * (waOpacityCurveBY[0] - 0.5f); cp.mulopaBY[1] = 200.f * (waOpacityCurveBY[62] - 0.5f); cp.mulopaBY[2] = 200.f * (waOpacityCurveBY[125] - 0.5f); @@ -361,47 +373,47 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.mulopaBY[7] = 200.f * (waOpacityCurveBY[438] - 0.5f); cp.mulopaBY[8] = 200.f * (waOpacityCurveBY[500] - 0.5f); } else { - for(int level = 0; level < 9; level++) { + for (int level = 0; level < 9; level++) { cp.mulopaBY[level] = 0.f; } } - if(wavCLVCcurve) { + if (wavCLVCcurve) { cp.edgcurv = true; } - if(waOpacityCurveWL) { + if (waOpacityCurveWL) { cp.diagcurv = true; } - for(int m = 0; m < maxmul; m++) { + for (int m = 0; m < maxmul; m++) { cp.mul[m] = waparams.c[m]; } cp.mul[9] = (float) waparams.sup; - for(int sc = 0; sc < 10; sc++) { //reduce strength if zoom < 100% for contrast - if(sc == 0) { - if(scaleskip[sc] < 1.f) { + for (int sc = 0; sc < 10; sc++) { //reduce strength if zoom < 100% for contrast + if (sc == 0) { + if (scaleskip[sc] < 1.f) { cp.mul[sc] *= (atten0 * scaleskip[sc]); } } else { - if(scaleskip[sc] < 1.f) { + if (scaleskip[sc] < 1.f) { cp.mul[sc] *= (atten123 * scaleskip[sc]); } } } // if(settings->verbose) printf("Wav mul 0=%f 1=%f 2=%f 3=%f 4=%f 5=%f 6=%f 7=%f 8=%f 9=%f\n",cp.mul[0],cp.mul[1],cp.mul[2],cp.mul[3],cp.mul[4],cp.mul[5],cp.mul[6],cp.mul[7],cp.mul[8],cp.mul[9]); - for(int sc = 0; sc < 9; sc++) { //reduce strength if zoom < 100% for chroma and tuning - if(sc == 0) { - if(scaleskip[sc] < 1.f) { + for (int sc = 0; sc < 9; sc++) { //reduce strength if zoom < 100% for chroma and tuning + if (sc == 0) { + if (scaleskip[sc] < 1.f) { cp.mulC[sc] *= (atten0 * scaleskip[sc]); cp.mulopaRG[sc] *= (atten0 * scaleskip[sc]); cp.mulopaBY[sc] *= (atten0 * scaleskip[sc]); } } else { - if(scaleskip[sc] < 1.f) { + if (scaleskip[sc] < 1.f) { cp.mulC[sc] *= (atten123 * scaleskip[sc]); cp.mulopaRG[sc] *= (atten123 * scaleskip[sc]); cp.mulopaBY[sc] *= (atten123 * scaleskip[sc]); @@ -418,6 +430,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const cp.conres = waparams.rescon; cp.conresH = waparams.resconH; + cp.radius = waparams.radius; cp.chrores = waparams.reschro; //cp.hueres=waparams.reshue; cp.hueres = 2.f; @@ -481,28 +494,28 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int minwin = min(imwidth, imheight); int maxlevelcrop = 9; - if(cp.mul[9] != 0) { + if (cp.mul[9] != 0) { maxlevelcrop = 10; } // adap maximum level wavelet to size of crop - if(minwin * skip < 1024) { + if (minwin * skip < 1024) { maxlevelcrop = 9; //sampling wavelet 512 } - if(minwin * skip < 512) { + if (minwin * skip < 512) { maxlevelcrop = 8; //sampling wavelet 256 } - if(minwin * skip < 256) { + if (minwin * skip < 256) { maxlevelcrop = 7; //sampling 128 } - if(minwin * skip < 128) { + if (minwin * skip < 128) { maxlevelcrop = 6; } - if(minwin < 64) { + if (minwin < 64) { maxlevelcrop = 5; } @@ -510,7 +523,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int levwav = params->wavelet.thres; - if(levwav == 9 && cp.mul[9] != 0) { + if (levwav == 9 && cp.mul[9] != 0) { levwav = 10; } @@ -522,7 +535,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const // if(cp.mul[levwav-1]!=0.f) // break; // I suppress this fonctionality ==> crash for level < 3 - if(levwav < 1) { + if (levwav < 1) { return; // nothing to do } @@ -532,11 +545,11 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const //output buffer int realtile = 0; - if(params->wavelet.Tilesmethod == "big") { + if (params->wavelet.Tilesmethod == "big") { realtile = 22; } - if(params->wavelet.Tilesmethod == "lit") { + if (params->wavelet.Tilesmethod == "lit") { realtile = 12; } @@ -544,16 +557,16 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int overlap = (int) tilesize * 0.125f; int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; - if(params->wavelet.Tilesmethod == "full") { + if (params->wavelet.Tilesmethod == "full") { kall = 0; } - Tile_calc (tilesize, overlap, kall, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + Tile_calc(tilesize, overlap, kall, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); const int numtiles = numtiles_W * numtiles_H; LabImage * dsttmp; - if(numtiles == 1) { + if (numtiles == 1) { dsttmp = dst; } else { dsttmp = new LabImage(imwidth, imheight); @@ -568,58 +581,57 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int minsizetile = min(tilewidth, tileheight); int maxlev2 = 10; - if(minsizetile < 1024 && levwav == 10) { + if (minsizetile < 1024 && levwav == 10) { maxlev2 = 9; } - if(minsizetile < 512) { + if (minsizetile < 512) { maxlev2 = 8; } - if(minsizetile < 256) { + if (minsizetile < 256) { maxlev2 = 7; } - if(minsizetile < 128) { + if (minsizetile < 128) { maxlev2 = 6; } levwav = min(maxlev2, levwav); //printf("levwav = %d\n",levwav); - #ifdef _OPENMP int numthreads = 1; int maxnumberofthreadsforwavelet = 0; //reduce memory for big tile size - if(kall != 0) { - if(realtile <= 22) { + if (kall != 0) { + if (realtile <= 22) { maxnumberofthreadsforwavelet = 2; } - if(realtile <= 20) { + if (realtile <= 20) { maxnumberofthreadsforwavelet = 3; } - if(realtile <= 18) { + if (realtile <= 18) { maxnumberofthreadsforwavelet = 4; } - if(realtile <= 16) { + if (realtile <= 16) { maxnumberofthreadsforwavelet = 6; } - if(realtile <= 14) { + if (realtile <= 14) { maxnumberofthreadsforwavelet = 8; } //printf("maxNRT=%d\n",maxnumberofthreadsforwavelet); - if((maxnumberofthreadsforwavelet == 6 || maxnumberofthreadsforwavelet == 8) && levwav == 10) { + if ((maxnumberofthreadsforwavelet == 6 || maxnumberofthreadsforwavelet == 8) && levwav == 10) { maxnumberofthreadsforwavelet -= 2; } - if(levwav <= 7 && maxnumberofthreadsforwavelet == 8) { + if (levwav <= 7 && maxnumberofthreadsforwavelet == 8) { maxnumberofthreadsforwavelet = 0; } } @@ -628,13 +640,13 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const // Calculate number of tiles. If less than omp_get_max_threads(), then limit num_threads to number of tiles - if( options.rgbDenoiseThreadLimit > 0) { + if (options.rgbDenoiseThreadLimit > 0) { maxnumberofthreadsforwavelet = min(max(options.rgbDenoiseThreadLimit / 2, 1), maxnumberofthreadsforwavelet); } numthreads = MIN(numtiles, omp_get_max_threads()); - if(maxnumberofthreadsforwavelet > 0) { + if (maxnumberofthreadsforwavelet > 0) { numthreads = MIN(numthreads, maxnumberofthreadsforwavelet); } @@ -642,20 +654,20 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const wavNestedLevels = omp_get_max_threads() / numthreads; bool oldNested = omp_get_nested(); - if(wavNestedLevels < 2) { + if (wavNestedLevels < 2) { wavNestedLevels = 1; } else { omp_set_nested(true); } - if(maxnumberofthreadsforwavelet > 0) - while(wavNestedLevels * numthreads > maxnumberofthreadsforwavelet) { + if (maxnumberofthreadsforwavelet > 0) + while (wavNestedLevels * numthreads > maxnumberofthreadsforwavelet) { wavNestedLevels--; } #endif - if(settings->verbose) { + if (settings->verbose) { printf("Ip Wavelet uses %d main thread(s) and up to %d nested thread(s) for each main thread\n", numthreads, wavNestedLevels); } @@ -695,10 +707,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const float **Lold = nullptr; float *LoldBuffer = nullptr; - if(numtiles == 1) { // untiled processing => we can use output buffer for labco + if (numtiles == 1) { // untiled processing => we can use output buffer for labco labco = dst; - if(cp.avoi) { // we need a buffer to hold a copy of the L channel + if (cp.avoi) { // we need a buffer to hold a copy of the L channel Lold = new float*[tileheight]; LoldBuffer = new float[tilewidth * tileheight]; memcpy(LoldBuffer, lab->L[0], tilewidth * tileheight * sizeof(float)); @@ -733,7 +745,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const _mm_storeu_ps(&varhue[i1][j1], huev); _mm_storeu_ps(&varchro[i1][j1], chrov); - if(labco != lab) { + if (labco != lab) { _mm_storeu_ps(&(labco->L[i1][j1]), LVFU(lab->L[i][j])); _mm_storeu_ps(&(labco->a[i1][j1]), av); _mm_storeu_ps(&(labco->b[i1][j1]), bv); @@ -751,7 +763,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const varhue[i1][j1] = xatan2f(b, a); varchro[i1][j1] = (sqrtf(a * a + b * b)) / 327.68f; - if(labco != lab) { + if (labco != lab) { labco->L[i1][j1] = lab->L[i][j]; labco->a[i1][j1] = a; labco->b[i1][j1] = b; @@ -760,7 +772,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const } //to avoid artifacts in blue sky - if(params->wavelet.median) { + if (params->wavelet.median) { float** tmL; int wid = labco->W; int hei = labco->H; @@ -771,8 +783,8 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const tmL[i] = new float[wid]; } - for(int i = borderL; i < hei - borderL; i++ ) { - for(int j = borderL; j < wid - borderL; j++) { + for (int i = borderL; i < hei - borderL; i++) { + for (int j = borderL; j < wid - borderL; j++) { tmL[i][j] = labco->L[i][j]; } } @@ -783,14 +795,14 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int i = 1; i < hei - 1; i++) { for (int j = 1; j < wid - 1; j++) { - if((varhue[i][j] < -1.3f && varhue[i][j] > - 2.5f) && (varchro[i][j] > 15.f && varchro[i][j] < 55.f) && labco->L[i][j] > 6000.f) { //blue sky + med3x3 ==> after for more effect use denoise - tmL[i][j] = median(labco->L[i][j] , labco->L[i - 1][j], labco->L[i + 1][j] , labco->L[i][j + 1], labco->L[i][j - 1], labco->L[i - 1][j - 1], labco->L[i - 1][j + 1], labco->L[i + 1][j - 1], labco->L[i + 1][j + 1]); //3x3 + if ((varhue[i][j] < -1.3f && varhue[i][j] > - 2.5f) && (varchro[i][j] > 15.f && varchro[i][j] < 55.f) && labco->L[i][j] > 6000.f) { //blue sky + med3x3 ==> after for more effect use denoise + tmL[i][j] = median(labco->L[i][j], labco->L[i - 1][j], labco->L[i + 1][j], labco->L[i][j + 1], labco->L[i][j - 1], labco->L[i - 1][j - 1], labco->L[i - 1][j + 1], labco->L[i + 1][j - 1], labco->L[i + 1][j + 1]); //3x3 } } } - for(int i = borderL; i < hei - borderL; i++ ) { - for(int j = borderL; j < wid - borderL; j++) { + for (int i = borderL; i < hei - borderL; i++) { + for (int j = borderL; j < wid - borderL; j++) { labco->L[i][j] = tmL[i][j]; } } @@ -803,7 +815,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const // end blue sky } - if(numtiles == 1) { + if (numtiles == 1) { // reduce the varhue array to get faster access in following processing and reduce peak memory usage float temphue[(tilewidth + 1) / 2] ALIGNED64; @@ -817,7 +829,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const memcpy(varhue[i], temphue, ((tilewidth + 1) / 2) * sizeof(float)); } - for(int i = (tileheight + 1) / 2; i < tileheight; i++) { + for (int i = (tileheight + 1) / 2; i < tileheight; i++) { delete [] varhue[i]; varhue[i] = nullptr; } @@ -834,20 +846,20 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int levwavL = levwav; bool ref0 = false; - if((cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f || cp.lev3s > 0.f) && cp.noiseena) { + if ((cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f || cp.lev3s > 0.f) && cp.noiseena) { ref0 = true; } // printf("LevwavL before: %d\n",levwavL); - if(cp.contrast == 0.f && !cp.tonemap && cp.conres == 0.f && cp.conresH == 0.f && cp.val == 0 && !ref0 && params->wavelet.CLmethod == "all") { // no processing of residual L or edge=> we probably can reduce the number of levels - while(levwavL > 0 && cp.mul[levwavL - 1] == 0.f) { // cp.mul[level] == 0.f means no changes to level + if (cp.contrast == 0.f && !cp.tonemap && cp.conres == 0.f && cp.conresH == 0.f && cp.val == 0 && !ref0 && params->wavelet.CLmethod == "all") { // no processing of residual L or edge=> we probably can reduce the number of levels + while (levwavL > 0 && cp.mul[levwavL - 1] == 0.f) { // cp.mul[level] == 0.f means no changes to level levwavL--; } } // printf("LevwavL after: %d\n",levwavL); // if(cp.noiseena){ - if(levwavL < 4 ) { + if (levwavL < 4) { levwavL = 4; //to allow edge => I always allocate 3 (4) levels..because if user select wavelet it is to do something !! } @@ -855,10 +867,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const // else { // if(levwavL < 3) levwavL=3;//to allow edge => I always allocate 3 (4) levels..because if user select wavelet it is to do something !! // } - if(levwavL > 0) { - wavelet_decomposition* Ldecomp = new wavelet_decomposition (labco->data, labco->W, labco->H, levwavL, 1, skip, max(1, wavNestedLevels), DaubLen ); + if (levwavL > 0) { + wavelet_decomposition* Ldecomp = new wavelet_decomposition(labco->data, labco->W, labco->H, levwavL, 1, skip, max(1, wavNestedLevels), DaubLen); - if(!Ldecomp->memoryAllocationFailed) { + if (!Ldecomp->memoryAllocationFailed) { float madL[8][3]; #ifdef _OPENMP @@ -878,19 +890,19 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const bool ref = false; - if((cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f || cp.lev3s > 0.f) && cp.noiseena) { + if ((cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f || cp.lev3s > 0.f) && cp.noiseena) { ref = true; } bool contr = false; - for(int f = 0; f < levwavL; f++) { - if(cp.mul[f] != 0.f) { + for (int f = 0; f < levwavL; f++) { + if (cp.mul[f] != 0.f) { contr = true; } } - if(cp.val > 0 || ref || contr) {//edge + if (cp.val > 0 || ref || contr) { //edge Evaluate2(*Ldecomp, mean, meanN, sigma, sigmaN, MaxP, MaxN); } @@ -902,7 +914,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const vari[2] = 8.f * SQR((cp.lev2n / 125.f) * (1.f + cp.lev2n / 25.f)); vari[3] = 8.f * SQR((cp.lev3n / 125.f) * (1.f + cp.lev3n / 25.f)); - if((cp.lev0n > 0.1f || cp.lev1n > 0.1f || cp.lev2n > 0.1f || cp.lev3n > 0.1f) && cp.noiseena) { + if ((cp.lev0n > 0.1f || cp.lev1n > 0.1f || cp.lev2n > 0.1f || cp.lev3n > 0.1f) && cp.noiseena) { int edge = 1; vari[0] = max(0.0001f, vari[0]); vari[1] = max(0.0001f, vari[1]); @@ -929,7 +941,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const WaveletcontAllL(labco, varhue, varchro, *Ldecomp, cp, skip, mean, sigma, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, ChCurve, Chutili); - if(cp.val > 0 || ref || contr || cp.diagcurv) {//edge + if (cp.val > 0 || ref || contr || cp.diagcurv) { //edge Evaluate2(*Ldecomp, mean, meanN, sigma, sigmaN, MaxP, MaxN); } @@ -956,21 +968,21 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const } - if(!hhutili) {//always a or b + if (!hhutili) { //always a or b int levwava = levwav; // printf("Levwava before: %d\n",levwava); - if(cp.chrores == 0.f && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels - while(levwava > 0 && !cp.diag && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwava - 1] == 0.f )) || (cp.CHmet != 2 && (levwava == 10 || (!cp.curv || cp.mulC[levwava - 1] == 0.f))))) && (!cp.opaRG || levwava == 10 || (cp.opaRG && cp.mulopaRG[levwava - 1] == 0.f)) && ((levwava == 10 || (cp.CHSLmet == 1 && cp.mulC[levwava - 1] == 0.f)))) { + if (cp.chrores == 0.f && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels + while (levwava > 0 && !cp.diag && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwava - 1] == 0.f)) || (cp.CHmet != 2 && (levwava == 10 || (!cp.curv || cp.mulC[levwava - 1] == 0.f))))) && (!cp.opaRG || levwava == 10 || (cp.opaRG && cp.mulopaRG[levwava - 1] == 0.f)) && ((levwava == 10 || (cp.CHSLmet == 1 && cp.mulC[levwava - 1] == 0.f)))) { levwava--; } } //printf("Levwava after: %d\n",levwava); - if(levwava > 0) { - wavelet_decomposition* adecomp = new wavelet_decomposition (labco->data + datalen, labco->W, labco->H, levwava, 1, skip, max(1, wavNestedLevels), DaubLen ); + if (levwava > 0) { + wavelet_decomposition* adecomp = new wavelet_decomposition(labco->data + datalen, labco->W, labco->H, levwava, 1, skip, max(1, wavNestedLevels), DaubLen); - if(!adecomp->memoryAllocationFailed) { + if (!adecomp->memoryAllocationFailed) { WaveletcontAllAB(labco, varhue, varchro, *adecomp, waOpacityCurveW, cp, true); adecomp->reconstruct(labco->data + datalen, cp.strength); } @@ -981,17 +993,17 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int levwavb = levwav; //printf("Levwavb before: %d\n",levwavb); - if(cp.chrores == 0.f && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels - while(levwavb > 0 && !cp.diag && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwavb - 1] == 0.f )) || (cp.CHmet != 2 && (levwavb == 10 || (!cp.curv || cp.mulC[levwavb - 1] == 0.f))))) && (!cp.opaBY || levwavb == 10 || (cp.opaBY && cp.mulopaBY[levwavb - 1] == 0.f)) && ((levwavb == 10 || (cp.CHSLmet == 1 && cp.mulC[levwavb - 1] == 0.f)))) { + if (cp.chrores == 0.f && params->wavelet.CLmethod == "all" && !cp.cbena) { // no processing of residual ab => we probably can reduce the number of levels + while (levwavb > 0 && !cp.diag && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwavb - 1] == 0.f)) || (cp.CHmet != 2 && (levwavb == 10 || (!cp.curv || cp.mulC[levwavb - 1] == 0.f))))) && (!cp.opaBY || levwavb == 10 || (cp.opaBY && cp.mulopaBY[levwavb - 1] == 0.f)) && ((levwavb == 10 || (cp.CHSLmet == 1 && cp.mulC[levwavb - 1] == 0.f)))) { levwavb--; } } // printf("Levwavb after: %d\n",levwavb); - if(levwavb > 0) { - wavelet_decomposition* bdecomp = new wavelet_decomposition (labco->data + 2 * datalen, labco->W, labco->H, levwavb, 1, skip, max(1, wavNestedLevels), DaubLen ); + if (levwavb > 0) { + wavelet_decomposition* bdecomp = new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavb, 1, skip, max(1, wavNestedLevels), DaubLen); - if(!bdecomp->memoryAllocationFailed) { + if (!bdecomp->memoryAllocationFailed) { WaveletcontAllAB(labco, varhue, varchro, *bdecomp, waOpacityCurveW, cp, false); bdecomp->reconstruct(labco->data + 2 * datalen, cp.strength); } @@ -1002,21 +1014,21 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const int levwavab = levwav; // printf("Levwavab before: %d\n",levwavab); - if(cp.chrores == 0.f && !hhutili && params->wavelet.CLmethod == "all") { // no processing of residual ab => we probably can reduce the number of levels - while(levwavab > 0 && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwavab - 1] == 0.f )) || (cp.CHmet != 2 && (levwavab == 10 || (!cp.curv || cp.mulC[levwavab - 1] == 0.f))))) && (!cp.opaRG || levwavab == 10 || (cp.opaRG && cp.mulopaRG[levwavab - 1] == 0.f)) && ((levwavab == 10 || (cp.CHSLmet == 1 && cp.mulC[levwavab - 1] == 0.f)))) { + if (cp.chrores == 0.f && !hhutili && params->wavelet.CLmethod == "all") { // no processing of residual ab => we probably can reduce the number of levels + while (levwavab > 0 && (((cp.CHmet == 2 && (cp.chro == 0.f || cp.mul[levwavab - 1] == 0.f)) || (cp.CHmet != 2 && (levwavab == 10 || (!cp.curv || cp.mulC[levwavab - 1] == 0.f))))) && (!cp.opaRG || levwavab == 10 || (cp.opaRG && cp.mulopaRG[levwavab - 1] == 0.f)) && ((levwavab == 10 || (cp.CHSLmet == 1 && cp.mulC[levwavab - 1] == 0.f)))) { levwavab--; } } // printf("Levwavab after: %d\n",levwavab); - if(levwavab > 0) { - wavelet_decomposition* adecomp = new wavelet_decomposition (labco->data + datalen, labco->W, labco->H, levwavab, 1, skip, max(1, wavNestedLevels), DaubLen ); - wavelet_decomposition* bdecomp = new wavelet_decomposition (labco->data + 2 * datalen, labco->W, labco->H, levwavab, 1, skip, max(1, wavNestedLevels), DaubLen ); + if (levwavab > 0) { + wavelet_decomposition* adecomp = new wavelet_decomposition(labco->data + datalen, labco->W, labco->H, levwavab, 1, skip, max(1, wavNestedLevels), DaubLen); + wavelet_decomposition* bdecomp = new wavelet_decomposition(labco->data + 2 * datalen, labco->W, labco->H, levwavab, 1, skip, max(1, wavNestedLevels), DaubLen); - if(!adecomp->memoryAllocationFailed && !bdecomp->memoryAllocationFailed) { + if (!adecomp->memoryAllocationFailed && !bdecomp->memoryAllocationFailed) { WaveletcontAllAB(labco, varhue, varchro, *adecomp, waOpacityCurveW, cp, true); WaveletcontAllAB(labco, varhue, varchro, *bdecomp, waOpacityCurveW, cp, false); - WaveletAandBAllAB(*adecomp, *bdecomp, cp, hhCurve, hhutili ); + WaveletAandBAllAB(*adecomp, *bdecomp, cp, hhCurve, hhutili); adecomp->reconstruct(labco->data + datalen, cp.strength); bdecomp->reconstruct(labco->data + 2 * datalen, cp.strength); @@ -1032,12 +1044,12 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const delete hhCurve; } - if(numtiles > 1 || (numtiles == 1 /*&& cp.avoi*/)) {//in all case since I add contrast curve + if (numtiles > 1 || (numtiles == 1 /*&& cp.avoi*/)) { //in all case since I add contrast curve //calculate mask for feathering output tile overlaps float Vmask[height + overlap] ALIGNED16; float Hmask[width + overlap] ALIGNED16; - if(numtiles > 1) { + if (numtiles > 1) { for (int i = 0; i < height; i++) { Vmask[i] = 1; } @@ -1083,7 +1095,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const float xBuffer[rowWidth] ALIGNED64; float yBuffer[rowWidth] ALIGNED64; - if(cp.avoi) { + if (cp.avoi) { int col; __m128 av, bv; __m128 cv, yv, xv; @@ -1092,7 +1104,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const __m128 c327d68v = _mm_set1_ps(327.68f); vmask xyMask; - for(col = 0; col < rowWidth - 3; col += 4) { + for (col = 0; col < rowWidth - 3; col += 4) { av = LVFU(labco->a[i1][col]); bv = LVFU(labco->b[i1][col]); STVF(atan2Buffer[col], xatan2f(bv, av)); @@ -1109,7 +1121,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const } - for(; col < rowWidth; col++) { + for (; col < rowWidth; col++) { float a = labco->a[i1][col]; float b = labco->b[i1][col]; atan2Buffer[col] = xatan2f(b, a); @@ -1125,7 +1137,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int j = tileleft; j < tileright; j++) { int j1 = j - tileleft; - if(cp.avoi) { //Gamut and Munsell + if (cp.avoi) { //Gamut and Munsell #ifdef __SSE2__ float HH = atan2Buffer[j1]; float Chprov1 = chprovBuffer[j1]; @@ -1145,7 +1157,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const L = labco->L[i1][j1]; const float Lin = labco->L[i1][j1]; - if(wavclCurve && cp.finena) { + if (wavclCurve && cp.finena) { labco->L[i1][j1] = (0.5f * Lin + 1.5f * wavclCurve[Lin]) / 2.f; //apply contrast curve } @@ -1176,8 +1188,8 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const Color::AllMunsellLch(true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum); #endif - if(correctionHue != 0.f || correctlum != 0.f) { // only calculate sin and cos if HH changed - if(fabs(correctionHue) < 0.015f) { + if (correctionHue != 0.f || correctlum != 0.f) { // only calculate sin and cos if HH changed + if (fabs(correctionHue) < 0.015f) { HH += correctlum; // correct only if correct Munsell chroma very little. } @@ -1190,7 +1202,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const L = labco->L[i1][j1]; const float Lin = std::max(0.f, L); - if(wavclCurve && cp.finena) { + if (wavclCurve && cp.finena) { labco->L[i1][j1] = (0.5f * Lin + 1.5f * wavclCurve[Lin]) / 2.f; //apply contrast curve } @@ -1199,7 +1211,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const b = labco->b[i1][j1]; } - if(numtiles > 1) { + if (numtiles > 1) { float factor = Vmask[i1] * Hmask[j1]; dsttmp->L[i][j] += factor * L; dsttmp->a[i][j] += factor * a; @@ -1214,19 +1226,19 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const } } - if(LoldBuffer != nullptr) { + if (LoldBuffer != nullptr) { delete [] LoldBuffer; delete [] Lold; } - if(numtiles > 1) { + if (numtiles > 1) { delete labco; } } } for (int i = 0; i < tileheight; i++) - if(varhue[i] != nullptr) { + if (varhue[i] != nullptr) { delete [] varhue[i]; } @@ -1243,11 +1255,86 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const omp_set_nested(oldNested); #endif - if(numtiles != 1) { + if (numtiles != 1) { dst->CopyFrom(dsttmp); delete dsttmp; } + if (waparams.softradend > 0.f && cp.finena) { + array2D ble(lab->W, lab->H); + array2D guid(lab->W, lab->H); + Imagefloat *tmpImage = nullptr; + tmpImage = new Imagefloat(lab->W, lab->H); + + bool multiTh = false; + +#ifdef _OPENMP + + if (numthreads > 1) { + multiTh = true; + } + +#endif + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < lab->H; ir++) + for (int jr = 0; jr < lab->W; jr++) { + float X, Y, Z; + float L = provradius->L[ir][jr]; + float a = provradius->a[ir][jr]; + float b = provradius->b[ir][jr]; + Color::Lab2XYZ(L, a, b, X, Y, Z); + + guid[ir][jr] = Y / 32768.f; + float La = dst->L[ir][jr]; + float aa = dst->a[ir][jr]; + float ba = dst->b[ir][jr]; + Color::Lab2XYZ(La, aa, ba, X, Y, Z); + tmpImage->r(ir, jr) = X; + tmpImage->g(ir, jr) = Y; + tmpImage->b(ir, jr) = Z; + ble[ir][jr] = Y / 32768.f; + + } + + double epsilmax = 0.001; + double epsilmin = 0.0001; + double aepsil = (epsilmax - epsilmin) / 90.f; + double bepsil = epsilmax - 100.f * aepsil; + double epsil = aepsil * waparams.softradend + bepsil; + + float blur = 10.f / scale * (0.001f + 0.8f * waparams.softradend); + + rtengine::guidedFilter(guid, ble, ble, blur, epsil, multiTh); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < lab->H; ir++) + for (int jr = 0; jr < lab->W; jr++) { + float X = tmpImage->r(ir, jr); + float Y = 32768.f * ble[ir][jr]; + float Z = tmpImage->b(ir, jr); + float L, a, b; + Color::XYZ2Lab(X, Y, Z, L, a, b); + + dst->L[ir][jr] = L; + } + + delete tmpImage; + } + + if (waparams.softradend > 0.f && cp.finena) { + delete provradius; + provradius = NULL; + } + #ifdef _DEBUG delete MunsDebugInfo; #endif @@ -1259,7 +1346,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const #undef offset #undef epsilon -void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &averagePlus, float &averageNeg, float &max, float &min) +void ImProcFunctions::Aver(float * RESTRICT DataList, int datalen, float &averagePlus, float &averageNeg, float &max, float &min) { //find absolute mean @@ -1278,19 +1365,19 @@ void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &aver #pragma omp for reduction(+:averaP,averaN,countP,countN) nowait #endif - for(int i = 0; i < datalen; i++) { - if(DataList[i] >= thres) { + for (int i = 0; i < datalen; i++) { + if (DataList[i] >= thres) { averaP += static_cast(DataList[i]); - if(DataList[i] > lmax) { + if (DataList[i] > lmax) { lmax = DataList[i]; } countP++; - } else if(DataList[i] < -thres) { + } else if (DataList[i] < -thres) { averaN += static_cast(DataList[i]); - if(DataList[i] < lmin) { + if (DataList[i] < lmin) { lmin = DataList[i]; } @@ -1307,13 +1394,13 @@ void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &aver } } - if(countP > 0) { + if (countP > 0) { averagePlus = averaP / countP; } else { averagePlus = 0; } - if(countN > 0) { + if (countN > 0) { averageNeg = averaN / countN; } else { averageNeg = 0; @@ -1322,7 +1409,7 @@ void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &aver } -void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg) +void ImProcFunctions::Sigma(float * RESTRICT DataList, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg) { int countP = 0, countN = 0; double variP = 0.0, variN = 0.0; // use double precision for large summations @@ -1332,23 +1419,23 @@ void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float aver #pragma omp parallel for reduction(+:variP,variN,countP,countN) num_threads(wavNestedLevels) if(wavNestedLevels>1) #endif - for(int i = 0; i < datalen; i++) { - if(DataList[i] >= thres) { + for (int i = 0; i < datalen; i++) { + if (DataList[i] >= thres) { variP += static_cast(SQR(DataList[i] - averagePlus)); countP++; - } else if(DataList[i] <= -thres) { + } else if (DataList[i] <= -thres) { variN += static_cast(SQR(DataList[i] - averageNeg)); countN++; } } - if(countP > 0) { + if (countP > 0) { sigmaPlus = sqrt(variP / countP); } else { sigmaPlus = 0; } - if(countN > 0) { + if (countN > 0) { sigmaNeg = sqrt(variN / countN); } else { sigmaNeg = 0; @@ -1369,12 +1456,12 @@ void ImProcFunctions::Evaluate2(wavelet_decomposition &WaveletCoeffs_L, float ** WavCoeffs_L = WaveletCoeffs_L.level_coeffs(lvl); - Eval2 (WavCoeffs_L, lvl, Wlvl_L, Hlvl_L, mean, meanN, sigma, sigmaN, MaxP, MaxN); + Eval2(WavCoeffs_L, lvl, Wlvl_L, Hlvl_L, mean, meanN, sigma, sigmaN, MaxP, MaxN); } } -void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, - int W_L, int H_L, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN) +void ImProcFunctions::Eval2(float ** WavCoeffs_L, int level, + int W_L, int H_L, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN) { float avLP[4], avLN[4]; @@ -1424,17 +1511,17 @@ void ImProcFunctions::CompressDR(float *Source, int W_L, int H_L, float Compress float exponent; - if(DetailBoost > 0.f && DetailBoost < 0.05f ) { + if (DetailBoost > 0.f && DetailBoost < 0.05f) { float betemp = expf(-(2.f - DetailBoost + 0.694f)) - 1.f; //0.694 = log(2) - exponent = 1.2f * xlogf( -betemp); + exponent = 1.2f * xlogf(-betemp); exponent /= 20.f; - } else if(DetailBoost >= 0.05f && DetailBoost < 0.25f ) { + } else if (DetailBoost >= 0.05f && DetailBoost < 0.25f) { float betemp = expf(-(2.f - DetailBoost + 0.694f)) - 1.f; //0.694 = log(2) - exponent = 1.2f * xlogf( -betemp); + exponent = 1.2f * xlogf(-betemp); exponent /= (-75.f * DetailBoost + 23.75f); - } else if(DetailBoost >= 0.25f) { + } else if (DetailBoost >= 0.25f) { float betemp = expf(-(2.f - DetailBoost + 0.694f)) - 1.f; //0.694 = log(2) - exponent = 1.2f * xlogf( -betemp); + exponent = 1.2f * xlogf(-betemp); exponent /= (-2.f * DetailBoost + 5.5f); } else { exponent = (Compression - 1.0f) / 20.f; @@ -1453,12 +1540,12 @@ void ImProcFunctions::CompressDR(float *Source, int W_L, int H_L, float Compress #pragma omp for #endif - for(int i = 0; i < n - 3; i += 4) { + for (int i = 0; i < n - 3; i += 4) { STVFU(Source[i], xexpf(xlogf(LVFU(Source[i])) * exponentv)); } } - for(int i = n - (n % 4); i < n; i++) { + for (int i = n - (n % 4); i < n; i++) { Source[i] = xexpf(xlogf(Source[i]) * exponent); } @@ -1467,7 +1554,7 @@ void ImProcFunctions::CompressDR(float *Source, int W_L, int H_L, float Compress #pragma omp parallel for #endif - for(int i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { Source[i] = xexpf(xlogf(Source[i]) * exponent); } @@ -1481,7 +1568,7 @@ void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, struct cont_params &cp float gamm = params->wavelet.gamma; cp.TMmeth = 2; //default after testing - if(cp.TMmeth == 1) { + if (cp.TMmeth == 1) { min0 = 0.0f; max0 = 32768.f; } else if (cp.TMmeth == 2) { @@ -1492,7 +1579,7 @@ void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, struct cont_params &cp #pragma omp parallel for #endif - for(int i = 0; i < W_L * H_L; i++) { + for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L0[i] = (WavCoeffs_L0[i] - min0) / max0; WavCoeffs_L0[i] *= gamm; } @@ -1500,7 +1587,7 @@ void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, struct cont_params &cp float Compression = expf(-stren); //This modification turns numbers symmetric around 0 into exponents. float DetailBoost = stren; - if(stren < 0.0f) { + if (stren < 0.0f) { DetailBoost = 0.0f; //Go with effect of exponent only if uncompressing. } @@ -1512,7 +1599,7 @@ void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, struct cont_params &cp #pragma omp parallel for // removed schedule(dynamic,10) #endif - for(int ii = 0; ii < W_L * H_L; ii++) { + for (int ii = 0; ii < W_L * H_L; ii++) { WavCoeffs_L0[ii] = WavCoeffs_L0[ii] * max0 * (1.f / gamm) + min0; } } @@ -1525,14 +1612,14 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat float stren = cp.tmstrength; - float edgest = params->epd.edgeStopping; - float sca = params->epd.scale; + float edgest = params->wavelet.edgs; + float sca = params->wavelet.scale; float gamm = params->wavelet.gamma; - float rew = params->epd.reweightingIterates; + int rew = 0; //params->epd.reweightingIterates; EdgePreservingDecomposition epd2(W_L, H_L); cp.TMmeth = 2; //default after testing - if(cp.TMmeth == 1) { + if (cp.TMmeth == 1) { min0 = 0.0f; max0 = 32768.f; } else if (cp.TMmeth == 2) { @@ -1544,7 +1631,7 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat #pragma omp parallel for #endif - for(int i = 0; i < W_L * H_L; i++) { + for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L0[i] = (WavCoeffs_L0[i] - min0) / max0; WavCoeffs_L0[i] *= gamm; } @@ -1552,12 +1639,12 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat float Compression = expf(-stren); //This modification turns numbers symmetric around 0 into exponents. float DetailBoost = stren; - if(stren < 0.0f) { + if (stren < 0.0f) { DetailBoost = 0.0f; //Go with effect of exponent only if uncompressing. } //Auto select number of iterates. Note that p->EdgeStopping = 0 makes a Gaussian blur. - if(Iterates == 0) { + if (Iterates == 0) { Iterates = (unsigned int)(edgest * 15.0f); } @@ -1569,7 +1656,7 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat #pragma omp parallel for // removed schedule(dynamic,10) #endif - for(int ii = 0; ii < W_L * H_L; ii++) { + for (int ii = 0; ii < W_L * H_L; ii++) { WavCoeffs_L0[ii] = WavCoeffs_L0[ii] * max0 * (1.f / gamm) + min0; } } @@ -1584,7 +1671,7 @@ void ImProcFunctions::WaveletcontAllLfinal(wavelet_decomposition &WaveletCoeffs_ int Wlvl_L = WaveletCoeffs_L.level_W(lvl); int Hlvl_L = WaveletCoeffs_L.level_H(lvl); float ** WavCoeffs_L = WaveletCoeffs_L.level_coeffs(lvl); - finalContAllL (WavCoeffs_L, WavCoeffs_L0, lvl, dir, cp, Wlvl_L, Hlvl_L, mean, sigma, MaxP, waOpacityCurveWL); + finalContAllL(WavCoeffs_L, WavCoeffs_L0, lvl, dir, cp, Wlvl_L, Hlvl_L, mean, sigma, MaxP, waOpacityCurveWL); } } } @@ -1598,16 +1685,12 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * int H_L = WaveletCoeffs_L.level_H(0); float * WavCoeffs_L0 = WaveletCoeffs_L.coeff0; - float maxh = 2.5f; //amplification contrast above mean - float maxl = 2.5f; //reduction contrast under mean float contrast = cp.contrast; - float multL = (float)contrast * (maxl - 1.f) / 100.f + 1.f; - float multH = (float) contrast * (maxh - 1.f) / 100.f + 1.f; double avedbl = 0.0; // use double precision for large summations float max0 = 0.f; float min0 = FLT_MAX; - if(contrast != 0.f || (cp.tonemap && cp.resena)) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step + if (contrast != 0.f || (cp.tonemap && cp.resena)) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step #ifdef _OPENMP #pragma omp parallel for reduction(+:avedbl) num_threads(wavNestedLevels) if(wavNestedLevels>1) #endif @@ -1627,12 +1710,12 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #pragma omp for #endif - for(int i = 0; i < W_L * H_L; i++) { - if(WavCoeffs_L0[i] < lminL) { + for (int i = 0; i < W_L * H_L; i++) { + if (WavCoeffs_L0[i] < lminL) { lminL = WavCoeffs_L0[i]; } - if(WavCoeffs_L0[i] > lmaxL) { + if (WavCoeffs_L0[i] > lmaxL) { lmaxL = WavCoeffs_L0[i]; } @@ -1642,11 +1725,11 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #pragma omp critical #endif { - if(lminL < min0) { + if (lminL < min0) { min0 = lminL; } - if(lmaxL > max0) { + if (lmaxL > max0) { max0 = lmaxL; } } @@ -1658,7 +1741,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * // printf("MAXmax0=%f MINmin0=%f\n",max0,min0); //tone mapping - if(cp.tonemap && cp.contmet == 2 && cp.resena) { + if (cp.tonemap && cp.contmet == 2 && cp.resena) { //iterate = 5 EPDToneMapResid(WavCoeffs_L0, 0, skip, cp, W_L, H_L, max0, min0); @@ -1670,20 +1753,13 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * max0 /= 327.68f; min0 /= 327.68f; float ave = avedbl / (double)(W_L * H_L); - float av = ave / 327.68f; - float ah = (multH - 1.f) / (av - max0); // - float bh = 1.f - max0 * ah; - float al = (multL - 1.f) / (av - min0); - float bl = 1.f - min0 * al; - float factorx = 1.f; -// float *koeLi[9]; -// float maxkoeLi[9]; + float avg = ave / 32768.f; float *koeLi[12]; float maxkoeLi[12]; float *koeLibuffer = nullptr; - for(int y = 0; y < 12; y++) { + for (int y = 0; y < 12; y++) { maxkoeLi[y] = 0.f; //9 } @@ -1693,44 +1769,44 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * koeLi[i] = &koeLibuffer[i * W_L * H_L]; } - for(int j = 0; j < 12; j++) //9 + for (int j = 0; j < 12; j++) //9 for (int i = 0; i < W_L * H_L; i++) { koeLi[j][i] = 0.f; } + avg = LIM01(avg); + double contreal = 0.6 * contrast; + 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 + }); + + #ifdef _OPENMP #pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1) #endif { if(contrast != 0.f && cp.resena && max0 > 0.f) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step { + #ifdef _OPENMP #pragma omp for #endif - for (int i = 0; i < W_L * H_L; i++) { //contrast - if(WavCoeffs_L0[i] < 32768.f) { - float prov; - - if( WavCoeffs_L0[i] > ave) { - float kh = ah * (WavCoeffs_L0[i] / 327.68f) + bh; - prov = WavCoeffs_L0[i]; - WavCoeffs_L0[i] = ave + kh * (WavCoeffs_L0[i] - ave); - } else { - float kl = al * (WavCoeffs_L0[i] / 327.68f) + bl; - prov = WavCoeffs_L0[i]; - WavCoeffs_L0[i] = ave - kl * (ave - WavCoeffs_L0[i]); - } - - float diflc = WavCoeffs_L0[i] - prov; - diflc *= factorx; - WavCoeffs_L0[i] = prov + diflc; - } + for (int i = 0; i < W_L * H_L; i++) { + float buf = LIM01(WavCoeffs_L0[i] / 32768.f); + buf = resid_contrast.getVal(buf); + buf *= 32768.f; + WavCoeffs_L0[i] = buf; } } } - if(cp.tonemap && cp.contmet == 1 && cp.resena) { + + if (cp.tonemap && cp.contmet == 1 && cp.resena) { float maxp = max0 * 256.f; float minp = min0 * 256.f; #ifdef _OPENMP @@ -1738,54 +1814,44 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #endif ContrastResid(WavCoeffs_L0, cp, W_L, H_L, maxp, minp); } + } + if ((cp.conres != 0.f || cp.conresH != 0.f) && cp.resena) { // cp.conres = 0.f and cp.comresH = 0.f means that all will be multiplied by 1.f, so we can skip this step + LabImage *temp = nullptr; + temp = new LabImage(W_L, H_L); #ifdef _OPENMP - #pragma omp barrier + #pragma omp for #endif - if((cp.conres != 0.f || cp.conresH != 0.f) && cp.resena) { // cp.conres = 0.f and cp.comresH = 0.f means that all will be multiplied by 1.f, so we can skip this step -#ifdef _OPENMP - #pragma omp for nowait -#endif - - for (int i = 0; i < W_L * H_L; i++) { - float LL = WavCoeffs_L0[i]; - float LL100 = LL / 327.68f; - float tran = 5.f;//transition - //shadow - float alp = 3.f; //increase contrast sahdow in lowlights between 1 and ?? - - if(cp.th > (100.f - tran)) { - tran = 100.f - cp.th; - } - - if(LL100 < cp.th) { - float aalp = (1.f - alp) / cp.th; //no changes for LL100 = cp.th - float kk = aalp * LL100 + alp; - WavCoeffs_L0[i] *= (1.f + kk * cp.conres / 200.f); - } else if(LL100 < cp.th + tran) { - float ath = -cp.conres / tran; - float bth = cp.conres - ath * cp.th; - WavCoeffs_L0[i] *= (1.f + (LL100 * ath + bth) / 200.f); - } - - //highlight - tran = 5.f; - - if(cp.thH < (tran)) { - tran = cp.thH; - } - - if(LL100 > cp.thH) { - WavCoeffs_L0[i] *= (1.f + cp.conresH / 200.f); - } else if(LL100 > (cp.thH - tran)) { - float athH = cp.conresH / tran; - float bthH = cp.conresH - athH * cp.thH; - WavCoeffs_L0[i] *= (1.f + (LL100 * athH + bthH) / 200.f); - } + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + temp->L[i][j] = WavCoeffs_L0[i * W_L + j]; } } + { + ImProcFunctions::shadowsHighlights(temp, true, 1, cp.conresH, cp.conres, cp.radius, skip, cp.thH, cp.th); + } + +#ifdef _OPENMP + #pragma omp for +#endif + + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + WavCoeffs_L0[i * W_L + j] = temp->L[i][j]; + } + } + + delete temp; + + } + + +#ifdef _OPENMP + #pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1) +#endif + { //enabled Lipschitz..replace simple by complex edge detection // I found this concept on the web (doctoral thesis on medical Imaging) // I was inspired by the principle of Canny and Lipschitz (continuity and derivability) @@ -1798,7 +1864,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * float eddlipampl = 1.f + cp.edgampl / 50.f; - if(cp.detectedge) { //enabled Lipschitz control...more memory..more time... + if (cp.detectedge) { //enabled Lipschitz control...more memory..more time... float *tmCBuffer = new float[H_L * W_L]; float *tmC[H_L]; @@ -1816,7 +1882,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * int H_L = WaveletCoeffs_L.level_H(lvl); float ** WavCoeffs_LL = WaveletCoeffs_L.level_coeffs(lvl); - calckoe(WavCoeffs_LL, cp, koeLi, lvl , dir, W_L, H_L, edd, maxkoeLi, tmC); + calckoe(WavCoeffs_LL, cp, koeLi, lvl, dir, W_L, H_L, edd, maxkoeLi, tmC); // return convolution KoeLi and maxkoeLi of level 0 1 2 3 and Dir Horiz, Vert, Diag } } @@ -1835,7 +1901,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * //treatment of koeLi and maxkoeLi float interm = 0.f; - if(cp.lip3 && cp.lipp) { + if (cp.lip3 && cp.lipp) { // comparison between pixel and neighbours const auto neigh = cp.neigh == 1; const auto kneigh = neigh ? 28.f : 38.f; @@ -1874,11 +1940,11 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * //Liamp=1 for eddlipinfl //liamp > 1 for alp >eddlipinfl and alph < 1 //Liamp < 1 for alp < eddlipinfl and alph > 0 - if(alph > 1.f) { + if (alph > 1.f) { alph = 1.f / alph; } - if(beta > 1.f) { + if (beta > 1.f) { beta = 1.f / beta; } @@ -1888,14 +1954,14 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * float bet = 1.f; //if(cp.lip3) {//enhance algorithm - if(alph > eddlipinfl && beta < 0.85f * eddlipinfl) { //0.85 arbitrary value ==> eliminate from edge if H V D too different + if (alph > eddlipinfl && beta < 0.85f * eddlipinfl) { //0.85 arbitrary value ==> eliminate from edge if H V D too different bet = beta; } //} float AmpLip = 1.f; - if(alph > eddlipinfl) { + if (alph > eddlipinfl) { AmpLip = alipinfl * alph + blipinfl; //If beta low reduce kampli kampli = SQR(bet) * AmpLip * aamp; } else { @@ -1915,7 +1981,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * interm *= kampli; - if(interm < cp.eddetthr / eddlow) { + if (interm < cp.eddetthr / eddlow) { interm = 0.01f; //eliminate too low values } @@ -1941,7 +2007,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * float ** WavCoeffs_L = WaveletCoeffs_L.level_coeffs(lvl); - ContAllL (koeLi, maxkoeLi, true, maxlvl, labco, varhue, varchrom, WavCoeffs_L, WavCoeffs_L0, lvl, dir, cp, Wlvl_L, Hlvl_L, skip, mean, sigma, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, ChCurve, Chutili); + ContAllL(koeLi, maxkoeLi, true, maxlvl, labco, varhue, varchrom, WavCoeffs_L, WavCoeffs_L0, lvl, dir, cp, Wlvl_L, Hlvl_L, skip, mean, sigma, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, ChCurve, Chutili); } @@ -1949,7 +2015,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } //delete edge detection - if(koeLibuffer) { + if (koeLibuffer) { delete [] koeLibuffer; } } @@ -1990,7 +2056,7 @@ void ImProcFunctions::WaveletAandBAllAB(wavelet_decomposition &WaveletCoeffs_a, STVF(chrbuffer[k], chrv); } - for(; k < W_L; k++) { + for (; k < W_L; k++) { huebuffer[k] = xatan2f(WavCoeffs_b0[i * W_L + k], WavCoeffs_a0[i * W_L + k]); chrbuffer[k] = sqrtf(SQR(WavCoeffs_b0[i * W_L + k]) + SQR(WavCoeffs_a0[i * W_L + k])) / 327.68f; } @@ -2036,7 +2102,7 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float #pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1) #endif { - if(cp.chrores != 0.f && cp.resena) { // cp.chrores == 0.f means all will be multiplied by 1.f, so we can skip the processing of residual + if (cp.chrores != 0.f && cp.resena) { // cp.chrores == 0.f means all will be multiplied by 1.f, so we can skip the processing of residual #ifdef _OPENMP #pragma omp for nowait @@ -2050,22 +2116,22 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float float modhue = varhue[ii][jj]; float scale = 1.f; - if(skyprot > 0.f) { - if((modhue < cp.t_ry && modhue > cp.t_ly)) { + if (skyprot > 0.f) { + if ((modhue < cp.t_ry && modhue > cp.t_ly)) { scale = (100.f - cp.sky) / 100.1f; - } else if((modhue >= cp.t_ry && modhue < cp.b_ry)) { + } else if ((modhue >= cp.t_ry && modhue < cp.b_ry)) { scale = (100.f - cp.sky) / 100.1f; float ar = (scale - 1.f) / (cp.t_ry - cp.b_ry); float br = scale - cp.t_ry * ar; scale = ar * modhue + br; - } else if((modhue > cp.b_ly && modhue < cp.t_ly)) { + } else if ((modhue > cp.b_ly && modhue < cp.t_ly)) { scale = (100.f - cp.sky) / 100.1f; float al = (scale - 1.f) / (-cp.b_ly + cp.t_ly); float bl = scale - cp.t_ly * al; scale = al * modhue + bl; } - } else if(skyprot < 0.f) { - if((modhue > cp.t_ry || modhue < cp.t_ly)) { + } else if (skyprot < 0.f) { + if ((modhue > cp.t_ry || modhue < cp.t_ly)) { scale = (100.f + cp.sky) / 100.1f; } @@ -2089,7 +2155,7 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float } } - if(cp.cbena && cp.resena) {//if user select Toning and color balance + if (cp.cbena && cp.resena) { //if user select Toning and color balance #ifdef _OPENMP #pragma omp for nowait @@ -2102,24 +2168,24 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float float sca = 1.f; //amplifer - reducter...about 1, but perhaps 0.6 or 1.3 - if(useChannelA) {//green red (little magenta) + if (useChannelA) { //green red (little magenta) //transition to avoid artifacts with 6 between 30 to 36 and 63 to 69 float aa = (cp.grmed - cp.grlow) / 6.f; float bb = cp.grlow - 30.f * aa; float aaa = (cp.grhigh - cp.grmed) / 6.f; float bbb = cp.grmed - 63.f * aaa; - if(LL < 30.f) { //shadows + if (LL < 30.f) { //shadows WavCoeffs_ab0[i] += cp.grlow * (sca) * 300.f; - } else if(LL >= 30.f && LL < 36.f) { //transition + } else if (LL >= 30.f && LL < 36.f) { //transition float tr = aa * LL + bb; WavCoeffs_ab0[i] += tr * (sca) * 300.f; - } else if(LL >= 36.f && LL < 63.f) { //midtones + } else if (LL >= 36.f && LL < 63.f) { //midtones WavCoeffs_ab0[i] += cp.grmed * (sca) * 300.f; - } else if(LL >= 63.f && LL < 69.f) { //transition + } else if (LL >= 63.f && LL < 69.f) { //transition float trh = aaa * LL + bbb; WavCoeffs_ab0[i] += trh * (sca) * 300.f; - } else if(LL >= 69.f) { //highlights + } else if (LL >= 69.f) { //highlights WavCoeffs_ab0[i] += cp.grhigh * (sca) * 300.f; } } else { //blue yellow @@ -2129,17 +2195,17 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float float aaa1 = (cp.blhigh - cp.blmed) / 6.f; float bbb1 = cp.blmed - 63.f * aaa1; - if(LL < 30.f) { + if (LL < 30.f) { WavCoeffs_ab0[i] += cp.bllow * (sca) * 300.f; - } else if(LL >= 30.f && LL < 36.f) { + } else if (LL >= 30.f && LL < 36.f) { float tr1 = aa1 * LL + bb1; WavCoeffs_ab0[i] += tr1 * (sca) * 300.f; - } else if(LL >= 36.f && LL < 63.f) { + } else if (LL >= 36.f && LL < 63.f) { WavCoeffs_ab0[i] += cp.blmed * (sca) * 300.f; - } else if(LL >= 63.f && LL < 69.f) { + } else if (LL >= 63.f && LL < 69.f) { float trh1 = aaa1 * LL + bbb1; WavCoeffs_ab0[i] += trh1 * (sca) * 300.f; - } else if(LL >= 69.f) { + } else if (LL >= 69.f) { WavCoeffs_ab0[i] += cp.blhigh * (sca) * 300.f; } } @@ -2157,7 +2223,7 @@ void ImProcFunctions::WaveletcontAllAB(LabImage * labco, float ** varhue, float int Hlvl_ab = WaveletCoeffs_ab.level_H(lvl); float ** WavCoeffs_ab = WaveletCoeffs_ab.level_coeffs(lvl); - ContAllAB (labco, maxlvl, varhue, varchrom, WavCoeffs_ab, WavCoeffs_ab0, lvl, dir, waOpacityCurveW, cp, Wlvl_ab, Hlvl_ab, useChannelA); + ContAllAB(labco, maxlvl, varhue, varchrom, WavCoeffs_ab, WavCoeffs_ab0, lvl, dir, waOpacityCurveW, cp, Wlvl_ab, Hlvl_ab, useChannelA); } } @@ -2173,7 +2239,7 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c int borderL = 2; // printf("cpedth=%f\n",cp.eddetthr); - if(cp.eddetthr < 30.f) { + if (cp.eddetthr < 30.f) { borderL = 1; // I calculate coefficients with r size matrix 3x3 r=1 ; 5x5 r=2; 7x7 r=3 @@ -2197,7 +2263,7 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c } } - } else if(cp.eddetthr >= 30.f && cp.eddetthr < 50.f) { + } else if (cp.eddetthr >= 30.f && cp.eddetthr < 50.f) { borderL = 1; for (int i = 1; i < H_L - 1; i++) { //sigma=0.85 @@ -2213,7 +2279,7 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c } - else if(cp.eddetthr >= 50.f && cp.eddetthr < 75.f) { + else if (cp.eddetthr >= 50.f && cp.eddetthr < 75.f) { borderL = 1; for (int i = 1; i < H_L - 1; i++) { @@ -2225,11 +2291,11 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c } } - else if(cp.eddetthr >= 75.f) { + else if (cp.eddetthr >= 75.f) { borderL = 2; //if(cp.lip3 && level > 1) { - if(level > 1) {// do not activate 5x5 if level 0 or 1 + if (level > 1) { // do not activate 5x5 if level 0 or 1 for (int i = 2; i < H_L - 2; i++) { for (int j = 2; j < W_L - 2; j++) { @@ -2247,7 +2313,7 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c // 4 9 12 9 4 // 2 4 5 4 2 // divi 159 - if(cp.eddetthr < 85.f) { //sigma=1.1 + if (cp.eddetthr < 85.f) { //sigma=1.1 tmC[i][j] = (15.f * WavCoeffs_LL[dir][i * W_L + j] + 10.f * WavCoeffs_LL[dir][(i - 1) * W_L + j] + 10.f * WavCoeffs_LL[dir][(i + 1) * W_L + j] + 10.f * WavCoeffs_LL[dir][i * W_L + j + 1] + 10.f * WavCoeffs_LL[dir][i * W_L + j - 1] + 7.f * WavCoeffs_LL[dir][(i - 1) * W_L + j - 1] + 7.f * WavCoeffs_LL[dir][(i - 1) * W_L + j + 1] + 7.f * WavCoeffs_LL[dir][(i + 1) * W_L + j - 1] + 7.f * WavCoeffs_LL[dir][(i + 1) * W_L + j + 1] @@ -2298,24 +2364,24 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c thr2 += cp.eddet / 30.f; //to test float diffFactor = (cp.eddet / 100.f); - for(int i = 0; i < H_L; i++ ) { - for(int j = 0; j < W_L; j++) { + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { koeLi[level * 3 + dir - 1][i * W_L + j] = 1.f; } } - for(int i = borderL; i < H_L - borderL; i++ ) { - for(int j = borderL; j < W_L - borderL; j++) { + for (int i = borderL; i < H_L - borderL; i++) { + for (int j = borderL; j < W_L - borderL; j++) { // my own algo : probably a little false, but simpler as Lipschitz ! // Thr2 = maximum of the function ==> Lipsitch says = probably edge // float temp = WavCoeffs_LL[dir][i*W_L + j]; // if(temp>=0.f && temp < thr) temp = thr; // if(temp < 0.f && temp > -thr) temp = -thr; - float temp = max(fabsf(WavCoeffs_LL[dir][i * W_L + j]), thr ); + float temp = max(fabsf(WavCoeffs_LL[dir][i * W_L + j]), thr); koeLi[level * 3 + dir - 1][i * W_L + j] = min(thr2, fabs(tmC[i][j] / temp)); // limit maxi //it will be more complicated to calculate both Wh and Wv, but we have also Wd==> pseudo Lipschitz - if(koeLi[level * 3 + dir - 1][i * W_L + j] > maxkoeLi[level * 3 + dir - 1]) { + if (koeLi[level * 3 + dir - 1][i * W_L + j] > maxkoeLi[level * 3 + dir - 1]) { maxkoeLi[level * 3 + dir - 1] = koeLi[level * 3 + dir - 1][i * W_L + j]; } @@ -2327,10 +2393,10 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, const struct cont_params& c } -void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, - int W_L, int H_L, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL) +void ImProcFunctions::finalContAllL(float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, + int W_L, int H_L, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL) { - if(cp.diagcurv && cp.finena && MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f ) { //curve + if (cp.diagcurv && cp.finena && MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { //curve float insigma = 0.666f; //SD float logmax = log(MaxP[level]); //log Max float rapX = (mean[level] + sigma[level]) / MaxP[level]; //rapport between sD / max @@ -2348,12 +2414,12 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, for (int i = 0; i < W_L * H_L; i++) { float absciss; - if(fabsf(WavCoeffs_L[dir][i]) >= (mean[level] + sigma[level])) { //for max + if (fabsf(WavCoeffs_L[dir][i]) >= (mean[level] + sigma[level])) { //for max float valcour = xlogf(fabsf(WavCoeffs_L[dir][i])); float valc = valcour - logmax; float vald = valc * rap; absciss = xexpf(vald); - } else if(fabsf(WavCoeffs_L[dir][i]) >= mean[level]) { + } else if (fabsf(WavCoeffs_L[dir][i]) >= mean[level]) { absciss = asig * fabsf(WavCoeffs_L[dir][i]) + bsig; } else { absciss = amean * fabsf(WavCoeffs_L[dir][i]); @@ -2374,34 +2440,34 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, int choiceClevel = 0; - if(params->wavelet.CLmethod == "one") { + if (params->wavelet.CLmethod == "one") { choiceClevel = 0; - } else if(params->wavelet.CLmethod == "inf") { + } else if (params->wavelet.CLmethod == "inf") { choiceClevel = 1; - } else if(params->wavelet.CLmethod == "sup") { + } else if (params->wavelet.CLmethod == "sup") { choiceClevel = 2; - } else if(params->wavelet.CLmethod == "all") { + } else if (params->wavelet.CLmethod == "all") { choiceClevel = 3; } int choiceDir = 0; - if(params->wavelet.Dirmethod == "one") { + if (params->wavelet.Dirmethod == "one") { choiceDir = 1; - } else if(params->wavelet.Dirmethod == "two") { + } else if (params->wavelet.Dirmethod == "two") { choiceDir = 2; - } else if(params->wavelet.Dirmethod == "thr") { + } else if (params->wavelet.Dirmethod == "thr") { choiceDir = 3; - } else if(params->wavelet.Dirmethod == "all") { + } else if (params->wavelet.Dirmethod == "all") { choiceDir = 0; } int dir1 = (choiceDir == 2) ? 1 : 2; int dir2 = (choiceDir == 3) ? 1 : 3; - if(choiceClevel < 3) { // not all levels visible, paint residual - if(level == 0) { - if(cp.backm != 2) { // nothing to change when residual is used as background + if (choiceClevel < 3) { // not all levels visible, paint residual + if (level == 0) { + if (cp.backm != 2) { // nothing to change when residual is used as background float backGroundColor = (cp.backm == 1) ? 12000.f : 0.f; for (int i = 0; i < W_L * H_L; i++) { @@ -2411,10 +2477,10 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } } - if(choiceClevel == 0) { // Only one level + if (choiceClevel == 0) { // Only one level - if(choiceDir == 0) { // All directions - if(level != choicelevel) { // zero all for the levels != choicelevel + if (choiceDir == 0) { // All directions + if (level != choicelevel) { // zero all for the levels != choicelevel for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir][i] = 0.f; @@ -2423,21 +2489,21 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } } else { // zero the unwanted directions for level == choicelevel - if(choicelevel >= cp.maxilev) { + if (choicelevel >= cp.maxilev) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir][i] = 0.f; } } - } else if(level != choicelevel) { // zero all for the levels != choicelevel + } else if (level != choicelevel) { // zero all for the levels != choicelevel for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir1][i] = WavCoeffs_L[dir2][i] = 0.f; } } } - } else if(choiceClevel == 1) { // Only below level - if(choiceDir == 0) { // All directions - if(level > choicelevel) { + } else if (choiceClevel == 1) { // Only below level + if (choiceDir == 0) { // All directions + if (level > choicelevel) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir][i] = 0.f; @@ -2445,15 +2511,15 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } } } else { // zero the unwanted directions for level >= choicelevel - if(level > choicelevel) { + if (level > choicelevel) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir1][i] = WavCoeffs_L[dir2][i] = 0.f; } } } - } else if(choiceClevel == 2) { // Only above level - if(choiceDir == 0) { // All directions - if(level <= choicelevel) { + } else if (choiceClevel == 2) { // Only above level + if (choiceDir == 0) { // All directions + if (level <= choicelevel) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir][i] = 0.f; @@ -2461,7 +2527,7 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } } } else { // zero the unwanted directions for level >= choicelevel - if(choicelevel >= cp.maxilev) { + if (choicelevel >= cp.maxilev) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir][i] = 0.f; @@ -2470,7 +2536,7 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } - else if(level <= choicelevel) { + else if (level <= choicelevel) { for (int i = 0; i < W_L * H_L; i++) { WavCoeffs_L[dir1][i] = WavCoeffs_L[dir2][i] = 0.f; } @@ -2481,16 +2547,16 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } -void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * labco, float ** varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, - int W_L, int H_L, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) +void ImProcFunctions::ContAllL(float *koeLi[12], float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * labco, float ** varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, + int W_L, int H_L, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) { - assert (level >= 0); - assert (maxlvl > level); + assert(level >= 0); + assert(maxlvl > level); static const float scales[10] = {1.f, 2.f, 4.f, 8.f, 16.f, 32.f, 64.f, 128.f, 256.f, 512.f}; float scaleskip[10]; - for(int sc = 0; sc < 10; sc++) { + for (int sc = 0; sc < 10; sc++) { scaleskip[sc] = scales[sc] / skip; } @@ -2502,11 +2568,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float aedstr = (eddstrength - 1.f) / 90.f; float bedstr = 1.f - 10.f * aedstr; - if(cp.val > 0 && cp.edgeena) { + if (cp.val > 0 && cp.edgeena) { float * koe = nullptr; float maxkoe = 0.f; - if(!lipschitz) { + if (!lipschitz) { koe = new float [H_L * W_L]; for (int i = 0; i < W_L * H_L; i++) { @@ -2515,7 +2581,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit maxkoe = 0.f; - if(cp.detectedge) { + if (cp.detectedge) { float** tmC; int borderL = 1; tmC = new float*[H_L]; @@ -2541,25 +2607,25 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit - for(int i = borderL; i < H_L - borderL; i++ ) { - for(int j = borderL; j < W_L - borderL; j++) { + for (int i = borderL; i < H_L - borderL; i++) { + for (int j = borderL; j < W_L - borderL; j++) { // my own algo : probably a little false, but simpler as Lipschitz ! float thr = 40.f; //avoid artifact eg. noise...to test float thr2 = edd; //edd can be modified in option ed_detect thr2 += cp.eddet / 30.f; //to test float temp = WavCoeffs_L[dir][i * W_L + j]; - if(temp >= 0.f && temp < thr) { + if (temp >= 0.f && temp < thr) { temp = thr; } - if(temp < 0.f && temp > -thr) { + if (temp < 0.f && temp > -thr) { temp = -thr; } koe[i * W_L + j] = min(thr2, fabs(tmC[i][j] / temp)); - if(koe[i * W_L + j] > maxkoe) { + if (koe[i * W_L + j] > maxkoe) { maxkoe = koe[i * W_L + j]; } @@ -2567,7 +2633,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit diff *= (cp.eddet / 100.f); float interm = maxkoe - diff; - if(interm < cp.eddetthr / 30.f) { + if (interm < cp.eddetthr / 30.f) { interm = 0.01f; } @@ -2600,18 +2666,18 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float repart = (float)cp.til; float brepart; - if(cp.reinforce == 1) { + if (cp.reinforce == 1) { brepart = 3.f; } - if(cp.reinforce == 3) { + if (cp.reinforce == 3) { brepart = 0.5f; //arbitrary value to increase / decrease repart, between 1 and 0 } float arepart = -(brepart - 1.f) / (lim0 / 60.f); if (cp.reinforce != 2) { - if(rad < lim0 / 60.f) { + if (rad < lim0 / 60.f) { repart *= (arepart * rad + brepart); //linear repartition of repart } } @@ -2625,35 +2691,35 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float expkoef = -pow(fabs(rad - lev), koef); //reduce effect for high levels if (cp.reinforce == 3) { - if(rad < lim0 / 60.f && level == 0) { + if (rad < lim0 / 60.f && level == 0) { expkoef *= abs(repart); //reduce effect for low values of rad and level=0==> quasi only level 1 is effective } } if (cp.reinforce == 1) { - if(rad < lim0 / 60.f && level == 1) { + if (rad < lim0 / 60.f && level == 1) { expkoef /= repart; //increase effect for low values of rad and level=1==> quasi only level 0 is effective } } //take into account local contrast - float refin = value * exp (expkoef); + float refin = value * exp(expkoef); - if(cp.link && cp.noiseena) { //combi + if (cp.link && cp.noiseena) { //combi { - if(level == 0) { + if (level == 0) { refin *= (1.f + cp.lev0s / 50.f); // we can change this sensibility! } - if(level == 1) { + if (level == 1) { refin *= (1.f + cp.lev1s / 50.f); } - if(level == 2) { + if (level == 2) { refin *= (1.f + cp.lev2s / 50.f); } - if(level == 3) { + if (level == 3) { refin *= (1.f + cp.lev3s / 50.f); } } @@ -2661,7 +2727,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance" - if(cp.EDmet == 2 && MaxP[level] > 0.f) { //curve + if (cp.EDmet == 2 && MaxP[level] > 0.f) { //curve // if(exa) {//curve float insigma = 0.666f; //SD float logmax = log(MaxP[level]); //log Max @@ -2677,21 +2743,21 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float kmul; int borderL = 1; - for(int i = borderL; i < H_L - borderL; i++ ) { - for(int j = borderL; j < W_L - borderL; j++) { + for (int i = borderL; i < H_L - borderL; i++) { + for (int j = borderL; j < W_L - borderL; j++) { int k = i * W_L + j; - if(cp.detectedge) { - if(!lipschitz) { - if(cp.eddet > 10.f) { + if (cp.detectedge) { + if (!lipschitz) { + if (cp.eddet > 10.f) { edge = (aedstr * cp.eddet + bedstr) * (edgePrecalc * (1.f + koe[k])) / (1.f + 0.9f * maxkoe); } else { edge = (edgePrecalc * (1.f + koe[k])) / (1.f + 0.9f * maxkoe); } } - if(lipschitz) { - if(level < 4) { + if (lipschitz) { + if (level < 4) { edge = 1.f + (edgePrecalc - 1.f) * (koeLi[level * 3][k]) / (1.f + 0.9f * maxkoeLi[level * 3 + dir - 1]); } else { edge = edgePrecalc; @@ -2701,16 +2767,16 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit edge = edgePrecalc; } - if(cp.edgcurv) { - if(fabs(WavCoeffs_L[dir][k]) >= (mean[level] + sigma[level])) { //for max + if (cp.edgcurv) { + if (fabs(WavCoeffs_L[dir][k]) >= (mean[level] + sigma[level])) { //for max float valcour = log(fabs(WavCoeffs_L[dir][k])); float valc = valcour - logmax; float vald = valc * rap; absciss = exp(vald); - } else if(fabs(WavCoeffs_L[dir][k]) >= mean[level] && fabs(WavCoeffs_L[dir][k]) < (mean[level] + sigma[level])) { + } else if (fabs(WavCoeffs_L[dir][k]) >= mean[level] && fabs(WavCoeffs_L[dir][k]) < (mean[level] + sigma[level])) { absciss = asig * fabs(WavCoeffs_L[dir][k]) + bsig; - } else if(fabs(WavCoeffs_L[dir][k]) < mean[level]) { + } else if (fabs(WavCoeffs_L[dir][k]) < mean[level]) { absciss = amean * fabs(WavCoeffs_L[dir][k]); } @@ -2732,7 +2798,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float am = (abssd - bbssd) / 0.666f; float kmuld = 0.f; - if(absciss > 0.666f && absciss < 1.f) { + if (absciss > 0.666f && absciss < 1.f) { kmul = a_abssd * absciss + b_abssd; //about max ==> kinterm kmuld = da_abssd * absciss + db_abssd; } else { @@ -2743,20 +2809,20 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float kc = kmul * (wavCLVCcurve[absciss * 500.f] - 0.5f); float kcd = kmuld * (wavCLVCcurve[absciss * 500.f] - 0.5f); - if(kc >= 0.f) { + if (kc >= 0.f) { float reduceeffect = 0.6f; kinterm = 1.f + reduceeffect * kmul * (wavCLVCcurve[absciss * 500.f] - 0.5f); //about 1 to 3 general and big amplification for max (under 0) } else { kinterm = 1.f - (SQR(kcd)) / 10.f; } - if(kinterm < 0.f) { + if (kinterm < 0.f) { kinterm = 0.01f; } edge *= kinterm; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } } @@ -2764,7 +2830,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit WavCoeffs_L[dir][k] *= edge; } } - } else if(cp.EDmet == 1) { //threshold adjuster + } else if (cp.EDmet == 1) { //threshold adjuster float MaxPCompare = MaxP[level] * SQR(cp.edg_max / 100.f); //100 instead of b_r...case if b_r < 100 float MaxNCompare = MaxN[level] * SQR(cp.edg_max / 100.f); //always reduce a little edge for near max values float edgeSdCompare = (mean[level] + 1.5f * sigma[level]) * SQR(cp.edg_sd / t_r); // 1.5 standard deviation #80% range between mean 50% and 80% @@ -2773,7 +2839,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float edgeMeanFactor = cbrt(cp.edg_mean / t_l); float interm; - if(cp.edg_low < 10.f) { + if (cp.edg_low < 10.f) { interm = cbrt((5.f + cp.edg_low) / 5.f); } else { interm = 1.437f; //cbrt(3); @@ -2787,21 +2853,21 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit //for (int i=0; i 10.f) { + if (cp.detectedge) { + if (!lipschitz) { + if (cp.eddet > 10.f) { edge = (aedstr * cp.eddet + bedstr) * (edgePrecalc * (1.f + koe[k])) / (1.f + 0.9f * maxkoe); } else { edge = (edgePrecalc * (1.f + koe[k])) / (1.f + 0.9f * maxkoe); } } - if(lipschitz) { - if(level < 4) { + if (lipschitz) { + if (level < 4) { edge = 1.f + (edgePrecalc - 1.f) * (koeLi[level * 3][k]) / (1.f + 0.9f * maxkoeLi[level * 3 + dir - 1]); } else { edge = edgePrecalc; @@ -2821,17 +2887,17 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit // If we move sliders to the left, local contrast is reduced // if we move sliders to the right local contrast is increased // MaxP, MaxN, mean, sigma are calculated if necessary (val > 0) by evaluate2(), eval2(), aver() , sigma() - if(b_r < 100.f && cp.edg_max / b_r > 1.f) { //in case of b_r < 100 and slider move to right + if (b_r < 100.f && cp.edg_max / b_r > 1.f) { //in case of b_r < 100 and slider move to right if (WavCoeffs_L[dir][k] > MaxPCompare * cp.edg_max / b_r) { edge *= edgMaxFsup; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } } else if (WavCoeffs_L[dir][k] < MaxNCompare * cp.edg_max / b_r) { edge *= edgMaxFsup; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } } @@ -2840,14 +2906,14 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit if (WavCoeffs_L[dir][k] > MaxPCompare) { edge *= edgeMaxFactor; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } }//reduce edge if > new max else if (WavCoeffs_L[dir][k] < MaxNCompare) { edge *= edgeMaxFactor; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } } @@ -2856,7 +2922,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit //if (fabs(WavCoeffs_L[dir][i]) > edgeSdCompare) { edge *= edgeSdFactor; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } }//modify effect if sd change @@ -2864,7 +2930,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit if (fabs(WavCoeffs_L[dir][k]) < edgeMeanCompare) { edge *= edgeMeanFactor; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } } // modify effect if mean change @@ -2872,7 +2938,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit if (fabs(WavCoeffs_L[dir][k]) < edgeLowCompare) { edge *= edgeLowFactor; - if(edge < 1.f) { + if (edge < 1.f) { edge = 1.f; } } @@ -2882,29 +2948,29 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } } - if(!lipschitz) { + if (!lipschitz) { delete [] koe; } } - if(!cp.link && cp.noiseena) { //used both with denoise 1 2 3 + if (!cp.link && cp.noiseena) { //used both with denoise 1 2 3 float refine = 0.f; for (int i = 0; i < W_L * H_L; i++) { - if(level == 0) { + if (level == 0) { refine = cp.lev0s / 40.f; } - if(level == 1) { + if (level == 1) { refine = cp.lev1s / 40.f; } - if(level == 2) { + if (level == 2) { refine = cp.lev2s / 40.f; } - if(level == 3) { + if (level == 3) { refine = cp.lev3s / 40.f; } @@ -2915,7 +2981,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float cpMul = cp.mul[level]; - if(cpMul != 0.f && cp.contena) { // cpMul == 0.f means all will be multiplied by 1.f, so we can skip this + if (cpMul != 0.f && cp.contena) { // cpMul == 0.f means all will be multiplied by 1.f, so we can skip this const float skinprot = params->wavelet.skinprotect; const float skinprotneg = -skinprot; @@ -2926,15 +2992,29 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit //for each pixel and each level float beta; float mea[9]; - mea[0] = mean[level] / 6.f; - mea[1] = mean[level] / 2.f; + float rap = mean[level] - 2.f * cp.sigm * sigma[level]; + + if (rap > 0.f) { + mea[0] = rap; + } else { + mea[0] = mean[level] / 6.f; + } + + rap = mean[level] - cp.sigm * sigma[level]; + + if (rap > 0.f) { + mea[1] = rap; + } else { + mea[1] = mean[level] / 2.f; + } + mea[2] = mean[level]; // 50% data - mea[3] = mean[level] + sigma[level] / 2.f; - mea[4] = mean[level] + sigma[level]; //66% - mea[5] = mean[level] + 1.2f * sigma[level]; - mea[6] = mean[level] + 1.5f * sigma[level]; // - mea[7] = mean[level] + 2.f * sigma[level]; //95% - mea[8] = mean[level] + 2.5f * sigma[level]; //99% + mea[3] = mean[level] + cp.sigm * sigma[level] / 2.f; + mea[4] = mean[level] + cp.sigm * sigma[level]; //66% + mea[5] = mean[level] + cp.sigm * 1.2f * sigma[level]; + mea[6] = mean[level] + cp.sigm * 1.5f * sigma[level]; // + mea[7] = mean[level] + cp.sigm * 2.f * sigma[level]; //95% + mea[8] = mean[level] + cp.sigm * 2.5f * sigma[level]; //99% bool useChromAndHue = (skinprot != 0.f || cp.HSmet); float modchro; @@ -2942,30 +3022,30 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit for (int i = 0; i < W_L * H_L; i++) { float kLlev = 1.f; - if(cpMul < 0.f) { + if (cpMul < 0.f) { beta = 1.f; // disabled for negatives values "less contrast" } else { float WavCL = fabsf(WavCoeffs_L[dir][i]); //reduction amplification: max action between mean / 2 and mean + sigma // arbitrary coefficient, we can add a slider !! - if(WavCL < mea[0]) { + if (WavCL < mea[0]) { beta = 0.6f; //preserve very low contrast (sky...) - } else if(WavCL < mea[1]) { + } else if (WavCL < mea[1]) { beta = 0.8f; - } else if(WavCL < mea[2]) { + } else if (WavCL < mea[2]) { beta = 1.f; //standard - } else if(WavCL < mea[3]) { + } else if (WavCL < mea[3]) { beta = 1.f; - } else if(WavCL < mea[4]) { + } else if (WavCL < mea[4]) { beta = 0.8f; //+sigma - } else if(WavCL < mea[5]) { + } else if (WavCL < mea[5]) { beta = 0.6f; - } else if(WavCL < mea[6]) { + } else if (WavCL < mea[6]) { beta = 0.4f; - } else if(WavCL < mea[7]) { + } else if (WavCL < mea[7]) { beta = 0.2f; // + 2 sigma - } else if(WavCL < mea[8]) { + } else if (WavCL < mea[8]) { beta = 0.1f; } else { beta = 0.0f; @@ -2984,8 +3064,8 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit LL100res = WavCoeffs_L0[i] / 327.68f; float delta = fabs(LL100init - LL100res) / (maxlvl / 2); - for(int ml = 0; ml < maxlvl; ml++) { - if(ml < maxlvl / 2) { + for (int ml = 0; ml < maxlvl; ml++) { + if (ml < maxlvl / 2) { kH[ml] = (LL100res + ml * delta) / LL100res; // fixed a priori max to level middle } else { kH[ml] = (LL100init - ml * delta) / LL100res; @@ -2993,16 +3073,16 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } - if(useChromAndHue) { + if (useChromAndHue) { float modhue = varhue[ii][jj]; modchro = varchrom[ii * 2][jj * 2]; // hue chroma skin with initial lab data scale = 1.f; - if(skinprot > 0.f) { - Color::SkinSatCbdl2 (LL100, modhue, modchro, skinprot, scale, true, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); //0 for skin and extand - } else if(skinprot < 0.f) { - Color::SkinSatCbdl2 (LL100, modhue, modchro, skinprotneg, scale, false, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); + if (skinprot > 0.f) { + Color::SkinSatCbdl2(LL100, modhue, modchro, skinprot, scale, true, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); //0 for skin and extand + } else if (skinprot < 0.f) { + Color::SkinSatCbdl2(LL100, modhue, modchro, skinprotneg, scale, false, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); if (scale == 1.f) { scale = factorHard; @@ -3013,13 +3093,13 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } - if(Chutili) { + if (Chutili) { int i_i = i / W_L; int j_j = i - i_i * W_L; float modhue2 = varhue[i_i][j_j]; float valparam = static_cast(ChCurve->getVal(Color::huelab_to_huehsv2(modhue2))) - 0.5f; //get valparam=f(H) - if(valparam > 0.f) { + if (valparam > 0.f) { scale2 = 1.f + 3.f * valparam; //arbitrary value } else { scale2 = 1.f + 1.9f * valparam; //near 0 but not zero if curve # 0 @@ -3030,7 +3110,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float diagacc = 1.f; float alpha = (1024.f + 15.f * (float) cpMul * scale * scale2 * beta * diagacc) / 1024.f ; - if(cp.HSmet && cp.contena) { + if (cp.HSmet && cp.contena) { float aaal = (1.f - alpha) / ((cp.b_lhl - cp.t_lhl) * kH[level]); float bbal = 1.f - aaal * cp.b_lhl * kH[level]; float aaar = (alpha - 1.f) / (cp.t_rhl - cp.b_rhl) * kH[level]; @@ -3041,24 +3121,24 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float aaarS = (alpha - 1.f) / (cp.t_rsl - cp.b_rsl); float bbbrS = 1.f - cp.b_rsl * aaarS; - if(level <= cp.numlevH) { //in function of levels - if((LL100 > cp.t_lhl * kH[level] && LL100 < cp.t_rhl * kH[level])) { + if (level <= cp.numlevH) { //in function of levels + if ((LL100 > cp.t_lhl * kH[level] && LL100 < cp.t_rhl * kH[level])) { kLlev = alpha; - } else if((LL100 > cp.b_lhl * kH[level] && LL100 <= cp.t_lhl * kH[level])) { + } else if ((LL100 > cp.b_lhl * kH[level] && LL100 <= cp.t_lhl * kH[level])) { kLlev = aaal * LL100 + bbal; - } else if((LL100 > cp.t_rhl * kH[level] && LL100 <= cp.b_rhl * kH[level])) { + } else if ((LL100 > cp.t_rhl * kH[level] && LL100 <= cp.b_rhl * kH[level])) { kLlev = aaar * LL100 + bbbr; } else { kLlev = 1.f; } } - if(level >= (9 - cp.numlevS)) { - if((LL100 > cp.t_lsl && LL100 < cp.t_rsl)) { + if (level >= (9 - cp.numlevS)) { + if ((LL100 > cp.t_lsl && LL100 < cp.t_rsl)) { kLlev = alpha; - } else if((LL100 > cp.b_lsl && LL100 <= cp.t_lsl)) { + } else if ((LL100 > cp.b_lsl && LL100 <= cp.t_lsl)) { kLlev = aaalS * LL100 + bbalS; - } else if((LL100 > cp.t_rsl && LL100 <= cp.b_rsl)) { + } else if ((LL100 > cp.t_rsl && LL100 <= cp.b_rsl)) { kLlev = aaarS * LL100 + bbbrS; } else { kLlev = 1.f; @@ -3073,27 +3153,27 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } } - if(waOpacityCurveW) { + if (waOpacityCurveW) { cp.opaW = true; } - if(cp.bam && cp.finena) { - if(cp.opaW && cp.BAmet == 2) { + if (cp.bam && cp.finena) { + if (cp.opaW && cp.BAmet == 2) { int iteration = cp.ite; int itplus = 7 + iteration; int itmoins = 7 - iteration; int med = maxlvl / 2; int it; - if(level < med) { + if (level < med) { it = itmoins; - } else if(level == med) { + } else if (level == med) { it = 7; - } else /*if(level > med)*/ { + } else { /*if(level > med)*/ it = itplus; } - for(int j = 0; j < it; j++) { + for (int j = 0; j < it; j++) { //float bal = cp.balan;//-100 +100 float kba = 1.f; @@ -3106,11 +3186,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float k1 = 0.3f * (waOpacityCurveW[6.f * LL100] - 0.5f); //k1 between 0 and 0.5 0.5==> 1/6=0.16 float k2 = k1 * 2.f; - if(dir < 3) { + if (dir < 3) { kba = 1.f + k1; } - if(dir == 3) { + if (dir == 3) { kba = 1.f - k2; } @@ -3119,22 +3199,22 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } } - if(cp.BAmet == 1) { + if (cp.BAmet == 1) { int iteration = cp.ite; int itplus = 7 + iteration; int itmoins = 7 - iteration; int med = maxlvl / 2; int it; - if(level < med) { + if (level < med) { it = itmoins; - } else if(level == med) { + } else if (level == med) { it = 7; - } else /*if(level > med)*/ { + } else { /*if(level > med)*/ it = itplus; } - for(int j = 0; j < it; j++) { + for (int j = 0; j < it; j++) { float bal = cp.balan;//-100 +100 float kba = 1.f; @@ -3151,12 +3231,12 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float b0 = 100000.f; float a0 = -4970.f; - if(LL100 > 80.f) { + if (LL100 > 80.f) { k1 = aa * LL100 + bb; k2 = 0.5f * k1; } - if(LL100 < 20.f) { + if (LL100 < 20.f) { k1 = a0 * LL100 + b0; k2 = 0.5f * k1; } @@ -3165,11 +3245,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit //k2=300.f; //k1=0.3f*(waOpacityCurveW[6.f*LL100]-0.5f);//k1 between 0 and 0.5 0.5==> 1/6=0.16 //k2=k1*2.f; - if(dir < 3) { + if (dir < 3) { kba = 1.f + bal / k1; } - if(dir == 3) { + if (dir == 3) { kba = 1.f - bal / k2; } @@ -3185,12 +3265,12 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit choicelevel = choicelevel == -1 ? 4 : choicelevel; } -void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, float **varchrom, float ** WavCoeffs_ab, float * WavCoeffs_ab0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, - int W_ab, int H_ab, const bool useChannelA) +void ImProcFunctions::ContAllAB(LabImage * labco, int maxlvl, float ** varhue, float **varchrom, float ** WavCoeffs_ab, float * WavCoeffs_ab0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, + int W_ab, int H_ab, const bool useChannelA) { float cpMul = cp.mul[level]; - if(cpMul != 0.f && cp.CHmet == 2 && cp.chro != 0.f && cp.chromena) { // cpMul == 0.f or cp.chro = 0.f means all will be multiplied by 1.f, so we can skip this + if (cpMul != 0.f && cp.CHmet == 2 && cp.chro != 0.f && cp.chromena) { // cpMul == 0.f or cp.chro = 0.f means all will be multiplied by 1.f, so we can skip this const float skinprot = params->wavelet.skinprotect; const float skinprotneg = -skinprot; const float factorHard = (1.f - skinprotneg / 100.f); @@ -3201,7 +3281,7 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, float alphaC = (1024.f + 15.f * cpMul * cpChrom / 50.f) / 1024.f ; for (int i = 0; i < W_ab * H_ab; i++) { - if(useSkinControl) { + if (useSkinControl) { int ii = i / W_ab; int jj = i - ii * W_ab; float LL100 = labco->L[ii * 2][jj * 2] / 327.68f; @@ -3210,10 +3290,10 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, // hue chroma skin with initial lab data float scale = 1.f; - if(skinprot > 0.f) { - Color::SkinSatCbdl2 (LL100, modhue, modchro, skinprot, scale, true, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); //0 for skin and extand - } else if(skinprot < 0.f) { - Color::SkinSatCbdl2 (LL100, modhue, modchro, skinprotneg, scale, false, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); + if (skinprot > 0.f) { + Color::SkinSatCbdl2(LL100, modhue, modchro, skinprot, scale, true, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); //0 for skin and extand + } else if (skinprot < 0.f) { + Color::SkinSatCbdl2(LL100, modhue, modchro, skinprotneg, scale, false, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 0); scale = (scale == 1.f) ? factorHard : 1.f; } @@ -3229,7 +3309,7 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, float cpMulC = cp.mulC[level]; // if( (cp.curv || cp.CHSLmet==1) && cp.CHmet!=2 && level < 9 && cpMulC != 0.f) { // cpMulC == 0.f means all will be multiplied by 1.f, so we can skip - if( cp.CHmet != 2 && level < 9 && cpMulC != 0.f && cp.chromena) { // cpMulC == 0.f means all will be multiplied by 1.f, so we can skip + if (cp.CHmet != 2 && level < 9 && cpMulC != 0.f && cp.chromena) { // cpMulC == 0.f means all will be multiplied by 1.f, so we can skip const float skinprot = params->wavelet.skinprotect; const float skinprotneg = -skinprot; const float factorHard = (1.f - skinprotneg / 100.f); @@ -3242,37 +3322,37 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, float scale = 1.f; float modchro = varchrom[ii * 2][jj * 2]; - if(useSkinControl) { + if (useSkinControl) { // hue chroma skin with initial lab data float LL100 = labco->L[ii * 2][jj * 2] / 327.68f; float modhue = varhue[ii][jj]; - if(skinprot > 0.f) { - Color::SkinSatCbdl2 (LL100, modhue, modchro, skinprot, scale, true, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 1); //1 for curve - } else if(skinprot < 0.f) { - Color::SkinSatCbdl2 (LL100, modhue, modchro, skinprotneg, scale, false, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 1); + if (skinprot > 0.f) { + Color::SkinSatCbdl2(LL100, modhue, modchro, skinprot, scale, true, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 1); //1 for curve + } else if (skinprot < 0.f) { + Color::SkinSatCbdl2(LL100, modhue, modchro, skinprotneg, scale, false, cp.b_l, cp.t_l, cp.t_r, cp.b_r, 1); scale = (scale == 1.f) ? factorHard : 1.f; } } float beta = (1024.f + 20.f * cpMulC * scale) / 1024.f ; - if(beta < 0.02f) { + if (beta < 0.02f) { beta = 0.02f; } float kClev = beta; - if(cp.CHmet == 1) { - if(level < cp.chrom) { + if (cp.CHmet == 1) { + if (level < cp.chrom) { //linear for saturated - if((modchro > cp.t_lsat && modchro < cp.t_rsat)) { + if ((modchro > cp.t_lsat && modchro < cp.t_rsat)) { kClev = beta; - } else if((modchro > cp.b_lsat && modchro <= cp.t_lsat)) { + } else if ((modchro > cp.b_lsat && modchro <= cp.t_lsat)) { float aaal = (1.f - beta) / (cp.b_lsat - cp.t_lsat); float bbal = 1.f - aaal * cp.b_lsat; kClev = aaal * modchro + bbal; - } else if((modchro > cp.t_rsat && modchro <= cp.b_rsat)) { + } else if ((modchro > cp.t_rsat && modchro <= cp.b_rsat)) { float aaar = (beta - 1.f) / (cp.t_rsat - cp.b_rsat); float bbbr = 1.f - cp.b_rsat * aaar; kClev = aaar * modchro + bbbr; @@ -3281,13 +3361,13 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, } } else { //linear for pastel - if((modchro > cp.t_lpast && modchro < cp.t_rpast)) { + if ((modchro > cp.t_lpast && modchro < cp.t_rpast)) { kClev = beta; - } else if((modchro > cp.b_lpast && modchro <= cp.t_lpast)) { + } else if ((modchro > cp.b_lpast && modchro <= cp.t_lpast)) { float aaalS = (1.f - beta) / (cp.b_lpast - cp.t_lpast); float bbalS = 1.f - aaalS * cp.b_lpast; kClev = aaalS * modchro + bbalS; - } else if((modchro > cp.t_rpast && modchro <= cp.b_rpast)) { + } else if ((modchro > cp.t_rpast && modchro <= cp.b_rpast)) { float aaarS = (beta - 1.f) / (cp.t_rpast - cp.b_rpast); float bbbrS = 1.f - cp.b_rpast * aaarS; kClev = aaarS * modchro + bbbrS; @@ -3295,7 +3375,7 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, kClev = 1.f; } } - } else if(cp.CHmet == 0) { + } else if (cp.CHmet == 0) { kClev = beta; } @@ -3306,19 +3386,21 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, bool useOpacity; float mulOpacity = 0.f; - if(useChannelA) { + if (useChannelA) { useOpacity = cp.opaRG; - if(level < 9) { + + if (level < 9) { mulOpacity = cp.mulopaRG[level]; } } else { useOpacity = cp.opaBY; - if(level < 9) { + + if (level < 9) { mulOpacity = cp.mulopaBY[level]; } } - if((useOpacity && level < 9 && mulOpacity != 0.f) && cp.toningena) { //toning + if ((useOpacity && level < 9 && mulOpacity != 0.f) && cp.toningena) { //toning float beta = (1024.f + 20.f * mulOpacity) / 1024.f ; @@ -3330,28 +3412,28 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, // WavCoeffs_ab[dir][i] += beta; } - if(waOpacityCurveW) { + if (waOpacityCurveW) { cp.opaW = true; } - if(cp.bam && cp.diag) { + if (cp.bam && cp.diag) { //printf("OK Chroma\n"); - if(cp.opaW && cp.BAmet == 2) { + if (cp.opaW && cp.BAmet == 2) { int iteration = cp.ite; int itplus = 7 + iteration; int itmoins = 7 - iteration; int med = maxlvl / 2; int it; - if(level < med) { + if (level < med) { it = itmoins; - } else if(level == med) { + } else if (level == med) { it = 7; - } else /*if(level > med)*/ { + } else { /*if(level > med)*/ it = itplus; } - for(int j = 0; j < it; j++) { + for (int j = 0; j < it; j++) { //float bal = cp.balan;//-100 +100 float kba = 1.f; @@ -3364,11 +3446,11 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, float k1 = 0.3f * (waOpacityCurveW[6.f * LL100] - 0.5f); //k1 between 0 and 0.5 0.5==> 1/6=0.16 float k2 = k1 * 2.f; - if(dir < 3) { + if (dir < 3) { kba = 1.f + k1; } - if(dir == 3) { + if (dir == 3) { kba = 1.f - k2; } @@ -3377,22 +3459,22 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, } } - if(cp.BAmet == 1) { + if (cp.BAmet == 1) { int iteration = cp.ite; int itplus = 7 + iteration; int itmoins = 7 - iteration; int med = maxlvl / 2; int it; - if(level < med) { + if (level < med) { it = itmoins; - } else if(level == med) { + } else if (level == med) { it = 7; - } else /*if(level > med)*/ { + } else { /*if(level > med)*/ it = itplus; } - for(int j = 0; j < it; j++) { + for (int j = 0; j < it; j++) { float bal = cp.balan;//-100 +100 float kba = 1.f; @@ -3409,12 +3491,12 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, float b0 = 100000.f; float a0 = -4970.f; - if(LL100 > 80.f) { + if (LL100 > 80.f) { k1 = aa * LL100 + bb; k2 = 0.5f * k1; } - if(LL100 < 20.f) { + if (LL100 < 20.f) { k1 = a0 * LL100 + b0; k2 = 0.5f * k1; } @@ -3423,11 +3505,11 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, //k2=300.f; //k1=0.3f*(waOpacityCurveW[6.f*LL100]-0.5f);//k1 between 0 and 0.5 0.5==> 1/6=0.16 //k2=k1*2.f; - if(dir < 3) { + if (dir < 3) { kba = 1.f + bal / k1; } - if(dir == 3) { + if (dir == 3) { kba = 1.f - bal / k2; } @@ -3443,34 +3525,34 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, choicelevel = choicelevel == -1 ? 4 : choicelevel; int choiceClevel = 0; - if(params->wavelet.CLmethod == "one") { + if (params->wavelet.CLmethod == "one") { choiceClevel = 0; - } else if(params->wavelet.CLmethod == "inf") { + } else if (params->wavelet.CLmethod == "inf") { choiceClevel = 1; - } else if(params->wavelet.CLmethod == "sup") { + } else if (params->wavelet.CLmethod == "sup") { choiceClevel = 2; - } else if(params->wavelet.CLmethod == "all") { + } else if (params->wavelet.CLmethod == "all") { choiceClevel = 3; } int choiceDir = 0; - if(params->wavelet.Dirmethod == "one") { + if (params->wavelet.Dirmethod == "one") { choiceDir = 1; - } else if(params->wavelet.Dirmethod == "two") { + } else if (params->wavelet.Dirmethod == "two") { choiceDir = 2; - } else if(params->wavelet.Dirmethod == "thr") { + } else if (params->wavelet.Dirmethod == "thr") { choiceDir = 3; - } else if(params->wavelet.Dirmethod == "all") { + } else if (params->wavelet.Dirmethod == "all") { choiceDir = 0; } int dir1 = (choiceDir == 2) ? 1 : 2; int dir2 = (choiceDir == 3) ? 1 : 3; - if(choiceClevel < 3) { // not all levels visible, paint residual - if(level == 0) { - if(cp.backm != 2) { // nothing to change when residual is used as background + if (choiceClevel < 3) { // not all levels visible, paint residual + if (level == 0) { + if (cp.backm != 2) { // nothing to change when residual is used as background for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab0[i] = 0.f; } @@ -3478,9 +3560,9 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, } } - if(choiceClevel == 0) { // Only one level - if(choiceDir == 0) { // All directions - if(level != choicelevel) { // zero all for the levels != choicelevel + if (choiceClevel == 0) { // Only one level + if (choiceDir == 0) { // All directions + if (level != choicelevel) { // zero all for the levels != choicelevel for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir][i] = 0.f; @@ -3488,21 +3570,21 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, } } } else { // zero the unwanted directions for level == choicelevel - if(choicelevel >= cp.maxilev) { + if (choicelevel >= cp.maxilev) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir][i] = 0.f; } } - } else if(level != choicelevel) { // zero all for the levels != choicelevel + } else if (level != choicelevel) { // zero all for the levels != choicelevel for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir1][i] = WavCoeffs_ab[dir2][i] = 0.f; } } } - } else if(choiceClevel == 1) { // Only below level - if(choiceDir == 0) { // All directions - if(level > choicelevel) { + } else if (choiceClevel == 1) { // Only below level + if (choiceDir == 0) { // All directions + if (level > choicelevel) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir][i] = 0.f; @@ -3510,15 +3592,15 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, } } } else { // zero the unwanted directions for level >= choicelevel - if(level > choicelevel) { + if (level > choicelevel) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir1][i] = WavCoeffs_ab[dir2][i] = 0.f; } } } - } else if(choiceClevel == 2) { // Only above level - if(choiceDir == 0) { // All directions - if(level <= choicelevel) { + } else if (choiceClevel == 2) { // Only above level + if (choiceDir == 0) { // All directions + if (level <= choicelevel) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir][i] = 0.f; @@ -3526,13 +3608,13 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, } } } else { // zero the unwanted directions for level >= choicelevel - if(choicelevel >= cp.maxilev) { + if (choicelevel >= cp.maxilev) { for (int dir = 1; dir < 4; dir++) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir][i] = 0.f; } } - } else if(level <= choicelevel) { + } else if (level <= choicelevel) { for (int i = 0; i < W_ab * H_ab; i++) { WavCoeffs_ab[dir1][i] = WavCoeffs_ab[dir2][i] = 0.f; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3f3455bb2..7d83b50d2 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2236,8 +2236,13 @@ WaveletParams::WaveletParams() : bluemed(0), greenhigh(0), bluehigh(0), + mergeL(40.), + mergeC(20.), + softrad(0.), + softradend(0.), lipst(false), avoid(false), + showmask(false), tmr(false), strength(100), balance(0), @@ -2251,6 +2256,7 @@ WaveletParams::WaveletParams() : expfinal(false), exptoning(false), expnoise(false), + expclari(false), Lmethod(4), CLmethod("all"), Backmethod("grey"), @@ -2258,6 +2264,7 @@ WaveletParams::WaveletParams() : daubcoeffmethod("4_"), CHmethod("without"), Medgreinf("less"), + ushamethod("clari"), CHSLmethod("SL"), EDmethod("CU"), NPmethod("none"), @@ -2265,10 +2272,13 @@ WaveletParams::WaveletParams() : TMmethod("cont"), Dirmethod("all"), HSmethod("with"), + sigma(1.0), rescon(0), resconH(0), reschro(0), tmrs(0), + edgs(1.4), + scale(1.), gamma(1), sup(0), sky(0.0), @@ -2286,8 +2296,9 @@ WaveletParams::WaveletParams() : edgrad(15), edgval(0), edgthresh(10), - thr(35), - thrH(65), + thr(30), + thrH(70), + radius(40), skinprotect(0.0), hueskin(-5, 25, 170, 120, false), hueskin2(-260, -250, -130, -140, false), @@ -2325,8 +2336,13 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && bluemed == other.bluemed && greenhigh == other.greenhigh && bluehigh == other.bluehigh + && mergeL == other.mergeL + && mergeC == other.mergeC + && softrad == other.softrad + && softradend == other.softradend && lipst == other.lipst && avoid == other.avoid + && showmask == other.showmask && tmr == other.tmr && strength == other.strength && balance == other.balance @@ -2345,6 +2361,7 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && expedge == other.expedge && expresid == other.expresid && expfinal == other.expfinal + && expclari == other.expclari && exptoning == other.exptoning && expnoise == other.expnoise && Lmethod == other.Lmethod @@ -2354,6 +2371,7 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && daubcoeffmethod == other.daubcoeffmethod && CHmethod == other.CHmethod && Medgreinf == other.Medgreinf + && ushamethod == other.ushamethod && CHSLmethod == other.CHSLmethod && EDmethod == other.EDmethod && NPmethod == other.NPmethod @@ -2361,10 +2379,13 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && TMmethod == other.TMmethod && Dirmethod == other.Dirmethod && HSmethod == other.HSmethod + && sigma == other.sigma && rescon == other.rescon && resconH == other.resconH && reschro == other.reschro && tmrs == other.tmrs + && edgs == other.edgs + && scale == other.scale && gamma == other.gamma && sup == other.sup && sky == other.sky @@ -2384,6 +2405,7 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && edgthresh == other.edgthresh && thr == other.thr && thrH == other.thrH + && radius == other.radius && skinprotect == other.skinprotect && hueskin == other.hueskin && hueskin2 == other.hueskin2 @@ -3462,6 +3484,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->wavelet.bluehigh, "Wavelet", "CBbluehigh", wavelet.bluehigh, keyFile); saveToKeyfile(!pedited || pedited->wavelet.bluemed, "Wavelet", "CBbluemed", wavelet.bluemed, keyFile); saveToKeyfile(!pedited || pedited->wavelet.bluelow, "Wavelet", "CBbluelow", wavelet.bluelow, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.mergeL, "Wavelet", "MergeL", wavelet.mergeL, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.mergeC, "Wavelet", "MergeC", wavelet.mergeC, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.softrad, "Wavelet", "Softrad", wavelet.softrad, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.softradend, "Wavelet", "Softradend", wavelet.softradend, keyFile); saveToKeyfile(!pedited || pedited->wavelet.expcontrast, "Wavelet", "Expcontrast", wavelet.expcontrast, keyFile); saveToKeyfile(!pedited || pedited->wavelet.expchroma, "Wavelet", "Expchroma", wavelet.expchroma, keyFile); saveToKeyfile(!pedited || pedited->wavelet.expedge, "Wavelet", "Expedge", wavelet.expedge, keyFile); @@ -3469,6 +3495,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->wavelet.expfinal, "Wavelet", "Expfinal", wavelet.expfinal, keyFile); saveToKeyfile(!pedited || pedited->wavelet.exptoning, "Wavelet", "Exptoning", wavelet.exptoning, keyFile); saveToKeyfile(!pedited || pedited->wavelet.expnoise, "Wavelet", "Expnoise", wavelet.expnoise, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.expclari, "Wavelet", "Expclari", wavelet.expclari, keyFile); for (int i = 0; i < 9; i++) { std::stringstream ss; @@ -3503,6 +3530,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->wavelet.chroma, "Wavelet", "ThresholdChroma", wavelet.chroma, keyFile); saveToKeyfile(!pedited || pedited->wavelet.CHmethod, "Wavelet", "CHromaMethod", wavelet.CHmethod, keyFile); saveToKeyfile(!pedited || pedited->wavelet.Medgreinf, "Wavelet", "Medgreinf", wavelet.Medgreinf, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.ushamethod, "Wavelet", "Ushamethod", wavelet.ushamethod, keyFile); saveToKeyfile(!pedited || pedited->wavelet.CHSLmethod, "Wavelet", "CHSLromaMethod", wavelet.CHSLmethod, keyFile); saveToKeyfile(!pedited || pedited->wavelet.EDmethod, "Wavelet", "EDMethod", wavelet.EDmethod, keyFile); saveToKeyfile(!pedited || pedited->wavelet.NPmethod, "Wavelet", "NPMethod", wavelet.NPmethod, keyFile); @@ -3530,13 +3558,18 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->wavelet.edgval, "Wavelet", "Edgval", wavelet.edgval, keyFile); saveToKeyfile(!pedited || pedited->wavelet.edgthresh, "Wavelet", "ThrEdg", wavelet.edgthresh, keyFile); saveToKeyfile(!pedited || pedited->wavelet.avoid, "Wavelet", "AvoidColorShift", wavelet.avoid, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.showmask, "Wavelet", "Showmask", wavelet.showmask, keyFile); saveToKeyfile(!pedited || pedited->wavelet.tmr, "Wavelet", "TMr", wavelet.tmr, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.sigma, "Wavelet", "Sigma", wavelet.sigma, keyFile); saveToKeyfile(!pedited || pedited->wavelet.rescon, "Wavelet", "ResidualcontShadow", wavelet.rescon, keyFile); saveToKeyfile(!pedited || pedited->wavelet.resconH, "Wavelet", "ResidualcontHighlight", wavelet.resconH, keyFile); saveToKeyfile(!pedited || pedited->wavelet.thr, "Wavelet", "ThresholdResidShadow", wavelet.thr, keyFile); saveToKeyfile(!pedited || pedited->wavelet.thrH, "Wavelet", "ThresholdResidHighLight", wavelet.thrH, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.radius, "Wavelet", "Residualradius", wavelet.radius, keyFile); saveToKeyfile(!pedited || pedited->wavelet.reschro, "Wavelet", "Residualchroma", wavelet.reschro, keyFile); saveToKeyfile(!pedited || pedited->wavelet.tmrs, "Wavelet", "ResidualTM", wavelet.tmrs, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.edgs, "Wavelet", "ResidualEDGS", wavelet.edgs, keyFile); + saveToKeyfile(!pedited || pedited->wavelet.scale, "Wavelet", "ResidualSCALE", wavelet.scale, keyFile); saveToKeyfile(!pedited || pedited->wavelet.gamma, "Wavelet", "Residualgamma", wavelet.gamma, keyFile); saveToKeyfile(!pedited || pedited->wavelet.sky, "Wavelet", "HueRangeResidual", wavelet.sky, keyFile); saveToKeyfile(!pedited || pedited->wavelet.hueskin2, "Wavelet", "HueRange", wavelet.hueskin2.toVector(), keyFile); @@ -4606,8 +4639,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "CBbluehigh", pedited, wavelet.bluehigh, pedited->wavelet.bluehigh); assignFromKeyfile(keyFile, "Wavelet", "CBbluemed", pedited, wavelet.bluemed, pedited->wavelet.bluemed); assignFromKeyfile(keyFile, "Wavelet", "CBbluelow", pedited, wavelet.bluelow, pedited->wavelet.bluelow); + assignFromKeyfile(keyFile, "Wavelet", "MergeL", pedited, wavelet.mergeL, pedited->wavelet.mergeL); + assignFromKeyfile(keyFile, "Wavelet", "MergeC", pedited, wavelet.mergeC, pedited->wavelet.mergeC); + assignFromKeyfile(keyFile, "Wavelet", "Softrad", pedited, wavelet.softrad, pedited->wavelet.softrad); + assignFromKeyfile(keyFile, "Wavelet", "Softradend", pedited, wavelet.softradend, pedited->wavelet.softradend); assignFromKeyfile(keyFile, "Wavelet", "Lipst", pedited, wavelet.lipst, pedited->wavelet.lipst); assignFromKeyfile(keyFile, "Wavelet", "AvoidColorShift", pedited, wavelet.avoid, pedited->wavelet.avoid); + assignFromKeyfile(keyFile, "Wavelet", "Showmask", pedited, wavelet.showmask, pedited->wavelet.showmask); assignFromKeyfile(keyFile, "Wavelet", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr); if (ppVersion < 331) { // wavelet.Lmethod was a string before version 331 @@ -4628,6 +4666,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "DaubMethod", pedited, wavelet.daubcoeffmethod, pedited->wavelet.daubcoeffmethod); assignFromKeyfile(keyFile, "Wavelet", "CHromaMethod", pedited, wavelet.CHmethod, pedited->wavelet.CHmethod); assignFromKeyfile(keyFile, "Wavelet", "Medgreinf", pedited, wavelet.Medgreinf, pedited->wavelet.Medgreinf); + assignFromKeyfile(keyFile, "Wavelet", "Ushamethod", pedited, wavelet.ushamethod, pedited->wavelet.ushamethod); assignFromKeyfile(keyFile, "Wavelet", "CHSLromaMethod", pedited, wavelet.CHSLmethod, pedited->wavelet.CHSLmethod); assignFromKeyfile(keyFile, "Wavelet", "EDMethod", pedited, wavelet.EDmethod, pedited->wavelet.EDmethod); assignFromKeyfile(keyFile, "Wavelet", "NPMethod", pedited, wavelet.NPmethod, pedited->wavelet.NPmethod); @@ -4635,10 +4674,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "TMMethod", pedited, wavelet.TMmethod, pedited->wavelet.TMmethod); assignFromKeyfile(keyFile, "Wavelet", "HSMethod", pedited, wavelet.HSmethod, pedited->wavelet.HSmethod); assignFromKeyfile(keyFile, "Wavelet", "DirMethod", pedited, wavelet.Dirmethod, pedited->wavelet.Dirmethod); + assignFromKeyfile(keyFile, "Wavelet", "Sigma", pedited, wavelet.sigma, pedited->wavelet.sigma); assignFromKeyfile(keyFile, "Wavelet", "ResidualcontShadow", pedited, wavelet.rescon, pedited->wavelet.rescon); assignFromKeyfile(keyFile, "Wavelet", "ResidualcontHighlight", pedited, wavelet.resconH, pedited->wavelet.resconH); assignFromKeyfile(keyFile, "Wavelet", "Residualchroma", pedited, wavelet.reschro, pedited->wavelet.reschro); assignFromKeyfile(keyFile, "Wavelet", "ResidualTM", pedited, wavelet.tmrs, pedited->wavelet.tmrs); + assignFromKeyfile(keyFile, "Wavelet", "ResidualEDGS", pedited, wavelet.edgs, pedited->wavelet.edgs); + assignFromKeyfile(keyFile, "Wavelet", "ResidualSCALE", pedited, wavelet.scale, pedited->wavelet.scale); assignFromKeyfile(keyFile, "Wavelet", "Residualgamma", pedited, wavelet.gamma, pedited->wavelet.gamma); assignFromKeyfile(keyFile, "Wavelet", "ContExtra", pedited, wavelet.sup, pedited->wavelet.sup); assignFromKeyfile(keyFile, "Wavelet", "HueRangeResidual", pedited, wavelet.sky, pedited->wavelet.sky); @@ -4658,6 +4700,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "ThrEdg", pedited, wavelet.edgthresh, pedited->wavelet.edgthresh); assignFromKeyfile(keyFile, "Wavelet", "ThresholdResidShadow", pedited, wavelet.thr, pedited->wavelet.thr); assignFromKeyfile(keyFile, "Wavelet", "ThresholdResidHighLight", pedited, wavelet.thrH, pedited->wavelet.thrH); + assignFromKeyfile(keyFile, "Wavelet", "Residualradius", pedited, wavelet.radius, pedited->wavelet.radius); assignFromKeyfile(keyFile, "Wavelet", "ContrastCurve", pedited, wavelet.ccwcurve, pedited->wavelet.ccwcurve); assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveRG", pedited, wavelet.opacityCurveRG, pedited->wavelet.opacityCurveRG); assignFromKeyfile(keyFile, "Wavelet", "OpacityCurveBY", pedited, wavelet.opacityCurveBY, pedited->wavelet.opacityCurveBY); @@ -4834,6 +4877,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Wavelet", "Expfinal", pedited, wavelet.expfinal, pedited->wavelet.expfinal); assignFromKeyfile(keyFile, "Wavelet", "Exptoning", pedited, wavelet.exptoning, pedited->wavelet.exptoning); assignFromKeyfile(keyFile, "Wavelet", "Expnoise", pedited, wavelet.expnoise, pedited->wavelet.expnoise); + assignFromKeyfile(keyFile, "Wavelet", "Expclari", pedited, wavelet.expclari, pedited->wavelet.expclari); } if (keyFile.has_group("Directional Pyramid Equalizer")) { diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 0b6b2dc46..e6828f570 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1200,9 +1200,14 @@ struct WaveletParams { int bluemed; int greenhigh; int bluehigh; + double mergeL; + double mergeC; + double softrad; + double softradend; bool lipst; bool avoid; + bool showmask; bool tmr; int strength; int balance; @@ -1216,6 +1221,7 @@ struct WaveletParams { bool expfinal; bool exptoning; bool expnoise; + bool expclari; int Lmethod; Glib::ustring CLmethod; @@ -1224,6 +1230,7 @@ struct WaveletParams { Glib::ustring daubcoeffmethod; Glib::ustring CHmethod; Glib::ustring Medgreinf; + Glib::ustring ushamethod; Glib::ustring CHSLmethod; Glib::ustring EDmethod; Glib::ustring NPmethod; @@ -1231,10 +1238,13 @@ struct WaveletParams { Glib::ustring TMmethod; Glib::ustring Dirmethod; Glib::ustring HSmethod; + double sigma; int rescon; int resconH; int reschro; double tmrs; + double edgs; + double scale; double gamma; int sup; double sky; @@ -1254,6 +1264,7 @@ struct WaveletParams { int edgthresh; int thr; int thrH; + int radius; double skinprotect; Threshold hueskin; Threshold hueskin2; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c50e23d4b..28188b0f6 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -35,6 +35,9 @@ #include "rawimagesource.h" #include "../rtgui/multilangmgr.h" #include "mytime.h" +#include "guidedfilter.h" +#include "color.h" + #undef THREAD_PRIORITY_NORMAL namespace rtengine @@ -44,7 +47,7 @@ namespace { template -void adjust_radius (const T &default_param, double scale_factor, T ¶m) +void adjust_radius(const T &default_param, double scale_factor, T ¶m) { const double delta = (param - default_param) * scale_factor; param = default_param + delta; @@ -60,10 +63,10 @@ public: ProgressListener* pl, bool flush ) : - job (static_cast (pjob)), - errorCode (errorCode), - pl (pl), - flush (flush), + job(static_cast(pjob)), + errorCode(errorCode), + pl(pl), + flush(flush), // internal state ii(nullptr), imgsrc(nullptr), @@ -143,14 +146,14 @@ private: errorCode = 0; if (pl) { - pl->setProgressStr ("PROGRESSBAR_PROCESSING"); - pl->setProgress (0.0); + pl->setProgressStr("PROGRESSBAR_PROCESSING"); + pl->setProgress(0.0); } ii = job->initialImage; if (!ii) { - ii = InitialImage::load (job->fname, job->isRaw, &errorCode); + ii = InitialImage::load(job->fname, job->isRaw, &errorCode); if (errorCode) { delete job; @@ -161,11 +164,12 @@ private: procparams::ProcParams& params = job->pparams; // acquire image from imagesource - imgsrc = ii->getImageSource (); + imgsrc = ii->getImageSource(); - tr = getCoarseBitMask (params.coarse); - if(imgsrc->getSensorType() == ST_BAYER) { - if(params.raw.bayersensor.method!= RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { + tr = getCoarseBitMask(params.coarse); + + if (imgsrc->getSensorType() == ST_BAYER) { + if (params.raw.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { imgsrc->setBorder(params.raw.bayersensor.border); } else { imgsrc->setBorder(std::max(params.raw.bayersensor.border, 2)); @@ -173,7 +177,8 @@ private: } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { imgsrc->setBorder(params.raw.xtranssensor.border); } - imgsrc->getFullSize (fw, fh, tr); + + imgsrc->getFullSize(fw, fh, tr); // check the crop params if (params.crop.x > fw || params.crop.y > fh) { @@ -207,11 +212,11 @@ private: // MyTime t1,t2; // t1.set(); - ipf_p.reset (new ImProcFunctions (¶ms, true)); + ipf_p.reset(new ImProcFunctions(¶ms, true)); ImProcFunctions &ipf = * (ipf_p.get()); - imgsrc->setCurrentFrame (params.raw.bayersensor.imageNum); - imgsrc->preprocess ( params.raw, params.lensProf, params.coarse, params.dirpyrDenoise.enabled); + imgsrc->setCurrentFrame(params.raw.bayersensor.imageNum); + imgsrc->preprocess(params.raw, params.lensProf, params.coarse, params.dirpyrDenoise.enabled); // After preprocess, run film negative processing if enabled if ((imgsrc->getSensorType() == ST_BAYER || (imgsrc->getSensorType() == ST_FUJI_XTRANS)) && params.filmNegative.enabled) { @@ -219,8 +224,9 @@ private: } if (pl) { - pl->setProgress (0.20); + pl->setProgress(0.20); } + bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params.raw.bayersensor.dualDemosaicAutoContrast : params.raw.xtranssensor.dualDemosaicAutoContrast; double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params.raw.bayersensor.dualDemosaicContrast : params.raw.xtranssensor.dualDemosaicContrast; @@ -231,52 +237,53 @@ private: if (pl) { - pl->setProgress (0.30); + pl->setProgress(0.30); } - pp = PreviewProps (0, 0, fw, fh, 1); + + pp = PreviewProps(0, 0, fw, fh, 1); if (params.retinex.enabled) { //enabled Retinex - LUTf cdcurve (65536, 0); - LUTf mapcurve (65536, 0); + LUTf cdcurve(65536, 0); + LUTf mapcurve(65536, 0); LUTu dummy; RetinextransmissionCurve dehatransmissionCurve; RetinexgaintransmissionCurve dehagaintransmissionCurve; bool dehacontlutili = false; bool mapcontlutili = false; bool useHsl = false; - multi_array2D conversionBuffer (1, 1); - imgsrc->retinexPrepareBuffers (params.icm, params.retinex, conversionBuffer, dummy); - imgsrc->retinexPrepareCurves (params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy ); + multi_array2D conversionBuffer(1, 1); + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex ( params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); + imgsrc->retinex(params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); } if (pl) { - pl->setProgress (0.40); + pl->setProgress(0.40); } - imgsrc->HLRecovery_Global ( params.toneCurve ); + imgsrc->HLRecovery_Global(params.toneCurve); if (pl) { - pl->setProgress (0.45); + pl->setProgress(0.45); } // set the color temperature - currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); if (!params.wb.enabled) { currWB = ColorTemp(); } else if (params.wb.method == "Camera") { - currWB = imgsrc->getWB (); + currWB = imgsrc->getWB(); } else if (params.wb.method == "Auto") { double rm, gm, bm; - imgsrc->getAutoWBMultipliers (rm, gm, bm); - currWB.update (rm, gm, bm, params.wb.equal, params.wb.tempBias); + imgsrc->getAutoWBMultipliers(rm, gm, bm); + currWB.update(rm, gm, bm, params.wb.equal, params.wb.tempBias); } calclum = nullptr ; - params.dirpyrDenoise.getCurves (noiseLCurve, noiseCCurve); + params.dirpyrDenoise.getCurves(noiseLCurve, noiseCCurve); autoNR = (float) settings->nrauto;// autoNRmax = (float) settings->nrautomax;// @@ -293,7 +300,7 @@ private: // const int tilesize = 768; // const int overlap = 96; int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; - ipf.Tile_calc (tilesize, overlap, 2, fw, fh, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + ipf.Tile_calc(tilesize, overlap, 2, fw, fh, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); int nbtl = numtiles_W * numtiles_H; if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { @@ -346,16 +353,16 @@ private: // Imagefloat *origCropPart;//init auto noise // origCropPart = new Imagefloat (crW, crH);//allocate memory if (params.dirpyrDenoise.enabled) {//evaluate Noise - LUTf gamcurve (65536, 0); + LUTf gamcurve(65536, 0); float gam, gamthresh, gamslope; - ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); #ifdef _OPENMP #pragma omp parallel #endif { Imagefloat *origCropPart;//init auto noise - origCropPart = new Imagefloat (crW, crH);//allocate memory - Imagefloat *provicalc = new Imagefloat ((crW + 1) / 2, (crH + 1) / 2); //for denoise curves + origCropPart = new Imagefloat(crW, crH); //allocate memory + Imagefloat *provicalc = new Imagefloat((crW + 1) / 2, (crH + 1) / 2); //for denoise curves int skipP = 1; #ifdef _OPENMP #pragma omp for schedule(dynamic) collapse(2) nowait @@ -365,20 +372,20 @@ private: for (int hcr = 0; hcr < numtiles_H; hcr++) { int beg_tileW = wcr * tileWskip + tileWskip / 2.f - crW / 2.f; int beg_tileH = hcr * tileHskip + tileHskip / 2.f - crH / 2.f; - PreviewProps ppP (beg_tileW, beg_tileH, crW, crH, skipP); - imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw ); + PreviewProps ppP(beg_tileW, beg_tileH, crW, crH, skipP); + imgsrc->getImage(currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); //baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve); // we only need image reduced to 1/4 here for (int ii = 0; ii < crH; ii += 2) { for (int jj = 0; jj < crW; jj += 2) { - provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); - provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); - provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); + provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); + provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); + provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); } } - imgsrc->convertColorSpace (provicalc, params.icm, currWB); //for denoise luminance curve + imgsrc->convertColorSpace(provicalc, params.icm, currWB); //for denoise luminance curve float maxr = 0.f; float maxb = 0.f; float pondcorrec = 1.0f; @@ -391,11 +398,11 @@ private: maxblueaut = 0.f; chromina = 0.f; sigma = 0.f; - ipf.RGB_denoise_info (origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + ipf.RGB_denoise_info(origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); float multip = 1.f; float adjustr = 1.f; - if (params.icm.workingProfile == "ProPhoto") { + if (params.icm.workingProfile == "ProPhoto") { adjustr = 1.f; // } else if (params.icm.workingProfile == "Adobe RGB") { adjustr = 1.f / 1.3f; @@ -417,11 +424,11 @@ private: multip = 2.f; //take into account gamma for TIF / JPG approximate value...not good for gamma=1 } - float maxmax = max (maxredaut, maxblueaut); + float maxmax = max(maxredaut, maxblueaut); float delta; int mode = 2; int lissage = settings->leveldnliss; - ipf.calcautodn_info (chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); + ipf.calcautodn_info(chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); // printf("PROCESS cha=%f red=%f bl=%f redM=%f bluM=%f chrom=%f sigm=%f lum=%f sigL=%f\n",chaut,redaut,blueaut, maxredaut, maxblueaut, chromina, sigma, lumema, sigma_L); if (maxredaut > maxblueaut) { @@ -520,7 +527,7 @@ private: if (settings->verbose) { t2pone.set(); - printf ("Info denoise ponderated performed in %d usec:\n", t2pone.etime (t1pone)); + printf("Info denoise ponderated performed in %d usec:\n", t2pone.etime(t1pone)); } } @@ -561,9 +568,9 @@ private: } if (params.dirpyrDenoise.enabled) {//evaluate Noise - LUTf gamcurve (65536, 0); + LUTf gamcurve(65536, 0); float gam, gamthresh, gamslope; - ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); int Nb[9]; int coordW[3];//coordinate of part of image to measure noise int coordH[3]; @@ -580,8 +587,8 @@ private: #endif { Imagefloat *origCropPart;//init auto noise - origCropPart = new Imagefloat (crW, crH);//allocate memory - Imagefloat *provicalc = new Imagefloat ((crW + 1) / 2, (crH + 1) / 2); //for denoise curves + origCropPart = new Imagefloat(crW, crH); //allocate memory + Imagefloat *provicalc = new Imagefloat((crW + 1) / 2, (crH + 1) / 2); //for denoise curves #ifdef _OPENMP #pragma omp for schedule(dynamic) collapse(2) nowait @@ -589,24 +596,24 @@ private: for (int wcr = 0; wcr <= 2; wcr++) { for (int hcr = 0; hcr <= 2; hcr++) { - PreviewProps ppP (coordW[wcr], coordH[hcr], crW, crH, 1); - imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); + PreviewProps ppP(coordW[wcr], coordH[hcr], crW, crH, 1); + imgsrc->getImage(currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); //baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve); // we only need image reduced to 1/4 here for (int ii = 0; ii < crH; ii += 2) { for (int jj = 0; jj < crW; jj += 2) { - provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); - provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); - provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); + provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); + provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); + provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); } } - imgsrc->convertColorSpace (provicalc, params.icm, currWB); //for denoise luminance curve + imgsrc->convertColorSpace(provicalc, params.icm, currWB); //for denoise luminance curve int nb = 0; float chaut = 0.f, redaut = 0.f, blueaut = 0.f, maxredaut = 0.f, maxblueaut = 0.f, minredaut = 0.f, minblueaut = 0.f, chromina = 0.f, sigma = 0.f, lumema = 0.f, sigma_L = 0.f, redyel = 0.f, skinc = 0.f, nsknc = 0.f; - ipf.RGB_denoise_info (origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + ipf.RGB_denoise_info(origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); Nb[hcr * 3 + wcr] = nb; ch_M[hcr * 3 + wcr] = chaut; max_r[hcr * 3 + wcr] = maxredaut; @@ -642,7 +649,7 @@ private: float MinRMoy = 0.f; float MinBMoy = 0.f; - if (params.icm.workingProfile == "ProPhoto") { + if (params.icm.workingProfile == "ProPhoto") { adjustr = 1.f; } else if (params.icm.workingProfile == "Adobe RGB") { adjustr = 1.f / 1.3f; @@ -669,8 +676,8 @@ private: int lissage = settings->leveldnliss; for (int k = 0; k < 9; k++) { - float maxmax = max (max_r[k], max_b[k]); - ipf.calcautodn_info (ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k] ); + float maxmax = max(max_r[k], max_b[k]); + ipf.calcautodn_info(ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k]); // printf("ch_M=%f delta=%f\n",ch_M[k], delta[k]); } @@ -743,17 +750,17 @@ private: if (settings->verbose) { t2aue.set(); - printf ("Info denoise auto performed in %d usec:\n", t2aue.etime (t1aue)); + printf("Info denoise auto performed in %d usec:\n", t2aue.etime(t1aue)); } //end evaluate noise } - baseImg = new Imagefloat (fw, fh); - imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.raw); + baseImg = new Imagefloat(fw, fh); + imgsrc->getImage(currWB, tr, baseImg, pp, params.toneCurve, params.raw); if (pl) { - pl->setProgress (0.50); + pl->setProgress(0.50); } // LUTf Noisecurve (65536,0); @@ -769,9 +776,10 @@ private: if (params.toneCurve.autoexp) { LUTu aehist; int aehistcompr; - imgsrc->getAutoExpHistogram (aehist, aehistcompr); - ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); + imgsrc->getAutoExpHistogram(aehist, aehistcompr); + ipf.getAutoExp(aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); } + if (params.toneCurve.histmatching) { if (!params.toneCurve.fromHistMatching) { imgsrc->getAutoMatchedToneCurve(params.icm, params.toneCurve.curve); @@ -787,7 +795,7 @@ private: params.toneCurve.brightness = 0; params.toneCurve.contrast = 0; params.toneCurve.black = 0; - } + } // at this stage, we can flush the raw data to free up quite an important amount of memory // commented out because it makes the application crash when batch processing... @@ -816,29 +824,29 @@ private: noiseLCurve.Reset(); } - if (denoiseParams.enabled && (noiseLCurve || noiseCCurve )) { + if (denoiseParams.enabled && (noiseLCurve || noiseCCurve)) { // we only need image reduced to 1/4 here - calclum = new Imagefloat ((fw + 1) / 2, (fh + 1) / 2); //for luminance denoise curve + calclum = new Imagefloat((fw + 1) / 2, (fh + 1) / 2); //for luminance denoise curve #ifdef _OPENMP #pragma omp parallel for #endif for (int ii = 0; ii < fh; ii += 2) { for (int jj = 0; jj < fw; jj += 2) { - calclum->r (ii >> 1, jj >> 1) = baseImg->r (ii, jj); - calclum->g (ii >> 1, jj >> 1) = baseImg->g (ii, jj); - calclum->b (ii >> 1, jj >> 1) = baseImg->b (ii, jj); + calclum->r(ii >> 1, jj >> 1) = baseImg->r(ii, jj); + calclum->g(ii >> 1, jj >> 1) = baseImg->g(ii, jj); + calclum->b(ii >> 1, jj >> 1) = baseImg->b(ii, jj); } } - imgsrc->convertColorSpace (calclum, params.icm, currWB); + imgsrc->convertColorSpace(calclum, params.icm, currWB); } if (denoiseParams.enabled) { ImProcFunctions &ipf = * (ipf_p.get()); float nresi, highresi; int kall = 2; - ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); + ipf.RGB_denoise(kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); } @@ -861,12 +869,12 @@ private: //ImProcFunctions ipf (¶ms, true); ImProcFunctions &ipf = * (ipf_p.get()); - imgsrc->convertColorSpace (baseImg, params.icm, currWB); + imgsrc->convertColorSpace(baseImg, params.icm, currWB); // perform first analysis - hist16 (65536); + hist16(65536); - ipf.firstAnalysis (baseImg, params, hist16); + ipf.firstAnalysis(baseImg, params, hist16); ipf.dehaze(baseImg); ipf.ToneMapFattal02(baseImg); @@ -874,14 +882,17 @@ private: // perform transform (excepted resizing) if (ipf.needsTransform(fw, fh, imgsrc->getRotateDegree(), imgsrc->getMetaData())) { Imagefloat* trImg = nullptr; + if (ipf.needsLuminanceOnly()) { trImg = baseImg; } else { - trImg = new Imagefloat (fw, fh); + trImg = new Imagefloat(fw, fh); } - ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, + + ipf.transform(baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, imgsrc->getMetaData(), imgsrc->getRotateDegree(), true, true); - if(trImg != baseImg) { + + if (trImg != baseImg) { delete baseImg; baseImg = trImg; } @@ -897,10 +908,10 @@ private: if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = baseImg->getWidth(); const int H = baseImg->getHeight(); - LabImage labcbdl (W, H); - ipf.rgb2lab (*baseImg, labcbdl, params.icm.workingProfile); - ipf.dirpyrequalizer (&labcbdl, 1); - ipf.lab2rgb (labcbdl, *baseImg, params.icm.workingProfile); + LabImage labcbdl(W, H); + ipf.rgb2lab(*baseImg, labcbdl, params.icm.workingProfile); + ipf.dirpyrequalizer(&labcbdl, 1); + ipf.lab2rgb(labcbdl, *baseImg, params.icm.workingProfile); } //gamma TRC working @@ -920,45 +931,45 @@ private: // RGB processing - curve1 (65536); - curve2 (65536); - curve (65536, 0); - satcurve (65536, 0); - lhskcurve (65536, 0); - lumacurve (32770, 0); // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation - clcurve (65536, 0); - wavclCurve (65536, 0); + curve1(65536); + curve2(65536); + curve(65536, 0); + satcurve(65536, 0); + lhskcurve(65536, 0); + lumacurve(32770, 0); // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation + clcurve(65536, 0); + wavclCurve(65536, 0); //if(params.blackwhite.enabled) params.toneCurve.hrenabled=false; - CurveFactory::complexCurve (expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, - params.toneCurve.curve, params.toneCurve.curve2, - hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2 ); + CurveFactory::complexCurve(expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, + params.toneCurve.curve, params.toneCurve.curve2, + hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2); - CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1); - CurveFactory::RGBCurve (params.rgbCurves.gcurve, gCurve, 1); - CurveFactory::RGBCurve (params.rgbCurves.bcurve, bCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.rcurve, rCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.gcurve, gCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.bcurve, bCurve, 1); bool opautili = false; if (params.colorToning.enabled) { - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params.icm.workingProfile); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params.icm.workingProfile); double wp[3][3] = { {wprof[0][0], wprof[0][1], wprof[0][2]}, {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili); - clToningcurve (65536, 0); - CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, 1); - cl2Toningcurve (65536, 0); - CurveFactory::curveToning (params.colorToning.cl2curve, cl2Toningcurve, 1); + params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, opautili); + clToningcurve(65536, 0); + CurveFactory::curveToning(params.colorToning.clcurve, clToningcurve, 1); + cl2Toningcurve(65536, 0); + CurveFactory::curveToning(params.colorToning.cl2curve, cl2Toningcurve, 1); } - labView = new LabImage (fw, fh); + labView = new LabImage(fw, fh); if (params.blackwhite.enabled) { - CurveFactory::curveBW (params.blackwhite.beforeCurve, params.blackwhite.afterCurve, hist16, dummy, customToneCurvebw1, customToneCurvebw2, 1); + CurveFactory::curveBW(params.blackwhite.beforeCurve, params.blackwhite.afterCurve, hist16, dummy, customToneCurvebw1, customToneCurvebw2, 1); } double rrm, ggm, bbm; @@ -969,7 +980,7 @@ private: if (params.colorToning.enabled && params.colorToning.autosat && params.colorToning.method != "LabGrid") { //for colortoning evaluation of saturation settings float moyS = 0.f; float eqty = 0.f; - ipf.moyeqt (baseImg, moyS, eqty);//return image : mean saturation and standard dev of saturation + ipf.moyeqt(baseImg, moyS, eqty); //return image : mean saturation and standard dev of saturation float satp = ((moyS + 1.5f * eqty) - 0.3f) / 0.7f; //1.5 sigma ==> 93% pixels with high saturation -0.3 / 0.7 convert to Hombre scale if (satp >= 0.92f) { @@ -987,18 +998,18 @@ private: autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000) DCPProfileApplyState as; - DCPProfile *dcpProf = imgsrc->getDCP (params.icm, as); + DCPProfile *dcpProf = imgsrc->getDCP(params.icm, as); LUTu histToneCurve; - ipf.rgbProc (baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve, options.chunkSizeRGB, options.measure); + ipf.rgbProc(baseImg, labView, nullptr, curve1, curve2, curve, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve, options.chunkSizeRGB, options.measure); if (settings->verbose) { printf ("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", static_cast(autor), static_cast(autog), static_cast(autob)); } // if clut was used and size of clut cache == 1 we free the memory used by the clutstore (default clut cache size = 1 for 32 bit OS) - if ( params.filmSimulation.enabled && !params.filmSimulation.clutFilename.empty() && options.clutCacheSize == 1) { + if (params.filmSimulation.enabled && !params.filmSimulation.clutFilename.empty() && options.clutCacheSize == 1) { CLUTStore::getInstance().clearCache(); } @@ -1017,7 +1028,7 @@ private: baseImg = nullptr; if (pl) { - pl->setProgress (0.55); + pl->setProgress(0.55); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1032,7 +1043,7 @@ private: #pragma omp parallel #endif { - LUTu hist16thr (hist16.getSize()); // one temporary lookup table per thread + LUTu hist16thr(hist16.getSize()); // one temporary lookup table per thread hist16thr.clear(); #ifdef _OPENMP #pragma omp for schedule(static) nowait @@ -1040,7 +1051,7 @@ private: for (int i = 0; i < fh; i++) for (int j = 0; j < fw; j++) { - hist16thr[ (int) ((labView->L[i][j]))]++; + hist16thr[(int)((labView->L[i][j]))]++; } #ifdef _OPENMP @@ -1053,74 +1064,217 @@ private: } bool utili; - CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, lumacurve, dummy, 1, utili); + CurveFactory::complexLCurve(params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, lumacurve, dummy, 1, utili); bool clcutili; - CurveFactory::curveCL (clcutili, params.labCurve.clcurve, clcurve, 1); + CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, 1); bool ccutili, cclutili; - CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, - params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); + CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, + params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); - ipf.chromiLuminanceCurve (nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); + ipf.chromiLuminanceCurve(nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { ipf.EPDToneMap (labView, 0, 1); } - ipf.vibrance (labView); + ipf.vibrance(labView); ipf.labColorCorrectionRegions(labView); // for all treatments Defringe, Sharpening, Contrast detail ,Microcontrast they are activated if "CIECAM" function are disabled if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { ipf.impulsedenoise (labView); - ipf.defringe (labView); + ipf.defringe(labView); } if (params.sharpenEdge.enabled) { - ipf.MLsharpen (labView); + ipf.MLsharpen(labView); } if (params.sharpenMicro.enabled) { - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - ipf.MLmicrocontrast (labView); //!params.colorappearance.sharpcie + if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + ipf.MLmicrocontrast(labView); //!params.colorappearance.sharpcie } } if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) && params.sharpening.enabled) { - ipf.sharpening (labView, params.sharpening); + ipf.sharpening(labView, params.sharpening); } - WaveletParams WaveParams = params.wavelet; - WavCurve wavCLVCurve; - WavOpacityCurveRG waOpacityCurveRG; - WavOpacityCurveBY waOpacityCurveBY; - WavOpacityCurveW waOpacityCurveW; - WavOpacityCurveWL waOpacityCurveWL; - - params.wavelet.getCurves (wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL ); // directional pyramid wavelet if (params.dirpyrequalizer.cbdlMethod == "aft") { if ((params.colorappearance.enabled && !settings->autocielab) || !params.colorappearance.enabled) { - ipf.dirpyrequalizer (labView, 1); //TODO: this is the luminance tonecurve, not the RGB one + ipf.dirpyrequalizer(labView, 1); //TODO: this is the luminance tonecurve, not the RGB one } } - bool wavcontlutili = false; + if ((params.wavelet.enabled)) { + LabImage *unshar = nullptr; + Glib::ustring provis; - CurveFactory::curveWavContL (wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); + bool wavcontlutili = false; + WaveletParams WaveParams = params.wavelet; + WavCurve wavCLVCurve; + WavOpacityCurveRG waOpacityCurveRG; + WavOpacityCurveBY waOpacityCurveBY; + WavOpacityCurveW waOpacityCurveW; + WavOpacityCurveWL waOpacityCurveWL; + LabImage *provradius = nullptr; + bool procont = WaveParams.expcontrast; + bool prochro = WaveParams.expchroma; + bool proedge = WaveParams.expedge; + bool profin = WaveParams.expfinal; + bool proton = WaveParams.exptoning; + bool pronois = WaveParams.expnoise; + +/* + if(WaveParams.showmask) { + WaveParams.showmask = false; + WaveParams.expclari = true; + } +*/ + if (WaveParams.softrad > 0.f) { + provradius = new LabImage(fw, fh); + provradius->CopyFrom(labView); + } - if (params.wavelet.enabled) { - ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); + params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); + + CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + unshar = new LabImage(fw, fh); + provis = params.wavelet.CLmethod; + params.wavelet.CLmethod = "all"; + ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); + unshar->CopyFrom(labView); + params.wavelet.CLmethod = provis; + } + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + WaveParams.expcontrast = false; + WaveParams.expchroma = false; + WaveParams.expedge = false; + WaveParams.expfinal = false; + WaveParams.exptoning = false; + WaveParams.expnoise = false; + } + + ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + WaveParams.expcontrast = procont; + WaveParams.expchroma = prochro; + WaveParams.expedge = proedge; + WaveParams.expfinal = profin; + WaveParams.exptoning = proton; + WaveParams.expnoise = pronois; + + if (WaveParams.softrad > 0.f) { + array2D ble(fw, fh); + array2D guid(fw, fh); + Imagefloat *tmpImage = nullptr; + tmpImage = new Imagefloat(fw, fh); +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < fh; ir++) + for (int jr = 0; jr < fw; jr++) { + float X, Y, Z; + float L = provradius->L[ir][jr]; + float a = provradius->a[ir][jr]; + float b = provradius->b[ir][jr]; + Color::Lab2XYZ(L, a, b, X, Y, Z); + + guid[ir][jr] = Y / 32768.f; + float La = labView->L[ir][jr]; + float aa = labView->a[ir][jr]; + float ba = labView->b[ir][jr]; + Color::Lab2XYZ(La, aa, ba, X, Y, Z); + tmpImage->r(ir, jr) = X; + tmpImage->g(ir, jr) = Y; + tmpImage->b(ir, jr) = Z; + ble[ir][jr] = Y / 32768.f; + } + double epsilmax = 0.0001; + double epsilmin = 0.00001; + double aepsil = (epsilmax - epsilmin) / 90.f; + double bepsil = epsilmax - 100.f * aepsil; + double epsil = aepsil * WaveParams.softrad + bepsil; + + float blur = 10.f / 1 * (0.0001f + 0.8f * WaveParams.softrad); + // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < fh; ir++) + for (int jr = 0; jr < fw; jr++) { + float X = tmpImage->r(ir, jr); + float Y = 32768.f * ble[ir][jr]; + float Z = tmpImage->b(ir, jr); + float L, a, b; + Color::XYZ2Lab(X, Y, Z, L, a, b); + labView->L[ir][jr] = L; + } + delete tmpImage; + } + + } + + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { + float mL = (float)(WaveParams.mergeL / 100.f); + float mC = (float)(WaveParams.mergeC / 100.f); + float mL0; + float mC0; + + if ((WaveParams.CLmethod == "one" || WaveParams.CLmethod == "inf") && WaveParams.Backmethod == "black") { + mL0 = mC0 = 0.f; + mL = -1.5f * mL; + mC = -mC; + } else if (WaveParams.CLmethod == "sup" && WaveParams.Backmethod == "resid") { + mL0 = mL; + mC0 = mC; + } else { + mL0 = mL = mC0 = mC = 0.f; + } + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int x = 0; x < fh; x++) + for (int y = 0; y < fw; y++) { + labView->L[x][y] = LIM((1.f + mL0) * (unshar->L[x][y]) - mL * labView->L[x][y], 0.f, 32768.f); + labView->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * labView->a[x][y]; + labView->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * labView->b[x][y]; + } + + delete unshar; + unshar = NULL; + + if (WaveParams.softrad > 0.f) { + delete provradius; + provradius = NULL; + } + + } + + wavCLVCurve.Reset(); } - wavCLVCurve.Reset(); - ipf.softLight(labView); //Colorappearance and tone-mapping associated @@ -1132,9 +1286,9 @@ private: f_h = fh; } - CieImage *cieView = new CieImage (f_w, (f_h)); + CieImage *cieView = new CieImage(f_w, (f_h)); - CurveFactory::curveLightBrightColor ( + CurveFactory::curveLightBrightColor( params.colorappearance.curve, params.colorappearance.curve2, params.colorappearance.curve3, @@ -1148,15 +1302,17 @@ private: if (params.colorappearance.enabled) { double adap; int imgNum = 0; + if (imgsrc->getSensorType() == ST_BAYER) { imgNum = params.raw.bayersensor.imageNum; } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { //imgNum = params.raw.xtranssensor.imageNum; } - float fnum = imgsrc->getMetaData()->getFNumber (imgNum); // F number - float fiso = imgsrc->getMetaData()->getISOSpeed (imgNum) ; // ISO - float fspeed = imgsrc->getMetaData()->getShutterSpeed (imgNum) ; //speed - float fcomp = imgsrc->getMetaData()->getExpComp (imgNum); //compensation + - + + float fnum = imgsrc->getMetaData()->getFNumber(imgNum); // F number + float fiso = imgsrc->getMetaData()->getISOSpeed(imgNum) ; // ISO + float fspeed = imgsrc->getMetaData()->getShutterSpeed(imgNum) ; //speed + float fcomp = imgsrc->getMetaData()->getExpComp(imgNum); //compensation + - if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) { adap = 2000.; @@ -1187,11 +1343,11 @@ private: //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (pl) { - pl->setProgress (0.60); + pl->setProgress(0.60); } int imw, imh; - double tmpScale = ipf.resizeScale (¶ms, fw, fh, imw, imh); + double tmpScale = ipf.resizeScale(¶ms, fw, fh, imw, imh); bool labResize = params.resize.enabled && params.resize.method != "Nearest" && (tmpScale != 1.0 || params.prsharpening.enabled); LabImage *tmplab; @@ -1205,7 +1361,7 @@ private: ch = params.crop.h; if (labResize) { // crop lab data - tmplab = new LabImage (cw, ch); + tmplab = new LabImage(cw, ch); for (int row = 0; row < ch; row++) { for (int col = 0; col < cw; col++) { @@ -1224,13 +1380,14 @@ private: if (labResize) { // resize lab data if ((labView->W != imw || labView->H != imh) && - (params.resize.allowUpscaling || (labView->W >= imw && labView->H >= imh))) { + (params.resize.allowUpscaling || (labView->W >= imw && labView->H >= imh))) { // resize image - tmplab = new LabImage (imw, imh); - ipf.Lanczos (labView, tmplab, tmpScale); + tmplab = new LabImage(imw, imh); + ipf.Lanczos(labView, tmplab, tmpScale); delete labView; labView = tmplab; } + cw = labView->W; ch = labView->H; @@ -1240,7 +1397,8 @@ private: labView->L[i][j] = labView->L[i][j] < 0.f ? 0.f : labView->L[i][j]; } } - ipf.sharpening (labView, params.prsharpening); + + ipf.sharpening(labView, params.prsharpening); } } @@ -1255,10 +1413,10 @@ private: // if Default gamma mode: we use the profile selected in the "Output profile" combobox; // gamma come from the selected profile, otherwise it comes from "Free gamma" tool - Imagefloat* readyImg = ipf.lab2rgbOut (labView, cx, cy, cw, ch, params.icm); + Imagefloat* readyImg = ipf.lab2rgbOut(labView, cx, cy, cw, ch, params.icm); if (settings->verbose) { - printf ("Output profile_: \"%s\"\n", params.icm.outputProfile.c_str()); + printf("Output profile_: \"%s\"\n", params.icm.outputProfile.c_str()); } delete labView; @@ -1268,42 +1426,44 @@ private: if (bwonly) { //force BW r=g=b if (settings->verbose) { - printf ("Force BW\n"); + printf("Force BW\n"); } for (int ccw = 0; ccw < cw; ccw++) { for (int cch = 0; cch < ch; cch++) { - readyImg->r (cch, ccw) = readyImg->g (cch, ccw); - readyImg->b (cch, ccw) = readyImg->g (cch, ccw); + readyImg->r(cch, ccw) = readyImg->g(cch, ccw); + readyImg->b(cch, ccw) = readyImg->g(cch, ccw); } } } if (pl) { - pl->setProgress (0.70); + pl->setProgress(0.70); } if (tmpScale != 1.0 && params.resize.method == "Nearest" && - (params.resize.allowUpscaling || (readyImg->getWidth() >= imw && readyImg->getHeight() >= imh))) { // resize rgb data (gamma applied) - Imagefloat* tempImage = new Imagefloat (imw, imh); - ipf.resize (readyImg, tempImage, tmpScale); + (params.resize.allowUpscaling || (readyImg->getWidth() >= imw && readyImg->getHeight() >= imh))) { // resize rgb data (gamma applied) + Imagefloat* tempImage = new Imagefloat(imw, imh); + ipf.resize(readyImg, tempImage, tmpScale); delete readyImg; readyImg = tempImage; } switch (params.metadata.mode) { - case MetaDataParams::TUNNEL: - // Sending back the whole first root, which won't necessarily be the selected frame number - // and may contain subframe depending on initial raw's hierarchy - readyImg->setMetadata (ii->getMetaData()->getRootExifData ()); - break; - case MetaDataParams::EDIT: - // ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy - readyImg->setMetadata (ii->getMetaData()->getBestExifData(imgsrc, ¶ms.raw), params.exif, params.iptc); - break; - default: // case MetaDataParams::STRIP - // nothing to do - break; + case MetaDataParams::TUNNEL: + // Sending back the whole first root, which won't necessarily be the selected frame number + // and may contain subframe depending on initial raw's hierarchy + readyImg->setMetadata(ii->getMetaData()->getRootExifData()); + break; + + case MetaDataParams::EDIT: + // ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy + readyImg->setMetadata(ii->getMetaData()->getBestExifData(imgsrc, ¶ms.raw), params.exif, params.iptc); + break; + + default: // case MetaDataParams::STRIP + // nothing to do + break; } @@ -1311,8 +1471,8 @@ private: if (customGamma) { if (!useLCMS) { // use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16 w/ gamma - ProfileContent pc (jprof); - readyImg->setOutputProfile (pc.getData().c_str(), pc.getData().size()); + ProfileContent pc(jprof); + readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size()); } } else { // use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma @@ -1320,23 +1480,23 @@ private: if (!params.icm.outputProfile.empty() && params.icm.outputProfile != ColorManagementParams::NoICMString) { // if ICCStore::getInstance()->getProfile send back an object, then ICCStore::getInstance()->getContent will do too - cmsHPROFILE jprof = ICCStore::getInstance()->getProfile (params.icm.outputProfile); //get outProfile + cmsHPROFILE jprof = ICCStore::getInstance()->getProfile(params.icm.outputProfile); //get outProfile if (jprof == nullptr) { if (settings->verbose) { - printf ("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", params.icm.outputProfile.c_str()); + printf("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", params.icm.outputProfile.c_str()); } } else { if (settings->verbose) { - printf ("Using \"%s\" output profile\n", params.icm.outputProfile.c_str()); + printf("Using \"%s\" output profile\n", params.icm.outputProfile.c_str()); } - ProfileContent pc = ICCStore::getInstance()->getContent (params.icm.outputProfile); - readyImg->setOutputProfile (pc.getData().c_str(), pc.getData().size()); + ProfileContent pc = ICCStore::getInstance()->getContent(params.icm.outputProfile); + readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size()); } } else { // No ICM - readyImg->setOutputProfile (nullptr, 0); + readyImg->setOutputProfile(nullptr, 0); } } @@ -1345,13 +1505,13 @@ private: // printf("Total:- %d usec\n", t2.etime(t1)); if (!job->initialImage) { - ii->decreaseRef (); + ii->decreaseRef(); } delete job; if (pl) { - pl->setProgress (0.75); + pl->setProgress(0.75); } /* curve1.reset();curve2.reset(); @@ -1375,10 +1535,10 @@ private: ImProcFunctions &ipf = * (ipf_p.get()); int imw, imh; - double scale_factor = ipf.resizeScale (¶ms, fw, fh, imw, imh); + double scale_factor = ipf.resizeScale(¶ms, fw, fh, imw, imh); - std::unique_ptr tmplab (new LabImage (fw, fh)); - ipf.rgb2lab (*baseImg, *tmplab, params.icm.workingProfile); + std::unique_ptr tmplab(new LabImage(fw, fh)); + ipf.rgb2lab(*baseImg, *tmplab, params.icm.workingProfile); if (params.crop.enabled) { int cx = params.crop.x; @@ -1386,7 +1546,7 @@ private: int cw = params.crop.w; int ch = params.crop.h; - std::unique_ptr cropped (new LabImage (cw, ch)); + std::unique_ptr cropped(new LabImage(cw, ch)); for (int row = 0; row < ch; row++) { for (int col = 0; col < cw; col++) { @@ -1396,29 +1556,29 @@ private: } } - tmplab = std::move (cropped); + tmplab = std::move(cropped); } - assert (params.resize.enabled); + assert(params.resize.enabled); // resize image if (params.resize.allowUpscaling || (imw <= fw && imh <= fh)) { - std::unique_ptr resized (new LabImage (imw, imh)); - ipf.Lanczos (tmplab.get(), resized.get(), scale_factor); - tmplab = std::move (resized); + std::unique_ptr resized(new LabImage(imw, imh)); + ipf.Lanczos(tmplab.get(), resized.get(), scale_factor); + tmplab = std::move(resized); } - adjust_procparams (scale_factor); + adjust_procparams(scale_factor); fw = imw; fh = imh; delete baseImg; - baseImg = new Imagefloat (fw, fh); - ipf.lab2rgb (*tmplab, *baseImg, params.icm.workingProfile); + baseImg = new Imagefloat(fw, fh); + ipf.lab2rgb(*tmplab, *baseImg, params.icm.workingProfile); } - void adjust_procparams (double scale_factor) + void adjust_procparams(double scale_factor) { procparams::ProcParams ¶ms = job->pparams; procparams::ProcParams defaultparams; @@ -1449,13 +1609,13 @@ private: lcurve[i] *= min(noise_factor /* * scale_factor*/, 1.0); } - noiseLCurve.Set (lcurve); + noiseLCurve.Set(lcurve); const char *medmethods[] = { "soft", "33", "55soft", "55", "77", "99" }; if (params.dirpyrDenoise.median) { auto &key = params.dirpyrDenoise.methodmed == "RGB" ? params.dirpyrDenoise.rgbmethod : params.dirpyrDenoise.medmethod; - for (int i = 1; i < int (sizeof (medmethods) / sizeof (const char *)); ++i) { + for (int i = 1; i < int (sizeof(medmethods) / sizeof(const char *)); ++i) { if (key == medmethods[i]) { int j = i - int (1.0 / scale_factor); @@ -1473,17 +1633,17 @@ private: params.epd.scale *= scale_factor; //params.epd.edgeStopping *= scale_factor; - const double dirpyreq_scale = min (scale_factor * 1.5, 1.0); + const double dirpyreq_scale = min(scale_factor * 1.5, 1.0); for (int i = 0; i < 6; ++i) { - adjust_radius (defaultparams.dirpyrequalizer.mult[i], dirpyreq_scale, - params.dirpyrequalizer.mult[i]); + adjust_radius(defaultparams.dirpyrequalizer.mult[i], dirpyreq_scale, + params.dirpyrequalizer.mult[i]); } params.dirpyrequalizer.threshold *= scale_factor; - adjust_radius (defaultparams.defringe.radius, scale_factor, - params.defringe.radius); + adjust_radius(defaultparams.defringe.radius, scale_factor, + params.defringe.radius); params.sh.radius *= scale_factor; params.localContrast.radius *= scale_factor; @@ -1578,40 +1738,40 @@ private: } // namespace -IImagefloat* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool flush) +IImagefloat* processImage(ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool flush) { - ImageProcessor proc (pjob, errorCode, pl, flush); + ImageProcessor proc(pjob, errorCode, pl, flush); return proc(); } -void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) +void batchProcessingThread(ProcessingJob* job, BatchProcessingListener* bpl) { ProcessingJob* currentJob = job; while (currentJob) { int errorCode; - IImagefloat* img = processImage (currentJob, errorCode, bpl, true); + IImagefloat* img = processImage(currentJob, errorCode, bpl, true); if (errorCode) { - bpl->error (M ("MAIN_MSG_CANNOTLOAD")); + bpl->error(M("MAIN_MSG_CANNOTLOAD")); currentJob = nullptr; } else { try { - currentJob = bpl->imageReady (img); + currentJob = bpl->imageReady(img); } catch (Glib::Exception& ex) { - bpl->error (ex.what()); + bpl->error(ex.what()); currentJob = nullptr; } } } } -void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) +void startBatchProcessing(ProcessingJob* job, BatchProcessingListener* bpl) { if (bpl) { - Glib::Thread::create (sigc::bind (sigc::ptr_fun (batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW); + Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW); } } diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 05150517f..7a267bb02 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -84,6 +84,7 @@ enum { ADDSET_WA_SKINPROTECT, ADDSET_WA_THRR, ADDSET_WA_THRRH, + ADDSET_WA_RADIUS, ADDSET_WA_THRES, ADDSET_WA_THRESHOLD, ADDSET_WA_THRESHOLD2, @@ -101,6 +102,8 @@ enum { ADDSET_WA_EDGEDETECTTHR, ADDSET_WA_EDGEDETECTTHR2, ADDSET_WA_TMRS, + ADDSET_WA_EDGS, + ADDSET_WA_SCALE, ADDSET_WA_GAMMA, ADDSET_RETI_STR, ADDSET_RETI_NEIGH, diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 2824a285c..e5d926b69 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -171,7 +171,7 @@ void BatchToolPanelCoordinator::initSession () shadowshighlights->setAdjusterBehavior (false, false); dirpyrequalizer->setAdjusterBehavior (false, false, false); - wavelet->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); + wavelet->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); dirpyrdenoise->setAdjusterBehavior (false, false, false, false, false, false, false); bayerprocess->setAdjusterBehavior(false, false, false, false, false, false); xtransprocess->setAdjusterBehavior(false, false); @@ -219,7 +219,7 @@ void BatchToolPanelCoordinator::initSession () blackwhite->setAdjusterBehavior (options.baBehav[ADDSET_BLACKWHITE_HUES], options.baBehav[ADDSET_BLACKWHITE_GAMMA]); shadowshighlights->setAdjusterBehavior (options.baBehav[ADDSET_SH_HIGHLIGHTS], options.baBehav[ADDSET_SH_SHADOWS]); dirpyrequalizer->setAdjusterBehavior (options.baBehav[ADDSET_DIRPYREQ], options.baBehav[ADDSET_DIRPYREQ_THRESHOLD], options.baBehav[ADDSET_DIRPYREQ_SKINPROTECT]); - wavelet->setAdjusterBehavior (options.baBehav[ADDSET_WA], options.baBehav[ADDSET_WA_THRESHOLD], options.baBehav[ADDSET_WA_THRESHOLD2], options.baBehav[ADDSET_WA_THRES], options.baBehav[ADDSET_WA_CHRO], options.baBehav[ADDSET_WA_CHROMA], options.baBehav[ADDSET_WA_CONTRAST], options.baBehav[ADDSET_WA_SKINPROTECT], options.baBehav[ADDSET_WA_RESCHRO], options.baBehav[ADDSET_WA_TMRS], options.baBehav[ADDSET_WA_RESCON], options.baBehav[ADDSET_WA_RESCONH], options.baBehav[ADDSET_WA_THRR], options.baBehav[ADDSET_WA_THRRH], options.baBehav[ADDSET_WA_SKYPROTECT], options.baBehav[ADDSET_WA_EDGRAD], options.baBehav[ADDSET_WA_EDGVAL], options.baBehav[ADDSET_WA_STRENGTH], options.baBehav[ADDSET_WA_GAMMA], options.baBehav[ADDSET_WA_EDGEDETECT], options.baBehav[ADDSET_WA_EDGEDETECTTHR], options.baBehav[ADDSET_WA_EDGEDETECTTHR2]); + wavelet->setAdjusterBehavior (options.baBehav[ADDSET_WA], options.baBehav[ADDSET_WA_THRESHOLD], options.baBehav[ADDSET_WA_THRESHOLD2], options.baBehav[ADDSET_WA_THRES], options.baBehav[ADDSET_WA_CHRO], options.baBehav[ADDSET_WA_CHROMA], options.baBehav[ADDSET_WA_CONTRAST], options.baBehav[ADDSET_WA_SKINPROTECT], options.baBehav[ADDSET_WA_RESCHRO], options.baBehav[ADDSET_WA_TMRS], options.baBehav[ADDSET_WA_EDGS], options.baBehav[ADDSET_WA_SCALE], options.baBehav[ADDSET_WA_RESCON], options.baBehav[ADDSET_WA_RESCONH], options.baBehav[ADDSET_WA_THRR], options.baBehav[ADDSET_WA_THRRH], options.baBehav[ADDSET_WA_RADIUS], options.baBehav[ADDSET_WA_SKYPROTECT], options.baBehav[ADDSET_WA_EDGRAD], options.baBehav[ADDSET_WA_EDGVAL], options.baBehav[ADDSET_WA_STRENGTH], options.baBehav[ADDSET_WA_GAMMA], options.baBehav[ADDSET_WA_EDGEDETECT], options.baBehav[ADDSET_WA_EDGEDETECTTHR], options.baBehav[ADDSET_WA_EDGEDETECTTHR2]); dirpyrdenoise->setAdjusterBehavior (options.baBehav[ADDSET_DIRPYRDN_LUMA], options.baBehav[ADDSET_DIRPYRDN_LUMDET], options.baBehav[ADDSET_DIRPYRDN_CHROMA], options.baBehav[ADDSET_DIRPYRDN_CHROMARED], options.baBehav[ADDSET_DIRPYRDN_CHROMABLUE], options.baBehav[ADDSET_DIRPYRDN_GAMMA], options.baBehav[ADDSET_DIRPYRDN_PASSES]); bayerprocess->setAdjusterBehavior(options.baBehav[ADDSET_BAYER_FALSE_COLOR_SUPPRESSION], options.baBehav[ADDSET_BAYER_ITER], options.baBehav[ADDSET_BAYER_DUALDEMOZCONTRAST], options.baBehav[ADDSET_BAYER_PS_SIGMA], options.baBehav[ADDSET_BAYER_PS_SMOOTH], options.baBehav[ADDSET_BAYER_PS_EPERISO]); xtransprocess->setAdjusterBehavior(options.baBehav[ADDSET_BAYER_FALSE_COLOR_SUPPRESSION], options.baBehav[ADDSET_BAYER_DUALDEMOZCONTRAST]); @@ -335,8 +335,11 @@ void BatchToolPanelCoordinator::initSession () if (options.baBehav[ADDSET_WA_RESCONH]) { pparams.wavelet.resconH = 0; } if (options.baBehav[ADDSET_WA_RESCHRO]) { pparams.wavelet.reschro = 0; } if (options.baBehav[ADDSET_WA_TMRS]) { pparams.wavelet.tmrs = 0; } + if (options.baBehav[ADDSET_WA_EDGS]) { pparams.wavelet.edgs = 0; } + if (options.baBehav[ADDSET_WA_SCALE]) { pparams.wavelet.scale = 0; } if (options.baBehav[ADDSET_WA_THRR]) { pparams.wavelet.thr = 0; } if (options.baBehav[ADDSET_WA_THRRH]) { pparams.wavelet.thrH = 0; } + if (options.baBehav[ADDSET_WA_RADIUS]) { pparams.wavelet.radius = 0; } if (options.baBehav[ADDSET_WA_SKYPROTECT]) { pparams.wavelet.sky = 0; } if (options.baBehav[ADDSET_WA_EDGRAD]) { pparams.wavelet.edgrad = 0; } if (options.baBehav[ADDSET_WA_EDGVAL]) { pparams.wavelet.edgval = 0; } diff --git a/rtgui/epd.cc b/rtgui/epd.cc index b13effba3..d032cf28d 100644 --- a/rtgui/epd.cc +++ b/rtgui/epd.cc @@ -31,8 +31,8 @@ EdgePreservingDecompositionUI::EdgePreservingDecompositionUI () : FoldableToolPa strength = Gtk::manage(new Adjuster (M("TP_EPD_STRENGTH"), -1.0, 2.0, 0.01, 0.5)); gamma = Gtk::manage(new Adjuster (M("TP_EPD_GAMMA"), 0.8, 1.5, 0.01, 1.)); - edgeStopping = Gtk::manage(new Adjuster (M("TP_EPD_EDGESTOPPING"), 0.1, 4.0, 0.01, 0.5)); - scale = Gtk::manage(new Adjuster (M("TP_EPD_SCALE"), 0.1, 10.0, 0.01, 0.1)); + edgeStopping = Gtk::manage(new Adjuster (M("TP_EPD_EDGESTOPPING"), 0.1, 4.0, 0.01, 1.4)); + scale = Gtk::manage(new Adjuster (M("TP_EPD_SCALE"), 0.1, 10.0, 0.01, 1.0)); reweightingIterates = Gtk::manage(new Adjuster (M("TP_EPD_REWEIGHTINGITERATES"), 0, 9, 1, 0)); strength->setAdjusterListener(this); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index d41bd472c..f39c73e03 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -483,8 +483,14 @@ void ParamsEdited::set(bool v) wavelet.bluemed = v; wavelet.bluelow = v; wavelet.lipst = v; + wavelet.mergeL = v; + wavelet.mergeC = v; + wavelet.softrad = v; + wavelet.softradend = v; wavelet.Medgreinf = v; + wavelet.ushamethod = v; wavelet.avoid = v; + wavelet.showmask = v; wavelet.tmr = v; wavelet.Lmethod = v; wavelet.CLmethod = v; @@ -499,10 +505,13 @@ void ParamsEdited::set(bool v) wavelet.TMmethod = v; wavelet.HSmethod = v; wavelet.Dirmethod = v; + wavelet.sigma = v; wavelet.rescon = v; wavelet.resconH = v; wavelet.reschro = v; wavelet.tmrs = v; + wavelet.edgs = v; + wavelet.scale = v; wavelet.gamma = v; wavelet.sup = v; wavelet.sky = v; @@ -522,6 +531,7 @@ void ParamsEdited::set(bool v) wavelet.edgthresh = v; wavelet.thr = v; wavelet.thrH = v; + wavelet.radius = v; wavelet.skinprotect = v; wavelet.hueskin = v; wavelet.hueskin2 = v; @@ -548,6 +558,7 @@ void ParamsEdited::set(bool v) // wavelet.enaedge = v; // wavelet.enares = v; wavelet.expfinal = v; + wavelet.expclari = v; wavelet.expcontrast = v; wavelet.expchroma = v; wavelet.expedge = v; @@ -1065,8 +1076,14 @@ void ParamsEdited::initFrom(const std::vector& wavelet.greenlow = wavelet.greenlow && p.wavelet.greenlow == other.wavelet.greenlow; wavelet.bluelow = wavelet.bluelow && p.wavelet.bluelow == other.wavelet.bluelow; wavelet.lipst = wavelet.lipst && p.wavelet.lipst == other.wavelet.lipst; - wavelet.Medgreinf = wavelet.Medgreinf && p.wavelet.Medgreinf == other.wavelet.Medgreinf; + wavelet.bluehigh = wavelet.bluehigh && p.wavelet.bluehigh == other.wavelet.bluehigh; + wavelet.mergeL = wavelet.mergeL && p.wavelet.mergeL == other.wavelet.mergeL; + wavelet.mergeC = wavelet.mergeC && p.wavelet.mergeC == other.wavelet.mergeC; + wavelet.softrad = wavelet.softrad && p.wavelet.softrad == other.wavelet.softrad; + wavelet.softradend = wavelet.softradend && p.wavelet.softradend == other.wavelet.softradend; + wavelet.ushamethod = wavelet.ushamethod && p.wavelet.ushamethod == other.wavelet.ushamethod; wavelet.avoid = wavelet.avoid && p.wavelet.avoid == other.wavelet.avoid; + wavelet.showmask = wavelet.showmask && p.wavelet.showmask == other.wavelet.showmask; wavelet.tmr = wavelet.tmr && p.wavelet.tmr == other.wavelet.tmr; wavelet.Lmethod = wavelet.Lmethod && p.wavelet.Lmethod == other.wavelet.Lmethod; wavelet.CLmethod = wavelet.CLmethod && p.wavelet.CLmethod == other.wavelet.CLmethod; @@ -1081,10 +1098,13 @@ void ParamsEdited::initFrom(const std::vector& wavelet.TMmethod = wavelet.TMmethod && p.wavelet.TMmethod == other.wavelet.TMmethod; wavelet.HSmethod = wavelet.HSmethod && p.wavelet.HSmethod == other.wavelet.HSmethod; wavelet.Dirmethod = wavelet.Dirmethod && p.wavelet.Dirmethod == other.wavelet.Dirmethod; + wavelet.sigma = wavelet.sigma && p.wavelet.sigma == other.wavelet.sigma; wavelet.rescon = wavelet.rescon && p.wavelet.rescon == other.wavelet.rescon; wavelet.resconH = wavelet.resconH && p.wavelet.resconH == other.wavelet.resconH; wavelet.reschro = wavelet.reschro && p.wavelet.reschro == other.wavelet.reschro; wavelet.tmrs = wavelet.tmrs && p.wavelet.tmrs == other.wavelet.tmrs; + wavelet.edgs = wavelet.edgs && p.wavelet.edgs == other.wavelet.edgs; + wavelet.scale = wavelet.scale && p.wavelet.scale == other.wavelet.scale; wavelet.gamma = wavelet.gamma && p.wavelet.gamma == other.wavelet.gamma; wavelet.sup = wavelet.sup && p.wavelet.sup == other.wavelet.sup; wavelet.sky = wavelet.sky && p.wavelet.sky == other.wavelet.sky; @@ -1104,6 +1124,7 @@ void ParamsEdited::initFrom(const std::vector& wavelet.edgthresh = wavelet.edgthresh && p.wavelet.edgthresh == other.wavelet.edgthresh; wavelet.thr = wavelet.thr && p.wavelet.thr == other.wavelet.thr; wavelet.thrH = wavelet.thrH && p.wavelet.thrH == other.wavelet.thrH; + wavelet.radius = wavelet.radius && p.wavelet.radius == other.wavelet.radius; wavelet.hueskin = wavelet.hueskin && p.wavelet.hueskin == other.wavelet.hueskin; wavelet.hueskin2 = wavelet.hueskin2 && p.wavelet.hueskin2 == other.wavelet.hueskin2; wavelet.hllev = wavelet.hllev && p.wavelet.hllev == other.wavelet.hllev; @@ -1132,6 +1153,7 @@ void ParamsEdited::initFrom(const std::vector& wavelet.expfinal = wavelet.expfinal && p.wavelet.expfinal == other.wavelet.expfinal; wavelet.exptoning = wavelet.exptoning && p.wavelet.exptoning == other.wavelet.exptoning; wavelet.expnoise = wavelet.expnoise && p.wavelet.expnoise == other.wavelet.expnoise; + wavelet.expclari = wavelet.expclari && p.wavelet.expclari == other.wavelet.expclari; for (int level = 0; level < 9; ++level) { wavelet.c[level] = wavelet.c[level] && p.wavelet.c[level] == other.wavelet.c[level]; @@ -2869,6 +2891,22 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.bluelow = mods.wavelet.bluelow; } + if (wavelet.mergeL) { + toEdit.wavelet.mergeL = mods.wavelet.mergeL; + } + + if (wavelet.mergeC) { + toEdit.wavelet.mergeC = mods.wavelet.mergeC; + } + + if (wavelet.softrad) { + toEdit.wavelet.softrad = mods.wavelet.softrad; + } + + if (wavelet.softradend) { + toEdit.wavelet.softradend = mods.wavelet.softradend; + } + if (wavelet.lipst) { toEdit.wavelet.lipst = mods.wavelet.lipst; } @@ -2877,10 +2915,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.Medgreinf = mods.wavelet.Medgreinf; } + if (wavelet.ushamethod) { + toEdit.wavelet.ushamethod = mods.wavelet.ushamethod; + } + if (wavelet.avoid) { toEdit.wavelet.avoid = mods.wavelet.avoid; } + if (wavelet.showmask) { + toEdit.wavelet.showmask = mods.wavelet.showmask; + } + if (wavelet.tmr) { toEdit.wavelet.tmr = mods.wavelet.tmr; } @@ -2953,6 +2999,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.thrH = dontforceSet && options.baBehav[ADDSET_WA_THRRH] ? toEdit.wavelet.thrH + mods.wavelet.thrH : mods.wavelet.thrH; } + if (wavelet.radius) { + toEdit.wavelet.radius = dontforceSet && options.baBehav[ADDSET_WA_RADIUS] ? toEdit.wavelet.radius + mods.wavelet.radius : mods.wavelet.radius; + } + if (wavelet.sup) { toEdit.wavelet.sup = mods.wavelet.sup; } @@ -3046,6 +3096,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.expfinal = mods.wavelet.expfinal; } + if (wavelet.expclari) { + toEdit.wavelet.expclari = mods.wavelet.expclari; + } + if (wavelet.exptoning) { toEdit.wavelet.exptoning = mods.wavelet.exptoning; } @@ -3086,6 +3140,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.edgeampli = mods.wavelet.edgeampli; } + if (wavelet.sigma) { + toEdit.wavelet.sigma = mods.wavelet.sigma; + } + if (wavelet.resconH) { toEdit.wavelet.resconH = dontforceSet && options.baBehav[ADDSET_WA_RESCONH] ? toEdit.wavelet.resconH + mods.wavelet.resconH : mods.wavelet.resconH; } @@ -3098,6 +3156,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.tmrs = dontforceSet && options.baBehav[ADDSET_WA_TMRS] ? toEdit.wavelet.tmrs + mods.wavelet.tmrs : mods.wavelet.tmrs; } + if (wavelet.edgs) { + toEdit.wavelet.edgs = dontforceSet && options.baBehav[ADDSET_WA_EDGS] ? toEdit.wavelet.edgs + mods.wavelet.edgs : mods.wavelet.edgs; + } + + if (wavelet.scale) { + toEdit.wavelet.scale = dontforceSet && options.baBehav[ADDSET_WA_SCALE] ? toEdit.wavelet.scale + mods.wavelet.scale : mods.wavelet.scale; + } + if (wavelet.gamma) { toEdit.wavelet.gamma = dontforceSet && options.baBehav[ADDSET_WA_GAMMA] ? toEdit.wavelet.gamma + mods.wavelet.gamma : mods.wavelet.gamma; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 153dd7bb6..23e90635e 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -502,7 +502,9 @@ struct WaveletParamsEdited { bool cbenab; bool lipst; bool Medgreinf; + bool ushamethod; bool avoid; + bool showmask; bool tmr; bool c[9]; bool ch[9]; @@ -519,10 +521,13 @@ struct WaveletParamsEdited { bool Tilesmethod; bool daubcoeffmethod; bool Dirmethod; + bool sigma; bool rescon; bool resconH; bool reschro; bool tmrs; + bool edgs; + bool scale; bool gamma; bool sup; bool sky; @@ -542,6 +547,7 @@ struct WaveletParamsEdited { bool edgthresh; bool thr; bool thrH; + bool radius; bool skinprotect; bool hueskin; bool hueskin2; @@ -568,6 +574,10 @@ struct WaveletParamsEdited { bool bluemed; bool greenhigh; bool bluehigh; + bool mergeL; + bool mergeC; + bool softrad; + bool softradend; bool expcontrast; bool expchroma; bool expedge; @@ -575,6 +585,7 @@ struct WaveletParamsEdited { bool expfinal; bool exptoning; bool expnoise; + bool expclari; }; struct DirPyrEqualizerParamsEdited { diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 68ef3b9ce..083444342 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -389,8 +389,11 @@ Gtk::Widget* Preferences::getBatchProcPanel () appendBehavList (mi, M ("TP_WAVELET_THR"), ADDSET_WA_THRR, true); appendBehavList (mi, M ("TP_WAVELET_RESCONH"), ADDSET_WA_RESCONH, true); appendBehavList (mi, M ("TP_WAVELET_THRH"), ADDSET_WA_THRRH, true); + appendBehavList (mi, M ("TP_WAVELET_RADIUS"), ADDSET_WA_RADIUS, true); appendBehavList (mi, M ("TP_WAVELET_RESCHRO"), ADDSET_WA_RESCHRO, true); appendBehavList (mi, M ("TP_WAVELET_TMSTRENGTH"), ADDSET_WA_TMRS, true); + appendBehavList (mi, M ("TP_WAVELET_TMEDGS"), ADDSET_WA_EDGS, true); + appendBehavList (mi, M ("TP_WAVELET_TMSCALE"), ADDSET_WA_SCALE, true); appendBehavList (mi, M ("TP_WAVELET_SKY"), ADDSET_WA_SKYPROTECT, true); appendBehavList (mi, M ("TP_WAVELET_CONTRA"), ADDSET_WA_CONTRAST, true); appendBehavList (mi, M ("TP_WAVELET_STRENGTH"), ADDSET_WA_STRENGTH, true); diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index a2642dad7..7d9a65f2a 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . * - * 2014 Jacques Desmis + * 2014 - 2019Jacques Desmis */ #include "wavelet.h" @@ -26,6 +26,7 @@ #include "guiutils.h" #include "rtimage.h" #include "options.h" +#include "eventmapper.h" #include "../rtengine/color.h" using namespace rtengine; @@ -34,27 +35,27 @@ using namespace rtengine::procparams; namespace { - GradientMilestone makeHsvGm(double position, float h, float s, float v) - { - float r; - float g; - float b; - Color::hsv2rgb01(h, s, v, r, g, b); - return GradientMilestone(position, r, g, b); +GradientMilestone makeHsvGm(double position, float h, float s, float v) +{ + float r; + float g; + float b; + Color::hsv2rgb01(h, s, v, r, g, b); + return GradientMilestone(position, r, g, b); +} + +std::vector makeWholeHueRange() +{ + std::vector res; + res.reserve(7); + + for (int i = 0; i < 7; ++i) { + const float x = static_cast(i) / 6.0f; + res.push_back(makeHsvGm(x, x, 0.5f, 0.5f)); } - std::vector makeWholeHueRange() - { - std::vector res; - res.reserve(7); - - for (int i = 0; i < 7; ++i) { - const float x = static_cast(i) / 6.0f; - res.push_back(makeHsvGm(x, x, 0.5f, 0.5f)); - } - - return res; - } + return res; +} } @@ -77,11 +78,15 @@ Wavelet::Wavelet() : lipst(Gtk::manage(new Gtk::CheckButton(M("TP_WAVELET_LIPST")))), avoid(Gtk::manage(new Gtk::CheckButton(M("TP_WAVELET_AVOID")))), tmr(Gtk::manage(new Gtk::CheckButton(M("TP_WAVELET_BALCHRO")))), + showmask(Gtk::manage(new Gtk::CheckButton(M("TP_WAVELET_SHOWMASK")))), neutralchButton(Gtk::manage(new Gtk::Button(M("TP_WAVELET_NEUTRAL")))), - rescon(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCON"), -100, 100, 1, 0))), - resconH(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCONH"), -100, 100, 1, 0))), + sigma(Gtk::manage(new Adjuster(M("TP_WAVELET_SIGMA"), 0.2, 2.5, 0.01, 1.))), + rescon(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCON"), 0, 100, 1, 0))), + resconH(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCONH"), 0, 100, 1, 0))), reschro(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCHRO"), -100, 100, 1, 0))), tmrs(Gtk::manage(new Adjuster(M("TP_WAVELET_TMSTRENGTH"), -1.0, 2.0, 0.01, 0.0))), + edgs(Gtk::manage(new Adjuster(M("TP_WAVELET_TMEDGS"), 0.1, 4.0, 0.01, 1.4))), + scale(Gtk::manage(new Adjuster(M("TP_WAVELET_TMSCALE"), 0.1, 10.0, 0.01, 1.0))), gamma(Gtk::manage(new Adjuster(M("TP_WAVELET_COMPGAMMA"), 0.4, 2.0, 0.01, 1.0))), sup(Gtk::manage(new Adjuster(M("TP_WAVELET_SUPE"), -100, 350, 1, 0))), sky(Gtk::manage(new Adjuster(M("TP_WAVELET_SKY"), -100., 100.0, 1., 0.))), @@ -89,12 +94,13 @@ Wavelet::Wavelet() : chroma(Gtk::manage(new Adjuster(M("TP_WAVELET_CHRO"), 1, 9, 1, 5))), chro(Gtk::manage(new Adjuster(M("TP_WAVELET_CHR"), 0., 100., 1., 0.))), contrast(Gtk::manage(new Adjuster(M("TP_WAVELET_CONTRA"), -100, 100, 1, 0))), - thr(Gtk::manage(new Adjuster(M("TP_WAVELET_THR"), 0, 100, 1, 35))), - thrH(Gtk::manage(new Adjuster(M("TP_WAVELET_THRH"), 0, 100, 1, 65))), - skinprotect(Gtk::manage( new Adjuster(M("TP_WAVELET_SKIN"), -100, 100, 1, 0.) )), - edgrad(Gtk::manage( new Adjuster(M("TP_WAVELET_EDRAD"), 0, 100, 1, 15) )), - edgval(Gtk::manage( new Adjuster(M("TP_WAVELET_EDVAL"), 0, 100, 1, 0) )), - edgthresh(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGTHRESH"), -50, 100, 1, 10 ))), + thr(Gtk::manage(new Adjuster(M("TP_WAVELET_THR"), 0, 100, 1, 30))), + thrH(Gtk::manage(new Adjuster(M("TP_WAVELET_THRH"), 0, 100, 1, 70))), + radius(Gtk::manage(new Adjuster(M("TP_WAVELET_RADIUS"), 0, 100, 1, 40))), + skinprotect(Gtk::manage(new Adjuster(M("TP_WAVELET_SKIN"), -100, 100, 1, 0.))), + edgrad(Gtk::manage(new Adjuster(M("TP_WAVELET_EDRAD"), 0, 100, 1, 15))), + edgval(Gtk::manage(new Adjuster(M("TP_WAVELET_EDVAL"), 0, 100, 1, 0))), + edgthresh(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGTHRESH"), -50, 100, 1, 10))), strength(Gtk::manage(new Adjuster(M("TP_WAVELET_STRENGTH"), 0, 100, 1, 100))), balance(Gtk::manage(new Adjuster(M("TP_WAVELET_BALANCE"), -30, 100, 1, 0))), iter(Gtk::manage(new Adjuster(M("TP_WAVELET_ITER"), -3, 3, 1, 0))), @@ -116,6 +122,10 @@ Wavelet::Wavelet() : edgedetectthr2(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGEDETECTTHR2"), -10, 100, 1, 0))), edgesensi(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGESENSI"), 0, 100, 1, 60))), edgeampli(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGEAMPLI"), 0, 100, 1, 10))), + mergeL(Gtk::manage(new Adjuster(M("TP_WAVELET_MERGEL"), -50, 100, 1, 40))), + mergeC(Gtk::manage(new Adjuster(M("TP_WAVELET_MERGEC"), -50, 100, 1, 20))), + softrad(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.5, 0.))), + softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.5, 0.))), Lmethod(Gtk::manage(new MyComboBoxText())), CHmethod(Gtk::manage(new MyComboBoxText())), CHSLmethod(Gtk::manage(new MyComboBoxText())), @@ -130,12 +140,15 @@ Wavelet::Wavelet() : daubcoeffmethod(Gtk::manage(new MyComboBoxText())), Dirmethod(Gtk::manage(new MyComboBoxText())), Medgreinf(Gtk::manage(new MyComboBoxText())), + ushamethod(Gtk::manage(new MyComboBoxText())), chanMixerHLFrame(Gtk::manage(new Gtk::Frame(M("TP_COLORTONING_HIGHLIGHT")))), chanMixerMidFrame(Gtk::manage(new Gtk::Frame(M("TP_COLORTONING_MIDTONES")))), chanMixerShadowsFrame(Gtk::manage(new Gtk::Frame(M("TP_COLORTONING_SHADOWS")))), + chromaFrame(Gtk::manage(new Gtk::Frame(M("TP_WAVELET_CHROMAFRAME")))), wavLabels(Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER))), labmC(Gtk::manage(new Gtk::Label(M("TP_WAVELET_CTYPE") + ":"))), labmNP(Gtk::manage(new Gtk::Label(M("TP_WAVELET_NPTYPE") + ":"))), + usharpLabel(Gtk::manage(new Gtk::Label(M("TP_WAVELET_USHARP") + ":"))), expchroma(Gtk::manage(new MyExpander(true, M("TP_WAVELET_LEVCH")))), expcontrast(Gtk::manage(new MyExpander(true, M("TP_WAVELET_LEVF")))), expedge(Gtk::manage(new MyExpander(true, M("TP_WAVELET_EDGE")))), @@ -145,106 +158,122 @@ Wavelet::Wavelet() : expresid(Gtk::manage(new MyExpander(true, M("TP_WAVELET_RESID")))), expsettings(Gtk::manage(new MyExpander(false, M("TP_WAVELET_SETTINGS")))), exptoning(Gtk::manage(new MyExpander(true, M("TP_WAVELET_TON")))), - neutrHBox(Gtk::manage(new Gtk::HBox())) + expclari(Gtk::manage(new MyExpander(true, M("TP_WAVELET_CLARI")))), + neutrHBox(Gtk::manage(new Gtk::HBox())), + usharpHBox(Gtk::manage(new Gtk::HBox())) { CurveListener::setMulti(true); + auto m = ProcEventMapper::getInstance(); + EvWavenaclari = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVCLARI"); + EvWavushamet = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVUSHAMET"); + EvWavmergeL = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVMERGEL"); + EvWavmergeC = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVMERGEC"); + EvWavsoftrad = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVSOFTRAD"); + EvWavsoftradend = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVSOFTRADEND"); + EvWavshowmask = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVSHOWMASK"); + EvWavedgs = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVEDGS"); + EvWavscale = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVSCALE"); + EvWavradius = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVRADIUS"); + EvWavsigma = m->newEvent(DIRPYREQUALIZER, "HISTORY_MSG_WAVSIGMA"); - expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings) ); + expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings)); - expcontrast->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Wavelet::foldAllButMe), expcontrast) ); - enableContrastConn = expcontrast->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), expcontrast) ); + expcontrast->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expcontrast)); + enableContrastConn = expcontrast->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expcontrast)); - expchroma->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), expchroma) ); - enableChromaConn = expchroma->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), expchroma) ); + expchroma->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expchroma)); + enableChromaConn = expchroma->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expchroma)); - exptoning->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), exptoning) ); - enableToningConn = exptoning->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), exptoning) ); + exptoning->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), exptoning)); + enableToningConn = exptoning->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), exptoning)); - expnoise->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), expnoise) ); - enableNoiseConn = expnoise->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), expnoise) ); + expnoise->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expnoise)); + enableNoiseConn = expnoise->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expnoise)); - expedge->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), expedge) ); - enableEdgeConn = expedge->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), expedge) ); + expedge->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expedge)); + enableEdgeConn = expedge->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expedge)); - expgamut->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), expgamut) ); + expgamut->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expgamut)); - expresid->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), expresid) ); - enableResidConn = expresid->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), expresid) ); + expresid->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expresid)); + enableResidConn = expresid->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expresid)); - expfinal->signal_button_release_event().connect_notify( sigc::bind ( sigc::mem_fun(this, &Wavelet::foldAllButMe), expfinal) ); - enableFinalConn = expfinal->signal_enabled_toggled().connect ( sigc::bind( sigc::mem_fun(this, &Wavelet::enableToggled), expfinal) ); + expfinal->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expfinal)); + enableFinalConn = expfinal->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expfinal)); + + expclari->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expclari)); + enableclariConn = expclari->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Wavelet::enableToggled), expclari)); // Wavelet Settings - ToolParamBlock* const settingsBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const settingsBox = Gtk::manage(new ToolParamBlock()); - strength->setAdjusterListener (this); + strength->setAdjusterListener(this); - thres->set_tooltip_text (M("TP_WAVELET_LEVELS_TOOLTIP")); - thres->setAdjusterListener (this); + thres->set_tooltip_text(M("TP_WAVELET_LEVELS_TOOLTIP")); + thres->setAdjusterListener(this); - Tilesmethod->append (M("TP_WAVELET_TILESFULL")); - Tilesmethod->append (M("TP_WAVELET_TILESBIG")); - Tilesmethod->append (M("TP_WAVELET_TILESLIT")); - Tilesmethodconn = Tilesmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::TilesmethodChanged) ); - Tilesmethod->set_tooltip_text (M("TP_WAVELET_TILES_TOOLTIP")); + Tilesmethod->append(M("TP_WAVELET_TILESFULL")); + Tilesmethod->append(M("TP_WAVELET_TILESBIG")); + Tilesmethod->append(M("TP_WAVELET_TILESLIT")); + Tilesmethodconn = Tilesmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::TilesmethodChanged)); + Tilesmethod->set_tooltip_text(M("TP_WAVELET_TILES_TOOLTIP")); Gtk::HBox* const tilesizeHBox = Gtk::manage(new Gtk::HBox()); Gtk::Label* const tilesizeLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_TILESIZE") + ":")); tilesizeHBox->pack_start(*tilesizeLabel, Gtk::PACK_SHRINK, 4); tilesizeHBox->pack_start(*Tilesmethod); daubcoeffmethod->set_sensitive(true); - daubcoeffmethod->append (M("TP_WAVELET_DAUB2")); - daubcoeffmethod->append (M("TP_WAVELET_DAUB4")); - daubcoeffmethod->append (M("TP_WAVELET_DAUB6")); - daubcoeffmethod->append (M("TP_WAVELET_DAUB10")); - daubcoeffmethod->append (M("TP_WAVELET_DAUB14")); - daubcoeffmethodconn = daubcoeffmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::daubcoeffmethodChanged) ); - daubcoeffmethod->set_tooltip_text (M("TP_WAVELET_DAUB_TOOLTIP")); + daubcoeffmethod->append(M("TP_WAVELET_DAUB2")); + daubcoeffmethod->append(M("TP_WAVELET_DAUB4")); + daubcoeffmethod->append(M("TP_WAVELET_DAUB6")); + daubcoeffmethod->append(M("TP_WAVELET_DAUB10")); + daubcoeffmethod->append(M("TP_WAVELET_DAUB14")); + daubcoeffmethodconn = daubcoeffmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::daubcoeffmethodChanged)); + daubcoeffmethod->set_tooltip_text(M("TP_WAVELET_DAUB_TOOLTIP")); Gtk::Label* const daubcoeffLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_DAUB") + ":")); Gtk::HBox* const daubcoeffHBox = Gtk::manage(new Gtk::HBox()); daubcoeffHBox->pack_start(*daubcoeffLabel, Gtk::PACK_SHRINK, 4); daubcoeffHBox->pack_start(*daubcoeffmethod); - Backmethod->append (M("TP_WAVELET_B0")); - Backmethod->append (M("TP_WAVELET_B1")); - Backmethod->append (M("TP_WAVELET_B2")); - Backmethodconn = Backmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::BackmethodChanged) ); + Backmethod->append(M("TP_WAVELET_B0")); + Backmethod->append(M("TP_WAVELET_B1")); + Backmethod->append(M("TP_WAVELET_B2")); + Backmethodconn = Backmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::BackmethodChanged)); Gtk::HBox* const backgroundHBox = Gtk::manage(new Gtk::HBox()); Gtk::Label* const backgroundLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_BACKGROUND") + ":")); backgroundHBox->pack_start(*backgroundLabel, Gtk::PACK_SHRINK, 4); backgroundHBox->pack_start(*Backmethod); - CLmethod->append (M("TP_WAVELET_LEVDIR_ONE")); - CLmethod->append (M("TP_WAVELET_LEVDIR_INF")); - CLmethod->append (M("TP_WAVELET_LEVDIR_SUP")); - CLmethod->append (M("TP_WAVELET_LEVDIR_ALL")); - CLmethodconn = CLmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::CLmethodChanged) ); + CLmethod->append(M("TP_WAVELET_LEVDIR_ONE")); + CLmethod->append(M("TP_WAVELET_LEVDIR_INF")); + CLmethod->append(M("TP_WAVELET_LEVDIR_SUP")); + CLmethod->append(M("TP_WAVELET_LEVDIR_ALL")); + CLmethodconn = CLmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::CLmethodChanged)); Gtk::HBox* const levdirMainHBox = Gtk::manage(new Gtk::HBox()); Gtk::Label* const levdirMainLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_PROC") + ":")); levdirMainHBox->pack_start(*levdirMainLabel, Gtk::PACK_SHRINK, 4); levdirMainHBox->pack_start(*CLmethod); //same Lmethod->set_sensitive(false); - Lmethod->set_sensitive(false); - Lmethod->append (M("TP_WAVELET_1")); - Lmethod->append (M("TP_WAVELET_2")); - Lmethod->append (M("TP_WAVELET_3")); - Lmethod->append (M("TP_WAVELET_4")); - Lmethod->append (M("TP_WAVELET_5")); - Lmethod->append (M("TP_WAVELET_6")); - Lmethod->append (M("TP_WAVELET_7")); - Lmethod->append (M("TP_WAVELET_8")); - Lmethod->append (M("TP_WAVELET_9")); - Lmethod->append (M("TP_WAVELET_SUPE")); - Lmethod->append (M("TP_WAVELET_RESID")); + Lmethod->append(M("TP_WAVELET_1")); + Lmethod->append(M("TP_WAVELET_2")); + Lmethod->append(M("TP_WAVELET_3")); + Lmethod->append(M("TP_WAVELET_4")); + Lmethod->append(M("TP_WAVELET_5")); + Lmethod->append(M("TP_WAVELET_6")); + Lmethod->append(M("TP_WAVELET_7")); + Lmethod->append(M("TP_WAVELET_8")); + Lmethod->append(M("TP_WAVELET_9")); + Lmethod->append(M("TP_WAVELET_SUPE")); + Lmethod->append(M("TP_WAVELET_RESID")); Lmethod->set_active(0); Dirmethod->set_sensitive(false); - Dirmethod->append (M("TP_WAVELET_DONE")); - Dirmethod->append (M("TP_WAVELET_DTWO")); - Dirmethod->append (M("TP_WAVELET_DTHR")); - Dirmethod->append (M("TP_WAVELET_DALL")); - Lmethodconn = Lmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::LmethodChanged) ); - Dirmethodconn = Dirmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::DirmethodChanged) ); + Dirmethod->append(M("TP_WAVELET_DONE")); + Dirmethod->append(M("TP_WAVELET_DTWO")); + Dirmethod->append(M("TP_WAVELET_DTHR")); + Dirmethod->append(M("TP_WAVELET_DALL")); + Lmethodconn = Lmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::LmethodChanged)); + Dirmethodconn = Dirmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::DirmethodChanged)); Gtk::HBox* const levdirSubHBox = Gtk::manage(new Gtk::HBox()); levdirSubHBox->pack_start(*Lmethod); levdirSubHBox->pack_start(*Dirmethod, Gtk::PACK_EXPAND_WIDGET, 2); // same, but 2 not 4? @@ -258,39 +287,39 @@ Wavelet::Wavelet() : settingsBox->pack_start(*levdirSubHBox); // Contrast - ToolParamBlock* const levBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const levBox = Gtk::manage(new ToolParamBlock()); - Gtk::HBox* const buttonBox = Gtk::manage (new Gtk::HBox(true, 10)); + Gtk::HBox* const buttonBox = Gtk::manage(new Gtk::HBox(true, 10)); levBox->pack_start(*buttonBox, Gtk::PACK_SHRINK, 2); - Gtk::Button* const contrastMinusButton = Gtk::manage (new Gtk::Button(M("TP_WAVELET_CONTRAST_MINUS"))); + Gtk::Button* const contrastMinusButton = Gtk::manage(new Gtk::Button(M("TP_WAVELET_CONTRAST_MINUS"))); buttonBox->pack_start(*contrastMinusButton); - contrastMinusPressedConn = contrastMinusButton->signal_pressed().connect( sigc::mem_fun(*this, &Wavelet::contrastMinusPressed)); + contrastMinusPressedConn = contrastMinusButton->signal_pressed().connect(sigc::mem_fun(*this, &Wavelet::contrastMinusPressed)); - Gtk::Button* const neutralButton = Gtk::manage (new Gtk::Button(M("TP_WAVELET_NEUTRAL"))); + Gtk::Button* const neutralButton = Gtk::manage(new Gtk::Button(M("TP_WAVELET_NEUTRAL"))); buttonBox->pack_start(*neutralButton); - neutralPressedConn = neutralButton->signal_pressed().connect( sigc::mem_fun(*this, &Wavelet::neutralPressed)); + neutralPressedConn = neutralButton->signal_pressed().connect(sigc::mem_fun(*this, &Wavelet::neutralPressed)); - Gtk::Button* const contrastPlusButton = Gtk::manage (new Gtk::Button(M("TP_WAVELET_CONTRAST_PLUS"))); + Gtk::Button* const contrastPlusButton = Gtk::manage(new Gtk::Button(M("TP_WAVELET_CONTRAST_PLUS"))); buttonBox->pack_start(*contrastPlusButton); - contrastPlusPressedConn = contrastPlusButton->signal_pressed().connect( sigc::mem_fun(*this, &Wavelet::contrastPlusPressed)); + contrastPlusPressedConn = contrastPlusButton->signal_pressed().connect(sigc::mem_fun(*this, &Wavelet::contrastPlusPressed)); buttonBox->show_all_children(); - for(int i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { Glib::ustring ss; - switch( i ) { - case 0: - ss = Glib::ustring::compose( "%1 (%2)", (i + 1), M("TP_WAVELET_FINEST")); - break; + switch (i) { + case 0: + ss = Glib::ustring::compose("%1 (%2)", (i + 1), M("TP_WAVELET_FINEST")); + break; - case 8: - ss = Glib::ustring::compose( "%1 (%2)", (i + 1), M("TP_WAVELET_LARGEST")); - break; + case 8: + ss = Glib::ustring::compose("%1 (%2)", (i + 1), M("TP_WAVELET_LARGEST")); + break; - default: - ss = Glib::ustring::compose( "%1", (i + 1)); + default: + ss = Glib::ustring::compose("%1", (i + 1)); } correction[i] = Gtk::manage(new Adjuster(std::move(ss), -100, 350, 1, 0)); @@ -298,34 +327,37 @@ Wavelet::Wavelet() : levBox->pack_start(*correction[i]); } + sigma->setAdjusterListener(this); + levBox->pack_start(*sigma, Gtk::PACK_SHRINK); + levBox->pack_start(*sup); - sup->setAdjusterListener (this); + sup->setAdjusterListener(this); wavLabels->show(); - levBox->pack_start (*wavLabels); + levBox->pack_start(*wavLabels); Gtk::VBox* const contrastSHVBox = Gtk::manage(new Gtk::VBox); contrastSHVBox->set_spacing(2); - HSmethod->append (M("TP_WAVELET_HS1")); - HSmethod->append (M("TP_WAVELET_HS2")); - HSmethodconn = HSmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::HSmethodChanged) ); + HSmethod->append(M("TP_WAVELET_HS1")); + HSmethod->append(M("TP_WAVELET_HS2")); + HSmethodconn = HSmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::HSmethodChanged)); const std::vector milestones2 = { GradientMilestone(0.0, 0.0, 0.0, 0.0), GradientMilestone(1.0, 1.0, 1.0, 1.0) }; - hllev->setAdjusterListener (this); + hllev->setAdjusterListener(this); hllev->setBgGradient(milestones2); - threshold->setAdjusterListener (this); - threshold->set_tooltip_text (M("TP_WAVELET_THRESHOLD_TOOLTIP")); + threshold->setAdjusterListener(this); + threshold->set_tooltip_text(M("TP_WAVELET_THRESHOLD_TOOLTIP")); - bllev->setAdjusterListener (this); + bllev->setAdjusterListener(this); bllev->setBgGradient(milestones2); - threshold2->setAdjusterListener (this); - threshold2->set_tooltip_text (M("TP_WAVELET_THRESHOLD2_TOOLTIP")); + threshold2->setAdjusterListener(this); + threshold2->set_tooltip_text(M("TP_WAVELET_THRESHOLD2_TOOLTIP")); contrastSHVBox->pack_start(*HSmethod); contrastSHVBox->pack_start(*hllev); @@ -337,68 +369,68 @@ Wavelet::Wavelet() : levBox->pack_start(*contrastSHFrame); // Chromaticity - ToolParamBlock* const chBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const chBox = Gtk::manage(new ToolParamBlock()); Gtk::Label* const labmch = Gtk::manage(new Gtk::Label(M("TP_WAVELET_CHTYPE") + ":")); Gtk::HBox* const ctboxch = Gtk::manage(new Gtk::HBox()); - ctboxch->pack_start (*labmch, Gtk::PACK_SHRINK, 1); + ctboxch->pack_start(*labmch, Gtk::PACK_SHRINK, 1); - CHmethod->append (M("TP_WAVELET_CH1")); - CHmethod->append (M("TP_WAVELET_CH2")); - CHmethod->append (M("TP_WAVELET_CH3")); - CHmethodconn = CHmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::CHmethodChanged) ); + CHmethod->append(M("TP_WAVELET_CH1")); + CHmethod->append(M("TP_WAVELET_CH2")); + CHmethod->append(M("TP_WAVELET_CH3")); + CHmethodconn = CHmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::CHmethodChanged)); ctboxch->pack_start(*CHmethod); chBox->pack_start(*ctboxch); Gtk::HBox* const ctboxCH = Gtk::manage(new Gtk::HBox()); - ctboxCH->pack_start (*labmC, Gtk::PACK_SHRINK, 1); + ctboxCH->pack_start(*labmC, Gtk::PACK_SHRINK, 1); - CHSLmethod->append (M("TP_WAVELET_CHSL")); - CHSLmethod->append (M("TP_WAVELET_CHCU")); - CHSLmethodconn = CHSLmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::CHSLmethodChanged) ); + CHSLmethod->append(M("TP_WAVELET_CHSL")); + CHSLmethod->append(M("TP_WAVELET_CHCU")); + CHSLmethodconn = CHSLmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::CHSLmethodChanged)); ctboxCH->pack_start(*CHSLmethod); - Gtk::HSeparator* const separatorChromaMethod = Gtk::manage (new Gtk::HSeparator()); + Gtk::HSeparator* const separatorChromaMethod = Gtk::manage(new Gtk::HSeparator()); chBox->pack_start(*separatorChromaMethod, Gtk::PACK_SHRINK, 2); - chroma->set_tooltip_text (M("TP_WAVELET_CHRO_TOOLTIP")); + chroma->set_tooltip_text(M("TP_WAVELET_CHRO_TOOLTIP")); chBox->pack_start(*chroma); - chroma->setAdjusterListener (this); + chroma->setAdjusterListener(this); - satlev->setAdjusterListener (this); + satlev->setAdjusterListener(this); satlev->setBgGradient(milestones2); - pastlev->setAdjusterListener (this); + pastlev->setAdjusterListener(this); pastlev->setBgGradient(milestones2); chBox->pack_start(*pastlev); chBox->pack_start(*satlev); - chro->set_tooltip_text (M("TP_WAVELET_CHR_TOOLTIP")); + chro->set_tooltip_text(M("TP_WAVELET_CHR_TOOLTIP")); chBox->pack_start(*chro); - chro->setAdjusterListener (this); + chro->setAdjusterListener(this); - Gtk::HBox* const buttonchBox = Gtk::manage (new Gtk::HBox(true, 10)); - neutralchPressedConn = neutralchButton->signal_pressed().connect( sigc::mem_fun(*this, &Wavelet::neutralchPressed)); + Gtk::HBox* const buttonchBox = Gtk::manage(new Gtk::HBox(true, 10)); + neutralchPressedConn = neutralchButton->signal_pressed().connect(sigc::mem_fun(*this, &Wavelet::neutralchPressed)); chBox->pack_start(*separatorNeutral, Gtk::PACK_SHRINK, 2); buttonchBox->pack_start(*neutralchButton); buttonchBox->show_all_children(); chBox->pack_start(*buttonchBox, Gtk::PACK_SHRINK, 2); - for(int i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { Glib::ustring ss; - switch( i ) { - case 0: - ss = Glib::ustring::compose( "%1 (%2)", (i + 1), M("TP_WAVELET_FINEST")); - break; + switch (i) { + case 0: + ss = Glib::ustring::compose("%1 (%2)", (i + 1), M("TP_WAVELET_FINEST")); + break; - case 8: - ss = Glib::ustring::compose( "%1 (%2)", (i + 1), M("TP_WAVELET_LARGEST")); - break; + case 8: + ss = Glib::ustring::compose("%1 (%2)", (i + 1), M("TP_WAVELET_LARGEST")); + break; - default: - ss = Glib::ustring::compose( "%1", (i + 1)); + default: + ss = Glib::ustring::compose("%1", (i + 1)); } correctionch[i] = Gtk::manage(new Adjuster(std::move(ss), -100, 100, 1, 0)); @@ -407,9 +439,9 @@ Wavelet::Wavelet() : } // Toning - ToolParamBlock* const tonBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const tonBox = Gtk::manage(new ToolParamBlock()); - opaCurveEditorG->setCurveListener (this); + opaCurveEditorG->setCurveListener(this); const WaveletParams default_params; @@ -420,9 +452,9 @@ Wavelet::Wavelet() : opaCurveEditorG->curveListComplete(); opaCurveEditorG->show(); - tonBox->pack_start( *opaCurveEditorG, Gtk::PACK_SHRINK, 2); + tonBox->pack_start(*opaCurveEditorG, Gtk::PACK_SHRINK, 2); - opacityCurveEditorG->setCurveListener (this); + opacityCurveEditorG->setCurveListener(this); opacityShapeBY = static_cast(opacityCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeBY->setIdentityValue(0.); @@ -431,77 +463,99 @@ Wavelet::Wavelet() : opacityCurveEditorG->curveListComplete(); opacityCurveEditorG->show(); - tonBox->pack_start( *opacityCurveEditorG, Gtk::PACK_SHRINK, 2); + tonBox->pack_start(*opacityCurveEditorG, Gtk::PACK_SHRINK, 2); // Denoise and Refine - ToolParamBlock* const noiseBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const noiseBox = Gtk::manage(new ToolParamBlock()); - linkedg->set_active (true); - linkedgConn = linkedg->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::linkedgToggled) ); + linkedg->set_active(true); + linkedgConn = linkedg->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::linkedgToggled)); noiseBox->pack_start(*linkedg); - level0noise->setAdjusterListener (this); + level0noise->setAdjusterListener(this); level0noise->setUpdatePolicy(RTUP_DYNAMIC); - level1noise->setAdjusterListener (this); + level1noise->setAdjusterListener(this); level1noise->setUpdatePolicy(RTUP_DYNAMIC); - level2noise->setAdjusterListener (this); + level2noise->setAdjusterListener(this); level2noise->setUpdatePolicy(RTUP_DYNAMIC); - level3noise->setAdjusterListener (this); + level3noise->setAdjusterListener(this); level3noise->setUpdatePolicy(RTUP_DYNAMIC); - noiseBox->pack_start( *level0noise, Gtk::PACK_SHRINK, 0); - noiseBox->pack_start( *level1noise, Gtk::PACK_SHRINK, 0); - noiseBox->pack_start( *level2noise, Gtk::PACK_SHRINK, 0); - noiseBox->pack_start( *level3noise, Gtk::PACK_SHRINK, 0); + noiseBox->pack_start(*level0noise, Gtk::PACK_SHRINK, 0); + noiseBox->pack_start(*level1noise, Gtk::PACK_SHRINK, 0); + noiseBox->pack_start(*level2noise, Gtk::PACK_SHRINK, 0); + noiseBox->pack_start(*level3noise, Gtk::PACK_SHRINK, 0); + +//Clarity + mergeL->setAdjusterListener(this); + mergeC->setAdjusterListener(this); + softrad->setAdjusterListener(this); + showmask->set_active(false); + showmaskConn = showmask->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::showmaskToggled)); + + ToolParamBlock* const clariBox = Gtk::manage(new ToolParamBlock()); + // ushamethod->append(M("TP_WAVELET_USH")); + ushamethod->append(M("TP_WAVELET_SHA")); + ushamethod->append(M("TP_WAVELET_CLA")); + ushamethodconn = ushamethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::ushamethodChanged)); + ushamethod->set_tooltip_text(M("TP_WAVELET_USH_TOOLTIP")); + usharpHBox->pack_start(*usharpLabel, Gtk::PACK_SHRINK, 0); + usharpHBox->pack_start(*ushamethod); + + clariBox->pack_start(*usharpHBox); + clariBox->pack_start(*mergeL); + clariBox->pack_start(*mergeC); + clariBox->pack_start(*softrad); + clariBox->pack_start(*showmask); // Edge Sharpness - ToolParamBlock* const edgBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const edgBox = Gtk::manage(new ToolParamBlock()); edgval->setAdjusterListener(this); edgBox->pack_start(*edgval); edgrad->setAdjusterListener(this); edgBox->pack_start(*edgrad); - edgrad->set_tooltip_markup (M("TP_WAVELET_EDRAD_TOOLTIP")); + edgrad->set_tooltip_markup(M("TP_WAVELET_EDRAD_TOOLTIP")); - edgthresh->setAdjusterListener (this); - edgthresh->set_tooltip_markup (M("TP_WAVELET_EDGTHRESH_TOOLTIP")); - edgBox->pack_start (*edgthresh); + edgthresh->setAdjusterListener(this); + edgthresh->set_tooltip_markup(M("TP_WAVELET_EDGTHRESH_TOOLTIP")); + edgBox->pack_start(*edgthresh); Gtk::Label* const labmedgr = Gtk::manage(new Gtk::Label(M("TP_WAVELET_MEDGREINF") + ":")); Gtk::HBox* const edbox = Gtk::manage(new Gtk::HBox()); - edbox->pack_start (*labmedgr, Gtk::PACK_SHRINK, 1); + edbox->pack_start(*labmedgr, Gtk::PACK_SHRINK, 1); - Medgreinf->append (M("TP_WAVELET_RE1")); - Medgreinf->append (M("TP_WAVELET_RE2")); - Medgreinf->append (M("TP_WAVELET_RE3")); - MedgreinfConn = Medgreinf->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::MedgreinfChanged) ); - Medgreinf->set_tooltip_markup (M("TP_WAVELET_EDGREINF_TOOLTIP")); + Medgreinf->append(M("TP_WAVELET_RE1")); + Medgreinf->append(M("TP_WAVELET_RE2")); + Medgreinf->append(M("TP_WAVELET_RE3")); + MedgreinfConn = Medgreinf->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::MedgreinfChanged)); + Medgreinf->set_tooltip_markup(M("TP_WAVELET_EDGREINF_TOOLTIP")); edbox->pack_start(*Medgreinf); edgBox->pack_start(*edbox); - Gtk::HSeparator* const separatorlc = Gtk::manage (new Gtk::HSeparator()); + Gtk::HSeparator* const separatorlc = Gtk::manage(new Gtk::HSeparator()); edgBox->pack_start(*separatorlc, Gtk::PACK_SHRINK, 2); Gtk::Label* const labmED = Gtk::manage(new Gtk::Label(M("TP_WAVELET_EDTYPE") + ":")); Gtk::HBox* const ctboxED = Gtk::manage(new Gtk::HBox()); - ctboxED->pack_start (*labmED, Gtk::PACK_SHRINK, 1); + ctboxED->pack_start(*labmED, Gtk::PACK_SHRINK, 1); - EDmethod->append (M("TP_WAVELET_EDSL")); - EDmethod->append (M("TP_WAVELET_EDCU")); - EDmethodconn = EDmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::EDmethodChanged) ); + EDmethod->append(M("TP_WAVELET_EDSL")); + EDmethod->append(M("TP_WAVELET_EDCU")); + EDmethodconn = EDmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::EDmethodChanged)); ctboxED->pack_start(*EDmethod); - edgBox->pack_start (*ctboxED); + edgBox->pack_start(*ctboxED); - edgcont->setAdjusterListener (this); + edgcont->setAdjusterListener(this); edgcont->setBgGradient(milestones2); - edgcont->set_tooltip_markup (M("TP_WAVELET_EDGCONT_TOOLTIP")); + edgcont->set_tooltip_markup(M("TP_WAVELET_EDGCONT_TOOLTIP")); // <-- Edge Sharpness Local Contrast curve - CCWcurveEditorG->setCurveListener (this); + CCWcurveEditorG->setCurveListener(this); ccshape = static_cast(CCWcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); @@ -513,56 +567,56 @@ Wavelet::Wavelet() : CCWcurveEditorG->show(); // --> - edgBox->pack_start (*edgcont); + edgBox->pack_start(*edgcont); edgBox->pack_start(*CCWcurveEditorG, Gtk::PACK_SHRINK, 4); - medianlev->set_active (true); - medianlevConn = medianlev->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::medianlevToggled) ); - medianlev->set_tooltip_text (M("TP_WAVELET_MEDILEV_TOOLTIP")); + medianlev->set_active(true); + medianlevConn = medianlev->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::medianlevToggled)); + medianlev->set_tooltip_text(M("TP_WAVELET_MEDILEV_TOOLTIP")); - Gtk::HSeparator* const separatored1 = Gtk::manage (new Gtk::HSeparator()); + Gtk::HSeparator* const separatored1 = Gtk::manage(new Gtk::HSeparator()); edgBox->pack_start(*separatored1, Gtk::PACK_SHRINK, 2); Gtk::HBox* const eddebox = Gtk::manage(new Gtk::HBox()); - edgBox->pack_start (*eddebox); + edgBox->pack_start(*eddebox); edgBox->pack_start(*medianlev); - edgedetect->setAdjusterListener (this); - edgedetect->set_tooltip_text (M("TP_WAVELET_EDGEDETECT_TOOLTIP")); + edgedetect->setAdjusterListener(this); + edgedetect->set_tooltip_text(M("TP_WAVELET_EDGEDETECT_TOOLTIP")); edgBox->pack_start(*edgedetect); - edgedetectthr->setAdjusterListener (this); - edgedetectthr->set_tooltip_text (M("TP_WAVELET_EDGEDETECTTHR_TOOLTIP")); + edgedetectthr->setAdjusterListener(this); + edgedetectthr->set_tooltip_text(M("TP_WAVELET_EDGEDETECTTHR_TOOLTIP")); edgBox->pack_start(*edgedetectthr); - edgedetectthr2->setAdjusterListener (this); + edgedetectthr2->setAdjusterListener(this); edgBox->pack_start(*edgedetectthr2); edgBox->pack_start(*separatoredge, Gtk::PACK_SHRINK, 2); - lipst->set_active (true); - lipstConn = lipst->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::lipstToggled) ); + lipst->set_active(true); + lipstConn = lipst->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::lipstToggled)); // lipst->set_tooltip_text (M("TP_WAVELET_LIPST_TOOLTIP")); edgBox->pack_start(*lipst); - edgesensi->setAdjusterListener (this); + edgesensi->setAdjusterListener(this); edgBox->pack_start(*edgesensi); - edgeampli->setAdjusterListener (this); + edgeampli->setAdjusterListener(this); edgBox->pack_start(*edgeampli); - Gtk::VBox* const ctboxES = Gtk::manage (new Gtk::VBox()); + Gtk::VBox* const ctboxES = Gtk::manage(new Gtk::VBox()); ctboxES->set_spacing(2); Gtk::HBox* const ctboxNP = Gtk::manage(new Gtk::HBox()); - ctboxNP->pack_start (*labmNP, Gtk::PACK_SHRINK, 1); + ctboxNP->pack_start(*labmNP, Gtk::PACK_SHRINK, 1); - NPmethod->append (M("TP_WAVELET_NPNONE")); - NPmethod->append (M("TP_WAVELET_NPLOW")); - NPmethod->append (M("TP_WAVELET_NPHIGH")); - NPmethodconn = NPmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::NPmethodChanged) ); - NPmethod->set_tooltip_text (M("TP_WAVELET_NPTYPE_TOOLTIP")); + NPmethod->append(M("TP_WAVELET_NPNONE")); + NPmethod->append(M("TP_WAVELET_NPLOW")); + NPmethod->append(M("TP_WAVELET_NPHIGH")); + NPmethodconn = NPmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::NPmethodChanged)); + NPmethod->set_tooltip_text(M("TP_WAVELET_NPTYPE_TOOLTIP")); ctboxNP->pack_start(*NPmethod); ctboxES->pack_start(*ctboxNP); @@ -570,13 +624,13 @@ Wavelet::Wavelet() : edgBox->pack_start(*ctboxES); // Gamut - ToolParamBlock* const conBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const conBox = Gtk::manage(new ToolParamBlock()); - median->set_active (true); - medianConn = median->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::medianToggled) ); + median->set_active(true); + medianConn = median->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::medianToggled)); conBox->pack_start(*median); - hueskin->set_tooltip_markup (M("TP_WAVELET_HUESKIN_TOOLTIP")); + hueskin->set_tooltip_markup(M("TP_WAVELET_HUESKIN_TOOLTIP")); //from -PI to +PI (radians) convert to hsv and draw bottombar const std::vector milestones = { @@ -599,13 +653,13 @@ Wavelet::Wavelet() : hueskin->setBgGradient(milestones); conBox->pack_start(*hueskin); - hueskin->setAdjusterListener (this); + hueskin->setAdjusterListener(this); skinprotect->setAdjusterListener(this); conBox->pack_start(*skinprotect); - skinprotect->set_tooltip_markup (M("TP_WAVELET_SKIN_TOOLTIP")); + skinprotect->set_tooltip_markup(M("TP_WAVELET_SKIN_TOOLTIP")); - curveEditorGAM->setCurveListener (this); + curveEditorGAM->setCurveListener(this); Chshape = static_cast(curveEditorGAM->addCurve(CT_Flat, M("TP_WAVELET_CURVEEDITOR_CH"))); Chshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_CH_TOOLTIP")); @@ -613,74 +667,91 @@ Wavelet::Wavelet() : curveEditorGAM->curveListComplete(); Chshape->setBottomBarBgGradient(milestones); - conBox->pack_start (*curveEditorGAM, Gtk::PACK_SHRINK, 4); + conBox->pack_start(*curveEditorGAM, Gtk::PACK_SHRINK, 4); - avoid->set_active (true); - avoidConn = avoid->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::avoidToggled) ); + avoid->set_active(true); + avoidConn = avoid->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::avoidToggled)); conBox->pack_start(*avoid); // Residual Image - ToolParamBlock* const resBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const resBox = Gtk::manage(new ToolParamBlock()); - rescon->setAdjusterListener (this); + rescon->setAdjusterListener(this); resBox->pack_start(*rescon, Gtk::PACK_SHRINK); resBox->pack_start(*thr); - thr->setAdjusterListener (this); + thr->setAdjusterListener(this); - resconH->setAdjusterListener (this); + resconH->setAdjusterListener(this); resBox->pack_start(*resconH, Gtk::PACK_SHRINK); - thrH->setAdjusterListener (this); + thrH->setAdjusterListener(this); resBox->pack_start(*thrH, Gtk::PACK_SHRINK); - contrast->set_tooltip_text (M("TP_WAVELET_CONTRA_TOOLTIP")); - contrast->setAdjusterListener (this); + radius->setAdjusterListener(this); + resBox->pack_start(*radius, Gtk::PACK_SHRINK); + + contrast->set_tooltip_text(M("TP_WAVELET_CONTRA_TOOLTIP")); + contrast->setAdjusterListener(this); resBox->pack_start(*contrast); //keep the possibility to reinstall - reschro->setAdjusterListener (this); - resBox->pack_start(*reschro); + reschro->setAdjusterListener(this); + chromaFrame->set_label_align(0.025, 0.5); + ToolParamBlock* const chromaBox = Gtk::manage(new ToolParamBlock()); + chromaBox->pack_start(*reschro); + chromaBox->pack_start(*hueskin2); + chromaBox->pack_start(*sky); + chromaFrame->add(*chromaBox); Gtk::Label* const labmTM = Gtk::manage(new Gtk::Label(M("TP_WAVELET_TMTYPE") + ":")); Gtk::HBox* const ctboxTM = Gtk::manage(new Gtk::HBox()); - ctboxTM->pack_start (*labmTM, Gtk::PACK_SHRINK, 1); + ctboxTM->pack_start(*labmTM, Gtk::PACK_SHRINK, 1); - Gtk::HSeparator* const separatorR0 = Gtk::manage (new Gtk::HSeparator()); + Gtk::HSeparator* const separatorR0 = Gtk::manage(new Gtk::HSeparator()); resBox->pack_start(*separatorR0, Gtk::PACK_SHRINK, 2); - TMmethod->append (M("TP_WAVELET_COMPCONT")); - TMmethod->append (M("TP_WAVELET_COMPTM")); - TMmethodconn = TMmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::TMmethodChanged) ); + TMmethod->append(M("TP_WAVELET_COMPCONT")); + TMmethod->append(M("TP_WAVELET_COMPTM")); + TMmethodconn = TMmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::TMmethodChanged)); ctboxTM->pack_start(*TMmethod); - resBox->pack_start (*ctboxTM); + resBox->pack_start(*ctboxTM); - tmrs->set_tooltip_text (M("TP_WAVELET_TMSTRENGTH_TOOLTIP")); + tmrs->set_tooltip_text(M("TP_WAVELET_TMSTRENGTH_TOOLTIP")); resBox->pack_start(*tmrs); - tmrs->setAdjusterListener (this); + tmrs->setAdjusterListener(this); - gamma->set_tooltip_text (M("TP_WAVELET_COMPGAMMA_TOOLTIP")); + gamma->set_tooltip_text(M("TP_WAVELET_COMPGAMMA_TOOLTIP")); resBox->pack_start(*gamma); - gamma->setAdjusterListener (this); + gamma->setAdjusterListener(this); - Gtk::HSeparator* const separatorR1 = Gtk::manage (new Gtk::HSeparator()); + //edgs->set_tooltip_text(M("TP_WAVELET_TMEDGS_TOOLTIP")); + + resBox->pack_start(*edgs); + edgs->setAdjusterListener(this); + + //scale->set_tooltip_text(M("TP_WAVELET_TMSCALE_TOOLTIP")); + + resBox->pack_start(*scale); + scale->setAdjusterListener(this); + + Gtk::HSeparator* const separatorR1 = Gtk::manage(new Gtk::HSeparator()); resBox->pack_start(*separatorR1, Gtk::PACK_SHRINK, 2); - hueskin2->set_tooltip_markup (M("TP_WAVELET_HUESKY_TOOLTIP")); + hueskin2->set_tooltip_markup(M("TP_WAVELET_HUESKY_TOOLTIP")); hueskin2->setBgGradient(milestones); - resBox->pack_start(*hueskin2); - hueskin2->setAdjusterListener (this); + hueskin2->setAdjusterListener(this); - sky->set_tooltip_text (M("TP_WAVELET_SKY_TOOLTIP")); - sky->setAdjusterListener (this); + sky->set_tooltip_text(M("TP_WAVELET_SKY_TOOLTIP")); + sky->setAdjusterListener(this); - resBox->pack_start(*sky); // whole hue range const std::vector milestones3 = makeWholeHueRange(); - curveEditorRES->setCurveListener (this); + curveEditorRES->setCurveListener(this); + resBox->pack_start(*chromaFrame); hhshape = static_cast(curveEditorRES->addCurve(CT_Flat, M("TP_WAVELET_CURVEEDITOR_HH"))); hhshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_HH_TOOLTIP")); @@ -688,54 +759,54 @@ Wavelet::Wavelet() : curveEditorRES->curveListComplete(); hhshape->setBottomBarBgGradient(milestones3); - resBox->pack_start (*curveEditorRES, Gtk::PACK_SHRINK, 4); + resBox->pack_start(*curveEditorRES, Gtk::PACK_SHRINK, 4); // Toning and Color Balance - Gtk::HSeparator* const separatorCB = Gtk::manage (new Gtk::HSeparator()); + Gtk::HSeparator* const separatorCB = Gtk::manage(new Gtk::HSeparator()); - Gtk::VBox* const chanMixerHLBox = Gtk::manage (new Gtk::VBox()); - Gtk::VBox* const chanMixerMidBox = Gtk::manage (new Gtk::VBox()); - Gtk::VBox* const chanMixerShadowsBox = Gtk::manage (new Gtk::VBox()); + Gtk::VBox* const chanMixerHLBox = Gtk::manage(new Gtk::VBox()); + Gtk::VBox* const chanMixerMidBox = Gtk::manage(new Gtk::VBox()); + Gtk::VBox* const chanMixerShadowsBox = Gtk::manage(new Gtk::VBox()); - cbenab->set_active (true); - cbenabConn = cbenab->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::cbenabToggled) ); - cbenab->set_tooltip_text (M("TP_WAVELET_CB_TOOLTIP")); + cbenab->set_active(true); + cbenabConn = cbenab->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::cbenabToggled)); + cbenab->set_tooltip_text(M("TP_WAVELET_CB_TOOLTIP")); - Gtk::Image* const iblueR = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* const iyelL = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* const imagL = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* const igreenR = Gtk::manage (new RTImage ("circle-green-small.png")); + Gtk::Image* const iblueR = Gtk::manage(new RTImage("circle-blue-small.png")); + Gtk::Image* const iyelL = Gtk::manage(new RTImage("circle-yellow-small.png")); + Gtk::Image* const imagL = Gtk::manage(new RTImage("circle-magenta-small.png")); + Gtk::Image* const igreenR = Gtk::manage(new RTImage("circle-green-small.png")); - Gtk::Image* const iblueRm = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* const iyelLm = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* const imagLm = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* const igreenRm = Gtk::manage (new RTImage ("circle-green-small.png")); + Gtk::Image* const iblueRm = Gtk::manage(new RTImage("circle-blue-small.png")); + Gtk::Image* const iyelLm = Gtk::manage(new RTImage("circle-yellow-small.png")); + Gtk::Image* const imagLm = Gtk::manage(new RTImage("circle-magenta-small.png")); + Gtk::Image* const igreenRm = Gtk::manage(new RTImage("circle-green-small.png")); - Gtk::Image* const iblueRh = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* const iyelLh = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* const imagLh = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* const igreenRh = Gtk::manage (new RTImage ("circle-green-small.png")); + Gtk::Image* const iblueRh = Gtk::manage(new RTImage("circle-blue-small.png")); + Gtk::Image* const iyelLh = Gtk::manage(new RTImage("circle-yellow-small.png")); + Gtk::Image* const imagLh = Gtk::manage(new RTImage("circle-magenta-small.png")); + Gtk::Image* const igreenRh = Gtk::manage(new RTImage("circle-green-small.png")); - greenhigh = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., igreenRh, imagLh)); - bluehigh = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., iblueRh, iyelLh)); - greenmed = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., igreenRm, imagLm)); - bluemed = Gtk::manage (new Adjuster ("", -100., 100., 1., 0. , iblueRm , iyelLm)); - greenlow = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., igreenR, imagL)); - bluelow = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., iblueR , iyelL)); + greenhigh = Gtk::manage(new Adjuster("", -100., 100., 1., 0., igreenRh, imagLh)); + bluehigh = Gtk::manage(new Adjuster("", -100., 100., 1., 0., iblueRh, iyelLh)); + greenmed = Gtk::manage(new Adjuster("", -100., 100., 1., 0., igreenRm, imagLm)); + bluemed = Gtk::manage(new Adjuster("", -100., 100., 1., 0., iblueRm, iyelLm)); + greenlow = Gtk::manage(new Adjuster("", -100., 100., 1., 0., igreenR, imagL)); + bluelow = Gtk::manage(new Adjuster("", -100., 100., 1., 0., iblueR, iyelL)); - chanMixerHLBox->pack_start (*greenhigh); - chanMixerHLBox->pack_start (*bluehigh); - chanMixerMidBox->pack_start (*greenmed); - chanMixerMidBox->pack_start (*bluemed); - chanMixerShadowsBox->pack_start (*greenlow); - chanMixerShadowsBox->pack_start (*bluelow); + chanMixerHLBox->pack_start(*greenhigh); + chanMixerHLBox->pack_start(*bluehigh); + chanMixerMidBox->pack_start(*greenmed); + chanMixerMidBox->pack_start(*bluemed); + chanMixerShadowsBox->pack_start(*greenlow); + chanMixerShadowsBox->pack_start(*bluelow); - greenlow->setAdjusterListener (this); - bluelow->setAdjusterListener (this); - greenmed->setAdjusterListener (this); - bluemed->setAdjusterListener (this); - greenhigh->setAdjusterListener (this); - bluehigh->setAdjusterListener (this); + greenlow->setAdjusterListener(this); + bluelow->setAdjusterListener(this); + greenmed->setAdjusterListener(this); + bluemed->setAdjusterListener(this); + greenhigh->setAdjusterListener(this); + bluehigh->setAdjusterListener(this); resBox->pack_start(*separatorCB, Gtk::PACK_SHRINK); @@ -751,15 +822,15 @@ Wavelet::Wavelet() : //RTImage *resetImg = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); //neutral->set_image(*resetImg); Gtk::Button* const neutral = Gtk::manage(new Gtk::Button(M("TP_COLORTONING_NEUTRAL"))); - neutral->set_tooltip_text (M("TP_COLORTONING_NEUTRAL_TIP")); - neutralconn = neutral->signal_pressed().connect( sigc::mem_fun(*this, &Wavelet::neutral_pressed) ); + neutral->set_tooltip_text(M("TP_COLORTONING_NEUTRAL_TIP")); + neutralconn = neutral->signal_pressed().connect(sigc::mem_fun(*this, &Wavelet::neutral_pressed)); neutral->show(); - neutrHBox->pack_start (*neutral, Gtk::PACK_EXPAND_WIDGET); + neutrHBox->pack_start(*neutral, Gtk::PACK_EXPAND_WIDGET); - resBox->pack_start (*neutrHBox); + resBox->pack_start(*neutrHBox); // Final Touchup - Gtk::VBox* const ctboxBA = Gtk::manage (new Gtk::VBox()); + Gtk::VBox* const ctboxBA = Gtk::manage(new Gtk::VBox()); ctboxBA->set_spacing(2); @@ -767,19 +838,20 @@ Wavelet::Wavelet() : //ctboxBA->pack_start(*separatorfin, Gtk::PACK_SHRINK, 2); Gtk::Label* const labmBA = Gtk::manage(new Gtk::Label(M("TP_WAVELET_BATYPE") + ":")); Gtk::HBox* const ctboxFI = Gtk::manage(new Gtk::HBox()); - ctboxFI->pack_start (*labmBA, Gtk::PACK_SHRINK, 1); + ctboxFI->pack_start(*labmBA, Gtk::PACK_SHRINK, 1); - BAmethod->append (M("TP_WAVELET_BANONE")); - BAmethod->append (M("TP_WAVELET_BASLI")); - BAmethod->append (M("TP_WAVELET_BACUR")); - BAmethodconn = BAmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::BAmethodChanged) ); + BAmethod->append(M("TP_WAVELET_BANONE")); + BAmethod->append(M("TP_WAVELET_BASLI")); + BAmethod->append(M("TP_WAVELET_BACUR")); + BAmethodconn = BAmethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::BAmethodChanged)); ctboxFI->pack_start(*BAmethod); ctboxBA->pack_start(*ctboxFI); - balance->setAdjusterListener (this); - balance->set_tooltip_text (M("TP_WAVELET_BALANCE_TOOLTIP")); + balance->setAdjusterListener(this); + balance->set_tooltip_text(M("TP_WAVELET_BALANCE_TOOLTIP")); + softradend->setAdjusterListener(this); - opacityCurveEditorW->setCurveListener (this); + opacityCurveEditorW->setCurveListener(this); opacityShape = static_cast(opacityCurveEditorW->addCurve(CT_Flat, "", nullptr, false, false)); opacityShape->setIdentityValue(0.); @@ -790,12 +862,12 @@ Wavelet::Wavelet() : opacityCurveEditorW->curveListComplete(); opacityCurveEditorW->show(); - iter->setAdjusterListener (this); - iter->set_tooltip_text (M("TP_WAVELET_ITER_TOOLTIP")); + iter->setAdjusterListener(this); + iter->set_tooltip_text(M("TP_WAVELET_ITER_TOOLTIP")); - Gtk::HSeparator* const separatorbalend = Gtk::manage (new Gtk::HSeparator()); + Gtk::HSeparator* const separatorbalend = Gtk::manage(new Gtk::HSeparator()); - opacityCurveEditorWL->setCurveListener (this); + opacityCurveEditorWL->setCurveListener(this); opacityShapeWL = static_cast(opacityCurveEditorWL->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeWL->setIdentityValue(0.); @@ -806,7 +878,7 @@ Wavelet::Wavelet() : opacityCurveEditorWL->curveListComplete(); opacityCurveEditorWL->show(); - curveEditorG->setCurveListener (this); + curveEditorG->setCurveListener(this); clshape = static_cast(curveEditorG->addCurve(CT_Diagonal, M("TP_WAVELET_CURVEEDITOR_CL"))); clshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_CL_TOOLTIP")); @@ -815,54 +887,62 @@ Wavelet::Wavelet() : curveEditorG->curveListComplete(); - tmr->set_active (true); - tmr->set_tooltip_text (M("TP_WAVELET_BALCHRO_TOOLTIP")); - tmrConn = tmr->signal_toggled().connect( sigc::mem_fun(*this, &Wavelet::tmrToggled) ); + tmr->set_active(true); + tmr->set_tooltip_text(M("TP_WAVELET_BALCHRO_TOOLTIP")); + tmrConn = tmr->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::tmrToggled)); - ToolParamBlock* const finalBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const finalBox = Gtk::manage(new ToolParamBlock()); - finalBox->pack_start (*ctboxBA); + finalBox->pack_start(*ctboxBA); finalBox->pack_start(*balance); - finalBox->pack_start( *opacityCurveEditorW, Gtk::PACK_SHRINK, 2); + finalBox->pack_start(*opacityCurveEditorW, Gtk::PACK_SHRINK, 2); finalBox->pack_start(*iter); finalBox->pack_start(*tmr); finalBox->pack_start(*separatorbalend, Gtk::PACK_SHRINK, 2); - finalBox->pack_start( *opacityCurveEditorWL, Gtk::PACK_SHRINK, 2); + finalBox->pack_start(*opacityCurveEditorWL, Gtk::PACK_SHRINK, 2); - finalBox->pack_start (*curveEditorG, Gtk::PACK_SHRINK, 4); + finalBox->pack_start(*curveEditorG, Gtk::PACK_SHRINK, 4); + finalBox->pack_start(*softradend); //----------------------------- + + expsettings->add(*settingsBox, false); expsettings->setLevel(2); - pack_start (*expsettings); + pack_start(*expsettings); expcontrast->add(*levBox, false); expcontrast->setLevel(2); - pack_start (*expcontrast); + pack_start(*expcontrast); expchroma->add(*chBox, false); expchroma->setLevel(2); - pack_start (*expchroma); - - exptoning->add(*tonBox, false); - exptoning->setLevel(2); - pack_start (*exptoning); - - expnoise->add(*noiseBox, false); - expnoise->setLevel(2); - pack_start (*expnoise); - - expedge->add(*edgBox, false); - expedge->setLevel(2); - pack_start (*expedge); + pack_start(*expchroma); expgamut->add(*conBox, false); expgamut->setLevel(2); - pack_start (*expgamut); + pack_start(*expgamut); + + exptoning->add(*tonBox, false); + exptoning->setLevel(2); + pack_start(*exptoning); + + expnoise->add(*noiseBox, false); + expnoise->setLevel(2); + pack_start(*expnoise); + + expedge->add(*edgBox, false); + expedge->setLevel(2); + pack_start(*expedge); + + expclari->add(*clariBox, false); + expclari->setLevel(2); + pack_start(*expclari); + expresid->add(*resBox, false); expresid->setLevel(2); @@ -873,7 +953,7 @@ Wavelet::Wavelet() : pack_start(*expfinal); } -Wavelet::~Wavelet () +Wavelet::~Wavelet() { idle_register.destroy(); @@ -888,27 +968,26 @@ Wavelet::~Wavelet () } -void Wavelet::wavChanged (double nlevel) +void Wavelet::wavChanged(double nlevel) { if (!batchMode) { idle_register.add( - [this, nlevel]() -> bool - { - wavLabels->set_text( - Glib::ustring::compose( - M("TP_WAVELET_LEVLABEL"), - Glib::ustring::format(std::fixed, std::setprecision(0), nlevel) - ) - ); - return false; - } + [this, nlevel]() -> bool { + wavLabels->set_text( + Glib::ustring::compose( + M("TP_WAVELET_LEVLABEL"), + Glib::ustring::format(std::fixed, std::setprecision(0), nlevel) + ) + ); + return false; + } ); } } // Will only reset the channel mixer // WARNING! In mutiImage mode, and for sliders in ADD mode, this will reset the slider to 0, but not to the default value as in SET mode. -void Wavelet::neutral_pressed () +void Wavelet::neutral_pressed() { disableListener(); greenlow->resetValue(false); @@ -921,11 +1000,11 @@ void Wavelet::neutral_pressed () enableListener(); if (listener && getEnabled()) { - listener->panelChanged (EvWavNeutral, M("GENERAL_RESET")); + listener->panelChanged(EvWavNeutral, M("GENERAL_RESET")); } } -void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) +void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) { /***************************************************************************************************** @@ -934,7 +1013,7 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) * *****************************************************************************************************/ - disableListener (); + disableListener(); Lmethodconn.block(true); CLmethodconn.block(true); Backmethodconn.block(true); @@ -949,6 +1028,7 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) TMmethodconn.block(true); HSmethodconn.block(true); MedgreinfConn.block(true); + ushamethodconn.block(true); cbenabConn.block(true); enableChromaConn.block(true); enableContrastConn.block(true); @@ -966,65 +1046,75 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) //HSmethod->set_active (1); // Note: default values are controlled in rtengine::ProcParams::SetDefaults if (pp->wavelet.HSmethod == "without") { - HSmethod->set_active (0); + HSmethod->set_active(0); } else if (pp->wavelet.HSmethod == "with") { - HSmethod->set_active (1); + HSmethod->set_active(1); } //CHmethod->set_active (1); if (pp->wavelet.CHmethod == "without") { - CHmethod->set_active (0); + CHmethod->set_active(0); } else if (pp->wavelet.CHmethod == "with") { - CHmethod->set_active (1); + CHmethod->set_active(1); } else if (pp->wavelet.CHmethod == "link") { - CHmethod->set_active (2); + CHmethod->set_active(2); } //Medgreinf->set_active (1); if (pp->wavelet.Medgreinf == "more") { - Medgreinf->set_active (0); + Medgreinf->set_active(0); } else if (pp->wavelet.Medgreinf == "none") { - Medgreinf->set_active (1); + Medgreinf->set_active(1); } else if (pp->wavelet.Medgreinf == "less") { - Medgreinf->set_active (2); + Medgreinf->set_active(2); + } + + //ushamethod +// if (pp->wavelet.ushamethod == "none") { +// ushamethod->set_active(0); +// } else + if (pp->wavelet.ushamethod == "sharp") { + ushamethod->set_active(0); + } else if (pp->wavelet.ushamethod == "clari") { + ushamethod->set_active(1); } //CHSLmethod->set_active (1); if (pp->wavelet.CHSLmethod == "SL") { - CHSLmethod->set_active (0); + CHSLmethod->set_active(0); } else if (pp->wavelet.CHSLmethod == "CU") { - CHSLmethod->set_active (1); + CHSLmethod->set_active(1); } //EDmethod->set_active (1); if (pp->wavelet.EDmethod == "SL") { - EDmethod->set_active (0); + EDmethod->set_active(0); } else if (pp->wavelet.EDmethod == "CU") { - EDmethod->set_active (1); + EDmethod->set_active(1); } if (pp->wavelet.NPmethod == "none") { - NPmethod->set_active (0); + NPmethod->set_active(0); } else if (pp->wavelet.NPmethod == "low") { - NPmethod->set_active (1); + NPmethod->set_active(1); } else if (pp->wavelet.NPmethod == "high") { - NPmethod->set_active (2); + NPmethod->set_active(2); } //BAmethod->set_active (0); if (pp->wavelet.BAmethod == "none") { - BAmethod->set_active (0); + BAmethod->set_active(0); } else if (pp->wavelet.BAmethod == "sli") { - BAmethod->set_active (1); + BAmethod->set_active(1); } else if (pp->wavelet.BAmethod == "cur") { - BAmethod->set_active (2); + BAmethod->set_active(2); } //TMmethod->set_active (1); if (pp->wavelet.TMmethod == "cont") { - TMmethod->set_active (0); + TMmethod->set_active(0); } else if (pp->wavelet.TMmethod == "tm") { - TMmethod->set_active (1); + TMmethod->set_active(1); } // else if (pp->wavelet.TMmethod=="both") @@ -1032,99 +1122,103 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) //Backmethod->set_active (3); if (pp->wavelet.Backmethod == "black") { - Backmethod->set_active (0); + Backmethod->set_active(0); } else if (pp->wavelet.Backmethod == "grey") { - Backmethod->set_active (1); + Backmethod->set_active(1); } else if (pp->wavelet.Backmethod == "resid") { - Backmethod->set_active (2); + Backmethod->set_active(2); } //CLmethod->set_active (3); if (pp->wavelet.CLmethod == "one") { - CLmethod->set_active (0); + CLmethod->set_active(0); } else if (pp->wavelet.CLmethod == "inf") { - CLmethod->set_active (1); + CLmethod->set_active(1); } else if (pp->wavelet.CLmethod == "sup") { - CLmethod->set_active (2); + CLmethod->set_active(2); } else if (pp->wavelet.CLmethod == "all") { - CLmethod->set_active (3); + CLmethod->set_active(3); } //Tilesmethod->set_active (2); if (pp->wavelet.Tilesmethod == "full") { - Tilesmethod->set_active (0); + Tilesmethod->set_active(0); } else if (pp->wavelet.Tilesmethod == "big") { - Tilesmethod->set_active (1); + Tilesmethod->set_active(1); } else if (pp->wavelet.Tilesmethod == "lit") { - Tilesmethod->set_active (2); + Tilesmethod->set_active(2); } //daubcoeffmethod->set_active (4); if (pp->wavelet.daubcoeffmethod == "2_") { - daubcoeffmethod->set_active (0); + daubcoeffmethod->set_active(0); } else if (pp->wavelet.daubcoeffmethod == "4_") { - daubcoeffmethod->set_active (1); + daubcoeffmethod->set_active(1); } else if (pp->wavelet.daubcoeffmethod == "6_") { - daubcoeffmethod->set_active (2); + daubcoeffmethod->set_active(2); } else if (pp->wavelet.daubcoeffmethod == "10_") { - daubcoeffmethod->set_active (3); + daubcoeffmethod->set_active(3); } else if (pp->wavelet.daubcoeffmethod == "14_") { - daubcoeffmethod->set_active (4); + daubcoeffmethod->set_active(4); } //Dirmethod->set_active (3); if (pp->wavelet.Dirmethod == "one") { - Dirmethod->set_active (0); + Dirmethod->set_active(0); } else if (pp->wavelet.Dirmethod == "two") { - Dirmethod->set_active (1); + Dirmethod->set_active(1); } else if (pp->wavelet.Dirmethod == "thr") { - Dirmethod->set_active (2); + Dirmethod->set_active(2); } else if (pp->wavelet.Dirmethod == "all") { - Dirmethod->set_active (3); + Dirmethod->set_active(3); } int selectedLevel = pp->wavelet.Lmethod - 1; - Lmethod->set_active (selectedLevel == -1 ? 4 : selectedLevel); + Lmethod->set_active(selectedLevel == -1 ? 4 : selectedLevel); - ccshape->setCurve (pp->wavelet.ccwcurve); - opacityShapeRG->setCurve (pp->wavelet.opacityCurveRG); - opacityShapeBY->setCurve (pp->wavelet.opacityCurveBY); - opacityShape->setCurve (pp->wavelet.opacityCurveW); - opacityShapeWL->setCurve (pp->wavelet.opacityCurveWL); - hhshape->setCurve (pp->wavelet.hhcurve); - Chshape->setCurve (pp->wavelet.Chcurve); - clshape->setCurve (pp->wavelet.wavclCurve); - expcontrast->setEnabled (pp->wavelet.expcontrast); - expchroma->setEnabled (pp->wavelet.expchroma); - expedge->setEnabled (pp->wavelet.expedge); - expresid->setEnabled (pp->wavelet.expresid); - expfinal->setEnabled (pp->wavelet.expfinal); - exptoning->setEnabled (pp->wavelet.exptoning); - expnoise->setEnabled (pp->wavelet.expnoise); + ccshape->setCurve(pp->wavelet.ccwcurve); + opacityShapeRG->setCurve(pp->wavelet.opacityCurveRG); + opacityShapeBY->setCurve(pp->wavelet.opacityCurveBY); + opacityShape->setCurve(pp->wavelet.opacityCurveW); + opacityShapeWL->setCurve(pp->wavelet.opacityCurveWL); + hhshape->setCurve(pp->wavelet.hhcurve); + Chshape->setCurve(pp->wavelet.Chcurve); + clshape->setCurve(pp->wavelet.wavclCurve); + expcontrast->setEnabled(pp->wavelet.expcontrast); + expchroma->setEnabled(pp->wavelet.expchroma); + expedge->setEnabled(pp->wavelet.expedge); + expresid->setEnabled(pp->wavelet.expresid); + expfinal->setEnabled(pp->wavelet.expfinal); + exptoning->setEnabled(pp->wavelet.exptoning); + expnoise->setEnabled(pp->wavelet.expnoise); + expclari->setEnabled(pp->wavelet.expclari); setEnabled(pp->wavelet.enabled); - avoidConn.block (true); - avoid->set_active (pp->wavelet.avoid); - avoidConn.block (false); - tmrConn.block (true); - tmr->set_active (pp->wavelet.tmr); - tmrConn.block (false); - medianConn.block (true); - median->set_active (pp->wavelet.median); - medianConn.block (false); - medianlevConn.block (true); - medianlev->set_active (pp->wavelet.medianlev); - medianlevConn.block (false); - linkedgConn.block (true); - linkedg->set_active (pp->wavelet.linkedg); - linkedgConn.block (false); - cbenabConn.block (true); - cbenab->set_active (pp->wavelet.cbenab); - cbenabConn.block (false); + avoidConn.block(true); + avoid->set_active(pp->wavelet.avoid); + avoidConn.block(false); + showmaskConn.block(true); + showmask->set_active(pp->wavelet.showmask); + showmaskConn.block(false); + tmrConn.block(true); + tmr->set_active(pp->wavelet.tmr); + tmrConn.block(false); + medianConn.block(true); + median->set_active(pp->wavelet.median); + medianConn.block(false); + medianlevConn.block(true); + medianlev->set_active(pp->wavelet.medianlev); + medianlevConn.block(false); + linkedgConn.block(true); + linkedg->set_active(pp->wavelet.linkedg); + linkedgConn.block(false); + cbenabConn.block(true); + cbenab->set_active(pp->wavelet.cbenab); + cbenabConn.block(false); - lipstConn.block (true); - lipst->set_active (pp->wavelet.lipst); - lipstConn.block (false); + lipstConn.block(true); + lipst->set_active(pp->wavelet.lipst); + lipstConn.block(false); //edgreinfConn.block (true); //edgreinf->set_active (pp->wavelet.edgreinf); //edgreinfConn.block (false); @@ -1135,23 +1229,28 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) lastcbenab = pp->wavelet.cbenab; lastlipst = pp->wavelet.lipst; lastavoid = pp->wavelet.avoid; + lastshowmask = pp->wavelet.showmask; lasttmr = pp->wavelet.tmr; - rescon->setValue (pp->wavelet.rescon); - resconH->setValue (pp->wavelet.resconH); - reschro->setValue (pp->wavelet.reschro); - tmrs->setValue (pp->wavelet.tmrs); - gamma->setValue (pp->wavelet.gamma); - sup->setValue (pp->wavelet.sup); - sky->setValue (pp->wavelet.sky); - thres->setValue (pp->wavelet.thres); - chroma->setValue (pp->wavelet.chroma); - chro->setValue (pp->wavelet.chro); - contrast->setValue (pp->wavelet.contrast); - edgrad->setValue (pp->wavelet.edgrad); - edgval->setValue (pp->wavelet.edgval); - edgthresh->setValue (pp->wavelet.edgthresh); - thr->setValue (pp->wavelet.thr); - thrH->setValue (pp->wavelet.thrH); + sigma->setValue(pp->wavelet.sigma); + rescon->setValue(pp->wavelet.rescon); + resconH->setValue(pp->wavelet.resconH); + reschro->setValue(pp->wavelet.reschro); + tmrs->setValue(pp->wavelet.tmrs); + edgs->setValue(pp->wavelet.edgs); + scale->setValue(pp->wavelet.scale); + gamma->setValue(pp->wavelet.gamma); + sup->setValue(pp->wavelet.sup); + sky->setValue(pp->wavelet.sky); + thres->setValue(pp->wavelet.thres); + chroma->setValue(pp->wavelet.chroma); + chro->setValue(pp->wavelet.chro); + contrast->setValue(pp->wavelet.contrast); + edgrad->setValue(pp->wavelet.edgrad); + edgval->setValue(pp->wavelet.edgval); + edgthresh->setValue(pp->wavelet.edgthresh); + thr->setValue(pp->wavelet.thr); + thrH->setValue(pp->wavelet.thrH); + radius->setValue(pp->wavelet.radius); skinprotect->setValue(pp->wavelet.skinprotect); hueskin->setValue(pp->wavelet.hueskin); hueskin2->setValue(pp->wavelet.hueskin2); @@ -1168,12 +1267,16 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) satlev->setValue(pp->wavelet.satlev); edgcont->setValue(pp->wavelet.edgcont); - greenlow->setValue (pp->wavelet.greenlow); - bluelow->setValue (pp->wavelet.bluelow); - greenmed->setValue (pp->wavelet.greenmed); - bluemed->setValue (pp->wavelet.bluemed); - greenhigh->setValue (pp->wavelet.greenhigh); - bluehigh->setValue (pp->wavelet.bluehigh); + greenlow->setValue(pp->wavelet.greenlow); + bluelow->setValue(pp->wavelet.bluelow); + greenmed->setValue(pp->wavelet.greenmed); + bluemed->setValue(pp->wavelet.bluemed); + greenhigh->setValue(pp->wavelet.greenhigh); + bluehigh->setValue(pp->wavelet.bluehigh); + mergeL->setValue(pp->wavelet.mergeL); + mergeC->setValue(pp->wavelet.mergeC); + softrad->setValue(pp->wavelet.softrad); + softradend->setValue(pp->wavelet.softradend); level0noise->setValue(pp->wavelet.level0noise); level1noise->setValue(pp->wavelet.level1noise); @@ -1254,83 +1357,97 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) Medgreinf->set_active_text(M("GENERAL_UNCHANGED")); } - set_inconsistent (multiImage && !pedited->wavelet.enabled); - ccshape->setUnChanged (!pedited->wavelet.ccwcurve); - expcontrast->set_inconsistent (!pedited->wavelet.expcontrast); - expchroma->set_inconsistent (!pedited->wavelet.expchroma); - expedge->set_inconsistent (!pedited->wavelet.expedge); - expresid->set_inconsistent (!pedited->wavelet.expresid); - expfinal->set_inconsistent (!pedited->wavelet.expfinal); - exptoning->set_inconsistent (!pedited->wavelet.exptoning); - expnoise->set_inconsistent (!pedited->wavelet.expnoise); - opacityShapeRG->setCurve (pp->wavelet.opacityCurveRG); - opacityShapeBY->setCurve (pp->wavelet.opacityCurveBY); - opacityShape->setCurve (pp->wavelet.opacityCurveW); - opacityShapeWL->setCurve (pp->wavelet.opacityCurveWL); - hhshape->setUnChanged (!pedited->wavelet.hhcurve); - Chshape->setUnChanged (!pedited->wavelet.Chcurve); - clshape->setUnChanged (!pedited->wavelet.wavclCurve); - avoid->set_inconsistent (!pedited->wavelet.avoid); - tmr->set_inconsistent (!pedited->wavelet.tmr); - edgthresh->setEditedState (pedited->wavelet.edgthresh ? Edited : UnEdited); - rescon->setEditedState (pedited->wavelet.rescon ? Edited : UnEdited); - resconH->setEditedState (pedited->wavelet.resconH ? Edited : UnEdited); - reschro->setEditedState (pedited->wavelet.reschro ? Edited : UnEdited); - tmrs->setEditedState (pedited->wavelet.tmrs ? Edited : UnEdited); - gamma->setEditedState (pedited->wavelet.gamma ? Edited : UnEdited); - sup->setEditedState (pedited->wavelet.sup ? Edited : UnEdited); - sky->setEditedState (pedited->wavelet.sky ? Edited : UnEdited); - thres->setEditedState (pedited->wavelet.thres ? Edited : UnEdited); - balance->setEditedState (pedited->wavelet.balance ? Edited : UnEdited); - iter->setEditedState (pedited->wavelet.iter ? Edited : UnEdited); - threshold->setEditedState (pedited->wavelet.threshold ? Edited : UnEdited); - threshold2->setEditedState (pedited->wavelet.threshold2 ? Edited : UnEdited); - edgedetect->setEditedState (pedited->wavelet.edgedetect ? Edited : UnEdited); - edgedetectthr->setEditedState (pedited->wavelet.edgedetectthr ? Edited : UnEdited); - edgedetectthr2->setEditedState (pedited->wavelet.edgedetectthr2 ? Edited : UnEdited); - edgesensi->setEditedState (pedited->wavelet.edgesensi ? Edited : UnEdited); - edgeampli->setEditedState (pedited->wavelet.edgeampli ? Edited : UnEdited); - chroma->setEditedState (pedited->wavelet.chroma ? Edited : UnEdited); - chro->setEditedState (pedited->wavelet.chro ? Edited : UnEdited); - - greenlow->setEditedState (pedited->wavelet.greenlow ? Edited : UnEdited); - bluelow->setEditedState (pedited->wavelet.bluelow ? Edited : UnEdited); - greenmed->setEditedState (pedited->wavelet.greenmed ? Edited : UnEdited); - bluemed->setEditedState (pedited->wavelet.bluemed ? Edited : UnEdited); - greenhigh->setEditedState (pedited->wavelet.greenhigh ? Edited : UnEdited); - bluehigh->setEditedState (pedited->wavelet.bluehigh ? Edited : UnEdited); - - median->set_inconsistent (!pedited->wavelet.median); - medianlev->set_inconsistent (!pedited->wavelet.medianlev); - linkedg->set_inconsistent (!pedited->wavelet.linkedg); -// edgreinf->set_inconsistent (!pedited->wavelet.edgreinf); - cbenab->set_inconsistent (!pedited->wavelet.cbenab); - lipst->set_inconsistent (!pedited->wavelet.lipst); - contrast->setEditedState (pedited->wavelet.contrast ? Edited : UnEdited); - edgrad->setEditedState (pedited->wavelet.edgrad ? Edited : UnEdited); - edgval->setEditedState (pedited->wavelet.edgval ? Edited : UnEdited); - thr->setEditedState (pedited->wavelet.thr ? Edited : UnEdited); - thrH->setEditedState (pedited->wavelet.thrH ? Edited : UnEdited); - skinprotect->setEditedState (pedited->wavelet.skinprotect ? Edited : UnEdited); - hueskin->setEditedState (pedited->wavelet.hueskin ? Edited : UnEdited); - hueskin2->setEditedState (pedited->wavelet.hueskin2 ? Edited : UnEdited); - hllev->setEditedState (pedited->wavelet.hllev ? Edited : UnEdited); - bllev->setEditedState (pedited->wavelet.bllev ? Edited : UnEdited); - pastlev->setEditedState (pedited->wavelet.pastlev ? Edited : UnEdited); - satlev->setEditedState (pedited->wavelet.satlev ? Edited : UnEdited); - strength->setEditedState(pedited->wavelet.strength ? Edited : UnEdited); - edgcont->setEditedState (pedited->wavelet.edgcont ? Edited : UnEdited); - level0noise->setEditedState (pedited->wavelet.level0noise ? Edited : UnEdited); - level1noise->setEditedState (pedited->wavelet.level1noise ? Edited : UnEdited); - level2noise->setEditedState (pedited->wavelet.level2noise ? Edited : UnEdited); - level3noise->setEditedState (pedited->wavelet.level3noise ? Edited : UnEdited); - - for(int i = 0; i < 9; i++) { - correction[i]->setEditedState (pedited->wavelet.c[i] ? Edited : UnEdited); + if (!pedited->wavelet.ushamethod) { + ushamethod->set_active_text(M("GENERAL_UNCHANGED")); } - for(int i = 0; i < 9; i++) { - correctionch[i]->setEditedState (pedited->wavelet.ch[i] ? Edited : UnEdited); + set_inconsistent(multiImage && !pedited->wavelet.enabled); + ccshape->setUnChanged(!pedited->wavelet.ccwcurve); + expcontrast->set_inconsistent(!pedited->wavelet.expcontrast); + expchroma->set_inconsistent(!pedited->wavelet.expchroma); + expedge->set_inconsistent(!pedited->wavelet.expedge); + expresid->set_inconsistent(!pedited->wavelet.expresid); + expfinal->set_inconsistent(!pedited->wavelet.expfinal); + expclari->set_inconsistent(!pedited->wavelet.expclari); + exptoning->set_inconsistent(!pedited->wavelet.exptoning); + expnoise->set_inconsistent(!pedited->wavelet.expnoise); + opacityShapeRG->setCurve(pp->wavelet.opacityCurveRG); + opacityShapeBY->setCurve(pp->wavelet.opacityCurveBY); + opacityShape->setCurve(pp->wavelet.opacityCurveW); + opacityShapeWL->setCurve(pp->wavelet.opacityCurveWL); + hhshape->setUnChanged(!pedited->wavelet.hhcurve); + Chshape->setUnChanged(!pedited->wavelet.Chcurve); + clshape->setUnChanged(!pedited->wavelet.wavclCurve); + avoid->set_inconsistent(!pedited->wavelet.avoid); + showmask->set_inconsistent(!pedited->wavelet.showmask); + tmr->set_inconsistent(!pedited->wavelet.tmr); + edgthresh->setEditedState(pedited->wavelet.edgthresh ? Edited : UnEdited); + rescon->setEditedState(pedited->wavelet.rescon ? Edited : UnEdited); + sigma->setEditedState(pedited->wavelet.sigma ? Edited : UnEdited); + resconH->setEditedState(pedited->wavelet.resconH ? Edited : UnEdited); + reschro->setEditedState(pedited->wavelet.reschro ? Edited : UnEdited); + tmrs->setEditedState(pedited->wavelet.tmrs ? Edited : UnEdited); + edgs->setEditedState(pedited->wavelet.edgs ? Edited : UnEdited); + scale->setEditedState(pedited->wavelet.scale ? Edited : UnEdited); + gamma->setEditedState(pedited->wavelet.gamma ? Edited : UnEdited); + sup->setEditedState(pedited->wavelet.sup ? Edited : UnEdited); + sky->setEditedState(pedited->wavelet.sky ? Edited : UnEdited); + thres->setEditedState(pedited->wavelet.thres ? Edited : UnEdited); + balance->setEditedState(pedited->wavelet.balance ? Edited : UnEdited); + iter->setEditedState(pedited->wavelet.iter ? Edited : UnEdited); + threshold->setEditedState(pedited->wavelet.threshold ? Edited : UnEdited); + threshold2->setEditedState(pedited->wavelet.threshold2 ? Edited : UnEdited); + edgedetect->setEditedState(pedited->wavelet.edgedetect ? Edited : UnEdited); + edgedetectthr->setEditedState(pedited->wavelet.edgedetectthr ? Edited : UnEdited); + edgedetectthr2->setEditedState(pedited->wavelet.edgedetectthr2 ? Edited : UnEdited); + edgesensi->setEditedState(pedited->wavelet.edgesensi ? Edited : UnEdited); + edgeampli->setEditedState(pedited->wavelet.edgeampli ? Edited : UnEdited); + chroma->setEditedState(pedited->wavelet.chroma ? Edited : UnEdited); + chro->setEditedState(pedited->wavelet.chro ? Edited : UnEdited); + + greenlow->setEditedState(pedited->wavelet.greenlow ? Edited : UnEdited); + bluelow->setEditedState(pedited->wavelet.bluelow ? Edited : UnEdited); + greenmed->setEditedState(pedited->wavelet.greenmed ? Edited : UnEdited); + bluemed->setEditedState(pedited->wavelet.bluemed ? Edited : UnEdited); + greenhigh->setEditedState(pedited->wavelet.greenhigh ? Edited : UnEdited); + bluehigh->setEditedState(pedited->wavelet.bluehigh ? Edited : UnEdited); + mergeL->setEditedState(pedited->wavelet.mergeL ? Edited : UnEdited); + mergeC->setEditedState(pedited->wavelet.mergeC ? Edited : UnEdited); + softrad->setEditedState(pedited->wavelet.softrad ? Edited : UnEdited); + softradend->setEditedState(pedited->wavelet.softradend ? Edited : UnEdited); + + median->set_inconsistent(!pedited->wavelet.median); + medianlev->set_inconsistent(!pedited->wavelet.medianlev); + linkedg->set_inconsistent(!pedited->wavelet.linkedg); +// edgreinf->set_inconsistent (!pedited->wavelet.edgreinf); + cbenab->set_inconsistent(!pedited->wavelet.cbenab); + lipst->set_inconsistent(!pedited->wavelet.lipst); + contrast->setEditedState(pedited->wavelet.contrast ? Edited : UnEdited); + edgrad->setEditedState(pedited->wavelet.edgrad ? Edited : UnEdited); + edgval->setEditedState(pedited->wavelet.edgval ? Edited : UnEdited); + thr->setEditedState(pedited->wavelet.thr ? Edited : UnEdited); + thrH->setEditedState(pedited->wavelet.thrH ? Edited : UnEdited); + radius->setEditedState(pedited->wavelet.radius ? Edited : UnEdited); + skinprotect->setEditedState(pedited->wavelet.skinprotect ? Edited : UnEdited); + hueskin->setEditedState(pedited->wavelet.hueskin ? Edited : UnEdited); + hueskin2->setEditedState(pedited->wavelet.hueskin2 ? Edited : UnEdited); + hllev->setEditedState(pedited->wavelet.hllev ? Edited : UnEdited); + bllev->setEditedState(pedited->wavelet.bllev ? Edited : UnEdited); + pastlev->setEditedState(pedited->wavelet.pastlev ? Edited : UnEdited); + satlev->setEditedState(pedited->wavelet.satlev ? Edited : UnEdited); + strength->setEditedState(pedited->wavelet.strength ? Edited : UnEdited); + edgcont->setEditedState(pedited->wavelet.edgcont ? Edited : UnEdited); + level0noise->setEditedState(pedited->wavelet.level0noise ? Edited : UnEdited); + level1noise->setEditedState(pedited->wavelet.level1noise ? Edited : UnEdited); + level2noise->setEditedState(pedited->wavelet.level2noise ? Edited : UnEdited); + level3noise->setEditedState(pedited->wavelet.level3noise ? Edited : UnEdited); + + for (int i = 0; i < 9; i++) { + correction[i]->setEditedState(pedited->wavelet.c[i] ? Edited : UnEdited); + } + + for (int i = 0; i < 9; i++) { + correctionch[i]->setEditedState(pedited->wavelet.ch[i] ? Edited : UnEdited); } } @@ -1345,20 +1462,20 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) y = thres->getValue(); int z; - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correction[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correction[z]->show(); } if (pp->wavelet.CHSLmethod == "SL") { - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correctionch[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correctionch[z]->show(); } } @@ -1374,16 +1491,16 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) TMmethodUpdateUI(); //BackmethodUpdateUI(); CLmethodUpdateUI(); - lipstUpdateUI (); + lipstUpdateUI(); //TilesmethodUpdateUI(); //daubcoeffmethodUpdateUI(); //DirmethodUpdateUI(); //LmethodUpdateUI(); - enabledUpdateUI (); - medianlevUpdateUI (); - cbenabUpdateUI (); + enabledUpdateUI(); + medianlevUpdateUI(); + cbenabUpdateUI(); - if(z == 9) { + if (z == 9) { sup->show(); } else { sup->hide(); @@ -1410,6 +1527,7 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) HSmethodconn.block(false); Dirmethodconn.block(false); MedgreinfConn.block(false); + ushamethodconn.block(false); enableChromaConn.block(false); enableContrastConn.block(false); enableEdgeConn.block(false); @@ -1418,10 +1536,10 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) enableResidConn.block(false); enableToningConn.block(false); - enableListener (); + enableListener(); } -void Wavelet::setEditProvider (EditDataProvider *provider) +void Wavelet::setEditProvider(EditDataProvider *provider) { ccshape->setEditProvider(provider); opacityShapeRG->setEditProvider(provider); @@ -1433,41 +1551,46 @@ void Wavelet::setEditProvider (EditDataProvider *provider) clshape->setEditProvider(provider); } -void Wavelet::autoOpenCurve () +void Wavelet::autoOpenCurve() { ccshape->openIfNonlinear(); //opacityShapeRG->openIfNonlinear(); //opacityShapeBY->openIfNonlinear(); } -void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) +void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) { pp->wavelet.enabled = getEnabled(); - pp->wavelet.avoid = avoid->get_active (); - pp->wavelet.tmr = tmr->get_active (); + pp->wavelet.avoid = avoid->get_active(); + pp->wavelet.showmask = showmask->get_active(); + pp->wavelet.tmr = tmr->get_active(); + pp->wavelet.sigma = sigma->getValue(); pp->wavelet.rescon = rescon->getValue(); pp->wavelet.resconH = resconH->getValue(); pp->wavelet.reschro = reschro->getValue(); pp->wavelet.tmrs = tmrs->getValue(); + pp->wavelet.edgs = edgs->getValue(); + pp->wavelet.scale = scale->getValue(); pp->wavelet.gamma = gamma->getValue(); pp->wavelet.sup = sup->getValue(); pp->wavelet.sky = sky->getValue(); pp->wavelet.thres = thres->getValue(); pp->wavelet.chroma = chroma->getValue(); pp->wavelet.chro = chro->getValue(); - pp->wavelet.median = median->get_active (); - pp->wavelet.medianlev = medianlev->get_active (); - pp->wavelet.linkedg = linkedg->get_active (); + pp->wavelet.median = median->get_active(); + pp->wavelet.medianlev = medianlev->get_active(); + pp->wavelet.linkedg = linkedg->get_active(); // pp->wavelet.edgreinf = edgreinf->get_active (); - pp->wavelet.cbenab = cbenab->get_active (); - pp->wavelet.lipst = lipst->get_active (); + pp->wavelet.cbenab = cbenab->get_active(); + pp->wavelet.lipst = lipst->get_active(); pp->wavelet.contrast = contrast->getValue(); pp->wavelet.edgrad = edgrad->getValue(); pp->wavelet.edgval = edgval->getValue(); pp->wavelet.edgthresh = edgthresh->getValue(); pp->wavelet.thr = thr->getValue(); pp->wavelet.thrH = thrH->getValue(); + pp->wavelet.radius = radius->getValue(); pp->wavelet.hueskin = hueskin->getValue (); pp->wavelet.hueskin2 = hueskin2->getValue (); pp->wavelet.skinprotect = skinprotect->getValue(); @@ -1485,24 +1608,28 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pp->wavelet.level1noise = level1noise->getValue (); pp->wavelet.level2noise = level2noise->getValue (); pp->wavelet.level3noise = level3noise->getValue (); - pp->wavelet.ccwcurve = ccshape->getCurve (); - pp->wavelet.opacityCurveRG = opacityShapeRG->getCurve (); - pp->wavelet.opacityCurveBY = opacityShapeBY->getCurve (); - pp->wavelet.opacityCurveW = opacityShape->getCurve (); - pp->wavelet.opacityCurveWL = opacityShapeWL->getCurve (); - pp->wavelet.hhcurve = hhshape->getCurve (); - pp->wavelet.Chcurve = Chshape->getCurve (); + pp->wavelet.ccwcurve = ccshape->getCurve(); + pp->wavelet.opacityCurveRG = opacityShapeRG->getCurve(); + pp->wavelet.opacityCurveBY = opacityShapeBY->getCurve(); + pp->wavelet.opacityCurveW = opacityShape->getCurve(); + pp->wavelet.opacityCurveWL = opacityShapeWL->getCurve(); + pp->wavelet.hhcurve = hhshape->getCurve(); + pp->wavelet.Chcurve = Chshape->getCurve(); pp->wavelet.pastlev = pastlev->getValue (); pp->wavelet.satlev = satlev->getValue (); pp->wavelet.strength = (int) strength->getValue(); pp->wavelet.balance = (int) balance->getValue(); - pp->wavelet.greenlow = greenlow->getValue (); - pp->wavelet.bluelow = bluelow->getValue (); - pp->wavelet.greenmed = greenmed->getValue (); - pp->wavelet.bluemed = bluemed->getValue (); - pp->wavelet.greenhigh = greenhigh->getValue (); - pp->wavelet.bluehigh = bluehigh->getValue (); + pp->wavelet.greenlow = greenlow->getValue(); + pp->wavelet.bluelow = bluelow->getValue(); + pp->wavelet.greenmed = greenmed->getValue(); + pp->wavelet.bluemed = bluemed->getValue(); + pp->wavelet.greenhigh = greenhigh->getValue(); + pp->wavelet.bluehigh = bluehigh->getValue(); + pp->wavelet.mergeL = mergeL->getValue(); + pp->wavelet.mergeC = mergeC->getValue(); + pp->wavelet.softrad = softrad->getValue(); + pp->wavelet.softradend = softradend->getValue(); pp->wavelet.expcontrast = expcontrast->getEnabled(); pp->wavelet.expchroma = expchroma->getEnabled(); pp->wavelet.expedge = expedge->getEnabled(); @@ -1510,9 +1637,10 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pp->wavelet.expfinal = expfinal->getEnabled(); pp->wavelet.exptoning = exptoning->getEnabled(); pp->wavelet.expnoise = expnoise->getEnabled(); + pp->wavelet.expclari = expclari->getEnabled(); pp->wavelet.iter = (int) iter->getValue(); - pp->wavelet.wavclCurve = clshape->getCurve (); + pp->wavelet.wavclCurve = clshape->getCurve(); for (int i = 0; i < 9; i++) { pp->wavelet.c[i] = (int) correction[i]->getValue(); @@ -1525,6 +1653,7 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) if (pedited) { pedited->wavelet.enabled = !get_inconsistent(); pedited->wavelet.avoid = !avoid->get_inconsistent(); + pedited->wavelet.showmask = !showmask->get_inconsistent(); pedited->wavelet.tmr = !tmr->get_inconsistent(); pedited->wavelet.median = !median->get_inconsistent(); pedited->wavelet.medianlev = !medianlev->get_inconsistent(); @@ -1532,6 +1661,7 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pedited->wavelet.cbenab = !cbenab->get_inconsistent(); pedited->wavelet.lipst = !lipst->get_inconsistent(); pedited->wavelet.Medgreinf = Medgreinf->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->wavelet.ushamethod = ushamethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->wavelet.Lmethod = Lmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->wavelet.CLmethod = CLmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->wavelet.Backmethod = Backmethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -1546,10 +1676,13 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pedited->wavelet.HSmethod = HSmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->wavelet.Dirmethod = Dirmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->wavelet.edgthresh = edgthresh->getEditedState(); + pedited->wavelet.sigma = sigma->getEditedState(); pedited->wavelet.rescon = rescon->getEditedState(); pedited->wavelet.resconH = resconH->getEditedState(); pedited->wavelet.reschro = reschro->getEditedState(); pedited->wavelet.tmrs = tmrs->getEditedState(); + pedited->wavelet.edgs = edgs->getEditedState(); + pedited->wavelet.scale = scale->getEditedState(); pedited->wavelet.gamma = gamma->getEditedState(); pedited->wavelet.sup = sup->getEditedState(); pedited->wavelet.sky = sky->getEditedState(); @@ -1568,35 +1701,40 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pedited->wavelet.edgval = edgval->getEditedState(); pedited->wavelet.thr = thr->getEditedState(); pedited->wavelet.thrH = thrH->getEditedState(); - pedited->wavelet.hueskin = hueskin->getEditedState (); - pedited->wavelet.hueskin2 = hueskin2->getEditedState (); + pedited->wavelet.radius = radius->getEditedState(); + pedited->wavelet.hueskin = hueskin->getEditedState(); + pedited->wavelet.hueskin2 = hueskin2->getEditedState(); pedited->wavelet.skinprotect = skinprotect->getEditedState(); - pedited->wavelet.hllev = hllev->getEditedState (); - pedited->wavelet.ccwcurve = !ccshape->isUnChanged (); - pedited->wavelet.edgcont = edgcont->getEditedState (); - pedited->wavelet.level0noise = level0noise->getEditedState (); - pedited->wavelet.level1noise = level1noise->getEditedState (); - pedited->wavelet.level2noise = level2noise->getEditedState (); - pedited->wavelet.level3noise = level3noise->getEditedState (); - pedited->wavelet.opacityCurveRG = !opacityShapeRG->isUnChanged (); - pedited->wavelet.opacityCurveBY = !opacityShapeBY->isUnChanged (); - pedited->wavelet.opacityCurveW = !opacityShape->isUnChanged (); - pedited->wavelet.opacityCurveWL = !opacityShapeWL->isUnChanged (); - pedited->wavelet.hhcurve = !hhshape->isUnChanged (); - pedited->wavelet.Chcurve = !Chshape->isUnChanged (); - pedited->wavelet.bllev = bllev->getEditedState (); - pedited->wavelet.pastlev = pastlev->getEditedState (); - pedited->wavelet.satlev = satlev->getEditedState (); - pedited->wavelet.strength = strength->getEditedState (); - pedited->wavelet.greenlow = greenlow->getEditedState (); - pedited->wavelet.bluelow = bluelow->getEditedState (); - pedited->wavelet.greenmed = greenmed->getEditedState (); - pedited->wavelet.bluemed = bluemed->getEditedState (); - pedited->wavelet.greenhigh = greenhigh->getEditedState (); - pedited->wavelet.bluehigh = bluehigh->getEditedState (); - pedited->wavelet.balance = balance->getEditedState (); - pedited->wavelet.iter = iter->getEditedState (); - pedited->wavelet.wavclCurve = !clshape->isUnChanged (); + pedited->wavelet.hllev = hllev->getEditedState(); + pedited->wavelet.ccwcurve = !ccshape->isUnChanged(); + pedited->wavelet.edgcont = edgcont->getEditedState(); + pedited->wavelet.level0noise = level0noise->getEditedState(); + pedited->wavelet.level1noise = level1noise->getEditedState(); + pedited->wavelet.level2noise = level2noise->getEditedState(); + pedited->wavelet.level3noise = level3noise->getEditedState(); + pedited->wavelet.opacityCurveRG = !opacityShapeRG->isUnChanged(); + pedited->wavelet.opacityCurveBY = !opacityShapeBY->isUnChanged(); + pedited->wavelet.opacityCurveW = !opacityShape->isUnChanged(); + pedited->wavelet.opacityCurveWL = !opacityShapeWL->isUnChanged(); + pedited->wavelet.hhcurve = !hhshape->isUnChanged(); + pedited->wavelet.Chcurve = !Chshape->isUnChanged(); + pedited->wavelet.bllev = bllev->getEditedState(); + pedited->wavelet.pastlev = pastlev->getEditedState(); + pedited->wavelet.satlev = satlev->getEditedState(); + pedited->wavelet.strength = strength->getEditedState(); + pedited->wavelet.greenlow = greenlow->getEditedState(); + pedited->wavelet.bluelow = bluelow->getEditedState(); + pedited->wavelet.greenmed = greenmed->getEditedState(); + pedited->wavelet.bluemed = bluemed->getEditedState(); + pedited->wavelet.greenhigh = greenhigh->getEditedState(); + pedited->wavelet.bluehigh = bluehigh->getEditedState(); + pedited->wavelet.mergeL = mergeL->getEditedState(); + pedited->wavelet.mergeC = mergeC->getEditedState(); + pedited->wavelet.softrad = softrad->getEditedState(); + pedited->wavelet.softradend = softradend->getEditedState(); + pedited->wavelet.balance = balance->getEditedState(); + pedited->wavelet.iter = iter->getEditedState(); + pedited->wavelet.wavclCurve = !clshape->isUnChanged(); pedited->wavelet.expcontrast = !expcontrast->get_inconsistent(); pedited->wavelet.expchroma = !expchroma->get_inconsistent(); pedited->wavelet.expedge = !expedge->get_inconsistent(); @@ -1604,12 +1742,13 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pedited->wavelet.expfinal = !expfinal->get_inconsistent(); pedited->wavelet.exptoning = !exptoning->get_inconsistent(); pedited->wavelet.expnoise = !expnoise->get_inconsistent(); + pedited->wavelet.expclari = !expclari->get_inconsistent(); - for(int i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { pedited->wavelet.c[i] = correction[i]->getEditedState(); } - for(int i = 0; i < 9; i++) { + for (int i = 0; i < 9; i++) { pedited->wavelet.ch[i] = correctionch[i]->getEditedState(); } @@ -1631,6 +1770,15 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pp->wavelet.Medgreinf = "less"; } +// if (ushamethod->get_active_row_number() == 0) { +// pp->wavelet.ushamethod = "none"; +// } else + if (ushamethod->get_active_row_number() == 0) { + pp->wavelet.ushamethod = "sharp"; + } else if (ushamethod->get_active_row_number() == 1) { + pp->wavelet.ushamethod = "clari"; + } + if (CHSLmethod->get_active_row_number() == 0) { pp->wavelet.CHSLmethod = "SL"; } else if (CHSLmethod->get_active_row_number() == 1) { @@ -1725,31 +1873,31 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) pp->wavelet.Lmethod = Lmethod->get_active_row_number() + 1; } -void Wavelet::curveChanged (CurveEditor* ce) +void Wavelet::curveChanged(CurveEditor* ce) { if (listener && getEnabled()) { if (ce == ccshape) { - listener->panelChanged (EvWavCCCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavCCCurve, M("HISTORY_CUSTOMCURVE")); } else if (ce == opacityShapeRG) { - listener->panelChanged (EvWavColor, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavColor, M("HISTORY_CUSTOMCURVE")); } else if (ce == opacityShapeBY) { - listener->panelChanged (EvWavOpac, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavOpac, M("HISTORY_CUSTOMCURVE")); } else if (ce == opacityShape) { - listener->panelChanged (EvWavopacity, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavopacity, M("HISTORY_CUSTOMCURVE")); } else if (ce == opacityShapeWL) { - listener->panelChanged (EvWavopacityWL, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavopacityWL, M("HISTORY_CUSTOMCURVE")); } else if (ce == hhshape) { - listener->panelChanged (EvWavHHCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavHHCurve, M("HISTORY_CUSTOMCURVE")); } else if (ce == Chshape) { - listener->panelChanged (EvWavCHCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavCHCurve, M("HISTORY_CUSTOMCURVE")); } else if (ce == clshape) { - listener->panelChanged (EvWavCLCurve, M("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvWavCLCurve, M("HISTORY_CUSTOMCURVE")); } } } -void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) +void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedited) { for (int i = 0; i < 9; i++) { @@ -1760,32 +1908,36 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi correctionch[i]->setDefault(defParams->wavelet.ch[i]); } - strength->setDefault(defParams->wavelet.strength ); - balance->setDefault(defParams->wavelet.balance ); - iter->setDefault(defParams->wavelet.iter ); - rescon->setDefault (defParams->wavelet.rescon); - resconH->setDefault (defParams->wavelet.resconH); - reschro->setDefault (defParams->wavelet.reschro); - tmrs->setDefault (defParams->wavelet.tmrs); - gamma->setDefault (defParams->wavelet.gamma); - sup->setDefault (defParams->wavelet.sup); - sky->setDefault (defParams->wavelet.sky); - thres->setDefault (defParams->wavelet.thres); - threshold->setDefault (defParams->wavelet.threshold); - threshold2->setDefault (defParams->wavelet.threshold2); - edgedetect->setDefault (defParams->wavelet.edgedetect); - edgedetectthr->setDefault (defParams->wavelet.edgedetectthr); - edgedetectthr2->setDefault (defParams->wavelet.edgedetectthr2); - edgesensi->setDefault (defParams->wavelet.edgesensi); - edgeampli->setDefault (defParams->wavelet.edgeampli); - chroma->setDefault (defParams->wavelet.chroma); - chro->setDefault (defParams->wavelet.chro); - contrast->setDefault (defParams->wavelet.contrast); - edgrad->setDefault (defParams->wavelet.edgrad); - edgval->setDefault (defParams->wavelet.edgval); - edgthresh->setDefault (defParams->wavelet.edgthresh); - thr->setDefault (defParams->wavelet.thr); - thrH->setDefault (defParams->wavelet.thrH); + strength->setDefault(defParams->wavelet.strength); + balance->setDefault(defParams->wavelet.balance); + iter->setDefault(defParams->wavelet.iter); + sigma->setDefault(defParams->wavelet.sigma); + rescon->setDefault(defParams->wavelet.rescon); + resconH->setDefault(defParams->wavelet.resconH); + reschro->setDefault(defParams->wavelet.reschro); + tmrs->setDefault(defParams->wavelet.tmrs); + edgs->setDefault(defParams->wavelet.edgs); + scale->setDefault(defParams->wavelet.scale); + gamma->setDefault(defParams->wavelet.gamma); + sup->setDefault(defParams->wavelet.sup); + sky->setDefault(defParams->wavelet.sky); + thres->setDefault(defParams->wavelet.thres); + threshold->setDefault(defParams->wavelet.threshold); + threshold2->setDefault(defParams->wavelet.threshold2); + edgedetect->setDefault(defParams->wavelet.edgedetect); + edgedetectthr->setDefault(defParams->wavelet.edgedetectthr); + edgedetectthr2->setDefault(defParams->wavelet.edgedetectthr2); + edgesensi->setDefault(defParams->wavelet.edgesensi); + edgeampli->setDefault(defParams->wavelet.edgeampli); + chroma->setDefault(defParams->wavelet.chroma); + chro->setDefault(defParams->wavelet.chro); + contrast->setDefault(defParams->wavelet.contrast); + edgrad->setDefault(defParams->wavelet.edgrad); + edgval->setDefault(defParams->wavelet.edgval); + edgthresh->setDefault(defParams->wavelet.edgthresh); + thr->setDefault(defParams->wavelet.thr); + thrH->setDefault(defParams->wavelet.thrH); + radius->setDefault(defParams->wavelet.radius); hueskin->setDefault (defParams->wavelet.hueskin); hueskin2->setDefault (defParams->wavelet.hueskin2); hllev->setDefault (defParams->wavelet.hllev); @@ -1798,27 +1950,38 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi level2noise->setDefault (defParams->wavelet.level2noise); level3noise->setDefault (defParams->wavelet.level3noise); - greenlow->setDefault (defParams->wavelet.greenlow); - bluelow->setDefault (defParams->wavelet.bluelow); - greenmed->setDefault (defParams->wavelet.greenmed); - bluemed->setDefault (defParams->wavelet.bluemed); - greenhigh->setDefault (defParams->wavelet.greenhigh); - bluehigh->setDefault (defParams->wavelet.bluehigh); + greenlow->setDefault(defParams->wavelet.greenlow); + bluelow->setDefault(defParams->wavelet.bluelow); + greenmed->setDefault(defParams->wavelet.greenmed); + bluemed->setDefault(defParams->wavelet.bluemed); + greenhigh->setDefault(defParams->wavelet.greenhigh); + bluehigh->setDefault(defParams->wavelet.bluehigh); + mergeL->setDefault(defParams->wavelet.mergeL); + mergeC->setDefault(defParams->wavelet.mergeC); + softrad->setDefault(defParams->wavelet.softrad); + softradend->setDefault(defParams->wavelet.softradend); if (pedited) { - greenlow->setDefaultEditedState (pedited->wavelet.greenlow ? Edited : UnEdited); - bluelow->setDefaultEditedState (pedited->wavelet.bluelow ? Edited : UnEdited); - greenmed->setDefaultEditedState (pedited->wavelet.greenmed ? Edited : UnEdited); - bluemed->setDefaultEditedState (pedited->wavelet.bluemed ? Edited : UnEdited); - greenhigh->setDefaultEditedState (pedited->wavelet.greenhigh ? Edited : UnEdited); - bluehigh->setDefaultEditedState (pedited->wavelet.bluehigh ? Edited : UnEdited); + greenlow->setDefaultEditedState(pedited->wavelet.greenlow ? Edited : UnEdited); + bluelow->setDefaultEditedState(pedited->wavelet.bluelow ? Edited : UnEdited); + greenmed->setDefaultEditedState(pedited->wavelet.greenmed ? Edited : UnEdited); + bluemed->setDefaultEditedState(pedited->wavelet.bluemed ? Edited : UnEdited); + greenhigh->setDefaultEditedState(pedited->wavelet.greenhigh ? Edited : UnEdited); + bluehigh->setDefaultEditedState(pedited->wavelet.bluehigh ? Edited : UnEdited); + mergeL->setDefaultEditedState(pedited->wavelet.mergeL ? Edited : UnEdited); + mergeC->setDefaultEditedState(pedited->wavelet.mergeC ? Edited : UnEdited); + softrad->setDefaultEditedState(pedited->wavelet.softrad ? Edited : UnEdited); + softradend->setDefaultEditedState(pedited->wavelet.softradend ? Edited : UnEdited); - rescon->setDefault (defParams->wavelet.rescon); - resconH->setDefault (defParams->wavelet.resconH); - reschro->setDefault (defParams->wavelet.reschro); - tmrs->setDefault (defParams->wavelet.tmrs); - gamma->setDefault (defParams->wavelet.gamma); - sup->setDefault (defParams->wavelet.sup); + sigma->setDefault(defParams->wavelet.sigma); + rescon->setDefault(defParams->wavelet.rescon); + resconH->setDefault(defParams->wavelet.resconH); + reschro->setDefault(defParams->wavelet.reschro); + tmrs->setDefault(defParams->wavelet.tmrs); + edgs->setDefault(defParams->wavelet.edgs); + scale->setDefault(defParams->wavelet.scale); + gamma->setDefault(defParams->wavelet.gamma); + sup->setDefault(defParams->wavelet.sup); sky->setDefaultEditedState(pedited->wavelet.sky ? Edited : UnEdited); thres->setDefaultEditedState(pedited->wavelet.thres ? Edited : UnEdited); threshold->setDefaultEditedState(pedited->wavelet.threshold ? Edited : UnEdited); @@ -1833,9 +1996,10 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi contrast->setDefaultEditedState(pedited->wavelet.contrast ? Edited : UnEdited); edgrad->setDefaultEditedState(pedited->wavelet.edgrad ? Edited : UnEdited); edgval->setDefaultEditedState(pedited->wavelet.edgval ? Edited : UnEdited); - edgthresh->setDefault (defParams->wavelet.edgthresh); + edgthresh->setDefault(defParams->wavelet.edgthresh); thr->setDefaultEditedState(pedited->wavelet.thr ? Edited : UnEdited); thrH->setDefaultEditedState(pedited->wavelet.thrH ? Edited : UnEdited); + radius->setDefaultEditedState(pedited->wavelet.radius ? Edited : UnEdited); skinprotect->setDefaultEditedState(pedited->wavelet.skinprotect ? Edited : UnEdited); hueskin->setDefaultEditedState(pedited->wavelet.hueskin ? Edited : UnEdited); hueskin2->setDefaultEditedState(pedited->wavelet.hueskin2 ? Edited : UnEdited); @@ -1860,10 +2024,13 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi correctionch[i]->setDefaultEditedState(pedited->wavelet.ch[i] ? Edited : UnEdited); } } else { + sigma->setDefaultEditedState(Irrelevant); rescon->setDefaultEditedState(Irrelevant); resconH->setDefaultEditedState(Irrelevant); reschro->setDefaultEditedState(Irrelevant); tmrs->setDefaultEditedState(Irrelevant); + edgs->setDefaultEditedState(Irrelevant); + scale->setDefaultEditedState(Irrelevant); gamma->setDefaultEditedState(Irrelevant); sup->setDefaultEditedState(Irrelevant); sky->setDefaultEditedState(Irrelevant); @@ -1883,21 +2050,22 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi edgthresh->setDefaultEditedState(Irrelevant); thr->setDefaultEditedState(Irrelevant); thrH->setDefaultEditedState(Irrelevant); + radius->setDefaultEditedState(Irrelevant); skinprotect->setDefaultEditedState(Irrelevant); - hueskin->setDefaultEditedState (Irrelevant); - hueskin2->setDefaultEditedState (Irrelevant); - hllev->setDefaultEditedState (Irrelevant); - bllev->setDefaultEditedState (Irrelevant); - edgcont->setDefaultEditedState (Irrelevant); - level0noise->setDefaultEditedState (Irrelevant); - level1noise->setDefaultEditedState (Irrelevant); - level2noise->setDefaultEditedState (Irrelevant); - level3noise->setDefaultEditedState (Irrelevant); - pastlev->setDefaultEditedState (Irrelevant); - satlev->setDefaultEditedState (Irrelevant); - strength->setDefaultEditedState (Irrelevant); - balance->setDefaultEditedState (Irrelevant); - iter->setDefaultEditedState (Irrelevant); + hueskin->setDefaultEditedState(Irrelevant); + hueskin2->setDefaultEditedState(Irrelevant); + hllev->setDefaultEditedState(Irrelevant); + bllev->setDefaultEditedState(Irrelevant); + edgcont->setDefaultEditedState(Irrelevant); + level0noise->setDefaultEditedState(Irrelevant); + level1noise->setDefaultEditedState(Irrelevant); + level2noise->setDefaultEditedState(Irrelevant); + level3noise->setDefaultEditedState(Irrelevant); + pastlev->setDefaultEditedState(Irrelevant); + satlev->setDefaultEditedState(Irrelevant); + strength->setDefaultEditedState(Irrelevant); + balance->setDefaultEditedState(Irrelevant); + iter->setDefaultEditedState(Irrelevant); for (int i = 0; i < 9; i++) { correction[i]->setDefaultEditedState(Irrelevant); @@ -1911,19 +2079,19 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi void Wavelet::adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) { - if (listener && (multiImage || getEnabled()) ) { - if(a == level0noise) { - listener->panelChanged (EvWavlev0nois, - Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); - } else if(a == level1noise) { - listener->panelChanged (EvWavlev1nois, - Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); - } else if(a == level2noise) { - listener->panelChanged (EvWavlev2nois, - Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); - } else if(a == level3noise) { - listener->panelChanged (EvWavlev3nois, - Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); + if (listener && (multiImage || getEnabled())) { + if (a == level0noise) { + listener->panelChanged(EvWavlev0nois, + Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); + } else if (a == level1noise) { + listener->panelChanged(EvWavlev1nois, + Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); + } else if (a == level2noise) { + listener->panelChanged(EvWavlev2nois, + Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); + } else if (a == level3noise) { + listener->panelChanged(EvWavlev3nois, + Glib::ustring::compose(Glib::ustring(M("TP_WAVELET_NOIS") + ": %1" + "\n" + M("TP_WAVELET_STREN") + ": %2"), int(newTop), int(newBottom))); } } @@ -1943,21 +2111,21 @@ void Wavelet::adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTo void Wavelet::adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) { - if (listener && (multiImage || getEnabled()) ) { - if(a == hueskin) { - listener->panelChanged (EvWavHueskin, hueskin->getHistoryString()); - } else if(a == hueskin2) { - listener->panelChanged (EvWavHueskin2, hueskin2->getHistoryString()); - } else if(a == hllev) { - listener->panelChanged (EvWavlhl, hllev->getHistoryString()); - } else if(a == bllev) { - listener->panelChanged (EvWavlbl, bllev->getHistoryString()); - } else if(a == pastlev) { - listener->panelChanged (EvWavpast, pastlev->getHistoryString()); - } else if(a == satlev) { - listener->panelChanged (EvWavsat, satlev->getHistoryString()); - } else if(a == edgcont) { - listener->panelChanged (EvWavedgcont, edgcont->getHistoryString()); + if (listener && (multiImage || getEnabled())) { + if (a == hueskin) { + listener->panelChanged(EvWavHueskin, hueskin->getHistoryString()); + } else if (a == hueskin2) { + listener->panelChanged(EvWavHueskin2, hueskin2->getHistoryString()); + } else if (a == hllev) { + listener->panelChanged(EvWavlhl, hllev->getHistoryString()); + } else if (a == bllev) { + listener->panelChanged(EvWavlbl, bllev->getHistoryString()); + } else if (a == pastlev) { + listener->panelChanged(EvWavpast, pastlev->getHistoryString()); + } else if (a == satlev) { + listener->panelChanged(EvWavsat, satlev->getHistoryString()); + } else if (a == edgcont) { + listener->panelChanged(EvWavedgcont, edgcont->getHistoryString()); } } } @@ -1965,7 +2133,7 @@ void Wavelet::adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL void Wavelet::HSmethodUpdateUI() { if (!batchMode) { - if(HSmethod->get_active_row_number() == 0) { //without + if (HSmethod->get_active_row_number() == 0) { //without hllev->hide(); bllev->hide(); threshold->hide(); @@ -1983,15 +2151,15 @@ void Wavelet::HSmethodChanged() { HSmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavHSmet, HSmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavHSmet, HSmethod->get_active_text()); } } void Wavelet::CHmethodUpdateUI() { if (!batchMode) { - if(CHmethod->get_active_row_number() == 0) { + if (CHmethod->get_active_row_number() == 0) { CHSLmethod->show(); pastlev->hide(); satlev->hide(); @@ -2003,14 +2171,14 @@ void Wavelet::CHmethodUpdateUI() int y = thres->getValue(); int z; - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correctionch[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correctionch[z]->show(); } - } else if(CHmethod->get_active_row_number() == 1) { + } else if (CHmethod->get_active_row_number() == 1) { CHSLmethod->show(); pastlev->show(); satlev->show(); @@ -2022,11 +2190,11 @@ void Wavelet::CHmethodUpdateUI() int y = thres->getValue(); int z; - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correctionch[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correctionch[z]->show(); } } else { @@ -2050,8 +2218,8 @@ void Wavelet::CHmethodChanged() { CHmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavCHmet, CHmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavCHmet, CHmethod->get_active_text()); } } @@ -2090,10 +2258,10 @@ void Wavelet::CHSLmethodChanged() void Wavelet::EDmethodUpdateUI() { if (!batchMode) { - if(EDmethod->get_active_row_number() == 0 ) { //SL + if (EDmethod->get_active_row_number() == 0) { //SL CCWcurveEditorG->hide(); edgcont->show(); - } else if(EDmethod->get_active_row_number() == 1) { //CU + } else if (EDmethod->get_active_row_number() == 1) { //CU CCWcurveEditorG->show(); edgcont->hide(); } @@ -2103,8 +2271,8 @@ void Wavelet::EDmethodChanged() { EDmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavEDmet, EDmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavEDmet, EDmethod->get_active_text()); } } @@ -2118,8 +2286,8 @@ void Wavelet::NPmethodChanged() { NPmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavNPmet, NPmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavNPmet, NPmethod->get_active_text()); } } @@ -2128,16 +2296,16 @@ void Wavelet::NPmethodChanged() void Wavelet::BAmethodUpdateUI() { if (!batchMode) { - if(BAmethod->get_active_row_number() == 0 ) { //none + if (BAmethod->get_active_row_number() == 0) { //none balance->hide(); opacityCurveEditorW->hide(); iter->hide(); - } else if(BAmethod->get_active_row_number() == 1) { //sli + } else if (BAmethod->get_active_row_number() == 1) { //sli opacityCurveEditorW->hide(); balance->show(); iter->show(); - } else if(BAmethod->get_active_row_number() == 2) { //CU + } else if (BAmethod->get_active_row_number() == 2) { //CU opacityCurveEditorW->show(); balance->hide(); iter->show(); @@ -2148,8 +2316,8 @@ void Wavelet::BAmethodChanged() { BAmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavBAmet, BAmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavBAmet, BAmethod->get_active_text()); } } @@ -2166,14 +2334,22 @@ void Wavelet::TMmethodUpdateUI() } } */ + if (TMmethod->get_active_row_number() == 1) { + edgs->show(); + scale->show(); + } else if (TMmethod->get_active_row_number() == 0) { + edgs->hide(); + scale->hide(); + } + } void Wavelet::TMmethodChanged() { TMmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavTMmet, TMmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavTMmet, TMmethod->get_active_text()); } } @@ -2187,8 +2363,8 @@ void Wavelet::BackmethodUpdateUI() { void Wavelet::BackmethodChanged() { //BackmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavBackmet, Backmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavBackmet, Backmethod->get_active_text()); } } @@ -2196,19 +2372,19 @@ void Wavelet::CLmethodUpdateUI() { if (!batchMode) { if (CLmethod->get_active_row_number() == 0) { - CLmethod->set_active (0); + CLmethod->set_active(0); Lmethod->set_sensitive(true); Dirmethod->set_sensitive(true); } else if (CLmethod->get_active_row_number() == 1) { - CLmethod->set_active (1); + CLmethod->set_active(1); Lmethod->set_sensitive(true); Dirmethod->set_sensitive(true); } else if (CLmethod->get_active_row_number() == 2) { - CLmethod->set_active (2); + CLmethod->set_active(2); Lmethod->set_sensitive(true); Dirmethod->set_sensitive(true); } else if (CLmethod->get_active_row_number() == 3) { - CLmethod->set_active (3); + CLmethod->set_active(3); Lmethod->set_sensitive(false); Dirmethod->set_sensitive(false); } @@ -2219,8 +2395,8 @@ void Wavelet::CLmethodChanged() { CLmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavCLmet, CLmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavCLmet, CLmethod->get_active_text()); } } @@ -2231,11 +2407,57 @@ void Wavelet::TilesmethodUpdateUI() { } */ + +void Wavelet::ushamethodChanged() +{ + if (ushamethod->get_active_row_number() == 1 && expclari->getEnabled() == true) { + Backmethod->set_active(2); + CLmethod->set_active(2); + Lmethod->set_active(6); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + Dirmethod->set_active(3); + CLmethod->set_sensitive(false); + Backmethod->set_sensitive(false); + } else if (ushamethod->get_active_row_number() == 0 && expclari->getEnabled() == true) { + Backmethod->set_active(0); + CLmethod->set_active(1); + Lmethod->set_active(2); + Dirmethod->set_active(3); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + CLmethod->set_sensitive(false); + Backmethod->set_sensitive(false); + /* } else if (ushamethod->get_active_row_number() == 0 || expclari->getEnabled() == false) { + Backmethod->set_active(1); + CLmethod->set_active(3); + Lmethod->set_active(3); + Dirmethod->set_active(3); + Lmethod->set_sensitive(false); + Dirmethod->set_sensitive(false); + */ + } else if (expclari->getEnabled() == false) { + Backmethod->set_active(1); + CLmethod->set_active(3); + Lmethod->set_active(3); + Dirmethod->set_active(3); + Lmethod->set_sensitive(false); + Dirmethod->set_sensitive(false); + CLmethod->set_sensitive(true); + Backmethod->set_sensitive(true); + } + + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavushamet, ushamethod->get_active_text()); + } +} + + void Wavelet::TilesmethodChanged() { //TilesmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavTilesmet, Tilesmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavTilesmet, Tilesmethod->get_active_text()); } } @@ -2247,8 +2469,8 @@ void Wavelet::daubcoeffmethodUpdateUI() { void Wavelet::daubcoeffmethodChanged() { //daubcoeffmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavdaubcoeffmet, daubcoeffmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavdaubcoeffmet, daubcoeffmethod->get_active_text()); } } @@ -2261,8 +2483,8 @@ void Wavelet::MedgreinfUpdateUI() { void Wavelet::MedgreinfChanged() { //MedgreinfUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavedgreinf, Medgreinf->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavedgreinf, Medgreinf->get_active_text()); } } @@ -2275,8 +2497,8 @@ void Wavelet::DirmethodUpdateUI() { void Wavelet::DirmethodChanged() { //DirmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavDirmeto, Dirmethod->get_active_text ()); + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavDirmeto, Dirmethod->get_active_text()); } } @@ -2289,74 +2511,91 @@ void Wavelet::LmethodUpdateUI() { void Wavelet::LmethodChanged() { //LmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavLmet, Lmethod->get_active_text ()); + if (ushamethod->get_active_row_number() == 0 && expclari->getEnabled() == true) { + if (Lmethod->get_active_row_number() > 3) { + Lmethod->set_active(3); + } + } + + if (ushamethod->get_active_row_number() == 1 && expclari->getEnabled() == true) { + if (Lmethod->get_active_row_number() < 4) { + Lmethod->set_active(4); + } + } + + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvWavLmet, Lmethod->get_active_text()); } } -void Wavelet::setBatchMode (bool batchMode) +void Wavelet::setBatchMode(bool batchMode) { - Lmethod->append (M("GENERAL_UNCHANGED")); - CLmethod->append (M("GENERAL_UNCHANGED")); - Backmethod->append (M("GENERAL_UNCHANGED")); - Tilesmethod->append (M("GENERAL_UNCHANGED")); - daubcoeffmethod->append (M("GENERAL_UNCHANGED")); - CHmethod->append (M("GENERAL_UNCHANGED")); - Medgreinf->append (M("GENERAL_UNCHANGED")); - CHSLmethod->append (M("GENERAL_UNCHANGED")); - EDmethod->append (M("GENERAL_UNCHANGED")); - NPmethod->append (M("GENERAL_UNCHANGED")); - BAmethod->append (M("GENERAL_UNCHANGED")); - TMmethod->append (M("GENERAL_UNCHANGED")); - HSmethod->append (M("GENERAL_UNCHANGED")); - Dirmethod->append (M("GENERAL_UNCHANGED")); - CCWcurveEditorG->setBatchMode (batchMode); - opaCurveEditorG->setBatchMode (batchMode); - opacityCurveEditorG->setBatchMode (batchMode); - opacityCurveEditorW->setBatchMode (batchMode); - opacityCurveEditorWL->setBatchMode (batchMode); - curveEditorRES->setBatchMode (batchMode); - curveEditorGAM->setBatchMode (batchMode); - rescon->showEditedCB (); - resconH->showEditedCB (); - reschro->showEditedCB (); - tmrs->showEditedCB (); - gamma->showEditedCB (); - sup->showEditedCB (); - sky->showEditedCB (); - thres->showEditedCB (); - threshold->showEditedCB (); - threshold2->showEditedCB (); - edgedetect->showEditedCB (); - edgedetectthr->showEditedCB (); - edgedetectthr2->showEditedCB (); - edgesensi->showEditedCB (); - edgeampli->showEditedCB (); - chroma->showEditedCB (); - chro->showEditedCB (); - contrast->showEditedCB (); - edgrad->showEditedCB (); - edgval->showEditedCB (); - edgthresh->showEditedCB (); - thr->showEditedCB (); - thrH->showEditedCB (); + Lmethod->append(M("GENERAL_UNCHANGED")); + CLmethod->append(M("GENERAL_UNCHANGED")); + Backmethod->append(M("GENERAL_UNCHANGED")); + Tilesmethod->append(M("GENERAL_UNCHANGED")); + daubcoeffmethod->append(M("GENERAL_UNCHANGED")); + CHmethod->append(M("GENERAL_UNCHANGED")); + Medgreinf->append(M("GENERAL_UNCHANGED")); + ushamethod->append(M("GENERAL_UNCHANGED")); + CHSLmethod->append(M("GENERAL_UNCHANGED")); + EDmethod->append(M("GENERAL_UNCHANGED")); + NPmethod->append(M("GENERAL_UNCHANGED")); + BAmethod->append(M("GENERAL_UNCHANGED")); + TMmethod->append(M("GENERAL_UNCHANGED")); + HSmethod->append(M("GENERAL_UNCHANGED")); + Dirmethod->append(M("GENERAL_UNCHANGED")); + CCWcurveEditorG->setBatchMode(batchMode); + opaCurveEditorG->setBatchMode(batchMode); + opacityCurveEditorG->setBatchMode(batchMode); + opacityCurveEditorW->setBatchMode(batchMode); + opacityCurveEditorWL->setBatchMode(batchMode); + curveEditorRES->setBatchMode(batchMode); + curveEditorGAM->setBatchMode(batchMode); + sigma->showEditedCB(); + rescon->showEditedCB(); + resconH->showEditedCB(); + reschro->showEditedCB(); + tmrs->showEditedCB(); + edgs->showEditedCB(); + scale->showEditedCB(); + gamma->showEditedCB(); + sup->showEditedCB(); + sky->showEditedCB(); + thres->showEditedCB(); + threshold->showEditedCB(); + threshold2->showEditedCB(); + edgedetect->showEditedCB(); + edgedetectthr->showEditedCB(); + edgedetectthr2->showEditedCB(); + edgesensi->showEditedCB(); + edgeampli->showEditedCB(); + chroma->showEditedCB(); + chro->showEditedCB(); + contrast->showEditedCB(); + edgrad->showEditedCB(); + edgval->showEditedCB(); + edgthresh->showEditedCB(); + thr->showEditedCB(); + thrH->showEditedCB(); + radius->showEditedCB(); skinprotect->showEditedCB(); - hueskin->showEditedCB (); - hueskin2->showEditedCB (); - hllev->showEditedCB (); - bllev->showEditedCB (); - pastlev->showEditedCB (); - satlev->showEditedCB (); - edgcont->showEditedCB (); - strength->showEditedCB (); - balance->showEditedCB (); - iter->showEditedCB (); - level0noise->showEditedCB (); - level1noise->showEditedCB (); - level2noise->showEditedCB (); - level3noise->showEditedCB (); + hueskin->showEditedCB(); + hueskin2->showEditedCB(); + hllev->showEditedCB(); + bllev->showEditedCB(); + pastlev->showEditedCB(); + satlev->showEditedCB(); + edgcont->showEditedCB(); + strength->showEditedCB(); + balance->showEditedCB(); + iter->showEditedCB(); + level0noise->showEditedCB(); + level1noise->showEditedCB(); + level2noise->showEditedCB(); + level3noise->showEditedCB(); - ToolPanel::setBatchMode (batchMode); + ToolPanel::setBatchMode(batchMode); for (int i = 0; i < 9; i++) { correction[i]->showEditedCB(); @@ -2367,170 +2606,196 @@ void Wavelet::setBatchMode (bool batchMode) } } -void Wavelet::adjusterUpdateUI (Adjuster* a) +void Wavelet::adjusterUpdateUI(Adjuster* a) { /* - if (!batchMode) { - if (a == tmrs ) { - float tm; - tm=tmrs->getValue(); - if(tm==0.f) tmr->hide(); - else tmr->show(); - } - else if (a == gamma ) { - float tm; - tm=tmrs->getValue(); - if(tm==0.f) tmr->hide(); - else tmr->show(); - ); - } - } + if (!batchMode) { + if (a == tmrs ) { + float tm; + tm=tmrs->getValue(); + if(tm==0.f) tmr->hide(); + else tmr->show(); + } + else if (a == gamma ) { + float tm; + tm=tmrs->getValue(); + if(tm==0.f) tmr->hide(); + else tmr->show(); + + } + } */ } void Wavelet::adjusterChanged(Adjuster* a, double newval) { - if (listener && (multiImage || getEnabled()) ) { + if (listener && (multiImage || getEnabled())) { if (a == edgthresh) { - listener->panelChanged (EvWavtiles, edgthresh->getTextValue()); - } else if (a == rescon ) { - listener->panelChanged (EvWavrescon, rescon->getTextValue()); - } else if (a == resconH ) { - listener->panelChanged (EvWavresconH, resconH->getTextValue()); - } else if (a == reschro ) { - listener->panelChanged (EvWavreschro, reschro->getTextValue()); - } else if (a == tmrs ) { + listener->panelChanged(EvWavtiles, edgthresh->getTextValue()); + } else if (a == rescon) { + listener->panelChanged(EvWavrescon, rescon->getTextValue()); + } else if (a == sigma) { + listener->panelChanged(EvWavsigma, sigma->getTextValue()); + } else if (a == resconH) { + listener->panelChanged(EvWavresconH, resconH->getTextValue()); + } else if (a == reschro) { + listener->panelChanged(EvWavreschro, reschro->getTextValue()); + } else if (a == tmrs) { adjusterUpdateUI(a); - listener->panelChanged (EvWavtmrs, tmrs->getTextValue()); - } else if (a == gamma ) { + listener->panelChanged(EvWavtmrs, tmrs->getTextValue()); + + if (tmrs->getValue() != 0 && TMmethod->get_active_row_number() == 1) { + edgs->show(); + scale->show(); + } else if (TMmethod->get_active_row_number() == 0) { + edgs->hide(); + scale->hide(); + } + } else if (a == gamma) { adjusterUpdateUI(a); - listener->panelChanged (EvWavgamma, gamma->getTextValue()); - } else if (a == sky ) { - listener->panelChanged (EvWavsky, sky->getTextValue()); - } else if (a == sup ) { - listener->panelChanged (EvWavsup, sup->getTextValue()); - } else if (a == chroma ) { - listener->panelChanged (EvWavchroma, chroma->getTextValue()); - } else if (a == chro ) { - listener->panelChanged (EvWavchro, chro->getTextValue()); - } else if (a == contrast ) { - listener->panelChanged (EvWavunif, contrast->getTextValue()); - } else if (a == thr ) { - listener->panelChanged (EvWavthr, thr->getTextValue()); - } else if (a == thrH ) { - listener->panelChanged (EvWavthrH, thrH->getTextValue()); - } else if (a == threshold ) { - listener->panelChanged (EvWavThreshold, threshold->getTextValue()); - } else if (a == threshold2 ) { - listener->panelChanged (EvWavThreshold2, threshold2->getTextValue()); - } else if (a == edgedetect ) { - listener->panelChanged (EvWavedgedetect, edgedetect->getTextValue()); - } else if (a == edgedetectthr ) { - listener->panelChanged (EvWavedgedetectthr, edgedetectthr->getTextValue()); - } else if (a == edgedetectthr2 ) { - listener->panelChanged (EvWavedgedetectthr2, edgedetectthr2->getTextValue()); - } else if (a == edgesensi ) { - listener->panelChanged (EvWavedgesensi, edgesensi->getTextValue()); - } else if (a == edgeampli ) { - listener->panelChanged (EvWavedgeampli, edgeampli->getTextValue()); - } else if (a == edgrad ) { - listener->panelChanged (EvWavedgrad, edgrad->getTextValue()); - } else if (a == edgval ) { - listener->panelChanged (EvWavedgval, edgval->getTextValue()); - } else if (a == thres ) { + listener->panelChanged(EvWavgamma, gamma->getTextValue()); + } else if (a == edgs) { + adjusterUpdateUI(a); + listener->panelChanged(EvWavedgs, edgs->getTextValue()); + } else if (a == scale) { + adjusterUpdateUI(a); + listener->panelChanged(EvWavscale, scale->getTextValue()); + } else if (a == sky) { + listener->panelChanged(EvWavsky, sky->getTextValue()); + } else if (a == sup) { + listener->panelChanged(EvWavsup, sup->getTextValue()); + } else if (a == chroma) { + listener->panelChanged(EvWavchroma, chroma->getTextValue()); + } else if (a == chro) { + listener->panelChanged(EvWavchro, chro->getTextValue()); + } else if (a == contrast) { + listener->panelChanged(EvWavunif, contrast->getTextValue()); + } else if (a == thr) { + listener->panelChanged(EvWavthr, thr->getTextValue()); + } else if (a == thrH) { + listener->panelChanged(EvWavthrH, thrH->getTextValue()); + } else if (a == radius) { + listener->panelChanged(EvWavradius, radius->getTextValue()); + } else if (a == threshold) { + listener->panelChanged(EvWavThreshold, threshold->getTextValue()); + } else if (a == threshold2) { + listener->panelChanged(EvWavThreshold2, threshold2->getTextValue()); + } else if (a == edgedetect) { + listener->panelChanged(EvWavedgedetect, edgedetect->getTextValue()); + } else if (a == edgedetectthr) { + listener->panelChanged(EvWavedgedetectthr, edgedetectthr->getTextValue()); + } else if (a == edgedetectthr2) { + listener->panelChanged(EvWavedgedetectthr2, edgedetectthr2->getTextValue()); + } else if (a == edgesensi) { + listener->panelChanged(EvWavedgesensi, edgesensi->getTextValue()); + } else if (a == edgeampli) { + listener->panelChanged(EvWavedgeampli, edgeampli->getTextValue()); + } else if (a == edgrad) { + listener->panelChanged(EvWavedgrad, edgrad->getTextValue()); + } else if (a == edgval) { + listener->panelChanged(EvWavedgval, edgval->getTextValue()); + } else if (a == thres) { int y = thres->getValue(); int z; - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correction[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correction[z]->show(); } - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correctionch[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correctionch[z]->show(); } - if(z == 9) { + if (z == 9) { sup->show(); } else { sup->hide(); } - listener->panelChanged (EvWavthres, thres->getTextValue()); + listener->panelChanged(EvWavthres, thres->getTextValue()); } else if (a == skinprotect) { - listener->panelChanged (EvWavSkin, skinprotect->getTextValue()); + listener->panelChanged(EvWavSkin, skinprotect->getTextValue()); } else if (a == strength) { - listener->panelChanged (EvWavStrength, strength->getTextValue()); + listener->panelChanged(EvWavStrength, strength->getTextValue()); } else if (a == balance) { - listener->panelChanged (EvWavbalance, balance->getTextValue()); + listener->panelChanged(EvWavbalance, balance->getTextValue()); } else if (a == iter) { - listener->panelChanged (EvWaviter, iter->getTextValue()); - } else if (a == greenhigh ) { - listener->panelChanged (EvWavgreenhigh, greenhigh->getTextValue()); - } else if (a == bluehigh ) { - listener->panelChanged (EvWavbluehigh, bluehigh->getTextValue()); - } else if (a == greenmed ) { - listener->panelChanged (EvWavgreenmed, greenmed->getTextValue()); - } else if (a == bluemed ) { - listener->panelChanged (EvWavbluemed, bluemed->getTextValue()); - } else if (a == greenlow ) { - listener->panelChanged (EvWavgreenlow, greenlow->getTextValue()); - } else if (a == bluelow ) { - listener->panelChanged (EvWavbluelow, bluelow->getTextValue()); + listener->panelChanged(EvWaviter, iter->getTextValue()); + } else if (a == greenhigh) { + listener->panelChanged(EvWavgreenhigh, greenhigh->getTextValue()); + } else if (a == bluehigh) { + listener->panelChanged(EvWavbluehigh, bluehigh->getTextValue()); + } else if (a == mergeL) { + listener->panelChanged(EvWavmergeL, mergeL->getTextValue()); + } else if (a == mergeC) { + listener->panelChanged(EvWavmergeC, mergeC->getTextValue()); + } else if (a == softrad) { + listener->panelChanged(EvWavsoftrad, softrad->getTextValue()); + } else if (a == softradend) { + listener->panelChanged(EvWavsoftradend, softradend->getTextValue()); + } else if (a == greenmed) { + listener->panelChanged(EvWavgreenmed, greenmed->getTextValue()); + } else if (a == bluemed) { + listener->panelChanged(EvWavbluemed, bluemed->getTextValue()); + } else if (a == greenlow) { + listener->panelChanged(EvWavgreenlow, greenlow->getTextValue()); + } else if (a == bluelow) { + listener->panelChanged(EvWavbluelow, bluelow->getTextValue()); } if ((a == correction[0] || a == correction[1] || a == correction[2] || a == correction[3] || a == correction[4] || a == correction[5] || a == correction[6] || a == correction[7] || a == correction[8])) { - listener->panelChanged (EvWavelet, - Glib::ustring::compose("%1, %2, %3, %4, %5, %6, %7, %8, %9", - Glib::ustring::format(std::fixed, std::setprecision(0), correction[0]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[1]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[2]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[3]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[4]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[5]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[6]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[7]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correction[8]->getValue())) - ); - } else if (a == correctionch[0] || a == correctionch[1] || a == correctionch[2] || a == correctionch[3] || a == correctionch[4] || a == correctionch[5] || a == correctionch[6] || a == correctionch[7] || a == correctionch[8] ) { - listener->panelChanged (EvWaveletch, - Glib::ustring::compose("%1, %2, %3, %4, %5, %6, %7, %8, %9", - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[0]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[1]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[2]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[3]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[4]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[5]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[6]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[7]->getValue()), - Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[8]->getValue())) - ); + listener->panelChanged(EvWavelet, + Glib::ustring::compose("%1, %2, %3, %4, %5, %6, %7, %8, %9", + Glib::ustring::format(std::fixed, std::setprecision(0), correction[0]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[1]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[2]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[3]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[4]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[5]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[6]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[7]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correction[8]->getValue())) + ); + } else if (a == correctionch[0] || a == correctionch[1] || a == correctionch[2] || a == correctionch[3] || a == correctionch[4] || a == correctionch[5] || a == correctionch[6] || a == correctionch[7] || a == correctionch[8]) { + listener->panelChanged(EvWaveletch, + Glib::ustring::compose("%1, %2, %3, %4, %5, %6, %7, %8, %9", + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[0]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[1]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[2]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[3]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[4]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[5]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[6]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[7]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), correctionch[8]->getValue())) + ); } } } -void Wavelet::enabledUpdateUI () +void Wavelet::enabledUpdateUI() { if (!batchMode) { int y = thres->getValue(); int z; - for(z = y; z < 9; z++) { + for (z = y; z < 9; z++) { correction[z]->hide(); } - for(z = 0; z < y; z++) { + for (z = 0; z < y; z++) { correction[z]->show(); } - if(z == 9) { + if (z == 9) { sup->show(); } else { sup->hide(); @@ -2540,52 +2805,52 @@ void Wavelet::enabledUpdateUI () } } -void Wavelet::enabledChanged () +void Wavelet::enabledChanged() { enabledUpdateUI(); if (listener) { if (get_inconsistent()) { - listener->panelChanged (EvWavEnabled, M("GENERAL_UNCHANGED")); + listener->panelChanged(EvWavEnabled, M("GENERAL_UNCHANGED")); } else if (getEnabled()) { - listener->panelChanged (EvWavEnabled, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavEnabled, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavEnabled, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavEnabled, M("GENERAL_DISABLED")); } } } -void Wavelet::medianToggled () +void Wavelet::medianToggled() { if (multiImage) { if (median->get_inconsistent()) { - median->set_inconsistent (false); - medianConn.block (true); - median->set_active (false); - medianConn.block (false); + median->set_inconsistent(false); + medianConn.block(true); + median->set_active(false); + medianConn.block(false); } else if (lastmedian) { - median->set_inconsistent (true); + median->set_inconsistent(true); } - lastmedian = median->get_active (); + lastmedian = median->get_active(); } - if (listener && (multiImage || getEnabled ())) { + if (listener && (multiImage || getEnabled())) { if (median->get_inconsistent()) { - listener->panelChanged (EvWavmedian, M("GENERAL_UNCHANGED")); - } else if (median->get_active ()) { - listener->panelChanged (EvWavmedian, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavmedian, M("GENERAL_UNCHANGED")); + } else if (median->get_active()) { + listener->panelChanged(EvWavmedian, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavmedian, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavmedian, M("GENERAL_DISABLED")); } } } -void Wavelet::medianlevUpdateUI () +void Wavelet::medianlevUpdateUI() { if (!batchMode) { - if (medianlev->get_active ()) { + if (medianlev->get_active()) { edgedetect->show(); lipst->show(); separatoredge->show(); @@ -2597,7 +2862,7 @@ void Wavelet::medianlevUpdateUI () // edgeampli->show(); // NPmethod->show(); // labmNP->show(); - if (lipst->get_active ()) { + if (lipst->get_active()) { edgesensi->show(); edgeampli->show(); NPmethod->show(); @@ -2625,66 +2890,66 @@ void Wavelet::medianlevUpdateUI () } } -void Wavelet::medianlevToggled () +void Wavelet::medianlevToggled() { if (multiImage) { if (medianlev->get_inconsistent()) { - medianlev->set_inconsistent (false); - medianlevConn.block (true); - medianlev->set_active (false); - medianlevConn.block (false); + medianlev->set_inconsistent(false); + medianlevConn.block(true); + medianlev->set_active(false); + medianlevConn.block(false); } else if (lastmedianlev) { - medianlev->set_inconsistent (true); + medianlev->set_inconsistent(true); } - lastmedianlev = medianlev->get_active (); + lastmedianlev = medianlev->get_active(); } medianlevUpdateUI(); - if (listener && (multiImage || getEnabled ())) { + if (listener && (multiImage || getEnabled())) { if (medianlev->get_inconsistent()) { - listener->panelChanged (EvWavmedianlev, M("GENERAL_UNCHANGED")); - } else if (medianlev->get_active () ) { - listener->panelChanged (EvWavmedianlev, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavmedianlev, M("GENERAL_UNCHANGED")); + } else if (medianlev->get_active()) { + listener->panelChanged(EvWavmedianlev, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavmedianlev, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavmedianlev, M("GENERAL_DISABLED")); } } } -void Wavelet::linkedgToggled () +void Wavelet::linkedgToggled() { if (multiImage) { if (linkedg->get_inconsistent()) { - linkedg->set_inconsistent (false); - linkedgConn.block (true); - linkedg->set_active (false); - linkedgConn.block (false); + linkedg->set_inconsistent(false); + linkedgConn.block(true); + linkedg->set_active(false); + linkedgConn.block(false); } else if (lastlinkedg) { - linkedg->set_inconsistent (true); + linkedg->set_inconsistent(true); } - lastlinkedg = linkedg->get_active (); + lastlinkedg = linkedg->get_active(); } - if (listener && (multiImage || getEnabled ())) { + if (listener && (multiImage || getEnabled())) { if (linkedg->get_inconsistent()) { - listener->panelChanged (EvWavlinkedg, M("GENERAL_UNCHANGED")); - } else if (linkedg->get_active () ) { - listener->panelChanged (EvWavlinkedg, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavlinkedg, M("GENERAL_UNCHANGED")); + } else if (linkedg->get_active()) { + listener->panelChanged(EvWavlinkedg, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavlinkedg, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavlinkedg, M("GENERAL_DISABLED")); } } } -void Wavelet::cbenabUpdateUI () +void Wavelet::cbenabUpdateUI() { if (!batchMode) { - if(cbenab->get_active ()) { + if (cbenab->get_active()) { chanMixerHLFrame->show(); chanMixerMidFrame->show(); chanMixerShadowsFrame->show(); @@ -2698,40 +2963,40 @@ void Wavelet::cbenabUpdateUI () } } -void Wavelet::cbenabToggled () +void Wavelet::cbenabToggled() { if (multiImage) { if (cbenab->get_inconsistent()) { - cbenab->set_inconsistent (false); - cbenabConn.block (true); - cbenab->set_active (false); - cbenabConn.block (false); + cbenab->set_inconsistent(false); + cbenabConn.block(true); + cbenab->set_active(false); + cbenabConn.block(false); } else if (lastcbenab) { - cbenab->set_inconsistent (true); + cbenab->set_inconsistent(true); } - lastcbenab = cbenab->get_active (); + lastcbenab = cbenab->get_active(); } cbenabUpdateUI(); - if (listener && (multiImage || getEnabled ())) { - if (cbenab->get_inconsistent() ) { - listener->panelChanged (EvWavcbenab, M("GENERAL_UNCHANGED")); - } else if (cbenab->get_active () ) { - listener->panelChanged (EvWavcbenab, M("GENERAL_ENABLED")); + if (listener && (multiImage || getEnabled())) { + if (cbenab->get_inconsistent()) { + listener->panelChanged(EvWavcbenab, M("GENERAL_UNCHANGED")); + } else if (cbenab->get_active()) { + listener->panelChanged(EvWavcbenab, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavcbenab, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavcbenab, M("GENERAL_DISABLED")); } } } -void Wavelet::lipstUpdateUI () +void Wavelet::lipstUpdateUI() { if (!batchMode) { - if (lipst->get_active ()) { + if (lipst->get_active()) { NPmethod->show(); edgesensi->show(); edgeampli->show(); @@ -2747,31 +3012,31 @@ void Wavelet::lipstUpdateUI () } -void Wavelet::lipstToggled () +void Wavelet::lipstToggled() { if (multiImage) { if (lipst->get_inconsistent()) { - lipst->set_inconsistent (false); - lipstConn.block (true); - lipst->set_active (false); - lipstConn.block (false); + lipst->set_inconsistent(false); + lipstConn.block(true); + lipst->set_active(false); + lipstConn.block(false); } else if (lastlipst) { - lipst->set_inconsistent (true); + lipst->set_inconsistent(true); } - lastlipst = lipst->get_active (); + lastlipst = lipst->get_active(); } lipstUpdateUI(); - if (listener && (multiImage || getEnabled ())) { + if (listener && (multiImage || getEnabled())) { if (lipst->get_inconsistent()) { - listener->panelChanged (EvWavlipst, M("GENERAL_UNCHANGED")); - } else if (lipst->get_active ()) { - listener->panelChanged (EvWavlipst, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavlipst, M("GENERAL_UNCHANGED")); + } else if (lipst->get_active()) { + listener->panelChanged(EvWavlipst, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavlipst, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavlipst, M("GENERAL_DISABLED")); } } } @@ -2802,62 +3067,88 @@ void Wavelet::edgreinfToggled () { } } */ -void Wavelet::avoidToggled () +void Wavelet::avoidToggled() { if (multiImage) { if (avoid->get_inconsistent()) { - avoid->set_inconsistent (false); - avoidConn.block (true); - avoid->set_active (false); - avoidConn.block (false); + avoid->set_inconsistent(false); + avoidConn.block(true); + avoid->set_active(false); + avoidConn.block(false); } else if (lastavoid) { - avoid->set_inconsistent (true); + avoid->set_inconsistent(true); } - lastavoid = avoid->get_active (); + lastavoid = avoid->get_active(); } - if (listener && (multiImage || getEnabled ())) { + if (listener && (multiImage || getEnabled())) { if (avoid->get_inconsistent()) { - listener->panelChanged (EvWavavoid, M("GENERAL_UNCHANGED")); - } else if (avoid->get_active ()) { - listener->panelChanged (EvWavavoid, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavavoid, M("GENERAL_UNCHANGED")); + } else if (avoid->get_active()) { + listener->panelChanged(EvWavavoid, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavavoid, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavavoid, M("GENERAL_DISABLED")); } } } -void Wavelet::tmrToggled () +void Wavelet::showmaskToggled() +{ + if (multiImage) { + if (showmask->get_inconsistent()) { + showmask->set_inconsistent(false); + showmaskConn.block(true); + showmask->set_active(false); + showmaskConn.block(false); + } else if (lastshowmask) { + showmask->set_inconsistent(true); + } + + lastshowmask = showmask->get_active(); + } + + if (listener && (multiImage || getEnabled())) { + if (showmask->get_inconsistent()) { + listener->panelChanged(EvWavshowmask, M("GENERAL_UNCHANGED")); + } else if (showmask->get_active()) { + listener->panelChanged(EvWavshowmask, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvWavshowmask, M("GENERAL_DISABLED")); + } + } +} + +void Wavelet::tmrToggled() { if (multiImage) { if (tmr->get_inconsistent()) { - tmr->set_inconsistent (false); - tmrConn.block (true); - tmr->set_active (false); - tmrConn.block (false); + tmr->set_inconsistent(false); + tmrConn.block(true); + tmr->set_active(false); + tmrConn.block(false); } else if (lasttmr) { - tmr->set_inconsistent (true); + tmr->set_inconsistent(true); } - lasttmr = tmr->get_active (); + lasttmr = tmr->get_active(); } - if (listener && (multiImage || getEnabled ())) { + if (listener && (multiImage || getEnabled())) { if (tmr->get_inconsistent()) { - listener->panelChanged (EvWavtmr, M("GENERAL_UNCHANGED")); - } else if (tmr->get_active ()) { - listener->panelChanged (EvWavtmr, M("GENERAL_ENABLED")); + listener->panelChanged(EvWavtmr, M("GENERAL_UNCHANGED")); + } else if (tmr->get_active()) { + listener->panelChanged(EvWavtmr, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvWavtmr, M("GENERAL_DISABLED")); + listener->panelChanged(EvWavtmr, M("GENERAL_DISABLED")); } } } -void Wavelet::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) +void Wavelet::colorForValue(double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) { float R = 0.f, G = 0.f, B = 0.f; @@ -2897,7 +3188,7 @@ void Wavelet::colorForValue (double valX, double valY, enum ColorCaller::ElemTyp caller->ccGreen = double(G); caller->ccBlue = double(B); } -void Wavelet::setAdjusterBehavior (bool multiplieradd, bool thresholdadd, bool threshold2add, bool thresadd, bool chroadd, bool chromaadd, bool contrastadd, bool skinadd, bool reschroadd, bool tmrsadd, bool resconadd, bool resconHadd, bool thradd, bool thrHadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd , bool edgedetectthr2add) +void Wavelet::setAdjusterBehavior(bool multiplieradd, bool thresholdadd, bool threshold2add, bool thresadd, bool chroadd, bool chromaadd, bool contrastadd, bool skinadd, bool reschroadd, bool tmrsadd, bool edgsadd, bool scaleadd, bool resconadd, bool resconHadd, bool thradd, bool thrHadd, bool radiusadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add) { for (int i = 0; i < 9; i++) { @@ -2915,8 +3206,11 @@ void Wavelet::setAdjusterBehavior (bool multiplieradd, bool thresholdadd, bool t resconH->setAddMode(resconHadd); reschro->setAddMode(reschroadd); tmrs->setAddMode(tmrsadd); + edgs->setAddMode(edgsadd); + scale->setAddMode(scaleadd); thr->setAddMode(thradd); thrH->setAddMode(thrHadd); + radius->setAddMode(radiusadd); sky->setAddMode(skyadd); edgrad->setAddMode(edgradadd); edgval->setAddMode(edgvaladd); @@ -2928,7 +3222,7 @@ void Wavelet::setAdjusterBehavior (bool multiplieradd, bool thresholdadd, bool t } -void Wavelet::neutralPressed () +void Wavelet::neutralPressed() { for (int i = 0; i < 9; i++) { correction[i]->setValue(0); @@ -2936,7 +3230,7 @@ void Wavelet::neutralPressed () } } -void Wavelet::neutralchPressed () +void Wavelet::neutralchPressed() { for (int i = 0; i < 9; i++) { @@ -2946,7 +3240,7 @@ void Wavelet::neutralchPressed () } -void Wavelet::contrastPlusPressed () +void Wavelet::contrastPlusPressed() { for (int i = 0; i < 9; i++) { @@ -2957,7 +3251,7 @@ void Wavelet::contrastPlusPressed () } -void Wavelet::contrastMinusPressed () +void Wavelet::contrastMinusPressed() { for (int i = 0; i < 9; i++) { @@ -2967,7 +3261,7 @@ void Wavelet::contrastMinusPressed () } } -void Wavelet::foldAllButMe (GdkEventButton* event, MyExpander *expander) +void Wavelet::foldAllButMe(GdkEventButton* event, MyExpander *expander) { if (event->button == 3) { expsettings->set_expanded(expsettings == expander); @@ -2979,6 +3273,7 @@ void Wavelet::foldAllButMe (GdkEventButton* event, MyExpander *expander) expgamut->set_expanded(expgamut == expander); expresid->set_expanded(expresid == expander); expfinal->set_expanded(expfinal == expander); + expclari->set_expanded(expclari == expander); } } @@ -3001,6 +3296,40 @@ void Wavelet::enableToggled(MyExpander *expander) event = EvWavenares; } else if (expander == expfinal) { event = EvWavenafin; + } else if (expander == expclari) { + if (expclari->getEnabled() == false) { + Backmethod->set_active(1); + CLmethod->set_active(3); + Lmethod->set_active(3); + Dirmethod->set_active(3); + Lmethod->set_sensitive(false); + Dirmethod->set_sensitive(false); + CLmethod->set_sensitive(true); + Backmethod->set_sensitive(true); + } else { + + if (ushamethod->get_active_row_number() == 1) { + Backmethod->set_active(2); + CLmethod->set_active(2); + Lmethod->set_active(6); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + Dirmethod->set_active(3); + CLmethod->set_sensitive(false); + Backmethod->set_sensitive(false); + } else if (ushamethod->get_active_row_number() == 0) { + Backmethod->set_active(0); + CLmethod->set_active(1); + Lmethod->set_active(2); + Dirmethod->set_active(3); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + CLmethod->set_sensitive(false); + Backmethod->set_sensitive(false); + } + } + + event = EvWavenaclari; } else // unknown expander, returning ! { @@ -3008,26 +3337,27 @@ void Wavelet::enableToggled(MyExpander *expander) } if (expander->get_inconsistent()) { - listener->panelChanged (event, M("GENERAL_UNCHANGED")); + listener->panelChanged(event, M("GENERAL_UNCHANGED")); } else if (expander->getEnabled()) { - listener->panelChanged (event, M("GENERAL_ENABLED")); + listener->panelChanged(event, M("GENERAL_ENABLED")); } else { - listener->panelChanged (event, M("GENERAL_DISABLED")); + listener->panelChanged(event, M("GENERAL_DISABLED")); } } } void Wavelet::writeOptions(std::vector &tpOpen) { - tpOpen.push_back (expsettings->get_expanded ()); - tpOpen.push_back (expcontrast->get_expanded ()); - tpOpen.push_back (expchroma->get_expanded ()); - tpOpen.push_back (exptoning->get_expanded ()); - tpOpen.push_back (expnoise->get_expanded ()); - tpOpen.push_back (expedge->get_expanded ()); - tpOpen.push_back (expgamut->get_expanded ()); - tpOpen.push_back (expresid->get_expanded ()); - tpOpen.push_back (expfinal->get_expanded ()); + tpOpen.push_back(expsettings->get_expanded()); + tpOpen.push_back(expcontrast->get_expanded()); + tpOpen.push_back(expchroma->get_expanded()); + tpOpen.push_back(exptoning->get_expanded()); + tpOpen.push_back(expnoise->get_expanded()); + tpOpen.push_back(expedge->get_expanded()); + tpOpen.push_back(expgamut->get_expanded()); + tpOpen.push_back(expresid->get_expanded()); + tpOpen.push_back(expfinal->get_expanded()); + tpOpen.push_back(expclari->get_expanded()); } void Wavelet::updateToolState(const std::vector& tpOpen) @@ -3042,11 +3372,11 @@ void Wavelet::updateToolState(const std::vector& tpOpen) expgamut->set_expanded(false); expresid->set_expanded(false); expfinal->set_expanded(false); - + expclari->set_expanded(false); return; } - if (tpOpen.size() >= 9) { + if (tpOpen.size() >= 10) { expsettings->set_expanded(tpOpen[0]); expcontrast->set_expanded(tpOpen[1]); expchroma->set_expanded(tpOpen[2]); @@ -3056,6 +3386,7 @@ void Wavelet::updateToolState(const std::vector& tpOpen) expgamut->set_expanded(tpOpen[6]); expresid->set_expanded(tpOpen[7]); expfinal->set_expanded(tpOpen[8]); + expclari->set_expanded(tpOpen.at(9)); } } diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index d01e52749..d3b66657e 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -52,7 +52,8 @@ public: void autoOpenCurve() override; void curveChanged(CurveEditor* ce) override; void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; - void setAdjusterBehavior(bool multiplieradd, bool thresholdadd, bool threshold2add, bool thresadd, bool chroadd, bool chromaadd, bool contrastadd, bool skinadd, bool reschroadd, bool tmrsadd, bool resconadd, bool resconHadd, bool thradd, bool thrHadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add); +// void setAdjusterBehavior(bool multiplieradd, bool thresholdadd, bool threshold2add, bool thresadd, bool chroadd, bool chromaadd, bool contrastadd, bool skinadd, bool reschroadd, bool tmrsadd, bool resconadd, bool resconHadd, bool thradd, bool thrHadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add); + void setAdjusterBehavior (bool multiplieradd, bool thresholdadd, bool threshold2add, bool thresadd, bool chroadd, bool chromaadd, bool contrastadd, bool skinadd, bool reschroadd, bool tmrsadd, bool edgsadd, bool scaleadd, bool resconadd, bool resconHadd, bool thradd, bool thrHadd, bool radiusadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add); void setBatchMode(bool batchMode) override; void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void setEditProvider(EditDataProvider *provider) override; @@ -67,6 +68,18 @@ public: void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; private: + rtengine::ProcEvent EvWavenaclari; + rtengine::ProcEvent EvWavushamet; + rtengine::ProcEvent EvWavmergeL; + rtengine::ProcEvent EvWavmergeC; + rtengine::ProcEvent EvWavsoftrad; + rtengine::ProcEvent EvWavsoftradend; + rtengine::ProcEvent EvWavshowmask; + rtengine::ProcEvent EvWavedgs; + rtengine::ProcEvent EvWavscale; + rtengine::ProcEvent EvWavradius; + rtengine::ProcEvent EvWavsigma; + void foldAllButMe(GdkEventButton* event, MyExpander *expander); void colorForValue(double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller) override; @@ -84,6 +97,7 @@ private: void TMmethodChanged(); void TilesmethodChanged(); void avoidToggled(); + void showmaskToggled (); void cbenabToggled(); void contrastMinusPressed(); void contrastPlusPressed(); @@ -99,6 +113,7 @@ private: void tmrToggled(); void updatewavLabel (); void wavChanged(double nlevel) override; + void ushamethodChanged(); void HSmethodUpdateUI(); void CHmethodUpdateUI(); @@ -150,14 +165,18 @@ private: Gtk::CheckButton* const lipst; Gtk::CheckButton* const avoid; Gtk::CheckButton* const tmr; + Gtk::CheckButton* const showmask; Gtk::Button* const neutralchButton; Adjuster* correction[9]; Adjuster* correctionch[9]; + Adjuster* const sigma; Adjuster* const rescon; Adjuster* const resconH; Adjuster* const reschro; Adjuster* const tmrs; + Adjuster* const edgs; + Adjuster* const scale; Adjuster* const gamma; Adjuster* const sup; Adjuster* const sky; @@ -167,6 +186,7 @@ private: Adjuster* const contrast; Adjuster* const thr; Adjuster* const thrH; + Adjuster* const radius; Adjuster* const skinprotect; Adjuster* const edgrad; Adjuster* const edgval; @@ -200,6 +220,11 @@ private: Adjuster* const edgedetectthr2; Adjuster* const edgesensi; Adjuster* const edgeampli; + Adjuster* const mergeL; + Adjuster* const mergeC; + Adjuster* const softrad; + Adjuster* const softradend; + MyComboBoxText* const Lmethod; sigc::connection Lmethodconn; MyComboBoxText* const CHmethod; @@ -228,13 +253,18 @@ private: sigc::connection Dirmethodconn; MyComboBoxText* const Medgreinf; sigc::connection MedgreinfConn; + MyComboBoxText* const ushamethod; + sigc::connection ushamethodconn; + Gtk::Frame* const chanMixerHLFrame; Gtk::Frame* const chanMixerMidFrame; Gtk::Frame* const chanMixerShadowsFrame; + Gtk::Frame* const chromaFrame; Gtk::Label* const wavLabels; Gtk::Label* const labmC; Gtk::Label* const labmNP; + Gtk::Label* const usharpLabel; MyExpander* const expchroma; MyExpander* const expcontrast; MyExpander* const expedge; @@ -244,18 +274,20 @@ private: MyExpander* const expresid; MyExpander* const expsettings; MyExpander* const exptoning; + MyExpander* const expclari; Gtk::HBox* const neutrHBox; + Gtk::HBox* const usharpHBox; - sigc::connection enableChromaConn, enableContrastConn, enableEdgeConn, enableFinalConn; + sigc::connection enableChromaConn, enableContrastConn, enableEdgeConn, enableFinalConn, enableclariConn; sigc::connection enableNoiseConn, enableResidConn, enableToningConn; - sigc::connection medianConn, avoidConn, tmrConn, medianlevConn, linkedgConn, lipstConn, cbenabConn, neutralconn; + sigc::connection medianConn, avoidConn, tmrConn, medianlevConn, linkedgConn, lipstConn, cbenabConn, neutralconn, showmaskConn; sigc::connection neutralPressedConn; sigc::connection contrastPlusPressedConn; sigc::connection contrastMinusPressedConn; sigc::connection neutralchPressedConn; - bool lastmedian, lastmedianlev, lastlinkedg, lastavoid, lastlipst, lasttmr, lastcbenab; + bool lastmedian, lastmedianlev, lastlinkedg, lastavoid, lastlipst, lasttmr, lastcbenab, lastshowmask; int nextnlevel; IdleRegister idle_register;