From 48d30e50c729d20be14036089d136eb4c5726339 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 22 Mar 2019 18:20:00 +0100 Subject: [PATCH 01/27] Wavelet Clarity and Unsharp mask --- rtdata/languages/default | 17 + rtengine/dcrop.cc | 112 +- rtengine/improccoordinator.cc | 152 ++- rtengine/ipwavelet.cc | 949 ++++++++------- rtengine/procparams.cc | 24 + rtengine/procparams.h | 6 + rtengine/simpleprocess.cc | 561 +++++---- rtgui/paramsedited.cc | 38 +- rtgui/paramsedited.h | 6 + rtgui/wavelet.cc | 2115 ++++++++++++++++++--------------- rtgui/wavelet.h | 21 +- 11 files changed, 2327 insertions(+), 1674 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 09f6fe9c1..432da3054 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -780,6 +780,12 @@ HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength HISTORY_MSG_TM_FATTAL_ANCHOR;DRC - Anchor +HISTORY_MSG_WAVCLARI;Clarity +HISTORY_MSG_WAVUSHAMET;Clarity method +HISTORY_MSG_WAVMERGEL;Merge L +HISTORY_MSG_WAVMERGEC;Merge C +HISTORY_MSG_WAVSOFTRAD;Soft radius clarity +HISTORY_MSG_WAVSOFTRADEND;Soft radius final HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -2129,6 +2135,7 @@ TP_WAVELET_CHRO_TOOLTIP;Sets the wavelet level which will be the threshold betwe 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;Clarity - Usharp Mask TP_WAVELET_COLORT;Opacity Red-Green TP_WAVELET_COMPCONT;Contrast TP_WAVELET_COMPGAMMA;Compression gamma @@ -2211,6 +2218,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 @@ -2238,6 +2247,7 @@ 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 @@ -2256,6 +2266,13 @@ 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_TMTYPE;Compression method 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\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels +TP_WAVELET_SHA;Sharp 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_CAMERA;Camera TP_WBALANCE_CLOUDY;Cloudy diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 0872049d8..695fd9056 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -23,6 +23,7 @@ #include "procparams.h" #include "refreshmap.h" #include "rt_math.h" +#include "guidedfilter.h" namespace { @@ -43,7 +44,7 @@ extern const Settings* settings; 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), @@ -825,15 +826,17 @@ 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; DCPProfile::ApplyState as; DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as); LUTu histToneCurve; - parent->ipf.rgbProc (workingCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve, + parent->ipf.rgbProc(workingCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve, 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; } @@ -893,8 +896,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); } } @@ -938,7 +941,7 @@ void Crop::update(int todo) if (params.wavelet.Tilesmethod == "big") { realtile = 22; - } else /*if (params.wavelet.Tilesmethod == "lit")*/ { + } else { /*if (params.wavelet.Tilesmethod == "lit")*/ realtile = 12; } @@ -985,15 +988,106 @@ void Crop::update(int todo) LUTu dummy; params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); + LabImage *unshar = nullptr; + Glib::ustring provis; + LabImage *provradius = nullptr; + + if (WaveParams.softrad > 0.f) { + provradius = new LabImage(labnCrop->W, labnCrop->H); + provradius->CopyFrom(labnCrop); + } + + + + if (WaveParams.ushamethod != "none" && 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; + + } parent->ipf.ip_wavelet(labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); + + if (WaveParams.ushamethod != "none" && 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 = -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 < labnCrop->H; x++) + for (int y = 0; y < labnCrop->W; y++) { + labnCrop->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * labnCrop->L[x][y]; + labnCrop->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * labnCrop->a[x][y]; + labnCrop->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * labnCrop->b[x][y]; + } + + delete unshar; + unshar = NULL; + + if (WaveParams.softrad > 0.f) { + array2D ble(labnCrop->W, labnCrop->H); + array2D guid(labnCrop->W, labnCrop->H); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < labnCrop->H ; ir++) + for (int jr = 0; jr < labnCrop->W; jr++) { + ble[ir][jr] = (labnCrop->L[ir][jr] - provradius->L[ir][jr]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + } + + float blur = 10.f / skip * (0.1f + 0.8f * WaveParams.softrad); + rtengine::guidedFilter(guid, ble, ble, blur, 0.001, false); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < labnCrop->H; ir++) + for (int jr = 0; jr < labnCrop->W; jr++) { + labnCrop->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; + } + } + + if (WaveParams.softrad > 0.f) { + delete provradius; + provradius = NULL; + } + + + } + + } - parent->ipf.softLight(labnCrop); + 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 ec047f853..c6207964f 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -28,6 +28,7 @@ #include #include #include +#include "guidedfilter.h" #include "color.h" #ifdef _OPENMP #include @@ -45,11 +46,11 @@ ImProcCoordinator::ImProcCoordinator() : fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), - ncie (nullptr), - imgsrc (nullptr), - lastAwbEqual (0.), - lastAwbTempBias (0.0), - monitorIntent (RI_RELATIVE), + ncie(nullptr), + imgsrc(nullptr), + lastAwbEqual(0.), + lastAwbTempBias(0.0), + monitorIntent(RI_RELATIVE), softProof(false), gamutCheck(false), sharpMask(false), @@ -181,12 +182,12 @@ ImProcCoordinator::~ImProcCoordinator() imgsrc->decreaseRef(); - if(customTransformIn) { + if (customTransformIn) { cmsDeleteTransform(customTransformIn); customTransformIn = nullptr; } - if(customTransformOut) { + if (customTransformOut) { cmsDeleteTransform(customTransformOut); customTransformOut = nullptr; } @@ -271,9 +272,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; @@ -307,8 +310,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)); @@ -316,6 +320,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); //enabled demosaic @@ -323,6 +328,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (imgsrc->getSensorType() == ST_BAYER && bayerAutoContrastListener && autoContrast) { bayerAutoContrastListener->autoContrastChanged(autoContrast ? contrastThreshold : -1.0); } + if (imgsrc->getSensorType() == ST_FUJI_XTRANS && xtransAutoContrastListener && autoContrast) { xtransAutoContrastListener->autoContrastChanged(autoContrast ? contrastThreshold : -1.0); } @@ -578,7 +584,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) progress("Exposure curve & CIELAB conversion...", 100 * readyphase / numofphases); - 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); @@ -590,17 +596,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); } } @@ -608,7 +618,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, @@ -702,7 +712,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) DCPProfile::ApplyState 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) { @@ -838,20 +848,119 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) //CurveFactory::curveWavContL ( wavcontlutili,params->wavelet.lcurve, wavclCurve, LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,int skip); CurveFactory::curveWavContL(wavcontlutili, params->wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16); - if ((params->wavelet.enabled)) { WaveletParams WaveParams = params->wavelet; - // WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY); WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); - int kall = 0; progress("Wavelet...", 100 * readyphase / numofphases); - // ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, scale); + LabImage *unshar = nullptr; + Glib::ustring provis; + LabImage *provradius = nullptr; + + if (WaveParams.softrad > 0.f) { + provradius = new LabImage(pW, pH); + provradius->CopyFrom(nprevl); + } + + + + + if (WaveParams.ushamethod != "none" && 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; + + } + ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); + if (WaveParams.ushamethod != "none" && 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 = -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 < pH; x++) + for (int y = 0; y < pW; y++) { + nprevl->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * nprevl->L[x][y]; + nprevl->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * nprevl->a[x][y]; + nprevl->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * nprevl->b[x][y]; + } + + delete unshar; + unshar = NULL; + + if (WaveParams.softrad > 0.f) { + array2D ble(pW, pH); + array2D guid(pW, pH); + /* + #ifdef _OPENMP + const int numThreads = omp_get_max_threads(); + #endif + + bool multiTh = false; + + if (numThreads > 1) { + multiTh = true; + } + */ +#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; + } + + float blur = 10.f / scale * (0.1f + 0.8f * WaveParams.softrad); + // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + rtengine::guidedFilter(guid, ble, ble, blur, 0.001, 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 @@ -1010,6 +1119,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; @@ -1307,7 +1417,7 @@ void ImProcCoordinator::getSoftProofing(bool &softProof, bool &gamutCheck) gamutCheck = this->gamutCheck; } -void ImProcCoordinator::setSharpMask (bool sharpMask) +void ImProcCoordinator::setSharpMask(bool sharpMask) { this->sharpMask = sharpMask; } @@ -1477,7 +1587,7 @@ void ImProcCoordinator::process() while (changeSinceLast) { const bool panningRelatedChange = - params->toneCurve != nextParams->toneCurve + params->toneCurve != nextParams->toneCurve || params->labCurve != nextParams->labCurve || params->localContrast != nextParams->localContrast || params->rgbCurves != nextParams->rgbCurves diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index d3595b42c..8b5f33b74 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -41,6 +41,7 @@ #include "EdgePreservingDecomposition.h" #include "iccstore.h" #include "procparams.h" +#include "guidedfilter.h" #ifdef _OPENMP #include @@ -149,38 +150,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; } @@ -192,27 +201,27 @@ 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; } @@ -226,15 +235,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; } @@ -246,7 +255,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; } @@ -257,7 +266,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; } @@ -267,23 +276,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; } @@ -292,11 +301,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; } @@ -316,29 +325,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); @@ -349,16 +358,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); @@ -369,47 +378,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]); @@ -489,28 +498,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; } @@ -518,7 +527,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; } @@ -530,7 +539,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 } @@ -540,11 +549,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; } @@ -552,16 +561,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); @@ -576,58 +585,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; } } @@ -636,13 +644,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); } @@ -650,20 +658,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); } @@ -703,10 +711,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)); @@ -741,7 +749,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); @@ -759,7 +767,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; @@ -768,7 +776,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; @@ -779,8 +787,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]; } } @@ -791,14 +799,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]; } } @@ -811,7 +819,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; @@ -825,7 +833,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; } @@ -842,20 +850,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 !! } @@ -863,10 +871,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 @@ -886,19 +894,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); } @@ -910,7 +918,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const vari[2] = 8.f * SQR((cp.lev2n / 125.0) * (1.0 + cp.lev2n / 25.0)); vari[3] = 8.f * SQR((cp.lev3n / 125.0) * (1.0 + cp.lev3n / 25.0)); - 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]); @@ -937,7 +945,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); } @@ -964,21 +972,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); } @@ -989,17 +997,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); } @@ -1010,21 +1018,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); @@ -1040,12 +1048,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; } @@ -1091,7 +1099,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; @@ -1100,7 +1108,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)); @@ -1117,7 +1125,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); @@ -1133,7 +1141,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]; @@ -1153,7 +1161,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 } @@ -1184,8 +1192,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. } @@ -1198,7 +1206,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 } @@ -1207,7 +1215,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; @@ -1222,19 +1230,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]; } @@ -1251,11 +1259,54 @@ 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); + + 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++) { + ble[ir][jr] = (dst->L[ir][jr] - provradius->L[ir][jr]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + } + + float blur = 10.f / skip * (0.1f + 0.1f * waparams.softradend); + + rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < lab->H; ir++) + for (int jr = 0; jr < lab->W; jr++) { + dst->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; + } + } + + if (waparams.softradend > 0.f && cp.finena) { + delete provradius; + provradius = NULL; + } + #ifdef _DEBUG delete MunsDebugInfo; #endif @@ -1267,7 +1318,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 @@ -1286,19 +1337,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 += 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 += DataList[i]; - if(DataList[i] < lmin) { + if (DataList[i] < lmin) { lmin = DataList[i]; } @@ -1315,13 +1366,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; @@ -1330,7 +1381,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 @@ -1340,23 +1391,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 += SQR(DataList[i] - averagePlus); countP++; - } else if(DataList[i] <= -thres) { + } else if (DataList[i] <= -thres) { variN += 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; @@ -1377,12 +1428,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]; @@ -1432,17 +1483,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; @@ -1461,12 +1512,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); } @@ -1475,7 +1526,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); } @@ -1489,7 +1540,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) { @@ -1500,7 +1551,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; } @@ -1508,7 +1559,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. } @@ -1520,7 +1571,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; } } @@ -1540,7 +1591,7 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat 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) { @@ -1552,7 +1603,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; } @@ -1560,12 +1611,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); } @@ -1577,7 +1628,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; } } @@ -1592,7 +1643,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); } } } @@ -1615,7 +1666,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * 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 @@ -1635,12 +1686,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]; } @@ -1650,11 +1701,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; } } @@ -1666,7 +1717,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, 5, skip, cp, W_L, H_L, max0, min0); @@ -1691,7 +1742,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * float *koeLibuffer = nullptr; - for(int y = 0; y < 12; y++) { + for (int y = 0; y < 12; y++) { maxkoeLi[y] = 0.f; //9 } @@ -1701,7 +1752,7 @@ 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; } @@ -1710,17 +1761,17 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #pragma omp parallel num_threads(wavNestedLevels) if(wavNestedLevels>1) #endif { - if(contrast != 0.f && cp.resena && max0 > 0.0) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step + if (contrast != 0.f && cp.resena && max0 > 0.0) { // 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) { + if (WavCoeffs_L0[i] < 32768.f) { float prov; - if( WavCoeffs_L0[i] > ave) { + 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); @@ -1738,7 +1789,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } } - 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 @@ -1751,7 +1802,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #pragma omp barrier #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 + 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 @@ -1763,15 +1814,15 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * //shadow float alp = 3.f; //increase contrast sahdow in lowlights between 1 and ?? - if(cp.th > (100.f - tran)) { + if (cp.th > (100.f - tran)) { tran = 100.f - cp.th; } - if(LL100 < 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) { + } 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); @@ -1780,13 +1831,13 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * //highlight tran = 5.f; - if(cp.thH < (tran)) { + if (cp.thH < (tran)) { tran = cp.thH; } - if(LL100 > cp.thH) { + if (LL100 > cp.thH) { WavCoeffs_L0[i] *= (1.f + cp.conresH / 200.f); - } else if(LL100 > (cp.thH - tran)) { + } 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); @@ -1806,7 +1857,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]; @@ -1824,7 +1875,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 } } @@ -1843,7 +1894,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; @@ -1882,11 +1933,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; } @@ -1896,14 +1947,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 { @@ -1923,7 +1974,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 } @@ -1949,7 +2000,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); } @@ -1957,7 +2008,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } //delete edge detection - if(koeLibuffer) { + if (koeLibuffer) { delete [] koeLibuffer; } } @@ -1998,7 +2049,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; } @@ -2044,7 +2095,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 @@ -2058,22 +2109,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; } @@ -2097,7 +2148,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 @@ -2110,24 +2161,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 @@ -2137,17 +2188,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; } } @@ -2165,7 +2216,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); } } @@ -2181,7 +2232,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 @@ -2205,7 +2256,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 @@ -2221,7 +2272,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++) { @@ -2233,11 +2284,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++) { @@ -2255,7 +2306,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] @@ -2306,24 +2357,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]; } @@ -2335,10 +2386,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 @@ -2356,12 +2407,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]); @@ -2382,34 +2433,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++) { @@ -2419,10 +2470,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; @@ -2431,21 +2482,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; @@ -2453,15 +2504,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; @@ -2469,7 +2520,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; @@ -2478,7 +2529,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; } @@ -2489,16 +2540,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; } @@ -2510,11 +2561,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++) { @@ -2523,7 +2574,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]; @@ -2549,25 +2600,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]; } @@ -2575,7 +2626,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; } @@ -2608,18 +2659,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 } } @@ -2633,35 +2684,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); } } @@ -2669,7 +2720,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 @@ -2685,21 +2736,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; @@ -2709,16 +2760,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]); } @@ -2740,7 +2791,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 { @@ -2751,20 +2802,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; } } @@ -2772,7 +2823,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% @@ -2781,7 +2832,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); @@ -2795,21 +2846,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; @@ -2829,17 +2880,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; } } @@ -2848,14 +2899,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; } } @@ -2864,7 +2915,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 @@ -2872,7 +2923,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 @@ -2880,7 +2931,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; } } @@ -2890,29 +2941,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; } @@ -2923,7 +2974,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; @@ -2950,30 +3001,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; @@ -2992,8 +3043,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; @@ -3001,16 +3052,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 datas 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; @@ -3021,14 +3072,14 @@ 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; double lr; float modhue2 = varhue[i_i][j_j]; float valparam = float((ChCurve->getVal(lr = 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 @@ -3039,7 +3090,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]; @@ -3050,24 +3101,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; @@ -3082,27 +3133,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; @@ -3115,11 +3166,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; } @@ -3128,22 +3179,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; @@ -3160,12 +3211,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; } @@ -3174,11 +3225,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; } @@ -3194,12 +3245,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); @@ -3210,7 +3261,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; @@ -3219,10 +3270,10 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue, // hue chroma skin with initial lab datas 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; } @@ -3238,7 +3289,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); @@ -3251,37 +3302,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 datas 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; @@ -3290,13 +3341,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; @@ -3304,7 +3355,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; } @@ -3315,19 +3366,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 ; @@ -3339,28 +3392,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; @@ -3373,11 +3426,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; } @@ -3386,22 +3439,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; @@ -3418,12 +3471,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; } @@ -3432,11 +3485,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; } @@ -3452,34 +3505,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; } @@ -3487,9 +3540,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; @@ -3497,21 +3550,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; @@ -3519,15 +3572,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; @@ -3535,13 +3588,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 6d914bb27..1bbab3f74 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2150,6 +2150,10 @@ WaveletParams::WaveletParams() : bluemed(0), greenhigh(0), bluehigh(0), + mergeL(40.), + mergeC(20.), + softrad(0.), + softradend(0.), lipst(false), avoid(false), tmr(false), @@ -2165,6 +2169,7 @@ WaveletParams::WaveletParams() : expfinal(false), exptoning(false), expnoise(false), + expclari(false), Lmethod(4), CLmethod("all"), Backmethod("grey"), @@ -2172,6 +2177,7 @@ WaveletParams::WaveletParams() : daubcoeffmethod("4_"), CHmethod("without"), Medgreinf("less"), + ushamethod("none"), CHSLmethod("SL"), EDmethod("CU"), NPmethod("none"), @@ -2239,6 +2245,10 @@ 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 && tmr == other.tmr @@ -2259,6 +2269,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 @@ -2268,6 +2279,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 @@ -3335,6 +3347,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); @@ -3342,6 +3358,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; @@ -3376,6 +3393,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); @@ -4457,6 +4475,10 @@ 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", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr); @@ -4478,6 +4500,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); @@ -4684,6 +4707,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 0982fda48..f2328217a 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1180,6 +1180,10 @@ struct WaveletParams { int bluemed; int greenhigh; int bluehigh; + double mergeL; + double mergeC; + double softrad; + double softradend; bool lipst; bool avoid; @@ -1196,6 +1200,7 @@ struct WaveletParams { bool expfinal; bool exptoning; bool expnoise; + bool expclari; int Lmethod; Glib::ustring CLmethod; @@ -1204,6 +1209,7 @@ struct WaveletParams { Glib::ustring daubcoeffmethod; Glib::ustring CHmethod; Glib::ustring Medgreinf; + Glib::ustring ushamethod; Glib::ustring CHSLmethod; Glib::ustring EDmethod; Glib::ustring NPmethod; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index ff2b234a3..52ab5a590 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -30,6 +30,8 @@ #include "rawimagesource.h" #include "../rtgui/multilangmgr.h" #include "mytime.h" +#include "guidedfilter.h" + #undef THREAD_PRIORITY_NORMAL namespace rtengine @@ -40,7 +42,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; @@ -56,10 +58,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), @@ -139,14 +141,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; @@ -157,11 +159,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)); @@ -169,7 +172,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) { @@ -203,29 +207,31 @@ 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); 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; - imgsrc->demosaic (params.raw, autoContrast, contrastThreshold); + imgsrc->demosaic(params.raw, autoContrast, contrastThreshold); 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; @@ -233,39 +239,39 @@ private: bool mapcontlutili = false; bool useHsl = false; // multi_array2D conversionBuffer(1, 1); - 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;// @@ -282,7 +288,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")) { @@ -335,16 +341,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 @@ -354,20 +360,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; @@ -380,11 +386,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; @@ -406,11 +412,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) { @@ -509,7 +515,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)); } } @@ -550,9 +556,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]; @@ -569,8 +575,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 @@ -578,24 +584,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; @@ -631,7 +637,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; @@ -658,8 +664,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]); } @@ -732,17 +738,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); @@ -758,9 +764,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); @@ -776,7 +783,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... @@ -815,22 +822,22 @@ 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) { @@ -839,7 +846,7 @@ private: // ipf.RGB_denoise(baseImg, baseImg, calclum, imgsrc->isRAW(), denoiseParams, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, lldenoiseutili); 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); } @@ -862,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); @@ -875,14 +882,17 @@ private: // perform transform (excepted resizing) if (ipf.needsTransform()) { 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, - imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); - if(trImg != baseImg) { + + ipf.transform(baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, + imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); + + if (trImg != baseImg) { delete baseImg; baseImg = trImg; } @@ -898,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 @@ -921,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; @@ -970,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) { @@ -988,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) DCPProfile::ApplyState 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", autor, autog, autob); + printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, 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(); } @@ -1018,7 +1028,7 @@ private: baseImg = nullptr; if (pl) { - pl->setProgress (0.55); + pl->setProgress(0.55); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1033,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 @@ -1041,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 @@ -1054,77 +1064,174 @@ 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, 5, 1); + ipf.EPDToneMap(labView, 5, 1); } - ipf.vibrance (labView); + ipf.vibrance(labView); ipf.labColorCorrectionRegions(labView); if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - ipf.impulsedenoise (labView); + ipf.impulsedenoise(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.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; - if (params.wavelet.enabled) { - ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); + if (WaveParams.softrad > 0.f) { + provradius = new LabImage(fw, fh); + provradius->CopyFrom(labView); + } + + params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); + + CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); + + if (WaveParams.ushamethod != "none" && 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; + } + + ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); + + if (WaveParams.ushamethod != "none" && 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 = -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] = (1.f + mL0) * (unshar->L[x][y]) - mL * labView->L[x][y]; + 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) { + array2D ble(fw, fh); + array2D guid(fw, fh); + /* + #ifdef _OPENMP + const int numThreads = omp_get_max_threads(); + #endif + + bool multiTh = false; + + if (numThreads > 1) { + multiTh = true; + } + */ +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < fh; ir++) + for (int jr = 0; jr < fw; jr++) { + ble[ir][jr] = (labView->L[ir][jr] - provradius->L[ir][jr]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + } + + float blur = 10.f / 1 * (0.1f + 0.8f * WaveParams.softrad); + // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + rtengine::guidedFilter(guid, ble, ble, blur, 0.001, false); + + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < fh; ir++) + for (int jr = 0; jr < fw; jr++) { + labView->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; + } + } + + if (WaveParams.softrad > 0.f) { + delete provradius; + provradius = NULL; + } + + } + + wavCLVCurve.Reset(); } - wavCLVCurve.Reset(); - ipf.softLight(labView); //Colorappearance and tone-mapping associated @@ -1136,9 +1243,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, @@ -1152,24 +1259,26 @@ 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.; }//if no exif data or wrong else { - float E_V = fcomp + log2 ((fnum * fnum) / fspeed / (fiso / 100.f)); + float E_V = fcomp + log2((fnum * fnum) / fspeed / (fiso / 100.f)); E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV - E_V += log2 (params.raw.expos); // exposure raw white point ; log2 ==> linear to EV - adap = powf (2.f, E_V - 3.f); //cd / m2 + E_V += log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV + adap = powf(2.f, E_V - 3.f); //cd / m2 } LUTf CAMBrightCurveJ; @@ -1177,7 +1286,7 @@ private: float CAMMean = NAN; float d, dj, yb; - ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); + ipf.ciecam_02float(cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } delete cieView; @@ -1191,11 +1300,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; @@ -1209,7 +1318,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++) { @@ -1228,13 +1337,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; @@ -1244,7 +1354,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); } } @@ -1259,10 +1370,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; @@ -1272,42 +1383,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; } @@ -1315,8 +1428,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 @@ -1324,23 +1437,23 @@ private: if (params.icm.outputProfile != "" && 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); } } @@ -1349,13 +1462,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(); @@ -1379,10 +1492,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; @@ -1390,7 +1503,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++) { @@ -1400,29 +1513,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; @@ -1453,13 +1566,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); @@ -1477,17 +1590,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; @@ -1582,40 +1695,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/paramsedited.cc b/rtgui/paramsedited.cc index 2c29b4f5b..cec0a5c92 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -473,7 +473,12 @@ 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.tmr = v; wavelet.Lmethod = v; @@ -538,6 +543,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; @@ -1040,7 +1046,12 @@ 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.tmr = wavelet.tmr && p.wavelet.tmr == other.wavelet.tmr; wavelet.Lmethod = wavelet.Lmethod && p.wavelet.Lmethod == other.wavelet.Lmethod; @@ -1107,6 +1118,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 i = 0; i < 9; i++) { wavelet.c[i] = wavelet.c[i] && p.wavelet.c[i] == other.wavelet.c[i]; @@ -2802,6 +2814,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; } @@ -2810,6 +2838,10 @@ 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; } @@ -2979,6 +3011,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; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 95701e01a..13d575d90 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -475,6 +475,7 @@ struct WaveletParamsEdited { bool cbenab; bool lipst; bool Medgreinf; + bool ushamethod; bool avoid; bool tmr; bool c[9]; @@ -541,6 +542,10 @@ struct WaveletParamsEdited { bool bluemed; bool greenhigh; bool bluehigh; + bool mergeL; + bool mergeC; + bool softrad; + bool softradend; bool expcontrast; bool expchroma; bool expedge; @@ -548,6 +553,7 @@ struct WaveletParamsEdited { bool expfinal; bool exptoning; bool expnoise; + bool expclari; }; struct DirPyrEqualizerParamsEdited { diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 60915fa02..6aa86abfa 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -22,6 +22,7 @@ #include "edit.h" #include "guiutils.h" #include "rtimage.h" +#include "eventmapper.h" using namespace rtengine; using namespace rtengine::procparams; @@ -30,27 +31,27 @@ extern Options options; 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; +} } @@ -87,10 +88,10 @@ Wavelet::Wavelet() : 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 ))), + 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))), @@ -112,6 +113,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.1, 0.))), + softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.1, 0.))), Lmethod(Gtk::manage(new MyComboBoxText())), CHmethod(Gtk::manage(new MyComboBoxText())), CHSLmethod(Gtk::manage(new MyComboBoxText())), @@ -126,12 +131,14 @@ 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")))), 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")))), @@ -141,80 +148,92 @@ 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"); - 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); @@ -222,25 +241,25 @@ Wavelet::Wavelet() : 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? @@ -254,74 +273,74 @@ 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 (ss, -100, 350, 1, 0) ); + correction[i] = Gtk::manage(new Adjuster(ss, -100, 350, 1, 0)); correction[i]->setAdjusterListener(this); levBox->pack_start(*correction[i]); } 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); @@ -333,79 +352,79 @@ 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 (ss, -100, 100, 1, 0) ); + correctionch[i] = Gtk::manage(new Adjuster(ss, -100, 100, 1, 0)); correctionch[i]->setAdjusterListener(this); chBox->pack_start(*correctionch[i]); } // 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; @@ -416,9 +435,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.); @@ -427,77 +446,96 @@ 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); + + 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); // 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)); @@ -509,56 +547,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); @@ -566,13 +604,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 = { @@ -595,13 +633,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")); @@ -609,74 +647,74 @@ 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); + contrast->set_tooltip_text(M("TP_WAVELET_CONTRA_TOOLTIP")); + contrast->setAdjusterListener(this); resBox->pack_start(*contrast); //keep the possibility to reinstall - reschro->setAdjusterListener (this); + reschro->setAdjusterListener(this); resBox->pack_start(*reschro); 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()); + 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); hhshape = static_cast(curveEditorRES->addCurve(CT_Flat, M("TP_WAVELET_CURVEEDITOR_HH"))); hhshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_HH_TOOLTIP")); @@ -684,54 +722,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); @@ -747,15 +785,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); @@ -763,19 +801,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.); @@ -786,12 +825,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.); @@ -802,7 +841,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")); @@ -811,54 +850,61 @@ 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); + pack_start(*expchroma); exptoning->add(*tonBox, false); exptoning->setLevel(2); - pack_start (*exptoning); + pack_start(*exptoning); expnoise->add(*noiseBox, false); expnoise->setLevel(2); - pack_start (*expnoise); + pack_start(*expnoise); expedge->add(*edgBox, false); expedge->setLevel(2); - pack_start (*expedge); + pack_start(*expedge); + + expclari->add(*clariBox, false); + expclari->setLevel(2); + pack_start(*expclari); expgamut->add(*conBox, false); expgamut->setLevel(2); - pack_start (*expgamut); + pack_start(*expgamut); expresid->add(*resBox, false); expresid->setLevel(2); @@ -869,7 +915,7 @@ Wavelet::Wavelet() : pack_start(*expfinal); } -Wavelet::~Wavelet () +Wavelet::~Wavelet() { idle_register.destroy(); @@ -884,27 +930,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); @@ -917,11 +962,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) { /***************************************************************************************************** @@ -930,7 +975,7 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) * *****************************************************************************************************/ - disableListener (); + disableListener(); Lmethodconn.block(true); CLmethodconn.block(true); Backmethodconn.block(true); @@ -945,6 +990,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); @@ -962,65 +1008,74 @@ 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(1); + } else if (pp->wavelet.ushamethod == "clari") { + ushamethod->set_active(2); } //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") @@ -1028,99 +1083,100 @@ 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); + 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); @@ -1132,22 +1188,22 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited) lastlipst = pp->wavelet.lipst; lastavoid = pp->wavelet.avoid; 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); + 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); skinprotect->setValue(pp->wavelet.skinprotect); hueskin->setValue(pp->wavelet.hueskin); hueskin2->setValue(pp->wavelet.hueskin2); @@ -1164,12 +1220,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); @@ -1250,83 +1310,92 @@ 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); + 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); + 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); + 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); } } @@ -1341,20 +1410,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(); } } @@ -1370,16 +1439,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(); @@ -1406,6 +1475,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); @@ -1414,10 +1484,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); @@ -1429,19 +1499,19 @@ 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.tmr = tmr->get_active(); pp->wavelet.rescon = rescon->getValue(); pp->wavelet.resconH = resconH->getValue(); pp->wavelet.reschro = reschro->getValue(); @@ -1452,12 +1522,12 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited) 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(); @@ -1481,24 +1551,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(); @@ -1506,9 +1580,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(); @@ -1528,6 +1603,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"); @@ -1564,35 +1640,39 @@ 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.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(); @@ -1600,12 +1680,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(); } @@ -1627,6 +1708,14 @@ 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() == 1) { + pp->wavelet.ushamethod = "sharp"; + } else if (ushamethod->get_active_row_number() == 2) { + pp->wavelet.ushamethod = "clari"; + } + if (CHSLmethod->get_active_row_number() == 0) { pp->wavelet.CHSLmethod = "SL"; } else if (CHSLmethod->get_active_row_number() == 1) { @@ -1721,31 +1810,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++) { @@ -1756,32 +1845,32 @@ 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); + 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); hueskin->setDefault (defParams->wavelet.hueskin); hueskin2->setDefault (defParams->wavelet.hueskin2); hllev->setDefault (defParams->wavelet.hllev); @@ -1794,27 +1883,35 @@ 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); + 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->setDefaultEditedState(pedited->wavelet.sky ? Edited : UnEdited); thres->setDefaultEditedState(pedited->wavelet.thres ? Edited : UnEdited); threshold->setDefaultEditedState(pedited->wavelet.threshold ? Edited : UnEdited); @@ -1829,7 +1926,7 @@ 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); skinprotect->setDefaultEditedState(pedited->wavelet.skinprotect ? Edited : UnEdited); @@ -1880,20 +1977,20 @@ void Wavelet::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi thr->setDefaultEditedState(Irrelevant); thrH->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); @@ -1907,19 +2004,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))); } } @@ -1939,21 +2036,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()); } } } @@ -1961,7 +2058,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(); @@ -1979,15 +2076,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(); @@ -1999,14 +2096,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(); @@ -2018,11 +2115,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 { @@ -2046,8 +2143,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()); } } @@ -2086,10 +2183,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(); } @@ -2099,8 +2196,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()); } } @@ -2114,8 +2211,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()); } } @@ -2124,16 +2221,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(); @@ -2144,8 +2241,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()); } } @@ -2168,8 +2265,8 @@ 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()); } } @@ -2183,8 +2280,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()); } } @@ -2192,19 +2289,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); } @@ -2215,8 +2312,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()); } } @@ -2227,11 +2324,50 @@ void Wavelet::TilesmethodUpdateUI() { } */ + +void Wavelet::ushamethodChanged() +{ + if (ushamethod->get_active_row_number() == 2 && 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); + } else if (ushamethod->get_active_row_number() == 1 && 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); + } 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); + } + + 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()); } } @@ -2243,8 +2379,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()); } } @@ -2257,8 +2393,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()); } } @@ -2271,8 +2407,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()); } } @@ -2285,74 +2421,75 @@ void Wavelet::LmethodUpdateUI() { void Wavelet::LmethodChanged() { //LmethodUpdateUI(); - if (listener && (multiImage || getEnabled()) ) { - listener->panelChanged (EvWavLmet, Lmethod->get_active_text ()); + 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); + 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(); 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(); @@ -2363,7 +2500,7 @@ void Wavelet::setBatchMode (bool batchMode) } } -void Wavelet::adjusterUpdateUI (Adjuster* a) +void Wavelet::adjusterUpdateUI(Adjuster* a) { /* if (!batchMode) { @@ -2386,128 +2523,136 @@ void Wavelet::adjusterUpdateUI (Adjuster* a) 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 == 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()); + } 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 == 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) { 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())) + ); } } } @@ -2516,21 +2661,21 @@ void Wavelet::adjusterAutoToggled(Adjuster* a, bool newval) { } -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 +2685,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 +2742,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 +2770,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 +2843,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 +2892,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 +2947,62 @@ 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::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 +3042,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 resconadd, bool resconHadd, bool thradd, bool thrHadd, bool skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add) { for (int i = 0; i < 9; i++) { @@ -2928,7 +3073,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 +3081,7 @@ void Wavelet::neutralPressed () } } -void Wavelet::neutralchPressed () +void Wavelet::neutralchPressed() { for (int i = 0; i < 9; i++) { @@ -2946,7 +3091,7 @@ void Wavelet::neutralchPressed () } -void Wavelet::contrastPlusPressed () +void Wavelet::contrastPlusPressed() { for (int i = 0; i < 9; i++) { @@ -2957,7 +3102,7 @@ void Wavelet::contrastPlusPressed () } -void Wavelet::contrastMinusPressed () +void Wavelet::contrastMinusPressed() { for (int i = 0; i < 9; i++) { @@ -2967,7 +3112,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 +3124,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 +3147,33 @@ 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); + } else { + if (ushamethod->get_active_row_number() == 2) { + Backmethod->set_active(2); + CLmethod->set_active(2); + Lmethod->set_active(6); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + Dirmethod->set_active(3); + } else if (ushamethod->get_active_row_number() == 1) { + Backmethod->set_active(0); + CLmethod->set_active(1); + Lmethod->set_active(2); + Dirmethod->set_active(3); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + } + } + + event = EvWavenaclari; } else // unknown expander, returning ! { @@ -3008,31 +3181,32 @@ 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(std::vector &tpOpen) { - if(tpOpen.size() >= 9) { + if (tpOpen.size() >= 10) { expsettings->set_expanded(tpOpen.at(0)); expcontrast->set_expanded(tpOpen.at(1)); expchroma->set_expanded(tpOpen.at(2)); @@ -3042,6 +3216,7 @@ void Wavelet::updateToolState(std::vector &tpOpen) expgamut->set_expanded(tpOpen.at(6)); expresid->set_expanded(tpOpen.at(7)); expfinal->set_expanded(tpOpen.at(8)); + expclari->set_expanded(tpOpen.at(9)); } } diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index 163395d52..59dde8039 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -63,6 +63,13 @@ 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; + void foldAllButMe (GdkEventButton* event, MyExpander *expander); void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller) override; @@ -95,6 +102,7 @@ private: void tmrToggled (); void updatewavLabel (); void wavChanged (double nlevel) override; + void ushamethodChanged(); void HSmethodUpdateUI(); void CHmethodUpdateUI(); @@ -196,6 +204,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; @@ -224,6 +237,9 @@ 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; @@ -231,6 +247,7 @@ private: 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; @@ -240,10 +257,12 @@ 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 neutralPressedConn; From 7ec1b27a91d7f8a19f35c9dc65e1365ee6358602 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 23 Mar 2019 12:45:44 +0100 Subject: [PATCH 02/27] Add show mask to Clarity --- rtdata/languages/default | 4 +- rtengine/dcrop.cc | 6 ++ rtengine/improccoordinator.cc | 5 ++ rtengine/procparams.cc | 4 ++ rtengine/procparams.h | 1 + rtengine/simpleprocess.cc | 7 ++- rtgui/paramsedited.cc | 6 ++ rtgui/paramsedited.h | 1 + rtgui/wavelet.cc | 103 ++++++++++++++++++++++++++++++---- rtgui/wavelet.h | 7 ++- 10 files changed, 130 insertions(+), 14 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 6e2124b21..5ae722656 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -786,6 +786,7 @@ HISTORY_MSG_WAVMERGEL;Merge L HISTORY_MSG_WAVMERGEC;Merge C HISTORY_MSG_WAVSOFTRAD;Soft radius clarity HISTORY_MSG_WAVSOFTRADEND;Soft radius final +HISTORY_MSG_WAVSHOWMASK;Show mask HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -2268,8 +2269,9 @@ TP_WAVELET_TMTYPE;Compression method 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\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels +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\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels. TP_WAVELET_SHA;Sharp mask +TP_WAVELET_SHOWMASK;Show 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 diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index f334a6d27..7d2d573ba 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -993,6 +993,12 @@ void Crop::update(int todo) Glib::ustring provis; LabImage *provradius = nullptr; + if(WaveParams.showmask) { + // WaveParams.showmask = false; + // WaveParams.expclari = true; + } + + if (WaveParams.softrad > 0.f) { provradius = new LabImage(labnCrop->W, labnCrop->H); provradius->CopyFrom(labnCrop); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index c6207964f..1c5b1d5df 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -857,6 +857,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) Glib::ustring provis; LabImage *provradius = nullptr; + if(WaveParams.showmask) { + // WaveParams.showmask = false; + // WaveParams.expclari = true; + } + if (WaveParams.softrad > 0.f) { provradius = new LabImage(pW, pH); provradius->CopyFrom(nprevl); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 1bbab3f74..6aa680a62 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2156,6 +2156,7 @@ WaveletParams::WaveletParams() : softradend(0.), lipst(false), avoid(false), + showmask(false), tmr(false), strength(100), balance(0), @@ -2251,6 +2252,7 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && softradend == other.softradend && lipst == other.lipst && avoid == other.avoid + && showmask == other.showmask && tmr == other.tmr && strength == other.strength && balance == other.balance @@ -3421,6 +3423,7 @@ 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.rescon, "Wavelet", "ResidualcontShadow", wavelet.rescon, keyFile); saveToKeyfile(!pedited || pedited->wavelet.resconH, "Wavelet", "ResidualcontHighlight", wavelet.resconH, keyFile); @@ -4481,6 +4484,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) 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 diff --git a/rtengine/procparams.h b/rtengine/procparams.h index f2328217a..1258ee05b 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1187,6 +1187,7 @@ struct WaveletParams { bool lipst; bool avoid; + bool showmask; bool tmr; int strength; int balance; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 52ab5a590..d4cdfc81e 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1129,7 +1129,12 @@ private: WavOpacityCurveW waOpacityCurveW; WavOpacityCurveWL waOpacityCurveWL; LabImage *provradius = nullptr; - +/* + if(WaveParams.showmask) { + WaveParams.showmask = false; + WaveParams.expclari = true; + } +*/ if (WaveParams.softrad > 0.f) { provradius = new LabImage(fw, fh); provradius->CopyFrom(labView); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index cec0a5c92..6e9a6372c 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -480,6 +480,7 @@ void ParamsEdited::set(bool v) wavelet.Medgreinf = v; wavelet.ushamethod = v; wavelet.avoid = v; + wavelet.showmask = v; wavelet.tmr = v; wavelet.Lmethod = v; wavelet.CLmethod = v; @@ -1053,6 +1054,7 @@ void ParamsEdited::initFrom(const std::vector& 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; @@ -2846,6 +2848,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.wavelet.avoid = mods.wavelet.avoid; } + if (wavelet.showmask) { + toEdit.wavelet.showmask = mods.wavelet.showmask; + } + if (wavelet.tmr) { toEdit.wavelet.tmr = mods.wavelet.tmr; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 13d575d90..366703fc7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -477,6 +477,7 @@ struct WaveletParamsEdited { bool Medgreinf; bool ushamethod; bool avoid; + bool showmask; bool tmr; bool c[9]; bool ch[9]; diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index a6660610f..cda404d2a 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -75,6 +75,7 @@ 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))), @@ -161,6 +162,7 @@ Wavelet::Wavelet() : 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"); expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings)); @@ -477,6 +479,8 @@ Wavelet::Wavelet() : 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")); @@ -491,6 +495,7 @@ Wavelet::Wavelet() : 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()); @@ -1159,6 +1164,9 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1188,6 +1196,7 @@ 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); @@ -1333,6 +1342,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1512,6 +1522,7 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) pp->wavelet.enabled = getEnabled(); pp->wavelet.avoid = avoid->get_active(); + pp->wavelet.showmask = showmask->get_active(); pp->wavelet.tmr = tmr->get_active(); pp->wavelet.rescon = rescon->getValue(); pp->wavelet.resconH = resconH->getValue(); @@ -1597,6 +1608,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(); @@ -2342,14 +2354,14 @@ void Wavelet::ushamethodChanged() Dirmethod->set_active(3); Lmethod->set_sensitive(true); Dirmethod->set_sensitive(true); - } else if (ushamethod->get_active_row_number() == 0 || expclari->getEnabled() == 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) { + } else if (expclari->getEnabled() == false) { Backmethod->set_active(1); CLmethod->set_active(3); Lmethod->set_active(3); @@ -2975,6 +2987,72 @@ void Wavelet::avoidToggled() } } +void Wavelet::showmaskToggled() +{ + if (ushamethod->get_active_row_number() == 2 && showmask->get_active()) { + Backmethod->set_active(2); + CLmethod->set_active(2); + Lmethod->set_active(6); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + Dirmethod->set_active(3); + expclari->setEnabled(false); + + } else if (ushamethod->get_active_row_number() == 1 && showmask->get_active()) { + Backmethod->set_active(0); + CLmethod->set_active(1); + Lmethod->set_active(2); + Dirmethod->set_active(3); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + expclari->setEnabled(false); + + } + + if (ushamethod->get_active_row_number() == 2 && !showmask->get_active()) { + Backmethod->set_active(2); + CLmethod->set_active(2); + Lmethod->set_active(6); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + Dirmethod->set_active(3); + expclari->setEnabled(true); + + } else if (ushamethod->get_active_row_number() == 1 && !showmask->get_active()) { + Backmethod->set_active(0); + CLmethod->set_active(1); + Lmethod->set_active(2); + Dirmethod->set_active(3); + Lmethod->set_sensitive(true); + Dirmethod->set_sensitive(true); + expclari->setEnabled(true); + + } + + 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() { @@ -3150,13 +3228,19 @@ void Wavelet::enableToggled(MyExpander *expander) 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); - } else { + if (! showmask->get_active()) { + 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 (showmask->get_active()) { + showmask->set_active(false); + } + if (ushamethod->get_active_row_number() == 2) { Backmethod->set_active(2); CLmethod->set_active(2); @@ -3173,7 +3257,6 @@ void Wavelet::enableToggled(MyExpander *expander) Dirmethod->set_sensitive(true); } } - event = EvWavenaclari; } else // unknown expander, returning ! diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index 1e7a07fc6..7dee7e955 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -71,6 +71,7 @@ private: rtengine::ProcEvent EvWavmergeC; rtengine::ProcEvent EvWavsoftrad; rtengine::ProcEvent EvWavsoftradend; + rtengine::ProcEvent EvWavshowmask; void foldAllButMe (GdkEventButton* event, MyExpander *expander); @@ -89,6 +90,7 @@ private: void TMmethodChanged (); void TilesmethodChanged (); void avoidToggled (); + void showmaskToggled (); void cbenabToggled (); void contrastMinusPressed (); void contrastPlusPressed (); @@ -156,6 +158,7 @@ private: Gtk::CheckButton* const lipst; Gtk::CheckButton* const avoid; Gtk::CheckButton* const tmr; + Gtk::CheckButton* const showmask; Gtk::Button* const neutralchButton; Adjuster* correction[9]; @@ -266,13 +269,13 @@ private: 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; From 71cfb520a03900b760dee68f6458a286a5256544 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 23 Mar 2019 18:07:53 +0100 Subject: [PATCH 03/27] increase sensitivity of Soft radius clarity and shap mask --- rtengine/dcrop.cc | 4 ++-- rtengine/improccoordinator.cc | 4 ++-- rtengine/simpleprocess.cc | 4 ++-- rtgui/wavelet.cc | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 7d2d573ba..7ddf9ed8f 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1067,8 +1067,8 @@ void Crop::update(int todo) guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } - float blur = 10.f / skip * (0.1f + 0.8f * WaveParams.softrad); - rtengine::guidedFilter(guid, ble, ble, blur, 0.001, false); + float blur = 10.f / skip * (0.01f + 0.8f * WaveParams.softrad); + rtengine::guidedFilter(guid, ble, ble, blur, 0.0005, false); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 1c5b1d5df..1f18a3527 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -940,9 +940,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } - float blur = 10.f / scale * (0.1f + 0.8f * WaveParams.softrad); + float blur = 10.f / scale * (0.01f + 0.8f * WaveParams.softrad); // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); - rtengine::guidedFilter(guid, ble, ble, blur, 0.001, false); + rtengine::guidedFilter(guid, ble, ble, blur, 0.0005, false); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index d4cdfc81e..50badfdd6 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1211,9 +1211,9 @@ private: guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } - float blur = 10.f / 1 * (0.1f + 0.8f * WaveParams.softrad); + float blur = 10.f / 1 * (0.01f + 0.8f * WaveParams.softrad); // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); - rtengine::guidedFilter(guid, ble, ble, blur, 0.001, false); + rtengine::guidedFilter(guid, ble, ble, blur, 0.0005, false); diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index cda404d2a..4397e1662 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -117,8 +117,8 @@ Wavelet::Wavelet() : 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.1, 0.))), - softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.1, 0.))), + softrad(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.01, 0.))), + softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.01, 0.))), Lmethod(Gtk::manage(new MyComboBoxText())), CHmethod(Gtk::manage(new MyComboBoxText())), CHSLmethod(Gtk::manage(new MyComboBoxText())), From 3d62375623f39f51d85a614e07bad3d03bbfff28 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 24 Mar 2019 13:59:38 +0100 Subject: [PATCH 04/27] Improvment to Soft radius --- rtdata/languages/default | 4 ++-- rtengine/dcrop.cc | 11 ++++++++--- rtengine/improccoordinator.cc | 9 +++++++-- rtengine/ipwavelet.cc | 11 +++++++++-- rtengine/simpleprocess.cc | 9 +++++++-- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 5ae722656..f21a40d24 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -786,7 +786,7 @@ HISTORY_MSG_WAVMERGEL;Merge L HISTORY_MSG_WAVMERGEC;Merge C HISTORY_MSG_WAVSOFTRAD;Soft radius clarity HISTORY_MSG_WAVSOFTRADEND;Soft radius final -HISTORY_MSG_WAVSHOWMASK;Show mask +HISTORY_MSG_WAVSHOWMASK;Show wavelet mask HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -2271,7 +2271,7 @@ 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\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels. TP_WAVELET_SHA;Sharp mask -TP_WAVELET_SHOWMASK;Show 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 diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 7ddf9ed8f..21fca6153 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1066,9 +1066,14 @@ void Crop::update(int todo) ble[ir][jr] = (labnCrop->L[ir][jr] - provradius->L[ir][jr]) / 32768.f; guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } - - float blur = 10.f / skip * (0.01f + 0.8f * WaveParams.softrad); - rtengine::guidedFilter(guid, ble, ble, blur, 0.0005, false); + 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 / skip * (0.001f + 0.8f * WaveParams.softrad); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 1f18a3527..61736cdfb 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -939,10 +939,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) 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.01f + 0.8f * WaveParams.softrad); + 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, 0.0005, false); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 8b5f33b74..b25e75b7a 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1286,9 +1286,16 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } - float blur = 10.f / skip * (0.1f + 0.1f * waparams.softradend); + // float blur = 10.f / skip * (0.1f + 0.1f * waparams.softradend); + 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; - rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); + float blur = 10.f / scale * (0.001f + 0.8f * waparams.softradend); + + rtengine::guidedFilter(guid, ble, ble, blur, epsil, multiTh); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 50badfdd6..fde5c8310 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1210,10 +1210,15 @@ private: ble[ir][jr] = (labView->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 / 1 * (0.01f + 0.8f * WaveParams.softrad); + float blur = 10.f / 1 * (0.001f + 0.8f * WaveParams.softrad); // rtengine::guidedFilter(guid, ble, ble, blur, 0.001, multiTh); - rtengine::guidedFilter(guid, ble, ble, blur, 0.0005, false); + rtengine::guidedFilter(guid, ble, ble, blur, epsil, false); From 5837f722a8e9a320061de6134dfabe704cf63c8c Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 3 Apr 2019 09:23:03 +0200 Subject: [PATCH 05/27] disabled showmask - improve GUI --- rtdata/languages/default | 2 +- rtengine/dcrop.cc | 4 ++-- rtengine/improccoordinator.cc | 4 ++-- rtengine/procparams.cc | 2 +- rtengine/simpleprocess.cc | 4 ++-- rtgui/wavelet.cc | 43 +++++++++++++++++++---------------- 6 files changed, 31 insertions(+), 28 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 8ab20b81c..126d1d693 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2277,7 +2277,7 @@ TP_WAVELET_TMTYPE;Compression method 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\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels. +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.\n\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels. TP_WAVELET_SHA;Sharp mask TP_WAVELET_SHOWMASK;Show wavelet 'mask' TP_WAVELET_CLA;Clarity diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index b7fb38c8a..c13831468 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1006,7 +1006,7 @@ void Crop::update(int todo) - if (WaveParams.ushamethod != "none" && WaveParams.expclari && WaveParams.CLmethod != "all") { + if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { unshar = new LabImage(labnCrop->W, labnCrop->H); provis = params.wavelet.CLmethod; @@ -1020,7 +1020,7 @@ void Crop::update(int todo) parent->ipf.ip_wavelet(labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); - if (WaveParams.ushamethod != "none" && WaveParams.expclari && WaveParams.CLmethod != "all") { + 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); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 61736cdfb..2790f93a2 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -870,7 +870,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) - if (WaveParams.ushamethod != "none" && WaveParams.expclari && WaveParams.CLmethod != "all") { + 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"; @@ -884,7 +884,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); - if (WaveParams.ushamethod != "none" && WaveParams.expclari && WaveParams.CLmethod != "all") { + 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; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 6aa680a62..c60b8e8a0 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2178,7 +2178,7 @@ WaveletParams::WaveletParams() : daubcoeffmethod("4_"), CHmethod("without"), Medgreinf("less"), - ushamethod("none"), + ushamethod("clari"), CHSLmethod("SL"), EDmethod("CU"), NPmethod("none"), diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index fde5c8310..dcf66ca5e 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1144,7 +1144,7 @@ private: CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); - if (WaveParams.ushamethod != "none" && WaveParams.expclari && WaveParams.CLmethod != "all") { + 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"; @@ -1155,7 +1155,7 @@ private: ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); - if (WaveParams.ushamethod != "none" && WaveParams.expclari && WaveParams.CLmethod != "all") { + 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; diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 4397e1662..1fc4143d0 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -117,8 +117,8 @@ Wavelet::Wavelet() : 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.01, 0.))), - softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.01, 0.))), + softrad(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.1, 0.))), + softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.1, 0.))), Lmethod(Gtk::manage(new MyComboBoxText())), CHmethod(Gtk::manage(new MyComboBoxText())), CHSLmethod(Gtk::manage(new MyComboBoxText())), @@ -483,7 +483,7 @@ Wavelet::Wavelet() : 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_USH")); ushamethod->append(M("TP_WAVELET_SHA")); ushamethod->append(M("TP_WAVELET_CLA")); ushamethodconn = ushamethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::ushamethodChanged)); @@ -495,7 +495,7 @@ Wavelet::Wavelet() : clariBox->pack_start(*mergeL); clariBox->pack_start(*mergeC); clariBox->pack_start(*softrad); - clariBox->pack_start(*showmask); +// clariBox->pack_start(*showmask); // Edge Sharpness ToolParamBlock* const edgBox = Gtk::manage(new ToolParamBlock()); @@ -1038,12 +1038,13 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) } //ushamethod - if (pp->wavelet.ushamethod == "none") { +// if (pp->wavelet.ushamethod == "none") { +// ushamethod->set_active(0); + // } else + if (pp->wavelet.ushamethod == "sharp") { ushamethod->set_active(0); - } else if (pp->wavelet.ushamethod == "sharp") { - ushamethod->set_active(1); } else if (pp->wavelet.ushamethod == "clari") { - ushamethod->set_active(2); + ushamethod->set_active(1); } //CHSLmethod->set_active (1); @@ -1721,11 +1722,12 @@ 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 = "none"; - } else if (ushamethod->get_active_row_number() == 1) { pp->wavelet.ushamethod = "sharp"; - } else if (ushamethod->get_active_row_number() == 2) { + } else if (ushamethod->get_active_row_number() == 1) { pp->wavelet.ushamethod = "clari"; } @@ -2340,27 +2342,28 @@ void Wavelet::TilesmethodUpdateUI() { void Wavelet::ushamethodChanged() { - if (ushamethod->get_active_row_number() == 2 && expclari->getEnabled() == true) { + 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); - } else if (ushamethod->get_active_row_number() == 1 && expclari->getEnabled() == true) { + } 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); - } else if (ushamethod->get_active_row_number() == 0 || expclari->getEnabled() == 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); @@ -2989,7 +2992,7 @@ void Wavelet::avoidToggled() void Wavelet::showmaskToggled() { - if (ushamethod->get_active_row_number() == 2 && showmask->get_active()) { + if (ushamethod->get_active_row_number() == 1 && showmask->get_active()) { Backmethod->set_active(2); CLmethod->set_active(2); Lmethod->set_active(6); @@ -2998,7 +3001,7 @@ void Wavelet::showmaskToggled() Dirmethod->set_active(3); expclari->setEnabled(false); - } else if (ushamethod->get_active_row_number() == 1 && showmask->get_active()) { + } else if (ushamethod->get_active_row_number() == 0 && showmask->get_active()) { Backmethod->set_active(0); CLmethod->set_active(1); Lmethod->set_active(2); @@ -3009,7 +3012,7 @@ void Wavelet::showmaskToggled() } - if (ushamethod->get_active_row_number() == 2 && !showmask->get_active()) { + if (ushamethod->get_active_row_number() == 1 && !showmask->get_active()) { Backmethod->set_active(2); CLmethod->set_active(2); Lmethod->set_active(6); @@ -3018,7 +3021,7 @@ void Wavelet::showmaskToggled() Dirmethod->set_active(3); expclari->setEnabled(true); - } else if (ushamethod->get_active_row_number() == 1 && !showmask->get_active()) { + } else if (ushamethod->get_active_row_number() == 0 && !showmask->get_active()) { Backmethod->set_active(0); CLmethod->set_active(1); Lmethod->set_active(2); @@ -3241,14 +3244,14 @@ void Wavelet::enableToggled(MyExpander *expander) showmask->set_active(false); } - if (ushamethod->get_active_row_number() == 2) { + 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); - } else if (ushamethod->get_active_row_number() == 1) { + } else if (ushamethod->get_active_row_number() == 0) { Backmethod->set_active(0); CLmethod->set_active(1); Lmethod->set_active(2); From 516e05fa6138cb722a976e047ba66f6fe0ba839b Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 29 Apr 2019 07:45:26 +0200 Subject: [PATCH 06/27] Suppress grey image when chnanging Clarity --- rtengine/cplx_wavelet_filter_coeffs.h | 6 +++++- rtengine/dcrop.cc | 5 +++++ rtengine/improccoordinator.cc | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rtengine/cplx_wavelet_filter_coeffs.h b/rtengine/cplx_wavelet_filter_coeffs.h index bd333d4b9..629bbe659 100644 --- a/rtengine/cplx_wavelet_filter_coeffs.h +++ b/rtengine/cplx_wavelet_filter_coeffs.h @@ -49,6 +49,10 @@ const float Daub4_anal16[2][16] ALIGNED16 = {//Daub 14 { -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 float Daub4_anal22[2][22] ALIGNED16 = {//Daub 20 + {0.f, 0.f, 0.01885858f, 0.13306109f, 0.37278754f, 0.48681406f, 0.19881887f, -0.1766681f, -0.13855494f, 0.09006372f, 0.0658015f, -0.05048328f, -0.02082962f, 0.0234849f, 0.002550222f, -0.0075895, 0.0009866627f, 0.001408843f, -0.0004849739f, -0.0000823545f, 0.00006617734f, -0.0000093792f}, + {0.0000093792f, -0.00006617734f, 0.0000823545f, 0.0004849739f, -0.001408843f, -0.0009866627f, 0.0075895, -0.002550222f, -0.0234849f, 0.02082962f, 0.05048328f, -0.0658015f, -0.09006372f, 0.13855494f, 0.1766681f, -0.19881887f, -0.48681406f, -0.37278754f, -0.13306109f, -0.01885858f, 0.f, 0.f} +}; + } diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index c13831468..4550eac52 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1018,6 +1018,11 @@ void Crop::update(int todo) } + if (!WaveParams.expclari && WaveParams.CLmethod != "all") { + params.wavelet.CLmethod = "all"; + params.wavelet.Backmethod = "grey"; + } + 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") { diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 2790f93a2..c64fe9746 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -882,6 +882,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } + if (!WaveParams.expclari && WaveParams.CLmethod != "all") { + params->wavelet.CLmethod = "all"; + params->wavelet.Backmethod = "grey"; + } + 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") { From f8b9e2618c93a011f658ce7313f06e84801db743 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 29 Apr 2019 08:10:51 +0200 Subject: [PATCH 07/27] Comment variable in cplx_wavelet_filter --- rtengine/cplx_wavelet_filter_coeffs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/cplx_wavelet_filter_coeffs.h b/rtengine/cplx_wavelet_filter_coeffs.h index 629bbe659..44a60d57a 100644 --- a/rtengine/cplx_wavelet_filter_coeffs.h +++ b/rtengine/cplx_wavelet_filter_coeffs.h @@ -48,11 +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} }; - +/* const float Daub4_anal22[2][22] ALIGNED16 = {//Daub 20 {0.f, 0.f, 0.01885858f, 0.13306109f, 0.37278754f, 0.48681406f, 0.19881887f, -0.1766681f, -0.13855494f, 0.09006372f, 0.0658015f, -0.05048328f, -0.02082962f, 0.0234849f, 0.002550222f, -0.0075895, 0.0009866627f, 0.001408843f, -0.0004849739f, -0.0000823545f, 0.00006617734f, -0.0000093792f}, {0.0000093792f, -0.00006617734f, 0.0000823545f, 0.0004849739f, -0.001408843f, -0.0009866627f, 0.0075895, -0.002550222f, -0.0234849f, 0.02082962f, 0.05048328f, -0.0658015f, -0.09006372f, 0.13855494f, 0.1766681f, -0.19881887f, -0.48681406f, -0.37278754f, -0.13306109f, -0.01885858f, 0.f, 0.f} }; - +*/ } From f5eedc404d3aadd704fd1cea20e8d6b6b9fe7f88 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 10 May 2019 07:43:53 +0200 Subject: [PATCH 08/27] disable GUI background and process if clarity is selected --- rtengine/cplx_wavelet_filter_coeffs.h | 6 +++--- rtgui/wavelet.cc | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/rtengine/cplx_wavelet_filter_coeffs.h b/rtengine/cplx_wavelet_filter_coeffs.h index 44a60d57a..371f834a1 100644 --- a/rtengine/cplx_wavelet_filter_coeffs.h +++ b/rtengine/cplx_wavelet_filter_coeffs.h @@ -49,9 +49,9 @@ const float Daub4_anal16[2][16] ALIGNED16 = {//Daub 14 { -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} }; /* -const float Daub4_anal22[2][22] ALIGNED16 = {//Daub 20 - {0.f, 0.f, 0.01885858f, 0.13306109f, 0.37278754f, 0.48681406f, 0.19881887f, -0.1766681f, -0.13855494f, 0.09006372f, 0.0658015f, -0.05048328f, -0.02082962f, 0.0234849f, 0.002550222f, -0.0075895, 0.0009866627f, 0.001408843f, -0.0004849739f, -0.0000823545f, 0.00006617734f, -0.0000093792f}, - {0.0000093792f, -0.00006617734f, 0.0000823545f, 0.0004849739f, -0.001408843f, -0.0009866627f, 0.0075895, -0.002550222f, -0.0234849f, 0.02082962f, 0.05048328f, -0.0658015f, -0.09006372f, 0.13855494f, 0.1766681f, -0.19881887f, -0.48681406f, -0.37278754f, -0.13306109f, -0.01885858f, 0.f, 0.f} +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/rtgui/wavelet.cc b/rtgui/wavelet.cc index 1fc4143d0..7e4d41501 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -2349,6 +2349,8 @@ void Wavelet::ushamethodChanged() 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); @@ -2356,6 +2358,8 @@ void Wavelet::ushamethodChanged() 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); @@ -2371,6 +2375,8 @@ void Wavelet::ushamethodChanged() Dirmethod->set_active(3); Lmethod->set_sensitive(false); Dirmethod->set_sensitive(false); + CLmethod->set_sensitive(true); + Backmethod->set_sensitive(true); } if (listener && (multiImage || getEnabled())) { @@ -3238,6 +3244,8 @@ void Wavelet::enableToggled(MyExpander *expander) Dirmethod->set_active(3); Lmethod->set_sensitive(false); Dirmethod->set_sensitive(false); + CLmethod->set_sensitive(true); + Backmethod->set_sensitive(true); } } else { if (showmask->get_active()) { @@ -3251,6 +3259,8 @@ void Wavelet::enableToggled(MyExpander *expander) 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); @@ -3258,6 +3268,8 @@ void Wavelet::enableToggled(MyExpander *expander) Dirmethod->set_active(3); Lmethod->set_sensitive(true); Dirmethod->set_sensitive(true); + CLmethod->set_sensitive(false); + Backmethod->set_sensitive(false); } } event = EvWavenaclari; From 744ca10eccef478ef26f44f4a5bb7091824a2740 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 13 May 2019 16:18:37 +0200 Subject: [PATCH 09/27] Improve clarity --- rtengine/dcrop.cc | 25 +++++++++++++++++++++++ rtengine/improccoordinator.cc | 37 ++++++++++++++++++++++++----------- rtengine/simpleprocess.cc | 25 +++++++++++++++++++++++ 3 files changed, 76 insertions(+), 11 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 4550eac52..8aafac91c 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -992,6 +992,12 @@ void Crop::update(int todo) 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; @@ -1023,8 +1029,27 @@ void Crop::update(int todo) 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.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { float mL = (float)(WaveParams.mergeL / 100.f); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index c64fe9746..a4e95aacf 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -856,6 +856,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) 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; @@ -887,8 +893,27 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) 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.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { float mL = (float)(WaveParams.mergeL / 100.f); float mC = (float)(WaveParams.mergeC / 100.f); @@ -924,17 +949,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) if (WaveParams.softrad > 0.f) { array2D ble(pW, pH); array2D guid(pW, pH); - /* - #ifdef _OPENMP - const int numThreads = omp_get_max_threads(); - #endif - - bool multiTh = false; - - if (numThreads > 1) { - multiTh = true; - } - */ #ifdef _OPENMP #pragma omp parallel for #endif @@ -973,6 +987,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } + } ipf.softLight(nprevl); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index dcf66ca5e..dbc2f9168 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1129,6 +1129,13 @@ private: 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; @@ -1153,8 +1160,26 @@ private: 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.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { float mL = (float)(WaveParams.mergeL / 100.f); float mC = (float)(WaveParams.mergeC / 100.f); From 14dc398c4d69b0cb47bacfb88465a75fe36f8f82 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 14 May 2019 10:55:48 +0200 Subject: [PATCH 10/27] Improvment to softradius clarity --- rtengine/dcrop.cc | 71 +++++++++++++------------- rtengine/improccoordinator.cc | 45 +++++++++++++++-- rtengine/simpleprocess.cc | 93 ++++++++++++++++++----------------- 3 files changed, 123 insertions(+), 86 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 8aafac91c..2d584eb8c 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1046,7 +1046,41 @@ void Crop::update(int todo) WaveParams.expedge = proedge; WaveParams.expfinal = profin; WaveParams.exptoning = proton; - WaveParams.expnoise = pronois; + WaveParams.expnoise = pronois; + if (WaveParams.softrad > 0.f) { + array2D ble(labnCrop->W, labnCrop->H); + array2D guid(labnCrop->W, labnCrop->H); + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < labnCrop->H ; ir++) + for (int jr = 0; jr < labnCrop->W; jr++) { + ble[ir][jr] = (labnCrop->L[ir][jr]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 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++) { + labnCrop->L[ir][jr] = 32768.f * ble[ir][jr]; + } + } + } @@ -1082,41 +1116,6 @@ void Crop::update(int todo) delete unshar; unshar = NULL; - - if (WaveParams.softrad > 0.f) { - array2D ble(labnCrop->W, labnCrop->H); - array2D guid(labnCrop->W, labnCrop->H); - -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int ir = 0; ir < labnCrop->H ; ir++) - for (int jr = 0; jr < labnCrop->W; jr++) { - ble[ir][jr] = (labnCrop->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 / skip * (0.001f + 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++) { - labnCrop->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; - } - } - if (WaveParams.softrad > 0.f) { delete provradius; provradius = NULL; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index a4e95aacf..12929ae25 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -911,7 +911,42 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) WaveParams.expedge = proedge; WaveParams.expfinal = profin; WaveParams.exptoning = proton; - WaveParams.expnoise = pronois; + WaveParams.expnoise = pronois; + + 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]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 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++) { + nprevl->L[ir][jr] = 32768.f * ble[ir][jr]; + } + } + } if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { @@ -920,6 +955,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float mL0; float mC0; + + if ((WaveParams.CLmethod == "one" || WaveParams.CLmethod == "inf") && WaveParams.Backmethod == "black") { mL0 = mC0 = 0.f; mL = -mL; @@ -945,7 +982,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) delete unshar; unshar = NULL; - +/* if (WaveParams.softrad > 0.f) { array2D ble(pW, pH); array2D guid(pW, pH); @@ -979,7 +1016,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) nprevl->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; } } - +*/ if (WaveParams.softrad > 0.f) { delete provradius; provradius = NULL; @@ -987,7 +1024,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } - + } ipf.softLight(nprevl); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index dbc2f9168..7b7361c91 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1177,7 +1177,53 @@ private: WaveParams.expedge = proedge; WaveParams.expfinal = profin; WaveParams.exptoning = proton; - WaveParams.expnoise = pronois; + WaveParams.expnoise = pronois; + + if (WaveParams.softrad > 0.f) { + array2D ble(fw, fh); + array2D guid(fw, fh); + /* + #ifdef _OPENMP + const int numThreads = omp_get_max_threads(); + #endif + + bool multiTh = false; + + if (numThreads > 1) { + multiTh = true; + } + */ +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < fh; ir++) + for (int jr = 0; jr < fw; jr++) { + ble[ir][jr] = (labView->L[ir][jr]) / 32768.f; + guid[ir][jr] = provradius->L[ir][jr] / 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++) { + labView->L[ir][jr] = 32768.f * ble[ir][jr]; + } + } + } if ((WaveParams.ushamethod == "sharp" || WaveParams.ushamethod == "clari") && WaveParams.expclari && WaveParams.CLmethod != "all") { @@ -1212,51 +1258,6 @@ private: delete unshar; unshar = NULL; - if (WaveParams.softrad > 0.f) { - array2D ble(fw, fh); - array2D guid(fw, fh); - /* - #ifdef _OPENMP - const int numThreads = omp_get_max_threads(); - #endif - - bool multiTh = false; - - if (numThreads > 1) { - multiTh = true; - } - */ -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int ir = 0; ir < fh; ir++) - for (int jr = 0; jr < fw; jr++) { - ble[ir][jr] = (labView->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 / 1 * (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 < fh; ir++) - for (int jr = 0; jr < fw; jr++) { - labView->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; - } - } - if (WaveParams.softrad > 0.f) { delete provradius; provradius = NULL; From 1ee64dcdb6a103141d54239638571c53e4308a4d Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 15 May 2019 13:37:38 +0200 Subject: [PATCH 11/27] Improve general soft --- rtengine/ipwavelet.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index b25e75b7a..31b215f02 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1282,11 +1282,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int ir = 0; ir < lab->H; ir++) for (int jr = 0; jr < lab->W; jr++) { - ble[ir][jr] = (dst->L[ir][jr] - provradius->L[ir][jr]) / 32768.f; + ble[ir][jr] = dst->L[ir][jr] / 32768.f; guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } - // float blur = 10.f / skip * (0.1f + 0.1f * waparams.softradend); double epsilmax = 0.001; double epsilmin = 0.0001; double aepsil = (epsilmax - epsilmin) / 90.f; @@ -1305,7 +1304,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int ir = 0; ir < lab->H; ir++) for (int jr = 0; jr < lab->W; jr++) { - dst->L[ir][jr] = provradius->L[ir][jr] + 32768.f * ble[ir][jr]; + dst->L[ir][jr] = 32768.f * ble[ir][jr]; } } From fc9867eb2db7f2cda9965409bcb605772ac2d251 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 21 May 2019 07:48:18 +0200 Subject: [PATCH 12/27] Improvment to residual image --- rtdata/languages/default | 6 +++- rtengine/improcfun.cc | 8 ++--- rtengine/ipwavelet.cc | 8 +++-- rtengine/procparams.cc | 8 +++++ rtengine/procparams.h | 2 ++ rtgui/addsetids.h | 2 ++ rtgui/batchtoolpanelcoord.cc | 6 ++-- rtgui/epd.cc | 12 +++---- rtgui/paramsedited.cc | 12 +++++++ rtgui/paramsedited.h | 2 ++ rtgui/preferences.cc | 2 ++ rtgui/wavelet.cc | 63 +++++++++++++++++++++++++++++++++--- rtgui/wavelet.h | 6 +++- 13 files changed, 115 insertions(+), 22 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 8cad97db8..2c478a23a 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -781,6 +781,8 @@ HISTORY_MSG_WAVMERGEC;Merge C 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_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -2228,8 +2230,10 @@ 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 diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index f63313126..bb7c0ac6b 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5126,11 +5126,11 @@ void ImProcFunctions::EPDToneMapCIE (CieImage *ncie, float a_w, float c_, int Wi if (!params->epd.enabled) { return; } - +/* if (params->wavelet.enabled && params->wavelet.tmrs != 0) { return; } - +*/ float stren = params->epd.strength; float edgest = params->epd.edgeStopping; float sca = params->epd.scale; @@ -5240,11 +5240,11 @@ void ImProcFunctions::EPDToneMap (LabImage *lab, unsigned int Iterates, int skip if (!params->epd.enabled) { return; } - +/* if (params->wavelet.enabled && params->wavelet.tmrs != 0) { return; } - +*/ float stren = params->epd.strength; float edgest = params->epd.edgeStopping; float sca = params->epd.scale; diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 3c51d8f18..af8adca90 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1590,8 +1590,8 @@ 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; EdgePreservingDecomposition epd2(W_L, H_L); @@ -1769,6 +1769,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * { if (contrast != 0.f && cp.resena && max0 > 0.0) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step { + // #ifdef _OPENMP #pragma omp for #endif @@ -1794,7 +1795,8 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } } } - + +// if (cp.tonemap && cp.contmet == 1 && cp.resena) { float maxp = max0 * 256.f; float minp = min0 * 256.f; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index c60b8e8a0..1fa4d62a4 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2190,6 +2190,8 @@ WaveletParams::WaveletParams() : resconH(0), reschro(0), tmrs(0), + edgs(1.4), + scale(1.), gamma(1), sup(0), sky(0.0), @@ -2293,6 +2295,8 @@ bool WaveletParams::operator ==(const WaveletParams& other) const && resconH == other.resconH && reschro == other.reschro && tmrs == other.tmrs + && edgs == other.edgs + && scale == other.scale && gamma == other.gamma && sup == other.sup && sky == other.sky @@ -3431,6 +3435,8 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->wavelet.thrH, "Wavelet", "ThresholdResidHighLight", wavelet.thrH, 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); @@ -4516,6 +4522,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) 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); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 1258ee05b..a17a34aaa 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1222,6 +1222,8 @@ struct WaveletParams { int resconH; int reschro; double tmrs; + double edgs; + double scale; double gamma; int sup; double sky; diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 163bc27ef..7e9f6f6cd 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -103,6 +103,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 1a0eaeb28..63934f21c 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -165,7 +165,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); dirpyrdenoise->setAdjusterBehavior (false, false, false, false, false, false, false); bayerprocess->setAdjusterBehavior(false, false, false, false, false, false); xtransprocess->setAdjusterBehavior(false, false); @@ -213,7 +213,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_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]); @@ -329,6 +329,8 @@ 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_SKYPROTECT]) { pparams.wavelet.sky = 0; } diff --git a/rtgui/epd.cc b/rtgui/epd.cc index 4b7cca10a..0b62569eb 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); @@ -69,7 +69,7 @@ void EdgePreservingDecompositionUI::read(const ProcParams *pp, const ParamsEdite setEnabled(pp->epd.enabled); strength->set_sensitive (true); - +/* if(pp->wavelet.enabled) { if(pp->wavelet.tmrs == 0) { strength->set_sensitive (true); @@ -79,7 +79,7 @@ void EdgePreservingDecompositionUI::read(const ProcParams *pp, const ParamsEdite gamma->set_sensitive (false); } } - +*/ strength->setValue(pp->epd.strength); gamma->setValue(pp->epd.gamma); edgeStopping->setValue(pp->epd.edgeStopping); @@ -98,7 +98,7 @@ void EdgePreservingDecompositionUI::write(ProcParams *pp, ParamsEdited *pedited) pp->epd.reweightingIterates = reweightingIterates->getValue(); pp->epd.enabled = getEnabled(); strength->set_sensitive (true); - +/* if(pp->wavelet.enabled) { if(pp->wavelet.tmrs == 0) { strength->set_sensitive (true); @@ -108,7 +108,7 @@ void EdgePreservingDecompositionUI::write(ProcParams *pp, ParamsEdited *pedited) gamma->set_sensitive (false); } } - +*/ if(pedited) { pedited->epd.strength = strength->getEditedState(); pedited->epd.gamma = gamma->getEditedState(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 6e9a6372c..f0abd04f7 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -499,6 +499,8 @@ void ParamsEdited::set(bool 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; @@ -1073,6 +1075,8 @@ void ParamsEdited::initFrom(const std::vector& 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; @@ -3073,6 +3077,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 366703fc7..5e123e638 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -498,6 +498,8 @@ struct WaveletParamsEdited { bool resconH; bool reschro; bool tmrs; + bool edgs; + bool scale; bool gamma; bool sup; bool sky; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index b7d10c8de..63a9315a6 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -389,6 +389,8 @@ Gtk::Widget* Preferences::getBatchProcPanel () appendBehavList (mi, M ("TP_WAVELET_THRH"), ADDSET_WA_THRRH, 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 2c83319d7..165db8e94 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -81,6 +81,8 @@ Wavelet::Wavelet() : resconH(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCONH"), -100, 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.))), @@ -163,6 +165,8 @@ Wavelet::Wavelet() : 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"); expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings)); @@ -704,6 +708,16 @@ Wavelet::Wavelet() : resBox->pack_start(*gamma); gamma->setAdjusterListener(this); + //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); @@ -1203,6 +1217,8 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1350,6 +1366,8 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1529,6 +1547,8 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) 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(); @@ -1636,6 +1656,8 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) 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(); @@ -1867,6 +1889,8 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit 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); @@ -1925,6 +1949,8 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit 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); @@ -1972,6 +1998,8 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit resconH->setDefaultEditedState(Irrelevant); reschro->setDefaultEditedState(Irrelevant); tmrs->setDefaultEditedState(Irrelevant); + edgs->setDefaultEditedState(Irrelevant); + scale->setDefaultEditedState(Irrelevant); gamma->setDefaultEditedState(Irrelevant); sup->setDefaultEditedState(Irrelevant); sky->setDefaultEditedState(Irrelevant); @@ -2274,6 +2302,14 @@ 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() @@ -2476,6 +2512,8 @@ void Wavelet::setBatchMode(bool batchMode) resconH->showEditedCB(); reschro->showEditedCB(); tmrs->showEditedCB(); + edgs->showEditedCB(); + scale->showEditedCB(); gamma->showEditedCB(); sup->showEditedCB(); sky->showEditedCB(); @@ -2524,7 +2562,7 @@ void Wavelet::setBatchMode(bool batchMode) void Wavelet::adjusterUpdateUI(Adjuster* a) { - /* + /* if (!batchMode) { if (a == tmrs ) { float tm; @@ -2537,10 +2575,10 @@ void Wavelet::adjusterUpdateUI(Adjuster* a) tm=tmrs->getValue(); if(tm==0.f) tmr->hide(); else tmr->show(); - ); + } } - */ + */ } void Wavelet::adjusterChanged(Adjuster* a, double newval) @@ -2554,12 +2592,25 @@ void Wavelet::adjusterChanged(Adjuster* a, double newval) listener->panelChanged(EvWavresconH, resconH->getTextValue()); } else if (a == reschro) { listener->panelChanged(EvWavreschro, reschro->getTextValue()); - } else if (a == tmrs) { + } else if (a == tmrs) { adjusterUpdateUI(a); 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 == 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) { @@ -3130,7 +3181,7 @@ void Wavelet::colorForValue(double valX, double valY, enum ColorCaller::ElemType 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 skyadd, bool edgradadd, bool edgvaladd, bool strengthadd, bool gammaadd, bool edgedetectadd, bool edgedetectthradd, bool edgedetectthr2add) { for (int i = 0; i < 9; i++) { @@ -3148,6 +3199,8 @@ void Wavelet::setAdjusterBehavior(bool multiplieradd, bool thresholdadd, bool th resconH->setAddMode(resconHadd); reschro->setAddMode(reschroadd); tmrs->setAddMode(tmrsadd); + edgs->setAddMode(edgsadd); + scale->setAddMode(scaleadd); thr->setAddMode(thradd); thrH->setAddMode(thrHadd); sky->setAddMode(skyadd); diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index 7dee7e955..5878a1ae4 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -50,7 +50,7 @@ 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 edgsadd, bool scaleadd, 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 setBatchMode (bool batchMode) override; void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void setEditProvider (EditDataProvider *provider) override; @@ -72,6 +72,8 @@ private: rtengine::ProcEvent EvWavsoftrad; rtengine::ProcEvent EvWavsoftradend; rtengine::ProcEvent EvWavshowmask; + rtengine::ProcEvent EvWavedgs; + rtengine::ProcEvent EvWavscale; void foldAllButMe (GdkEventButton* event, MyExpander *expander); @@ -167,6 +169,8 @@ private: Adjuster* const resconH; Adjuster* const reschro; Adjuster* const tmrs; + Adjuster* const edgs; + Adjuster* const scale; Adjuster* const gamma; Adjuster* const sup; Adjuster* const sky; From 04d6b28d2ed7cee893c0cdca9834e3b9d8fe3615 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 26 May 2019 17:28:58 +0200 Subject: [PATCH 13/27] Improve contrast residual --- rtengine/ipwavelet.cc | 52 ++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index af8adca90..51dbe149e 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1663,11 +1663,7 @@ 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; @@ -1735,14 +1731,7 @@ 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]; @@ -1763,35 +1752,32 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * 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.0) { // contrast = 0.f means that all will be multiplied by 1.f, so we can skip this step { - // + #ifdef _OPENMP - #pragma omp for + #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; } } } From 83f487753c6da9868730126c4e9f3a09c7341f1c Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 27 May 2019 09:23:56 +0200 Subject: [PATCH 14/27] Improve shadows-Highlight Residual --- rtdata/languages/default | 2 + rtengine/improcfun.cc | 3 +- rtengine/improcfun.h | 3 +- rtengine/ipshadowshighlights.cc | 18 ++++----- rtengine/ipwavelet.cc | 68 ++++++++++++++------------------- rtengine/procparams.cc | 8 +++- rtengine/procparams.h | 1 + rtgui/addsetids.h | 1 + rtgui/batchtoolpanelcoord.cc | 5 ++- rtgui/paramsedited.h | 1 + rtgui/preferences.cc | 1 + rtgui/wavelet.cc | 26 ++++++++++--- rtgui/wavelet.h | 4 +- 13 files changed, 80 insertions(+), 61 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index f9c89888a..3bb511d2b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -784,6 +784,7 @@ 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 @@ -2202,6 +2203,7 @@ 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 diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index bb7c0ac6b..d1529184e 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -3649,7 +3649,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 cd1650f6e..68aff736b 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -351,7 +351,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 6ce66d9b3..96b8e84ef 100644 --- a/rtengine/ipshadowshighlights.cc +++ b/rtengine/ipshadowshighlights.cc @@ -27,20 +27,20 @@ #include "sleef.c" namespace rtengine { - -void ImProcFunctions::shadowsHighlights(LabImage *lab) +//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) { - 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 = float(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); @@ -187,12 +187,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 51dbe149e..bf9a6f37e 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -71,6 +71,7 @@ struct cont_params { float thH; float conres; float conresH; + float radius; float chrores; float hueres; float sky; @@ -435,6 +436,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; @@ -1782,7 +1784,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } } -// + if (cp.tonemap && cp.contmet == 1 && cp.resena) { float maxp = max0 * 256.f; float minp = min0 * 256.f; @@ -1791,54 +1793,40 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #endif ContrastResid(WavCoeffs_L0, cp, W_L, H_L, maxp, minp); } - -#ifdef _OPENMP - #pragma omp barrier -#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 + LabImage *temp = nullptr; + temp = new LabImage(W_L, H_L); #ifdef _OPENMP - #pragma omp for nowait + #pragma omp for #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; + 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]; + } } - 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); - } + delete temp; - //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); - } - } } + +#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) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 1fa4d62a4..4a23e02dd 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2209,8 +2209,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), @@ -2316,6 +2317,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 @@ -3433,6 +3435,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo 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); @@ -4543,6 +4546,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); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index a17a34aaa..d5d055ca1 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1243,6 +1243,7 @@ struct WaveletParams { int edgthresh; int thr; int thrH; + int radius; double skinprotect; Threshold hueskin; Threshold hueskin2; diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 7e9f6f6cd..a03228c33 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -86,6 +86,7 @@ enum { ADDSET_WA_SKINPROTECT, ADDSET_WA_THRR, ADDSET_WA_THRRH, + ADDSET_WA_RADIUS, ADDSET_WA_THRES, ADDSET_WA_THRESHOLD, ADDSET_WA_THRESHOLD2, diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 63934f21c..1c7e61b04 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -165,7 +165,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, 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); @@ -213,7 +213,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_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_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]); @@ -333,6 +333,7 @@ void BatchToolPanelCoordinator::initSession () 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/paramsedited.h b/rtgui/paramsedited.h index 5e123e638..160f68feb 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -519,6 +519,7 @@ struct WaveletParamsEdited { bool edgthresh; bool thr; bool thrH; + bool radius; bool skinprotect; bool hueskin; bool hueskin2; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 63a9315a6..2269c6749 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -387,6 +387,7 @@ 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); diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 165db8e94..5275fa948 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -77,8 +77,8 @@ Wavelet::Wavelet() : 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))), + 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))), @@ -90,8 +90,9 @@ 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))), + 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))), @@ -167,6 +168,7 @@ Wavelet::Wavelet() : 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"); expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Wavelet::foldAllButMe), expsettings)); @@ -678,6 +680,9 @@ Wavelet::Wavelet() : thrH->setAdjusterListener(this); resBox->pack_start(*thrH, Gtk::PACK_SHRINK); + 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 @@ -1231,6 +1236,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1406,6 +1412,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1567,6 +1574,7 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) 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(); @@ -1676,6 +1684,7 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) pedited->wavelet.edgval = edgval->getEditedState(); pedited->wavelet.thr = thr->getEditedState(); pedited->wavelet.thrH = thrH->getEditedState(); + pedited->wavelet.radius = radius->getEditedState(); pedited->wavelet.hueskin = hueskin->getEditedState(); pedited->wavelet.hueskin2 = hueskin2->getEditedState(); pedited->wavelet.skinprotect = skinprotect->getEditedState(); @@ -1910,6 +1919,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit 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); @@ -1970,6 +1980,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit 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); @@ -2019,6 +2030,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit edgthresh->setDefaultEditedState(Irrelevant); thr->setDefaultEditedState(Irrelevant); thrH->setDefaultEditedState(Irrelevant); + radius->setDefaultEditedState(Irrelevant); skinprotect->setDefaultEditedState(Irrelevant); hueskin->setDefaultEditedState(Irrelevant); hueskin2->setDefaultEditedState(Irrelevant); @@ -2533,6 +2545,7 @@ void Wavelet::setBatchMode(bool batchMode) edgthresh->showEditedCB(); thr->showEditedCB(); thrH->showEditedCB(); + radius->showEditedCB(); skinprotect->showEditedCB(); hueskin->showEditedCB(); hueskin2->showEditedCB(); @@ -2625,6 +2638,8 @@ void Wavelet::adjusterChanged(Adjuster* a, double newval) 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) { @@ -3181,7 +3196,7 @@ void Wavelet::colorForValue(double valX, double valY, enum ColorCaller::ElemType 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 edgsadd, bool scaleadd, 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++) { @@ -3203,6 +3218,7 @@ void Wavelet::setAdjusterBehavior(bool multiplieradd, bool thresholdadd, bool th scale->setAddMode(scaleadd); thr->setAddMode(thradd); thrH->setAddMode(thrHadd); + radius->setAddMode(radiusadd); sky->setAddMode(skyadd); edgrad->setAddMode(edgradadd); edgval->setAddMode(edgvaladd); diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index 5878a1ae4..4ef36d076 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -50,7 +50,7 @@ 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 edgsadd, bool scaleadd, 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; @@ -74,6 +74,7 @@ private: rtengine::ProcEvent EvWavshowmask; rtengine::ProcEvent EvWavedgs; rtengine::ProcEvent EvWavscale; + rtengine::ProcEvent EvWavradius; void foldAllButMe (GdkEventButton* event, MyExpander *expander); @@ -180,6 +181,7 @@ private: Adjuster* const contrast; Adjuster* const thr; Adjuster* const thrH; + Adjuster* const radius; Adjuster* const skinprotect; Adjuster* const edgrad; Adjuster* const edgval; From 25e66f1fc23ebf9051d98fa1f6e209b64ee5d9c5 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 27 May 2019 11:20:14 +0200 Subject: [PATCH 15/27] Small improvments residual --- rtengine/ipwavelet.cc | 2 +- rtgui/paramsedited.cc | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index bf9a6f37e..de5d193a1 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1595,7 +1595,7 @@ void ImProcFunctions::EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterat 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 diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index f0abd04f7..3616aade1 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -520,6 +520,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; @@ -1096,6 +1097,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; @@ -2928,6 +2930,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; } From f2666dc464dae9da843baa8bd50de4a53173303f Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 14 Jun 2019 07:28:37 +0200 Subject: [PATCH 16/27] Re-enabled showmask clarity and sharp-mask --- rtengine/dcrop.cc | 14 ++++++-- rtengine/improccoordinator.cc | 14 +++++--- rtgui/wavelet.cc | 63 +++++------------------------------ 3 files changed, 30 insertions(+), 61 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 7a72cc1cc..e08a53a10 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1102,6 +1102,14 @@ void Crop::update(int todo) mL0 = mL = mC0 = mC = 0.f; } + float indic = 1.f; + if(WaveParams.showmask){ + mL0 = mC0 = -1.f; + indic = -1.f; + mL = fabs(mL); + mC = fabs(mC); + } + #ifdef _OPENMP #pragma omp parallel for @@ -1109,9 +1117,9 @@ void Crop::update(int todo) for (int x = 0; x < labnCrop->H; x++) for (int y = 0; y < labnCrop->W; y++) { - labnCrop->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * labnCrop->L[x][y]; - labnCrop->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * labnCrop->a[x][y]; - labnCrop->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * labnCrop->b[x][y]; + labnCrop->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * indic * labnCrop->L[x][y]; + 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; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index b9d1664cd..5b946fb8c 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -967,17 +967,23 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } else { mL0 = mL = mC0 = mC = 0.f; } + float indic = 1.f; - + if(WaveParams.showmask){ + mL0 = mC0 = -1.f; + indic = -1.f; + mL = fabs(mL); + mC = fabs(mC); + } #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] = (1.f + mL0) * (unshar->L[x][y]) - mL * nprevl->L[x][y]; - nprevl->a[x][y] = (1.f + mC0) * (unshar->a[x][y]) - mC * nprevl->a[x][y]; - nprevl->b[x][y] = (1.f + mC0) * (unshar->b[x][y]) - mC * nprevl->b[x][y]; + nprevl->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * indic * nprevl->L[x][y]; + 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; diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 5275fa948..7f9164779 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -501,7 +501,7 @@ Wavelet::Wavelet() : clariBox->pack_start(*mergeL); clariBox->pack_start(*mergeC); clariBox->pack_start(*softrad); -// clariBox->pack_start(*showmask); + clariBox->pack_start(*showmask); // Edge Sharpness ToolParamBlock* const edgBox = Gtk::manage(new ToolParamBlock()); @@ -3064,46 +3064,6 @@ void Wavelet::avoidToggled() void Wavelet::showmaskToggled() { - if (ushamethod->get_active_row_number() == 1 && showmask->get_active()) { - Backmethod->set_active(2); - CLmethod->set_active(2); - Lmethod->set_active(6); - Lmethod->set_sensitive(true); - Dirmethod->set_sensitive(true); - Dirmethod->set_active(3); - expclari->setEnabled(false); - - } else if (ushamethod->get_active_row_number() == 0 && showmask->get_active()) { - Backmethod->set_active(0); - CLmethod->set_active(1); - Lmethod->set_active(2); - Dirmethod->set_active(3); - Lmethod->set_sensitive(true); - Dirmethod->set_sensitive(true); - expclari->setEnabled(false); - - } - - if (ushamethod->get_active_row_number() == 1 && !showmask->get_active()) { - Backmethod->set_active(2); - CLmethod->set_active(2); - Lmethod->set_active(6); - Lmethod->set_sensitive(true); - Dirmethod->set_sensitive(true); - Dirmethod->set_active(3); - expclari->setEnabled(true); - - } else if (ushamethod->get_active_row_number() == 0 && !showmask->get_active()) { - Backmethod->set_active(0); - CLmethod->set_active(1); - Lmethod->set_active(2); - Dirmethod->set_active(3); - Lmethod->set_sensitive(true); - Dirmethod->set_sensitive(true); - expclari->setEnabled(true); - - } - if (multiImage) { if (showmask->get_inconsistent()) { showmask->set_inconsistent(false); @@ -3306,20 +3266,15 @@ void Wavelet::enableToggled(MyExpander *expander) event = EvWavenafin; } else if (expander == expclari) { if (expclari->getEnabled() == false) { - if (! showmask->get_active()) { - 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); - } + 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 (showmask->get_active()) { - showmask->set_active(false); - } if (ushamethod->get_active_row_number() == 1) { Backmethod->set_active(2); From 9338bef4c69e3825147aed007e0691efc22da4a4 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 24 Jul 2019 07:23:51 +0200 Subject: [PATCH 17/27] Change limit Lmethod for clarity and sharp-mask --- rtgui/wavelet.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 7f9164779..b66d61e93 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -248,7 +248,6 @@ Wavelet::Wavelet() : 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")); @@ -2491,6 +2490,14 @@ void Wavelet::LmethodUpdateUI() { void Wavelet::LmethodChanged() { //LmethodUpdateUI(); + 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()); } From 7d9edc4681ea806d36ebe93b87d90599aa08c4ea Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 24 Jul 2019 08:54:17 +0200 Subject: [PATCH 18/27] Change clarity tooltip --- rtdata/languages/default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 3014ce83d..146a5c2c1 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2249,7 +2249,7 @@ 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.\n\nIf you select Clarity, wavelet settings will be automatically positioned :\nBackground=residual, Process=above, level=7..you can change level and wavelet levels. +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 From 9cd4ca51d317e2bd246d3dc34cb87ae41c461568 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 27 Aug 2019 08:56:15 +0200 Subject: [PATCH 19/27] Change Guidedfilter Guid reference from L to Y --- rtengine/improccoordinator.cc | 9 ++++++++- rtengine/ipwavelet.cc | 10 +++++++++- rtgui/wavelet.cc | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index bbc37cd2a..6a93d1d82 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -934,8 +934,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) 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; + ble[ir][jr] = (nprevl->L[ir][jr]) / 32768.f; - guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } double epsilmax = 0.0001; double epsilmin = 0.00001; diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 4b46c9742..8a2e3eeda 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -1285,7 +1285,15 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int ir = 0; ir < lab->H; ir++) for (int jr = 0; jr < lab->W; jr++) { ble[ir][jr] = dst->L[ir][jr] / 32768.f; - guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + 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; + +// guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } double epsilmax = 0.001; diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 4aa18f5bd..375e0a8cf 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -120,8 +120,8 @@ Wavelet::Wavelet() : 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.1, 0.))), - softradend(Gtk::manage(new Adjuster(M("TP_WAVELET_SOFTRAD"), 0.0, 100., 0.1, 0.))), + 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())), From 8fc55ea70c3cdce41d91509fb8cd543b31c67574 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 29 Aug 2019 13:29:14 +0200 Subject: [PATCH 20/27] Change GUI for residual chroma --- rtdata/languages/default | 3 ++- rtgui/wavelet.cc | 14 +++++++++++--- rtgui/wavelet.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 146a5c2c1..977f40149 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2109,6 +2109,7 @@ 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 @@ -2216,7 +2217,7 @@ 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 diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 375e0a8cf..775205bdb 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -140,6 +140,7 @@ Wavelet::Wavelet() : 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") + ":"))), @@ -687,8 +688,14 @@ Wavelet::Wavelet() : resBox->pack_start(*contrast); //keep the possibility to reinstall reschro->setAdjusterListener(this); - resBox->pack_start(*reschro); +// resBox->pack_start(*reschro); + 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()); @@ -727,18 +734,19 @@ Wavelet::Wavelet() : hueskin2->set_tooltip_markup(M("TP_WAVELET_HUESKY_TOOLTIP")); hueskin2->setBgGradient(milestones); - resBox->pack_start(*hueskin2); +// resBox->pack_start(*hueskin2); hueskin2->setAdjusterListener(this); sky->set_tooltip_text(M("TP_WAVELET_SKY_TOOLTIP")); sky->setAdjusterListener(this); - resBox->pack_start(*sky); +// resBox->pack_start(*sky); // whole hue range const std::vector milestones3 = makeWholeHueRange(); 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")); diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index 918e9fa7c..0cf63a225 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -253,6 +253,7 @@ private: Gtk::Frame* const chanMixerHLFrame; Gtk::Frame* const chanMixerMidFrame; Gtk::Frame* const chanMixerShadowsFrame; + Gtk::Frame* const chromaFrame; Gtk::Label* const wavLabels; Gtk::Label* const labmC; From 0cfe14f433b4763c7082d094339f21001510965c Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 29 Aug 2019 18:59:45 +0200 Subject: [PATCH 21/27] Move gamut in GUI after contrast and chroma --- rtgui/wavelet.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 775205bdb..dde60b93e 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -918,6 +918,10 @@ Wavelet::Wavelet() : expchroma->setLevel(2); pack_start(*expchroma); + expgamut->add(*conBox, false); + expgamut->setLevel(2); + pack_start(*expgamut); + exptoning->add(*tonBox, false); exptoning->setLevel(2); pack_start(*exptoning); @@ -934,9 +938,6 @@ Wavelet::Wavelet() : expclari->setLevel(2); pack_start(*expclari); - expgamut->add(*conBox, false); - expgamut->setLevel(2); - pack_start(*expgamut); expresid->add(*resBox, false); expresid->setLevel(2); From 1c6fa0d3d0bc4b3d9d0051d6ea1194e2cc646be0 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 30 Aug 2019 07:06:36 +0200 Subject: [PATCH 22/27] Clean code and adjustements to guidefilter --- rtengine/improccoordinator.cc | 21 ++++++++++++++++++--- rtengine/ipwavelet.cc | 23 +++++++++++++++++++---- rtgui/wavelet.cc | 5 +---- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 6a93d1d82..b3f5b186e 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -928,6 +928,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) 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 @@ -941,8 +943,14 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) Color::Lab2XYZ(L, a, b, X, Y, Z); guid[ir][jr] = Y / 32768.f; - - ble[ir][jr] = (nprevl->L[ir][jr]) / 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; @@ -962,8 +970,15 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) for (int ir = 0; ir < pH; ir++) for (int jr = 0; jr < pW; jr++) { - nprevl->L[ir][jr] = 32768.f * ble[ir][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; + } } diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 8a2e3eeda..7db25dbd1 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -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 // @@ -1269,6 +1269,8 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const 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; @@ -1284,7 +1286,6 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int ir = 0; ir < lab->H; ir++) for (int jr = 0; jr < lab->W; jr++) { - ble[ir][jr] = dst->L[ir][jr] / 32768.f; float X, Y, Z; float L = provradius->L[ir][jr]; float a = provradius->a[ir][jr]; @@ -1292,8 +1293,15 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const 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; -// guid[ir][jr] = provradius->L[ir][jr] / 32768.f; } double epsilmax = 0.001; @@ -1314,8 +1322,15 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const for (int ir = 0; ir < lab->H; ir++) for (int jr = 0; jr < lab->W; jr++) { - dst->L[ir][jr] = 32768.f * ble[ir][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) { diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index dde60b93e..e3460e685 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" @@ -688,7 +688,6 @@ Wavelet::Wavelet() : resBox->pack_start(*contrast); //keep the possibility to reinstall reschro->setAdjusterListener(this); -// resBox->pack_start(*reschro); chromaFrame->set_label_align(0.025, 0.5); ToolParamBlock* const chromaBox = Gtk::manage(new ToolParamBlock()); @@ -734,13 +733,11 @@ Wavelet::Wavelet() : hueskin2->set_tooltip_markup(M("TP_WAVELET_HUESKY_TOOLTIP")); hueskin2->setBgGradient(milestones); -// resBox->pack_start(*hueskin2); hueskin2->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(); From 6a0e1cf1b6658e6ca992bc65f80dce94f0b20f3b Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 30 Aug 2019 07:42:47 +0200 Subject: [PATCH 23/27] change guidedfilter wavalet in simpleprocess --- rtengine/simpleprocess.cc | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 8270ec45b..1348879c3 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1187,25 +1187,29 @@ private: if (WaveParams.softrad > 0.f) { array2D ble(fw, fh); array2D guid(fw, fh); - /* - #ifdef _OPENMP - const int numThreads = omp_get_max_threads(); - #endif - - bool multiTh = false; - - if (numThreads > 1) { - multiTh = true; - } - */ + 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++) { - ble[ir][jr] = (labView->L[ir][jr]) / 32768.f; - guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + 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; @@ -1225,8 +1229,14 @@ private: for (int ir = 0; ir < fh; ir++) for (int jr = 0; jr < fw; jr++) { - labView->L[ir][jr] = 32768.f * ble[ir][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; } } From 2068871b6ed2e700d7900c4fd2210f6f639bca11 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 30 Aug 2019 08:04:32 +0200 Subject: [PATCH 24/27] Format ipwavelet.cc and wavelet.cc --- rtengine/ipwavelet.cc | 74 ++++++++++++++++-------------- rtgui/wavelet.cc | 102 ++++++++++++++++++++++-------------------- 2 files changed, 95 insertions(+), 81 deletions(-) diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 7db25dbd1..784d3d405 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 @@ -1275,9 +1275,11 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const bool multiTh = false; #ifdef _OPENMP + if (numthreads > 1) { multiTh = true; } + #endif #ifdef _OPENMP @@ -1301,7 +1303,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const tmpImage->g(ir, jr) = Y; tmpImage->b(ir, jr) = Z; ble[ir][jr] = Y / 32768.f; - + } double epsilmax = 0.001; @@ -1327,9 +1329,10 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const 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; } @@ -1781,11 +1784,11 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * 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 - }); + 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 @@ -1796,17 +1799,18 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * { #ifdef _OPENMP - #pragma omp for + #pragma omp for #endif + for (int i = 0; i < W_L * H_L; i++) { - float buf = LIM01( WavCoeffs_L0[i] / 32768.f); + 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) { float maxp = max0 * 256.f; @@ -1818,33 +1822,37 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } } - 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); + 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 for + #pragma omp for #endif - 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; + 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) diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index e3460e685..11126666d 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -489,7 +489,7 @@ Wavelet::Wavelet() : 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_USH")); ushamethod->append(M("TP_WAVELET_SHA")); ushamethod->append(M("TP_WAVELET_CLA")); ushamethodconn = ushamethod->signal_changed().connect(sigc::mem_fun(*this, &Wavelet::ushamethodChanged)); @@ -1064,7 +1064,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) //ushamethod // if (pp->wavelet.ushamethod == "none") { // ushamethod->set_active(0); - // } else +// } else if (pp->wavelet.ushamethod == "sharp") { ushamethod->set_active(0); } else if (pp->wavelet.ushamethod == "clari") { @@ -1758,9 +1758,9 @@ 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 = "none"; +// } else if (ushamethod->get_active_row_number() == 0) { pp->wavelet.ushamethod = "sharp"; } else if (ushamethod->get_active_row_number() == 1) { @@ -2319,14 +2319,14 @@ 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(); - } - + 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() @@ -2413,14 +2413,14 @@ void Wavelet::ushamethodChanged() 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 (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); @@ -2496,12 +2496,16 @@ void Wavelet::LmethodUpdateUI() { void Wavelet::LmethodChanged() { //LmethodUpdateUI(); - 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() == 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 (ushamethod->get_active_row_number() == 1 && expclari->getEnabled() == true) { + if (Lmethod->get_active_row_number() < 4) { + Lmethod->set_active(4); + } } if (listener && (multiImage || getEnabled())) { @@ -2588,23 +2592,23 @@ void Wavelet::setBatchMode(bool batchMode) 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) @@ -2618,15 +2622,16 @@ void Wavelet::adjusterChanged(Adjuster* a, double newval) listener->panelChanged(EvWavresconH, resconH->getTextValue()); } else if (a == reschro) { listener->panelChanged(EvWavreschro, reschro->getTextValue()); - } else if (a == tmrs) { + } else if (a == tmrs) { adjusterUpdateUI(a); listener->panelChanged(EvWavtmrs, tmrs->getTextValue()); - if(tmrs->getValue() != 0 && TMmethod->get_active_row_number() == 1) { - edgs->show(); - scale->show(); + + 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(); + edgs->hide(); + scale->hide(); } } else if (a == gamma) { adjusterUpdateUI(a); @@ -3305,6 +3310,7 @@ void Wavelet::enableToggled(MyExpander *expander) Backmethod->set_sensitive(false); } } + event = EvWavenaclari; } else // unknown expander, returning ! From 0f8b9c4574517fcf856e929f99eea08fc0343136 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 31 Aug 2019 08:00:41 +0200 Subject: [PATCH 25/27] Improve showmask and Guidedfilter dcrop --- rtengine/dcrop.cc | 40 ++++++++++++++++++++++++++++++----- rtengine/improccoordinator.cc | 13 ++++++++++-- rtengine/simpleprocess.cc | 2 +- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index fc6e838d4..2ab9caa59 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1043,6 +1043,8 @@ void Crop::update(int todo) 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 @@ -1050,8 +1052,21 @@ void Crop::update(int todo) for (int ir = 0; ir < labnCrop->H ; ir++) for (int jr = 0; jr < labnCrop->W; jr++) { - ble[ir][jr] = (labnCrop->L[ir][jr]) / 32768.f; - guid[ir][jr] = provradius->L[ir][jr] / 32768.f; + 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; @@ -1070,8 +1085,14 @@ void Crop::update(int todo) for (int ir = 0; ir < labnCrop->H; ir++) for (int jr = 0; jr < labnCrop->W; jr++) { - labnCrop->L[ir][jr] = 32768.f * ble[ir][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; } } @@ -1083,16 +1104,24 @@ void Crop::update(int todo) 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 = -mL; + 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; @@ -1101,6 +1130,7 @@ void Crop::update(int todo) indic = -1.f; mL = fabs(mL); mC = fabs(mC); + show = 1; } @@ -1110,7 +1140,7 @@ void Crop::update(int todo) for (int x = 0; x < labnCrop->H; x++) for (int y = 0; y < labnCrop->W; y++) { - labnCrop->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * indic * labnCrop->L[x][y]; + labnCrop->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) + show * background - mL * indic * labnCrop->L[x][y]; 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]; } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 812e6a23b..d04a29518 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -988,18 +988,26 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) 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 = -mL; + 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; @@ -1008,6 +1016,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) indic = -1.f; mL = fabs(mL); mC = fabs(mC); + show = 1; } #ifdef _OPENMP #pragma omp parallel for @@ -1015,7 +1024,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) for (int x = 0; x < pH; x++) for (int y = 0; y < pW; y++) { - nprevl->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * indic * nprevl->L[x][y]; + nprevl->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) + show * background - mL * indic * nprevl->L[x][y]; 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]; } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index eb51577a7..9311d2736 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1249,7 +1249,7 @@ private: if ((WaveParams.CLmethod == "one" || WaveParams.CLmethod == "inf") && WaveParams.Backmethod == "black") { mL0 = mC0 = 0.f; - mL = -mL; + mL = -1.5f * mL; mC = -mC; } else if (WaveParams.CLmethod == "sup" && WaveParams.Backmethod == "resid") { mL0 = mL; From 0b13aee4bc0bdafb7f7d3f2acf0658cfc98d4f6a Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 1 Sep 2019 08:51:34 +0200 Subject: [PATCH 26/27] Clip result clarity --- rtengine/dcrop.cc | 3 +-- rtengine/improccoordinator.cc | 2 +- rtengine/simpleprocess.cc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 2ab9caa59..f7ce7bbb5 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1133,14 +1133,13 @@ void Crop::update(int todo) 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] = (1.f + mL0) * (unshar->L[x][y]) + show * background - mL * indic * labnCrop->L[x][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]; } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index d04a29518..d746ff9c6 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -1024,7 +1024,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) for (int x = 0; x < pH; x++) for (int y = 0; y < pW; y++) { - nprevl->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) + show * background - mL * indic * nprevl->L[x][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]; } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 9311d2736..b7d807808 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1265,7 +1265,7 @@ private: for (int x = 0; x < fh; x++) for (int y = 0; y < fw; y++) { - labView->L[x][y] = (1.f + mL0) * (unshar->L[x][y]) - mL * labView->L[x][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]; } From 025f444d7eef0de4d2d8a7884ff3ac7ed04c9f0b Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 15 Dec 2019 08:21:41 +0100 Subject: [PATCH 27/27] Improve contrast levels with sigma --- rtdata/languages/default | 2 ++ rtengine/ipwavelet.cc | 32 ++++++++++++++++++++++++-------- rtengine/procparams.cc | 4 ++++ rtengine/procparams.h | 1 + rtgui/paramsedited.cc | 6 ++++++ rtgui/paramsedited.h | 1 + rtgui/wavelet.cc | 15 +++++++++++++++ rtgui/wavelet.h | 2 ++ 8 files changed, 55 insertions(+), 8 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 9cc354323..5fa474dd6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -790,6 +790,7 @@ 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 @@ -2236,6 +2237,7 @@ 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 diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index f45b21f28..f2c8c8182 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -63,6 +63,7 @@ namespace rtengine struct cont_params { float mul[10]; + float sigm; int chrom; int chro; int contrast; @@ -224,6 +225,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const if (params->wavelet.BAmethod == "cur") { cp.BAmet = 2; } + cp.sigm = params->wavelet.sigma; cp.tmstrength = params->wavelet.tmrs; //cp.tonemap = params->wavelet.tmr; @@ -2997,15 +2999,29 @@ void ImProcFunctions::ContAllL(float *koeLi[12], float *maxkoeLi, bool lipschitz //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; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f92b40191..1822a81c7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2263,6 +2263,7 @@ WaveletParams::WaveletParams() : TMmethod("cont"), Dirmethod("all"), HSmethod("with"), + sigma(1.0), rescon(0), resconH(0), reschro(0), @@ -2369,6 +2370,7 @@ 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 @@ -3548,6 +3550,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo 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); @@ -4655,6 +4658,7 @@ 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); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 839872e77..7ad99b594 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1237,6 +1237,7 @@ struct WaveletParams { Glib::ustring TMmethod; Glib::ustring Dirmethod; Glib::ustring HSmethod; + double sigma; int rescon; int resconH; int reschro; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index d4e2bd759..c915685bc 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -504,6 +504,7 @@ 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; @@ -1095,6 +1096,7 @@ 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; @@ -3132,6 +3134,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; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d166e7ccc..4f7fabd1a 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -520,6 +520,7 @@ struct WaveletParamsEdited { bool Tilesmethod; bool daubcoeffmethod; bool Dirmethod; + bool sigma; bool rescon; bool resconH; bool reschro; diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index c95736a80..252ed0abe 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -80,6 +80,7 @@ Wavelet::Wavelet() : 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")))), + 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))), @@ -173,6 +174,7 @@ Wavelet::Wavelet() : 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)); @@ -325,6 +327,9 @@ Wavelet::Wavelet() : levBox->pack_start(*correction[i]); } + sigma->setAdjusterListener(this); + levBox->pack_start(*sigma, Gtk::PACK_SHRINK); + levBox->pack_start(*sup); sup->setAdjusterListener(this); wavLabels->show(); @@ -1226,6 +1231,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) lastavoid = pp->wavelet.avoid; lastshowmask = pp->wavelet.showmask; lasttmr = pp->wavelet.tmr; + sigma->setValue(pp->wavelet.sigma); rescon->setValue(pp->wavelet.rescon); resconH->setValue(pp->wavelet.resconH); reschro->setValue(pp->wavelet.reschro); @@ -1377,6 +1383,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) 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); @@ -1558,6 +1565,7 @@ void Wavelet::write(ProcParams* pp, ParamsEdited* pedited) 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(); @@ -1668,6 +1676,7 @@ 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(); @@ -1902,6 +1911,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit 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); @@ -1963,6 +1973,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit softrad->setDefaultEditedState(pedited->wavelet.softrad ? Edited : UnEdited); softradend->setDefaultEditedState(pedited->wavelet.softradend ? Edited : UnEdited); + sigma->setDefault(defParams->wavelet.sigma); rescon->setDefault(defParams->wavelet.rescon); resconH->setDefault(defParams->wavelet.resconH); reschro->setDefault(defParams->wavelet.reschro); @@ -2013,6 +2024,7 @@ void Wavelet::setDefaults(const ProcParams* defParams, const ParamsEdited* pedit correctionch[i]->setDefaultEditedState(pedited->wavelet.ch[i] ? Edited : UnEdited); } } else { + sigma->setDefaultEditedState(Irrelevant); rescon->setDefaultEditedState(Irrelevant); resconH->setDefaultEditedState(Irrelevant); reschro->setDefaultEditedState(Irrelevant); @@ -2540,6 +2552,7 @@ void Wavelet::setBatchMode(bool batchMode) opacityCurveEditorWL->setBatchMode(batchMode); curveEditorRES->setBatchMode(batchMode); curveEditorGAM->setBatchMode(batchMode); + sigma->showEditedCB(); rescon->showEditedCB(); resconH->showEditedCB(); reschro->showEditedCB(); @@ -2621,6 +2634,8 @@ void Wavelet::adjusterChanged(Adjuster* a, double newval) 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) { diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index b18ac668b..9d9502670 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -76,6 +76,7 @@ private: rtengine::ProcEvent EvWavedgs; rtengine::ProcEvent EvWavscale; rtengine::ProcEvent EvWavradius; + rtengine::ProcEvent EvWavsigma; void foldAllButMe (GdkEventButton* event, MyExpander *expander); @@ -167,6 +168,7 @@ private: Gtk::Button* const neutralchButton; Adjuster* correction[9]; Adjuster* correctionch[9]; + Adjuster* const sigma; Adjuster* const rescon; Adjuster* const resconH; Adjuster* const reschro;