diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index ae2f601ee..95b72293a 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -940,7 +940,7 @@ void Crop::update(int todo) lumare = parent->lumarefs[sp]; sobelre = parent->sobelrefs[sp]; - parent->ipf.Lab_Local(1, sp, parent->huerefs, parent->sobelrefs, parent->centerx, parent->centery, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, + parent->ipf.Lab_Local(1, sp, parent->sobelrefs, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, huere, chromare, lumare, sobelre); lllocalcurve2.clear(); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index ddf7d7a9d..5564fcd42 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -42,11 +42,11 @@ namespace rtengine extern const Settings* settings; ImProcCoordinator::ImProcCoordinator() - : orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), reserv(nullptr), fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), - ncie(nullptr), imgsrc(nullptr), lastAwbEqual(0.), lastAwbTempBias(0.0), ipf(¶ms, true), monitorIntent(RI_RELATIVE), + : orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), + ncie (nullptr), imgsrc (nullptr), lastAwbEqual (0.), lastAwbTempBias (0.0), ipf (¶ms, true), monitorIntent (RI_RELATIVE), softProof(false), gamutCheck(false), sharpMask(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false), - allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), coordX(0), coordY(0), localX(0), localY(0), - ctColorCurve(), + allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), + hltonecurve(65536), shtonecurve(65536), tonecurve(65536, 0), //,1); @@ -59,14 +59,6 @@ ImProcCoordinator::ImProcCoordinator() conversionBuffer(1, 1), wavclCurve(65536, 0), clToningcurve(65536, 0), - lllocalcurve(65536, 0), - cclocalcurve(65536, 0), - sklocalcurve(65536, 0), - exlocalcurve(65536, 0), - hltonecurveloc(65536, 0), //32768 - shtonecurveloc(65536, 0), - tonecurveloc(65536, 0), - lightCurveloc(32770, 0), cl2Toningcurve(65536, 0), Noisecurve(65536, 0), NoiseCCcurve(65536, 0), @@ -94,6 +86,7 @@ ImProcCoordinator::ImProcCoordinator() rCurve(), gCurve(), bCurve(), + ctColorCurve(), rcurvehist(256), rcurvehistCropped(256), rbeforehist(256), gcurvehist(256), gcurvehistCropped(256), gbeforehist(256), bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), @@ -103,10 +96,18 @@ ImProcCoordinator::ImProcCoordinator() plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), flatFieldAutoClipListener(nullptr), bayerAutoContrastListener(nullptr), xtransAutoContrastListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr), resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), wavcontlutili(false), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), highQualityComputed(false), customTransformIn(nullptr), customTransformOut(nullptr), + //locallab + reserv(nullptr), + coordX(0), coordY(0), localX(0), localY(0), + lllocalcurve(65536, 0), + cclocalcurve(65536, 0), + sklocalcurve(65536, 0), + exlocalcurve(65536, 0), + hltonecurveloc(65536, 0), //32768 + shtonecurveloc(65536, 0), + tonecurveloc(65536, 0), + lightCurveloc(32770, 0), locallutili(false), localcutili(false), localskutili(false), localexutili(false), LHutili(false), HHutili(false), - centerx(500, -10000), - centery(500, -10000), - huerefs(500, -100000.f), huerefblurs(500, -100000.f), chromarefs(500, -100000.f), @@ -117,8 +118,7 @@ ImProcCoordinator::ImProcCoordinator() chromar(0), lumar(0), sobeler(0), - lastspotdup(false), - + lastspotdup(false), retistrsav(nullptr) {} @@ -818,7 +818,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) * - maxspot, huerefs, centerx and centery aren't used in Lab_Local (only for printf) so values aren't important * - shbuffer is used as nullptr */ - ipf.Lab_Local(3, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, + ipf.Lab_Local(3, sp, sobelrefs, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, huer, chromar, lumar, sobeler); // Clear local curves diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 4f060b34c..8551e6e19 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -26,7 +26,6 @@ #include "imagesource.h" #include "procevents.h" #include "dcrop.h" - #include "LUT.h" #include "../rtgui/threadutils.h" @@ -52,16 +51,12 @@ class ImProcCoordinator : public StagedImageProcessor { friend class Crop; -private: - protected: Imagefloat *orig_prev; Imagefloat *oprevi; LabImage *oprevl; LabImage *nprevl; - LabImage *reserv; - Imagefloat *fattal_11_dcrop_cache; // global cache for ToneMapFattal02 used in 1:1 detail windows (except when denoise is active) Image8 *previmg; // displayed image in monitor color space, showing the output profile as well (soft-proofing enabled, which then correspond to workimg) or not Image8 *workimg; // internal image in output color space for analysis @@ -94,15 +89,11 @@ protected: float bwAutoR, bwAutoG, bwAutoB; float CAMMean; - int coordX, coordY, localX, localY; - ColorGradientCurve ctColorCurve; - LUTf hltonecurve; LUTf shtonecurve; LUTf tonecurve; LUTf lumacurve; -// LUTf localcurve; LUTf chroma_acurve; LUTf chroma_bcurve; LUTf satcurve; @@ -112,18 +103,6 @@ protected: multi_array2D conversionBuffer; LUTf wavclCurve; LUTf clToningcurve; - LUTf lllocalcurve; - LUTf cclocalcurve; - LUTf sklocalcurve; - LUTf exlocalcurve; - - LUTf hltonecurveloc; - LUTf shtonecurveloc; - LUTf tonecurveloc; - LUTf lightCurveloc; - -// ToneCurve customToneCurve1loc; - LUTf cl2Toningcurve; LUTf Noisecurve; LUTf NoiseCCcurve; @@ -138,7 +117,7 @@ protected: LUTu histBlue, histBlueRaw; LUTu histLuma, histToneCurve, histToneCurveBW, histLCurve, histCCurve; LUTu histLLCurve, histLCAM, histCCAM, histClad, bcabhist, histChroma, histLRETI; - LUTu lhist16; + LUTf CAMBrightCurveJ, CAMBrightCurveQ; LUTf rCurve; @@ -146,6 +125,7 @@ protected: LUTf bCurve; ToneCurve customToneCurve1; ToneCurve customToneCurve2; + ColorGradientCurve ctColorCurve; OpacityCurve ctOpacityCurve; NoiseCurve noiseLCurve; NoiseCurve noiseCCurve; @@ -156,10 +136,6 @@ protected: WavOpacityCurveWL waOpacityCurveWL; RetinextransmissionCurve dehatransmissionCurve; RetinexgaintransmissionCurve dehagaintransmissionCurve; - LocretigainCurve locRETgainCurve; - LocretigainCurverab locRETgainCurverab; - LocLHCurve loclhCurve; - LocHHCurve lochhCurve; ColorAppearance customColCurve1; ColorAppearance customColCurve2; @@ -192,7 +168,7 @@ protected: WaveletListener* awavListener; RetinexListener* dehaListener; - + HistogramListener* hListener; std::vector sizeListeners; @@ -207,7 +183,6 @@ protected: void updateLRGBHistograms(); void setScale(int prevscale); void updatePreviewImage (int todo, bool panningRelatedChange); -// void updatePreviewImage(int todo, Crop* cropCall = nullptr); MyMutex mProcessing; ProcParams params; @@ -226,7 +201,6 @@ protected: int changeSinceLast; bool updaterRunning; ProcParams nextParams; - ProcParams nextParams2; bool destroying; bool utili; bool autili; @@ -236,31 +210,51 @@ protected: bool clcutili; bool opautili; bool wavcontlutili; + void startProcessing(); + void process(); + float colourToningSatLimit; + float colourToningSatLimitOpacity; + bool highQualityComputed; + cmsHTRANSFORM customTransformIn; + cmsHTRANSFORM customTransformOut; + + //locallab + LabImage *reserv; + int coordX, coordY, localX, localY; + LUTf lllocalcurve; + LUTf cclocalcurve; + LUTf sklocalcurve; + LUTf exlocalcurve; + LUTf hltonecurveloc; + LUTf shtonecurveloc; + LUTf tonecurveloc; + LUTf lightCurveloc; + LUTu lhist16; + LocretigainCurve locRETgainCurve; + LocretigainCurverab locRETgainCurverab; + LocLHCurve loclhCurve; + LocHHCurve lochhCurve; + ProcParams nextParams2; bool locallutili; bool localcutili; bool localskutili; bool localexutili; bool LHutili; bool HHutili; - - LUTi centerx; - LUTi centery; - LUTf huerefs; LUTf huerefblurs; LUTf chromarefs; LUTf lumarefs; LUTf sobelrefs; - double huer, huerblu, chromar, lumar, sobeler; - void startProcessing(); - void process(); - float colourToningSatLimit; - float colourToningSatLimitOpacity; bool lastspotdup; - bool highQualityComputed; - cmsHTRANSFORM customTransformIn; - cmsHTRANSFORM customTransformOut; + + + + + + + public: ImProcCoordinator (); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 40192da96..00c26a633 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -289,7 +289,7 @@ public: void calc_ref(int sp, LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &huere, double &chromare, double &lumare, double &sobelref); void copy_ref(LabImage* spotbuffer, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot); void paste_ref(LabImage* spotbuffer, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp); - void Lab_Local(int call, int sp, LUTf & huerefs, LUTf & sobelrefs, LUTi & centerx, LUTi & centery, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, LUTf & lightCurveloc, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref); + void Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, LUTf & lightCurveloc, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); void InverseBlurNoise_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 56b3ccf74..1198415ce 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -8522,7 +8522,7 @@ void ImProcFunctions::fftw_denoise(int GW, int GH, int max_numblox_W, int min_nu -void ImProcFunctions::Lab_Local(int call, int sp, LUTf & huerefs, LUTf & sobelrefs, LUTi & centerx, LUTi & centery, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk, +void ImProcFunctions::Lab_Local(int call, int sp, LUTf & sobelrefs, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index cba48dca7..0b82c6e26 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1130,7 +1130,7 @@ private: } - ipf.Lab_Local(2, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, + ipf.Lab_Local(2, sp, sobelrefs, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, huere, chromare, lumare, sobelre); // Clear local curves