From 9a46885cfe71a1470759dac9edf1a9bc32ddf4d6 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 26 Jun 2019 12:34:57 +0200 Subject: [PATCH] Fixed bug from ff2000 --- rtengine/curves.cc | 2 +- rtengine/dcrop.cc | 7 ++- rtengine/improccoordinator.cc | 10 +++-- rtengine/improccoordinator.h | 3 +- rtengine/procparams.cc | 85 +++++++++++++++++------------------ rtengine/simpleprocess.cc | 10 ++--- 6 files changed, 62 insertions(+), 55 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 581d650ab..9ce37dd92 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1125,7 +1125,7 @@ void CurveFactory::complexCurvelocal(double ecomp, double black, double hlcompr, int k = avg * 32768; avg = lightCurveloc[k]; -// printf("avg=%f lumaref=%f\n", avg, lumare/100.f); + printf("avg=%f lumaref=%f\n", avg, lumare/100.f); std::vector contrastcurvePoints; bool lumm = true; diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index fd1f6f5b6..c6ab8a822 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -911,7 +911,7 @@ void Crop::update(int todo) bool lcmasretiutili = parent->lcmasretiutili; bool llmasretiutili = parent->llmasretiutili; - float avg = parent->avg; + // float avg = parent->avg; LUTu dummy; bool needslocal = params.locallab.enabled; LocretigainCurve locRETgainCurve; @@ -976,6 +976,7 @@ void Crop::update(int todo) double cont = params.locallab.spots.at(sp).contrast; double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; + float avge; huerefblu = parent->huerefblurs[sp]; chromarefblu = parent->chromarefblurs[sp]; lumarefblu = parent->lumarefblurs[sp]; @@ -983,8 +984,9 @@ void Crop::update(int todo) chromare = parent->chromarefs[sp]; lumare = parent->lumarefs[sp]; sobelre = parent->sobelrefs[sp]; + avge = parent->avgs[sp]; CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lumare, - hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, avg, + hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, avge, sca); // Locallab mask are only shown for selected spot if (sp == params.locallab.selspot) { @@ -1003,6 +1005,7 @@ void Crop::update(int todo) LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0); } lllocalcurve2.clear(); + lightCurveloc2.clear(); cclocalcurve2.clear(); exlocalcurve2.clear(); hltonecurveloc2.clear(); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 8aa997fc8..c1d7de34f 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -192,6 +192,7 @@ ImProcCoordinator::ImProcCoordinator() : chromarefs(500, -100000.f), lumarefs(500, -100000.f), sobelrefs(500, -100000.f), + avgs(500, -100000.f), huer(0), huerblu(0), chromarblu(0), @@ -199,13 +200,13 @@ ImProcCoordinator::ImProcCoordinator() : chromar(0), lumar(0), sobeler(0), + avg(0), lastspotdup(false), locallColorMask(0), locallExpMask(0), locallSHMask(0), locallcbMask(0), locallretiMask(0), - avg(0), retistrsav(nullptr) { @@ -865,6 +866,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) float **shbuffer = nullptr; int sca = 1; double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; + float avge; for (int sp = 0; sp < params->locallab.nbspot && sp < (int)params->locallab.spots.size(); sp++) { // Set local curves of current spot to LUT @@ -919,9 +921,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) // Reference parameters computation if (params->locallab.spots.at(sp).spotMethod == "exc") { - ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avg); + ipf.calc_ref(sp, reserv, reserv, 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); } else { - ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avg); + ipf.calc_ref(sp, nprevl, nprevl, 0, 0, pW, pH, scale, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); } // printf("improc avg=%f\n", avg); @@ -932,6 +934,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) chromar = chromarefs[sp] = chromare; lumar = lumarefs[sp] = lumare ; sobeler = sobelrefs[sp] = sobelre; + avg = avgs[sp] = avge; CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lumar, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, avg, sca); @@ -969,6 +972,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } lllocalcurve.clear(); + lightCurveloc.clear(); cclocalcurve.clear(); exlocalcurve.clear(); hltonecurveloc.clear(); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index ded9a6533..d474f2e78 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -279,14 +279,15 @@ protected: LUTf chromarefs; LUTf lumarefs; LUTf sobelrefs; + LUTf avgs; double huer, huerblu, chromarblu, lumarblu, chromar, lumar, sobeler; + float avg; bool lastspotdup; int locallColorMask; int locallExpMask; int locallSHMask; int locallcbMask; int locallretiMask; - float avg; public: diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index c5d3b9d80..0e959e352 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3215,23 +3215,23 @@ ProcParams::ProcParams() void ProcParams::setDefaults() { - toneCurve = {}; + toneCurve = ToneCurveParams(); - labCurve = {}; + labCurve = LCurveParams(); - rgbCurves = {}; + rgbCurves = RGBCurvesParams(); - localContrast = {}; + localContrast = LocalContrastParams(); - colorToning = {}; + colorToning = ColorToningParams(); - sharpenEdge = {}; + sharpenEdge = SharpenEdgeParams(); - sharpenMicro = {}; + sharpenMicro = SharpenMicroParams(); - sharpening = {}; + sharpening = SharpeningParams(); - prsharpening = {}; + prsharpening = SharpeningParams(); prsharpening.contrast = 15.0; prsharpening.method = "rld"; prsharpening.deconvamount = 100; @@ -3239,72 +3239,71 @@ void ProcParams::setDefaults() prsharpening.deconviter = 100; prsharpening.deconvdamping = 0; - vibrance = {}; + vibrance = VibranceParams(); - wb = {}; + wb = WBParams(); - colorappearance = {}; + colorappearance = ColorAppearanceParams(); - defringe = {}; + defringe = DefringeParams(); - impulseDenoise = {}; + impulseDenoise = ImpulseDenoiseParams(); - dirpyrDenoise = {}; + dirpyrDenoise = DirPyrDenoiseParams(); - epd = {}; + epd = EPDParams(); - fattal = {}; + fattal = FattalToneMappingParams(); - sh = {}; + sh = SHParams(); - crop = {}; + crop = CropParams(); - coarse = {}; + coarse = CoarseTransformParams(); - commonTrans = {}; + commonTrans = CommonTransformParams(); - rotate = {}; + rotate = RotateParams(); - distortion = {}; + distortion = DistortionParams(); - lensProf = {}; + lensProf = LensProfParams(); - perspective = {}; + perspective = PerspectiveParams(); - gradient = {}; + gradient = GradientParams(); - pcvignette = {}; - - locallab = {}; + locallab = LocallabParams(); + pcvignette = PCVignetteParams(); - vignetting = {}; + vignetting = VignettingParams(); - chmixer = {}; + chmixer = ChannelMixerParams(); - blackwhite = {}; + blackwhite = BlackWhiteParams(); - cacorrection = {}; + cacorrection = CACorrParams(); - resize = {}; + resize = ResizeParams(); - icm = {}; + icm = ColorManagementParams(); - wavelet = {}; + wavelet = WaveletParams(); - dirpyrequalizer = {}; + dirpyrequalizer = DirPyrEqualizerParams(); - hsvequalizer = {}; + hsvequalizer = HSVEqualizerParams(); - filmSimulation = {}; + filmSimulation = FilmSimulationParams(); - softlight = {}; + softlight = SoftLightParams(); - dehaze = {}; + dehaze = DehazeParams(); - raw = {}; + raw = RAWParams(); - metadata = {}; + metadata = MetaDataParams(); exif.clear(); iptc.clear(); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 392e0c9b7..e9cdf7818 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1174,14 +1174,14 @@ private: // Reference parameters computation double huere, chromare, lumare, huerefblu, chromarefblu, lumarefblu, sobelre; - float avg = 0.f; + float avge; if (params.locallab.spots.at(sp).spotMethod == "exc") { - ipf.calc_ref(sp, reservView, reservView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avg); + ipf.calc_ref(sp, reservView, reservView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); } else { - ipf.calc_ref(sp, labView, labView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avg); + ipf.calc_ref(sp, labView, labView, 0, 0, fw, fh, 1, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, avge); } CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, cont, lumare, - hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, avg, + hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, avge, 1); // No Locallab mask is shown in exported picture @@ -1199,7 +1199,7 @@ private: hltonecurveloc.clear(); shtonecurveloc.clear(); tonecurveloc.clear(); - + lightCurveloc.clear(); if (params.locallab.spots.at(sp).inverssha) { for (int i = 0; i < fh; i++) {