From 5e93f6ba5d3e6ba5ea52637d08beb44c1921b5bc Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 26 Nov 2017 09:21:39 +0100 Subject: [PATCH] Improve Inverse Color Light and fixed some bugs --- rawtherapee.astylerc | 2 +- rtengine/improcfun.h | 365 ++-- rtengine/iplocallab.cc | 3191 +++++++++++++++++++---------- rtgui/locallab.cc | 4253 ++++++++++++++++++++------------------- rtgui/toolpanelcoord.cc | 37 +- 5 files changed, 4406 insertions(+), 3442 deletions(-) diff --git a/rawtherapee.astylerc b/rawtherapee.astylerc index bcea16b96..b790a1e4d 100644 --- a/rawtherapee.astylerc +++ b/rawtherapee.astylerc @@ -4,5 +4,5 @@ indent-switches break-blocks pad-oper convert-tabs -pad-first-paren-out pad-header +unpad-paren \ No newline at end of file diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index e085c4310..b176adc82 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -59,29 +59,29 @@ class ImProcFunctions double scale; bool multiThread; - void calcVignettingParams (int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul); + void calcVignettingParams(int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul); - void transformLuminanceOnly (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); - void transformGeneral (bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); - void transformLCPCAOnly (Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap); + void transformLuminanceOnly(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); + void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); + void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap); - void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, int W, int H, const SharpeningParams &sharpenParam); - void sharpenHaloCtrl (LabImage* lab, float** blurmap, float** base, int W, int H, SharpeningParams &sharpenParam); - void sharpenHaloCtrlcam (CieImage* ncie, float** blurmap, float** base, int W, int H); - void dcdamping (float** aI, float** aO, float damping, int W, int H); + void sharpenHaloCtrl(float** luminance, float** blurmap, float** base, int W, int H, const SharpeningParams &sharpenParam); + void sharpenHaloCtrl(LabImage* lab, float** blurmap, float** base, int W, int H, SharpeningParams &sharpenParam); + void sharpenHaloCtrlcam(CieImage* ncie, float** blurmap, float** base, int W, int H); + void dcdamping(float** aI, float** aO, float damping, int W, int H); - bool needsCA (); - bool needsDistortion (); - bool needsRotation (); - bool needsPerspective (); - bool needsGradient (); - bool needsVignetting (); - bool needsLCP (); + bool needsCA(); + bool needsDistortion(); + bool needsRotation(); + bool needsPerspective(); + bool needsGradient(); + bool needsVignetting(); + bool needsLCP(); bool needsLensfun(); // static cmsUInt8Number* Mempro = NULL; - inline void interpolateTransformCubic (Imagefloat* src, int xs, int ys, double Dx, double Dy, float *r, float *g, float *b, double mul) + inline void interpolateTransformCubic(Imagefloat* src, int xs, int ys, double Dx, double Dy, float *r, float *g, float *b, double mul) { const double A = -0.85; @@ -104,9 +104,9 @@ class ImProcFunctions rd = gd = bd = 0.0; for (int i = xs, ix = 0; i < xs + 4; i++, ix++) { - rd += src->r (k, i) * w[ix]; - gd += src->g (k, i) * w[ix]; - bd += src->b (k, i) * w[ix]; + rd += src->r(k, i) * w[ix]; + gd += src->g(k, i) * w[ix]; + bd += src->b(k, i) * w[ix]; } yr[kx] = rd; @@ -142,7 +142,7 @@ class ImProcFunctions // printf ("r=%g, g=%g\n", *r, *g); } - inline void interpolateTransformChannelsCubic (float** src, int xs, int ys, double Dx, double Dy, float *r, double mul) + inline void interpolateTransformChannelsCubic(float** src, int xs, int ys, double Dx, double Dy, float *r, double mul) { const double A = -0.85; @@ -204,206 +204,207 @@ public: double lumimul[3]; - ImProcFunctions (const ProcParams* iparams, bool imultiThread = true) - : lastcutpast (false), lastcxbuf (0), lastcybuf (0), lastcount (0), spotbuffer (nullptr), monitorTransform (nullptr), lab2outputTransform (nullptr), output2monitorTransform (nullptr), params (iparams), scale (1), multiThread (imultiThread), lumimul{} {} - ~ImProcFunctions (); + ImProcFunctions(const ProcParams* iparams, bool imultiThread = true) + : lastcutpast(false), lastcxbuf(0), lastcybuf(0), lastcount(0), spotbuffer(nullptr), monitorTransform(nullptr), lab2outputTransform(nullptr), output2monitorTransform(nullptr), params(iparams), scale(1), multiThread(imultiThread), lumimul{} {} + ~ImProcFunctions(); bool needsLuminanceOnly() { - return ! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient()); + return !(needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient()); } - void setScale (double iscale); + void setScale(double iscale); - bool needsTransform (); - bool needsPCVignetting (); + bool needsTransform(); + bool needsPCVignetting(); - void firstAnalysis (const Imagefloat* const working, const ProcParams ¶ms, LUTu & vhist16); - void updateColorProfiles (const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); - void rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, - SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, - const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve ); - void rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, - SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, - const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, - double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve); - void labtoning (float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve, LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3] ); - void toning2col (float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float rl, float gl, float bl, float rh, float gh, float bh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect); - void toningsmh (float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect); - void toningsmh2 (float r, float g, float b, float &ro, float &go, float &bo, float low[3], float satLow, float med[3], float satMed, float high[3], float satHigh, float reducac, int mode, int preser); - void secondeg_begin (float reducac, float vend, float &aam, float &bbm); - void secondeg_end (float reducac, float vinf, float &aa, float &bb, float &cc); + void firstAnalysis(const Imagefloat* const working, const ProcParams ¶ms, LUTu & vhist16); + void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); + void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, + SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, + const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve); + void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, + SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, + const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, + double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve); + void labtoning(float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve, LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3]); + void toning2col(float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float rl, float gl, float bl, float rh, float gh, float bh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect); + void toningsmh(float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect); + void toningsmh2(float r, float g, float b, float &ro, float &go, float &bo, float low[3], float satLow, float med[3], float satMed, float high[3], float satHigh, float reducac, int mode, int preser); + void secondeg_begin(float reducac, float vend, float &aam, float &bbm); + void secondeg_end(float reducac, float vinf, float &aa, float &bb, float &cc); - void retreavergb (float &r, float &g, float &b); - void moyeqt (Imagefloat* working, float &moyS, float &eqty); + void retreavergb(float &r, float &g, float &b); + void moyeqt(Imagefloat* working, float &moyS, float &eqty); - void luminanceCurve (LabImage* lold, LabImage* lnew, LUTf &curve); - void ciecam_02float (CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params, - const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, - LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt); - void ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, LabImage* lab, const ProcParams* params, - const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, - LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, int rtt); - void chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); - void vibrance (LabImage* lab);//Jacques' vibrance + void luminanceCurve(LabImage* lold, LabImage* lnew, LUTf &curve); + void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params, + const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, + LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt); + void ciecam_02(CieImage* ncie, double adap, int pW, int pwb, LabImage* lab, const ProcParams* params, + const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, + LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, int rtt); + void chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); + void vibrance(LabImage* lab); //Jacques' vibrance // void colorCurve (LabImage* lold, LabImage* lnew); - void sharpening (LabImage* lab, float** buffer, SharpeningParams &sharpenParam); - void sharpeningcam (CieImage* ncie, float** buffer); - void transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage); - float resizeScale (const ProcParams* params, int fw, int fh, int &imw, int &imh); - void lab2monitorRgb (LabImage* lab, Image8* image); - void resize (Image16* src, Image16* dst, float dScale); - void Lanczos (const LabImage* src, LabImage* dst, float scale); - void Lanczos (const Image16* src, Image16* dst, float scale); + void sharpening(LabImage* lab, float** buffer, SharpeningParams &sharpenParam); + void sharpeningcam(CieImage* ncie, float** buffer); + void transform(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage); + float resizeScale(const ProcParams* params, int fw, int fh, int &imw, int &imh); + void lab2monitorRgb(LabImage* lab, Image8* image); + void resize(Image16* src, Image16* dst, float dScale); + void Lanczos(const LabImage* src, LabImage* dst, float scale); + void Lanczos(const Image16* src, Image16* dst, float scale); - void deconvsharpening (float** luminance, float** buffer, int W, int H, const SharpeningParams &sharpenParam); - void deconvsharpeningloc (float** luminance, float** buffer, int W, int H, float** loctemp, int damp, double radi, int ite, int amo); + void deconvsharpening(float** luminance, float** buffer, int W, int H, const SharpeningParams &sharpenParam); + void deconvsharpeningloc(float** luminance, float** buffer, int W, int H, float** loctemp, int damp, double radi, int ite, int amo); - void MLsharpen (LabImage* lab);// Manuel's clarity / sharpening - void MLmicrocontrast (float** luminance, int W, int H ); //Manuel's microcontrast - void MLmicrocontrast (LabImage* lab ); //Manuel's microcontrast - void MLmicrocontrastcam (CieImage* ncie ); //Manuel's microcontrast + void MLsharpen(LabImage* lab); // Manuel's clarity / sharpening + void MLmicrocontrast(float** luminance, int W, int H); //Manuel's microcontrast + void MLmicrocontrast(LabImage* lab); //Manuel's microcontrast + void MLmicrocontrastcam(CieImage* ncie); //Manuel's microcontrast - void impulsedenoise (LabImage* lab);//Emil's impulse denoise - void impulsedenoisecam (CieImage* ncie, float **buffers[3]); - void impulse_nr (LabImage* lab, double thresh); - void impulse_nrcam (CieImage* ncie, double thresh, float **buffers[3]); + void impulsedenoise(LabImage* lab); //Emil's impulse denoise + void impulsedenoisecam(CieImage* ncie, float **buffers[3]); + void impulse_nr(LabImage* lab, double thresh); + void impulse_nrcam(CieImage* ncie, double thresh, float **buffers[3]); - void dirpyrdenoise (LabImage* src);//Emil's pyramid denoise - void dirpyrequalizer (LabImage* lab, int scale);//Emil's wavelet + void dirpyrdenoise(LabImage* src); //Emil's pyramid denoise + void dirpyrequalizer(LabImage* lab, int scale); //Emil's wavelet - void EPDToneMapResid (float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params& cp, int W_L, int H_L, float max0, float min0); - float *CompressDR (float *Source, int W_L, int H_L, float Compression, float DetailBoost, float *Compressed); - void ContrastResid (float * WavCoeffs_L0, struct cont_params &cp, int W_L, int H_L, float max0, float min0); - float *ContrastDR (float *Source, int W_L, int H_L, float *Contrast = nullptr); + void EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params& cp, int W_L, int H_L, float max0, float min0); + float *CompressDR(float *Source, int W_L, int H_L, float Compression, float DetailBoost, float *Compressed); + void ContrastResid(float * WavCoeffs_L0, struct cont_params &cp, int W_L, int H_L, float max0, float min0); + float *ContrastDR(float *Source, int W_L, int H_L, float *Contrast = nullptr); - void EPDToneMap (LabImage *lab, unsigned int Iterates = 0, int skip = 1); - void EPDToneMaplocal (LabImage *lab, LabImage *tmp1, unsigned int Iterates, int skip); - void EPDToneMapCIE (CieImage *ncie, float a_w, float c_, int Wid, int Hei, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); + void EPDToneMap(LabImage *lab, unsigned int Iterates = 0, int skip = 1); + void EPDToneMaplocal(LabImage *lab, LabImage *tmp1, unsigned int Iterates, int skip); + void EPDToneMapCIE(CieImage *ncie, float a_w, float c_, int Wid, int Hei, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); // pyramid denoise procparams::DirPyrDenoiseParams dnparams; - void dirpyr (LabImage* data_fine, LabImage* data_coarse, int level, LUTf &rangefn_L, LUTf &rangefn_ab, - int pitch, int scale, const int luma, int chroma ); - void idirpyr (LabImage* data_coarse, LabImage* data_fine, int level, LUTf &rangefn_L, LUTf & nrwt_l, LUTf & nrwt_ab, - int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/ ); + void dirpyr(LabImage* data_fine, LabImage* data_coarse, int level, LUTf &rangefn_L, LUTf &rangefn_ab, + int pitch, int scale, const int luma, int chroma); + void idirpyr(LabImage* data_coarse, LabImage* data_fine, int level, LUTf &rangefn_L, LUTf & nrwt_l, LUTf & nrwt_ab, + int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/); //locallab - void MSRLocal (float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void MSRLocal(float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); // void calc_ref (LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huere, double &chromare, double &lumare, double &sobelref); - void calc_ref (LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, 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, 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, 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); - void Reti_Local (float ** buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); - void InverseReti_Local (const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); - void Contrast_Local (int call, float ** buflightc, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, float pm, struct local_contra &lco, float lumaref, const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void cbdl_Local (float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int chro); - void BlurNoise_Local (int call, LabImage* tmp1, LabImage* tmp2, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void TM_Local (LabImage* tmp1, float ** buflight, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - static void strcurv_data (std::string retistr, int *s_datc, int &siz); - void InverseContrast_Local (float ave, const struct local_contra& lco, const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* dest, bool & localskutili, LUTf & sklocalcurve); - void Expose_Local (int sen, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy); - void exlabLocal (const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve); - void Exclude_Local (int sen, float **deltaso, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, LabImage * rsv, int cx, int cy); + void calc_ref(LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, 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, 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, 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); + void Reti_Local(float ** buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); + void InverseReti_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro); + void Contrast_Local(int call, float ** buflightc, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, float pm, struct local_contra &lco, float lumaref, const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void cbdl_Local(float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int chro); + void BlurNoise_Local(int call, LabImage* tmp1, LabImage* tmp2, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void TM_Local(LabImage* tmp1, float ** buflight, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + static void strcurv_data(std::string retistr, int *s_datc, int &siz); + void InverseContrast_Local(float ave, struct local_contra & lco, const struct local_params & lp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, LabImage * original, LabImage * transformed, int cx, int cy); - void DeNoise_Local (int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy); + void vibrancelocal(int bfw, int bfh, LabImage* lab, LabImage* dest, bool & localskutili, LUTf & sklocalcurve); + void Expose_Local(int sen, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy); + void exlabLocal(const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve); + void Exclude_Local(int sen, float **deltaso, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, LabImage * rsv, int cx, int cy); - void ColorLight_Local (int call, LabImage * bufcolorig, float **buflight, float **bufchro, float **bufchroslid, float ** bufhh, float ** buflightslid, bool &LHutili, bool &HHutili, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void InverseColorLight_Local (const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void DeNoise_Local(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy); - void Sharp_Local (int call, float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void InverseSharp_Local (float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void ColorLight_Local(int call, LabImage * bufcolorig, float **buflight, float **bufchro, float **bufchroslid, float ** bufhh, float ** buflightslid, bool &LHutili, bool &HHutili, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void InverseColorLight_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref); + + void Sharp_Local(int call, float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); + void InverseSharp_Local(float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy); - void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip); - void ip_wavelet (LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, int skip); + void Tile_calc(int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip); + void ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, int skip); - void WaveletcontAllL (LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_L, - struct cont_params &cp, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili); - void WaveletcontAllLfinal (wavelet_decomposition &WaveletCoeffs_L, struct cont_params &cp, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL); - void WaveletcontAllAB (LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_a, const WavOpacityCurveW & waOpacityCurveW, - struct cont_params &cp, const bool useChannelA); - void WaveletAandBAllAB (wavelet_decomposition &WaveletCoeffs_a, wavelet_decomposition &WaveletCoeffs_b, - struct cont_params &cp, FlatCurve* hhcurve, bool hhutili); - void ContAllL (float **koeLi, float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * lab, 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 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 ContAllAB (LabImage * lab, int maxlvl, float **varhue, float **varchrom, float ** WavCoeffs_a, float * WavCoeffs_a0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, - int W_ab, int H_ab, const bool useChannelA); - void Evaluate2 (wavelet_decomposition &WaveletCoeffs_L, - float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN); - void 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 WaveletcontAllL(LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_L, + struct cont_params &cp, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili); + void WaveletcontAllLfinal(wavelet_decomposition &WaveletCoeffs_L, struct cont_params &cp, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL); + void WaveletcontAllAB(LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_a, const WavOpacityCurveW & waOpacityCurveW, + struct cont_params &cp, const bool useChannelA); + void WaveletAandBAllAB(wavelet_decomposition &WaveletCoeffs_a, wavelet_decomposition &WaveletCoeffs_b, + struct cont_params &cp, FlatCurve* hhcurve, bool hhutili); + void ContAllL(float **koeLi, float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * lab, 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 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 ContAllAB(LabImage * lab, int maxlvl, float **varhue, float **varchrom, float ** WavCoeffs_a, float * WavCoeffs_a0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, + int W_ab, int H_ab, const bool useChannelA); + void Evaluate2(wavelet_decomposition &WaveletCoeffs_L, + float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN); + void 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 Aver (float * HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min); - void Sigma (float * HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg); - void calckoe (float ** WavCoeffs_LL, const struct cont_params& cp, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC = nullptr); + void Aver(float * HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min); + void Sigma(float * HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg); + void calckoe(float ** WavCoeffs_LL, const struct cont_params& cp, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC = nullptr); - void Median_Denoise ( float **src, float **dst, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); - void Median_Denoise ( float **src, float **dst, float upperBound, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); - void RGB_denoise (int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &nresi, float &highresi); - void RGB_denoise_infoGamCurve (const procparams::DirPyrDenoiseParams & dnparams, const bool isRAW, LUTf &gamcurve, float &gam, float &gamthresh, float &gamslope); - void RGB_denoise_info (Imagefloat * src, Imagefloat * provicalc, bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &minredaut, float & minblueaut, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, bool multiThread = false); - void RGBtile_denoise (float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer ); //for DCT - void RGBoutput_tile_row (float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top ); - bool WaveletDenoiseAllL (wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge, int denoiseNestedLevels); - bool WaveletDenoiseAllAB (wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float *variC, int local, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, int denoiseNestedLevels); - void WaveletDenoiseAll_info (int levwav, wavelet_decomposition &WaveletCoeffs_a, - wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float & minblueaut, int schoice, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, - float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb); + void Median_Denoise(float **src, float **dst, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); + void Median_Denoise(float **src, float **dst, float upperBound, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); + void RGB_denoise(int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &nresi, float &highresi); + void RGB_denoise_infoGamCurve(const procparams::DirPyrDenoiseParams & dnparams, const bool isRAW, LUTf &gamcurve, float &gam, float &gamthresh, float &gamslope); + void RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc, bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &minredaut, float & minblueaut, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, bool multiThread = false); + void RGBtile_denoise(float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer); //for DCT + void RGBoutput_tile_row(float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top); + bool WaveletDenoiseAllL(wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge, int denoiseNestedLevels); + bool WaveletDenoiseAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float *variC, int local, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, int denoiseNestedLevels); + void WaveletDenoiseAll_info(int levwav, wavelet_decomposition &WaveletCoeffs_a, + wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float & minblueaut, int schoice, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, + float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb); - bool WaveletDenoiseAll_BiShrinkL (wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3]); - bool WaveletDenoiseAll_BiShrinkAB (wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float noisevar_ab, - const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb); - void ShrinkAllL (wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir, float *noisevarlum, float * madL, float * vari, int edge); - void ShrinkAllAB (wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir, - float *noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, float * madL, float * variC, int local, float * madaab = nullptr, bool madCalculated = false); - void ShrinkAll_info (float ** WavCoeffs_a, float ** WavCoeffs_b, - int W_ab, int H_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, - float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb); - void Noise_residualAB (wavelet_decomposition &WaveletCoeffs_ab, float &chresid, float &chmaxresid, bool denoiseMethodRgb); - void calcautodn_info (float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc); - float MadMax (float * DataList, int &max, int datalen); - float Mad (float * DataList, const int datalen); - float MadRgb (float * DataList, const int datalen); + bool WaveletDenoiseAll_BiShrinkL(wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3]); + bool WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float noisevar_ab, + const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb); + void ShrinkAllL(wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir, float *noisevarlum, float * madL, float * vari, int edge); + void ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir, + float *noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, float * madL, float * variC, int local, float * madaab = nullptr, bool madCalculated = false); + void ShrinkAll_info(float ** WavCoeffs_a, float ** WavCoeffs_b, + int W_ab, int H_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, + float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb); + void Noise_residualAB(wavelet_decomposition &WaveletCoeffs_ab, float &chresid, float &chmaxresid, bool denoiseMethodRgb); + void calcautodn_info(float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc); + float MadMax(float * DataList, int &max, int datalen); + float Mad(float * DataList, const int datalen); + float MadRgb(float * DataList, const int datalen); // pyramid wavelet - void cbdl_local_temp (float ** src, float ** dst, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale); - void idirpyr_eq_channel_loc (float ** data_coarse, float ** data_fine, float ** loctemp, float ** buffer, int width, int height, int level, float multi[5], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice); - void dirpyr_equalizer (float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scale);//Emil's directional pyramid wavelet - void dirpyr_equalizercam (CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, float b_l, float t_l, float t_r, int scale);//Emil's directional pyramid wavelet - void dirpyr_channel (float ** data_fine, float ** data_coarse, int width, int height, int level, int scale); - void idirpyr_eq_channel (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); - void idirpyr_eq_channelcam (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); - void defringe (LabImage* lab); - void defringecam (CieImage* ncie); - void badpixcam (CieImage* ncie, double rad, int thr, int mode, float skinprot, float chrom, int hotbad); - void badpixlab (LabImage* lab, double rad, int thr, int mode, float skinprot, float chrom); + void cbdl_local_temp(float ** src, float ** dst, float ** loctemp, int srcwidth, int srcheight, const float * mult, float kchro, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale); + void idirpyr_eq_channel_loc(float ** data_coarse, float ** data_fine, float ** loctemp, float ** buffer, int width, int height, int level, float multi[5], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice); + void dirpyr_equalizer(float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scale); //Emil's directional pyramid wavelet + void dirpyr_equalizercam(CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, float b_l, float t_l, float t_r, int scale); //Emil's directional pyramid wavelet + void dirpyr_channel(float ** data_fine, float ** data_coarse, int width, int height, int level, int scale); + void idirpyr_eq_channel(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); + void idirpyr_eq_channelcam(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); + void defringe(LabImage* lab); + void defringecam(CieImage* ncie); + void badpixcam(CieImage* ncie, double rad, int thr, int mode, float skinprot, float chrom, int hotbad); + void badpixlab(LabImage* lab, double rad, int thr, int mode, float skinprot, float chrom); - void PF_correct_RT (LabImage * src, LabImage * dst, double radius, int thresh); - void PF_correct_RTcam (CieImage * src, CieImage * dst, double radius, int thresh); - void Badpixelscam (CieImage * src, CieImage * dst, double radius, int thresh, int mode, float skinprot, float chrom, int hotbad); - void BadpixelsLab (LabImage * src, LabImage * dst, double radius, int thresh, int mode, float skinprot, float chrom); + void PF_correct_RT(LabImage * src, LabImage * dst, double radius, int thresh); + void PF_correct_RTcam(CieImage * src, CieImage * dst, double radius, int thresh); + void Badpixelscam(CieImage * src, CieImage * dst, double radius, int thresh, int mode, float skinprot, float chrom, int hotbad); + void BadpixelsLab(LabImage * src, LabImage * dst, double radius, int thresh, int mode, float skinprot, float chrom); void ToneMapFattal02(Imagefloat *rgb); - - Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm); - Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, GammaValues *ga = nullptr); + + Image8* lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm); + Image16* lab2rgb16(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, GammaValues *ga = nullptr); // CieImage *ciec; - bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); - bool transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); - static void getAutoExp (const LUTu & histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); - static double getAutoDistor (const Glib::ustring& fname, int thumb_size); - double getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap = nullptr); - void rgb2lab (const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); - void lab2rgb (const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); + bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); + bool transCoord(int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); + static void getAutoExp(const LUTu & histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); + static double getAutoDistor(const Glib::ustring& fname, int thumb_size); + double getTransformAutoFill(int oW, int oH, const LensCorrection *pLCPMap = nullptr); + void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); + void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); }; } #endif diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 1eb850140..596f5ce21 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -58,7 +58,7 @@ namespace { -float calcLocalFactor (const float lox, const float loy, const float lcx, const float dx, const float lcy, const float dy, const float ach) +float calcLocalFactor(const float lox, const float loy, const float lcx, const float dx, const float lcy, const float dy, const float ach) { //elipse x2/a2 + y2/b2=1 //transition elipsoidal @@ -66,12 +66,12 @@ float calcLocalFactor (const float lox, const float loy, const float lcx, const // a==> dx b==>dy float kelip = dx / dy; - float belip = sqrt ((rtengine::SQR ((lox - lcx) / kelip) + rtengine::SQR (loy - lcy))); //determine position ellipse ==> a and b + float belip = sqrt((rtengine::SQR((lox - lcx) / kelip) + rtengine::SQR(loy - lcy))); //determine position ellipse ==> a and b float aelip = belip * kelip; float degrad = aelip / dx; float ap = rtengine::RT_PI / (1.f - ach); float bp = rtengine::RT_PI - ap; - return 0.5f * (1.f + xcosf (degrad * ap + bp)); //trigo cos transition + return 0.5f * (1.f + xcosf(degrad * ap + bp)); //trigo cos transition } /* @@ -164,7 +164,7 @@ struct local_params { }; -static void SobelCannyLuma (float **sobelL, float **deltasobelL, float **luma, int bfw, int bfh, float radius) +static void SobelCannyLuma(float **sobelL, float **deltasobelL, float **luma, int bfw, int bfh, float radius) { //base of the process to detect shape in complement of deltaE //use for calcualte Spot reference @@ -241,16 +241,17 @@ static void SobelCannyLuma (float **sobelL, float **deltasobelL, float **luma, i } } -//if(radius > 1.f) { - radius /= 2.f; + if (radius > 0.f) { + radius /= 2.f; - if (radius < 0.5f) { - radius = 0.5f; + if (radius < 0.5f) { + radius = 0.5f; + } + + // printf ("raiusssss=%f\n", radius); + gaussianBlur(luma, tmL, bfw, bfh, radius); } - // printf ("raiusssss=%f\n", radius); - gaussianBlur (luma, tmL, bfw, bfh, radius); - //} for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw ; x++) { @@ -275,11 +276,11 @@ static void SobelCannyLuma (float **sobelL, float **deltasobelL, float **luma, i } //Edge strength - SUML = sqrt (SQR (sumXL) + SQR (sumYL)); + SUML = sqrt(SQR(sumXL) + SQR(sumYL)); //we can add if need teta = atan2 (sumYr, sumXr) } - SUML = CLIPLOC (SUML); + SUML = CLIPLOC(SUML); sobelL[y][x] = SUML; deltasobelL[y][x] = SUML - tmL[y][x]; @@ -302,7 +303,7 @@ static void SobelCannyLuma (float **sobelL, float **deltasobelL, float **luma, i -static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, struct local_params& lp) +static void calcLocalParams(int oW, int oH, const LocallabParams& locallab, struct local_params& lp) { int w = oW; int h = oH; @@ -372,7 +373,7 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str multi[y] = ((float) locallab.mult[y]) / 100.f; } - float thresho = ((float)locallab.threshold ) / 100.f; + float thresho = ((float)locallab.threshold) / 100.f; float chromcbdl = (float)locallab.chromacbdl ; int local_chroma = locallab.chroma; @@ -488,7 +489,7 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str } -static void calcTransition (const float lox, const float loy, const float ach, const local_params& lp, int &zone, float &localFactor) +static void calcTransition(const float lox, const float loy, const float ach, const local_params& lp, int &zone, float &localFactor) { // returns the zone (0 = outside selection, 1 = transition zone between outside and inside selection, 2 = inside selection) // and a factor to calculate the transition in case zone == 1 @@ -496,47 +497,47 @@ static void calcTransition (const float lox, const float loy, const float ach, c zone = 0; if (lox >= lp.xc && lox < (lp.xc + lp.lx) && loy >= lp.yc && loy < lp.yc + lp.ly) { - float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lx)) + SQR ((loy - lp.yc) / (ach * lp.ly)); + float zoneVal = SQR((lox - lp.xc) / (ach * lp.lx)) + SQR((loy - lp.yc) / (ach * lp.ly)); zone = zoneVal < 1.f ? 2 : 0; if (!zone) { - zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lx)) + SQR ((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; + zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lx)) + SQR((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; if (zone) { - localFactor = calcLocalFactor (lox, loy, lp.xc, lp.lx, lp.yc, lp.ly, ach); + localFactor = calcLocalFactor(lox, loy, lp.xc, lp.lx, lp.yc, lp.ly, ach); } } } else if (lox >= lp.xc && lox < lp.xc + lp.lx && loy < lp.yc && loy > lp.yc - lp.lyT) { - float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lx)) + SQR ((loy - lp.yc) / (ach * lp.lyT)); + float zoneVal = SQR((lox - lp.xc) / (ach * lp.lx)) + SQR((loy - lp.yc) / (ach * lp.lyT)); zone = zoneVal < 1.f ? 2 : 0; if (!zone) { - zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lx)) + SQR ((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; + zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lx)) + SQR((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; if (zone) { - localFactor = calcLocalFactor (lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach); + localFactor = calcLocalFactor(lox, loy, lp.xc, lp.lx, lp.yc, lp.lyT, ach); } } } else if (lox < lp.xc && lox > lp.xc - lp.lxL && loy <= lp.yc && loy > lp.yc - lp.lyT) { - float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lxL)) + SQR ((loy - lp.yc) / (ach * lp.lyT)); + float zoneVal = SQR((lox - lp.xc) / (ach * lp.lxL)) + SQR((loy - lp.yc) / (ach * lp.lyT)); zone = zoneVal < 1.f ? 2 : 0; if (!zone) { - zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lxL)) + SQR ((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; + zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lxL)) + SQR((loy - lp.yc) / (lp.lyT))) < 1.f)) ? 1 : 0; if (zone) { - localFactor = calcLocalFactor (lox, loy, lp.xc, lp.lxL, lp.yc, lp.lyT, ach); + localFactor = calcLocalFactor(lox, loy, lp.xc, lp.lxL, lp.yc, lp.lyT, ach); } } } else if (lox < lp.xc && lox > lp.xc - lp.lxL && loy > lp.yc && loy < lp.yc + lp.ly) { - float zoneVal = SQR ((lox - lp.xc) / (ach * lp.lxL)) + SQR ((loy - lp.yc) / (ach * lp.ly)); + float zoneVal = SQR((lox - lp.xc) / (ach * lp.lxL)) + SQR((loy - lp.yc) / (ach * lp.ly)); zone = zoneVal < 1.f ? 2 : 0; if (!zone) { - zone = (zoneVal > 1.f && ((SQR ((lox - lp.xc) / (lp.lxL)) + SQR ((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; + zone = (zoneVal > 1.f && ((SQR((lox - lp.xc) / (lp.lxL)) + SQR((loy - lp.yc) / (lp.ly))) < 1.f)) ? 1 : 0; if (zone) { - localFactor = calcLocalFactor (lox, loy, lp.xc, lp.lxL, lp.yc, lp.ly, ach); + localFactor = calcLocalFactor(lox, loy, lp.xc, lp.lxL, lp.yc, lp.ly, ach); } } } @@ -602,7 +603,7 @@ static void calcTransitioninv (const float lox, const float loy, const float ach } */ -void ImProcFunctions::strcurv_data (std::string retistr, int *s_datc, int &siz) +void ImProcFunctions::strcurv_data(std::string retistr, int *s_datc, int &siz) { std::string delim[69] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", @@ -610,9 +611,9 @@ void ImProcFunctions::strcurv_data (std::string retistr, int *s_datc, int &siz) }; int s_size; - std::size_t posend = retistr.find ("@"); + std::size_t posend = retistr.find("@"); - std::string strend = retistr.substr (posend - 1, 1); + std::string strend = retistr.substr(posend - 1, 1); int longe = 0; for (int sl = 0; sl < 69; sl++) { @@ -629,13 +630,13 @@ void ImProcFunctions::strcurv_data (std::string retistr, int *s_datc, int &siz) pose[0] = -1; for (int z = 1; z < s_size + 1; z++) { - pose[z] = retistr.find (delim[z - 1]); + pose[z] = retistr.find(delim[z - 1]); } for (int z = 1; z < s_size + 1; z++) { - std::string sval = retistr.substr (pose[z - 1] + 1, (pose[z] - pose[z - 1])); - s_datc[z - 1] = s_datcu[z - 1] = std::stoi (sval.c_str()); + std::string sval = retistr.substr(pose[z - 1] + 1, (pose[z] - pose[z - 1])); + s_datc[z - 1] = s_datcu[z - 1] = std::stoi(sval.c_str()); } @@ -652,7 +653,7 @@ void ImProcFunctions::strcurv_data (std::string retistr, int *s_datc, int &siz) } -void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* dest, bool & localskutili, LUTf & sklocalcurve) +void ImProcFunctions::vibrancelocal(int bfw, int bfh, LabImage* lab, LabImage* dest, bool & localskutili, LUTf & sklocalcurve) { if (!params->locallab.expvibrance) { return; @@ -709,7 +710,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* const float chromaPastel = float (params->locallab.pastels) / 100.0f; const float chromaSatur = float (params->locallab.saturated) / 100.0f; const float p00 = 0.07f; - const float limitpastelsatur = (static_cast (params->locallab.psthreshold.value[ThresholdSelector::TS_TOPLEFT]) / 100.0f) * (1.0f - p00) + p00; + const float limitpastelsatur = (static_cast(params->locallab.psthreshold.value[ThresholdSelector::TS_TOPLEFT]) / 100.0f) * (1.0f - p00) + p00; const float maxdp = (limitpastelsatur - p00) / 4.0f; const float maxds = (1.0 - limitpastelsatur) / 4.0f; const float p0 = p00 + maxdp; @@ -718,7 +719,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* const float s0 = limitpastelsatur + maxds; const float s1 = limitpastelsatur + 2.0f * maxds; const float s2 = limitpastelsatur + 3.0f * maxds; - const float transitionweighting = static_cast (params->locallab.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]) / 100.0f; + const float transitionweighting = static_cast(params->locallab.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]) / 100.0f; float chromamean = 0.0f; if (chromaPastel != chromaSatur) { @@ -753,7 +754,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* const bool protectskins = params->locallab.protectskins; const bool avoidcolorshift = params->locallab.avoidcolorshift; - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.working); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.working); //inverse matrix user select const double wip[3][3] = { {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, @@ -791,8 +792,8 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* if (settings->verbose) { #endif - printf ("vibrance: p0=%1.2f p1=%1.2f p2=%1.2f s0=%1.2f s1=%1.2f s2=%1.2f\n", p0, p1, p2, s0, s1, s2); - printf (" pastel=%f satur=%f limit= %1.2f chromamean=%0.5f\n", 1.0f + chromaPastel, 1.0f + chromaSatur, limitpastelsatur, chromamean); + printf("vibrance: p0=%1.2f p1=%1.2f p2=%1.2f s0=%1.2f s1=%1.2f s2=%1.2f\n", p0, p1, p2, s0, s1, s2); + printf(" pastel=%f satur=%f limit= %1.2f chromamean=%0.5f\n", 1.0f + chromaPastel, 1.0f + chromaSatur, limitpastelsatur, chromamean); } #pragma omp for schedule(dynamic, 16) @@ -800,13 +801,13 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* for (int i = 0; i < height; i++) for (int j = 0; j < width; j++) { float LL = lab->L[i][j] / 327.68f; - float CC = sqrt (SQR (lab->a[i][j]) + SQR (lab->b[i][j])) / 327.68f; - float HH = xatan2f (lab->b[i][j], lab->a[i][j]); + float CC = sqrt(SQR(lab->a[i][j]) + SQR(lab->b[i][j])) / 327.68f; + float HH = xatan2f(lab->b[i][j], lab->a[i][j]); float satredu = 1.0f; //reduct sat in function of skin if (protectskins) { - Color::SkinSat (LL, HH, CC, satredu);// for skin colors + Color::SkinSat(LL, HH, CC, satredu); // for skin colors } // here we work on Chromaticity and Hue @@ -829,7 +830,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* bool neg = false; bool more_rgb = false; //gamut control : Lab values are in gamut - Color::gamutLchonly (HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f, neg, more_rgb); + Color::gamutLchonly(HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f, neg, more_rgb); if (neg) { negat++; @@ -841,11 +842,11 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* #else //gamut control : Lab values are in gamut - Color::gamutLchonly (HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f); + Color::gamutLchonly(HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f); #endif if (Chprov > 6.0f) { - const float saturation = SAT (R, G, B); + const float saturation = SAT(R, G, B); if (saturation > 0.0f) { if (satredu != 1.0f) { @@ -858,7 +859,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* //blue: -1.80 -3.14 green = 2.1 3.14 green-yellow=1.4 2.1 red:0 1.4 blue-purple:-0.7 -1.4 purple: 0 -0.7 //these values allow a better and differential response if (LL < 20.0f) { //more for blue-purple, blue and red modulate - if (/*HH> -3.1415f &&*/ HH < -1.5f ) { + if (/*HH> -3.1415f &&*/ HH < -1.5f) { sathue[0] = 1.3f; //blue sathue[1] = 1.2f; sathue[2] = 1.1f; @@ -868,7 +869,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.1f ; sathue2[2] = 1.05f; sathue2[3] = 1.0f; - } else if (/*HH>=-1.5f &&*/ HH < -0.7f ) { + } else if (/*HH>=-1.5f &&*/ HH < -0.7f) { sathue[0] = 1.6f; //blue purple 1.2 1.1 sathue[1] = 1.4f; sathue[2] = 1.3f; @@ -878,7 +879,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.15f; sathue2[2] = 1.1f ; sathue2[3] = 1.0f; - } else if (/*HH>=-0.7f &&*/ HH < 0.0f ) { + } else if (/*HH>=-0.7f &&*/ HH < 0.0f) { sathue[0] = 1.2f; //purple sathue[1] = 1.0f; sathue[2] = 1.0f; @@ -890,7 +891,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[3] = 1.0f; } // else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=1.1f;sathue[1]=1.1f;sathue[2]=1.1f;sathue[3]=1.0f ;sathue[4]=0.4f;sathue2[0]=1.0f ;sathue2[1]=1.0f ;sathue2[2]=1.0f ;sathue2[3]=1.0f;}//red 0.8 0.7 - else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) { + else if (/*HH>= 0.0f &&*/ HH <= 1.4f) { sathue[0] = 1.3f; //red 0.8 0.7 sathue[1] = 1.2f; sathue[2] = 1.1f; @@ -900,7 +901,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.0f ; sathue2[2] = 1.0f ; sathue2[3] = 1.0f; - } else if (/*HH> 1.4f &&*/ HH <= 2.1f ) { + } else if (/*HH> 1.4f &&*/ HH <= 2.1f) { sathue[0] = 1.0f; //green yellow 1.2 1.1 sathue[1] = 1.0f; sathue[2] = 1.0f; @@ -922,7 +923,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[3] = 1.0f; } } else if (LL < 50.0f) { //more for blue and green, less for red and green-yellow - if (/*HH> -3.1415f &&*/ HH < -1.5f ) { + if (/*HH> -3.1415f &&*/ HH < -1.5f) { sathue[0] = 1.5f; //blue sathue[1] = 1.4f; sathue[2] = 1.3f; @@ -932,7 +933,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.1f ; sathue2[2] = 1.05f; sathue2[3] = 1.0f; - } else if (/*HH>=-1.5f &&*/ HH < -0.7f ) { + } else if (/*HH>=-1.5f &&*/ HH < -0.7f) { sathue[0] = 1.3f; //blue purple 1.2 1.1 sathue[1] = 1.2f; sathue[2] = 1.1f; @@ -942,7 +943,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.05f; sathue2[2] = 1.0f ; sathue2[3] = 1.0f; - } else if (/*HH>=-0.7f &&*/ HH < 0.0f ) { + } else if (/*HH>=-0.7f &&*/ HH < 0.0f) { sathue[0] = 1.2f; //purple sathue[1] = 1.0f; sathue[2] = 1.0f; @@ -954,7 +955,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[3] = 1.0f; } // else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=0.8f;sathue[1]=0.8f;sathue[2]=0.8f;sathue[3]=0.8f ;sathue[4]=0.4f;sathue2[0]=0.8f ;sathue2[1]=0.8f ;sathue2[2]=0.8f ;sathue2[3]=0.8f;}//red 0.8 0.7 - else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) { + else if (/*HH>= 0.0f &&*/ HH <= 1.4f) { sathue[0] = 1.1f; //red 0.8 0.7 sathue[1] = 1.0f; sathue[2] = 0.9f; @@ -964,7 +965,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 0.8f ; sathue2[2] = 0.8f ; sathue2[3] = 0.8f; - } else if (/*HH> 1.4f &&*/ HH <= 2.1f ) { + } else if (/*HH> 1.4f &&*/ HH <= 2.1f) { sathue[0] = 1.1f; //green yellow 1.2 1.1 sathue[1] = 1.1f; sathue[2] = 1.1f; @@ -987,7 +988,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* } } else if (LL < 80.0f) { //more for green, less for red and green-yellow - if (/*HH> -3.1415f &&*/ HH < -1.5f ) { + if (/*HH> -3.1415f &&*/ HH < -1.5f) { sathue[0] = 1.3f; //blue sathue[1] = 1.2f; sathue[2] = 1.15f; @@ -997,7 +998,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.1f ; sathue2[2] = 1.05f; sathue2[3] = 1.0f; - } else if (/*HH>=-1.5f &&*/ HH < -0.7f ) { + } else if (/*HH>=-1.5f &&*/ HH < -0.7f) { sathue[0] = 1.3f; //blue purple 1.2 1.1 sathue[1] = 1.2f; sathue[2] = 1.15f; @@ -1007,7 +1008,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 1.05f; sathue2[2] = 1.0f ; sathue2[3] = 1.0f; - } else if (/*HH>=-0.7f &&*/ HH < 0.0f ) { + } else if (/*HH>=-0.7f &&*/ HH < 0.0f) { sathue[0] = 1.2f; //purple sathue[1] = 1.0f; sathue[2] = 1.0f ; @@ -1019,7 +1020,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[3] = 1.0f; } // else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=0.8f;sathue[1]=0.8f;sathue[2]=0.8f ;sathue[3]=0.8f ;sathue[4]=0.3f;sathue2[0]=0.8f ;sathue2[1]=0.8f ;sathue2[2]=0.8f ;sathue2[3]=0.8f;}//red 0.8 0.7 - else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) { + else if (/*HH>= 0.0f &&*/ HH <= 1.4f) { sathue[0] = 1.1f; //red 0.8 0.7 sathue[1] = 1.0f; sathue[2] = 0.9f ; @@ -1029,7 +1030,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 0.8f ; sathue2[2] = 0.8f ; sathue2[3] = 0.8f; - } else if (/*HH> 1.4f &&*/ HH <= 2.1f ) { + } else if (/*HH> 1.4f &&*/ HH <= 2.1f) { sathue[0] = 1.3f; //green yellow 1.2 1.1 sathue[1] = 1.2f; sathue[2] = 1.1f ; @@ -1051,7 +1052,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[3] = 1.05f; } } else { /*if (LL>=80.0f)*/ //more for green-yellow, less for red and purple - if (/*HH> -3.1415f &&*/ HH < -1.5f ) { + if (/*HH> -3.1415f &&*/ HH < -1.5f) { sathue[0] = 1.0f; //blue sathue[1] = 1.0f; sathue[2] = 0.9f; @@ -1061,7 +1062,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 0.8f ; sathue2[2] = 0.8f ; sathue2[3] = 0.8f; - } else if (/*HH>=-1.5f &&*/ HH < -0.7f ) { + } else if (/*HH>=-1.5f &&*/ HH < -0.7f) { sathue[0] = 1.0f; //blue purple 1.2 1.1 sathue[1] = 1.0f; sathue[2] = 0.9f; @@ -1071,7 +1072,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 0.8f ; sathue2[2] = 0.8f ; sathue2[3] = 0.8f; - } else if (/*HH>=-0.7f &&*/ HH < 0.0f ) { + } else if (/*HH>=-0.7f &&*/ HH < 0.0f) { sathue[0] = 1.2f; //purple sathue[1] = 1.0f; sathue[2] = 1.0f; @@ -1083,7 +1084,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[3] = 0.8f; } // else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=0.8f;sathue[1]=0.8f;sathue[2]=0.8f;sathue[3]=0.8f;sathue[4]=0.2f;sathue2[0]=0.8f;sathue2[1]=0.8f ;sathue2[2]=0.8f ;sathue2[3]=0.8f;}//red 0.8 0.7 - else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) { + else if (/*HH>= 0.0f &&*/ HH <= 1.4f) { sathue[0] = 1.1f; //red 0.8 0.7 sathue[1] = 1.0f; sathue[2] = 0.9f; @@ -1093,7 +1094,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* sathue2[1] = 0.8f ; sathue2[2] = 0.8f ; sathue2[3] = 0.8f; - } else if (/*HH> 1.4f &&*/ HH <= 2.1f ) { + } else if (/*HH> 1.4f &&*/ HH <= 2.1f) { sathue[0] = 1.6f; //green yellow 1.2 1.1 sathue[1] = 1.5f; sathue[2] = 1.4f; @@ -1132,9 +1133,9 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* float s3 = 1.0f; // We handle only positive values here ; improve transitions - if (saturation < p00) { + if (saturation < p00) { chmodpastel = chl00 ; //neutral tones - } else if (saturation < p0 ) { + } else if (saturation < p0) { pa = (chl00 - chl0) / (p00 - p0); pb = chl00 - pa * p00; chmodpastel = pa * saturation + pb; @@ -1184,7 +1185,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* }// end transition if (saturation <= limitpastelsatur) { - if (chmodpastel > 2.0f ) { + if (chmodpastel > 2.0f) { chmodpastel = 2.0f; //avoid too big values } else if (chmodpastel < -0.93f) { chmodpastel = -0.93f; //avoid negative values @@ -1196,7 +1197,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* Chprov = 6.0f; } } else { //if (saturation > limitpastelsatur) - if (chmodsat > 1.8f ) { + if (chmodsat > 1.8f) { chmodsat = 1.8f; //saturated } else if (chmodsat < -0.93f) { chmodsat = -0.93f; @@ -1255,7 +1256,7 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* //Munsell correction // float2 sincosval; if (!avoidcolorshift && hhModified) { - sincosval = xsincosf (HH); + sincosval = xsincosf(HH); } float aprovn, bprovn; @@ -1269,13 +1270,13 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* float correctlum = 0.0f; #ifdef _DEBUG - Color::AllMunsellLch (/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum, MunsDebugInfo); + Color::AllMunsellLch(/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum, MunsDebugInfo); #else - Color::AllMunsellLch (/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum); + Color::AllMunsellLch(/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum); #endif if (correctionHue != 0.f || hhModified) { - sincosval = xsincosf (HH + correctionHue); + sincosval = xsincosf(HH + correctionHue); hhModified = false; } } @@ -1283,15 +1284,15 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* aprovn = Chprov * sincosval.y; bprovn = Chprov * sincosval.x; - float fyy = (0.00862069f * Lprov ) + 0.137932f; + float fyy = (0.00862069f * Lprov) + 0.137932f; float fxx = (0.002f * aprovn) + fyy; float fzz = fyy - (0.005f * bprovn); - float xx_ = 65535.f * Color::f2xyz (fxx) * Color::D50x; + float xx_ = 65535.f * Color::f2xyz(fxx) * Color::D50x; // float yy_ = 65535.0f * Color::f2xyz(fyy); - float zz_ = 65535.f * Color::f2xyz (fzz) * Color::D50z; + float zz_ = 65535.f * Color::f2xyz(fzz) * Color::D50z; float yy_ = 65535.f * ((Lprov > Color::epskap) ? fyy * fyy*fyy : Lprov / Color::kappa); - Color::xyz2rgb (xx_, yy_, zz_, R, G, B, wip); + Color::xyz2rgb(xx_, yy_, zz_, R, G, B, wip); if (R < 0.0f || G < 0.0f || B < 0.0f) { #ifdef _DEBUG @@ -1322,11 +1323,11 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* t2e.set(); if (settings->verbose) { - printf ("Vibrance local (performed in %d usec):\n", t2e.etime (t1e)); - printf (" Gamut: G1negat=%iiter G165535=%iiter G2negsat=%iiter G265535=%iiter\n", negat, moreRGB, negsat, moresat); + printf("Vibrance local (performed in %d usec):\n", t2e.etime(t1e)); + printf(" Gamut: G1negat=%iiter G165535=%iiter G2negsat=%iiter G265535=%iiter\n", negat, moreRGB, negsat, moresat); if (MunsDebugInfo) { - printf (" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad depass=%u\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass); + printf(" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad depass=%u\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass); } } @@ -1338,13 +1339,13 @@ void ImProcFunctions::vibrancelocal (int bfw, int bfh, LabImage* lab, LabImage* } -void ImProcFunctions::exlabLocal (const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve) +void ImProcFunctions::exlabLocal(const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve) { float maxran = 32768.f; //65536 - const float exp_scale = pow (2.0, lp.expcomp);//lp.expcomp - const float comp = (max (0.0, lp.expcomp) + 1.0) * lp.hlcomp / 100.0; - const float shoulder = ((maxran / max (1.0f, exp_scale)) * (lp.hlcompthr / 200.0)) + 0.1; + const float exp_scale = pow(2.0, lp.expcomp); //lp.expcomp + const float comp = (max(0.0, lp.expcomp) + 1.0) * lp.hlcomp / 100.0; + const float shoulder = ((maxran / max(1.0f, exp_scale)) * (lp.hlcompthr / 200.0)) + 0.1; const float hlrange = maxran - shoulder; @@ -1356,13 +1357,13 @@ void ImProcFunctions::exlabLocal (const local_params& lp, int bfh, int bfw, LabI { char *buffer; - buffer = (char *) malloc (3 * sizeof (float) * TS * TS + 20 * 64 + 63); + buffer = (char *) malloc(3 * sizeof(float) * TS * TS + 20 * 64 + 63); char *data; - data = (char*) ( ( uintptr_t (buffer) + uintptr_t (63)) / 64 * 64); + data = (char*)((uintptr_t (buffer) + uintptr_t (63)) / 64 * 64); float *Ltemp = (float (*))data; - float *atemp = (float (*)) ((char*)Ltemp + sizeof (float) * TS * TS + 4 * 64); - float *btemp = (float (*)) ((char*)atemp + sizeof (float) * TS * TS + 8 * 64); + float *atemp = (float (*))((char*)Ltemp + sizeof(float) * TS * TS + 4 * 64); + float *btemp = (float (*))((char*)atemp + sizeof(float) * TS * TS + 8 * 64); int istart; int jstart; int tW; @@ -1377,8 +1378,8 @@ void ImProcFunctions::exlabLocal (const local_params& lp, int bfh, int bfw, LabI istart = ii; jstart = jj; - tH = min (ii + TS, bfh); - tW = min (jj + TS, bfw); + tH = min(ii + TS, bfh); + tW = min(jj + TS, bfw); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -1398,7 +1399,7 @@ void ImProcFunctions::exlabLocal (const local_params& lp, int bfh, int bfw, LabI float L = Ltemp[ti * TS + tj]; // float a = atemp[ti * TS + tj]; // float b = btemp[ti * TS + tj]; - float tonefactor = (L < MAXVALF ? hltonecurve[L] : CurveFactory::hlcurveloc (exp_scale, comp, hlrange, L, niv) ); + float tonefactor = (L < MAXVALF ? hltonecurve[L] : CurveFactory::hlcurveloc(exp_scale, comp, hlrange, L, niv)); Ltemp[ti * TS + tj] = L * tonefactor; } } @@ -1472,7 +1473,7 @@ void ImProcFunctions::exlabLocal (const local_params& lp, int bfh, int bfw, LabI } } - free (buffer); + free(buffer); } @@ -1481,15 +1482,15 @@ void ImProcFunctions::exlabLocal (const local_params& lp, int bfh, int bfw, LabI } -void ImProcFunctions::addGaNoise (LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk) +void ImProcFunctions::addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk) { // BENCHFUN //Box-Muller method. // add luma noise to image - srand (1); + srand(1); - const float variaFactor = SQR (variance) / sk; + const float variaFactor = SQR(variance) / sk; const float randFactor = 1.f / RAND_MAX; #ifdef _OPENMP #pragma omp parallel @@ -1517,10 +1518,10 @@ void ImProcFunctions::addGaNoise (LabImage *lab, LabImage *dst, const float mean kvar = kvar < 0.5f ? 0.5f : kvar; } - float varia = SQR (kvar) * variaFactor; + float varia = SQR(kvar) * variaFactor; if (!generate) { - dst->L[y][x] = LIM (lab->L[y][x] + mean + varia * z1, 0.f, 32768.f); + dst->L[y][x] = LIM(lab->L[y][x] + mean + varia * z1, 0.f, 32768.f); continue; } @@ -1535,19 +1536,19 @@ void ImProcFunctions::addGaNoise (LabImage *lab, LabImage *dst, const float mean float u1f = u1 * randFactor; float u2f = u2 * randFactor; - float2 sincosval = xsincosf (2.f * rtengine::RT_PI * u2f); - float factor = sqrtf (-2.f * xlogf (u1f)); + float2 sincosval = xsincosf(2.f * rtengine::RT_PI * u2f); + float factor = sqrtf(-2.f * xlogf(u1f)); z0 = factor * sincosval.y; z1 = factor * sincosval.x; - dst->L[y][x] = LIM (lab->L[y][x] + mean + varia * z0, 0.f, 32768.f); + dst->L[y][x] = LIM(lab->L[y][x] + mean + varia * z0, 0.f, 32768.f); } } } } -void ImProcFunctions::DeNoise_Local (int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy) +void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy) { // local denoise // BENCHFUN @@ -1574,7 +1575,7 @@ void ImProcFunctions::DeNoise_Local (int call, const struct local_params& lp, La int zone; float localFactor; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); int begx = int (lp.xc - lp.lxL); int begy = int (lp.yc - lp.lyT); @@ -1637,7 +1638,7 @@ void ImProcFunctions::DeNoise_Local (int call, const struct local_params& lp, La } -void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int chro) +void ImProcFunctions::cbdl_Local(float ** buflight, float ** bufchrom, float **loctemp, float **loctempch, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int chro) { //local CBDL BENCHFUN @@ -1666,7 +1667,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -1685,15 +1686,15 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -1705,7 +1706,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -1716,8 +1717,8 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif // int zone; float rL = original->L[y][x] / 327.68f; @@ -1763,28 +1764,28 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** float kch = 1.f; float fach = 1.f; float falu = 1.f; - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); } float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 //kch to modulate action with chroma - if (deltachro < 160.f * SQR (lp.senscb / 100.f)) { + if (deltachro < 160.f * SQR(lp.senscb / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.senscb / 100.f); + float ck = 160.f * SQR(lp.senscb / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (lp.senscb < 40.f ) { - kch = pow (kch, pa * lp.senscb + pb); //increase under 40 + if (lp.senscb < 40.f) { + kch = pow(kch, pa * lp.senscb + pb); //increase under 40 } @@ -1792,7 +1793,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** if (lp.senscb < 100.f) { //to try... //hue detection if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good - if (rhue >= hueplus - delhu ) { + if (rhue >= hueplus - delhu) { realcligh = apluscligh * rhue + bpluscligh; realcchro = apluscchro * rhue + bpluscchro; @@ -1811,7 +1812,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** // kzon = true; - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; realcchro = apluscchro * rhue + bpluscchro; @@ -1832,7 +1833,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** // kzon = true; } - if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; realcchro = apluscchro * rhue + bpluscchro; @@ -1852,7 +1853,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** } // kzon = true; - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; realcchro = apluscchro * rhue + bpluscchro; @@ -1921,7 +1922,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** // float fchr = ((100.f + realcchro) / 100.f);//chroma transition if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow (rchro / kcr, lp.iterat / 10.f); + falL *= pow(rchro / kcr, lp.iterat / 10.f); } switch (zone) { @@ -1953,15 +1954,15 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** if (chro == 1) { - float difab = loctempch[loy - begy][lox - begx] - sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); - difa = difab * cos (rhue); - difb = difab * sin (rhue); + float difab = loctempch[loy - begy][lox - begx] - sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])); + difa = difab * cos(rhue); + difb = difab * sin(rhue); difa *= factorx * (100.f + realcchro * falu * falL) / 100.f; difb *= factorx * (100.f + realcchro * falu * falL) / 100.f; difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } break; @@ -1979,15 +1980,15 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** } if (chro == 1) { - float difab = loctempch[loy - begy][lox - begx] - sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); - difa = difab * cos (rhue); - difb = difab * sin (rhue); + float difab = loctempch[loy - begy][lox - begx] - sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])); + difa = difab * cos(rhue); + difb = difab * sin(rhue); difa *= (100.f + realcchro * falu * falL) / 100.f; difb *= (100.f + realcchro * falu * falL) / 100.f; difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } } @@ -2000,7 +2001,7 @@ void ImProcFunctions::cbdl_Local (float ** buflight, float ** bufchrom, float ** } -void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::TM_Local(LabImage * tmp1, float **buflight, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { //local TM BENCHFUN @@ -2030,7 +2031,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -2049,15 +2050,15 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -2074,7 +2075,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -2086,8 +2087,8 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif // int zone; float rL = original->L[y][x] / 327.68f; @@ -2116,28 +2117,28 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h float kch = 1.f; float fach = 1.f; float falu = 1.f; - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); } float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 //kch to modulate action with chroma - if (deltachro < 160.f * SQR (lp.senstm / 100.f)) { + if (deltachro < 160.f * SQR(lp.senstm / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.senstm / 100.f); + float ck = 160.f * SQR(lp.senstm / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (lp.senstm < 40.f ) { - kch = pow (kch, pa * lp.senstm + pb); //increase under 40 + if (lp.senstm < 40.f) { + kch = pow(kch, pa * lp.senstm + pb); //increase under 40 } @@ -2145,7 +2146,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h if (lp.senstm < 100.f) { //to try... //hue detection if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good - if (rhue >= hueplus - delhu ) { + if (rhue >= hueplus - delhu) { realcligh = apluscligh * rhue + bpluscligh; khu = apl * rhue + bpl; @@ -2161,7 +2162,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h // kzon = true; - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; @@ -2179,7 +2180,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h // kzon = true; } - if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; @@ -2195,7 +2196,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h } // kzon = true; - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; @@ -2250,7 +2251,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h float falL = 1.f; if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow (rchro / kcr, lp.iterat / 10.f); + falL *= pow(rchro / kcr, lp.iterat / 10.f); } @@ -2309,7 +2310,7 @@ void ImProcFunctions::TM_Local (LabImage * tmp1, float **buflight, const float h -void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp2, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::BlurNoise_Local(int call, LabImage * tmp1, LabImage * tmp2, float ** buflight, float ** bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { //local BLUR BENCHFUN @@ -2339,7 +2340,7 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -2383,15 +2384,15 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -2405,7 +2406,7 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp int begy = int (lp.yc - lp.lyT); float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values if (lp.blurmet == 0) { @@ -2435,8 +2436,8 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp const float rhue = atan2Buffer[x]; const float rchro = sqrtBuffer[x]; #else - const float rhue = xatan2f (original->b[y][x], original->a[y][x]); - const float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + const float rhue = xatan2f(original->b[y][x], original->a[y][x]); + const float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif float rL = original->L[y][x] / 327.68f; @@ -2461,8 +2462,8 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp float kch = 1.f; float fach = 1.f; float falu = 1.f; - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); float realstr = 1.f; float realstrch = 1.f; float khu = 0.f; @@ -2472,27 +2473,27 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp } float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 //kch to modulate action with chroma - if (deltachro < 160.f * SQR (lp.sensbn / 100.f)) { + if (deltachro < 160.f * SQR(lp.sensbn / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.sensbn / 100.f); + float ck = 160.f * SQR(lp.sensbn / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (lp.sensbn < 40.f ) { - kch = pow (kch, pa * lp.sensbn + pb); //increase under 90 + if (lp.sensbn < 40.f) { + kch = pow(kch, pa * lp.sensbn + pb); //increase under 90 } // algo with detection of hue ==> artifacts for noisy images ==> denoise before if (lp.qualmet >= 1 && lp.sensbn < 50.f) { //to try... //hue detection if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good - if (rhue >= hueplus - delhu ) { + if (rhue >= hueplus - delhu) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; khu = apl * rhue + bpl; @@ -2505,7 +2506,7 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp realstrch = clc; khu = 1.f; } - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -2521,7 +2522,7 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp } } - if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -2535,7 +2536,7 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp realstrch = clc; khu = 1.f; } - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -2619,13 +2620,13 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp difb *= kch * fach; if (lp.blurmet == 0) { - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } if (lp.blurmet == 2) { - transformed->a[y][x] = CLIPC (tmp2->a[y][x] - difa); - transformed->b[y][x] = CLIPC (tmp2->b[y][x] - difb); + transformed->a[y][x] = CLIPC(tmp2->a[y][x] - difa); + transformed->b[y][x] = CLIPC(tmp2->b[y][x] - difb); } } @@ -2664,13 +2665,13 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp difb *= kch * fach; if (lp.blurmet == 0) { - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); ; - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); ; + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } if (lp.blurmet == 2) { - transformed->a[y][x] = CLIPC (tmp2->a[y][x] - difa); - transformed->b[y][x] = CLIPC (tmp2->b[y][x] - difb); + transformed->a[y][x] = CLIPC(tmp2->a[y][x] - difa); + transformed->b[y][x] = CLIPC(tmp2->b[y][x] - difb); } } @@ -2681,7 +2682,7 @@ void ImProcFunctions::BlurNoise_Local (int call, LabImage * tmp1, LabImage * tmp } } -void ImProcFunctions::InverseReti_Local (const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy, int chro) +void ImProcFunctions::InverseReti_Local(const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy, int chro) { // BENCHFUN //inverse local retinex @@ -2697,7 +2698,7 @@ void ImProcFunctions::InverseReti_Local (const struct local_params & lp, LabImag int zone; float localFactor; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); switch (zone) { case 0: { // outside selection and outside transition zone => full effect, no transition @@ -2754,7 +2755,7 @@ void ImProcFunctions::InverseReti_Local (const struct local_params & lp, LabImag -void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy, int chro) +void ImProcFunctions::Reti_Local(float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy, int chro) { //local retinex @@ -2802,7 +2803,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -2827,15 +2828,15 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -2847,7 +2848,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values transformed->L[y][x] = original->L[y][x]; @@ -2858,8 +2859,8 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif float rL = original->L[y][x] / 327.68f; @@ -2888,32 +2889,32 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float float realstr = 1.f; float realstrch = 1.f; //prepare shape detection - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); } float deltaE = 20.f * deltahue + deltachro; //between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 float kch = 1.f; float khu = 0.f; float fach = 1.f; float falu = 1.f; - if (deltachro < 160.f * SQR (lp.sensh / 100.f)) { + if (deltachro < 160.f * SQR(lp.sensh / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.sensh / 100.f); + float ck = 160.f * SQR(lp.sensh / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (lp.sensh < 40.f ) { - kch = pow (kch, pa * lp.sensh + pb); //increase under 40 + if (lp.sensh < 40.f) { + kch = pow(kch, pa * lp.sensh + pb); //increase under 40 } bool kzon = false; @@ -2939,7 +2940,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float } kzon = true; - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -2979,7 +2980,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float } kzon = true; - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -3035,7 +3036,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float if (lp.sensh < 60.f) { //arbitrary value if (hueref < -1.1f && hueref > -2.8f) { // detect blue sky if (chromaref > 0.f && chromaref < 35.f * multchro) { // detect blue sky - if ( (rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { + if ((rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { realstr *= 0.9f; } else { realstr = 1.f; @@ -3048,7 +3049,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float if (lp.sensh < 50.f) { //&& lp.chro > 0.f if (hueref > -0.1f && hueref < 1.6f) { // detect skin if (chromaref > 0.f && chromaref < 55.f * multchroskin) { // detect skin - if ( (rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { + if ((rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { realstr *= 0.7f; } else { realstr = 1.f; @@ -3066,7 +3067,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float float falL = 1.f; if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow (rchro / kcr, lp.iterat / 10.f); + falL *= pow(rchro / kcr, lp.iterat / 10.f); } // int zone; @@ -3110,8 +3111,8 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float difb *= factorx * (100.f + realstrch * falu * falL) / 100.f; difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } @@ -3140,8 +3141,8 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } } @@ -3156,7 +3157,7 @@ void ImProcFunctions::Reti_Local (float **buflight, float **bufchro, const float } } -void ImProcFunctions::InverseBlurNoise_Local (const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy) +void ImProcFunctions::InverseBlurNoise_Local(const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy) { // BENCHFUN //inverse local blur and noise @@ -3172,7 +3173,7 @@ void ImProcFunctions::InverseBlurNoise_Local (const struct local_params & lp, La int zone; float localFactor; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); switch (zone) { case 0: { // outside selection and outside transition zone => full effect, no transition @@ -3236,7 +3237,7 @@ struct local_contra { float al, bl; }; -void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, float pm, struct local_contra & lco, float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::Contrast_Local(int call, float ** buflightc, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, float pm, struct local_contra & lco, float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { BENCHFUN // contrast - perhaps for 4 areas if need @@ -3282,8 +3283,8 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float lco.alinf = realcox / (localtype / 2.f); const float vi = (localtype / 2.f) / 100.f; const float vinf = (50.f + localtype / 2.f) / 100.f; - ImProcFunctions::secondeg_begin (reducac, vi, lco.aa, lco.bb);//parabolic - ImProcFunctions::secondeg_end (reducac, vinf, lco.aaa, lco.bbb, lco.ccc);//parabolic + ImProcFunctions::secondeg_begin(reducac, vi, lco.aa, lco.bb); //parabolic + ImProcFunctions::secondeg_end(reducac, vinf, lco.aaa, lco.bbb, lco.ccc); //parabolic if (call <= 3) { #ifdef _OPENMP @@ -3294,7 +3295,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -3314,15 +3315,15 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -3337,7 +3338,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -3347,8 +3348,8 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif //prepare shape detection float khu = 0.f; @@ -3375,8 +3376,8 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float float amoinscligh = (cli - 1.f) / delhu; float bmoinscligh = 1.f - amoinscligh * huemoins; float realcligh = 1.f; - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); @@ -3385,16 +3386,16 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 //kch to modulate action with chroma - if (deltachro < 160.f * SQR (lp.sens / 100.f)) { // TODOPRECOMPUTE + if (deltachro < 160.f * SQR(lp.sens / 100.f)) { // TODOPRECOMPUTE kch = 1.f; } else { - float ck = 160.f * SQR (lp.sens / 100.f); + float ck = 160.f * SQR(lp.sens / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; - if (lp.sens < 40.f ) { - kch = pow_F (kch, pa * lp.sens + pb); //increase under 40 + if (lp.sens < 40.f) { + kch = pow_F(kch, pa * lp.sens + pb); //increase under 40 } } @@ -3402,7 +3403,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float if (lp.sens < 100.f && lp.qualmet >= 1) { //to try... //hue detection if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good - if (rhue >= hueplus - delhu ) { + if (rhue >= hueplus - delhu) { realcligh = apluscligh * rhue + bpluscligh; khu = apl * rhue + bpl; @@ -3417,7 +3418,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float } - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; @@ -3434,7 +3435,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float } - if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; @@ -3448,7 +3449,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float khu = 1.f; } - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realcligh = apluscligh * rhue + bpluscligh; @@ -3474,7 +3475,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float constexpr float kcr = 10.f; if (rchro < kcr) { - fach *= SQR (rchro) / SQR (kcr); + fach *= SQR(rchro) / SQR(kcr); } } @@ -3482,7 +3483,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float float falL = 1.f; if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow_F (rchro / kcr, lp.iterat / 10.f); + falL *= pow_F(rchro / kcr, lp.iterat / 10.f); } float modu = 1.f ;//realclig / cli; @@ -3494,7 +3495,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float if (!lp.curvact) { modu = 1.f; } else { - modu = CLIP1 (realcligh / cli); + modu = CLIP1(realcligh / cli); } @@ -3542,7 +3543,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float } else { // modu = realcligh / (cli + 0.001f); // printf("mo=%f", modu); - modu = CLIP1 (realcligh / cli); + modu = CLIP1(realcligh / cli); } @@ -3550,7 +3551,7 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float float prov100 = original->L[y][x] / 32768.f; float prov = prov100 * 100.f; - if (prov > localty ) { + if (prov > localty) { if (prov >= localty && prov < 50.f + localty / 2.f) { float core = (lco.alsup2 * prov + lco.blsup2) ; transformed->L[y][x] = 327.68f * (prov + pm * (prov - localty) * core * kch * fach * falL * modu); @@ -3577,80 +3578,294 @@ void ImProcFunctions::Contrast_Local (int call, float ** buflightc, const float } } +void ImProcFunctions::InverseContrast_Local(float ave, struct local_contra & lco, const struct local_params & lp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, LabImage * original, LabImage * transformed, int cx, int cy) -void ImProcFunctions::InverseContrast_Local (float ave, const local_contra & lco, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { // BENCHFUN - float ach = (float)lp.trans / 100.f; + // float ach = (float)lp.trans / 100.f; + const float localtype = lumaref; // always spot area + const float ach = (float)lp.trans / 100.f; + float reducac; - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + /* + #pragma omp parallel for schedule(dynamic,16) if (multiThread) - for (int y = 0; y < transformed->H; y++) { - int loy = cy + y; + for (int y = 0; y < transformed->H; y++) { + int loy = cy + y; - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; + for (int x = 0; x < transformed->W; x++) { + int lox = cx + x; - int zone; - float localFactor; - calcTransition (lox, loy, ach, lp, zone, localFactor); + int zone; + float localFactor; + calcTransition (lox, loy, ach, lp, zone, localFactor); + */ + //constant and variable to prepare shape detection + if (lp.sens < 30.f) { + reducac = 0.2f * (lp.sens / 100.f); + } else { + float areduc = 0.6285714f; //0.44f/0.7f; + float breduc = 0.5f - areduc; + reducac = areduc * (lp.sens / 100.f) + breduc; + } - switch (zone) { - case 0: { // outside selection and outside transition zone => full effect, no transition - if (original->L[y][x] < 32768.f) { - float prov = original->L[y][x]; + const float realcox = lco.dx, realcoy = lco.dy; - if (original->L[y][x] > ave) { - float kh = lco.ah * (original->L[y][x] / 327.68f) + lco.bh; - original->L[y][x] = ave + kh * (original->L[y][x] - ave); - } else { - float kl = lco.al * (original->L[y][x] / 327.68f) + 1.f; - original->L[y][x] = ave - kl * (ave - original->L[y][x]); - } + lco.alsup = (-realcox) / (localtype / 2.f); + lco.blsup = -lco.alsup * localtype; + lco.alsup2 = (realcoy) / (50.f - localtype / 2.f); + lco.blsup2 = -lco.alsup2 * localtype; + lco.alsup3 = (realcoy) / (localtype / 2.f - 50.f); + lco.blsup3 = -lco.alsup3 * 100.f; + lco.aDY = realcoy; - float diflc = original->L[y][x] - prov; - transformed->L[y][x] = prov + diflc; - } else { - transformed->L[y][x] = original->L[y][x]; - } - break; + constexpr float delhu = 0.1f; //between 0.05 and 0.2 + + const float apl = (-1.f) / delhu; + const float bpl = - apl * hueplus; + const float amo = 1.f / delhu; + const float bmo = - amo * huemoins; + + + const float pb = 4.f; + const float pa = (1.f - pb) / 40.f; + + const float ahu = 1.f / (2.8f * lp.sens - 280.f); + const float bhu = 1.f - ahu * 2.8f * lp.sens; + + lco.alinf = realcox / (localtype / 2.f); + const float vi = (localtype / 2.f) / 100.f; + const float vinf = (50.f + localtype / 2.f) / 100.f; + ImProcFunctions::secondeg_begin(reducac, vi, lco.aa, lco.bb); //parabolic + ImProcFunctions::secondeg_end(reducac, vinf, lco.aaa, lco.bbb, lco.ccc); //parabolic + +#ifdef _OPENMP + #pragma omp parallel if (multiThread) +#endif + { + //Todo optimization in this first part with something equivalent to bufcolorig and bufcoltra in colorlight_local +#ifdef __SSE2__ + float atan2Buffer[transformed->W] ALIGNED16; + float sqrtBuffer[transformed->W] ALIGNED16; + vfloat c327d68v = F2V(327.68f); +#endif + +#ifdef _OPENMP + #pragma omp for schedule(dynamic,16) +#endif + + for (int y = 0; y < transformed->H; y++) { + const int loy = cy + y; + +#ifdef __SSE2__ + int i = 0; + + for (; i < transformed->W - 3; i += 4) { + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); + } + + for (; i < transformed->W; i++) { + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; + } + +#endif + + for (int x = 0; x < transformed->W; x++) { + const int lox = cx + x; + + // float rL; + + // rL > 3.2768f to avoid crash with very low gamut in rare cases ex : L=0.01 a=0.5 b=-0.9 + int zone = 0; + + float localFactor = 1.f; + calcTransition(lox, loy, ach, lp, zone, localFactor); + + +#ifdef __SSE2__ + float rhue = atan2Buffer[x]; + float rchro = sqrtBuffer[x]; +#else + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; +#endif + //prepare shape detection + float khu = 0.f; + float kch = 1.f; + float fach = 1.f; + + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); + + if (deltahue > rtengine::RT_PI) { + deltahue = - (deltahue - 2.f * rtengine::RT_PI); } - case 1: { // inside transition zone - if (original->L[y][x] < 32768.f) { - float factorx = localFactor; - factorx = 1.f - factorx; - float prov = original->L[y][x]; + float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 - if (original->L[y][x] > ave) { - float kh = lco.ah * (original->L[y][x] / 327.68f) + lco.bh; - original->L[y][x] = ave + kh * (original->L[y][x] - ave); - } else { - float kl = lco.al * (original->L[y][x] / 327.68f) + 1.f; - original->L[y][x] = ave - kl * (ave - original->L[y][x]); - } + //kch to modulate action with chroma + if (deltachro < 160.f * SQR(lp.sens / 100.f)) { // TODOPRECOMPUTE + kch = 1.f; + } else { + float ck = 160.f * SQR(lp.sens / 100.f); + float ak = 1.f / (ck - 160.f); + float bk = -160.f * ak; + kch = ak * deltachro + bk; - float diflc = original->L[y][x] - prov; - diflc *= factorx; - transformed->L[y][x] = prov + diflc; - - } else { - transformed->L[y][x] = original->L[y][x]; + if (lp.sens < 40.f) { + kch = pow_F(kch, pa * lp.sens + pb); //increase under 40 } - - break; } - case 2: { // inside selection => no effect, keep original values - transformed->L[y][x] = original->L[y][x]; + // algo with detection of hue ==> artifacts for noisy images ==> denoise before + if (lp.sens < 100.f && lp.qualmet >= 1) { //to try... + //hue detection + if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good + if (rhue >= hueplus - delhu) { + + khu = apl * rhue + bpl; + } else if (rhue < huemoins + delhu) { + + khu = amo * rhue + bmo; + } else { + + khu = 1.f; + } + + + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + + khu = apl * rhue + bpl; + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + + khu = amo * rhue + bmo; + } else { + + khu = 1.f; + } + + } + + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + + khu = apl * rhue + bpl; + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + khu = amo * rhue + bmo; + } else { + + khu = 1.f; + } + + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + + khu = apl * rhue + bpl; + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + + khu = amo * rhue + bmo; + } else { + + khu = 1.f; + } + + } + + if (deltaE < 2.8f * lp.sens) { + fach = khu; + } else { + fach = khu * (ahu * deltaE + bhu); + } + + constexpr float kcr = 10.f; + + if (rchro < kcr) { + fach *= SQR(rchro) / SQR(kcr); + } + } + + float kcr = 100.f * lp.thr; + float falL = 1.f; + + if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm + falL *= pow_F(rchro / kcr, lp.iterat / 10.f); + } + + if (lp.sens > 75.f) { + fach = 1.f; + kch = 1.f; + falL = 1.f; + } + + switch (zone) { + case 0: { // + if (original->L[y][x] < 32768.f) { + float prov = original->L[y][x]; + + if (original->L[y][x] > ave) { + float kh = lco.ah * (original->L[y][x] / 327.68f) + lco.bh; + original->L[y][x] = ave + kh * (original->L[y][x] - ave); + } else { + float kl = lco.al * (original->L[y][x] / 327.68f) + 1.f; + original->L[y][x] = ave - kl * (ave - original->L[y][x]); + } + + float diflc = original->L[y][x] - prov; + transformed->L[y][x] = prov + diflc * fach * kch * falL; + } else { + transformed->L[y][x] = original->L[y][x]; + } + + + + break; + } + + case 1: { // inside transition zone + + if (original->L[y][x] < 32768.f) { + float factorx = localFactor; + factorx = 1.f - factorx; + float prov = original->L[y][x]; + + if (original->L[y][x] > ave) { + float kh = lco.ah * (original->L[y][x] / 327.68f) + lco.bh; + original->L[y][x] = ave + kh * (original->L[y][x] - ave); + } else { + float kl = lco.al * (original->L[y][x] / 327.68f) + 1.f; + original->L[y][x] = ave - kl * (ave - original->L[y][x]); + } + + float diflc = original->L[y][x] - prov; + diflc *= factorx; + transformed->L[y][x] = prov + diflc * fach * kch * falL; + + } else { + transformed->L[y][x] = original->L[y][x]; + } + + + + + break; + } + + case 2: { // inside selection => no effect, keep original values + transformed->L[y][x] = original->L[y][x]; + } } } } } } -static void calclight (float lum, float koef, float & lumnew, bool inv) +static void calclight(float lum, float koef, float & lumnew, bool inv) //replace L-curve that does not work in local or bad { @@ -3684,11 +3899,11 @@ static void calclight (float lum, float koef, float & lumnew, bool inv) } - lumnew = CLIPLOC (lumnew); + lumnew = CLIPLOC(lumnew); } -void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::InverseSharp_Local(float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { //local sharp // BENCHFUN @@ -3714,7 +3929,7 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -3726,15 +3941,15 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -3747,18 +3962,18 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif int zone; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); //prepare shape detection float khu = 0.f; float kch = 1.f; float fach = 1.f; - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); @@ -3767,17 +3982,17 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 //kch to modulate action with chroma - if (deltachro < 160.f * SQR (lp.senssha / 100.f)) { + if (deltachro < 160.f * SQR(lp.senssha / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.senssha / 100.f); + float ck = 160.f * SQR(lp.senssha / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (lp.senssha < 40.f ) { - kch = pow (kch, pa * lp.senssha + pb); //increase under 40 + if (lp.senssha < 40.f) { + kch = pow(kch, pa * lp.senssha + pb); //increase under 40 } @@ -3785,7 +4000,7 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, if (lp.senssha < 20.f) { //to try... //hue detection if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good - if (rhue >= hueplus - delhu ) { + if (rhue >= hueplus - delhu) { khu = apl * rhue + bpl; } else if (rhue < huemoins + delhu) { khu = amo * rhue + bmo; @@ -3793,7 +4008,7 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, khu = 1.f; } - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { @@ -3804,7 +4019,7 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, } - if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { if (rhue >= hueplus - delhu && rhue < hueplus) { khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { @@ -3813,7 +4028,7 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, khu = 1.f; } - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { @@ -3886,7 +4101,7 @@ void ImProcFunctions::InverseSharp_Local (float **loctemp, const float hueplus, } -void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::Sharp_Local(int call, float **loctemp, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { BENCHFUN const float ach = (float)lp.trans / 100.f; @@ -3912,7 +4127,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -3937,25 +4152,25 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu if (detectHue) { for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } } else { for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } } @@ -3965,7 +4180,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu int lox = cx + x; int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values transformed->L[y][x] = original->L[y][x]; @@ -3975,24 +4190,24 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu #ifdef __SSE2__ float rchro = sqrtBuffer[x]; #else - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif //prepare shape detection float kch = 1.f; float fach = 1.f; - float deltachro = fabs (rchro - chromaref); + float deltachro = fabs(rchro - chromaref); //kch to modulate action with chroma - if (deltachro < 160.f * SQR (lp.senssha / 100.f)) { + if (deltachro < 160.f * SQR(lp.senssha / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.senssha / 100.f); + float ck = 160.f * SQR(lp.senssha / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; - if (lp.senssha < 40.f ) { - kch = pow_F (kch, pa * lp.senssha + pb); //increase under 40 + if (lp.senssha < 40.f) { + kch = pow_F(kch, pa * lp.senssha + pb); //increase under 40 } } @@ -4005,10 +4220,10 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu #ifdef __SSE2__ float rhue = atan2Buffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); + float rhue = xatan2f(original->b[y][x], original->a[y][x]); #endif float khu = 0.f; - float deltahue = fabs (rhue - hueref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); @@ -4016,7 +4231,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu //hue detection if ((hueref + dhue) < rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { //transition are good - if (rhue >= hueplus - delhu ) { + if (rhue >= hueplus - delhu) { khu = apl * rhue + bpl; } else if (rhue < huemoins + delhu) { khu = amo * rhue + bmo; @@ -4025,7 +4240,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu } - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { @@ -4036,7 +4251,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu } - if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins ) { + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { if (rhue >= hueplus - delhu && rhue < hueplus) { khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { @@ -4045,7 +4260,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu khu = 1.f; } - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { khu = apl * rhue + bpl; } else if (rhue >= huemoins && rhue < huemoins + delhu) { @@ -4114,7 +4329,7 @@ void ImProcFunctions::Sharp_Local (int call, float **loctemp, const float hueplu -void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, LabImage * rsv, int cx, int cy) +void ImProcFunctions::Exclude_Local(int sen, float **deltaso, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, LabImage * rsv, int cx, int cy) { //local exposure @@ -4174,7 +4389,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -4199,15 +4414,15 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -4219,7 +4434,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values transformed->L[y][x] = original->L[y][x]; @@ -4230,8 +4445,8 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif float rL = original->L[y][x] / 327.68f; @@ -4261,32 +4476,32 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, float realstr = 1.f; float realstrch = 1.f; //prepare shape detection - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); } float deltaE = 20.f * deltahue + deltachro; //between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 float kch = 1.f; float khu = 0.f; float fach = 1.f; float falu = 1.f; - if (deltachro < 160.f * SQR (varsens / 100.f)) { + if (deltachro < 160.f * SQR(varsens / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (varsens / 100.f); + float ck = 160.f * SQR(varsens / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (varsens < 40.f ) { - kch = pow (kch, pa * varsens + pb); //increase under 40 + if (varsens < 40.f) { + kch = pow(kch, pa * varsens + pb); //increase under 40 } bool kzon = false; @@ -4312,7 +4527,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, } kzon = true; - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -4352,7 +4567,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, } kzon = true; - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -4417,7 +4632,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, if (varsens < 60.f) { //arbitrary value if (hueref < -1.1f && hueref > -2.8f) { // detect blue sky if (chromaref > 0.f && chromaref < 35.f * multchro) { // detect blue sky - if ( (rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { + if ((rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { realstr *= 0.9f; } else { realstr = 1.f; @@ -4430,7 +4645,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, if (varsens < 50.f) { //&& lp.chro > 0.f if (hueref > -0.1f && hueref < 1.6f) { // detect skin if (chromaref > 0.f && chromaref < 55.f * multchroskin) { // detect skin - if ( (rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { + if ((rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { realstr *= 0.7f; } else { realstr = 1.f; @@ -4448,7 +4663,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, float falL = 1.f; if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow (rchro / kcr, lp.iterat / 10.f); + falL *= pow(rchro / kcr, lp.iterat / 10.f); } // int zone; @@ -4492,8 +4707,8 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, transformed->a[y][x] = original->a[y][x]; //rsv->a[loy - begy][lox - begx]; transformed->b[y][x] = original->b[y][x]; //rsv->b[loy - begy][lox - begx]; } else { - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } break; @@ -4530,8 +4745,8 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, transformed->b[y][x] = original->b[y][x]; //rsv->b[loy - begy][lox - begx]; } else { // printf ("1"); - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } } @@ -4550,7 +4765,7 @@ void ImProcFunctions::Exclude_Local (int sen, float **deltaso, float **buflight, -void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy) +void ImProcFunctions::Expose_Local(int sen, float **buflight, float **bufchro, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy) { //local exposure @@ -4610,7 +4825,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -4635,15 +4850,15 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -4655,7 +4870,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { // outside selection and outside transition zone => no effect, keep original values transformed->L[y][x] = original->L[y][x]; @@ -4666,8 +4881,8 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, float rhue = atan2Buffer[x]; float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif float rL = original->L[y][x] / 327.68f; @@ -4697,32 +4912,32 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, float realstr = 1.f; float realstrch = 1.f; //prepare shape detection - float deltachro = fabs (rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltachro = fabs(rchro - chromaref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); } float deltaE = 20.f * deltahue + deltachro; //between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 float kch = 1.f; float khu = 0.f; float fach = 1.f; float falu = 1.f; - if (deltachro < 160.f * SQR (varsens / 100.f)) { + if (deltachro < 160.f * SQR(varsens / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (varsens / 100.f); + float ck = 160.f * SQR(varsens / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (varsens < 40.f ) { - kch = pow (kch, pa * varsens + pb); //increase under 40 + if (varsens < 40.f) { + kch = pow(kch, pa * varsens + pb); //increase under 40 } bool kzon = false; @@ -4748,7 +4963,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, } kzon = true; - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -4788,7 +5003,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, } kzon = true; - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realstr = aplus * rhue + bplus; realstrch = aplusch * rhue + bplusch; @@ -4853,7 +5068,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, if (varsens < 60.f) { //arbitrary value if (hueref < -1.1f && hueref > -2.8f) { // detect blue sky if (chromaref > 0.f && chromaref < 35.f * multchro) { // detect blue sky - if ( (rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { + if ((rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { realstr *= 0.9f; } else { realstr = 1.f; @@ -4866,7 +5081,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, if (varsens < 50.f) { //&& lp.chro > 0.f if (hueref > -0.1f && hueref < 1.6f) { // detect skin if (chromaref > 0.f && chromaref < 55.f * multchroskin) { // detect skin - if ( (rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { + if ((rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { realstr *= 0.7f; } else { realstr = 1.f; @@ -4884,7 +5099,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, float falL = 1.f; if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow (rchro / kcr, lp.iterat / 10.f); + falL *= pow(rchro / kcr, lp.iterat / 10.f); } // int zone; @@ -4918,8 +5133,8 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, difb *= factorx * (100.f + realstrch * falu * falL) / 100.f; difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); break; @@ -4942,8 +5157,8 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, difa *= kch * fach; difb *= kch * fach; - transformed->a[y][x] = CLIPC (original->a[y][x] + difa); - transformed->b[y][x] = CLIPC (original->b[y][x] + difb); + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } } @@ -4960,7 +5175,7 @@ void ImProcFunctions::Expose_Local (int sen, float **buflight, float **bufchro, } -void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float ** buflight, float ** bufchro, float ** bufchroslid, float ** bufhh, float ** buflightslid, bool &LHutili, bool &HHutili, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::ColorLight_Local(int call, LabImage * bufcolorig, float ** buflight, float ** bufchro, float ** bufchroslid, float ** bufhh, float ** buflightslid, bool &LHutili, bool &HHutili, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) { BENCHFUN // chroma and lightness @@ -4985,7 +5200,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * const float multchroskin = lp.sens * achsensskin + bchsensskin; //transition = difficult to avoid artifact with scope on flat area (sky...) - constexpr float delhu = 0.1f; //between 0.05 and 0.2 ==> minima for scope + constexpr float delhu = 0.05f; //between 0.05 and 0.2 ==> minima for scope constexpr float delhuhr = 0.1f; // same //constexpr float delhu2 = 0.03f; //between 0.05 and 0.2 @@ -5026,16 +5241,16 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * float vinf = (lumaref + modlum) / 100.f; float vi = (lumaref - modlum) / 100.f; - ImProcFunctions::secondeg_begin (reducac, vi, aa, bb);//parabolic - ImProcFunctions::secondeg_end (reducac, vinf, aaa, bbb, ccc);//parabolic + ImProcFunctions::secondeg_begin(reducac, vi, aa, bb); //parabolic + ImProcFunctions::secondeg_end(reducac, vinf, aaa, bbb, ccc); //parabolic float vinf2 = (lumaref + modlum) / 100.f; float vi2 = (lumaref - modlum) / 100.f; float aaaa, bbbb, cccc, aO, bO; - ImProcFunctions::secondeg_end (reducac2, vinf2, aaaa, bbbb, cccc);//parabolic - ImProcFunctions::secondeg_begin (reducac2, vi2, aO, bO);//parabolic + ImProcFunctions::secondeg_end(reducac2, vinf2, aaaa, bbbb, cccc); //parabolic + ImProcFunctions::secondeg_begin(reducac2, vi2, aO, bO); //parabolic - float hueplushr = Color::huelab_to_huehsv2 (hueplus); - float huemoinshr = Color::huelab_to_huehsv2 (huemoins); + float hueplushr = Color::huelab_to_huehsv2(hueplus); + float huemoinshr = Color::huelab_to_huehsv2(huemoins); if (call <= 3) { //Todo optimization in this first part with bufcolorig and bufcoltra @@ -5047,7 +5262,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * #ifdef __SSE2__ float atan2Buffer[transformed->W] ALIGNED16; float sqrtBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); + vfloat c327d68v = F2V(327.68f); #endif #ifdef _OPENMP @@ -5067,15 +5282,15 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (original->a[y][i]); - vfloat bv = LVFU (original->b[y][i]); - STVF (atan2Buffer[i], xatan2f (bv, av)); - STVF (sqrtBuffer[i], _mm_sqrt_ps (SQRV (bv) + SQRV (av)) / c327d68v); + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); } for (; i < transformed->W; i++) { - atan2Buffer[i] = xatan2f (original->b[y][i], original->a[y][i]); - sqrtBuffer[i] = sqrt (SQR (original->b[y][i]) + SQR (original->a[y][i])) / 327.68f; + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; } #endif @@ -5089,7 +5304,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * int zone = 0; float localFactor = 1.f; - calcTransition (lox, loy, ach, lp, zone, localFactor); + calcTransition(lox, loy, ach, lp, zone, localFactor); if (zone == 0) { continue; @@ -5101,16 +5316,16 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * float rchro = sqrtBuffer[x]; #else - float rhue = xatan2f (original->b[y][x], original->a[y][x]); + float rhue = xatan2f(original->b[y][x], original->a[y][x]); - float rchro = sqrt (SQR (original->b[y][x]) + SQR (original->a[y][x])) / 327.68f; + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; #endif - float rhuehr = Color::huelab_to_huehsv2 (rhue); + float rhuehr = Color::huelab_to_huehsv2(rhue); float rL = original->L[y][x] / 327.68f; float rLL = original->L[y][x] / 327.68f; - if (fabs (original->b[y][x]) < 0.01f) { + if (fabs(original->b[y][x]) < 0.01f) { original->b[y][x] = 0.01f; } @@ -5169,9 +5384,9 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * float realclighsl = 1.f; float realhh = 0.f; //evaluate delta Hue and delta Chro - float deltachro = fabs (rchro - chromaref); + float deltachro = fabs(rchro - chromaref); - float deltahue = fabs (rhue - hueref); + float deltahue = fabs(rhue - hueref); if (deltahue > rtengine::RT_PI) { deltahue = - (deltahue - 2.f * rtengine::RT_PI); @@ -5179,7 +5394,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * //pseudo deltaE float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 - float deltaL = fabs (lumaref - rL); //between 0 and 100 + float deltaL = fabs(lumaref - rL); //between 0 and 100 float kch = 1.f; float khu = 0.f; @@ -5187,17 +5402,17 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * float falu = 1.f; //kch acts on luma - if (deltachro < 160.f * SQR (lp.sens / 100.f)) { + if (deltachro < 160.f * SQR(lp.sens / 100.f)) { kch = 1.f; } else { - float ck = 160.f * SQR (lp.sens / 100.f); + float ck = 160.f * SQR(lp.sens / 100.f); float ak = 1.f / (ck - 160.f); float bk = -160.f * ak; kch = ak * deltachro + bk; } - if (lp.sens < 40.f ) { - kch = pow (kch, pa * lp.sens + pb); //increase under 40 + if (lp.sens < 40.f) { + kch = pow(kch, pa * lp.sens + pb); //increase under 40 } bool kzon = false; @@ -5238,7 +5453,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * } kzon = true; - } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref + dhue) >= rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realchro = aplus * rhue + bplus; realchroslid = apluschroslid * rhue + bpluschroslid; @@ -5306,7 +5521,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * } kzon = true; - } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus )) { + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { if (rhue >= hueplus - delhu && rhue < hueplus) { realchro = aplus * rhue + bplus; realchroslid = apluschroslid * rhue + bpluschroslid; @@ -5378,7 +5593,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * if (lp.sens < 60.f) { //arbitrary value if (hueref < -1.1f && hueref > -2.8f) { // detect blue sky if (chromaref > 0.f && chromaref < 35.f * multchro) { // detect blue sky - if ( (rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { + if ((rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { realchro *= 0.9f; realcurv *= 0.9f; realchroslid *= 0.9f; @@ -5399,7 +5614,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * if (lp.sens < 50.f && lp.chro > 0.f) { if (hueref > -0.1f && hueref < 1.6f) { // detect skin if (chromaref > 0.f && chromaref < 55.f * multchroskin) { // detect skin - if ( (rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { + if ((rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { realchro *= 0.9f; realcurv *= 0.9f; realchroslid *= 0.9f; @@ -5430,7 +5645,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * if (kzon) { ///rhue < hueplus && rhue > huemoins - if ( (rLL > (lumaref - modlum) && rLL < (lumaref + modlum))) { + if ((rLL > (lumaref - modlum) && rLL < (lumaref + modlum))) { kdiff = 1.f; } else if (rLL > 0.f && rLL <= (lumaref - modlum)) { kdiff = (aa * kLinf * kLinf + bb * kLinf); //parabolic @@ -5452,7 +5667,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * } else { float ktes = 1.f; - if ( (rLL > (lumaref - modlum) && rLL < (lumaref + modlum))) { + if ((rLL > (lumaref - modlum) && rLL < (lumaref + modlum))) { kdiff = ktes; } else if (rLL > 0.f && rLL <= (lumaref - modlum)) { @@ -5478,7 +5693,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * float falL = 1.f; if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm - falL *= pow (rchro / kcr, lp.iterat / 10.f); + falL *= pow(rchro / kcr, lp.iterat / 10.f); } @@ -5520,12 +5735,12 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * { float khu = 1.9f; //in reserve in case of! - float valparam = float ((loclhCurve[500.f * Color::huelab_to_huehsv2 (rhue)] - 0.5f)); //get l_r=f(H) + float valparam = float ((loclhCurve[500.f * Color::huelab_to_huehsv2(rhue)] - 0.5f)); //get l_r=f(H) float valparamneg; valparamneg = valparam; if (valparam > 0.f) { - l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR (((SQR (1.f - min (l_r, 1.0f)))))); + l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR(((SQR(1.f - min(l_r, 1.0f)))))); } else //for negative { @@ -5539,7 +5754,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * } if (lp.ligh != 0.f && lp.curvact == false) { - calclight (lumnew, lp.ligh, lumnew, true); //replace L-curve + calclight(lumnew, lp.ligh, lumnew, true); //replace L-curve lightcont = lumnew; } else { @@ -5553,16 +5768,16 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * // float flichrosl = 1.f; if (lp.curvact && lp.ligh != 0.f) { - flisl = ((100.f + realclighsl * falL ) / 100.f);//luma transition + flisl = ((100.f + realclighsl * falL) / 100.f); //luma transition } if (lp.curvact && lp.chro != 0.f) { - realchro = ((100.f + realchroslid) / 100.f);//chroma transition + realchro = realchroslid;//chroma transition //realchro = 1.f; } if (lp.qualcurvemet == 2) { - fli = ((100.f + realcligh * falL ) / 100.f);//luma transition + fli = ((100.f + realcligh * falL) / 100.f); //luma transition } float flicur = 1.f; @@ -5571,22 +5786,22 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * flicur = ((100.f + realcurv * factorx * falu * falL) / 100.f); } - float fac = flicur * (100.f + factorx * realchro * falu * falL) / 100.f; //chroma factor transition + float fac = flicur * (100.f + factorx * realchro * falu * falL) / 100.f; //chroma factor transition //if(fac < 0.2f) fac = 0.2f; float diflc = lightcont * fli * flisl - original->L[y][x]; kdiff *= fach * kch; diflc *= kdiff ; diflc *= factorx; //transition lightness - transformed->L[y][x] = CLIPL (1.f * (original->L[y][x] + diflc)); + transformed->L[y][x] = CLIPL(1.f * (original->L[y][x] + diflc)); if (lochhCurve && lp.qualcurvemet >= 1 && HHutili) { float addh = 0.f; - float chromhr = sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); + float chromhr = sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])); if (lp.qualcurvemet == 1) { - float valparam = float ((lochhCurve[500.f * Color::huelab_to_huehsv2 (rhue)] - 0.5f)); //get H=f(H) 1.7 optimisation ! + float valparam = float ((lochhCurve[500.f * Color::huelab_to_huehsv2(rhue)] - 0.5f)); //get H=f(H) 1.7 optimisation ! // float hh = 0.5 * ((rhue / rtengine::RT_PI) + 1.); // float valparam = float ((lochhCurve[500.f * hh] - 0.5f)); //get H=f(H) 1.7 optimisation ! ddhue = 2 * valparam; @@ -5604,18 +5819,18 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * if (newhr > rtengine::RT_PI) { newhr -= 2 * rtengine::RT_PI; - } else if ( newhr < -rtengine::RT_PI) { + } else if (newhr < -rtengine::RT_PI) { newhr += 2 * rtengine::RT_PI; } - sincosval = xsincosf (newhr); - transformed->a[y][x] = CLIPC (chromhr * sincosval.y * fac) ; - transformed->b[y][x] = CLIPC (chromhr * sincosval.x * fac); + sincosval = xsincosf(newhr); + transformed->a[y][x] = CLIPC(chromhr * sincosval.y * fac) ; + transformed->b[y][x] = CLIPC(chromhr * sincosval.x * fac); } else { - transformed->a[y][x] = CLIPC (original->a[y][x] * fac) ; - transformed->b[y][x] = CLIPC (original->b[y][x] * fac); + transformed->a[y][x] = CLIPC(original->a[y][x] * fac) ; + transformed->b[y][x] = CLIPC(original->b[y][x] * fac); } break; @@ -5639,12 +5854,12 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * { float khu = 1.9f; - float valparam = float ((loclhCurve[500.f * Color::huelab_to_huehsv2 (rhue)] - 0.5f)); //get l_r=f(H) + float valparam = float ((loclhCurve[500.f * Color::huelab_to_huehsv2(rhue)] - 0.5f)); //get l_r=f(H) float valparamneg; valparamneg = valparam; if (valparam > 0.f) { - l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR (((SQR (1.f - min (l_r, 1.0f)))))); + l_r = (1.f - valparam) * l_r + valparam * (1.f - SQR(((SQR(1.f - min(l_r, 1.0f)))))); } else //for negative { @@ -5659,7 +5874,7 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * if (lp.ligh != 0.f && lp.curvact == false) { - calclight (lumnew, lp.ligh, lumnew, true); //replace L-curve + calclight(lumnew, lp.ligh, lumnew, true); //replace L-curve lightcont = lumnew; } else { @@ -5670,11 +5885,11 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * float flisl = 1.f; if (lp.curvact && lp.ligh != 0.f) { - flisl = ((100.f + realclighsl * falL ) / 100.f);//luma transition + flisl = ((100.f + realclighsl * falL) / 100.f); //luma transition } if (lp.curvact && lp.chro != 0.f) { - realchro = ((100.f + realchroslid) / 100.f);//chroma transition + realchro = realchroslid;//chroma transition //realchro = 1.f; } @@ -5695,16 +5910,16 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * kdiff *= fach * kch; diflc *= kdiff ; - transformed->L[y][x] = CLIPL (1.f * (original->L[y][x] + diflc)); + transformed->L[y][x] = CLIPL(1.f * (original->L[y][x] + diflc)); // float newchro = sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); if (lochhCurve && lp.qualcurvemet >= 1 && HHutili) { float addh = 0.f; - float chromhr = sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); + float chromhr = sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])); if (lp.qualcurvemet == 1) { - float valparam = float ((lochhCurve[500.f * Color::huelab_to_huehsv2 (rhue)] - 0.5f)); //get H=f(H) 1.7 optimisation ! + float valparam = float ((lochhCurve[500.f * Color::huelab_to_huehsv2(rhue)] - 0.5f)); //get H=f(H) 1.7 optimisation ! //float hh = 0.5 * ((rhue / rtengine::RT_PI) + 1.); //float valparam = float ((lochhCurve[500.f * hh] - 0.5f)); //get H=f(H) 1.7 optimisation ! @@ -5722,19 +5937,19 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * if (newhr > rtengine::RT_PI) { newhr -= 2 * rtengine::RT_PI; - } else if ( newhr < -rtengine::RT_PI) { + } else if (newhr < -rtengine::RT_PI) { newhr += 2 * rtengine::RT_PI; } - sincosval = xsincosf (newhr); - transformed->a[y][x] = CLIPC (chromhr * sincosval.y * fac) ; - transformed->b[y][x] = CLIPC (chromhr * sincosval.x * fac); + sincosval = xsincosf(newhr); + transformed->a[y][x] = CLIPC(chromhr * sincosval.y * fac) ; + transformed->b[y][x] = CLIPC(chromhr * sincosval.x * fac); } else { - transformed->a[y][x] = CLIPC (original->a[y][x] * fac) ; - transformed->b[y][x] = CLIPC (original->b[y][x] * fac); + transformed->a[y][x] = CLIPC(original->a[y][x] * fac) ; + transformed->b[y][x] = CLIPC(original->b[y][x] * fac); } @@ -5753,78 +5968,482 @@ void ImProcFunctions::ColorLight_Local (int call, LabImage * bufcolorig, float * } -void ImProcFunctions::InverseColorLight_Local (const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy) +void ImProcFunctions::InverseColorLight_Local(const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, const float hueplus, const float huemoins, const float hueref, const float dhue, const float chromaref, const float lumaref) { // BENCHFUN float ach = (float)lp.trans / 100.f; const float facc = (100.f + lp.chro) / 100.f; //chroma factor transition - #pragma omp parallel for schedule(dynamic,16) if (multiThread) + //chroma + constexpr float amplchsens = 2.5f; + constexpr float achsens = (amplchsens - 1.f) / (100.f - 20.f); //20. default locallab.sensi + constexpr float bchsens = 1.f - 20.f * achsens; + const float multchro = lp.sens * achsens + bchsens; - for (int y = 0; y < transformed->H; y++) { - int loy = cy + y; + //luma + constexpr float ampllumsens = 2.f; + constexpr float alumsens = (ampllumsens - 1.f) / (100.f - 20.f); //20. default locallab.sensi + constexpr float blumsens = 1.f - 20.f * alumsens; + const float multlum = lp.sens * alumsens + blumsens; - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; + //skin + constexpr float amplchsensskin = 1.6f; + constexpr float achsensskin = (amplchsensskin - 1.f) / (100.f - 20.f); //20. default locallab.sensi + constexpr float bchsensskin = 1.f - 20.f * achsensskin; + const float multchroskin = lp.sens * achsensskin + bchsensskin; - int zone; - float localFactor; - calcTransition (lox, loy, ach, lp, zone, localFactor); + //transition = difficult to avoid artifact with scope on flat area (sky...) + constexpr float delhu = 0.05f; //between 0.05 and 0.2 ==> minima for scope - switch (zone) { - case 0: { // outside selection and outside transition zone => no effect, keep original values - float lumnew = original->L[y][x]; + const float aplus = (1.f - lp.chro) / delhu; + const float bplus = 1.f - aplus * hueplus; + const float amoins = (lp.chro - 1.f) / delhu; + const float bmoins = 1.f - amoins * huemoins; - if (lp.ligh != 0.f) { - calclight (original->L[y][x], lp.ligh, lumnew, false); + const float apl = (-1.f) / delhu; + const float bpl = - apl * hueplus; + const float amo = 1.f / delhu; + const float bmo = - amo * huemoins; + + const float pb = 4.f; + const float pa = (1.f - pb) / 40.f; + + const float ahu = 1.f / (2.8f * lp.sens - 280.f); + const float bhu = 1.f - ahu * 2.8f * lp.sens; + + //luma + constexpr float lumdelta = 11.f; //11 + float modlum = lumdelta * multlum; + + // constant and variables to prepare shape detection + if (lumaref + modlum >= 100.f) { + modlum = (100.f - lumaref) / 2.f; + } + + if (lumaref - modlum <= 0.f) { + modlum = (lumaref) / 2.f; + } + + float aa, bb, aaa, bbb, ccc; + float reducac = settings->reduchigh;//0.85f; + float reducac2 = settings->reduclow;//0.2f; + + float vinf = (lumaref + modlum) / 100.f; + float vi = (lumaref - modlum) / 100.f; + ImProcFunctions::secondeg_begin(reducac, vi, aa, bb); //parabolic + ImProcFunctions::secondeg_end(reducac, vinf, aaa, bbb, ccc); //parabolic + float vinf2 = (lumaref + modlum) / 100.f; + float vi2 = (lumaref - modlum) / 100.f; + float aaaa, bbbb, cccc, aO, bO; + ImProcFunctions::secondeg_end(reducac2, vinf2, aaaa, bbbb, cccc); //parabolic + ImProcFunctions::secondeg_begin(reducac2, vi2, aO, bO); //parabolic + + +#ifdef _OPENMP + #pragma omp parallel if (multiThread) +#endif + { +#ifdef __SSE2__ + float atan2Buffer[transformed->W] ALIGNED16; + float sqrtBuffer[transformed->W] ALIGNED16; + vfloat c327d68v = F2V(327.68f); +#endif + +#ifdef _OPENMP + #pragma omp for schedule(dynamic,16) +#endif + + for (int y = 0; y < transformed->H; y++) { + const int loy = cy + y; + +#ifdef __SSE2__ + int i = 0; + + for (; i < transformed->W - 3; i += 4) { + vfloat av = LVFU(original->a[y][i]); + vfloat bv = LVFU(original->b[y][i]); + STVF(atan2Buffer[i], xatan2f(bv, av)); + STVF(sqrtBuffer[i], _mm_sqrt_ps(SQRV(bv) + SQRV(av)) / c327d68v); + } + + for (; i < transformed->W; i++) { + atan2Buffer[i] = xatan2f(original->b[y][i], original->a[y][i]); + sqrtBuffer[i] = sqrt(SQR(original->b[y][i]) + SQR(original->a[y][i])) / 327.68f; + } + +#endif + + + for (int x = 0; x < transformed->W; x++) { + const int lox = cx + x; + int zone = 0; + + float localFactor = 1.f; + calcTransition(lox, loy, ach, lp, zone, localFactor); + + +#ifdef __SSE2__ + float rhue = atan2Buffer[x]; + float rchro = sqrtBuffer[x]; +#else + + float rhue = xatan2f(original->b[y][x], original->a[y][x]); + + float rchro = sqrt(SQR(original->b[y][x]) + SQR(original->a[y][x])) / 327.68f; +#endif + + float rL = original->L[y][x] / 327.68f; + float rLL = original->L[y][x] / 327.68f; + + if (fabs(original->b[y][x]) < 0.01f) { + original->b[y][x] = 0.01f; + } + + + float realchro = 1.f; + //evaluate delta Hue and delta Chro + float deltachro = fabs(rchro - chromaref); + + float deltahue = fabs(rhue - hueref); + + if (deltahue > rtengine::RT_PI) { + deltahue = - (deltahue - 2.f * rtengine::RT_PI); + } + + //pseudo deltaE + float deltaE = 20.f * deltahue + deltachro; //pseudo deltaE between 0 and 280 + float deltaL = fabs(lumaref - rL); //between 0 and 100 + + float kch = 1.f; + float khu = 0.f; + float fach = 1.f; + float falu = 1.f; + + //kch acts on luma + if (deltachro < 160.f * SQR(lp.sens / 100.f)) { + kch = 1.f; + } else { + float ck = 160.f * SQR(lp.sens / 100.f); + float ak = 1.f / (ck - 160.f); + float bk = -160.f * ak; + kch = ak * deltachro + bk; + } + + if (lp.sens < 40.f) { + kch = pow(kch, pa * lp.sens + pb); //increase under 40 + } + + bool kzon = false; + + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + realchro = aplus * rhue + bplus; + khu = apl * rhue + bpl; + + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + realchro = amoins * rhue + bmoins; + khu = amo * rhue + bmo; + + } else { + realchro = lp.chro; + khu = 1.f; } - float lightcont = lumnew ; //original->L[y][x] + (lp.ligh /100.f)*original->L[y][x] ; //apply lightness + kzon = true; + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + realchro = aplus * rhue + bplus; + khu = apl * rhue + bpl; + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + realchro = amoins * rhue + bmoins; + khu = amo * rhue + bmo; - - transformed->L[y][x] = lightcont; //localcurve[original->L[y][x]]; //apply lightness - transformed->a[y][x] = original->a[y][x] * facc; - transformed->b[y][x] = original->b[y][x] * facc; - break; - } - - case 1: { // inside transition zone - float factorx = 1.f - localFactor; - float fac = (100.f + factorx * lp.chro) / 100.f; //chroma factor transition - float lumnew = original->L[y][x]; - - if (lp.ligh != 0.f) { - calclight (original->L[y][x], lp.ligh, lumnew, false); + } else { + realchro = lp.chro; + khu = 1.f; } - float lightcont = lumnew ; //apply lightness - - float diflc = lightcont - original->L[y][x]; - diflc *= factorx; - transformed->L[y][x] = original->L[y][x] + diflc; - transformed->a[y][x] = original->a[y][x] * fac; - transformed->b[y][x] = original->b[y][x] * fac; - break; + kzon = true; } - case 2: { // inside selection => no effect, keep original values - transformed->L[y][x] = original->L[y][x]; - transformed->a[y][x] = original->a[y][x]; - transformed->b[y][x] = original->b[y][x]; + if ((hueref - dhue) > -rtengine::RT_PI && rhue < hueplus && rhue > huemoins) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + realchro = aplus * rhue + bplus; + khu = apl * rhue + bpl; + + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + realchro = amoins * rhue + bmoins; + khu = amo * rhue + bmo; + + } else { + realchro = lp.chro; + khu = 1.f; + } + + kzon = true; + } else if ((hueref - dhue) <= -rtengine::RT_PI && (rhue > huemoins || rhue < hueplus)) { + if (rhue >= hueplus - delhu && rhue < hueplus) { + realchro = aplus * rhue + bplus; + khu = apl * rhue + bpl; + + } else if (rhue >= huemoins && rhue < huemoins + delhu) { + realchro = amoins * rhue + bmoins; + khu = amo * rhue + bmo; + + } else { + realchro = lp.chro; + khu = 1.f; + } + + kzon = true; } + + if (lp.sens <= 20.f) { //to try... + //fach and kch acts on luma + if (deltaE < 2.8f * lp.sens) { + fach = khu; + } else { + fach = khu * (ahu * deltaE + bhu); + } + + float kcr = 10.f; + + if (rchro < kcr) { + fach *= (1.f / (kcr * kcr)) * rchro * rchro; + } + + //fach = 1.f;//to avoid artifacts in some cases + //can be probably improved + if (lp.qualmet >= 1) { + } else { + fach = 1.f; + } + + //falu acts on chroma + if (deltaL < lp.sens) { + falu = 1.f; + } else { + falu = 1.f;// alum * deltaL + blum; + } + + } + + if (kzon) { + if (lp.sens < 60.f) { //arbitrary value + if (hueref < -1.1f && hueref > -2.8f) { // detect blue sky + if (chromaref > 0.f && chromaref < 35.f * multchro) { // detect blue sky + if ((rhue > -2.79f && rhue < -1.11f) && (rchro < 35.f * multchro)) { + realchro *= 0.9f; + } else { + realchro = 1.f; + + } + } + } else { + realchro = lp.chro; + + } + + if (lp.sens < 50.f && lp.chro > 0.f) { + if (hueref > -0.1f && hueref < 1.6f) { // detect skin + if (chromaref > 0.f && chromaref < 55.f * multchroskin) { // detect skin + if ((rhue > -0.09f && rhue < 1.59f) && (rchro < 55.f * multchroskin)) { + realchro *= 0.9f; + + } else { + realchro = 1.f; + + } + } + } else { + realchro = lp.chro; + + } + } + } + + } + + float kLinf = rLL / (100.f); + float kLsup = kLinf; + + float kdiff = 1.f; + + if (kzon) { ///rhue < hueplus && rhue > huemoins + + if ((rLL > (lumaref - modlum) && rLL < (lumaref + modlum))) { + kdiff = 1.f; + } else if (rLL > 0.f && rLL <= (lumaref - modlum)) { + kdiff = (aa * kLinf * kLinf + bb * kLinf); //parabolic + + if (kdiff < 0.01f) { + kdiff = 0.01f; + } + } else if (rLL <= 100.f && rLL >= (lumaref + modlum)) { + + kdiff = (aaa * kLsup * kLsup + bbb * kLsup + ccc); //parabolic + + if (kdiff < 0.01f) { + kdiff = 0.01f; + } + + } + + //end luma + } else { + float ktes = 1.f; + + if ((rLL > (lumaref - modlum) && rLL < (lumaref + modlum))) { + kdiff = ktes; + } else if (rLL > 0.f && rLL <= (lumaref - modlum)) { + + kdiff = (ktes * (aO * kLinf * kLinf + bO * kLinf)); //parabolic + + if (kdiff < 0.01f) { + kdiff = 0.01f; + } + + } else if (rLL <= 100.f && rLL >= (lumaref + modlum)) { + + kdiff = (ktes * (aaaa * kLsup * kLsup + bbbb * kLsup + cccc)); //parabolic + + if (kdiff < 0.01f) { + kdiff = 0.01f; + } + + } + + } + + float kcr = 100.f * lp.thr; + float falL = 1.f; + + if (rchro < kcr && chromaref > kcr) { // reduce artifacts in grey tones near hue spot and improve algorithm + falL *= pow(rchro / kcr, lp.iterat / 10.f); + } + + + float th_r = 0.01f; + + if (rL > th_r) { //to avoid crash with very low gamut in rare cases ex : L=0.01 a=0.5 b=-0.9 + + switch (zone) { + case 2: { // outside selection and outside transition zone => no effect, keep original values + transformed->L[y][x] = original->L[y][x]; + transformed->a[y][x] = original->a[y][x]; + transformed->b[y][x] = original->b[y][x]; + break; + } + + case 1: { // inside transition zone + float lumnew = original->L[y][x]; + + if (lp.sens < 75.f) { + float lightcont; + + if (lp.ligh != 0.f) { + calclight(lumnew, lp.ligh, lumnew, true); //replace L-curve + lightcont = lumnew; + + } else { + lightcont = lumnew; + } + + float factorx = 1.f - localFactor; + float fli = 1.f; + float flisl = 1.f; + float flicur = 1.f; + float fac = flicur * (100.f + factorx * realchro * falu * falL) / 100.f; //chroma factor transition + float diflc = lightcont * fli * flisl - original->L[y][x]; + kdiff *= fach * kch; + diflc *= kdiff ; + + diflc *= factorx; //transition lightness + transformed->L[y][x] = CLIPL(1.f * (original->L[y][x] + diflc)); + + transformed->a[y][x] = CLIPC(original->a[y][x] * fac) ; + transformed->b[y][x] = CLIPC(original->b[y][x] * fac); + } else { + float factorx = 1.f - localFactor; + float fac = (100.f + factorx * lp.chro) / 100.f; //chroma factor transition + float lumnew = original->L[y][x]; + + if (lp.ligh != 0.f) { + calclight(original->L[y][x], lp.ligh, lumnew, false); + } + + float lightcont = lumnew ; //apply lightness + + float diflc = lightcont - original->L[y][x]; + diflc *= factorx; + transformed->L[y][x] = original->L[y][x] + diflc; + transformed->a[y][x] = original->a[y][x] * fac; + transformed->b[y][x] = original->b[y][x] * fac; + + + } + + break; + } + + case 0: { // inside selection => full effect, no transition + float lumnew = original->L[y][x]; + + if (lp.sens < 75.f) { + + float lightcont; + + if (lp.ligh != 0.f) { + calclight(lumnew, lp.ligh, lumnew, true); //replace L-curve + lightcont = lumnew; + + } else { + lightcont = lumnew; + } + + float fli = 1.f; + float flisl = 1.f; + float flicur = 1.f; + float fac = flicur * (100.f + realchro * falu * falL) / 100.f; //chroma factor transition7 + + float diflc = lightcont * fli * flisl - original->L[y][x]; + + kdiff *= fach * kch; + diflc *= kdiff ; + transformed->L[y][x] = CLIPL(1.f * (original->L[y][x] + diflc)); + + transformed->a[y][x] = CLIPC(original->a[y][x] * fac) ; + transformed->b[y][x] = CLIPC(original->b[y][x] * fac); + + + } else { + if (lp.ligh != 0.f) { + calclight(original->L[y][x], lp.ligh, lumnew, false); + } + + float lightcont = lumnew ; + transformed->L[y][x] = lightcont; + transformed->a[y][x] = original->a[y][x] * facc; + transformed->b[y][x] = original->b[y][x] * facc; + + } + } + } + } + } } } } -void ImProcFunctions::calc_ref (LabImage * original, LabImage * transformed, int cx, int cy, int oW, int oH, int sk, double & hueref, double & chromaref, double & lumaref, double &sobelref) +void ImProcFunctions::calc_ref(LabImage * original, LabImage * transformed, int cx, int cy, int oW, int oH, int sk, double & hueref, double & chromaref, double & lumaref, double & sobelref) { if (params->locallab.enabled) { //always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise struct local_params lp; - calcLocalParams (oW, oH, params->locallab, lp); + calcLocalParams(oW, oH, params->locallab, lp); // double precision for large summations double aveA = 0.; @@ -5837,7 +6456,7 @@ void ImProcFunctions::calc_ref (LabImage * original, LabImage * transformed, int int nso = 0; // single precision for the result float avA, avB, avL; - int spotSize = 0.88623f * max (1, lp.cir / sk); //18 + int spotSize = 0.88623f * max(1, lp.cir / sk); //18 //O.88623 = sqrt(PI / 4) ==> sqare equal to circle int spotSise2; // = 0.88623f * max (1, lp.cir / sk); //18 @@ -5848,24 +6467,24 @@ void ImProcFunctions::calc_ref (LabImage * original, LabImage * transformed, int LabImage *sobelL; LabImage *deltasobelL; LabImage *origsob; - int spotSi = 1 + 2 * max (1, lp.cir / sk); + int spotSi = 1 + 2 * max(1, lp.cir / sk); if (spotSi < 5) { spotSi = 5; } spotSise2 = (spotSi - 1) / 2; - origsob = new LabImage (spotSi, spotSi); - sobelL = new LabImage (spotSi, spotSi); - deltasobelL = new LabImage (spotSi, spotSi); + origsob = new LabImage(spotSi, spotSi); + sobelL = new LabImage(spotSi, spotSi); + deltasobelL = new LabImage(spotSi, spotSi); //ref for luma, chroma, hue - for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) { - for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) { + for (int y = max(cy, (int)(lp.yc - spotSize)); y < min(transformed->H + cy, (int)(lp.yc + spotSize + 1)); y++) { + for (int x = max(cx, (int)(lp.xc - spotSize)); x < min(transformed->W + cx, (int)(lp.xc + spotSize + 1)); x++) { aveL += original->L[y - cy][x - cx]; aveA += original->a[y - cy][x - cx]; aveB += original->b[y - cy][x - cx]; - aveChro += sqrtf (SQR (original->b[y - cy][x - cx]) + SQR (original->a[y - cy][x - cx])); + aveChro += sqrtf(SQR(original->b[y - cy][x - cx]) + SQR(original->a[y - cy][x - cx])); nab++; } } @@ -5874,11 +6493,11 @@ void ImProcFunctions::calc_ref (LabImage * original, LabImage * transformed, int bool toto = true; if (toto) { - for (int y = max (cy, (int) (lp.yc - spotSise2)); y < min (transformed->H + cy, (int) (lp.yc + spotSise2 + 1)); y++) { - for (int x = max (cx, (int) (lp.xc - spotSise2)); x < min (transformed->W + cx, (int) (lp.xc + spotSise2 + 1)); x++) { - int yb = max (cy, (int) (lp.yc - spotSise2)); + for (int y = max(cy, (int)(lp.yc - spotSise2)); y < min(transformed->H + cy, (int)(lp.yc + spotSise2 + 1)); y++) { + for (int x = max(cx, (int)(lp.xc - spotSise2)); x < min(transformed->W + cx, (int)(lp.xc + spotSise2 + 1)); x++) { + int yb = max(cy, (int)(lp.yc - spotSise2)); - int xb = max (cx, (int) (lp.xc - spotSise2)); + int xb = max(cx, (int)(lp.xc - spotSise2)); int z = y - yb; int u = x - xb; @@ -5888,7 +6507,7 @@ void ImProcFunctions::calc_ref (LabImage * original, LabImage * transformed, int } const float radius = 3.f / (sk * 1.4f); //0 to 70 ==> see skip - SobelCannyLuma (sobelL->L, deltasobelL->L, origsob->L, spotSi, spotSi, radius); + SobelCannyLuma(sobelL->L, deltasobelL->L, origsob->L, spotSi, spotSi, radius); // SobelCannyLuma (sobelL, deltasobelL, origsob, spotSi, spotSi, radius ); int nbs = 0; @@ -5915,13 +6534,13 @@ void ImProcFunctions::calc_ref (LabImage * original, LabImage * transformed, int avA = aveA / 327.68f; avB = aveB / 327.68f; avL = aveL / 327.68f; - hueref = xatan2f (avB, avA); //mean hue + hueref = xatan2f(avB, avA); //mean hue chromaref = aveChro; lumaref = avL; } } -void ImProcFunctions::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 ImProcFunctions::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) { if (params->locallab.enabled) { @@ -5935,7 +6554,7 @@ void ImProcFunctions::copy_ref (LabImage * spotbuffer, LabImage * original, LabI // single precision for the result float avA, avB, avL; // int spotSize = 0.88623f * max (1, lp.cir / sk); //18 - int spotSize = max (1, lp.cir / sk); + int spotSize = max(1, lp.cir / sk); //O.88623 = sqrt(PI / 4) ==> sqare equal to circle /* @@ -5944,13 +6563,13 @@ void ImProcFunctions::copy_ref (LabImage * spotbuffer, LabImage * original, LabI printf ("COPYymin=%i ymax=%i\n", max (cy, (int) (lp.yc - spotSize)), min (transformed->H + cy, (int) (lp.yc + spotSize + 1)) ); printf ("COPYxmin=%i xmax=%i\n", max (cx, (int) (lp.xc - spotSize)), min (transformed->W + cx, (int) (lp.xc + spotSize + 1)) ); */ - for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) { - for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) { + for (int y = max(cy, (int)(lp.yc - spotSize)); y < min(transformed->H + cy, (int)(lp.yc + spotSize + 1)); y++) { + for (int x = max(cx, (int)(lp.xc - spotSize)); x < min(transformed->W + cx, (int)(lp.xc + spotSize + 1)); x++) { - int yb = max (cy, (int) (lp.yc - spotSize)); + int yb = max(cy, (int)(lp.yc - spotSize)); // int ye = min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); - int xb = max (cx, (int) (lp.xc - spotSize)); + int xb = max(cx, (int)(lp.xc - spotSize)); // int xe = min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); aveL += original->L[y - cy][x - cx]; @@ -5963,7 +6582,7 @@ void ImProcFunctions::copy_ref (LabImage * spotbuffer, LabImage * original, LabI aveA += original->a[y - cy][x - cx]; aveB += original->b[y - cy][x - cx]; - aveChro += sqrtf (SQR (original->b[y - cy][x - cx]) + SQR (original->a[y - cy][x - cx])); + aveChro += sqrtf(SQR(original->b[y - cy][x - cx]) + SQR(original->a[y - cy][x - cx])); nab++; } @@ -5977,25 +6596,25 @@ void ImProcFunctions::copy_ref (LabImage * spotbuffer, LabImage * original, LabI avA = aveA / 327.68f; avB = aveB / 327.68f; avL = aveL / 327.68f; - huerefspot = xatan2f (avB, avA); //mean hue + huerefspot = xatan2f(avB, avA); //mean hue chromarefspot = aveChro; lumarefspot = avL; } } -void ImProcFunctions::paste_ref (LabImage * spotbuffer, LabImage * transformed, int cx, int cy, int sk, const struct local_params & lp) +void ImProcFunctions::paste_ref(LabImage * spotbuffer, LabImage * transformed, int cx, int cy, int sk, const struct local_params & lp) { if (params->locallab.enabled) { int nab = 0; - int spotSize = max (1, lp.cir / sk); + int spotSize = max(1, lp.cir / sk); - for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) { - for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) { - int yb = max (cy, (int) (lp.yc - spotSize)); + for (int y = max(cy, (int)(lp.yc - spotSize)); y < min(transformed->H + cy, (int)(lp.yc + spotSize + 1)); y++) { + for (int x = max(cx, (int)(lp.xc - spotSize)); x < min(transformed->W + cx, (int)(lp.xc + spotSize + 1)); x++) { + int yb = max(cy, (int)(lp.yc - spotSize)); // int ye = min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); - int xb = max (cx, (int) (lp.xc - spotSize)); + int xb = max(cx, (int)(lp.xc - spotSize)); // int xe = min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); // aveL += original->L[y - cy][x - cx]; @@ -6012,9 +6631,9 @@ void ImProcFunctions::paste_ref (LabImage * spotbuffer, LabImage * transformed, } } -void ImProcFunctions::Lab_Local (int call, 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, double & hueref, double & chromaref, double & lumaref, double &sobelref) +void ImProcFunctions::Lab_Local(int call, 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, double & hueref, double & chromaref, double & lumaref, double & sobelref) { //general call of others functions : important return hueref, chromaref, lumaref if (params->locallab.enabled) { @@ -6029,11 +6648,16 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original int del = 3; // to avoid crash with [loy - begy] and [lox - begx] and bfh bfw // with gtk2 [loy - begy-1] [lox - begx -1 ] and del = 1 struct local_params lp; - calcLocalParams (oW, oH, params->locallab, lp); + calcLocalParams(oW, oH, params->locallab, lp); const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip - float radiussob = lp.strucc / (sk * 1.4f); //0 to 70 ==> see skip - //printf("radiussob=%f rad=%f sk=%i\n", radiussob, lp.rad, sk); + int strred = (lp.strucc - 1); + + if (strred > 1) { + strred = 1; + } + + float radiussob = strred / (sk * 1.4f); double ave = 0.; int n = 0; float av = 0; @@ -6118,9 +6742,9 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original constexpr float maxl = 2.5f; // 3 reductio contrast under mean - float multh = (float) fabs (lp.cont) * (maxh - 1.f) / 100.f + 1.f; + float multh = (float) fabs(lp.cont) * (maxh - 1.f) / 100.f + 1.f; - float mult = (float)fabs (lp.cont) * (maxl - 1.f) / 100.f + 1.f; + float mult = (float)fabs(lp.cont) * (maxl - 1.f) / 100.f + 1.f; lco.dx = 1.f - 1.f / mult; @@ -6141,8 +6765,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original int begx = lp.xc - lp.lxL; int yEn = lp.yc + lp.ly; int xEn = lp.xc + lp.lx; - bufsob = new LabImage (bfw, bfh); - bufreserv = new LabImage (bfw, bfh); + bufsob = new LabImage(bfw, bfh); + bufreserv = new LabImage(bfw, bfh); float **buflight = nullptr; float **bufchro = nullptr; float *orig[bfh] ALIGNED16; @@ -6152,7 +6776,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original orig[i] = &origBuffer[i * bfw]; } - bufexclu = new LabImage (bfw, bfh); + bufexclu = new LabImage(bfw, bfh); + buflight = new float*[bfh]; for (int i = 0; i < bfh; i++) { @@ -6180,349 +6805,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original bufreserv->L[ir][jr] = 0.f; bufreserv->a[ir][jr] = 0.f; bufreserv->b[ir][jr] = 0.f; - } -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int y = 0; y < transformed->H ; y++) //{ - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; - int loy = cy + y; - - if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufsob->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - - } - } - - tmpsob = new LabImage (bfw, bfh); - deltasobelL = new LabImage (bfw, bfh); - SobelCannyLuma (tmpsob->L, deltasobelL->L, bufsob->L, bfw, bfh, radiussob); -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int ir = 0; ir < bfh; ir++) //fill with 0 - for (int jr = 0; jr < bfw; jr++) { - deltasobelL->L[ir][jr] = 1.f; - } - - bool titi = false; - - if (titi) { - - // if (lp.strucc > 0.f) { - // if (titi) { - //todo use of tmpsob and deltasobelL - shape detection - // float epsxy = 0.001f; - //first quarter superior - buflight = new float*[bfh]; - - for (int i = 0; i < bfh; i++) { - buflight[i] = new float[bfw]; - } - - int Xo = ceil (-lp.lxL); - int Xe = ceil (lp.lx); - // int Yo = ceil (-lp.ly); - int Ye = ceil (lp.lyT); - - int XR = max (-Xo, Xe); - float **val = nullptr; - int rr = sqrt (SQR (XR) + SQR (Ye)) + 3; - - val = new float*[xEn - begx + 3]; - - for (int i = 0; i < (xEn - begx + 3); i++) { - val[i] = new float[rr]; - } - - float *rad = nullptr; - rad = new float[xEn - begx + 3]; - float *radlim = nullptr; - radlim = new float[xEn - begx + 3]; - - //second quarter left - float *valL = nullptr; - valL = new float[yEn - begy + 3]; - float *radL = nullptr; - radL = new float[yEn - begy + 3]; - - float *radlimL = nullptr; - radlimL = new float[yEn - begy + 3]; - - float2 sincosval; - - for (int w = 0; w < (xEn - begx); w++) { - rad[w] = 0.f; - radlim[w] = 0.f; - } - - for (int w = 0; w < (xEn - begx); w++) { - for (int z = 0; z < rr; z++) { - val[w][z] = 0.f; - } - - } - - for (int w = 0; w < (yEn - begy); w++) { - radL[w] = 0.f; - radlimL[w] = 0.f; - } - - //change coordonate to XX, YY XX=x, YY=-y to can use easily trigo functions and polar coordonates - // xc yc are XX=0 YY=0 - //at the end we convert inverse - float sobelponder = 2.f * sobelref; - - if (sobelponder > 25000.f) { - sobelponder = 25000.f; - } - - - float valm = 0.f; - - /* - printf ("yT=%i xL=%i x=%i y=%i xc=%i yc=%i\n", (int)lp.lyT, (int)lp.lxL, (int)lp.lx, (int)lp.ly, (int)lp.xc, (int)lp.yc); - float tetabe1 = xatan2f (Ye, Xo ); - float tetaen1 = xatan2f (Ye, Xe); - printf ("tetbhaut1=%f tetend1=%f\n", tetabe1, tetaen1); - - float tetabe2 = xatan2f (Yo, Xo ); - float tetaen2 = xatan2f (Ye, Xo); - printf ("tetbhaut2=%f tetend2=%f\n", tetabe2, tetaen2); - */ - // int maxm = -10; - for (int XX = Xo; XX < Xe; XX++) { //first quarter superior - int m = ceil (XX - Xo); - - if (m < 0) { - m = 0; - } - - radlim[m] = sqrt (SQR (XX) + SQR (Ye)); - - float tetacur = xatan2f (Ye, XX); - // float maxval = -10000.f; - float valedge = 8000.f; - - for (int r = 0; r < radlim[m]; r++) { - sincosval = xsincosf (tetacur); - float xcur = r * sincosval.y; - float ycur = r * sincosval.x; - - int xxcur = ceil (lp.xc) + ceil (xcur) - begx; - xxcur = LIM (xxcur, 0, bfw - 1); - - int yycur = ceil (lp.yc) - ceil (ycur) - begy;// - before ceil(ycur) to convert YY ==> y - yycur = LIM (yycur, 0, bfh - 1); - valm = tmpsob->L[yycur][xxcur]; - - if (valm > valedge) { - // if(m > maxm) maxm = m; - val[m][r] = valm; - - if (XX == 0 || XX == 2) { - printf ("XX=%i m=%i r=%i val=%f \n", XX, m, r, val[m][r]); - } - } - - - - // val[maxm][r] = valedge; - - - } - } - - /* - for (int XX = Xo; XX < Xe; XX++) { //first quarter superior - int m = ceil (XX - Xo); - - if (m < 0) { - m = 0; - } - - radlim[m] = sqrt (SQR (XX) + SQR (Ye)); - - float tetacur = xatan2f (Ye, XX); - - int rf = -10; - for (int r = 0; r < radlim[m]; r++) { - sincosval = xsincosf (tetacur); - float xcur = r * sincosval.y; - float ycur = r * sincosval.x; - - int xxcur = ceil (lp.xc) + ceil (xcur) - begx; - xxcur = LIM (xxcur, 0, bfw - 1); - - int yycur = ceil (lp.yc) - ceil (ycur) - begy; - yycur = LIM (yycur, 0, bfh - 1); - float lect = tmpsob->L[yycur][xxcur]; - - if (lect == val[m][r]) { - if(r > rf) rf = r; - rad[m] = (float) rf; - } - } - } - - - for (int XX = Xo; XX < Xe; XX++) { //first quarter superior - int m = ceil (XX - Xo); - - if (m < 0) { - m = 0; - } - - radlim[m] = sqrt (SQR (XX) + SQR (Ye)); - - float tetacur = xatan2f (Ye, XX); - - - for (int r = 0; r < radlim[m]; r++) { - sincosval = xsincosf (tetacur); - float xcur = r * sincosval.y; - float ycur = r * sincosval.x; - - int xxcur = ceil (lp.xc) + ceil (xcur) - begx; - xxcur = LIM (xxcur, 0, bfw - 1); - - int yycur = ceil (lp.yc) - ceil (ycur) - begy; - yycur = LIM (yycur, 0, bfh - 1); - - if ((float) r <= rad[m]) { - deltasobelL->L[yycur][xxcur] = 1.f; - } else { - deltasobelL->L[yycur][xxcur] = 0.f; - } - } - } - */ - /* - - for (int YY = Yo; YY < Ye; YY++) { //second quarter left - int m = ceil (YY - Yo); - - if (m < 0) { - m = 0; - } - - radlimL[m] = sqrt (SQR (YY) + SQR (Xo)); - - float tetacur = xatan2f (YY, Xo); - float maxval = -10000.f; - - for (int r = 0; r < radlimL[m]; r++) { - sincosval = xsincosf (tetacur); - float xcur = r * sincosval.y; - float ycur = r * sincosval.x; - - int xxcur = ceil (lp.xc) + ceil (xcur) - begx; - xxcur = LIM (xxcur, 0, bfw - 1); - - int yycur = ceil (lp.yc) - ceil (ycur) - begy; - yycur = LIM (yycur, 0, bfh - 1); - valm = tmpsob->L[yycur][xxcur]; - - - if (valm > maxval) { - maxval = valm; - } - - valL[m] = maxval; - - - - } - } - - - for (int YY = Yo; YY < Ye; YY++) { //second quarter left - int m = ceil (YY - Yo); - - if (m < 0) { - m = 0; - } - - radlimL[m] = sqrt (SQR (YY) + SQR (Xo)); - - float tetacur = xatan2f (YY, Xo); - - - - for (int r = 0; r < radlimL[m]; r++) { - sincosval = xsincosf (tetacur); - float xcur = r * sincosval.y; - float ycur = r * sincosval.x; - - int xxcur = ceil (lp.xc) + ceil (xcur) - begx; - xxcur = LIM (xxcur, 0, bfw - 1); - - int yycur = ceil (lp.yc) - ceil (ycur) - begy; - yycur = LIM (yycur, 0, bfh - 1); - float lect = tmpsob->L[yycur][xxcur]; - - if (lect == valL[m]) { - radL[m] = (float) r; - } - } - } - - for (int YY = Yo; YY < Ye; YY++) { //second quarter left - int m = ceil (YY - Yo); - - if (m < 0) { - m = 0; - } - - radlimL[m] = sqrt (SQR (YY) + SQR (Xo)); - - float tetacur = xatan2f (YY, Xo); - - for (int r = 0; r < radlimL[m]; r++) { - sincosval = xsincosf (tetacur); - float xcur = r * sincosval.y; - float ycur = r * sincosval.x; - - int xxcur = ceil (lp.xc) + ceil (xcur) - begx; - xxcur = LIM (xxcur, 0, bfw - 1); - - int yycur = ceil (lp.yc) - ceil (ycur) - begy; - yycur = LIM (yycur, 0, bfh - 1); - - if ((float) r <= radL[m]) { - deltasobelL->L[yycur][xxcur] = 1.f; - } else { - deltasobelL->L[yycur][xxcur] = 0.f; - } - } - } - */ - - delete[] radlimL; - delete[] radL; - delete[] valL; - - delete[] radlim; - delete[] rad; - - for (int i = 0; i < (xEn - begx + 3); i++) { - delete [] val[i]; - } - - delete [] val; - - - } - - //then restore non modified area - - - #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -6543,6 +6827,655 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } } + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int y = 0; y < transformed->H ; y++) //{ + for (int x = 0; x < transformed->W; x++) { + int lox = cx + x; + int loy = cy + y; + + if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { + // bufsob->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas + bufsob->L[loy - begy][lox - begx] = reserved->L[y][x];//fill square buffer with datas + + } + } + + tmpsob = new LabImage(bfw, bfh); + deltasobelL = new LabImage(bfw, bfh); + SobelCannyLuma(tmpsob->L, deltasobelL->L, bufsob->L, bfw, bfh, radiussob); +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int jr = 0; jr < bfw; jr++) { + deltasobelL->L[ir][jr] = 1.f; + } + + + + bool titi = false; + + if (titi) { + + + + // if (lp.strucc > 0) { + // if (titi) { + //todo use of tmpsob and deltasobelL - shape detection + /* + buflight = new float*[bfh]; + + for (int i = 0; i < bfh; i++) { + buflight[i] = new float[bfw]; + } + */ + //change coordonate to XX, YY XX=x, YY=-y to can use easily trigo functions and polar coordonates + // xc yc are XX=0 YY=0 + //at the end we convert inverse + // we have 4 quarter for the area bfw * bfh : TOP, LEFT, BOTTOM, RIGHT + float **Cdeltae = nullptr; + Cdeltae = new float*[bfh]; + + for (int i = 0; i < bfh; i++) { + Cdeltae[i] = new float[bfw]; + } + + float **Cdeltaesob = nullptr; + Cdeltaesob = new float*[bfh]; + + for (int i = 0; i < bfh; i++) { + Cdeltaesob[i] = new float[bfw]; + } + + float **Ldeltae = nullptr; + Ldeltae = new float*[bfh]; + + for (int i = 0; i < bfh; i++) { + Ldeltae[i] = new float[bfw]; + } + + float **Ldeltaesob = nullptr; + Ldeltaesob = new float*[bfh]; + + for (int i = 0; i < bfh; i++) { + Ldeltaesob[i] = new float[bfw]; + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int jr = 0; jr < bfw; jr++) { + Cdeltae[ir][jr] = 0.f; + Ldeltae[ir][jr] = 0.f; + Cdeltaesob[ir][jr] = 0.f; + Ldeltaesob[ir][jr] = 0.f; + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + float tempc = SQR(bufreserv->a[ir][jr] - bufexclu->a[ir][jr]) + SQR(bufreserv->b[ir][jr] - bufexclu->b[ir][jr]); + float templ = fabs(bufreserv->L[ir][jr] - bufexclu->L[ir][jr]); + Cdeltae[ir][jr] = sqrt(tempc); + Ldeltae[ir][jr] = templ; + } + + + SobelCannyLuma(Cdeltaesob, deltasobelL->L, Cdeltae, bfw, bfh, 0);//0 or other thing eg radiussob if noise... + SobelCannyLuma(Ldeltaesob, deltasobelL->L, Ldeltae, bfw, bfh, 0); + + int Xo = trunc(-lp.lxL); + int Xe = trunc(lp.lx); + int Yo = trunc(-lp.ly); + int Ye = trunc(lp.lyT); + int ar = 1;//to avoid crash due to round values + //init first quarter top + int XR = max(-Xo, Xe); + float **val = nullptr; + //rr maximum radius to stock data + int rr = sqrt(SQR(XR) + SQR(Ye)) + ar; //+ 3 to prevent crash due to round float + //val [m = position on relative abscisse] [r = polar radius] + + //val to stock Sobel on radius + val = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + val[i] = new float[rr]; + } + + //cDe and LdE to stock delta E chroma and luma + float **CdE = nullptr; + CdE = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + CdE[i] = new float[rr]; + } + + float **LdE = nullptr; + LdE = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + LdE[i] = new float[rr]; + } + + //cdEsob and ldesob to stock sobel on DeltaEch and Luma + float **CdEsob = nullptr; + CdEsob = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + CdEsob[i] = new float[rr]; + } + + float **LdEsob = nullptr; + LdEsob = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + LdEsob[i] = new float[rr]; + } + + float **Soderiv = nullptr; + Soderiv = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + Soderiv[i] = new float[rr]; + } + + //derivative of deltae Chroma + float **Chderiv = nullptr; + Chderiv = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + Chderiv[i] = new float[rr]; + } + + //derivative of deltaE Luma + float **Luderiv = nullptr; + Luderiv = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + Luderiv[i] = new float[rr]; + } + + //good max : find the good max value. This value perhaps is max, but perhaps it is after - on the radius - and before the end + float *goodmax = nullptr; + goodmax = new float[xEn - begx + ar]; + //derivative of sobel + + //keep radius On OFF action + float *rad = nullptr; + rad = new float[xEn - begx + ar]; + + //radlim maximum radius + float *radlim = nullptr; + radlim = new float[xEn - begx + ar]; + + //init second quarter left + int YL = max(-Yo, Ye); + + float **valL = nullptr; + int rrL = sqrt(SQR(YL) + SQR(Xo)) + ar; + + valL = new float*[yEn - begy + ar]; + + for (int i = 0; i < (yEn - begy + ar); i++) { + valL[i] = new float[rrL]; + } + + float *radL = nullptr; + radL = new float[yEn - begy + ar]; + + float *radlimL = nullptr; + radlimL = new float[yEn - begy + ar]; + + //init third quarter bottom + XR = max(-Xo, Xe); + float **valB = nullptr; + int rrB = sqrt(SQR(XR) + SQR(Yo)) + ar; + valB = new float*[xEn - begx + ar]; + + for (int i = 0; i < (xEn - begx + ar); i++) { + valB[i] = new float[rrB]; + } + + float *radB = nullptr; + radB = new float[xEn - begx + ar]; + float *radlimB = nullptr; + radlimB = new float[xEn - begx + ar]; + + //init fourth quarter right + YL = max(-Yo, Ye); + + float **valR = nullptr; + int rrR = sqrt(SQR(YL) + SQR(Xe)) + ar; + + valR = new float*[yEn - begy + ar]; + + for (int i = 0; i < (yEn - begy + ar); i++) { + valR[i] = new float[rrR]; + } + + float *radR = nullptr; + radR = new float[yEn - begy + ar]; + + float *radlimR = nullptr; + radlimR = new float[yEn - begy + ar]; + + float2 sincosval; + + for (int w = 0; w < (xEn - begx); w++) { + rad[w] = 0.f; + radlim[w] = 0.f; + radB[w] = 0.f; + radlimB[w] = 0.f; + goodmax[w] = 0.f; + } + + for (int w = 0; w < (xEn - begx); w++) { + for (int z = 0; z < rr; z++) { + val[w][z] = 0.f; + Soderiv[w][z] = 0.f; + Chderiv[w][z] = 0.f; + Luderiv[w][z] = 0.f; + CdE[w][z] = 0.f; + LdE[w][z] = 0.f; + CdEsob[w][z] = 0.f; + LdEsob[w][z] = 0.f; + } + } + + for (int w = 0; w < (xEn - begx); w++) { + for (int z = 0; z < rrB; z++) { + valB[w][z] = 0.f; + } + } + + for (int w = 0; w < (yEn - begy); w++) { + for (int z = 0; z < rrL; z++) { + valL[w][z] = 0.f; + } + } + + for (int w = 0; w < (yEn - begy); w++) { + for (int z = 0; z < rrR; z++) { + valR[w][z] = 0.f; + } + } + + for (int w = 0; w < (yEn - begy); w++) { + radL[w] = 0.f; + radlimL[w] = 0.f; + radR[w] = 0.f; + radlimR[w] = 0.f; + } + + float sobelponder = 2.f * sobelref; + + if (sobelponder > 25000.f) { + sobelponder = 25000.f; + } + + //first step : fill val[m][r] with Sobel-Canny datas + //Canny with very smal denoise to keep good datas :radiussob # 1 2 3 + float valm = 0.f; + + for (int XX = Xo; XX < Xe; XX++) { //first quarter superior + int m = trunc(XX - Xo); + + if (m < 0) { + m = 0; + } + + radlim[m] = sqrt(SQR(XX) + SQR(Ye)); + + float tetacur = xatan2f(Ye, XX);//we can probably supprres xatan2f and repace by XX / Ye but I keep it in case of + float valedge = 0.f; + + for (int r = 0; r < radlim[m] - (ar + 2); r++) { + sincosval = xsincosf(tetacur); + float xcur = r * sincosval.y; + float ycur = r * sincosval.x; + + int xxcur = trunc(lp.xc) + trunc(xcur) - begx; + xxcur = LIM (xxcur, 0, bfw - 1); + + int yycur = trunc(lp.yc) - trunc(ycur) - begy; // - before ceil(ycur) to convert YY ==> y + yycur = LIM (yycur, 0, bfh - 1); + valm = tmpsob->L[yycur][xxcur]; + valm = tmpsob->L[yycur][xxcur]; + CdEsob[m][r] = Cdeltaesob[yycur][xxcur]; + LdEsob[m][r] = Ldeltaesob[yycur][xxcur]; + LdE[m][r] = Ldeltae[yycur][xxcur]; + CdE[m][r] = Cdeltae[yycur][xxcur]; + + if (valm > valedge) { + // if(m > maxm) maxm = m; + val[m][r] = valm; + + if (XX == 2) { + // printf("XX=%i m=%i r=%i val=%i CdE=%i LdE=%i\n", XX, m, r, (int) val[m][r], (int)CdE[m][r], (int)LdE[m][r]); + } + } + } + } + + valm = 0.f; + + for (int YY = Yo; YY < Ye; YY++) { //second quarter left + int m = ceil(YY - Yo); + + if (m < 0) { + m = 0; + } + + radlimL[m] = sqrt(SQR(YY) + SQR(Xo)); + + float tetacur = xatan2f(YY, Xo); + float valedge = 00.f; + + for (int r = 0; r < radlimL[m] - (ar + 2); r++) { + sincosval = xsincosf(tetacur); + float xcur = r * sincosval.y; + float ycur = r * sincosval.x; + + int xxcur = ceil(lp.xc) + ceil(xcur) - begx; + xxcur = LIM (xxcur, 0, bfw - 1); + + int yycur = ceil(lp.yc) - ceil(ycur) - begy; + yycur = LIM (yycur, 0, bfh - 1); + valm = tmpsob->L[yycur][xxcur]; + + if (valm > valedge) { + valL[m][r] = valm; + + if (YY == 0) { + // printf ("YYL=%i m=%i r=%i val=%i \n", YY, m, r, (int) valL[m][r]); + } + } + } + } + + valm = 0.f; + + for (int XX = Xo; XX < Xe; XX++) { //third quarter bottom + int m = ceil(XX - Xo); + + if (m < 0) { + m = 0; + } + + radlimB[m] = sqrt(SQR(XX) + SQR(Yo)); + + float tetacur = xatan2f(Yo, XX); + float valedge = 0.f; + + for (int r = 0; r < radlimB[m] - (ar + 2); r++) { + sincosval = xsincosf(tetacur); + float xcur = r * sincosval.y; + float ycur = r * sincosval.x; + + int xxcur = ceil(lp.xc) + ceil(xcur) - begx; + xxcur = LIM (xxcur, 0, bfw - 1); + + int yycur = ceil(lp.yc) - ceil(ycur) - begy; // - before ceil(ycur) to convert YY ==> y + yycur = LIM (yycur, 0, bfh - 1); + valm = tmpsob->L[yycur][xxcur]; + + if (valm > valedge) { + // if(m > maxm) maxm = m; + valB[m][r] = valm; + + if (XX == 0) { + // printf ("XXB=%i m=%i r=%i val=%i \n", XX, m, r, (int) valB[m][r]); + } + } + } + } + + valm = 0.f; + + for (int YY = Yo; YY < Ye; YY++) { //fourth quarter right + int m = ceil(YY - Yo); + + if (m < 0) { + m = 0; + } + + radlimR[m] = sqrt(SQR(YY) + SQR(Xe)); + + float tetacur = xatan2f(YY, Xe); + float valedge = 00.f; + + for (int r = 0; r < radlimR[m] - (ar + 2); r++) { + sincosval = xsincosf(tetacur); + float xcur = r * sincosval.y; + float ycur = r * sincosval.x; + + int xxcur = ceil(lp.xc) + ceil(xcur) - begx; + xxcur = LIM (xxcur, 0, bfw - 1); + + int yycur = ceil(lp.yc) - ceil(ycur) - begy; + yycur = LIM (yycur, 0, bfh - 1); + valm = tmpsob->L[yycur][xxcur]; + + if (valm > valedge) { + valR[m][r] = valm; + + if (YY == 0) { + // printf ("YYR=%i m=%i r=%i val=%i \n", YY, m, r, (int) valR[m][r]); + } + } + } + } + + + + //second step : moving average to forgot isolate datas + // it seems that most of edge are among 3 or 4 pixels + // average convolution on 3 datas (only 'r' !) + // derivative function + for (int XX = Xo; XX < Xe; XX++) { //first quarter superior + int m = trunc(XX - Xo); + + if (m < 0) { + m = 0; + } + + //average convolution and first max + for (int r = 1; r < radlim[m] - (ar + 3); r++) { + val[m][r] = 0.333f * (val[m][r - 1] + val[m][r] + val[m][r + 1]); + CdE[m][r] = 0.333f * (CdE[m][r - 1] + CdE[m][r] + CdE[m][r + 1]); + LdE[m][r] = 0.333f * (LdE[m][r - 1] + LdE[m][r] + LdE[m][r + 1]); + CdEsob[m][r] = 0.333f * (CdEsob[m][r - 1] + CdEsob[m][r] + CdEsob[m][r + 1]); + LdEsob[m][r] = 0.333f * (LdEsob[m][r - 1] + LdEsob[m][r] + LdEsob[m][r + 1]); + } + + //derivative function on 2 values + for (int r = 2; r < radlim[m] - (ar + 6); r++) { + Soderiv[m][r] = (val[m][r] - val[m][r + 2]); + Chderiv[m][r] = (CdEsob[m][r] - CdEsob[m][r + 2]); + Luderiv[m][r] = (LdEsob[m][r] - LdEsob[m][r + 2]); + + if (XX == Xe / 2) { + + printf("X=%i m=%i r=%i So=%i Chd=%i Ld=%i Sdri=%i Csodri=%i Lsodri=%i\n", XX, m, r, (int) val[m][r], (int)CdE[m][r], (int)LdE[m][r], (int) Soderiv[m][r], (int) Chderiv[m][r], (int) Luderiv[m][r]); + } + + + } + + /* + for (int r = 1; r < radlim[m] - (ar + 3); r++) { + + if ((val[m][r] == goodmax[m]) && (Soderiv[m][r] > 5000.f)) { + rad[m] = r; + } + + } + + if (XX == 2) { + printf("XX=%i m=%i gmax=%i rad=%i\n", XX, m, (int) goodmax[m], (int) rad[m]); + } + + float maxref2 = -1000.f; + + for (int r = 1; r < radlim[m] - (ar + 3); r++) { + + if (r > rad[m]) { + if (val[m][r] > maxref2) { + maxref2 = val[m][r]; + } + } + + goodmax[m] = maxref2; + + } + + for (int r = 1; r < radlim[m] - (ar + 3); r++) { + + if (val[m][r] == goodmax[m] && Soderiv[m][r] > 5000.f) { + rad[m] = r; + } + + } + + if (XX == 2) { + printf("XX=%i m=%i gmax2=%i rad=%i\n", XX, m, (int) goodmax[m], (int) rad[m]); + } + */ + + } + + + + + // put good values in delatasobelL + for (int XX = Xo; XX < Xe; XX++) { //first quarter superior + int m = trunc(XX - Xo); + + if (m < 0) { + m = 0; + } + + radlim[m] = sqrt(SQR(XX) + SQR(Ye)); + + float tetacur = xatan2f(Ye, XX); + // float valedge = 0.f; + + for (int r = 0; r < radlim[m] - (ar + 2); r++) { + sincosval = xsincosf(tetacur); + float xcur = r * sincosval.y; + float ycur = r * sincosval.x; + + int xxcur = trunc(lp.xc) + trunc(xcur) - begx; + xxcur = LIM (xxcur, 0, bfw - 1); + + int yycur = trunc(lp.yc) - trunc(ycur) - begy; // - before ceil(ycur) to convert YY ==> y + yycur = LIM (yycur, 0, bfh - 1); + + if (r > rad[m]) { + deltasobelL->L[yycur][xxcur] = 0.f; + } + + } + } + + + + delete[] radlimB; + delete[] radB; + + delete[] radlimR; + delete[] radR; + + delete[] radlimL; + delete[] radL; + + delete[] radlim; + delete[] rad; + delete[] goodmax; + + for (int i = 0; i < (xEn - begx + ar); i++) { + delete [] val[i]; + delete[] Soderiv[i]; + delete[] Chderiv[i]; + delete[] Luderiv[i]; + delete [] CdE[i]; + delete [] LdE[i]; + delete [] CdEsob[i]; + delete [] LdEsob[i]; + + } + + delete [] val; + delete [] Soderiv; + delete [] Chderiv; + delete [] Luderiv; + delete [] CdE; + delete [] LdE; + delete [] CdEsob; + delete [] LdEsob; + + for (int i = 0; i < (yEn - begy + ar); i++) { + delete [] valL[i]; + } + + delete [] valL; + + for (int i = 0; i < (xEn - begx + ar); i++) { + delete [] valB[i]; + } + + delete [] valB; + + for (int i = 0; i < (yEn - begy + ar); i++) { + delete [] valR[i]; + } + + delete [] valR; + + for (int i = 0; i < bfh; i++) { + delete [] Cdeltae[i]; + } + + delete [] Cdeltae; + + for (int i = 0; i < bfh; i++) { + delete [] Ldeltae[i]; + } + + delete [] Ldeltae; + + for (int i = 0; i < bfh; i++) { + delete [] Cdeltaesob[i]; + } + + delete [] Cdeltaesob; + + for (int i = 0; i < bfh; i++) { + delete [] Ldeltaesob[i]; + } + + delete [] Ldeltaesob; + + + + } + + //then restore non modified area + + + + //TODO then use instead of others modifications Color and Light, Blur, etc. float hueplus = hueref + dhueexclu; float huemoins = hueref - dhueexclu; @@ -6562,7 +7495,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rL; - rL = CLIPRET ((bufreserv->L[ir][jr] - bufexclu->L[ir][jr]) / 328.f); + rL = CLIPRET((bufreserv->L[ir][jr] - bufexclu->L[ir][jr]) / 328.f); buflight[ir][jr] = rL; } @@ -6573,7 +7506,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < bfh; ir += 1) for (int jr = 0; jr < bfw; jr += 1) { - orig[ir][jr] = sqrt (SQR (bufexclu->a[ir][jr]) + SQR (bufexclu->b[ir][jr])); + orig[ir][jr] = sqrt(SQR(bufexclu->a[ir][jr]) + SQR(bufexclu->b[ir][jr])); } @@ -6584,11 +7517,11 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rch; - rch = CLIPRET ((sqrt ((SQR (bufreserv->a[ir][jr]) + SQR (bufreserv->b[ir][jr]))) - orig[ir][jr]) / 328.f); + rch = CLIPRET((sqrt((SQR(bufreserv->a[ir][jr]) + SQR(bufreserv->b[ir][jr]))) - orig[ir][jr]) / 328.f); bufchro[ir][jr] = rch; } - Exclude_Local (1, deltasobelL->L, buflight, bufchro, hueplus, huemoins, hueref, dhueex, chromaref, lumaref, lp, original, transformed, bufreserv, cx, cy); + Exclude_Local(1, deltasobelL->L, buflight, bufchro, hueplus, huemoins, hueref, dhueex, chromaref, lumaref, lp, original, transformed, bufreserv, cx, cy); delete deltasobelL; @@ -6609,8 +7542,6 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original delete bufexclu; delete [] origBuffer; - - delete bufreserv; delete bufsob; @@ -6636,7 +7567,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original // if (call <= 3 && !lp.invrad) { if (call <= 3 && lp.blurmet != 1) { - bufgb = new LabImage (bfw, bfh); + bufgb = new LabImage(bfw, bfh); buflight = new float*[bfh]; for (int i = 0; i < bfh; i++) { @@ -6690,7 +7621,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } } - tmp1 = new LabImage (bfw, bfh); + tmp1 = new LabImage(bfw, bfh); // deltasobelL = new LabImage (bfw, bfh); @@ -6698,14 +7629,14 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (lp.blurmet == 2) { - tmp2 = new LabImage (transformed->W, transformed->H); + tmp2 = new LabImage(transformed->W, transformed->H); #ifdef _OPENMP #pragma omp parallel #endif { - gaussianBlur (original->L, tmp2->L, GW, GH, radius); - gaussianBlur (original->a, tmp2->a, GW, GH, radius); - gaussianBlur (original->b, tmp2->b, GW, GH, radius); + gaussianBlur(original->L, tmp2->L, GW, GH, radius); + gaussianBlur(original->a, tmp2->a, GW, GH, radius); + gaussianBlur(original->b, tmp2->b, GW, GH, radius); } @@ -6713,27 +7644,26 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } - // SobelCannyLuma (tmp1->L, deltasobelL->L, bufgb->L, bfw, bfh, radiussob); #ifdef _OPENMP #pragma omp parallel #endif { - gaussianBlur (bufgb->L, tmp1->L, bfw, bfh, radius); - gaussianBlur (bufgb->a, tmp1->a, bfw, bfh, radius); - gaussianBlur (bufgb->b, tmp1->b, bfw, bfh, radius); + gaussianBlur(bufgb->L, tmp1->L, bfw, bfh, radius); + gaussianBlur(bufgb->a, tmp1->a, bfw, bfh, radius); + gaussianBlur(bufgb->b, tmp1->b, bfw, bfh, radius); } } else { - tmp1 = new LabImage (transformed->W, transformed->H);; + tmp1 = new LabImage(transformed->W, transformed->H);; #ifdef _OPENMP #pragma omp parallel #endif { - gaussianBlur (original->L, tmp1->L, GW, GH, radius); - gaussianBlur (original->a, tmp1->a, GW, GH, radius); - gaussianBlur (original->b, tmp1->b, GW, GH, radius); + gaussianBlur(original->L, tmp1->L, GW, GH, radius); + gaussianBlur(original->a, tmp1->a, GW, GH, radius); + gaussianBlur(original->b, tmp1->b, GW, GH, radius); } } @@ -6741,7 +7671,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (lp.stren > 0.1f) { float mean = 0.f;//0 best result float variance = lp.stren ; //(double) SQR(lp.stren)/sk; - addGaNoise (tmp1, tmp1, mean, variance, sk) ; + addGaNoise(tmp1, tmp1, mean, variance, sk) ; } // if (!lp.invrad) { //blur and noise (center) @@ -6764,7 +7694,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rL; - rL = CLIPRET ((tmp1->L[ir][jr] - bufgb->L[ir][jr]) / 328.f); + rL = CLIPRET((tmp1->L[ir][jr] - bufgb->L[ir][jr]) / 328.f); buflight[ir][jr] = rL; } @@ -6775,7 +7705,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < bfh; ir += 1) for (int jr = 0; jr < bfw; jr += 1) { - orig[ir][jr] = sqrt (SQR (bufgb->a[ir][jr]) + SQR (bufgb->b[ir][jr])); + orig[ir][jr] = sqrt(SQR(bufgb->a[ir][jr]) + SQR(bufgb->b[ir][jr])); } @@ -6786,15 +7716,15 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rch; - rch = CLIPRET ((sqrt ((SQR (tmp1->a[ir][jr]) + SQR (tmp1->b[ir][jr]))) - orig[ir][jr]) / 328.f); + rch = CLIPRET((sqrt((SQR(tmp1->a[ir][jr]) + SQR(tmp1->b[ir][jr]))) - orig[ir][jr]) / 328.f); bufchro[ir][jr] = rch; } - BlurNoise_Local (call, tmp1, tmp2, buflight, bufchro, hueplus, huemoins, hueref, dhuebn, chromaref, lumaref, lp, original, transformed, cx, cy); + BlurNoise_Local(call, tmp1, tmp2, buflight, bufchro, hueplus, huemoins, hueref, dhuebn, chromaref, lumaref, lp, original, transformed, cx, cy); } else { - InverseBlurNoise_Local (lp, original, transformed, tmp1, cx, cy); + InverseBlurNoise_Local(lp, original, transformed, tmp1, cx, cy); } @@ -6840,7 +7770,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original execdenoi = noiscfactiv && ((lp.colorena && execcolor) || (lp.tonemapena && lp.strengt != 0.f) || (lp.cbdlena && execbdl) || (lp.sharpena && lp.shrad > 0.42) || (lp.retiena && lp.str > 0.f) || (lp.exposena && lp.expcomp != 0.f) || (lp.expvib && lp.past != 0.f)); if (((lp.noiself > 0.f || lp.noiselc > 0.f || lp.noisecf > 0.f || lp.noisecc > 0.f) && lp.denoiena) || execdenoi) { - StopWatch Stop1 ("locallab Denoise called"); + StopWatch Stop1("locallab Denoise called"); if (lp.noisecf > 0.1f || lp.noisecc > 0.1f) { noiscfactiv = false; @@ -6855,7 +7785,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original #endif if (call == 1) { - LabImage tmp1 (transformed->W, transformed->H); + LabImage tmp1(transformed->W, transformed->H); int GW = transformed->W; int GH = transformed->H; @@ -6871,9 +7801,9 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original int levwavL = levred; int skip = 1; - wavelet_decomposition Ldecomp (tmp1.L[0], tmp1.W, tmp1.H, levwavL, 1, skip, numThreads, DaubLen); - wavelet_decomposition adecomp (tmp1.a[0], tmp1.W, tmp1.H, levwavL, 1, skip, numThreads, DaubLen); - wavelet_decomposition bdecomp (tmp1.b[0], tmp1.W, tmp1.H, levwavL, 1, skip, numThreads, DaubLen); + wavelet_decomposition Ldecomp(tmp1.L[0], tmp1.W, tmp1.H, levwavL, 1, skip, numThreads, DaubLen); + wavelet_decomposition adecomp(tmp1.a[0], tmp1.W, tmp1.H, levwavL, 1, skip, numThreads, DaubLen); + wavelet_decomposition bdecomp(tmp1.b[0], tmp1.W, tmp1.H, levwavL, 1, skip, numThreads, DaubLen); float madL[8][3]; int edge = 2; @@ -6883,12 +7813,12 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int lvl = 0; lvl < levred; lvl++) { for (int dir = 1; dir < 4; dir++) { - int Wlvl_L = Ldecomp.level_W (lvl); - int Hlvl_L = Ldecomp.level_H (lvl); + int Wlvl_L = Ldecomp.level_W(lvl); + int Hlvl_L = Ldecomp.level_H(lvl); - float ** WavCoeffs_L = Ldecomp.level_coeffs (lvl); + float ** WavCoeffs_L = Ldecomp.level_coeffs(lvl); - madL[lvl][dir - 1] = SQR (Mad (WavCoeffs_L[dir], Wlvl_L * Hlvl_L)); + madL[lvl][dir - 1] = SQR(Mad(WavCoeffs_L[dir], Wlvl_L * Hlvl_L)); } } @@ -6896,38 +7826,38 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (levred == 7) { edge = 2; - vari[0] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[1] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[2] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[0] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[1] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[2] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[3] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); - vari[4] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); - vari[5] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); - vari[6] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[3] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[4] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[5] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[6] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); } else if (levred == 4) { edge = 3; - vari[0] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[1] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[2] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[3] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[0] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[1] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[2] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[3] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiselc / 25.0)); } - if (( lp.noiself > 0.1f || lp.noiselc > 0.1f)) { - vari[0] = max (0.0001f, vari[0]); - vari[1] = max (0.0001f, vari[1]); - vari[2] = max (0.0001f, vari[2]); - vari[3] = max (0.0001f, vari[3]); + if ((lp.noiself > 0.1f || lp.noiselc > 0.1f)) { + vari[0] = max(0.0001f, vari[0]); + vari[1] = max(0.0001f, vari[1]); + vari[2] = max(0.0001f, vari[2]); + vari[3] = max(0.0001f, vari[3]); if (levred == 7) { - vari[4] = max (0.0001f, vari[4]); - vari[5] = max (0.0001f, vari[5]); - vari[6] = max (0.0001f, vari[6]); + vari[4] = max(0.0001f, vari[4]); + vari[5] = max(0.0001f, vari[5]); + vari[6] = max(0.0001f, vari[6]); } float* noisevarlum = nullptr; // we need a dummy to pass it to WaveletDenoiseAllL - WaveletDenoiseAllL (Ldecomp, noisevarlum, madL, vari, edge, numThreads); + WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); } } @@ -6936,40 +7866,40 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!adecomp.memoryAllocationFailed && !bdecomp.memoryAllocationFailed) { if (levred == 7) { edge = 2; - variC[0] = SQR (lp.noisecf / 10.0); - variC[1] = SQR (lp.noisecf / 10.0); - variC[2] = SQR (lp.noisecf / 10.0); + variC[0] = SQR(lp.noisecf / 10.0); + variC[1] = SQR(lp.noisecf / 10.0); + variC[2] = SQR(lp.noisecf / 10.0); - variC[3] = SQR (lp.noisecf / 10.0); - variC[4] = SQR (lp.noisecf / 10.0); - variC[5] = SQR (lp.noisecc / 10.0); - variC[6] = SQR (lp.noisecc / 10.0); + variC[3] = SQR(lp.noisecf / 10.0); + variC[4] = SQR(lp.noisecf / 10.0); + variC[5] = SQR(lp.noisecc / 10.0); + variC[6] = SQR(lp.noisecc / 10.0); } else if (levred == 4) { edge = 3; - variC[0] = SQR (lp.noisecf / 10.0); - variC[1] = SQR (lp.noisecf / 10.0); - variC[2] = SQR (lp.noisecf / 10.0); - variC[3] = SQR (lp.noisecf / 10.0); + variC[0] = SQR(lp.noisecf / 10.0); + variC[1] = SQR(lp.noisecf / 10.0); + variC[2] = SQR(lp.noisecf / 10.0); + variC[3] = SQR(lp.noisecf / 10.0); } - if (( lp.noisecf > 0.1f || lp.noisecc > 0.1f || noiscfactiv)) { + if ((lp.noisecf > 0.1f || lp.noisecc > 0.1f || noiscfactiv)) { float minic = 0.0001f; if (noiscfactiv) { minic = 0.01f;//only for artifact shape detection } - variC[0] = max (minic, variC[0]); - variC[1] = max (minic, variC[1]); - variC[2] = max (minic, variC[2]); - variC[3] = max (minic, variC[3]); + variC[0] = max(minic, variC[0]); + variC[1] = max(minic, variC[1]); + variC[2] = max(minic, variC[2]); + variC[3] = max(minic, variC[3]); if (levred == 7) { - variC[4] = max (0.0001f, variC[4]); - variC[5] = max (0.0001f, variC[5]); - variC[6] = max (0.0001f, variC[6]); + variC[4] = max(0.0001f, variC[4]); + variC[5] = max(0.0001f, variC[5]); + variC[6] = max(0.0001f, variC[6]); } float* noisevarchrom = new float[GH * GW]; @@ -6979,8 +7909,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } float noisevarab_r = 100.f; //SQR(lp.noisecc / 10.0); - WaveletDenoiseAllAB (Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); - WaveletDenoiseAllAB (Ldecomp, bdecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); + WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); + WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); delete[] noisevarchrom; } @@ -6988,27 +7918,27 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!Ldecomp.memoryAllocationFailed) { - Ldecomp.reconstruct (tmp1.L[0]); + Ldecomp.reconstruct(tmp1.L[0]); } if (!adecomp.memoryAllocationFailed) { - adecomp.reconstruct (tmp1.a[0]); + adecomp.reconstruct(tmp1.a[0]); } if (!bdecomp.memoryAllocationFailed) { - bdecomp.reconstruct (tmp1.b[0]); + bdecomp.reconstruct(tmp1.b[0]); } - DeNoise_Local (call, lp, original, transformed, tmp1, cx, cy); + DeNoise_Local(call, lp, original, transformed, tmp1, cx, cy); } else if (call == 2) { //simpleprocess int bfh = int (lp.ly + lp.lyT) + del; //bfw bfh real size of square zone int bfw = int (lp.lx + lp.lxL) + del; - LabImage bufwv (bfw, bfh); - bufwv.clear (true); + LabImage bufwv(bfw, bfh); + bufwv.clear(true); int begy = lp.yc - lp.lyT; int begx = lp.xc - lp.lxL; @@ -7036,9 +7966,9 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original int levwavL = levred; int skip = 1; - wavelet_decomposition Ldecomp (bufwv.L[0], bufwv.W, bufwv.H, levwavL, 1, skip, numThreads, DaubLen); - wavelet_decomposition adecomp (bufwv.a[0], bufwv.W, bufwv.H, levwavL, 1, skip, numThreads, DaubLen); - wavelet_decomposition bdecomp (bufwv.b[0], bufwv.W, bufwv.H, levwavL, 1, skip, numThreads, DaubLen); + wavelet_decomposition Ldecomp(bufwv.L[0], bufwv.W, bufwv.H, levwavL, 1, skip, numThreads, DaubLen); + wavelet_decomposition adecomp(bufwv.a[0], bufwv.W, bufwv.H, levwavL, 1, skip, numThreads, DaubLen); + wavelet_decomposition bdecomp(bufwv.b[0], bufwv.W, bufwv.H, levwavL, 1, skip, numThreads, DaubLen); float madL[8][3]; int edge = 2; @@ -7048,12 +7978,12 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int lvl = 0; lvl < levred; lvl++) { for (int dir = 1; dir < 4; dir++) { - int Wlvl_L = Ldecomp.level_W (lvl); - int Hlvl_L = Ldecomp.level_H (lvl); + int Wlvl_L = Ldecomp.level_W(lvl); + int Hlvl_L = Ldecomp.level_H(lvl); - float ** WavCoeffs_L = Ldecomp.level_coeffs (lvl); + float ** WavCoeffs_L = Ldecomp.level_coeffs(lvl); - madL[lvl][dir - 1] = SQR (Mad (WavCoeffs_L[dir], Wlvl_L * Hlvl_L)); + madL[lvl][dir - 1] = SQR(Mad(WavCoeffs_L[dir], Wlvl_L * Hlvl_L)); } } @@ -7061,40 +7991,40 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (levred == 7) { edge = 2; - vari[0] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[1] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[2] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[0] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[1] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[2] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[3] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); - vari[4] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); - vari[5] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); - vari[6] = 8.f * SQR ((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[3] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[4] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[5] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[6] = 8.f * SQR((lp.noiselc / 125.0) * (1.0 + lp.noiselc / 25.0)); } else if (levred == 4) { edge = 3; - vari[0] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[1] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[2] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); - vari[3] = 8.f * SQR ((lp.noiself / 125.0) * (1.0 + lp.noiselc / 25.0)); + vari[0] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[1] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[2] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiself / 25.0)); + vari[3] = 8.f * SQR((lp.noiself / 125.0) * (1.0 + lp.noiselc / 25.0)); } - if (( lp.noiself > 0.1f || lp.noiselc > 0.1f)) { - vari[0] = max (0.0001f, vari[0]); - vari[1] = max (0.0001f, vari[1]); - vari[2] = max (0.0001f, vari[2]); - vari[3] = max (0.0001f, vari[3]); + if ((lp.noiself > 0.1f || lp.noiselc > 0.1f)) { + vari[0] = max(0.0001f, vari[0]); + vari[1] = max(0.0001f, vari[1]); + vari[2] = max(0.0001f, vari[2]); + vari[3] = max(0.0001f, vari[3]); if (levred == 7) { - vari[4] = max (0.0001f, vari[4]); - vari[5] = max (0.0001f, vari[5]); - vari[6] = max (0.0001f, vari[6]); + vari[4] = max(0.0001f, vari[4]); + vari[5] = max(0.0001f, vari[5]); + vari[6] = max(0.0001f, vari[6]); } float* noisevarlum = nullptr; // we need a dummy to pass it to WaveletDenoiseAllL - WaveletDenoiseAllL (Ldecomp, noisevarlum, madL, vari, edge, numThreads); + WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); } } @@ -7105,39 +8035,39 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (levred == 7) { edge = 2; - variC[0] = SQR (lp.noisecf / 10.0); - variC[1] = SQR (lp.noisecf / 10.0); - variC[2] = SQR (lp.noisecf / 10.0); + variC[0] = SQR(lp.noisecf / 10.0); + variC[1] = SQR(lp.noisecf / 10.0); + variC[2] = SQR(lp.noisecf / 10.0); - variC[3] = SQR (lp.noisecf / 10.0); - variC[4] = SQR (lp.noisecf / 10.0); - variC[5] = SQR (lp.noisecc / 10.0); - variC[6] = SQR (lp.noisecc / 10.0); + variC[3] = SQR(lp.noisecf / 10.0); + variC[4] = SQR(lp.noisecf / 10.0); + variC[5] = SQR(lp.noisecc / 10.0); + variC[6] = SQR(lp.noisecc / 10.0); } else if (levred == 4) { edge = 3; - variC[0] = SQR (lp.noisecf / 10.0); - variC[1] = SQR (lp.noisecf / 10.0); - variC[2] = SQR (lp.noisecf / 10.0); - variC[3] = SQR (lp.noisecf / 10.0); + variC[0] = SQR(lp.noisecf / 10.0); + variC[1] = SQR(lp.noisecf / 10.0); + variC[2] = SQR(lp.noisecf / 10.0); + variC[3] = SQR(lp.noisecf / 10.0); } - if (( lp.noisecf > 0.1f || lp.noisecc > 0.1f || noiscfactiv)) { + if ((lp.noisecf > 0.1f || lp.noisecc > 0.1f || noiscfactiv)) { float minic = 0.0001f; if (noiscfactiv) { minic = 0.01f;//only for artifact shape detection } - variC[0] = max (minic, variC[0]); - variC[1] = max (minic, variC[1]); - variC[2] = max (minic, variC[2]); - variC[3] = max (minic, variC[3]); + variC[0] = max(minic, variC[0]); + variC[1] = max(minic, variC[1]); + variC[2] = max(minic, variC[2]); + variC[3] = max(minic, variC[3]); if (levred == 7) { - variC[4] = max (0.0001f, variC[4]); - variC[5] = max (0.0001f, variC[5]); - variC[6] = max (0.0001f, variC[6]); + variC[4] = max(0.0001f, variC[4]); + variC[5] = max(0.0001f, variC[5]); + variC[6] = max(0.0001f, variC[6]); } float* noisevarchrom = new float[bfh * bfw]; @@ -7148,8 +8078,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float noisevarab_r = 100.f; //SQR(lp.noisecc / 10.0); - WaveletDenoiseAllAB (Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); - WaveletDenoiseAllAB (Ldecomp, bdecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); + WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); + WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, variC, edge, noisevarab_r, false, false, false, numThreads); delete[] noisevarchrom; } @@ -7157,20 +8087,20 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!Ldecomp.memoryAllocationFailed) { - Ldecomp.reconstruct (bufwv.L[0]); + Ldecomp.reconstruct(bufwv.L[0]); } if (!adecomp.memoryAllocationFailed) { - adecomp.reconstruct (bufwv.a[0]); + adecomp.reconstruct(bufwv.a[0]); } if (!bdecomp.memoryAllocationFailed) { - bdecomp.reconstruct (bufwv.b[0]); + bdecomp.reconstruct(bufwv.b[0]); } - DeNoise_Local (call, lp, original, transformed, bufwv, cx, cy); + DeNoise_Local(call, lp, original, transformed, bufwv, cx, cy); } } @@ -7231,7 +8161,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float adjustr = 1.0f; //adapt chroma to working profile - if (params->icm.working == "ProPhoto") { + if (params->icm.working == "ProPhoto") { adjustr = 1.2f; // 1.2 instead 1.0 because it's very rare to have C>170.. } else if (params->icm.working == "Adobe RGB") { adjustr = 1.8f; @@ -7253,7 +8183,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (call <= 3) { //simpleprocess, dcrop, improccoordinator bfh = int (lp.ly + lp.lyT) + del; //bfw bfh real size of square zone bfw = int (lp.lx + lp.lxL) + del; - bufcolorig = new LabImage (bfw, bfh);//buffer for data in zone limit + bufcolorig = new LabImage(bfw, bfh); //buffer for data in zone limit buflight = new float*[bfh];//for lightness curve @@ -7400,7 +8330,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original //Chroma curve if (cclocalcurve && lp.qualcurvemet != 0) { // C=f(C) curve - float chromat = sqrt (SQR (bufcolorig->a[loy - begy][lox - begx]) + SQR (bufcolorig->b[loy - begy][lox - begx])); + float chromat = sqrt(SQR(bufcolorig->a[loy - begy][lox - begx]) + SQR(bufcolorig->b[loy - begy][lox - begx])); float ch; float ampli = 25.f; ch = (cclocalcurve[chromat * adjustr ]) / ((chromat + 0.00001f) * adjustr); //ch between 0 and 0 50 or more @@ -7408,7 +8338,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (ch <= 1.f) {//convert data curve near values of slider -100 + 100, to be used after to detection shape chpro = 99.f * ch - 99.f; } else { - chpro = CLIPCHRO (ampli * ch - ampli); //ampli = 25.f arbitrary empirical coefficient between 5 and 50 + chpro = CLIPCHRO(ampli * ch - ampli); //ampli = 25.f arbitrary empirical coefficient between 5 and 50 } bufchro[loy - begy][lox - begx] = chpro; @@ -7418,15 +8348,17 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original chpro = 0.f; if (lp.chro != 0.f && lp.curvact) { - float chromat = sqrt (SQR (bufcolorig->a[loy - begy][lox - begx]) + SQR (bufcolorig->b[loy - begy][lox - begx])); + // process to improve eg same as in Lab adjustements + // float chromat = sqrt(SQR(bufcolorig->a[loy - begy][lox - begx]) + SQR(bufcolorig->b[loy - begy][lox - begx])); float ch; - float ampli = 25.f; - ch = (1.f + 0.01f * lp.chro) * (chromat * adjustr) / ((chromat + 0.00001f) * adjustr); //ch between 0 and 0 50 or more + float ampli = 70.f; + // ch = (1.f + 0.01f * lp.chro) * (chromat * adjustr) / ((chromat + 0.00001f) * adjustr); //ch between 0 and 0 50 or more + ch = (1.f + 0.01f * lp.chro) ; //* (chromat * adjustr) / ((chromat + 0.00001f) * adjustr); //ch between 0 and 0 50 or more if (ch <= 1.f) {//convert data curve near values of slider -100 + 100, to be used after to detection shape chpro = 99.f * ch - 99.f; } else { - chpro = CLIPCHRO (ampli * ch - ampli); //ampli = 25.f arbitrary empirical coefficient between 5 and 50 + chpro = CLIPCHRO(ampli * ch - ampli); //ampli = 25.f arbitrary empirical coefficient between 5 and 50 } bufchroslid[loy - begy][lox - begx] = chpro; @@ -7434,10 +8366,10 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } if (lochhCurve && lp.qualcurvemet == 2 && HHutili) { - float hhforcurv = xatan2f (bufcolorig->b[loy - begy][lox - begx], bufcolorig->a[loy - begy][lox - begx]); + float hhforcurv = xatan2f(bufcolorig->b[loy - begy][lox - begx], bufcolorig->a[loy - begy][lox - begx]); - float valparam = float ((lochhCurve[500.f * Color::huelab_to_huehsv2 (hhforcurv)] - 0.5f)); //get H=f(H) 1.7 optimisation ! - float ddhue = CLIPRET (200.f * valparam); + float valparam = float ((lochhCurve[500.f * Color::huelab_to_huehsv2(hhforcurv)] - 0.5f)); //get H=f(H) 1.7 optimisation ! + float ddhue = CLIPRET(200.f * valparam); bufhh[loy - begy][lox - begx] = ddhue;//valparamdh; // } @@ -7450,13 +8382,13 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float lighLnew; float amplil = 140.f; float lighL = bufcolorig->L[loy - begy][lox - begx]; - calclight (lighL, lp.ligh, lighLnew, true); //replace L-curve + calclight(lighL, lp.ligh, lighLnew, true); //replace L-curve lL = lighLnew / lighL; if (lL <= 1.f) {//convert data curve near values of slider -100 + 100, to be used after to detection shape clighL = 99.f * lL - 99.f; } else { - clighL = CLIPLIG (amplil * lL - amplil); //ampli = 25.f arbitrary empirical coefficient between 5 and 150 + clighL = CLIPLIG(amplil * lL - amplil); //ampli = 25.f arbitrary empirical coefficient between 5 and 150 } buflightslid[loy - begy][lox - begx] = clighL; @@ -7475,7 +8407,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (lh <= 1.f) {//convert data curve near values of slider -100 + 100, to be used after to detection shape cligh = 0.3f * (100.f * lh - 100.f);//0.3 reduce sensibility } else { - cligh = CLIPLIG (amplil * lh - amplil); + cligh = CLIPLIG(amplil * lh - amplil); } buflight[loy - begy][lox - begx] = cligh; @@ -7487,7 +8419,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } - ColorLight_Local (call, bufcolorig, buflight, bufchro, bufchroslid, bufhh, buflightslid, LHutili, HHutili, hueplus, huemoins, hueref, dhue, chromaref, lumaref, lllocalcurve, loclhCurve, lochhCurve, lp, original, transformed, cx, cy); + ColorLight_Local(call, bufcolorig, buflight, bufchro, bufchroslid, bufhh, buflightslid, LHutili, HHutili, hueplus, huemoins, hueref, dhue, chromaref, lumaref, lllocalcurve, loclhCurve, lochhCurve, lp, original, transformed, cx, cy); if (call <= 3) { @@ -7530,8 +8462,20 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } //inverse else if (lp.inv && (lp.chro != 0 || lp.ligh != 0.f) && lp.colorena) { + float hueplus = hueref + dhue; + float huemoins = hueref - dhue; + // float ddhue = 0.f; - InverseColorLight_Local (lp, original, transformed, cx, cy); + //printf("hueplus=%f huemoins=%f dhu=%f\n", hueplus, huemoins, dhue); + if (hueplus > rtengine::RT_PI) { + hueplus = hueref + dhue - 2.f * rtengine::RT_PI; + } + + if (huemoins < -rtengine::RT_PI) { + huemoins = hueref - dhue + 2.f * rtengine::RT_PI; + } + + InverseColorLight_Local(lp, original, transformed, cx, cy, hueplus, huemoins, hueref, dhue, chromaref, lumaref); } @@ -7578,13 +8522,13 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original lco.alinf = realcox / (localtype / 2.f); const float vi = (localtype / 2.f) / 100.f; const float vinf = (50.f + localtype / 2.f) / 100.f; - ImProcFunctions::secondeg_begin (reducac, vi, lco.aa, lco.bb);//parabolic - ImProcFunctions::secondeg_end (reducac, vinf, lco.aaa, lco.bbb, lco.ccc);//parabolic + ImProcFunctions::secondeg_begin(reducac, vi, lco.aa, lco.bb); //parabolic + ImProcFunctions::secondeg_end(reducac, vinf, lco.aaa, lco.bbb, lco.ccc); //parabolic if (call <= 3) { //simpleprocess, dcrop, improccoordinator bfh = int (lp.ly + lp.lyT) + del; //bfw bfh real size of square zone bfw = int (lp.lx + lp.lxL) + del; - bufcontorig = new LabImage (bfw, bfh);//buffer for data in zone limit + bufcontorig = new LabImage(bfw, bfh); //buffer for data in zone limit buflightc = new float*[bfh];//for lightness curve @@ -7668,7 +8612,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (cL <= 1.f) {//convert data curve near values of slider -100 + 100, to be used after to detection shape clighc = 99.f * cL - 99.f; } else { - clighc = CLIPLIG (amplil * cL - amplil); //arbitrary empirical coefficient between 5 and 150 + clighc = CLIPLIG(amplil * cL - amplil); //arbitrary empirical coefficient between 5 and 150 } /* @@ -7692,7 +8636,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } - Contrast_Local (call, buflightc, hueplus, huemoins, hueref, dhue, chromaref, pm, lco, lumaref, lp, original, transformed, cx, cy); + Contrast_Local(call, buflightc, hueplus, huemoins, hueref, dhue, chromaref, pm, lco, lumaref, lp, original, transformed, cx, cy); if (call <= 3) { @@ -7708,6 +8652,16 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } else if (lp.inv && lp.cont != 0 && lp.colorena) { + float hueplus = hueref + dhue; + float huemoins = hueref - dhue; + + if (hueplus > rtengine::RT_PI) { + hueplus = hueref + dhue - 2.f * rtengine::RT_PI; + } + + if (huemoins < -rtengine::RT_PI) { + huemoins = hueref - dhue + 2.f * rtengine::RT_PI; + } float multL = (float)lp.cont * (maxl - 1.f) / 100.f + 1.f; float multH = (float) lp.cont * (maxh - 1.f) / 100.f + 1.f; @@ -7716,8 +8670,9 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original lco.bh = 1.f - 100.f * lco.ah; lco.al = (multL - 1.f) / av; lco.bl = 1.f; + InverseContrast_Local(ave, lco, lp, hueplus, huemoins, hueref, dhue, chromaref, lumaref, original, transformed, cx, cy); - InverseContrast_Local (ave, lco, lp, original, transformed, cx, cy); + // InverseContrast_Local (ave, lco, lp, original, transformed, cx, cy); } @@ -7750,8 +8705,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original bfw = int (lp.lx + lp.lxL) + del; - bufexporig = new LabImage (bfw, bfh);//buffer for data in zone limit - bufexpfin = new LabImage (bfw, bfh);//buffer for data in zone limit + bufexporig = new LabImage(bfw, bfh); //buffer for data in zone limit + bufexpfin = new LabImage(bfw, bfh); //buffer for data in zone limit buflight = new float*[bfh];//for lightness @@ -7806,7 +8761,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } - ImProcFunctions::exlabLocal (lp, bfh, bfw, bufexporig, bufexpfin, hltonecurveloc, shtonecurveloc, tonecurveloc); + ImProcFunctions::exlabLocal(lp, bfh, bfw, bufexporig, bufexpfin, hltonecurveloc, shtonecurveloc, tonecurveloc); if (exlocalcurve && localexutili) {// L=f(L) curve enhanced #ifdef _OPENMP @@ -7845,7 +8800,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original // float lighL = bufexporig->L[loy - begy][lox - begx]; // float lighLnew = bufexpfin->L[loy - begy][lox - begx]; float rL; - rL = CLIPRET ((bufexpfin->L[loy - begy][lox - begx] - bufexporig->L[loy - begy][lox - begx]) / 328.f); + rL = CLIPRET((bufexpfin->L[loy - begy][lox - begx] - bufexporig->L[loy - begy][lox - begx]) / 328.f); buflight[loy - begy][lox - begx] = rL; @@ -7870,7 +8825,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } // printf ("min=%2.2f max=%2.2f", minc, maxc); - Expose_Local (1, buflight, bufl_ab, hueplus, huemoins, hueref, dhueex, chromaref, lumaref, lp, original, transformed, bufexpfin, cx, cy); + Expose_Local(1, buflight, bufl_ab, hueplus, huemoins, hueref, dhueex, chromaref, lumaref, lp, original, transformed, bufexpfin, cx, cy); } @@ -7927,8 +8882,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original bfw = int (lp.lx + lp.lxL) + del; - bufexporig = new LabImage (bfw, bfh);//buffer for data in zone limit - bufexpfin = new LabImage (bfw, bfh);//buffer for data in zone limit + bufexporig = new LabImage(bfw, bfh); //buffer for data in zone limit + bufexpfin = new LabImage(bfw, bfh); //buffer for data in zone limit buflight = new float*[bfh];//for lightness @@ -7987,7 +8942,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original - ImProcFunctions::vibrancelocal (bfw, bfh, bufexporig, bufexpfin, localskutili, sklocalcurve); + ImProcFunctions::vibrancelocal(bfw, bfh, bufexporig, bufexpfin, localskutili, sklocalcurve); // float maxc = -10000.f; @@ -8010,13 +8965,13 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original // float lighL = bufexporig->L[loy - begy][lox - begx]; // float lighLnew = bufexpfin->L[loy - begy][lox - begx]; float rL; - rL = CLIPRET ((bufexpfin->L[loy - begy][lox - begx] - bufexporig->L[loy - begy][lox - begx]) / 328.f); + rL = CLIPRET((bufexpfin->L[loy - begy][lox - begx] - bufexporig->L[loy - begy][lox - begx]) / 328.f); buflight[loy - begy][lox - begx] = rL; float chp; - chp = CLIPRET ((sqrt (SQR (bufexpfin->a[loy - begy][lox - begx]) + SQR (bufexpfin->b[loy - begy][lox - begx])) - sqrt (SQR (bufexporig->a[loy - begy][lox - begx]) + SQR (bufexporig->b[loy - begy][lox - begx]))) / 250.f); + chp = CLIPRET((sqrt(SQR(bufexpfin->a[loy - begy][lox - begx]) + SQR(bufexpfin->b[loy - begy][lox - begx])) - sqrt(SQR(bufexporig->a[loy - begy][lox - begx]) + SQR(bufexporig->b[loy - begy][lox - begx]))) / 250.f); /* if (chp > maxc) { maxc = chp; @@ -8035,7 +8990,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } // printf ("min=%2.2f max=%2.2f", minc, maxc); - Expose_Local (2, buflight, bufl_ab, hueplus, huemoins, hueref, dhuev, chromaref, lumaref, lp, original, transformed, bufexpfin, cx, cy); + Expose_Local(2, buflight, bufl_ab, hueplus, huemoins, hueref, dhuev, chromaref, lumaref, lp, original, transformed, bufexpfin, cx, cy); } @@ -8074,7 +9029,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (call <= 3) { //simpleprocess dcrop improcc - bufgb = new LabImage (bfw, bfh); + bufgb = new LabImage(bfw, bfh); buflight = new float*[bfh];//for lightness reti for (int i = 0; i < bfh; i++) { @@ -8114,8 +9069,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } } - tmp1 = new LabImage (bfw, bfh); - ImProcFunctions::EPDToneMaplocal (bufgb, tmp1, 5, sk); + tmp1 = new LabImage(bfw, bfh); + ImProcFunctions::EPDToneMaplocal(bufgb, tmp1, 5, sk); } /*else { //stay here in case of tmp = new LabImage (transformed->W, transformed->H); @@ -8152,7 +9107,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - float rL = CLIPRET ((tmp1->L[loy - begy][lox - begx] - original->L[y][x]) / 400.f); + float rL = CLIPRET((tmp1->L[loy - begy][lox - begx] - original->L[y][x]) / 400.f); /* if (rL > maxc) { maxc = rL; @@ -8170,7 +9125,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original // printf ("min=%2.2f max=%2.2f", minc, maxc); - TM_Local (tmp1, buflight, hueplus, huemoins, hueref, dhuetm, chromaref, lumaref, lp, original, transformed, cx, cy); + TM_Local(tmp1, buflight, hueplus, huemoins, hueref, dhuetm, chromaref, lumaref, lp, original, transformed, cx, cy); if (call <= 3) { delete bufgb; @@ -8286,12 +9241,12 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { bufsh[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufchr[loy - begy][lox - begx] = sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x])); + bufchr[loy - begy][lox - begx] = sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])); } } - ImProcFunctions::cbdl_local_temp (bufsh, bufsh, loctemp, bfw, bfh, lp.mulloc, 1.f, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + ImProcFunctions::cbdl_local_temp(bufsh, bufsh, loctemp, bfw, bfh, lp.mulloc, 1.f, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); #ifdef _OPENMP @@ -8305,7 +9260,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { float rL; - rL = CLIPRET ((loctemp[loy - begy][lox - begx] - original->L[y][x]) / 330.f); + rL = CLIPRET((loctemp[loy - begy][lox - begx] - original->L[y][x]) / 330.f); buflight[loy - begy][lox - begx] = rL; @@ -8316,7 +9271,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original - cbdl_Local (buflight, bufchrom, loctemp, loctempch, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy, 0); + cbdl_Local(buflight, bufchrom, loctemp, loctempch, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy, 0); for (int i = 0; i < bfh; i++) { @@ -8343,7 +9298,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } { - ImProcFunctions::cbdl_local_temp (bufchr, bufchr, loctempch, bfw, bfh, multc, lp.chromacb, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + ImProcFunctions::cbdl_local_temp(bufchr, bufchr, loctempch, bfw, bfh, multc, lp.chromacb, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); float rch; @@ -8357,13 +9312,13 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - rch = CLIPRET ((loctempch[loy - begy][lox - begx] - sqrt (SQR (original->a[y][x]) + SQR (original->b[y][x]))) / 200.f); + rch = CLIPRET((loctempch[loy - begy][lox - begx] - sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x]))) / 200.f); bufchrom[loy - begy][lox - begx] = rch; } } } - cbdl_Local (buflight, bufchrom, loctemp, loctempch, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy, 1); + cbdl_Local(buflight, bufchrom, loctemp, loctempch, hueplus, huemoins, hueref, dhuecb, chromaref, lumaref, lp, original, transformed, cx, cy, 1); } for (int i = 0; i < bfh; i++) { @@ -8413,11 +9368,11 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!lp.invshar && lp.shrad > 0.42 && call < 3 && lp.sharpena) { //interior ellipse for sharpening, call = 1 and 2 only with Dcrop and simpleprocess int bfh = call == 2 ? int (lp.ly + lp.lyT) + del : original->H; //bfw bfh real size of square zone int bfw = call == 2 ? int (lp.lx + lp.lxL) + del : original->W; - const JaggedArray loctemp (bfw, bfh); + const JaggedArray loctemp(bfw, bfh); if (call == 2) { //call from simpleprocess - const JaggedArray bufsh (bfw, bfh, true); - const JaggedArray hbuffer (bfw, bfh); + const JaggedArray bufsh(bfw, bfh, true); + const JaggedArray hbuffer(bfw, bfh); int begy = lp.yc - lp.lyT; int begx = lp.xc - lp.lxL; @@ -8441,10 +9396,10 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original // } //sharpen only square area instaed of all image - ImProcFunctions::deconvsharpeningloc (bufsh, hbuffer, bfw, bfh, loctemp, params->locallab.shardamping, (double)params->locallab.sharradius / 100., params->locallab.shariter, params->locallab.sharamount); + ImProcFunctions::deconvsharpeningloc(bufsh, hbuffer, bfw, bfh, loctemp, params->locallab.shardamping, (double)params->locallab.sharradius / 100., params->locallab.shariter, params->locallab.sharamount); } else { //call from dcrop.cc - ImProcFunctions::deconvsharpeningloc (original->L, shbuffer, bfw, bfh, loctemp, params->locallab.shardamping, (double)params->locallab.sharradius / 100., params->locallab.shariter, params->locallab.sharamount); + ImProcFunctions::deconvsharpeningloc(original->L, shbuffer, bfw, bfh, loctemp, params->locallab.shardamping, (double)params->locallab.sharradius / 100., params->locallab.shariter, params->locallab.sharamount); } @@ -8460,14 +9415,14 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } //sharpen ellipse and transition - Sharp_Local (call, loctemp, hueplus, huemoins, hueref, dhuesha, chromaref, lp, original, transformed, cx, cy); + Sharp_Local(call, loctemp, hueplus, huemoins, hueref, dhuesha, chromaref, lp, original, transformed, cx, cy); } else if (lp.invshar && lp.shrad > 0.42 && call < 3 && lp.sharpena) { int GW = original->W; int GH = original->H; - const JaggedArray loctemp (GW, GH); + const JaggedArray loctemp(GW, GH); - ImProcFunctions::deconvsharpeningloc (original->L, shbuffer, GW, GH, loctemp, params->locallab.shardamping, (double)params->locallab.sharradius / 100., params->locallab.shariter, params->locallab.sharamount); + ImProcFunctions::deconvsharpeningloc(original->L, shbuffer, GW, GH, loctemp, params->locallab.shardamping, (double)params->locallab.sharradius / 100., params->locallab.shariter, params->locallab.sharamount); float hueplus = hueref + dhuesha; float huemoins = hueref - dhuesha; @@ -8480,7 +9435,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original huemoins = hueref - dhuesha + 2.f * rtengine::RT_PI; } - InverseSharp_Local (loctemp, hueplus, huemoins, hueref, dhuesha, chromaref, lp, original, transformed, cx, cy); + InverseSharp_Local(loctemp, hueplus, huemoins, hueref, dhuesha, chromaref, lp, original, transformed, cx, cy); } // } @@ -8514,7 +9469,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original Hd = bfh; Wd = bfw; - bufreti = new LabImage (bfw, bfh); + bufreti = new LabImage(bfw, bfh); buflight = new float*[bfh];//for lightness reti for (int i = 0; i < bfh; i++) { @@ -8595,7 +9550,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original orig1[ir][jr] = bufreti->L[ir][jr]; } - tmpl = new LabImage (Wd, Hd); + tmpl = new LabImage(Wd, Hd); } /* else { @@ -8615,7 +9570,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } */ float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - ImProcFunctions::MSRLocal (orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 0, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + ImProcFunctions::MSRLocal(orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 0, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); #ifdef _OPENMP #pragma omp parallel for #endif @@ -8626,7 +9581,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!lp.invret) { float rL; - rL = CLIPRET ((tmpl->L[ir][jr] - bufreti->L[ir][jr]) / 328.f); + rL = CLIPRET((tmpl->L[ir][jr] - bufreti->L[ir][jr]) / 328.f); /* if (rL > maxc) { maxc = rL; @@ -8647,9 +9602,9 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!lp.invret) { - Reti_Local (buflight, bufchro, hueplus, huemoins, hueref, dhueret, chromaref, lumaref, lp, original, transformed, tmpl, cx, cy, 0); + Reti_Local(buflight, bufchro, hueplus, huemoins, hueref, dhueret, chromaref, lumaref, lp, original, transformed, tmpl, cx, cy, 0); } else { - InverseReti_Local (lp, original, transformed, tmpl, cx, cy, 0); + InverseReti_Local(lp, original, transformed, tmpl, cx, cy, 0); } if (params->locallab.chrrt > 0) { @@ -8663,8 +9618,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original for (int ir = 0; ir < Hd; ir += 1) for (int jr = 0; jr < Wd; jr += 1) { - orig[ir][jr] = sqrt (SQR (bufreti->a[ir][jr]) + SQR (bufreti->b[ir][jr])); - orig1[ir][jr] = sqrt (SQR (bufreti->a[ir][jr]) + SQR (bufreti->b[ir][jr])); + orig[ir][jr] = sqrt(SQR(bufreti->a[ir][jr]) + SQR(bufreti->b[ir][jr])); + orig1[ir][jr] = sqrt(SQR(bufreti->a[ir][jr]) + SQR(bufreti->b[ir][jr])); } } /* else { @@ -8680,7 +9635,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original } } */ - ImProcFunctions::MSRLocal (orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + ImProcFunctions::MSRLocal(orig, tmpl->L, orig1, Wd, Hd, params->locallab, sk, locRETgainCcurve, 1, 4, 0.8f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if (!lp.invret && call <= 3) { @@ -8702,7 +9657,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!lp.invret) { float ra; - ra = CLIPRET ((sqrt (SQR (tmpl->a[ir][jr]) + SQR (tmpl->b[ir][jr])) - Chprov) / 300.f); + ra = CLIPRET((sqrt(SQR(tmpl->a[ir][jr]) + SQR(tmpl->b[ir][jr])) - Chprov) / 300.f); /* if (ra > maxch) { maxch = ra; @@ -8741,9 +9696,9 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (!lp.invret) { - Reti_Local (buflight, bufchro, hueplus, huemoins, hueref, dhueret, chromaref, lumaref, lp, original, transformed, tmpl, cx, cy, 1); + Reti_Local(buflight, bufchro, hueplus, huemoins, hueref, dhueret, chromaref, lumaref, lp, original, transformed, tmpl, cx, cy, 1); } else { - InverseReti_Local (lp, original, transformed, tmpl, cx, cy, 1); + InverseReti_Local(lp, original, transformed, tmpl, cx, cy, 1); } } @@ -8774,11 +9729,11 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original // Gamut and Munsell control - very important do not desactivated to avoid crash if (params->locallab.avoid) { - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.working); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.working); float wip[3][3] = { - {static_cast (wiprof[0][0]), static_cast (wiprof[0][1]), static_cast (wiprof[0][2])}, - {static_cast (wiprof[1][0]), static_cast (wiprof[1][1]), static_cast (wiprof[1][2])}, - {static_cast (wiprof[2][0]), static_cast (wiprof[2][1]), static_cast (wiprof[2][2])} + {static_cast(wiprof[0][0]), static_cast(wiprof[0][1]), static_cast(wiprof[0][2])}, + {static_cast(wiprof[1][0]), static_cast(wiprof[1][1]), static_cast(wiprof[1][2])}, + {static_cast(wiprof[2][0]), static_cast(wiprof[2][1]), static_cast(wiprof[2][2])} }; const bool highlight = params->toneCurve.hrenabled; const bool needHH = (lp.chro != 0.f); @@ -8791,8 +9746,8 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float sqrtBuffer[transformed->W] ALIGNED16; float sincosyBuffer[transformed->W] ALIGNED16; float sincosxBuffer[transformed->W] ALIGNED16; - vfloat c327d68v = F2V (327.68f); - vfloat onev = F2V (1.f); + vfloat c327d68v = F2V(327.68f); + vfloat onev = F2V(1.f); #endif #ifdef _OPENMP @@ -8808,22 +9763,22 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original int i = 0; for (; i < transformed->W - 3; i += 4) { - vfloat av = LVFU (transformed->a[y][i]); - vfloat bv = LVFU (transformed->b[y][i]); + vfloat av = LVFU(transformed->a[y][i]); + vfloat bv = LVFU(transformed->b[y][i]); if (needHH) { // only do expensive atan2 calculation if needed - STVF (atan2Buffer[i], xatan2f (bv, av)); + STVF(atan2Buffer[i], xatan2f(bv, av)); } - vfloat Chprov1v = vsqrtf (SQRV (bv) + SQRV (av)); - STVF (sqrtBuffer[i], Chprov1v / c327d68v); + vfloat Chprov1v = vsqrtf(SQRV(bv) + SQRV(av)); + STVF(sqrtBuffer[i], Chprov1v / c327d68v); vfloat sincosyv = av / Chprov1v; vfloat sincosxv = bv / Chprov1v; - vmask selmask = vmaskf_eq (Chprov1v, ZEROV); - sincosyv = vself (selmask, onev, sincosyv); - sincosxv = vselfnotzero (selmask, sincosxv); - STVF (sincosyBuffer[i], sincosyv); - STVF (sincosxBuffer[i], sincosxv); + vmask selmask = vmaskf_eq(Chprov1v, ZEROV); + sincosyv = vself(selmask, onev, sincosyv); + sincosxv = vselfnotzero(selmask, sincosxv); + STVF(sincosyBuffer[i], sincosyv); + STVF(sincosxBuffer[i], sincosxv); } for (; i < transformed->W; i++) { @@ -8831,10 +9786,10 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float bb = transformed->b[y][i]; if (needHH) { // only do expensive atan2 calculation if needed - atan2Buffer[i] = xatan2f (bb, aa); + atan2Buffer[i] = xatan2f(bb, aa); } - float Chprov1 = sqrtf (SQR (bb) + SQR (aa)); + float Chprov1 = sqrtf(SQR(bb) + SQR(aa)); sqrtBuffer[i] = Chprov1 / 327.68f; if (Chprov1 == 0.0f) { @@ -8865,10 +9820,10 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float HH = 0.f, chr = 0.f; if (needHH) { // only do expensive atan2 calculation if needed - HH = xatan2f (bb, aa); + HH = xatan2f(bb, aa); } - float Chprov1 = sqrtf (SQR (aa) + SQR (bb)) / 327.68f; + float Chprov1 = sqrtf(SQR(aa) + SQR(bb)) / 327.68f; if (Chprov1 == 0.0f) { sincosval.y = 1.f; @@ -8884,13 +9839,13 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original bool neg = false; bool more_rgb = false; // Color::pregamutlab (Lprov1, HH, chr); - Chprov1 = min (Chprov1, chr); + Chprov1 = min(Chprov1, chr); - Color::gamutLchonly (sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.92f, neg, more_rgb); + Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.92f, neg, more_rgb); #else - Color::pregamutlab (Lprov1, HH, chr); - Chprov1 = min (Chprov1, chr); - Color::gamutLchonly (sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.92f); + Color::pregamutlab(Lprov1, HH, chr); + Chprov1 = min(Chprov1, chr); + Color::gamutLchonly(sincosval, Lprov1, Chprov1, wip, highlight, 0.15f, 0.92f); #endif transformed->L[y][x] = Lprov1 * 327.68f; @@ -8901,19 +9856,19 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original float Lprov2 = original->L[y][x] / 327.68f; float correctionHue = 0.f; // Munsell's correction float correctlum = 0.f; - float memChprov = sqrtf (SQR (original->a[y][x]) + SQR (original->b[y][x])) / 327.68f; - float Chprov = sqrtf (SQR (transformed->a[y][x]) + SQR (transformed->b[y][x])) / 327.68f; + float memChprov = sqrtf(SQR(original->a[y][x]) + SQR(original->b[y][x])) / 327.68f; + float Chprov = sqrtf(SQR(transformed->a[y][x]) + SQR(transformed->b[y][x])) / 327.68f; #ifdef _DEBUG - Color::AllMunsellLch (true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum, MunsDebugInfo); + Color::AllMunsellLch(true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum, MunsDebugInfo); #else - Color::AllMunsellLch (true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum); + Color::AllMunsellLch(true, Lprov1, Lprov2, HH, Chprov, memChprov, correctionHue, correctlum); #endif - if (fabs (correctionHue) < 0.015f) { + if (fabs(correctionHue) < 0.015f) { HH += correctlum; // correct only if correct Munsell chroma very little. } - float2 sincosval = xsincosf (HH + correctionHue); + float2 sincosval = xsincosf(HH + correctionHue); transformed->a[y][x] = 327.68f * Chprov * sincosval.y; // apply Munsell transformed->b[y][x] = 327.68f * Chprov * sincosval.x; @@ -8928,7 +9883,7 @@ void ImProcFunctions::Lab_Local (int call, float** shbuffer, LabImage * original if (settings->verbose) { t2e.set(); - printf ("Color::AllMunsellLch (correction performed in %d usec):\n", t2e.etime (t1e)); + printf("Color::AllMunsellLch (correction performed in %d usec):\n", t2e.etime(t1e)); // printf(" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad dep=%i\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass); // printf(" Munsell luminance : MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad dep=%i\n", MunsDebugInfo->maxdhuelum[0], MunsDebugInfo->maxdhuelum[1], MunsDebugInfo->maxdhuelum[2], MunsDebugInfo->maxdhuelum[3], MunsDebugInfo->depassLum); } diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 4c0d6c7da..6cfc0f7e5 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -38,98 +38,98 @@ extern Options options; -Locallab::Locallab (): - FoldableToolPanel (this, "locallab", M ("TP_LOCALLAB_LABEL"), false, true), - EditSubscriber (ET_OBJECTS), lastObject (-1), - expcolor (new MyExpander (true, M ("TP_LOCALLAB_COFR"))), - expexpose (new MyExpander (true, M ("TP_LOCALLAB_EXPOSE"))), - expvibrance (new MyExpander (true, M ("TP_LOCALLAB_VIBRANCE"))), - expblur (new MyExpander (true, M ("TP_LOCALLAB_BLUFR"))), - exptonemap (new MyExpander (true, M ("TP_LOCALLAB_TM"))), - expreti (new MyExpander (true, M ("TP_LOCALLAB_RETI"))), - expsharp (new MyExpander (true, M ("TP_LOCALLAB_SHARP"))), - expcbdl (new MyExpander (true, M ("TP_LOCALLAB_CBDL"))), - expdenoi (new MyExpander (true, M ("TP_LOCALLAB_DENOIS"))), - expsettings (new MyExpander (false, M ("TP_LOCALLAB_SETTINGS"))), +Locallab::Locallab(): + FoldableToolPanel(this, "locallab", M("TP_LOCALLAB_LABEL"), true, true), + EditSubscriber(ET_OBJECTS), lastObject(-1), + expcolor(new MyExpander(true, M("TP_LOCALLAB_COFR"))), + expexpose(new MyExpander(true, M("TP_LOCALLAB_EXPOSE"))), + expvibrance(new MyExpander(true, M("TP_LOCALLAB_VIBRANCE"))), + expblur(new MyExpander(true, M("TP_LOCALLAB_BLUFR"))), + exptonemap(new MyExpander(true, M("TP_LOCALLAB_TM"))), + expreti(new MyExpander(true, M("TP_LOCALLAB_RETI"))), + expsharp(new MyExpander(true, M("TP_LOCALLAB_SHARP"))), + expcbdl(new MyExpander(true, M("TP_LOCALLAB_CBDL"))), + expdenoi(new MyExpander(true, M("TP_LOCALLAB_DENOIS"))), + expsettings(new MyExpander(false, M("TP_LOCALLAB_SETTINGS"))), - LocalcurveEditorgainT (new CurveEditorGroup (options.lastlocalCurvesDir, M ("TP_LOCALLAB_TRANSMISSIONGAIN"))), - LocalcurveEditorgainTrab (new CurveEditorGroup (options.lastlocalCurvesDir, M ("TP_LOCALLAB_TRANSMISSIONGAINRAB"))), - llCurveEditorG (new CurveEditorGroup (options.lastlocalCurvesDir, M ("TP_LOCALLAB_LUM"))), + LocalcurveEditorgainT(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONGAIN"))), + LocalcurveEditorgainTrab(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONGAINRAB"))), + llCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_LUM"))), - anbspot (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_ANBSPOT"), 0, 1, 1, 0))), - locX (Gtk::manage (new Adjuster (M ("TP_LOCAL_WIDTH"), 0, 2250, 1, 250))), - locXL (Gtk::manage (new Adjuster (M ("TP_LOCAL_WIDTH_L"), 0, 2250, 1, 250))), - degree (Gtk::manage (new Adjuster (M ("TP_LOCAL_DEGREE"), -180, 180, 1, 0))), - locY (Gtk::manage (new Adjuster (M ("TP_LOCAL_HEIGHT"), 0, 2250, 1, 250))), - locYT (Gtk::manage (new Adjuster (M ("TP_LOCAL_HEIGHT_T"), 0, 2250, 1, 250))), - centerX (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CENTER_X"), -1000, 1000, 1, 0))), - centerY (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))), - circrad (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))), - sensiexclu (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSIEXCLU"), 0, 100, 1, 19))), - struc (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_STRUC"), 0, 400, 1, 0))), - thres (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_THRES"), 1, 35, 1, 18))), - proxi (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_PROXI"), 0, 60, 1, 0))), - lightness (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_LIGHTNESS"), -100, 100, 1, 0))), - contrast (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CONTRAST"), -100, 100, 1, 0))), - chroma (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CHROMA"), -100, 150, 1, 0))), - sensi (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), - expcomp (Gtk::manage (new Adjuster (M ("TP_EXPOSURE_EXPCOMP"), -200, 200, 5, 0))), - hlcompr (Gtk::manage (new Adjuster (M ("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 20))), - hlcomprthresh (Gtk::manage (new Adjuster (M ("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 33))), - black (Gtk::manage (new Adjuster (M ("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 50, 0))), - shcompr (Gtk::manage (new Adjuster (M ("TP_EXPOSURE_COMPRSHADOWS"), 0, 100, 1, 50))), - sensiex (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), - radius (Gtk::manage ( new Adjuster (M ("TP_LOCALLAB_RADIUS"), 1, 100, 1, 1) )), - strength (Gtk::manage ( new Adjuster (M ("TP_LOCALLAB_STRENGTH"), 0, 100, 1, 0) )), - sensibn (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSIBN"), 0, 100, 1, 40))), - transit (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), - stren (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_STREN"), -50, 100, 1, 0))), - gamma (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_GAM"), 80, 150, 1, 100))), - estop (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_ESTOP"), 10, 400, 1, 140))), - scaltm (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SCALTM"), 1, 100, 1, 10))), - rewei (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_REWEI"), 0, 9, 1, 0))), - sensitm (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), - str (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_STR"), 0, 100, 1, 0))), - neigh (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_NEIGH"), 14, 150, 1, 50))), - vart (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_VART"), 50, 500, 1, 200))), - chrrt (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CHRRT"), 0, 100, 1, 0))), - sensih (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSIH"), 0, 100, 1, 19))), - retrab (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_RETRAB"), 0, 10000, 1, 500))), - chromacbdl (Gtk::manage ( new Adjuster (M ("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0) )), - threshold (Gtk::manage ( new Adjuster (M ("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 100, 1, 20) )), - sensicb (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSICB"), 0, 100, 1, 19))), - sharradius (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SHARRADIUS"), 42, 500, 1, 4))), - sharamount (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SHARAMOUNT"), 0, 100, 1, 75))), - shardamping (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SHARDAMPING"), 0, 100, 1, 75))), - shariter (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SHARITER"), 5, 100, 1, 30))), - sensisha (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))), - noiselumf (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_NOISELUMFINE"), 0, 100, 1, 0))), - noiselumc (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_NOISELUMCOARSE"), 0, 100, 1, 0))), - noisechrof (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_NOISECHROFINE"), 0, 100, 1, 0))), - noisechroc (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_NOISECHROCOARSE"), 0, 100, 1, 0))), - hueref (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_HUEREF"), -3.15, 3.15, 0.01, 0))), - chromaref (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CHROMAREF"), 0, 200, 0.01, 0))), - lumaref (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_LUMAMAREF"), 0, 100, 0.01, 0))), - sobelref (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SOBELREF"), 0, 100, 0.01, 0))), - centerXbuf (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CENTERBUF_X"), -1000, 1000, 1, 0))), - centerYbuf (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_CENTERBUF_Y"), -1000, 1000, 1, 0))), - adjblur (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_ADJBLUR"), 0, 100, 1, 0))), + anbspot(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ANBSPOT"), 0, 1, 1, 0))), + locX(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH"), 0, 2250, 1, 250))), + locXL(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH_L"), 0, 2250, 1, 250))), + degree(Gtk::manage(new Adjuster(M("TP_LOCAL_DEGREE"), -180, 180, 1, 0))), + locY(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT"), 0, 2250, 1, 250))), + locYT(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT_T"), 0, 2250, 1, 250))), + centerX(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_X"), -1000, 1000, 1, 0))), + centerY(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))), + circrad(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))), + sensiexclu(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIEXCLU"), 0, 100, 1, 19))), + struc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUC"), 0, 5, 1, 0))), + thres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1, 35, 1, 18))), + proxi(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0, 60, 1, 0))), + lightness(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LIGHTNESS"), -100, 100, 1, 0))), + contrast(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTRAST"), -100, 100, 1, 0))), + chroma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMA"), -100, 150, 1, 0))), + sensi(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), + expcomp(Gtk::manage(new Adjuster(M("TP_EXPOSURE_EXPCOMP"), -200, 200, 5, 0))), + hlcompr(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 20))), + hlcomprthresh(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 33))), + black(Gtk::manage(new Adjuster(M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 50, 0))), + shcompr(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRSHADOWS"), 0, 100, 1, 50))), + sensiex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), + radius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADIUS"), 1, 100, 1, 1))), + strength(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGTH"), 0, 100, 1, 0))), + sensibn(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIBN"), 0, 100, 1, 40))), + transit(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), + stren(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STREN"), -50, 100, 1, 0))), + gamma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAM"), 80, 150, 1, 100))), + estop(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ESTOP"), 10, 400, 1, 140))), + scaltm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCALTM"), 1, 100, 1, 10))), + rewei(Gtk::manage(new Adjuster(M("TP_LOCALLAB_REWEI"), 0, 9, 1, 0))), + sensitm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 19))), + str(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STR"), 0, 100, 1, 0))), + neigh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NEIGH"), 14, 150, 1, 50))), + vart(Gtk::manage(new Adjuster(M("TP_LOCALLAB_VART"), 50, 500, 1, 200))), + chrrt(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHRRT"), 0, 100, 1, 0))), + sensih(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIH"), 0, 100, 1, 19))), + retrab(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RETRAB"), 0, 10000, 1, 500))), + chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0))), + threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 100, 1, 20))), + sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSICB"), 0, 100, 1, 19))), + sharradius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARRADIUS"), 42, 500, 1, 4))), + sharamount(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARAMOUNT"), 0, 100, 1, 75))), + shardamping(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARDAMPING"), 0, 100, 1, 75))), + shariter(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARITER"), 5, 100, 1, 30))), + sensisha(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 19))), + noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), 0, 100, 1, 0))), + noiselumc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMCOARSE"), 0, 100, 1, 0))), + noisechrof(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHROFINE"), 0, 100, 1, 0))), + noisechroc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHROCOARSE"), 0, 100, 1, 0))), + hueref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_HUEREF"), -3.15, 3.15, 0.01, 0))), + chromaref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMAREF"), 0, 200, 0.01, 0))), + lumaref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMAMAREF"), 0, 100, 0.01, 0))), + sobelref(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOBELREF"), 0, 100, 0.01, 0))), + centerXbuf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTERBUF_X"), -1000, 1000, 1, 0))), + centerYbuf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTERBUF_Y"), -1000, 1000, 1, 0))), + adjblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ADJBLUR"), 0, 100, 1, 0))), - Smethod (Gtk::manage (new MyComboBoxText ())), - Exclumethod (Gtk::manage (new MyComboBoxText ())), + Smethod(Gtk::manage(new MyComboBoxText())), + Exclumethod(Gtk::manage(new MyComboBoxText())), - retinexMethod (Gtk::manage (new MyComboBoxText ())), - qualityMethod (Gtk::manage (new MyComboBoxText ())), - qualitycurveMethod (Gtk::manage (new MyComboBoxText ())), - blurMethod (Gtk::manage (new MyComboBoxText ())), - dustMethod (Gtk::manage (new MyComboBoxText ())), + retinexMethod(Gtk::manage(new MyComboBoxText())), + qualityMethod(Gtk::manage(new MyComboBoxText())), + qualitycurveMethod(Gtk::manage(new MyComboBoxText())), + blurMethod(Gtk::manage(new MyComboBoxText())), + dustMethod(Gtk::manage(new MyComboBoxText())), - excluFrame (Gtk::manage (new Gtk::Frame (M ("TP_LOCALLAB_EXCLUF")))), - artifFrame (Gtk::manage (new Gtk::Frame (M ("TP_LOCALLAB_ARTIF")))), - shapeFrame (Gtk::manage (new Gtk::Frame (M ("TP_LOCALLAB_SHFR")))), - superFrame (Gtk::manage (new Gtk::Frame ())), - dustFrame (Gtk::manage (new Gtk::Frame (M ("TP_LOCALLAB_DUST")))), + excluFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_EXCLUF")))), + artifFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_ARTIF")))), + shapeFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SHFR")))), + superFrame(Gtk::manage(new Gtk::Frame())), + dustFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_DUST")))), // artifVBox (Gtk::manage (new Gtk::VBox ())), // shapeVBox (Gtk::manage (new Gtk::VBox ())), @@ -143,44 +143,44 @@ Locallab::Locallab (): // superVBox (Gtk::manage (new Gtk::VBox ())), - labmdh (Gtk::manage (new Gtk::Label (M ("TP_LOCRETI_METHOD") + ":"))), - labqual (Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_QUAL_METHOD") + ":"))), - labqualcurv (Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_QUALCURV_METHOD") + ":"))), - labmS (Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_STYPE") + ":"))), - labmEx (Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_EXCLUTYPE") + ":"))), + labmdh(Gtk::manage(new Gtk::Label(M("TP_LOCRETI_METHOD") + ":"))), + labqual(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_QUAL_METHOD") + ":"))), + labqualcurv(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_QUALCURV_METHOD") + ":"))), + labmS(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_STYPE") + ":"))), + labmEx(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_EXCLUTYPE") + ":"))), - ctboxS (Gtk::manage (new Gtk::HBox ())), - ctboxEx (Gtk::manage (new Gtk::HBox ())), - dhbox (Gtk::manage (new Gtk::HBox ())), - qualbox (Gtk::manage (new Gtk::HBox ())), - qualcurvbox (Gtk::manage (new Gtk::HBox ())), + ctboxS(Gtk::manage(new Gtk::HBox())), + ctboxEx(Gtk::manage(new Gtk::HBox())), + dhbox(Gtk::manage(new Gtk::HBox())), + qualbox(Gtk::manage(new Gtk::HBox())), + qualcurvbox(Gtk::manage(new Gtk::HBox())), - avoid (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_AVOID")))), - activlum (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_ACTIV")))), - invers (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_INVERS")))), - curvactiv (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_CURV")))), - inversrad (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_INVERS")))), - inversret (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_INVERS")))), - inverssha (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_INVERS")))), - cutpast (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_CUTPAST")))), - lastdust (Gtk::manage (new Gtk::CheckButton (M ("TP_LOCALLAB_LASTDUST")))), - draggedPointOldAngle (-1000.) + avoid(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AVOID")))), + activlum(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIV")))), + invers(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), + curvactiv(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CURV")))), + inversrad(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), + inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), + inverssha(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), + cutpast(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CUTPAST")))), + lastdust(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LASTDUST")))), + draggedPointOldAngle(-1000.) { - CurveListener::setMulti (true); + CurveListener::setMulti(true); ProcParams params; - editHBox = Gtk::manage (new Gtk::HBox()); - edit = Gtk::manage (new Gtk::ToggleButton()); - edit->add (*Gtk::manage (new RTImage ("editmodehand.png"))); - edit->set_tooltip_text (M ("EDIT_OBJECT_TOOLTIP")); - editConn = edit->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::editToggled) ); - editHBox->pack_start (*edit, Gtk::PACK_SHRINK, 0); - pack_start (*editHBox, Gtk::PACK_SHRINK, 0); + editHBox = Gtk::manage(new Gtk::HBox()); + edit = Gtk::manage(new Gtk::ToggleButton()); + edit->add(*Gtk::manage(new RTImage("editmodehand.png"))); + edit->set_tooltip_text(M("EDIT_OBJECT_TOOLTIP")); + editConn = edit->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::editToggled)); + editHBox->pack_start(*edit, Gtk::PACK_SHRINK, 0); + pack_start(*editHBox, Gtk::PACK_SHRINK, 0); int realnbspot; realnbspot = options.rtSettings.nspot; - nbspot = Gtk::manage (new Adjuster (M ("TP_LOCALLAB_NBSPOT"), 1, realnbspot, 1, 1)); + nbspot = Gtk::manage(new Adjuster(M("TP_LOCALLAB_NBSPOT"), 1, realnbspot, 1, 1)); if (options.rtSettings.locdelay) { @@ -190,104 +190,104 @@ Locallab::Locallab (): } - nbspot->setAdjusterListener (this); - nbspot->set_tooltip_text (M ("TP_LOCALLAB_NBSPOT_TOOLTIP")); + nbspot->setAdjusterListener(this); + nbspot->set_tooltip_text(M("TP_LOCALLAB_NBSPOT_TOOLTIP")); - anbspot->setAdjusterListener (this); - anbspot->set_tooltip_text (M ("TP_LOCALLAB_ANBSPOT_TOOLTIP")); + anbspot->setAdjusterListener(this); + anbspot->set_tooltip_text(M("TP_LOCALLAB_ANBSPOT_TOOLTIP")); - shapeFrame->set_label_align (0.025, 0.5); + shapeFrame->set_label_align(0.025, 0.5); - expsettings->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expsettings) ); + expsettings->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expsettings)); - expcolor->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expcolor) ); - enablecolorConn = expcolor->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expcolor) ); + expcolor->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expcolor)); + enablecolorConn = expcolor->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expcolor)); - expexpose->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expexpose) ); - enableexposeConn = expexpose->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expexpose) ); + expexpose->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expexpose)); + enableexposeConn = expexpose->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expexpose)); - expvibrance->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expvibrance) ); - enablevibranceConn = expvibrance->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expvibrance) ); + expvibrance->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expvibrance)); + enablevibranceConn = expvibrance->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expvibrance)); - expblur->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expblur) ); - enableblurConn = expblur->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expblur) ); + expblur->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expblur)); + enableblurConn = expblur->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expblur)); - exptonemap->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), exptonemap) ); - enabletonemapConn = exptonemap->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), exptonemap) ); + exptonemap->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), exptonemap)); + enabletonemapConn = exptonemap->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), exptonemap)); - expreti->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expreti) ); - enableretiConn = expreti->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expreti) ); + expreti->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expreti)); + enableretiConn = expreti->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expreti)); - expsharp->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expsharp) ); - enablesharpConn = expsharp->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expsharp) ); + expsharp->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expsharp)); + enablesharpConn = expsharp->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expsharp)); - expcbdl->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expcbdl) ); - enablecbdlConn = expcbdl->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expcbdl) ); + expcbdl->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expcbdl)); + enablecbdlConn = expcbdl->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expcbdl)); - expdenoi->signal_button_release_event().connect_notify ( sigc::bind ( sigc::mem_fun (this, &Locallab::foldAllButMe), expdenoi) ); - enabledenoiConn = expdenoi->signal_enabled_toggled().connect ( sigc::bind ( sigc::mem_fun (this, &Locallab::enableToggled), expdenoi) ); + expdenoi->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expdenoi)); + enabledenoiConn = expdenoi->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expdenoi)); - ctboxEx->pack_start (*labmEx, Gtk::PACK_SHRINK, 4); - ctboxEx->set_tooltip_markup (M ("TP_LOCALLAB_EXCLUTYPE_TOOLTIP")); + ctboxEx->pack_start(*labmEx, Gtk::PACK_SHRINK, 4); + ctboxEx->set_tooltip_markup(M("TP_LOCALLAB_EXCLUTYPE_TOOLTIP")); - Exclumethod->append (M ("TP_LOCALLAB_EXNORM")); - Exclumethod->append (M ("TP_LOCALLAB_EXECLU")); - Exclumethod->set_active (0); - Exclumethodconn = Exclumethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::ExclumethodChanged) ); + Exclumethod->append(M("TP_LOCALLAB_EXNORM")); + Exclumethod->append(M("TP_LOCALLAB_EXECLU")); + Exclumethod->set_active(0); + Exclumethodconn = Exclumethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::ExclumethodChanged)); - sensiexclu->set_tooltip_text (M ("TP_LOCALLAB_SENSIEXCLU_TOOLTIP")); - sensiexclu->setAdjusterListener (this); + sensiexclu->set_tooltip_text(M("TP_LOCALLAB_SENSIEXCLU_TOOLTIP")); + sensiexclu->setAdjusterListener(this); - struc->set_tooltip_text (M ("TP_LOCALLAB_STRUC_TOOLTIP")); - struc->setAdjusterListener (this); + struc->set_tooltip_text(M("TP_LOCALLAB_STRUC_TOOLTIP")); + struc->setAdjusterListener(this); - ctboxS->pack_start (*labmS, Gtk::PACK_SHRINK, 4); - ctboxS->set_tooltip_markup (M ("TP_LOCALLAB_STYPE_TOOLTIP")); + ctboxS->pack_start(*labmS, Gtk::PACK_SHRINK, 4); + ctboxS->set_tooltip_markup(M("TP_LOCALLAB_STYPE_TOOLTIP")); - Smethod->append (M ("TP_LOCALLAB_IND")); - Smethod->append (M ("TP_LOCALLAB_SYM")); - Smethod->append (M ("TP_LOCALLAB_INDSL")); - Smethod->append (M ("TP_LOCALLAB_SYMSL")); - Smethod->set_active (0); - Smethodconn = Smethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::SmethodChanged) ); + Smethod->append(M("TP_LOCALLAB_IND")); + Smethod->append(M("TP_LOCALLAB_SYM")); + Smethod->append(M("TP_LOCALLAB_INDSL")); + Smethod->append(M("TP_LOCALLAB_SYMSL")); + Smethod->set_active(0); + Smethodconn = Smethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::SmethodChanged)); //locX->set_tooltip_text (M("TP_LOCAL_WIDTH_TOOLTIP")); - locX->setAdjusterListener (this); + locX->setAdjusterListener(this); //locX->set_tooltip_text (M("TP_LOCAL_WIDTH_TOOLTIP")); - locXL->setAdjusterListener (this); + locXL->setAdjusterListener(this); //degree->set_tooltip_text (M("TP_LOCAL_DEGREE_TOOLTIP")); - degree->setAdjusterListener (this); + degree->setAdjusterListener(this); //locY->set_tooltip_text (M("TP_LOCAL_HEIGHT_TOOLTIP")); - locY->setAdjusterListener (this); + locY->setAdjusterListener(this); //locY->set_tooltip_text (M("TP_LOCAL_HEIGHT_TOOLTIP")); - locYT->setAdjusterListener (this); + locYT->setAdjusterListener(this); //centerX->set_tooltip_text (M("TP_LOCALLAB_CENTER_X_TOOLTIP")); - centerX->setAdjusterListener (this); + centerX->setAdjusterListener(this); //centerY->set_tooltip_text (M("TP_LOCALLAB_CENTER_Y_TOOLTIP")); - centerY->setAdjusterListener (this); + centerY->setAdjusterListener(this); - circrad->setAdjusterListener (this); + circrad->setAdjusterListener(this); - qualityMethod->append (M ("TP_LOCALLAB_STD")); - qualityMethod->append (M ("TP_LOCALLAB_ENH")); - qualityMethod->append (M ("TP_LOCALLAB_ENHDEN")); - qualityMethod->set_active (0); - qualityMethodConn = qualityMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::qualityMethodChanged) ); - qualityMethod->set_tooltip_markup (M ("TP_LOCALLAB_METHOD_TOOLTIP")); + qualityMethod->append(M("TP_LOCALLAB_STD")); + qualityMethod->append(M("TP_LOCALLAB_ENH")); + qualityMethod->append(M("TP_LOCALLAB_ENHDEN")); + qualityMethod->set_active(0); + qualityMethodConn = qualityMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::qualityMethodChanged)); + qualityMethod->set_tooltip_markup(M("TP_LOCALLAB_METHOD_TOOLTIP")); - thres->setAdjusterListener (this); + thres->setAdjusterListener(this); - proxi->setAdjusterListener (this); + proxi->setAdjusterListener(this); std::vector milestones; std::vector defaultCurve; std::vector defaultCurve2; @@ -296,75 +296,75 @@ Locallab::Locallab (): std::vector defaultCurve4; std::vector defaultCurve5; - irg = Gtk::manage (new RTImage ("Chanmixer-RG.png")); + irg = Gtk::manage(new RTImage("Chanmixer-RG.png")); - qualitycurveMethod->append (M ("TP_LOCALLAB_CURVNONE")); - qualitycurveMethod->append (M ("TP_LOCALLAB_CURVCURR")); - qualitycurveMethod->append (M ("TP_LOCALLAB_CURVENH")); - qualitycurveMethod->set_active (0); - qualitycurveMethodConn = qualitycurveMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::qualitycurveMethodChanged) ); - qualitycurveMethod->set_tooltip_markup (M ("TP_LOCALLAB_CURVEMETHOD_TOOLTIP")); + qualitycurveMethod->append(M("TP_LOCALLAB_CURVNONE")); + qualitycurveMethod->append(M("TP_LOCALLAB_CURVCURR")); + qualitycurveMethod->append(M("TP_LOCALLAB_CURVENH")); + qualitycurveMethod->set_active(0); + qualitycurveMethodConn = qualitycurveMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::qualitycurveMethodChanged)); + qualitycurveMethod->set_tooltip_markup(M("TP_LOCALLAB_CURVEMETHOD_TOOLTIP")); - llCurveEditorG->setCurveListener (this); + llCurveEditorG->setCurveListener(this); - rtengine::LocallabParams::getDefaultLLCurve (defaultCurve); - llshape = static_cast (llCurveEditorG->addCurve (CT_Diagonal, "L(L)")); - llshape->setResetCurve (DiagonalCurveType (defaultCurve.at (0)), defaultCurve); - llshape->setTooltip (M ("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); - milestones.push_back ( GradientMilestone (0., 0., 0., 0.) ); - milestones.push_back ( GradientMilestone (1., 1., 1., 1.) ); - llshape->setBottomBarBgGradient (milestones); - llshape->setLeftBarBgGradient (milestones); + rtengine::LocallabParams::getDefaultLLCurve(defaultCurve); + llshape = static_cast(llCurveEditorG->addCurve(CT_Diagonal, "L(L)")); + llshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + llshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); + milestones.push_back(GradientMilestone(0., 0., 0., 0.)); + milestones.push_back(GradientMilestone(1., 1., 1., 1.)); + llshape->setBottomBarBgGradient(milestones); + llshape->setLeftBarBgGradient(milestones); - rtengine::LocallabParams::getDefaultCCCurve (defaultCurve4); - ccshape = static_cast (llCurveEditorG->addCurve (CT_Diagonal, "C(C)")); - ccshape->setResetCurve (DiagonalCurveType (defaultCurve4.at (0)), defaultCurve4); - ccshape->setTooltip (M ("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); - milestones.push_back ( GradientMilestone (0., 0., 0., 0.) ); - milestones.push_back ( GradientMilestone (1., 1., 1., 1.) ); - ccshape->setBottomBarBgGradient (milestones); - ccshape->setLeftBarBgGradient (milestones); + rtengine::LocallabParams::getDefaultCCCurve(defaultCurve4); + ccshape = static_cast(llCurveEditorG->addCurve(CT_Diagonal, "C(C)")); + ccshape->setResetCurve(DiagonalCurveType(defaultCurve4.at(0)), defaultCurve4); + ccshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); + milestones.push_back(GradientMilestone(0., 0., 0., 0.)); + milestones.push_back(GradientMilestone(1., 1., 1., 1.)); + ccshape->setBottomBarBgGradient(milestones); + ccshape->setLeftBarBgGradient(milestones); - rtengine::LocallabParams::getDefaultLHCurve (defaultCurve3); + rtengine::LocallabParams::getDefaultLHCurve(defaultCurve3); - LHshape = static_cast (llCurveEditorG->addCurve (CT_Flat, "L(H)", nullptr, false, true)); + LHshape = static_cast(llCurveEditorG->addCurve(CT_Flat, "L(H)", nullptr, false, true)); - LHshape->setIdentityValue (0.); - LHshape->setResetCurve (FlatCurveType (defaultCurve3.at (0)), defaultCurve3); - LHshape->setTooltip (M ("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); - LHshape->setCurveColorProvider (this, 1); + LHshape->setIdentityValue(0.); + LHshape->setResetCurve(FlatCurveType(defaultCurve3.at(0)), defaultCurve3); + LHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); + LHshape->setCurveColorProvider(this, 1); milestones.clear(); for (int i = 0; i < 7; i++) { float R, G, B; float x = float (i) * (1.0f / 6.0); - Color::hsv2rgb01 (x, 0.5f, 0.5f, R, G, B); - milestones.push_back ( GradientMilestone (double (x), double (R), double (G), double (B)) ); + Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); + milestones.push_back(GradientMilestone(double (x), double (R), double (G), double (B))); } - LHshape->setBottomBarBgGradient (milestones); + LHshape->setBottomBarBgGradient(milestones); - rtengine::LocallabParams::getDefaultHHCurve (defaultCurve5); + rtengine::LocallabParams::getDefaultHHCurve(defaultCurve5); - HHshape = static_cast (llCurveEditorG->addCurve (CT_Flat, "H(H)", nullptr, false, true)); + HHshape = static_cast(llCurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true)); - HHshape->setIdentityValue (0.); - HHshape->setResetCurve (FlatCurveType (defaultCurve5.at (0)), defaultCurve5); - HHshape->setTooltip (M ("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); - HHshape->setCurveColorProvider (this, 1); + HHshape->setIdentityValue(0.); + HHshape->setResetCurve(FlatCurveType(defaultCurve5.at(0)), defaultCurve5); + HHshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); + HHshape->setCurveColorProvider(this, 1); milestones.clear(); for (int i = 0; i < 7; i++) { float R, G, B; float x = float (i) * (1.0f / 6.0); - Color::hsv2rgb01 (x, 0.5f, 0.5f, R, G, B); - milestones.push_back ( GradientMilestone (double (x), double (R), double (G), double (B)) ); + Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); + milestones.push_back(GradientMilestone(double (x), double (R), double (G), double (B))); } - HHshape->setBottomBarBgGradient (milestones); + HHshape->setBottomBarBgGradient(milestones); llCurveEditorG->curveListComplete(); @@ -372,124 +372,124 @@ Locallab::Locallab (): //lightness->set_tooltip_text (M("TP_LOCALLAB_LIGHTNESS_TOOLTIP")); - lightness->setAdjusterListener (this); + lightness->setAdjusterListener(this); //contrast->set_tooltip_text (M("TP_LOCALLAB_CONTRAST_TOOLTIP")); - contrast->setAdjusterListener (this); + contrast->setAdjusterListener(this); //chroma->set_tooltip_text (M("TP_LOCALLAB_CHROMA_TOOLTIP")); - chroma->setAdjusterListener (this); + chroma->setAdjusterListener(this); - sensi->set_tooltip_text (M ("TP_LOCALLAB_SENSI_TOOLTIP")); - sensi->setAdjusterListener (this); + sensi->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); + sensi->setAdjusterListener(this); - centerXbuf->setAdjusterListener (this);; - centerYbuf->setAdjusterListener (this);; - adjblur->setAdjusterListener (this);; + centerXbuf->setAdjusterListener(this);; + centerYbuf->setAdjusterListener(this);; + adjblur->setAdjusterListener(this);; //exposure - expcomp->setAdjusterListener (this); - hlcomprthresh->setAdjusterListener (this); - black->setAdjusterListener (this); - hlcompr->setAdjusterListener (this); - shcompr->setAdjusterListener (this); - sensiex->set_tooltip_text (M ("TP_LOCALLAB_SENSI_TOOLTIP")); - sensiex->setAdjusterListener (this); + expcomp->setAdjusterListener(this); + hlcomprthresh->setAdjusterListener(this); + black->setAdjusterListener(this); + hlcompr->setAdjusterListener(this); + shcompr->setAdjusterListener(this); + sensiex->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); + sensiex->setAdjusterListener(this); //radius->set_tooltip_text (M("TP_LOCALLAB_RADIUS_TOOLTIP")); - radius->setAdjusterListener (this); + radius->setAdjusterListener(this); //radius->set_tooltip_text (M("TP_LOCALLAB_RADIUS_TOOLTIP")); - strength->setAdjusterListener (this); + strength->setAdjusterListener(this); - sensibn->set_tooltip_text (M ("TP_LOCALLAB_SENSIH_TOOLTIP")); - sensibn->setAdjusterListener (this); + sensibn->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); + sensibn->setAdjusterListener(this); - activlum->set_active (false); - activlumConn = activlum->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::activlumChanged) ); + activlum->set_active(false); + activlumConn = activlum->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::activlumChanged)); - transit->set_tooltip_text (M ("TP_LOCALLAB_TRANSIT_TOOLTIP")); - transit->setAdjusterListener (this); + transit->set_tooltip_text(M("TP_LOCALLAB_TRANSIT_TOOLTIP")); + transit->setAdjusterListener(this); - invers->set_active (false); - inversConn = invers->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::inversChanged) ); + invers->set_active(false); + inversConn = invers->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversChanged)); - curvactiv->set_active (false); - curvactivConn = curvactiv->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::curvactivChanged) ); + curvactiv->set_active(false); + curvactivConn = curvactiv->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::curvactivChanged)); - inversrad->set_active (false); - inversradConn = inversrad->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::inversradChanged) ); + inversrad->set_active(false); + inversradConn = inversrad->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversradChanged)); - inversret->set_active (false); - inversretConn = inversret->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::inversretChanged) ); + inversret->set_active(false); + inversretConn = inversret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversretChanged)); - cutpast->set_active (false); - cutpastConn = cutpast->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::cutpastChanged) ); - cutpast->set_tooltip_text (M ("TP_LOCALLAB_CUTPAST_TOOLTIP")); + cutpast->set_active(false); + cutpastConn = cutpast->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::cutpastChanged)); + cutpast->set_tooltip_text(M("TP_LOCALLAB_CUTPAST_TOOLTIP")); //tone mapping local - lastdust->set_active (false); - lastdustConn = lastdust->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::lastdustChanged) ); - lastdust->set_tooltip_text (M ("TP_LOCALLAB_LASTDUST_TOOLTIP")); + lastdust->set_active(false); + lastdustConn = lastdust->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::lastdustChanged)); + lastdust->set_tooltip_text(M("TP_LOCALLAB_LASTDUST_TOOLTIP")); - stren->setAdjusterListener (this); + stren->setAdjusterListener(this); - gamma->setAdjusterListener (this); + gamma->setAdjusterListener(this); - estop->setAdjusterListener (this); + estop->setAdjusterListener(this); - scaltm->setAdjusterListener (this); + scaltm->setAdjusterListener(this); - rewei->setAdjusterListener (this); + rewei->setAdjusterListener(this); - sensitm->set_tooltip_text (M ("TP_LOCALLAB_SENSI_TOOLTIP")); - sensitm->setAdjusterListener (this); + sensitm->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); + sensitm->setAdjusterListener(this); //end TM //retinex local - dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); + dhbox->pack_start(*labmdh, Gtk::PACK_SHRINK, 1); - retinexMethod->append (M ("TP_RETINEX_LOW")); - retinexMethod->append (M ("TP_RETINEX_UNIFORM")); - retinexMethod->append (M ("TP_RETINEX_HIGH")); - retinexMethod->set_active (0); - retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::retinexMethodChanged) ); - retinexMethod->set_tooltip_markup (M ("TP_LOCRETI_METHOD_TOOLTIP")); + retinexMethod->append(M("TP_RETINEX_LOW")); + retinexMethod->append(M("TP_RETINEX_UNIFORM")); + retinexMethod->append(M("TP_RETINEX_HIGH")); + retinexMethod->set_active(0); + retinexMethodConn = retinexMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::retinexMethodChanged)); + retinexMethod->set_tooltip_markup(M("TP_LOCRETI_METHOD_TOOLTIP")); - str->setAdjusterListener (this); - neigh->setAdjusterListener (this); - vart->setAdjusterListener (this); - chrrt->setAdjusterListener (this); - sensih->set_tooltip_text (M ("TP_LOCALLAB_SENSIH_TOOLTIP")); - sensih->setAdjusterListener (this); - retrab->setAdjusterListener (this); + str->setAdjusterListener(this); + neigh->setAdjusterListener(this); + vart->setAdjusterListener(this); + chrrt->setAdjusterListener(this); + sensih->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); + sensih->setAdjusterListener(this); + retrab->setAdjusterListener(this); - LocalcurveEditorgainT->setCurveListener (this); - rtengine::LocallabParams::getDefaultLocalgainCurveT (defaultCurve2); + LocalcurveEditorgainT->setCurveListener(this); + rtengine::LocallabParams::getDefaultLocalgainCurveT(defaultCurve2); - cTgainshape = static_cast (LocalcurveEditorgainT->addCurve (CT_Flat, "", nullptr, false, false)); + cTgainshape = static_cast(LocalcurveEditorgainT->addCurve(CT_Flat, "", nullptr, false, false)); - cTgainshape->setIdentityValue (0.); - cTgainshape->setResetCurve (FlatCurveType (defaultCurve2.at (0)), defaultCurve2); - cTgainshape->setTooltip (M ("TP_RETINEX_GAINTRANSMISSION_TOOLTIP")); + cTgainshape->setIdentityValue(0.); + cTgainshape->setResetCurve(FlatCurveType(defaultCurve2.at(0)), defaultCurve2); + cTgainshape->setTooltip(M("TP_RETINEX_GAINTRANSMISSION_TOOLTIP")); - LocalcurveEditorgainTrab->setCurveListener (this); + LocalcurveEditorgainTrab->setCurveListener(this); - rtengine::LocallabParams::getDefaultLocalgainCurveTrab (defaultCurve2rab); + rtengine::LocallabParams::getDefaultLocalgainCurveTrab(defaultCurve2rab); - cTgainshaperab = static_cast (LocalcurveEditorgainTrab->addCurve (CT_Flat, "", nullptr, false, false)); + cTgainshaperab = static_cast(LocalcurveEditorgainTrab->addCurve(CT_Flat, "", nullptr, false, false)); - cTgainshaperab->setIdentityValue (0.); - cTgainshaperab->setResetCurve (FlatCurveType (defaultCurve2rab.at (0)), defaultCurve2rab); - cTgainshaperab->setTooltip (M ("TP_RETINEX_GAINTRANSMISSIONRAB_TOOLTIP")); + cTgainshaperab->setIdentityValue(0.); + cTgainshaperab->setResetCurve(FlatCurveType(defaultCurve2rab.at(0)), defaultCurve2rab); + cTgainshaperab->setTooltip(M("TP_RETINEX_GAINTRANSMISSIONRAB_TOOLTIP")); LocalcurveEditorgainT->curveListComplete(); LocalcurveEditorgainT->show(); @@ -498,193 +498,193 @@ Locallab::Locallab (): // end reti - ToolParamBlock* const shapeBox = Gtk::manage (new ToolParamBlock()); - avoid->set_active (false); - avoidConn = avoid->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::avoidChanged) ); - shapeBox->pack_start (*nbspot); - pack_start (*anbspot); + ToolParamBlock* const shapeBox = Gtk::manage(new ToolParamBlock()); + avoid->set_active(false); + avoidConn = avoid->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::avoidChanged)); + shapeBox->pack_start(*nbspot); + pack_start(*anbspot); - hueref->setAdjusterListener (this); - chromaref->setAdjusterListener (this); - lumaref->setAdjusterListener (this); - sobelref->setAdjusterListener (this); + hueref->setAdjusterListener(this); + chromaref->setAdjusterListener(this); + lumaref->setAdjusterListener(this); + sobelref->setAdjusterListener(this); - pack_start (*hueref); - pack_start (*chromaref); - pack_start (*lumaref); - pack_start (*sobelref); + pack_start(*hueref); + pack_start(*chromaref); + pack_start(*lumaref); + pack_start(*sobelref); anbspot->hide();//keep anbspot - i used it to test diffrent algo... hueref->hide(); chromaref->hide(); lumaref->hide(); sobelref->hide(); - ctboxEx->pack_start (*Exclumethod); - shapeBox->pack_start (*ctboxEx); + ctboxEx->pack_start(*Exclumethod); + shapeBox->pack_start(*ctboxEx); - excluFrame->set_label_align (0.025, 0.5); - excluFrame->set_tooltip_text (M ("TP_LOCALLAB_EXCLUF_TOOLTIP")); - ToolParamBlock* const excluBox = Gtk::manage (new ToolParamBlock()); + excluFrame->set_label_align(0.025, 0.5); + excluFrame->set_tooltip_text(M("TP_LOCALLAB_EXCLUF_TOOLTIP")); + ToolParamBlock* const excluBox = Gtk::manage(new ToolParamBlock()); - excluBox->pack_start (*sensiexclu); -// excluBox->pack_start (*struc); - excluFrame->add (*excluBox); - shapeBox->pack_start (*excluFrame); + excluBox->pack_start(*sensiexclu); + //excluBox->pack_start (*struc); + excluFrame->add(*excluBox); + shapeBox->pack_start(*excluFrame); - ctboxS->pack_start (*Smethod); - shapeBox->pack_start (*ctboxS); + ctboxS->pack_start(*Smethod); + shapeBox->pack_start(*ctboxS); - shapeBox->pack_start (*locX); - shapeBox->pack_start (*locXL); + shapeBox->pack_start(*locX); + shapeBox->pack_start(*locXL); //pack_start (*degree); - shapeBox->pack_start (*locY); - shapeBox->pack_start (*locYT); - shapeBox->pack_start (*centerX); - shapeBox->pack_start (*centerY); - shapeBox->pack_start (*circrad); - qualbox->pack_start (*labqual, Gtk::PACK_SHRINK, 4); - qualbox->pack_start (*qualityMethod); - shapeBox->pack_start (*qualbox); - shapeBox->pack_start (*transit); + shapeBox->pack_start(*locY); + shapeBox->pack_start(*locYT); + shapeBox->pack_start(*centerX); + shapeBox->pack_start(*centerY); + shapeBox->pack_start(*circrad); + qualbox->pack_start(*labqual, Gtk::PACK_SHRINK, 4); + qualbox->pack_start(*qualityMethod); + shapeBox->pack_start(*qualbox); + shapeBox->pack_start(*transit); - artifFrame->set_label_align (0.025, 0.5); - artifFrame->set_tooltip_text (M ("TP_LOCALLAB_ARTIF_TOOLTIP")); + artifFrame->set_label_align(0.025, 0.5); + artifFrame->set_tooltip_text(M("TP_LOCALLAB_ARTIF_TOOLTIP")); - ToolParamBlock* const artifBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const artifBox = Gtk::manage(new ToolParamBlock()); - artifBox->pack_start (*thres); - artifBox->pack_start (*proxi); - artifFrame->add (*artifBox); - shapeBox->pack_start (*artifFrame); + artifBox->pack_start(*thres); + artifBox->pack_start(*proxi); + artifFrame->add(*artifBox); + shapeBox->pack_start(*artifFrame); - expsettings->add (*shapeBox); - expsettings->setLevel (2); - pack_start (*expsettings); + expsettings->add(*shapeBox); + expsettings->setLevel(2); + pack_start(*expsettings); - Gtk::HBox * buttonBox1 = Gtk::manage (new Gtk::HBox (true, 10)); + Gtk::HBox * buttonBox1 = Gtk::manage(new Gtk::HBox(true, 10)); - Gtk::Button * lumacontrastMinusButton = Gtk::manage (new Gtk::Button (M ("TP_DIRPYREQUALIZER_LUMACONTRAST_MINUS"))); - buttonBox1->pack_start (*lumacontrastMinusButton); - lumacontrastMinusPressedConn = lumacontrastMinusButton->signal_pressed().connect ( sigc::mem_fun (*this, &Locallab::lumacontrastMinusPressed)); + Gtk::Button * lumacontrastMinusButton = Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_MINUS"))); + buttonBox1->pack_start(*lumacontrastMinusButton); + lumacontrastMinusPressedConn = lumacontrastMinusButton->signal_pressed().connect(sigc::mem_fun(*this, &Locallab::lumacontrastMinusPressed)); - Gtk::Button * lumaneutralButton = Gtk::manage (new Gtk::Button (M ("TP_DIRPYREQUALIZER_LUMANEUTRAL"))); - buttonBox1->pack_start (*lumaneutralButton); - lumaneutralPressedConn = lumaneutralButton->signal_pressed().connect ( sigc::mem_fun (*this, &Locallab::lumaneutralPressed)); + Gtk::Button * lumaneutralButton = Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMANEUTRAL"))); + buttonBox1->pack_start(*lumaneutralButton); + lumaneutralPressedConn = lumaneutralButton->signal_pressed().connect(sigc::mem_fun(*this, &Locallab::lumaneutralPressed)); - Gtk::Button * lumacontrastPlusButton = Gtk::manage (new Gtk::Button (M ("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS"))); - buttonBox1->pack_start (*lumacontrastPlusButton); - lumacontrastPlusPressedConn = lumacontrastPlusButton->signal_pressed().connect ( sigc::mem_fun (*this, &Locallab::lumacontrastPlusPressed)); - ToolParamBlock* const cbdlBox = Gtk::manage (new ToolParamBlock()); + Gtk::Button * lumacontrastPlusButton = Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS"))); + buttonBox1->pack_start(*lumacontrastPlusButton); + lumacontrastPlusPressedConn = lumacontrastPlusButton->signal_pressed().connect(sigc::mem_fun(*this, &Locallab::lumacontrastPlusPressed)); + ToolParamBlock* const cbdlBox = Gtk::manage(new ToolParamBlock()); - cbdlBox->pack_start (*buttonBox1); + cbdlBox->pack_start(*buttonBox1); for (int i = 0; i < 5; i++) { Glib::ustring ss; - ss = Glib::ustring::format (i); + ss = Glib::ustring::format(i); - if (i == 0) { - ss += Glib::ustring::compose (" (%1)", M ("TP_DIRPYREQUALIZER_LUMAFINEST")); + if (i == 0) { + ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMAFINEST")); } else if (i == 4) { - ss += Glib::ustring::compose (" (%1)", M ("TP_DIRPYREQUALIZER_LUMACOARSEST")); + ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMACOARSEST")); } - multiplier[i] = Gtk::manage ( new Adjuster (ss, 0, 400, 1, 100) ); - multiplier[i]->setAdjusterListener (this); - cbdlBox->pack_start (*multiplier[i]); + multiplier[i] = Gtk::manage(new Adjuster(ss, 0, 400, 1, 100)); + multiplier[i]->setAdjusterListener(this); + cbdlBox->pack_start(*multiplier[i]); } - Gtk::HSeparator *separator3 = Gtk::manage (new Gtk::HSeparator()); - cbdlBox->pack_start (*separator3, Gtk::PACK_SHRINK, 2); + Gtk::HSeparator *separator3 = Gtk::manage(new Gtk::HSeparator()); + cbdlBox->pack_start(*separator3, Gtk::PACK_SHRINK, 2); - chromacbdl->set_tooltip_text (M ("TP_LOCALLAB_CHROMACB_TOOLTIP")); + chromacbdl->set_tooltip_text(M("TP_LOCALLAB_CHROMACB_TOOLTIP")); - chromacbdl->setAdjusterListener (this); - cbdlBox->pack_start (*chromacbdl); + chromacbdl->setAdjusterListener(this); + cbdlBox->pack_start(*chromacbdl); - threshold->setAdjusterListener (this); - cbdlBox->pack_start (*threshold); + threshold->setAdjusterListener(this); + cbdlBox->pack_start(*threshold); - sensicb->set_tooltip_text (M ("TP_LOCALLAB_SENSIH_TOOLTIP")); - sensicb->setAdjusterListener (this); - cbdlBox->pack_start (*sensicb); + sensicb->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); + sensicb->setAdjusterListener(this); + cbdlBox->pack_start(*sensicb); - sharradius->setAdjusterListener (this); + sharradius->setAdjusterListener(this); - sharamount->setAdjusterListener (this); + sharamount->setAdjusterListener(this); - shardamping->setAdjusterListener (this); + shardamping->setAdjusterListener(this); - shariter->setAdjusterListener (this); + shariter->setAdjusterListener(this); - sensisha->set_tooltip_text (M ("TP_LOCALLAB_SENSIS_TOOLTIP")); - sensisha->setAdjusterListener (this); + sensisha->set_tooltip_text(M("TP_LOCALLAB_SENSIS_TOOLTIP")); + sensisha->setAdjusterListener(this); - inverssha->set_active (false); - inversshaConn = inverssha->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::inversshaChanged) ); - ToolParamBlock* const sharpBox = Gtk::manage (new ToolParamBlock()); + inverssha->set_active(false); + inversshaConn = inverssha->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversshaChanged)); + ToolParamBlock* const sharpBox = Gtk::manage(new ToolParamBlock()); - sharpBox->pack_start (*sharradius); - sharpBox->pack_start (*sharamount); - sharpBox->pack_start (*shardamping); - sharpBox->pack_start (*shariter); - sharpBox->pack_start (*sensisha); - sharpBox->pack_start (*inverssha); + sharpBox->pack_start(*sharradius); + sharpBox->pack_start(*sharamount); + sharpBox->pack_start(*shardamping); + sharpBox->pack_start(*shariter); + sharpBox->pack_start(*sensisha); + sharpBox->pack_start(*inverssha); - noiselumf->setAdjusterListener (this); + noiselumf->setAdjusterListener(this); - noiselumc->setAdjusterListener (this); + noiselumc->setAdjusterListener(this); - noisechrof->setAdjusterListener (this); + noisechrof->setAdjusterListener(this); - noisechroc->setAdjusterListener (this); - ToolParamBlock* const denoisBox = Gtk::manage (new ToolParamBlock()); + noisechroc->setAdjusterListener(this); + ToolParamBlock* const denoisBox = Gtk::manage(new ToolParamBlock()); - denoisBox->pack_start (*noiselumf); - denoisBox->pack_start (*noiselumc); - denoisBox->pack_start (*noisechrof); - denoisBox->pack_start (*noisechroc); + denoisBox->pack_start(*noiselumf); + denoisBox->pack_start(*noiselumc); + denoisBox->pack_start(*noisechrof); + denoisBox->pack_start(*noisechroc); - neutrHBox1 = Gtk::manage (new Gtk::HBox ()); + neutrHBox1 = Gtk::manage(new Gtk::HBox()); - neutral1 = Gtk::manage (new Gtk::Button (M ("TP_LOCALLAB_NEUTRAL"))); - RTImage *resetImg1 = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); - neutral1->set_image (*resetImg1); - neutral1->set_tooltip_text (M ("TP_LOCALLAB_NEUTRAL_TIP")); - neutralconn1 = neutral1->signal_pressed().connect ( sigc::mem_fun (*this, &Locallab::neutral_pressed) ); + neutral1 = Gtk::manage(new Gtk::Button(M("TP_LOCALLAB_NEUTRAL"))); + RTImage *resetImg1 = Gtk::manage(new RTImage("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); + neutral1->set_image(*resetImg1); + neutral1->set_tooltip_text(M("TP_LOCALLAB_NEUTRAL_TIP")); + neutralconn1 = neutral1->signal_pressed().connect(sigc::mem_fun(*this, &Locallab::neutral_pressed)); neutral1->show(); - neutrHBox1->pack_start (*neutral1); - pack_start (*neutrHBox1); + neutrHBox1->pack_start(*neutral1); + pack_start(*neutrHBox1); - superFrame->set_label_align (0.025, 0.5); + superFrame->set_label_align(0.025, 0.5); // Gtk::VBox *superVBox = Gtk::manage ( new Gtk::VBox()); - ToolParamBlock* const superBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const superBox = Gtk::manage(new ToolParamBlock()); - superFrame->set_label_widget (*curvactiv); - ToolParamBlock* const colorBox = Gtk::manage (new ToolParamBlock()); + superFrame->set_label_widget(*curvactiv); + ToolParamBlock* const colorBox = Gtk::manage(new ToolParamBlock()); // ToolParamBlock* const dustBox = Gtk::manage (new ToolParamBlock()); - dustMethod->append (M ("TP_LOCALLAB_DSCOP")); - dustMethod->append (M ("TP_LOCALLAB_DSMOV")); - dustMethod->append (M ("TP_LOCALLAB_DSPAS")); - dustMethod->set_active (0); - dustMethodConn = dustMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::dustMethodChanged) ); - dustMethod->set_tooltip_markup (M ("TP_LOCALLAB_BLMETHOD_TOOLTIP")); + dustMethod->append(M("TP_LOCALLAB_DSCOP")); + dustMethod->append(M("TP_LOCALLAB_DSMOV")); + dustMethod->append(M("TP_LOCALLAB_DSPAS")); + dustMethod->set_active(0); + dustMethodConn = dustMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::dustMethodChanged)); + dustMethod->set_tooltip_markup(M("TP_LOCALLAB_BLMETHOD_TOOLTIP")); - superBox->pack_start (*lightness); - superBox->pack_start (*contrast); - superFrame->add (*superBox); - colorBox->pack_start (*superFrame); + superBox->pack_start(*lightness); + superBox->pack_start(*contrast); + superFrame->add(*superBox); + colorBox->pack_start(*superFrame); - colorBox->pack_start (*chroma); - colorBox->pack_start (*sensi); + colorBox->pack_start(*chroma); + colorBox->pack_start(*sensi); - dustFrame->set_label_align (0.025, 0.5); + dustFrame->set_label_align(0.025, 0.5); // dustBox->pack_start (*dustMethod); // dustBox->pack_start (*lastdust); @@ -697,188 +697,188 @@ Locallab::Locallab (): centerXbuf->hide(); centerYbuf->hide(); - qualcurvbox->pack_start (*labqualcurv, Gtk::PACK_SHRINK, 4); - qualcurvbox->pack_start (*qualitycurveMethod); + qualcurvbox->pack_start(*labqualcurv, Gtk::PACK_SHRINK, 4); + qualcurvbox->pack_start(*qualitycurveMethod); - colorBox->pack_start (*qualcurvbox); + colorBox->pack_start(*qualcurvbox); - colorBox->pack_start (*llCurveEditorG, Gtk::PACK_SHRINK, 2); - colorBox->pack_start (*invers); + colorBox->pack_start(*llCurveEditorG, Gtk::PACK_SHRINK, 2); + colorBox->pack_start(*invers); - expcolor->add (*colorBox); - expcolor->setLevel (2); - pack_start (*expcolor); + expcolor->add(*colorBox); + expcolor->setLevel(2); + pack_start(*expcolor); - ToolParamBlock* const exposeBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const exposeBox = Gtk::manage(new ToolParamBlock()); - curveEditorG = new CurveEditorGroup (options.lastlocalCurvesDir, M ("TP_LOCALLAB_CURVEEDITOR_TONES_LABEL")); - curveEditorG->setCurveListener (this); + curveEditorG = new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_CURVEEDITOR_TONES_LABEL")); + curveEditorG->setCurveListener(this); - shape = static_cast (curveEditorG->addCurve (CT_Diagonal, "")); - shape->setTooltip (M ("TP_LOCALLAB_CURVEEDITOR_TONES_TOOLTIP")); + shape = static_cast(curveEditorG->addCurve(CT_Diagonal, "")); + shape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_TONES_TOOLTIP")); curveEditorG->curveListComplete(); - exposeBox->pack_start (*expcomp); - exposeBox->pack_start (*hlcompr); - exposeBox->pack_start (*hlcomprthresh); - exposeBox->pack_start (*black); - exposeBox->pack_start (*shcompr); - exposeBox->pack_start (*sensiex); - exposeBox->pack_start (*curveEditorG); + exposeBox->pack_start(*expcomp); + exposeBox->pack_start(*hlcompr); + exposeBox->pack_start(*hlcomprthresh); + exposeBox->pack_start(*black); + exposeBox->pack_start(*shcompr); + exposeBox->pack_start(*sensiex); + exposeBox->pack_start(*curveEditorG); - expexpose->add (*exposeBox); - expexpose->setLevel (2); - pack_start (*expexpose); + expexpose->add(*exposeBox); + expexpose->setLevel(2); + pack_start(*expexpose); - ToolParamBlock* const vibranceBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const vibranceBox = Gtk::manage(new ToolParamBlock()); std::vector milestonesvib; float R, G, B; // -0.1 rad < Hue < 1.6 rad - Color::hsv2rgb01 (0.92f, 0.45f, 0.6f, R, G, B); - milestonesvib.push_back ( GradientMilestone (0.0, double (R), double (G), double (B)) ); - Color::hsv2rgb01 (0.14056f, 0.45f, 0.6f, R, G, B); - milestonesvib.push_back ( GradientMilestone (1.0, double (R), double (G), double (B)) ); + Color::hsv2rgb01(0.92f, 0.45f, 0.6f, R, G, B); + milestonesvib.push_back(GradientMilestone(0.0, double (R), double (G), double (B))); + Color::hsv2rgb01(0.14056f, 0.45f, 0.6f, R, G, B); + milestonesvib.push_back(GradientMilestone(1.0, double (R), double (G), double (B))); - saturated = Gtk::manage (new Adjuster (M ("TP_VIBRANCE_SATURATED"), -100., 100., 1., 0.)); - saturated->setAdjusterListener (this); - saturated->set_sensitive (false); - vibranceBox->pack_start ( *saturated, Gtk::PACK_SHRINK, 0); + saturated = Gtk::manage(new Adjuster(M("TP_VIBRANCE_SATURATED"), -100., 100., 1., 0.)); + saturated->setAdjusterListener(this); + saturated->set_sensitive(false); + vibranceBox->pack_start(*saturated, Gtk::PACK_SHRINK, 0); - pastels = Gtk::manage (new Adjuster (M ("TP_VIBRANCE_PASTELS"), -100., 100., 1., 0.)); - pastels->setAdjusterListener (this); - vibranceBox->pack_start ( *pastels, Gtk::PACK_SHRINK, 0); + pastels = Gtk::manage(new Adjuster(M("TP_VIBRANCE_PASTELS"), -100., 100., 1., 0.)); + pastels->setAdjusterListener(this); + vibranceBox->pack_start(*pastels, Gtk::PACK_SHRINK, 0); - psThreshold = Gtk::manage (new ThresholdAdjuster (M ("TP_VIBRANCE_PSTHRESHOLD"), -100., 100., 0., M ("TP_VIBRANCE_PSTHRESHOLD_WEIGTHING"), 0, 0., 100., 75., M ("TP_VIBRANCE_PSTHRESHOLD_SATTHRESH"), 0, this, false)); - psThreshold->setAdjusterListener (this); - psThreshold->set_tooltip_markup (M ("TP_VIBRANCE_PSTHRESHOLD_TOOLTIP")); - psThreshold->set_sensitive (false); - vibranceBox->pack_start ( *psThreshold, Gtk::PACK_SHRINK, 0); + psThreshold = Gtk::manage(new ThresholdAdjuster(M("TP_VIBRANCE_PSTHRESHOLD"), -100., 100., 0., M("TP_VIBRANCE_PSTHRESHOLD_WEIGTHING"), 0, 0., 100., 75., M("TP_VIBRANCE_PSTHRESHOLD_SATTHRESH"), 0, this, false)); + psThreshold->setAdjusterListener(this); + psThreshold->set_tooltip_markup(M("TP_VIBRANCE_PSTHRESHOLD_TOOLTIP")); + psThreshold->set_sensitive(false); + vibranceBox->pack_start(*psThreshold, Gtk::PACK_SHRINK, 0); - protectSkins = Gtk::manage (new Gtk::CheckButton (M ("TP_VIBRANCE_PROTECTSKINS"))); - protectSkins->set_active (true); - vibranceBox->pack_start (*protectSkins, Gtk::PACK_SHRINK, 0); + protectSkins = Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PROTECTSKINS"))); + protectSkins->set_active(true); + vibranceBox->pack_start(*protectSkins, Gtk::PACK_SHRINK, 0); - avoidColorShift = Gtk::manage (new Gtk::CheckButton (M ("TP_VIBRANCE_AVOIDCOLORSHIFT"))); - avoidColorShift->set_active (true); - vibranceBox->pack_start (*avoidColorShift, Gtk::PACK_SHRINK, 0); + avoidColorShift = Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_AVOIDCOLORSHIFT"))); + avoidColorShift->set_active(true); + vibranceBox->pack_start(*avoidColorShift, Gtk::PACK_SHRINK, 0); - pastSatTog = Gtk::manage (new Gtk::CheckButton (M ("TP_VIBRANCE_PASTSATTOG"))); - pastSatTog->set_active (true); - vibranceBox->pack_start (*pastSatTog, Gtk::PACK_SHRINK, 0); + pastSatTog = Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PASTSATTOG"))); + pastSatTog->set_active(true); + vibranceBox->pack_start(*pastSatTog, Gtk::PACK_SHRINK, 0); - sensiv = Gtk::manage (new Adjuster (M ("TP_LOCALLAB_SENSI"), 0, 100, 1, 19)); - sensiv->setAdjusterListener (this); + sensiv = Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 19)); + sensiv->setAdjusterListener(this); - vibranceBox->pack_start (*sensiv, Gtk::PACK_SHRINK, 0); + vibranceBox->pack_start(*sensiv, Gtk::PACK_SHRINK, 0); - curveEditorGG = new CurveEditorGroup (options.lastlocalCurvesDir, M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL")); - curveEditorGG->setCurveListener (this); + curveEditorGG = new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL")); + curveEditorGG->setCurveListener(this); - skinTonesCurve = static_cast (curveEditorGG->addCurve (CT_Diagonal, M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES"))); - skinTonesCurve->setTooltip (M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES_TOOLTIP")); - skinTonesCurve->setBottomBarBgGradient (milestonesvib); - skinTonesCurve->setLeftBarBgGradient (milestonesvib); - skinTonesCurve->setRangeLabels ( - M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE1"), M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE2"), - M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE3"), M ("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE4") + skinTonesCurve = static_cast(curveEditorGG->addCurve(CT_Diagonal, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES"))); + skinTonesCurve->setTooltip(M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_TOOLTIP")); + skinTonesCurve->setBottomBarBgGradient(milestonesvib); + skinTonesCurve->setLeftBarBgGradient(milestonesvib); + skinTonesCurve->setRangeLabels( + M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE1"), M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE2"), + M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE3"), M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE4") ); - skinTonesCurve->setRangeDefaultMilestones (0.1, 0.4, 0.85); + skinTonesCurve->setRangeDefaultMilestones(0.1, 0.4, 0.85); curveEditorGG->curveListComplete(); - vibranceBox->pack_start (*curveEditorGG, Gtk::PACK_SHRINK, 4); + vibranceBox->pack_start(*curveEditorGG, Gtk::PACK_SHRINK, 4); - pskinsconn = protectSkins->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::protectskins_toggled) ); - ashiftconn = avoidColorShift->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::avoidcolorshift_toggled) ); - pastsattogconn = pastSatTog->signal_toggled().connect ( sigc::mem_fun (*this, &Locallab::pastsattog_toggled) ); + pskinsconn = protectSkins->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::protectskins_toggled)); + ashiftconn = avoidColorShift->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::avoidcolorshift_toggled)); + pastsattogconn = pastSatTog->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::pastsattog_toggled)); - expvibrance->add (*vibranceBox); - expvibrance->setLevel (2); - pack_start (*expvibrance); + expvibrance->add(*vibranceBox); + expvibrance->setLevel(2); + pack_start(*expvibrance); - ToolParamBlock* const blurrBox = Gtk::manage (new ToolParamBlock()); - blurMethod->append (M ("TP_LOCALLAB_BLNORM")); - blurMethod->append (M ("TP_LOCALLAB_BLINV")); - blurMethod->append (M ("TP_LOCALLAB_BLSYM")); - blurMethod->set_active (0); - blurMethodConn = blurMethod->signal_changed().connect ( sigc::mem_fun (*this, &Locallab::blurMethodChanged) ); - blurMethod->set_tooltip_markup (M ("TP_LOCALLAB_BLMETHOD_TOOLTIP")); + ToolParamBlock* const blurrBox = Gtk::manage(new ToolParamBlock()); + blurMethod->append(M("TP_LOCALLAB_BLNORM")); + blurMethod->append(M("TP_LOCALLAB_BLINV")); + blurMethod->append(M("TP_LOCALLAB_BLSYM")); + blurMethod->set_active(0); + blurMethodConn = blurMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::blurMethodChanged)); + blurMethod->set_tooltip_markup(M("TP_LOCALLAB_BLMETHOD_TOOLTIP")); - blurrBox->pack_start (*radius); - blurrBox->pack_start (*strength); - blurrBox->pack_start (*sensibn); - blurrBox->pack_start (*blurMethod); + blurrBox->pack_start(*radius); + blurrBox->pack_start(*strength); + blurrBox->pack_start(*sensibn); + blurrBox->pack_start(*blurMethod); - blurrBox->pack_start (*activlum); + blurrBox->pack_start(*activlum); // blurrBox->pack_start (*inversrad); - expblur->add (*blurrBox); - expblur->setLevel (2); - pack_start (*expblur); - ToolParamBlock* const tmBox = Gtk::manage (new ToolParamBlock()); + expblur->add(*blurrBox); + expblur->setLevel(2); + pack_start(*expblur); + ToolParamBlock* const tmBox = Gtk::manage(new ToolParamBlock()); - tmBox->pack_start (*stren); - tmBox->pack_start (*gamma); - tmBox->pack_start (*estop); - tmBox->pack_start (*scaltm); - tmBox->pack_start (*rewei); - tmBox->pack_start (*sensitm); + tmBox->pack_start(*stren); + tmBox->pack_start(*gamma); + tmBox->pack_start(*estop); + tmBox->pack_start(*scaltm); + tmBox->pack_start(*rewei); + tmBox->pack_start(*sensitm); - exptonemap->add (*tmBox); - exptonemap->setLevel (2); - pack_start (*exptonemap); + exptonemap->add(*tmBox); + exptonemap->setLevel(2); + pack_start(*exptonemap); - ToolParamBlock* const retiBox = Gtk::manage (new ToolParamBlock()); + ToolParamBlock* const retiBox = Gtk::manage(new ToolParamBlock()); - retiBox->pack_start (*retinexMethod); - retiBox->pack_start (*str); - retiBox->pack_start (*chrrt); - retiBox->pack_start (*neigh); - retiBox->pack_start (*vart); - retiBox->pack_start (*sensih); - retiBox->pack_start (*retrab); + retiBox->pack_start(*retinexMethod); + retiBox->pack_start(*str); + retiBox->pack_start(*chrrt); + retiBox->pack_start(*neigh); + retiBox->pack_start(*vart); + retiBox->pack_start(*sensih); + retiBox->pack_start(*retrab); - retiBox->pack_start (*LocalcurveEditorgainTrab, Gtk::PACK_SHRINK, 4); + retiBox->pack_start(*LocalcurveEditorgainTrab, Gtk::PACK_SHRINK, 4); - retiBox->pack_start (*LocalcurveEditorgainT, Gtk::PACK_SHRINK, 4); - retiBox->pack_start (*inversret); + retiBox->pack_start(*LocalcurveEditorgainT, Gtk::PACK_SHRINK, 4); + retiBox->pack_start(*inversret); - expreti->add (*retiBox); - expreti->setLevel (2); - pack_start (*expreti); + expreti->add(*retiBox); + expreti->setLevel(2); + pack_start(*expreti); - expsharp->add (*sharpBox); - expsharp->setLevel (2); - pack_start (*expsharp); + expsharp->add(*sharpBox); + expsharp->setLevel(2); + pack_start(*expsharp); - expcbdl->add (*cbdlBox); - expcbdl->setLevel (2); - pack_start (*expcbdl); + expcbdl->add(*cbdlBox); + expcbdl->setLevel(2); + pack_start(*expcbdl); - expdenoi->add (*denoisBox); - expdenoi->setLevel (2); - pack_start (*expdenoi); + expdenoi->add(*denoisBox); + expdenoi->setLevel(2); + pack_start(*expdenoi); // pack_start (*transit); - pack_start (*avoid);//keep avoid clor shift in case of + pack_start(*avoid); //keep avoid clor shift in case of - neutrHBox = Gtk::manage (new Gtk::HBox ()); + neutrHBox = Gtk::manage(new Gtk::HBox()); - neutral = Gtk::manage (new Gtk::Button (M ("TP_LOCALLAB_NEUTRAL"))); - RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); - neutral->set_image (*resetImg); - neutral->set_tooltip_text (M ("TP_LOCALLAB_NEUTRAL_TIP")); - neutralconn = neutral->signal_pressed().connect ( sigc::mem_fun (*this, &Locallab::neutral_pressed) ); + neutral = Gtk::manage(new Gtk::Button(M("TP_LOCALLAB_NEUTRAL"))); + RTImage *resetImg = Gtk::manage(new RTImage("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); + neutral->set_image(*resetImg); + neutral->set_tooltip_text(M("TP_LOCALLAB_NEUTRAL_TIP")); + neutralconn = neutral->signal_pressed().connect(sigc::mem_fun(*this, &Locallab::neutral_pressed)); neutral->show(); - neutrHBox->pack_start (*neutral); - pack_start (*neutrHBox); + neutrHBox->pack_start(*neutral); + pack_start(*neutrHBox); // Instantiating the Editing geometry; positions will be initialized later @@ -981,29 +981,29 @@ Locallab::Locallab (): // oneellipse->radius = locX->getValue(); // oneellipse->filled = false; - EditSubscriber::visibleGeometry.push_back ( locXLine[0] ); - EditSubscriber::visibleGeometry.push_back ( locXLine[1] ); - EditSubscriber::visibleGeometry.push_back ( locYLine[0] ); - EditSubscriber::visibleGeometry.push_back ( locYLine[1] ); - EditSubscriber::visibleGeometry.push_back ( centerCircle ); + EditSubscriber::visibleGeometry.push_back(locXLine[0]); + EditSubscriber::visibleGeometry.push_back(locXLine[1]); + EditSubscriber::visibleGeometry.push_back(locYLine[0]); + EditSubscriber::visibleGeometry.push_back(locYLine[1]); + EditSubscriber::visibleGeometry.push_back(centerCircle); if (options.showdelimspot) { - EditSubscriber::visibleGeometry.push_back ( onebeziers[0] ); - EditSubscriber::visibleGeometry.push_back ( onebeziers[1] ); - EditSubscriber::visibleGeometry.push_back ( onebeziers[2] ); - EditSubscriber::visibleGeometry.push_back ( onebeziers[3] ); - EditSubscriber::visibleGeometry.push_back ( twobeziers[0] ); - EditSubscriber::visibleGeometry.push_back ( twobeziers[1] ); - EditSubscriber::visibleGeometry.push_back ( twobeziers[2] ); - EditSubscriber::visibleGeometry.push_back ( twobeziers[3] ); - EditSubscriber::visibleGeometry.push_back ( thrbeziers[0] ); - EditSubscriber::visibleGeometry.push_back ( thrbeziers[1] ); - EditSubscriber::visibleGeometry.push_back ( thrbeziers[2] ); - EditSubscriber::visibleGeometry.push_back ( thrbeziers[3] ); - EditSubscriber::visibleGeometry.push_back ( foubeziers[0] ); - EditSubscriber::visibleGeometry.push_back ( foubeziers[1] ); - EditSubscriber::visibleGeometry.push_back ( foubeziers[2] ); - EditSubscriber::visibleGeometry.push_back ( foubeziers[3] ); + EditSubscriber::visibleGeometry.push_back(onebeziers[0]); + EditSubscriber::visibleGeometry.push_back(onebeziers[1]); + EditSubscriber::visibleGeometry.push_back(onebeziers[2]); + EditSubscriber::visibleGeometry.push_back(onebeziers[3]); + EditSubscriber::visibleGeometry.push_back(twobeziers[0]); + EditSubscriber::visibleGeometry.push_back(twobeziers[1]); + EditSubscriber::visibleGeometry.push_back(twobeziers[2]); + EditSubscriber::visibleGeometry.push_back(twobeziers[3]); + EditSubscriber::visibleGeometry.push_back(thrbeziers[0]); + EditSubscriber::visibleGeometry.push_back(thrbeziers[1]); + EditSubscriber::visibleGeometry.push_back(thrbeziers[2]); + EditSubscriber::visibleGeometry.push_back(thrbeziers[3]); + EditSubscriber::visibleGeometry.push_back(foubeziers[0]); + EditSubscriber::visibleGeometry.push_back(foubeziers[1]); + EditSubscriber::visibleGeometry.push_back(foubeziers[2]); + EditSubscriber::visibleGeometry.push_back(foubeziers[3]); } // MouseOver geometry @@ -1096,31 +1096,31 @@ Locallab::Locallab (): // oneellipse->radius = 10;//locX->getValue(); // oneellipse->filled = false; - EditSubscriber::mouseOverGeometry.push_back ( locXLine[0] ); - EditSubscriber::mouseOverGeometry.push_back ( locXLine[1] ); + EditSubscriber::mouseOverGeometry.push_back(locXLine[0]); + EditSubscriber::mouseOverGeometry.push_back(locXLine[1]); - EditSubscriber::mouseOverGeometry.push_back ( locYLine[0] ); - EditSubscriber::mouseOverGeometry.push_back ( locYLine[1] ); + EditSubscriber::mouseOverGeometry.push_back(locYLine[0]); + EditSubscriber::mouseOverGeometry.push_back(locYLine[1]); - EditSubscriber::mouseOverGeometry.push_back ( centerCircle ); + EditSubscriber::mouseOverGeometry.push_back(centerCircle); if (options.showdelimspot) { - EditSubscriber::mouseOverGeometry.push_back ( onebeziers[0] ); - EditSubscriber::mouseOverGeometry.push_back ( onebeziers[1] ); - EditSubscriber::mouseOverGeometry.push_back ( onebeziers[2] ); - EditSubscriber::mouseOverGeometry.push_back ( onebeziers[3] ); - EditSubscriber::mouseOverGeometry.push_back ( twobeziers[0] ); - EditSubscriber::mouseOverGeometry.push_back ( twobeziers[1] ); - EditSubscriber::mouseOverGeometry.push_back ( twobeziers[2] ); - EditSubscriber::mouseOverGeometry.push_back ( twobeziers[3] ); - EditSubscriber::mouseOverGeometry.push_back ( thrbeziers[0] ); - EditSubscriber::mouseOverGeometry.push_back ( thrbeziers[1] ); - EditSubscriber::mouseOverGeometry.push_back ( thrbeziers[2] ); - EditSubscriber::mouseOverGeometry.push_back ( thrbeziers[3] ); - EditSubscriber::mouseOverGeometry.push_back ( foubeziers[0] ); - EditSubscriber::mouseOverGeometry.push_back ( foubeziers[1] ); - EditSubscriber::mouseOverGeometry.push_back ( foubeziers[2] ); - EditSubscriber::mouseOverGeometry.push_back ( foubeziers[3] ); + EditSubscriber::mouseOverGeometry.push_back(onebeziers[0]); + EditSubscriber::mouseOverGeometry.push_back(onebeziers[1]); + EditSubscriber::mouseOverGeometry.push_back(onebeziers[2]); + EditSubscriber::mouseOverGeometry.push_back(onebeziers[3]); + EditSubscriber::mouseOverGeometry.push_back(twobeziers[0]); + EditSubscriber::mouseOverGeometry.push_back(twobeziers[1]); + EditSubscriber::mouseOverGeometry.push_back(twobeziers[2]); + EditSubscriber::mouseOverGeometry.push_back(twobeziers[3]); + EditSubscriber::mouseOverGeometry.push_back(thrbeziers[0]); + EditSubscriber::mouseOverGeometry.push_back(thrbeziers[1]); + EditSubscriber::mouseOverGeometry.push_back(thrbeziers[2]); + EditSubscriber::mouseOverGeometry.push_back(thrbeziers[3]); + EditSubscriber::mouseOverGeometry.push_back(foubeziers[0]); + EditSubscriber::mouseOverGeometry.push_back(foubeziers[1]); + EditSubscriber::mouseOverGeometry.push_back(foubeziers[2]); + EditSubscriber::mouseOverGeometry.push_back(foubeziers[3]); } show_all(); @@ -1141,24 +1141,24 @@ Locallab::~Locallab() delete llCurveEditorG; } -void Locallab::foldAllButMe (GdkEventButton* event, MyExpander *expander) +void Locallab::foldAllButMe(GdkEventButton* event, MyExpander *expander) { if (event->button == 3) { - expsettings->set_expanded (expsettings == expander); - expcolor->set_expanded (expcolor == expander); - expexpose->set_expanded (expexpose == expander); - expvibrance->set_expanded (expvibrance == expander); - expblur->set_expanded (expblur == expander); - exptonemap->set_expanded (exptonemap == expander); - expreti->set_expanded (expreti == expander); - expsharp->set_expanded (expsharp == expander); - expcbdl->set_expanded (expcbdl == expander); - expdenoi->set_expanded (expdenoi == expander); + expsettings->set_expanded(expsettings == expander); + expcolor->set_expanded(expcolor == expander); + expexpose->set_expanded(expexpose == expander); + expvibrance->set_expanded(expvibrance == expander); + expblur->set_expanded(expblur == expander); + exptonemap->set_expanded(exptonemap == expander); + expreti->set_expanded(expreti == expander); + expsharp->set_expanded(expsharp == expander); + expcbdl->set_expanded(expcbdl == expander); + expdenoi->set_expanded(expdenoi == expander); } } -void Locallab::enableToggled (MyExpander *expander) +void Locallab::enableToggled(MyExpander *expander) { if (listener) { rtengine::ProcEvent event = NUMOFEVENTS; @@ -1186,159 +1186,159 @@ void Locallab::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 Locallab::writeOptions (std::vector &tpOpen) +void Locallab::writeOptions(std::vector &tpOpen) { - tpOpen.push_back (expsettings->get_expanded ()); - tpOpen.push_back (expcolor->get_expanded ()); - tpOpen.push_back (expexpose->get_expanded ()); - tpOpen.push_back (expvibrance->get_expanded ()); - tpOpen.push_back (expblur->get_expanded ()); - tpOpen.push_back (exptonemap->get_expanded ()); - tpOpen.push_back (expreti->get_expanded ()); - tpOpen.push_back (expsharp->get_expanded ()); - tpOpen.push_back (expcbdl->get_expanded ()); - tpOpen.push_back (expdenoi->get_expanded ()); + tpOpen.push_back(expsettings->get_expanded()); + tpOpen.push_back(expcolor->get_expanded()); + tpOpen.push_back(expexpose->get_expanded()); + tpOpen.push_back(expvibrance->get_expanded()); + tpOpen.push_back(expblur->get_expanded()); + tpOpen.push_back(exptonemap->get_expanded()); + tpOpen.push_back(expreti->get_expanded()); + tpOpen.push_back(expsharp->get_expanded()); + tpOpen.push_back(expcbdl->get_expanded()); + tpOpen.push_back(expdenoi->get_expanded()); } -void Locallab::updateToolState (std::vector &tpOpen) +void Locallab::updateToolState(std::vector &tpOpen) { if (tpOpen.size() >= 10) { - expsettings->set_expanded (tpOpen.at (0)); - expcolor->set_expanded (tpOpen.at (1)); - expexpose->set_expanded (tpOpen.at (2)); - expvibrance->set_expanded (tpOpen.at (3)); - expblur->set_expanded (tpOpen.at (4)); - exptonemap->set_expanded (tpOpen.at (5)); - expreti->set_expanded (tpOpen.at (6)); - expsharp->set_expanded (tpOpen.at (7)); - expcbdl->set_expanded (tpOpen.at (8)); - expdenoi->set_expanded (tpOpen.at (9)); + expsettings->set_expanded(tpOpen.at(0)); + expcolor->set_expanded(tpOpen.at(1)); + expexpose->set_expanded(tpOpen.at(2)); + expvibrance->set_expanded(tpOpen.at(3)); + expblur->set_expanded(tpOpen.at(4)); + exptonemap->set_expanded(tpOpen.at(5)); + expreti->set_expanded(tpOpen.at(6)); + expsharp->set_expanded(tpOpen.at(7)); + expcbdl->set_expanded(tpOpen.at(8)); + expdenoi->set_expanded(tpOpen.at(9)); } } -void Locallab::neutral_pressed () +void Locallab::neutral_pressed() { - Smethod->set_active (0); - Exclumethod->set_active (0); - locX->resetValue (false); - locXL->resetValue (false); - locY->resetValue (false); - locYT->resetValue (false); - centerX->resetValue (false); - centerY->resetValue (false); - circrad->resetValue (false); - centerXbuf->resetValue (false); - centerYbuf->resetValue (false); - adjblur->resetValue (false); - blurMethod->set_active (0); - dustMethod->set_active (1); - sensiexclu->resetValue (false); - struc->resetValue (false); + Smethod->set_active(0); + Exclumethod->set_active(0); + locX->resetValue(false); + locXL->resetValue(false); + locY->resetValue(false); + locYT->resetValue(false); + centerX->resetValue(false); + centerY->resetValue(false); + circrad->resetValue(false); + centerXbuf->resetValue(false); + centerYbuf->resetValue(false); + adjblur->resetValue(false); + blurMethod->set_active(0); + dustMethod->set_active(1); + sensiexclu->resetValue(false); + struc->resetValue(false); - qualityMethod->set_active (0); - qualitycurveMethod->set_active (0); - thres->resetValue (false); - proxi->resetValue (false); - lightness->resetValue (false); - chroma->resetValue (false); - contrast->resetValue (false); - sensi->resetValue (false); - radius->resetValue (false); - strength->resetValue (false); - transit->resetValue (false); - sensibn->resetValue (false); - invers->set_active (false); - cutpast->set_active (false); - lastdust->set_active (false); - curvactiv->set_active (false); - inversrad->set_active (false); - inversret->set_active (false); - stren->resetValue (false); - gamma->resetValue (false); - estop->resetValue (false); - scaltm->resetValue (false); - rewei->resetValue (false); - sensitm->resetValue (false); - retinexMethod->set_active (2); - str->resetValue (false); - neigh->resetValue (false); - vart->resetValue (false); - chrrt->resetValue (false); - sensih->resetValue (false); - retrab->resetValue (false); + qualityMethod->set_active(0); + qualitycurveMethod->set_active(0); + thres->resetValue(false); + proxi->resetValue(false); + lightness->resetValue(false); + chroma->resetValue(false); + contrast->resetValue(false); + sensi->resetValue(false); + radius->resetValue(false); + strength->resetValue(false); + transit->resetValue(false); + sensibn->resetValue(false); + invers->set_active(false); + cutpast->set_active(false); + lastdust->set_active(false); + curvactiv->set_active(false); + inversrad->set_active(false); + inversret->set_active(false); + stren->resetValue(false); + gamma->resetValue(false); + estop->resetValue(false); + scaltm->resetValue(false); + rewei->resetValue(false); + sensitm->resetValue(false); + retinexMethod->set_active(2); + str->resetValue(false); + neigh->resetValue(false); + vart->resetValue(false); + chrrt->resetValue(false); + sensih->resetValue(false); + retrab->resetValue(false); // cTgainshape->reset(); // cTgainshape->setCurve (creti); - avoid->set_active (false); + avoid->set_active(false); for (int i = 0; i < 5; i++) { - multiplier[i]->resetValue (false); + multiplier[i]->resetValue(false); } - chromacbdl->resetValue (false); - threshold->resetValue (false); - sensicb->resetValue (false); - sharradius->resetValue (false); - sharamount->resetValue (false); - shardamping->resetValue (false); - shariter->resetValue (false); - sensisha->resetValue (false); - inverssha->set_active (false); - noiselumf->resetValue (false); - noiselumc->resetValue (false); - noisechrof->resetValue (false); - noisechroc->resetValue (false); + chromacbdl->resetValue(false); + threshold->resetValue(false); + sensicb->resetValue(false); + sharradius->resetValue(false); + sharamount->resetValue(false); + shardamping->resetValue(false); + shariter->resetValue(false); + sensisha->resetValue(false); + inverssha->set_active(false); + noiselumf->resetValue(false); + noiselumc->resetValue(false); + noisechrof->resetValue(false); + noisechroc->resetValue(false); } -void Locallab::lumaneutralPressed () +void Locallab::lumaneutralPressed() { for (int i = 0; i < 5; i++) { - multiplier[i]->setValue (100); - adjusterChanged (multiplier[i], 100); + multiplier[i]->setValue(100); + adjusterChanged(multiplier[i], 100); } } -void Locallab::lumacontrastPlusPressed () +void Locallab::lumacontrastPlusPressed() { for (int i = 0; i < 5; i++) { float inc = (5 - i); - multiplier[i]->setValue (multiplier[i]->getValue() + inc); - adjusterChanged (multiplier[i], multiplier[i]->getValue()); + multiplier[i]->setValue(multiplier[i]->getValue() + inc); + adjusterChanged(multiplier[i], multiplier[i]->getValue()); } } -void Locallab::lumacontrastMinusPressed () +void Locallab::lumacontrastMinusPressed() { for (int i = 0; i < 5; i++) { float inc = - (5 - i); - multiplier[i]->setValue (multiplier[i]->getValue() + inc); - adjusterChanged (multiplier[i], multiplier[i]->getValue()); + multiplier[i]->setValue(multiplier[i]->getValue() + inc); + adjusterChanged(multiplier[i], multiplier[i]->getValue()); } } -void Locallab::autoOpenCurve () +void Locallab::autoOpenCurve() { cTgainshape->openIfNonlinear(); // llshape->openIfNonlinear(); @@ -1347,27 +1347,27 @@ void Locallab::autoOpenCurve () } -int localChangedUI (void* data) +int localChangedUI(void* data) { GThreadLock lock; - (static_cast (data))->localComputed_ (); + (static_cast(data))->localComputed_(); return 0; } -int localretChangedUI (void* data) +int localretChangedUI(void* data) { GThreadLock lock; - (static_cast (data))->localretComputed_ (); + (static_cast(data))->localretComputed_(); return 0; } -bool Locallab::localretComputed_ () +bool Locallab::localretComputed_() { - disableListener (); + disableListener(); //Reticurv //update GUI and MIP specially for curve @@ -1376,117 +1376,117 @@ bool Locallab::localretComputed_ () s_datc = new int[70]; int siz; //printf("nexts=%s\n", nextstr2.c_str()); - ImProcFunctions::strcurv_data (nextstr2, s_datc, siz); + ImProcFunctions::strcurv_data(nextstr2, s_datc, siz); std::vector creti; for (int j = 0; j < siz; j++) { - creti.push_back ((double) (s_datc[j]) / 1000.); + creti.push_back((double)(s_datc[j]) / 1000.); } delete [] s_datc; - cTgainshape->setCurve (creti); + cTgainshape->setCurve(creti); int *s_datcl; s_datcl = new int[70]; int sizl; - ImProcFunctions::strcurv_data (nextll_str2, s_datcl, sizl); + ImProcFunctions::strcurv_data(nextll_str2, s_datcl, sizl); std::vector cll; for (int j = 0; j < sizl; j++) { - cll.push_back ((double) (s_datcl[j]) / 1000.); + cll.push_back((double)(s_datcl[j]) / 1000.); } delete [] s_datcl; - llshape->setCurve (cll); + llshape->setCurve(cll); int *s_datcc; s_datcc = new int[70]; int sizc; - ImProcFunctions::strcurv_data (nextcc_str2, s_datcc, sizc); + ImProcFunctions::strcurv_data(nextcc_str2, s_datcc, sizc); std::vector ccc; for (int j = 0; j < sizc; j++) { - ccc.push_back ((double) (s_datcc[j]) / 1000.); + ccc.push_back((double)(s_datcc[j]) / 1000.); } delete [] s_datcc; - ccshape->setCurve (ccc); + ccshape->setCurve(ccc); int *s_datch; s_datch = new int[70]; int sizh; - ImProcFunctions::strcurv_data (nextlh_str2, s_datch, sizh); + ImProcFunctions::strcurv_data(nextlh_str2, s_datch, sizh); std::vector clh; for (int j = 0; j < sizh; j++) { - clh.push_back ((double) (s_datch[j]) / 1000.); + clh.push_back((double)(s_datch[j]) / 1000.); } delete [] s_datch; - LHshape->setCurve (clh); + LHshape->setCurve(clh); int *s_datchh; s_datchh = new int[70]; int sizhh; - ImProcFunctions::strcurv_data (nexthh_str2, s_datchh, sizhh); + ImProcFunctions::strcurv_data(nexthh_str2, s_datchh, sizhh); std::vector chh; for (int j = 0; j < sizhh; j++) { - chh.push_back ((double) (s_datchh[j]) / 1000.); + chh.push_back((double)(s_datchh[j]) / 1000.); } delete [] s_datchh; - HHshape->setCurve (chh); + HHshape->setCurve(chh); //skinTonesCurve int *s_datcsk; s_datcsk = new int[70]; int sizsk; - ImProcFunctions::strcurv_data (nextsk_str2, s_datcsk, sizsk); + ImProcFunctions::strcurv_data(nextsk_str2, s_datcsk, sizsk); std::vector csk; for (int j = 0; j < sizsk; j++) { - csk.push_back ((double) (s_datcsk[j]) / 1000.); + csk.push_back((double)(s_datcsk[j]) / 1000.); } delete [] s_datcsk; - skinTonesCurve->setCurve (csk); + skinTonesCurve->setCurve(csk); //PSthreshold int sizps = 2; int s_datcps[sizps + 1]; - ImProcFunctions::strcurv_data (nextps_str2, s_datcps, sizps); - psThreshold->setValue (s_datcps[0], s_datcps[1]); + ImProcFunctions::strcurv_data(nextps_str2, s_datcps, sizps); + psThreshold->setValue(s_datcps[0], s_datcps[1]); //exCurve int *s_datcex; s_datcex = new int[70]; int sizex; - ImProcFunctions::strcurv_data (nextex_str2, s_datcex, sizex); + ImProcFunctions::strcurv_data(nextex_str2, s_datcex, sizex); std::vector cex; for (int j = 0; j < sizex; j++) { - cex.push_back ((double) (s_datcex[j]) / 1000.); + cex.push_back((double)(s_datcex[j]) / 1000.); } delete [] s_datcex; - shape->setCurve (cex); + shape->setCurve(cex); - enableListener (); + enableListener(); //update all sliders by this strange process! if (anbspot->getValue() == 0) { - anbspot->setValue (1); + anbspot->setValue(1); if (options.rtSettings.locdelay) { if (anbspot->delay < 100) { @@ -1494,10 +1494,10 @@ bool Locallab::localretComputed_ () } } - adjusterChanged (anbspot, 1); + adjusterChanged(anbspot, 1); } else if (anbspot->getValue() == 1) { - anbspot->setValue (0); + anbspot->setValue(0); if (options.rtSettings.locdelay) { if (anbspot->delay < 100) { @@ -1505,23 +1505,23 @@ bool Locallab::localretComputed_ () } } - adjusterChanged (anbspot, 0); + adjusterChanged(anbspot, 0); } //update all curves std::vector cretirab; - cretirab = cTgainshaperab->getCurve (); + cretirab = cTgainshaperab->getCurve(); - if (cretirab.at (5) == 0.70) { - cretirab.at (5) = 0.9; - cTgainshaperab->setCurve (cretirab); + if (cretirab.at(5) == 0.70) { + cretirab.at(5) = 0.9; + cTgainshaperab->setCurve(cretirab); - curveChanged (cTgainshaperab); - } else if (cretirab.at (5) == 0.90) { - cretirab.at (5) = 0.7; - cTgainshaperab->setCurve (cretirab); - curveChanged (cTgainshaperab); + curveChanged(cTgainshaperab); + } else if (cretirab.at(5) == 0.90) { + cretirab.at(5) = 0.7; + cTgainshaperab->setCurve(cretirab); + curveChanged(cTgainshaperab); } @@ -1529,43 +1529,43 @@ bool Locallab::localretComputed_ () // printf("G2 anbspot=%i\n", anbspot->getValue()); if (listener) { //for all sliders - listener->panelChanged (Evlocallabanbspot, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallabanbspot, ""); //anbspot->getTextValue()); } if (listener) {//for curve - listener->panelChanged (EvlocallabCTgainCurverab, M ("")); + listener->panelChanged(EvlocallabCTgainCurverab, M("")); } if (listener) {//for curve - listener->panelChanged (EvlocallabCTgainCurve, M ("")); + listener->panelChanged(EvlocallabCTgainCurve, M("")); } if (listener) {//for curve - listener->panelChanged (Evlocallabllshape, M ("")); + listener->panelChanged(Evlocallabllshape, M("")); } if (listener) {//for curve - listener->panelChanged (Evlocallabccshape, M ("")); + listener->panelChanged(Evlocallabccshape, M("")); } if (listener) {//for curve - listener->panelChanged (EvlocallabLHshape, M ("")); + listener->panelChanged(EvlocallabLHshape, M("")); } if (listener) {//for curve - listener->panelChanged (EvlocallabHHshape, M ("")); + listener->panelChanged(EvlocallabHHshape, M("")); } if (listener) {//for curve - listener->panelChanged (EvlocallabSkinTonesCurve, M ("")); + listener->panelChanged(EvlocallabSkinTonesCurve, M("")); } if (listener) {//for PSthreshold - listener->panelChanged (EvlocallabPastSatThreshold, M ("")); + listener->panelChanged(EvlocallabPastSatThreshold, M("")); } if (listener) {//for PSthreshold - listener->panelChanged (Evlocallabshape, M ("")); + listener->panelChanged(Evlocallabshape, M("")); } @@ -1573,365 +1573,365 @@ bool Locallab::localretComputed_ () } -bool Locallab::localComputed_ () +bool Locallab::localComputed_() { //update GUI and MIP - disableListener (); + disableListener(); //size spot - circrad->setValue (nextdatasp[2]); + circrad->setValue(nextdatasp[2]); //center and cursor - locX->setValue (nextdatasp[3]); - locY->setValue (nextdatasp[4]); - locYT->setValue (nextdatasp[5]); - locXL->setValue (nextdatasp[6]); - centerX->setValue (nextdatasp[7]); - centerY->setValue (nextdatasp[8]); + locX->setValue(nextdatasp[3]); + locY->setValue(nextdatasp[4]); + locYT->setValue(nextdatasp[5]); + locXL->setValue(nextdatasp[6]); + centerX->setValue(nextdatasp[7]); + centerY->setValue(nextdatasp[8]); //sliders - lightness->setValue (nextdatasp[9]); - contrast->setValue (nextdatasp[10]); - chroma->setValue (nextdatasp[11]); - sensi->setValue (nextdatasp[12]); - transit->setValue (nextdatasp[13]); + lightness->setValue(nextdatasp[9]); + contrast->setValue(nextdatasp[10]); + chroma->setValue(nextdatasp[11]); + sensi->setValue(nextdatasp[12]); + transit->setValue(nextdatasp[13]); //inverse if (nextdatasp[14] == 0) { - invers->set_active (false); + invers->set_active(false); } else { - invers->set_active (true); + invers->set_active(true); } //method cursor if (nextdatasp[15] == 0) { - Smethod->set_active (0); + Smethod->set_active(0); } else if (nextdatasp[15] == 1) { - Smethod->set_active (1); + Smethod->set_active(1); } else if (nextdatasp[15] == 2) { - Smethod->set_active (2); + Smethod->set_active(2); } else if (nextdatasp[15] == 3) { - Smethod->set_active (3); + Smethod->set_active(3); } //sliders blurr - radius->setValue (nextdatasp[17]); - strength->setValue (nextdatasp[18]); - sensibn->setValue (nextdatasp[19]); + radius->setValue(nextdatasp[17]); + strength->setValue(nextdatasp[18]); + sensibn->setValue(nextdatasp[19]); //inverse if (nextdatasp[20] == 0) { - inversrad->set_active (false); + inversrad->set_active(false); } else { - inversrad->set_active (true); + inversrad->set_active(true); } //sliders retinex - str->setValue (nextdatasp[21]); - chrrt->setValue (nextdatasp[22]); - neigh->setValue (nextdatasp[23]); - vart->setValue (nextdatasp[24]); - sensih->setValue (nextdatasp[25]); + str->setValue(nextdatasp[21]); + chrrt->setValue(nextdatasp[22]); + neigh->setValue(nextdatasp[23]); + vart->setValue(nextdatasp[24]); + sensih->setValue(nextdatasp[25]); //inverse if (nextdatasp[26] == 0) { - inversret->set_active (false); + inversret->set_active(false); } else { - inversret->set_active (true); + inversret->set_active(true); } //method retinex if (nextdatasp[27] == 0) { - retinexMethod->set_active (0); + retinexMethod->set_active(0); } else if (nextdatasp[27] == 1) { - retinexMethod->set_active (1); + retinexMethod->set_active(1); } else if (nextdatasp[27] == 2) { - retinexMethod->set_active (2); + retinexMethod->set_active(2); } //sharpening - sharradius->setValue (nextdatasp[28]); - sharamount->setValue (nextdatasp[29]); - shardamping->setValue (nextdatasp[30]); - shariter->setValue (nextdatasp[31]); - sensisha->setValue (nextdatasp[32]); + sharradius->setValue(nextdatasp[28]); + sharamount->setValue(nextdatasp[29]); + shardamping->setValue(nextdatasp[30]); + shariter->setValue(nextdatasp[31]); + sensisha->setValue(nextdatasp[32]); if (nextdatasp[33] == 0) { - inverssha->set_active (false); + inverssha->set_active(false); } else { - inverssha->set_active (true); + inverssha->set_active(true); } if (nextdatasp[34] == 0) { - qualityMethod->set_active (0); + qualityMethod->set_active(0); } else if (nextdatasp[34] == 1) { - qualityMethod->set_active (1); + qualityMethod->set_active(1); } else if (nextdatasp[34] == 2) { - qualityMethod->set_active (2); + qualityMethod->set_active(2); } - thres->setValue (nextdatasp[35]); - proxi->setValue (nextdatasp[36]); + thres->setValue(nextdatasp[35]); + proxi->setValue(nextdatasp[36]); //denoise - noiselumf->setValue (nextdatasp[37]); - noiselumc->setValue (nextdatasp[38]); - noisechrof->setValue (nextdatasp[39]); - noisechroc->setValue (nextdatasp[40]); + noiselumf->setValue(nextdatasp[37]); + noiselumc->setValue(nextdatasp[38]); + noisechrof->setValue(nextdatasp[39]); + noisechroc->setValue(nextdatasp[40]); //cbdl - multiplier[0]->setValue (nextdatasp[41]); - multiplier[1]->setValue (nextdatasp[42]); - multiplier[2]->setValue (nextdatasp[43]); - multiplier[3]->setValue (nextdatasp[44]); - multiplier[4]->setValue (nextdatasp[45]); - threshold->setValue (nextdatasp[46]); - sensicb->setValue (nextdatasp[47]); + multiplier[0]->setValue(nextdatasp[41]); + multiplier[1]->setValue(nextdatasp[42]); + multiplier[2]->setValue(nextdatasp[43]); + multiplier[3]->setValue(nextdatasp[44]); + multiplier[4]->setValue(nextdatasp[45]); + threshold->setValue(nextdatasp[46]); + sensicb->setValue(nextdatasp[47]); //blur luma if (nextdatasp[48] == 0) { - activlum->set_active (false); + activlum->set_active(false); } else { - activlum->set_active (true); + activlum->set_active(true); } //TM - stren->setValue (nextdatasp[49]); - gamma->setValue (nextdatasp[50]); - estop->setValue (nextdatasp[51]); - scaltm->setValue (nextdatasp[52]); - rewei->setValue (nextdatasp[53]); - sensitm->setValue (nextdatasp[54]); + stren->setValue(nextdatasp[49]); + gamma->setValue(nextdatasp[50]); + estop->setValue(nextdatasp[51]); + scaltm->setValue(nextdatasp[52]); + rewei->setValue(nextdatasp[53]); + sensitm->setValue(nextdatasp[54]); // usleep(10000); //Reticurv - retrab->setValue (nextdatasp[55]); + retrab->setValue(nextdatasp[55]); //curvactiv if (nextdatasp[56] == 0) { - curvactiv->set_active (false); + curvactiv->set_active(false); } else { - curvactiv->set_active (true); + curvactiv->set_active(true); } if (nextdatasp[57] == 0) { - qualitycurveMethod->set_active (0); + qualitycurveMethod->set_active(0); } else if (nextdatasp[57] == 1) { - qualitycurveMethod->set_active (1); + qualitycurveMethod->set_active(1); } else if (nextdatasp[57] == 2) { - qualitycurveMethod->set_active (2); + qualitycurveMethod->set_active(2); } - sensiv->setValue (nextdatasp[58]); - pastels->setValue (nextdatasp[59]); - saturated->setValue (nextdatasp[60]); + sensiv->setValue(nextdatasp[58]); + pastels->setValue(nextdatasp[59]); + saturated->setValue(nextdatasp[60]); //protectskin if (nextdatasp[61] == 0) { - protectSkins->set_active (false); + protectSkins->set_active(false); } else { - protectSkins->set_active (true); + protectSkins->set_active(true); } //avoidColorShift if (nextdatasp[62] == 0) { - avoidColorShift->set_active (false); + avoidColorShift->set_active(false); } else { - avoidColorShift->set_active (true); + avoidColorShift->set_active(true); } //pastSatTog if (nextdatasp[63] == 0) { - pastSatTog->set_active (false); - adjusterChanged (pastels, pastels->getValue()); - adjusterChanged (saturated, saturated->getValue()); + pastSatTog->set_active(false); + adjusterChanged(pastels, pastels->getValue()); + adjusterChanged(saturated, saturated->getValue()); } else { - pastSatTog->set_active (true); - adjusterChanged (pastels, pastels->getValue()); - adjusterChanged (saturated, saturated->getValue()); + pastSatTog->set_active(true); + adjusterChanged(pastels, pastels->getValue()); + adjusterChanged(saturated, saturated->getValue()); } - expcomp->setValue (nextdatasp[64]); - black->setValue (nextdatasp[65]); - hlcompr->setValue (nextdatasp[66]); - hlcomprthresh->setValue (nextdatasp[67]); - shcompr->setValue (nextdatasp[68]); - sensiex->setValue (nextdatasp[69]); + expcomp->setValue(nextdatasp[64]); + black->setValue(nextdatasp[65]); + hlcompr->setValue(nextdatasp[66]); + hlcomprthresh->setValue(nextdatasp[67]); + shcompr->setValue(nextdatasp[68]); + sensiex->setValue(nextdatasp[69]); - centerXbuf->setValue (nextdatasp[70]); - centerYbuf->setValue (nextdatasp[71]); - adjblur->setValue (nextdatasp[72]); + centerXbuf->setValue(nextdatasp[70]); + centerYbuf->setValue(nextdatasp[71]); + adjblur->setValue(nextdatasp[72]); //protectskin if (nextdatasp[73] == 0) { - cutpast->set_active (false); + cutpast->set_active(false); } else { - cutpast->set_active (true); + cutpast->set_active(true); } - chromacbdl->setValue (nextdatasp[74]); + chromacbdl->setValue(nextdatasp[74]); if (nextdatasp[75] == 0) { - lastdust->set_active (false); + lastdust->set_active(false); } else { - lastdust->set_active (true); + lastdust->set_active(true); } if (nextdatasp[76] == 0) { - blurMethod->set_active (0); + blurMethod->set_active(0); } else if (nextdatasp[76] == 1) { - blurMethod->set_active (1); + blurMethod->set_active(1); } else if (nextdatasp[76] == 2) { - blurMethod->set_active (2); + blurMethod->set_active(2); } if (nextdatasp[77] == 0) { - dustMethod->set_active (0); + dustMethod->set_active(0); } else if (nextdatasp[77] == 1) { - dustMethod->set_active (1); + dustMethod->set_active(1); } else if (nextdatasp[77] == 2) { - dustMethod->set_active (2); + dustMethod->set_active(2); } if (nextdatasp[78] == 0) { - Exclumethod->set_active (0); + Exclumethod->set_active(0); } else if (nextdatasp[78] == 1) { - Exclumethod->set_active (1); + Exclumethod->set_active(1); } - sensiexclu->setValue (nextdatasp[79]); - struc->setValue (nextdatasp[80]); + sensiexclu->setValue(nextdatasp[79]); + struc->setValue(nextdatasp[80]); double intermed = 0.01 * (double) nextdatasp[81]; - hueref->setValue (intermed); - chromaref->setValue (nextdatasp[82]); - lumaref->setValue (nextdatasp[83]); - sobelref->setValue (nextdatasp[84]); + hueref->setValue(intermed); + chromaref->setValue(nextdatasp[82]); + lumaref->setValue(nextdatasp[83]); + sobelref->setValue(nextdatasp[84]); int *s_datc; s_datc = new int[70]; int siz; - ImProcFunctions::strcurv_data (nextstr, s_datc, siz); + ImProcFunctions::strcurv_data(nextstr, s_datc, siz); std::vector creti; for (int j = 0; j < siz; j++) { - creti.push_back ((double) (s_datc[j]) / 1000.); + creti.push_back((double)(s_datc[j]) / 1000.); } delete [] s_datc; - cTgainshape->setCurve (creti); + cTgainshape->setCurve(creti); //LLcurv int *s_datcl; s_datcl = new int[70]; int sizl; - ImProcFunctions::strcurv_data (nextll_str, s_datcl, sizl); + ImProcFunctions::strcurv_data(nextll_str, s_datcl, sizl); std::vector cll; for (int j = 0; j < sizl; j++) { - cll.push_back ((double) (s_datcl[j]) / 1000.); + cll.push_back((double)(s_datcl[j]) / 1000.); } delete [] s_datcl; - llshape->setCurve (cll); + llshape->setCurve(cll); //CCcurv int *s_datcc; s_datcc = new int[70]; int sizc; - ImProcFunctions::strcurv_data (nextcc_str, s_datcc, sizc); + ImProcFunctions::strcurv_data(nextcc_str, s_datcc, sizc); std::vector ccc; for (int j = 0; j < sizc; j++) { - ccc.push_back ((double) (s_datcc[j]) / 1000.); + ccc.push_back((double)(s_datcc[j]) / 1000.); } delete [] s_datcc; - ccshape->setCurve (ccc); + ccshape->setCurve(ccc); //LHcurv int *s_datch; s_datch = new int[70]; int sizh; - ImProcFunctions::strcurv_data (nextlh_str, s_datch, sizh); + ImProcFunctions::strcurv_data(nextlh_str, s_datch, sizh); std::vector clh; for (int j = 0; j < sizh; j++) { - clh.push_back ((double) (s_datch[j]) / 1000.); + clh.push_back((double)(s_datch[j]) / 1000.); } delete [] s_datch; - LHshape->setCurve (clh); + LHshape->setCurve(clh); //HHcurv int *s_datchh; s_datchh = new int[70]; int sizhh; - ImProcFunctions::strcurv_data (nexthh_str, s_datchh, sizhh); + ImProcFunctions::strcurv_data(nexthh_str, s_datchh, sizhh); std::vector chh; for (int j = 0; j < sizhh; j++) { - chh.push_back ((double) (s_datchh[j]) / 1000.); + chh.push_back((double)(s_datchh[j]) / 1000.); } delete [] s_datchh; - HHshape->setCurve (chh); + HHshape->setCurve(chh); //skinTonesCurve int *s_datcsk; s_datcsk = new int[70]; int sizsk; - ImProcFunctions::strcurv_data (nextsk_str, s_datcsk, sizsk); + ImProcFunctions::strcurv_data(nextsk_str, s_datcsk, sizsk); std::vector csk; for (int j = 0; j < sizsk; j++) { - csk.push_back ((double) (s_datcsk[j]) / 1000.); + csk.push_back((double)(s_datcsk[j]) / 1000.); } delete [] s_datcsk; - skinTonesCurve->setCurve (csk); + skinTonesCurve->setCurve(csk); //PSthreshold int sizps = 2; int s_datcps[sizps + 1]; - ImProcFunctions::strcurv_data (nextps_str, s_datcps, sizps); - psThreshold->setValue (s_datcps[0], s_datcps[1]); + ImProcFunctions::strcurv_data(nextps_str, s_datcps, sizps); + psThreshold->setValue(s_datcps[0], s_datcps[1]); //exCurve int *s_datcex; s_datcex = new int[70]; int sizex; - ImProcFunctions::strcurv_data (nextex_str, s_datcex, sizex); + ImProcFunctions::strcurv_data(nextex_str, s_datcex, sizex); std::vector cex; for (int j = 0; j < sizex; j++) { - cex.push_back ((double) (s_datcex[j]) / 1000.); + cex.push_back((double)(s_datcex[j]) / 1000.); } delete [] s_datcex; - shape->setCurve (cex); + shape->setCurve(cex); - enableListener (); + enableListener(); //update all sliders by this strange process! if (anbspot->getValue() == 0) { - anbspot->setValue (1); + anbspot->setValue(1); if (options.rtSettings.locdelay) { if (anbspot->delay < 100) { @@ -1939,10 +1939,10 @@ bool Locallab::localComputed_ () } } - adjusterChanged (anbspot, 1); + adjusterChanged(anbspot, 1); } else if (anbspot->getValue() == 1) { - anbspot->setValue (0); + anbspot->setValue(0); if (options.rtSettings.locdelay) { if (anbspot->delay < 100) { @@ -1950,24 +1950,24 @@ bool Locallab::localComputed_ () } } - adjusterChanged (anbspot, 0); + adjusterChanged(anbspot, 0); } //update all curves std::vector cretirab; - cretirab = cTgainshaperab->getCurve (); + cretirab = cTgainshaperab->getCurve(); - if (cretirab.at (5) == 0.70) { - cretirab.at (5) = 0.9; - cTgainshaperab->setCurve (cretirab); + if (cretirab.at(5) == 0.70) { + cretirab.at(5) = 0.9; + cTgainshaperab->setCurve(cretirab); - curveChanged (cTgainshaperab); - } else if (cretirab.at (5) == 0.90) { - cretirab.at (5) = 0.7; - cTgainshaperab->setCurve (cretirab); - curveChanged (cTgainshaperab); + curveChanged(cTgainshaperab); + } else if (cretirab.at(5) == 0.90) { + cretirab.at(5) = 0.7; + cTgainshaperab->setCurve(cretirab); + curveChanged(cTgainshaperab); } @@ -1978,15 +1978,15 @@ bool Locallab::localComputed_ () //add events for each cases if (listener) { //for all sliders - listener->panelChanged (Evlocallabanbspot, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallabanbspot, ""); //anbspot->getTextValue()); } if (listener) {//for curve - listener->panelChanged (EvlocallabCTgainCurverab, M ("")); + listener->panelChanged(EvlocallabCTgainCurverab, M("")); } if (listener) {//for inverse color - listener->panelChanged (Evlocallabinvers, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinvers, M("GENERAL_ENABLED")); } if (listener) {//for cutpast @@ -1998,7 +1998,7 @@ bool Locallab::localComputed_ () } if (listener) {//for blur method - listener->panelChanged (EvlocallabblurMethod, blurMethod->get_active_text ()); + listener->panelChanged(EvlocallabblurMethod, blurMethod->get_active_text()); } if (listener) {//for dust method @@ -2006,90 +2006,90 @@ bool Locallab::localComputed_ () } if (listener) {//for Exclude method - listener->panelChanged (Evlocallabexclumethod, Exclumethod->get_active_text ()); + listener->panelChanged(Evlocallabexclumethod, Exclumethod->get_active_text()); } if (listener) {//for curvactiv - listener->panelChanged (Evlocallabcurvactiv, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabcurvactiv, M("GENERAL_ENABLED")); } if (listener) {//for inverse blurr - listener->panelChanged (Evlocallabinversrad, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinversrad, M("GENERAL_ENABLED")); } if (listener) {//for quality method - listener->panelChanged (EvlocallabqualityMethod, qualityMethod->get_active_text ()); + listener->panelChanged(EvlocallabqualityMethod, qualityMethod->get_active_text()); } if (listener) {//for quality method - listener->panelChanged (EvlocallabqualitycurveMethod, qualitycurveMethod->get_active_text ()); + listener->panelChanged(EvlocallabqualitycurveMethod, qualitycurveMethod->get_active_text()); } if (listener) {//for inverse retinex - listener->panelChanged (Evlocallabinversret, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinversret, M("GENERAL_ENABLED")); } if (listener) {//for inverse sharpen - listener->panelChanged (Evlocallabinverssha, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinverssha, M("GENERAL_ENABLED")); } if (listener) {//for Smethod : position of mouse cursor - listener->panelChanged (EvlocallabSmet, Smethod->get_active_text ()); + listener->panelChanged(EvlocallabSmet, Smethod->get_active_text()); } if (listener) {//for retinex method - listener->panelChanged (EvlocallabretinexMethod, retinexMethod->get_active_text ()); + listener->panelChanged(EvlocallabretinexMethod, retinexMethod->get_active_text()); } if (listener) {//for curve reti - listener->panelChanged (EvlocallabCTgainCurve, M ("")); + listener->panelChanged(EvlocallabCTgainCurve, M("")); } if (listener) {//for curve LL - listener->panelChanged (Evlocallabllshape, M ("")); + listener->panelChanged(Evlocallabllshape, M("")); } if (listener) {//for curve LH - listener->panelChanged (EvlocallabLHshape, M ("")); + listener->panelChanged(EvlocallabLHshape, M("")); } if (listener) {//for curve LH - listener->panelChanged (Evlocallabccshape, M ("")); + listener->panelChanged(Evlocallabccshape, M("")); } if (listener) {//for curve LH - listener->panelChanged (EvlocallabHHshape, M ("")); + listener->panelChanged(EvlocallabHHshape, M("")); } if (listener) {//for curve Skin - listener->panelChanged (EvlocallabSkinTonesCurve, M ("")); + listener->panelChanged(EvlocallabSkinTonesCurve, M("")); } if (listener) {//for PSthreshold - listener->panelChanged (EvlocallabPastSatThreshold, M ("")); + listener->panelChanged(EvlocallabPastSatThreshold, M("")); } //for checkbox if (listener) {//f - listener->panelChanged (EvlocallabProtectSkins, M ("")); + listener->panelChanged(EvlocallabProtectSkins, M("")); } if (listener) {//fo - listener->panelChanged (EvlocallabAvoidColorShift, M ("")); + listener->panelChanged(EvlocallabAvoidColorShift, M("")); } if (listener) {//for - listener->panelChanged (EvlocallabPastSatTog, M ("")); + listener->panelChanged(EvlocallabPastSatTog, M("")); } if (listener) {//for - listener->panelChanged (Evlocallabshape, M ("")); + listener->panelChanged(Evlocallabshape, M("")); } return false; } -void Locallab::localChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) +void Locallab::localChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) { for (int i = 2; i < 85; i++) { nextdatasp[i] = datasp[i][sp]; @@ -2105,10 +2105,10 @@ void Locallab::localChanged (int **datasp, std::string datastr, std::string ll_ nextex_str = ex_str; nextlength = maxdat; - g_idle_add (localChangedUI, this); + g_idle_add(localChangedUI, this); } -void Locallab::localretChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) +void Locallab::localretChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) { nextlength = maxdat; nextstr2 = datastr; @@ -2120,11 +2120,11 @@ void Locallab::localretChanged (int **datasp, std::string datastr, std::string nextps_str2 = ps_str; nextex_str2 = ex_str; - g_idle_add (localretChangedUI, this); + g_idle_add(localretChangedUI, this); } -void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) +void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) { anbspot->hide(); hueref->hide(); @@ -2134,310 +2134,310 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) centerXbuf->hide(); centerYbuf->hide(); - disableListener (); - enablecolorConn.block (true); - enablevibranceConn.block (true); - enableblurConn.block (true); - enabletonemapConn.block (true); - enableretiConn.block (true); - enablesharpConn.block (true); - enablecbdlConn.block (true); - enabledenoiConn.block (true); + disableListener(); + enablecolorConn.block(true); + enablevibranceConn.block(true); + enableblurConn.block(true); + enabletonemapConn.block(true); + enableretiConn.block(true); + enablesharpConn.block(true); + enablecbdlConn.block(true); + enabledenoiConn.block(true); if (pedited) { - degree->setEditedState (pedited->locallab.degree ? Edited : UnEdited); - locY->setEditedState (pedited->locallab.locY ? Edited : UnEdited); - locX->setEditedState (pedited->locallab.locX ? Edited : UnEdited); - locYT->setEditedState (pedited->locallab.locYT ? Edited : UnEdited); - locXL->setEditedState (pedited->locallab.locXL ? Edited : UnEdited); - centerX->setEditedState (pedited->locallab.centerX ? Edited : UnEdited); - centerY->setEditedState (pedited->locallab.centerY ? Edited : UnEdited); - circrad->setEditedState (pedited->locallab.circrad ? Edited : UnEdited); - centerXbuf->setEditedState (pedited->locallab.centerXbuf ? Edited : UnEdited); - centerYbuf->setEditedState (pedited->locallab.centerYbuf ? Edited : UnEdited); - adjblur->setEditedState (pedited->locallab.adjblur ? Edited : UnEdited); - thres->setEditedState (pedited->locallab.thres ? Edited : UnEdited); - proxi->setEditedState (pedited->locallab.proxi ? Edited : UnEdited); - lightness->setEditedState (pedited->locallab.lightness ? Edited : UnEdited); - contrast->setEditedState (pedited->locallab.contrast ? Edited : UnEdited); - chroma->setEditedState (pedited->locallab.chroma ? Edited : UnEdited); - expcomp->setEditedState (pedited->locallab.expcomp ? Edited : UnEdited); - hlcompr->setEditedState (pedited->locallab.hlcompr ? Edited : UnEdited); - hlcomprthresh->setEditedState (pedited->locallab.hlcomprthresh ? Edited : UnEdited); - black->setEditedState (pedited->locallab.black ? Edited : UnEdited); - shcompr->setEditedState (pedited->locallab.shcompr ? Edited : UnEdited); - sensiex->setEditedState (pedited->locallab.sensiex ? Edited : UnEdited); + degree->setEditedState(pedited->locallab.degree ? Edited : UnEdited); + locY->setEditedState(pedited->locallab.locY ? Edited : UnEdited); + locX->setEditedState(pedited->locallab.locX ? Edited : UnEdited); + locYT->setEditedState(pedited->locallab.locYT ? Edited : UnEdited); + locXL->setEditedState(pedited->locallab.locXL ? Edited : UnEdited); + centerX->setEditedState(pedited->locallab.centerX ? Edited : UnEdited); + centerY->setEditedState(pedited->locallab.centerY ? Edited : UnEdited); + circrad->setEditedState(pedited->locallab.circrad ? Edited : UnEdited); + centerXbuf->setEditedState(pedited->locallab.centerXbuf ? Edited : UnEdited); + centerYbuf->setEditedState(pedited->locallab.centerYbuf ? Edited : UnEdited); + adjblur->setEditedState(pedited->locallab.adjblur ? Edited : UnEdited); + thres->setEditedState(pedited->locallab.thres ? Edited : UnEdited); + proxi->setEditedState(pedited->locallab.proxi ? Edited : UnEdited); + lightness->setEditedState(pedited->locallab.lightness ? Edited : UnEdited); + contrast->setEditedState(pedited->locallab.contrast ? Edited : UnEdited); + chroma->setEditedState(pedited->locallab.chroma ? Edited : UnEdited); + expcomp->setEditedState(pedited->locallab.expcomp ? Edited : UnEdited); + hlcompr->setEditedState(pedited->locallab.hlcompr ? Edited : UnEdited); + hlcomprthresh->setEditedState(pedited->locallab.hlcomprthresh ? Edited : UnEdited); + black->setEditedState(pedited->locallab.black ? Edited : UnEdited); + shcompr->setEditedState(pedited->locallab.shcompr ? Edited : UnEdited); + sensiex->setEditedState(pedited->locallab.sensiex ? Edited : UnEdited); - sharradius->setEditedState (pedited->locallab.sharradius ? Edited : UnEdited); - sharamount->setEditedState (pedited->locallab.sharamount ? Edited : UnEdited); - shardamping->setEditedState (pedited->locallab.shardamping ? Edited : UnEdited); - shariter->setEditedState (pedited->locallab.shariter ? Edited : UnEdited); - sensisha->setEditedState (pedited->locallab.sensisha ? Edited : UnEdited); - noiselumf->setEditedState (pedited->locallab.noiselumf ? Edited : UnEdited); - noiselumc->setEditedState (pedited->locallab.noiselumc ? Edited : UnEdited); - noisechrof->setEditedState (pedited->locallab.noisechrof ? Edited : UnEdited); - noisechroc->setEditedState (pedited->locallab.noisechroc ? Edited : UnEdited); + sharradius->setEditedState(pedited->locallab.sharradius ? Edited : UnEdited); + sharamount->setEditedState(pedited->locallab.sharamount ? Edited : UnEdited); + shardamping->setEditedState(pedited->locallab.shardamping ? Edited : UnEdited); + shariter->setEditedState(pedited->locallab.shariter ? Edited : UnEdited); + sensisha->setEditedState(pedited->locallab.sensisha ? Edited : UnEdited); + noiselumf->setEditedState(pedited->locallab.noiselumf ? Edited : UnEdited); + noiselumc->setEditedState(pedited->locallab.noiselumc ? Edited : UnEdited); + noisechrof->setEditedState(pedited->locallab.noisechrof ? Edited : UnEdited); + noisechroc->setEditedState(pedited->locallab.noisechroc ? Edited : UnEdited); - pastels->setEditedState (pedited->locallab.pastels ? Edited : UnEdited); - saturated->setEditedState (pedited->locallab.saturated ? Edited : UnEdited); - psThreshold->setEditedState (pedited->locallab.psthreshold ? Edited : UnEdited); - protectSkins->set_inconsistent (!pedited->locallab.protectskins); - avoidColorShift->set_inconsistent (!pedited->locallab.avoidcolorshift); - pastSatTog->set_inconsistent (!pedited->locallab.pastsattog); - skinTonesCurve->setUnChanged (!pedited->locallab.skintonescurve); - sensiv->setEditedState (pedited->locallab.sensiv ? Edited : UnEdited); + pastels->setEditedState(pedited->locallab.pastels ? Edited : UnEdited); + saturated->setEditedState(pedited->locallab.saturated ? Edited : UnEdited); + psThreshold->setEditedState(pedited->locallab.psthreshold ? Edited : UnEdited); + protectSkins->set_inconsistent(!pedited->locallab.protectskins); + avoidColorShift->set_inconsistent(!pedited->locallab.avoidcolorshift); + pastSatTog->set_inconsistent(!pedited->locallab.pastsattog); + skinTonesCurve->setUnChanged(!pedited->locallab.skintonescurve); + sensiv->setEditedState(pedited->locallab.sensiv ? Edited : UnEdited); for (int i = 0; i < 5; i++) { - multiplier[i]->setEditedState (pedited->locallab.mult[i] ? Edited : UnEdited); + multiplier[i]->setEditedState(pedited->locallab.mult[i] ? Edited : UnEdited); } - threshold->setEditedState (pedited->locallab.threshold ? Edited : UnEdited); - chromacbdl->setEditedState (pedited->locallab.chromacbdl ? Edited : UnEdited); - sensiexclu->setEditedState (pedited->locallab.sensiexclu ? Edited : UnEdited); - struc->setEditedState (pedited->locallab.struc ? Edited : UnEdited); + threshold->setEditedState(pedited->locallab.threshold ? Edited : UnEdited); + chromacbdl->setEditedState(pedited->locallab.chromacbdl ? Edited : UnEdited); + sensiexclu->setEditedState(pedited->locallab.sensiexclu ? Edited : UnEdited); + struc->setEditedState(pedited->locallab.struc ? Edited : UnEdited); - sensi->setEditedState (pedited->locallab.sensi ? Edited : UnEdited); - sensih->setEditedState (pedited->locallab.sensih ? Edited : UnEdited); - retrab->setEditedState (pedited->locallab.retrab ? Edited : UnEdited); - sensicb->setEditedState (pedited->locallab.sensicb ? Edited : UnEdited); - sensibn->setEditedState (pedited->locallab.sensibn ? Edited : UnEdited); - sensitm->setEditedState (pedited->locallab.sensitm ? Edited : UnEdited); - radius->setEditedState (pedited->locallab.radius ? Edited : UnEdited); - strength->setEditedState (pedited->locallab.strength ? Edited : UnEdited); - stren->setEditedState (pedited->locallab.stren ? Edited : UnEdited); - gamma->setEditedState (pedited->locallab.gamma ? Edited : UnEdited); - estop->setEditedState (pedited->locallab.estop ? Edited : UnEdited); - scaltm->setEditedState (pedited->locallab.scaltm ? Edited : UnEdited); - rewei->setEditedState (pedited->locallab.rewei ? Edited : UnEdited); + sensi->setEditedState(pedited->locallab.sensi ? Edited : UnEdited); + sensih->setEditedState(pedited->locallab.sensih ? Edited : UnEdited); + retrab->setEditedState(pedited->locallab.retrab ? Edited : UnEdited); + sensicb->setEditedState(pedited->locallab.sensicb ? Edited : UnEdited); + sensibn->setEditedState(pedited->locallab.sensibn ? Edited : UnEdited); + sensitm->setEditedState(pedited->locallab.sensitm ? Edited : UnEdited); + radius->setEditedState(pedited->locallab.radius ? Edited : UnEdited); + strength->setEditedState(pedited->locallab.strength ? Edited : UnEdited); + stren->setEditedState(pedited->locallab.stren ? Edited : UnEdited); + gamma->setEditedState(pedited->locallab.gamma ? Edited : UnEdited); + estop->setEditedState(pedited->locallab.estop ? Edited : UnEdited); + scaltm->setEditedState(pedited->locallab.scaltm ? Edited : UnEdited); + rewei->setEditedState(pedited->locallab.rewei ? Edited : UnEdited); - nbspot->setEditedState (pedited->locallab.nbspot ? Edited : UnEdited); - anbspot->setEditedState (pedited->locallab.anbspot ? Edited : UnEdited); - hueref->setEditedState (pedited->locallab.hueref ? Edited : UnEdited); - chromaref->setEditedState (pedited->locallab.chromaref ? Edited : UnEdited); - lumaref->setEditedState (pedited->locallab.lumaref ? Edited : UnEdited); - sobelref->setEditedState (pedited->locallab.sobelref ? Edited : UnEdited); - transit->setEditedState (pedited->locallab.transit ? Edited : UnEdited); - str->setEditedState (pedited->locallab.str ? Edited : UnEdited); - neigh->setEditedState (pedited->locallab.neigh ? Edited : UnEdited); - vart->setEditedState (pedited->locallab.vart ? Edited : UnEdited); - chrrt->setEditedState (pedited->locallab.chrrt ? Edited : UnEdited); - set_inconsistent (multiImage && !pedited->locallab.enabled); - avoid->set_inconsistent (multiImage && !pedited->locallab.avoid); - activlum->set_inconsistent (multiImage && !pedited->locallab.activlum); - invers->set_inconsistent (multiImage && !pedited->locallab.invers); - cutpast->set_inconsistent (multiImage && !pedited->locallab.cutpast); - lastdust->set_inconsistent (multiImage && !pedited->locallab.lastdust); - curvactiv->set_inconsistent (multiImage && !pedited->locallab.curvactiv); - inversrad->set_inconsistent (multiImage && !pedited->locallab.inversrad); - inverssha->set_inconsistent (multiImage && !pedited->locallab.inverssha); - cTgainshape->setUnChanged (!pedited->locallab.localTgaincurve); - llshape->setUnChanged (!pedited->locallab.llcurve); - ccshape->setUnChanged (!pedited->locallab.cccurve); - LHshape->setUnChanged (!pedited->locallab.LHcurve); - HHshape->setUnChanged (!pedited->locallab.HHcurve); - shape->setUnChanged (!pedited->locallab.excurve); - inversret->set_inconsistent (multiImage && !pedited->locallab.inversret); - cTgainshaperab->setUnChanged (!pedited->locallab.localTgaincurverab); - expcolor->set_inconsistent (!pedited->locallab.expcolor); - expexpose->set_inconsistent (!pedited->locallab.expexpose); - expvibrance->set_inconsistent (!pedited->locallab.expvibrance); - expblur->set_inconsistent (!pedited->locallab.expblur); - exptonemap->set_inconsistent (!pedited->locallab.exptonemap); - expreti->set_inconsistent (!pedited->locallab.expreti); - expsharp->set_inconsistent (!pedited->locallab.expsharp); - expcbdl->set_inconsistent (!pedited->locallab.expcbdl); - expdenoi->set_inconsistent (!pedited->locallab.expdenoi); + nbspot->setEditedState(pedited->locallab.nbspot ? Edited : UnEdited); + anbspot->setEditedState(pedited->locallab.anbspot ? Edited : UnEdited); + hueref->setEditedState(pedited->locallab.hueref ? Edited : UnEdited); + chromaref->setEditedState(pedited->locallab.chromaref ? Edited : UnEdited); + lumaref->setEditedState(pedited->locallab.lumaref ? Edited : UnEdited); + sobelref->setEditedState(pedited->locallab.sobelref ? Edited : UnEdited); + transit->setEditedState(pedited->locallab.transit ? Edited : UnEdited); + str->setEditedState(pedited->locallab.str ? Edited : UnEdited); + neigh->setEditedState(pedited->locallab.neigh ? Edited : UnEdited); + vart->setEditedState(pedited->locallab.vart ? Edited : UnEdited); + chrrt->setEditedState(pedited->locallab.chrrt ? Edited : UnEdited); + set_inconsistent(multiImage && !pedited->locallab.enabled); + avoid->set_inconsistent(multiImage && !pedited->locallab.avoid); + activlum->set_inconsistent(multiImage && !pedited->locallab.activlum); + invers->set_inconsistent(multiImage && !pedited->locallab.invers); + cutpast->set_inconsistent(multiImage && !pedited->locallab.cutpast); + lastdust->set_inconsistent(multiImage && !pedited->locallab.lastdust); + curvactiv->set_inconsistent(multiImage && !pedited->locallab.curvactiv); + inversrad->set_inconsistent(multiImage && !pedited->locallab.inversrad); + inverssha->set_inconsistent(multiImage && !pedited->locallab.inverssha); + cTgainshape->setUnChanged(!pedited->locallab.localTgaincurve); + llshape->setUnChanged(!pedited->locallab.llcurve); + ccshape->setUnChanged(!pedited->locallab.cccurve); + LHshape->setUnChanged(!pedited->locallab.LHcurve); + HHshape->setUnChanged(!pedited->locallab.HHcurve); + shape->setUnChanged(!pedited->locallab.excurve); + inversret->set_inconsistent(multiImage && !pedited->locallab.inversret); + cTgainshaperab->setUnChanged(!pedited->locallab.localTgaincurverab); + expcolor->set_inconsistent(!pedited->locallab.expcolor); + expexpose->set_inconsistent(!pedited->locallab.expexpose); + expvibrance->set_inconsistent(!pedited->locallab.expvibrance); + expblur->set_inconsistent(!pedited->locallab.expblur); + exptonemap->set_inconsistent(!pedited->locallab.exptonemap); + expreti->set_inconsistent(!pedited->locallab.expreti); + expsharp->set_inconsistent(!pedited->locallab.expsharp); + expcbdl->set_inconsistent(!pedited->locallab.expcbdl); + expdenoi->set_inconsistent(!pedited->locallab.expdenoi); if (!pedited->locallab.Smethod) { - Smethod->set_active_text (M ("GENERAL_UNCHANGED")); + Smethod->set_active_text(M("GENERAL_UNCHANGED")); } if (!pedited->locallab.Exclumethod) { - Exclumethod->set_active_text (M ("GENERAL_UNCHANGED")); + Exclumethod->set_active_text(M("GENERAL_UNCHANGED")); } if (!pedited->locallab.retinexMethod) { - retinexMethod->set_active_text (M ("GENERAL_UNCHANGED")); + retinexMethod->set_active_text(M("GENERAL_UNCHANGED")); } if (!pedited->locallab.blurMethod) { - blurMethod->set_active_text (M ("GENERAL_UNCHANGED")); + blurMethod->set_active_text(M("GENERAL_UNCHANGED")); } if (!pedited->locallab.dustMethod) { - dustMethod->set_active_text (M ("GENERAL_UNCHANGED")); + dustMethod->set_active_text(M("GENERAL_UNCHANGED")); } if (!pedited->locallab.qualityMethod) { - qualityMethod->set_active_text (M ("GENERAL_UNCHANGED")); + qualityMethod->set_active_text(M("GENERAL_UNCHANGED")); } if (!pedited->locallab.qualitycurveMethod) { - qualitycurveMethod->set_active_text (M ("GENERAL_UNCHANGED")); + qualitycurveMethod->set_active_text(M("GENERAL_UNCHANGED")); } } - setEnabled (pp->locallab.enabled); + setEnabled(pp->locallab.enabled); - Smethodconn.block (true); - Exclumethodconn.block (true); - retinexMethodConn.block (true); - qualityMethodConn.block (true); - qualitycurveMethodConn.block (true); - blurMethodConn.block (true); - dustMethodConn.block (true); + Smethodconn.block(true); + Exclumethodconn.block(true); + retinexMethodConn.block(true); + qualityMethodConn.block(true); + qualitycurveMethodConn.block(true); + blurMethodConn.block(true); + dustMethodConn.block(true); - avoidConn.block (true); - avoid->set_active (pp->locallab.avoid); - avoidConn.block (false); - activlumConn.block (true); - activlum->set_active (pp->locallab.activlum); - activlumConn.block (false); - inversConn.block (true); - invers->set_active (pp->locallab.invers); - inversConn.block (false); - cutpastConn.block (true); - cutpast->set_active (pp->locallab.cutpast); - cutpastConn.block (false); - lastdustConn.block (true); - lastdust->set_active (pp->locallab.lastdust); - lastdustConn.block (false); + avoidConn.block(true); + avoid->set_active(pp->locallab.avoid); + avoidConn.block(false); + activlumConn.block(true); + activlum->set_active(pp->locallab.activlum); + activlumConn.block(false); + inversConn.block(true); + invers->set_active(pp->locallab.invers); + inversConn.block(false); + cutpastConn.block(true); + cutpast->set_active(pp->locallab.cutpast); + cutpastConn.block(false); + lastdustConn.block(true); + lastdust->set_active(pp->locallab.lastdust); + lastdustConn.block(false); - curvactivConn.block (true); - curvactiv->set_active (pp->locallab.curvactiv); - curvactivConn.block (false); - inversradConn.block (true); - inversrad->set_active (pp->locallab.inversrad); - inversradConn.block (false); - inversretConn.block (true); - inversret->set_active (pp->locallab.inversret); - inversretConn.block (false); - inversshaConn.block (true); - inverssha->set_active (pp->locallab.inverssha); - inversshaConn.block (false); + curvactivConn.block(true); + curvactiv->set_active(pp->locallab.curvactiv); + curvactivConn.block(false); + inversradConn.block(true); + inversrad->set_active(pp->locallab.inversrad); + inversradConn.block(false); + inversretConn.block(true); + inversret->set_active(pp->locallab.inversret); + inversretConn.block(false); + inversshaConn.block(true); + inverssha->set_active(pp->locallab.inverssha); + inversshaConn.block(false); - degree->setValue (pp->locallab.degree); - locY->setValue (pp->locallab.locY); - locX->setValue (pp->locallab.locX); - locYT->setValue (pp->locallab.locYT); - locXL->setValue (pp->locallab.locXL); - centerX->setValue (pp->locallab.centerX); - centerY->setValue (pp->locallab.centerY); - circrad->setValue (pp->locallab.circrad); - centerXbuf->setValue (pp->locallab.centerXbuf); - centerYbuf->setValue (pp->locallab.centerYbuf); - adjblur->setValue (pp->locallab.adjblur); - thres->setValue (pp->locallab.thres); - proxi->setValue (pp->locallab.proxi); - lightness->setValue (pp->locallab.lightness); - contrast->setValue (pp->locallab.contrast); - chroma->setValue (pp->locallab.chroma); - expcomp->setValue (pp->locallab.expcomp); - hlcompr->setValue (pp->locallab.hlcompr); - hlcomprthresh->setValue (pp->locallab.hlcomprthresh); - black->setValue (pp->locallab.black); - shcompr->setValue (pp->locallab.shcompr); - shcompr->set_sensitive (! ((int)black->getValue () == 0)); //at black=0 shcompr value has no effect - sensiexclu->setValue (pp->locallab.sensiexclu); - struc->setValue (pp->locallab.struc); + degree->setValue(pp->locallab.degree); + locY->setValue(pp->locallab.locY); + locX->setValue(pp->locallab.locX); + locYT->setValue(pp->locallab.locYT); + locXL->setValue(pp->locallab.locXL); + centerX->setValue(pp->locallab.centerX); + centerY->setValue(pp->locallab.centerY); + circrad->setValue(pp->locallab.circrad); + centerXbuf->setValue(pp->locallab.centerXbuf); + centerYbuf->setValue(pp->locallab.centerYbuf); + adjblur->setValue(pp->locallab.adjblur); + thres->setValue(pp->locallab.thres); + proxi->setValue(pp->locallab.proxi); + lightness->setValue(pp->locallab.lightness); + contrast->setValue(pp->locallab.contrast); + chroma->setValue(pp->locallab.chroma); + expcomp->setValue(pp->locallab.expcomp); + hlcompr->setValue(pp->locallab.hlcompr); + hlcomprthresh->setValue(pp->locallab.hlcomprthresh); + black->setValue(pp->locallab.black); + shcompr->setValue(pp->locallab.shcompr); + shcompr->set_sensitive(!((int)black->getValue() == 0)); //at black=0 shcompr value has no effect + sensiexclu->setValue(pp->locallab.sensiexclu); + struc->setValue(pp->locallab.struc); - sharradius->setValue (pp->locallab.sharradius); - sharamount->setValue (pp->locallab.sharamount); - shardamping->setValue (pp->locallab.shardamping); - shariter->setValue (pp->locallab.shariter); - sensisha->setValue (pp->locallab.sensisha); - sensi->setValue (pp->locallab.sensi); - sensiex->setValue (pp->locallab.sensiex); - sensih->setValue (pp->locallab.sensih); - retrab->setValue (pp->locallab.retrab); - sensicb->setValue (pp->locallab.sensicb); - sensibn->setValue (pp->locallab.sensibn); - sensitm->setValue (pp->locallab.sensitm); - transit->setValue (pp->locallab.transit); - radius->setValue (pp->locallab.radius); - strength->setValue (pp->locallab.strength); - stren->setValue (pp->locallab.stren); - gamma->setValue (pp->locallab.gamma); - estop->setValue (pp->locallab.estop); - scaltm->setValue (pp->locallab.scaltm); - rewei->setValue (pp->locallab.rewei); - str->setValue (pp->locallab.str); - neigh->setValue (pp->locallab.neigh); - nbspot->setValue (pp->locallab.nbspot); - anbspot->setValue (pp->locallab.anbspot); - hueref->setValue (pp->locallab.hueref); - chromaref->setValue (pp->locallab.chromaref); - lumaref->setValue (pp->locallab.lumaref); - sobelref->setValue (pp->locallab.sobelref); - vart->setValue (pp->locallab.vart); - chrrt->setValue (pp->locallab.chrrt); - cTgainshape->setCurve (pp->locallab.localTgaincurve); - cTgainshaperab->setCurve (pp->locallab.localTgaincurverab); - llshape->setCurve (pp->locallab.llcurve); - ccshape->setCurve (pp->locallab.cccurve); - LHshape->setCurve (pp->locallab.LHcurve); - shape->setCurve (pp->locallab.excurve); - HHshape->setCurve (pp->locallab.HHcurve); + sharradius->setValue(pp->locallab.sharradius); + sharamount->setValue(pp->locallab.sharamount); + shardamping->setValue(pp->locallab.shardamping); + shariter->setValue(pp->locallab.shariter); + sensisha->setValue(pp->locallab.sensisha); + sensi->setValue(pp->locallab.sensi); + sensiex->setValue(pp->locallab.sensiex); + sensih->setValue(pp->locallab.sensih); + retrab->setValue(pp->locallab.retrab); + sensicb->setValue(pp->locallab.sensicb); + sensibn->setValue(pp->locallab.sensibn); + sensitm->setValue(pp->locallab.sensitm); + transit->setValue(pp->locallab.transit); + radius->setValue(pp->locallab.radius); + strength->setValue(pp->locallab.strength); + stren->setValue(pp->locallab.stren); + gamma->setValue(pp->locallab.gamma); + estop->setValue(pp->locallab.estop); + scaltm->setValue(pp->locallab.scaltm); + rewei->setValue(pp->locallab.rewei); + str->setValue(pp->locallab.str); + neigh->setValue(pp->locallab.neigh); + nbspot->setValue(pp->locallab.nbspot); + anbspot->setValue(pp->locallab.anbspot); + hueref->setValue(pp->locallab.hueref); + chromaref->setValue(pp->locallab.chromaref); + lumaref->setValue(pp->locallab.lumaref); + sobelref->setValue(pp->locallab.sobelref); + vart->setValue(pp->locallab.vart); + chrrt->setValue(pp->locallab.chrrt); + cTgainshape->setCurve(pp->locallab.localTgaincurve); + cTgainshaperab->setCurve(pp->locallab.localTgaincurverab); + llshape->setCurve(pp->locallab.llcurve); + ccshape->setCurve(pp->locallab.cccurve); + LHshape->setCurve(pp->locallab.LHcurve); + shape->setCurve(pp->locallab.excurve); + HHshape->setCurve(pp->locallab.HHcurve); lastactivlum = pp->locallab.activlum; lastanbspot = pp->locallab.anbspot; - noiselumf->setValue (pp->locallab.noiselumf); - noiselumc->setValue (pp->locallab.noiselumc); - noisechrof->setValue (pp->locallab.noisechrof); - noisechroc->setValue (pp->locallab.noisechroc); - expcolor->setEnabled (pp->locallab.expcolor); - expexpose->setEnabled (pp->locallab.expexpose); - expvibrance->setEnabled (pp->locallab.expvibrance); - sensiv->setValue (pp->locallab.sensiv); + noiselumf->setValue(pp->locallab.noiselumf); + noiselumc->setValue(pp->locallab.noiselumc); + noisechrof->setValue(pp->locallab.noisechrof); + noisechroc->setValue(pp->locallab.noisechroc); + expcolor->setEnabled(pp->locallab.expcolor); + expexpose->setEnabled(pp->locallab.expexpose); + expvibrance->setEnabled(pp->locallab.expvibrance); + sensiv->setValue(pp->locallab.sensiv); - pskinsconn.block (true); - protectSkins->set_active (pp->locallab.protectskins); - pskinsconn.block (false); + pskinsconn.block(true); + protectSkins->set_active(pp->locallab.protectskins); + pskinsconn.block(false); lastProtectSkins = pp->locallab.protectskins; - ashiftconn.block (true); - avoidColorShift->set_active (pp->locallab.avoidcolorshift); - ashiftconn.block (false); + ashiftconn.block(true); + avoidColorShift->set_active(pp->locallab.avoidcolorshift); + ashiftconn.block(false); lastAvoidColorShift = pp->locallab.avoidcolorshift; - pastsattogconn.block (true); - pastSatTog->set_active (pp->locallab.pastsattog); - pastsattogconn.block (false); + pastsattogconn.block(true); + pastSatTog->set_active(pp->locallab.pastsattog); + pastsattogconn.block(false); lastPastSatTog = pp->locallab.pastsattog; - pastels->setValue (pp->locallab.pastels); + pastels->setValue(pp->locallab.pastels); psThreshold->setValue (pp->locallab.psthreshold); if (lastPastSatTog) { // Link both slider, so we set saturated and psThresholds unsensitive - psThreshold->set_sensitive (false); - saturated->set_sensitive (false); - saturated->setValue (pp->locallab.pastels); // Pastels and Saturated are linked + psThreshold->set_sensitive(false); + saturated->set_sensitive(false); + saturated->setValue(pp->locallab.pastels); // Pastels and Saturated are linked } else { // Separate sliders, so we set saturated and psThresholds sensitive again - psThreshold->set_sensitive (true); - saturated->set_sensitive (true); - saturated->setValue (pp->locallab.saturated); // Pastels and Saturated are separate + psThreshold->set_sensitive(true); + saturated->set_sensitive(true); + saturated->setValue(pp->locallab.saturated); // Pastels and Saturated are separate } - skinTonesCurve->setCurve (pp->locallab.skintonescurve); + skinTonesCurve->setCurve(pp->locallab.skintonescurve); - expblur->setEnabled (pp->locallab.expblur); - exptonemap->setEnabled (pp->locallab.exptonemap); - expreti->setEnabled (pp->locallab.expreti); - expsharp->setEnabled (pp->locallab.expsharp); - expcbdl->setEnabled (pp->locallab.expcbdl); - expdenoi->setEnabled (pp->locallab.expdenoi); + expblur->setEnabled(pp->locallab.expblur); + exptonemap->setEnabled(pp->locallab.exptonemap); + expreti->setEnabled(pp->locallab.expreti); + expsharp->setEnabled(pp->locallab.expsharp); + expcbdl->setEnabled(pp->locallab.expcbdl); + expdenoi->setEnabled(pp->locallab.expdenoi); for (int i = 0; i < 5; i++) { - multiplier[i]->setValue (pp->locallab.mult[i]); + multiplier[i]->setValue(pp->locallab.mult[i]); } - threshold->setValue (pp->locallab.threshold); - chromacbdl->setValue (pp->locallab.chromacbdl); + threshold->setValue(pp->locallab.threshold); + chromacbdl->setValue(pp->locallab.chromacbdl); lastavoid = pp->locallab.avoid; lastinvers = pp->locallab.invers; @@ -2456,84 +2456,84 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) inversretChanged(); inversshaChanged(); - updateGeometry (pp->locallab.centerX, pp->locallab.centerY, pp->locallab.circrad, pp->locallab.locY, pp->locallab.degree, pp->locallab.locX, pp->locallab.locYT, pp->locallab.locXL); + updateGeometry(pp->locallab.centerX, pp->locallab.centerY, pp->locallab.circrad, pp->locallab.locY, pp->locallab.degree, pp->locallab.locX, pp->locallab.locYT, pp->locallab.locXL); if (pp->locallab.Smethod == "IND") { - Smethod->set_active (0); + Smethod->set_active(0); } else if (pp->locallab.Smethod == "SYM") { - Smethod->set_active (1); + Smethod->set_active(1); } else if (pp->locallab.Smethod == "INDSL") { - Smethod->set_active (2); + Smethod->set_active(2); } else if (pp->locallab.Smethod == "SYMSL") { - Smethod->set_active (3); + Smethod->set_active(3); } SmethodChanged(); - Smethodconn.block (false); + Smethodconn.block(false); if (pp->locallab.Exclumethod == "norm") { - Exclumethod->set_active (0); + Exclumethod->set_active(0); } else if (pp->locallab.Exclumethod == "exc") { - Exclumethod->set_active (1); + Exclumethod->set_active(1); } ExclumethodChanged(); - Exclumethodconn.block (false); + Exclumethodconn.block(false); if (pp->locallab.retinexMethod == "low") { - retinexMethod->set_active (0); + retinexMethod->set_active(0); } else if (pp->locallab.retinexMethod == "uni") { - retinexMethod->set_active (1); + retinexMethod->set_active(1); } else if (pp->locallab.retinexMethod == "high") { - retinexMethod->set_active (2); + retinexMethod->set_active(2); } - retinexMethodChanged (); - retinexMethodConn.block (false); + retinexMethodChanged(); + retinexMethodConn.block(false); if (pp->locallab.blurMethod == "norm") { - blurMethod->set_active (0); + blurMethod->set_active(0); } else if (pp->locallab.blurMethod == "inv") { - blurMethod->set_active (1); + blurMethod->set_active(1); } else if (pp->locallab.blurMethod == "sym") { - blurMethod->set_active (2); + blurMethod->set_active(2); } - blurMethodChanged (); - blurMethodConn.block (false); + blurMethodChanged(); + blurMethodConn.block(false); if (pp->locallab.dustMethod == "cop") { - dustMethod->set_active (0); + dustMethod->set_active(0); } else if (pp->locallab.dustMethod == "mov") { - dustMethod->set_active (1); + dustMethod->set_active(1); } else if (pp->locallab.dustMethod == "pas") { - dustMethod->set_active (2); + dustMethod->set_active(2); } - dustMethodChanged (); - dustMethodConn.block (false); + dustMethodChanged(); + dustMethodConn.block(false); if (pp->locallab.qualityMethod == "std") { - qualityMethod->set_active (0); + qualityMethod->set_active(0); } else if (pp->locallab.qualityMethod == "enh") { - qualityMethod->set_active (1); + qualityMethod->set_active(1); } else if (pp->locallab.qualityMethod == "enhden") { - qualityMethod->set_active (2); + qualityMethod->set_active(2); } - qualityMethodChanged (); - qualityMethodConn.block (false); + qualityMethodChanged(); + qualityMethodConn.block(false); if (pp->locallab.qualitycurveMethod == "none") { - qualitycurveMethod->set_active (0); + qualitycurveMethod->set_active(0); } else if (pp->locallab.qualitycurveMethod == "std") { - qualitycurveMethod->set_active (1); + qualitycurveMethod->set_active(1); } else if (pp->locallab.qualitycurveMethod == "enh") { - qualitycurveMethod->set_active (2); + qualitycurveMethod->set_active(2); } - qualitycurveMethodChanged (); - qualitycurveMethodConn.block (false); + qualitycurveMethodChanged(); + qualitycurveMethodConn.block(false); anbspot->hide(); hueref->hide(); @@ -2544,33 +2544,33 @@ void Locallab::read (const ProcParams* pp, const ParamsEdited* pedited) centerYbuf->hide(); if (pp->locallab.Smethod == "SYM" || pp->locallab.Smethod == "SYMSL") { - locXL->setValue (locX->getValue()); - locYT->setValue (locY->getValue()); + locXL->setValue(locX->getValue()); + locYT->setValue(locY->getValue()); } else if (pp->locallab.Smethod == "LOC") { - locXL->setValue (locX->getValue()); - locYT->setValue (locX->getValue()); - locY->setValue (locX->getValue()); + locXL->setValue(locX->getValue()); + locYT->setValue(locX->getValue()); + locY->setValue(locX->getValue()); } else if (pp->locallab.Smethod == "INDSL" || pp->locallab.Smethod == "IND") { - locX->setValue (pp->locallab.locX); - locY->setValue (pp->locallab.locY); - locXL->setValue (pp->locallab.locXL); - locYT->setValue (pp->locallab.locYT); + locX->setValue(pp->locallab.locX); + locY->setValue(pp->locallab.locY); + locXL->setValue(pp->locallab.locXL); + locYT->setValue(pp->locallab.locYT); } - enablecolorConn.block (false); - enablevibranceConn.block (false); - enableblurConn.block (false); - enabletonemapConn.block (false); - enableretiConn.block (false); - enablesharpConn.block (false); - enablecbdlConn.block (false); - enabledenoiConn.block (false); + enablecolorConn.block(false); + enablevibranceConn.block(false); + enableblurConn.block(false); + enabletonemapConn.block(false); + enableretiConn.block(false); + enablesharpConn.block(false); + enablecbdlConn.block(false); + enabledenoiConn.block(false); - enableListener (); + enableListener(); } -void Locallab::updateGeometry (const int centerX_, const int centerY_, const int circrad_, const int locY_, const double degree_, const int locX_, const int locYT_, const int locXL_, const int fullWidth, const int fullHeight) +void Locallab::updateGeometry(const int centerX_, const int centerY_, const int circrad_, const int locY_, const double degree_, const int locX_, const int locYT_, const int locXL_, const int fullWidth, const int fullHeight) { EditDataProvider* dataProvider = getEditProvider(); @@ -2586,7 +2586,7 @@ void Locallab::updateGeometry (const int centerX_, const int centerY_, const int imW = fullWidth; imH = fullHeight; } else { - dataProvider->getImageSize (imW, imH); + dataProvider->getImageSize(imW, imH); if (!imW || !imH) { return; @@ -2599,7 +2599,7 @@ void Locallab::updateGeometry (const int centerX_, const int centerY_, const int double decayYT = (locYT_) * double (imH) / 2000.; double decayX = (locX_) * (double (imW)) / 2000.; double decayXL = (locXL_) * (double (imW)) / 2000.; - rtengine::Coord origin (imW / 2 + centerX_ * imW / 2000.f, imH / 2 + centerY_ * imH / 2000.f); + rtengine::Coord origin(imW / 2 + centerX_ * imW / 2000.f, imH / 2 + centerY_ * imH / 2000.f); // printf("deX=%f dexL=%f deY=%f deyT=%f locX=%i locY=%i\n", decayX, decayXL, decayY, decayYT, locX_, locY_); if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { @@ -2621,27 +2621,27 @@ void Locallab::updateGeometry (const int centerX_, const int centerY_, const int line->end += origin; }; */ - const auto updateLineWithDecay = [&] (Geometry * geometry, const float radius, const float decal, const float offSetAngle) { - const auto line = static_cast (geometry); //180 - line->begin = PolarCoord (radius, -degree_ + decal) + PolarCoord (decay, -degree_ + offSetAngle); + const auto updateLineWithDecay = [&](Geometry * geometry, const float radius, const float decal, const float offSetAngle) { + const auto line = static_cast(geometry); //180 + line->begin = PolarCoord(radius, -degree_ + decal) + PolarCoord(decay, -degree_ + offSetAngle); line->begin += origin;//0 - line->end = PolarCoord (radius, -degree_ + (decal - 180)) + PolarCoord (decay, -degree_ + offSetAngle); + line->end = PolarCoord(radius, -degree_ + (decal - 180)) + PolarCoord(decay, -degree_ + offSetAngle); line->end += origin; }; - const auto updateCircle = [&] (Geometry * geometry) { - const auto circle = static_cast (geometry); + const auto updateCircle = [&](Geometry * geometry) { + const auto circle = static_cast(geometry); circle->center = origin; circle->radius = circrad_; }; - const auto updateBeziers = [&] (Geometry * geometry, const double dX_, const double dI_, const double dY_, const float begi, const float inte, const float en) { - const auto beziers = static_cast (geometry); - beziers->begin = PolarCoord (dX_, begi); + const auto updateBeziers = [&](Geometry * geometry, const double dX_, const double dI_, const double dY_, const float begi, const float inte, const float en) { + const auto beziers = static_cast(geometry); + beziers->begin = PolarCoord(dX_, begi); beziers->begin += origin;//0 - beziers->inter = PolarCoord (dI_, inte); + beziers->inter = PolarCoord(dI_, inte); beziers->inter += origin;//0 - beziers->end = PolarCoord (dY_, en); + beziers->end = PolarCoord(dY_, en); beziers->end += origin; // printf("dX=%f dI=%f dY=%f begx=%i begy=%i intx=%i inty=%i endx=%i endy=%i\n", dX_, dI_, dY_, beziers->begin.x, beziers->begin.y, beziers->inter.x, beziers->inter.y, beziers->end.x, beziers->end.y); }; @@ -2670,112 +2670,112 @@ void Locallab::updateGeometry (const int centerX_, const int centerY_, const int decay = decayX; - updateLineWithDecay (visibleGeometry.at (0), dimline, 90., 0.); - updateLineWithDecay (mouseOverGeometry.at (0), dimline, 90., 0.); + updateLineWithDecay(visibleGeometry.at(0), dimline, 90., 0.); + updateLineWithDecay(mouseOverGeometry.at(0), dimline, 90., 0.); decay = decayXL; - updateLineWithDecay (visibleGeometry.at (1), dimline, 90., 180.); - updateLineWithDecay (mouseOverGeometry.at (1), dimline, 90., 180.); + updateLineWithDecay(visibleGeometry.at(1), dimline, 90., 180.); + updateLineWithDecay(mouseOverGeometry.at(1), dimline, 90., 180.); decay = decayYT; - updateLineWithDecay (visibleGeometry.at (2), dimline, 180., 270.); - updateLineWithDecay (mouseOverGeometry.at (2), dimline, 180., 270.); + updateLineWithDecay(visibleGeometry.at(2), dimline, 180., 270.); + updateLineWithDecay(mouseOverGeometry.at(2), dimline, 180., 270.); decay = decayY; - updateLineWithDecay (visibleGeometry.at (3), dimline, 180, 90.); - updateLineWithDecay (mouseOverGeometry.at (3), dimline, 180., 90.); + updateLineWithDecay(visibleGeometry.at(3), dimline, 180, 90.); + updateLineWithDecay(mouseOverGeometry.at(3), dimline, 180., 90.); - updateCircle (visibleGeometry.at (4)); - updateCircle (mouseOverGeometry.at (4)); + updateCircle(visibleGeometry.at(4)); + updateCircle(mouseOverGeometry.at(4)); if (options.showdelimspot) { //this decayww evaluate approximation of a point in the ellipse for an angle alpha //this decayww evaluate approximation of a point in the ellipse for an angle alpha - double decay5 = 1.003819 * ((decayX * decayY) / sqrt (0.00765 * SQR (decayX) + SQR (decayY))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) - double decay15 = 1.03527 * ((decayX * decayY) / sqrt (0.07179 * SQR (decayX) + SQR (decayY))); //0.07179 = SQR(sin(15)/cos(15)) 1.03527 = 1 / cos(15) - double decay30 = 1.15473 * ((decayX * decayY) / sqrt (0.33335 * SQR (decayX) + SQR (decayY))); - double decay60 = 2. * ((decayX * decayY) / sqrt (3.0 * SQR (decayX) + SQR (decayY))); - double decay75 = 3.86398 * ((decayX * decayY) / sqrt (13.929 * SQR (decayX) + SQR (decayY))); - double decay85 = 11.473 * ((decayX * decayY) / sqrt (130.64 * SQR (decayX) + SQR (decayY))); + double decay5 = 1.003819 * ((decayX * decayY) / sqrt(0.00765 * SQR(decayX) + SQR(decayY))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) + double decay15 = 1.03527 * ((decayX * decayY) / sqrt(0.07179 * SQR(decayX) + SQR(decayY))); //0.07179 = SQR(sin(15)/cos(15)) 1.03527 = 1 / cos(15) + double decay30 = 1.15473 * ((decayX * decayY) / sqrt(0.33335 * SQR(decayX) + SQR(decayY))); + double decay60 = 2. * ((decayX * decayY) / sqrt(3.0 * SQR(decayX) + SQR(decayY))); + double decay75 = 3.86398 * ((decayX * decayY) / sqrt(13.929 * SQR(decayX) + SQR(decayY))); + double decay85 = 11.473 * ((decayX * decayY) / sqrt(130.64 * SQR(decayX) + SQR(decayY))); - double decay5L = 1.003819 * ((decayXL * decayY) / sqrt (0.00765 * SQR (decayXL) + SQR (decayY))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) - double decay15L = 1.03527 * ((decayXL * decayY) / sqrt (0.07179 * SQR (decayXL) + SQR (decayY))); - double decay30L = 1.15473 * ((decayXL * decayY) / sqrt (0.33335 * SQR (decayXL) + SQR (decayY))); - double decay60L = 2. * ((decayXL * decayY) / sqrt (3.0 * SQR (decayXL) + SQR (decayY))); - double decay75L = 3.86398 * ((decayXL * decayY) / sqrt (13.929 * SQR (decayXL) + SQR (decayY))); - double decay85L = 11.473 * ((decayXL * decayY) / sqrt (130.64 * SQR (decayXL) + SQR (decayY))); + double decay5L = 1.003819 * ((decayXL * decayY) / sqrt(0.00765 * SQR(decayXL) + SQR(decayY))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) + double decay15L = 1.03527 * ((decayXL * decayY) / sqrt(0.07179 * SQR(decayXL) + SQR(decayY))); + double decay30L = 1.15473 * ((decayXL * decayY) / sqrt(0.33335 * SQR(decayXL) + SQR(decayY))); + double decay60L = 2. * ((decayXL * decayY) / sqrt(3.0 * SQR(decayXL) + SQR(decayY))); + double decay75L = 3.86398 * ((decayXL * decayY) / sqrt(13.929 * SQR(decayXL) + SQR(decayY))); + double decay85L = 11.473 * ((decayXL * decayY) / sqrt(130.64 * SQR(decayXL) + SQR(decayY))); - double decay5LT = 1.003819 * ((decayXL * decayYT) / sqrt (0.00765 * SQR (decayXL) + SQR (decayYT))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) - double decay15LT = 1.03527 * ((decayXL * decayYT) / sqrt (0.07179 * SQR (decayXL) + SQR (decayYT))); - double decay30LT = 1.15473 * ((decayXL * decayYT) / sqrt (0.33335 * SQR (decayXL) + SQR (decayYT))); - double decay60LT = 2. * ((decayXL * decayYT) / sqrt (3.0 * SQR (decayXL) + SQR (decayYT))); - double decay75LT = 3.86398 * ((decayXL * decayYT) / sqrt (13.929 * SQR (decayXL) + SQR (decayYT))); - double decay85LT = 11.473 * ((decayXL * decayYT) / sqrt (130.64 * SQR (decayXL) + SQR (decayYT))); + double decay5LT = 1.003819 * ((decayXL * decayYT) / sqrt(0.00765 * SQR(decayXL) + SQR(decayYT))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) + double decay15LT = 1.03527 * ((decayXL * decayYT) / sqrt(0.07179 * SQR(decayXL) + SQR(decayYT))); + double decay30LT = 1.15473 * ((decayXL * decayYT) / sqrt(0.33335 * SQR(decayXL) + SQR(decayYT))); + double decay60LT = 2. * ((decayXL * decayYT) / sqrt(3.0 * SQR(decayXL) + SQR(decayYT))); + double decay75LT = 3.86398 * ((decayXL * decayYT) / sqrt(13.929 * SQR(decayXL) + SQR(decayYT))); + double decay85LT = 11.473 * ((decayXL * decayYT) / sqrt(130.64 * SQR(decayXL) + SQR(decayYT))); - double decay5T = 1.003819 * ((decayX * decayYT) / sqrt (0.00765 * SQR (decayX) + SQR (decayYT))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) - double decay15T = 1.03527 * ((decayX * decayYT) / sqrt (0.07179 * SQR (decayX) + SQR (decayYT))); - double decay30T = 1.15473 * ((decayX * decayYT) / sqrt (0.33335 * SQR (decayX) + SQR (decayYT))); - double decay60T = 2. * ((decayX * decayYT) / sqrt (3.0 * SQR (decayX) + SQR (decayYT))); - double decay75T = 3.86398 * ((decayX * decayYT) / sqrt (13.929 * SQR (decayX) + SQR (decayYT))); - double decay85T = 11.473 * ((decayX * decayYT) / sqrt (130.64 * SQR (decayX) + SQR (decayYT))); + double decay5T = 1.003819 * ((decayX * decayYT) / sqrt(0.00765 * SQR(decayX) + SQR(decayYT))); //0.07179 = SQR(sin(15)/cos(15)) 1.0038 = 1 / cos(5) + double decay15T = 1.03527 * ((decayX * decayYT) / sqrt(0.07179 * SQR(decayX) + SQR(decayYT))); + double decay30T = 1.15473 * ((decayX * decayYT) / sqrt(0.33335 * SQR(decayX) + SQR(decayYT))); + double decay60T = 2. * ((decayX * decayYT) / sqrt(3.0 * SQR(decayX) + SQR(decayYT))); + double decay75T = 3.86398 * ((decayX * decayYT) / sqrt(13.929 * SQR(decayX) + SQR(decayYT))); + double decay85T = 11.473 * ((decayX * decayYT) / sqrt(130.64 * SQR(decayX) + SQR(decayYT))); - double decay45 = (1.414 * decayX * decayY) / sqrt (SQR (decayX) + SQR (decayY)); - double decay45L = (1.414 * decayXL * decayY) / sqrt (SQR (decayXL) + SQR (decayY)); - double decay45LT = (1.414 * decayXL * decayYT) / sqrt (SQR (decayXL) + SQR (decayYT)); - double decay45T = (1.414 * decayX * decayYT) / sqrt (SQR (decayX) + SQR (decayYT)); + double decay45 = (1.414 * decayX * decayY) / sqrt(SQR(decayX) + SQR(decayY)); + double decay45L = (1.414 * decayXL * decayY) / sqrt(SQR(decayXL) + SQR(decayY)); + double decay45LT = (1.414 * decayXL * decayYT) / sqrt(SQR(decayXL) + SQR(decayYT)); + double decay45T = (1.414 * decayX * decayYT) / sqrt(SQR(decayX) + SQR(decayYT)); //printf("decayX=%f decayY=%f decay10=%f decay45=%f oriX=%i origY=%i\n", decayX, decayY, decay10, decay45, origin.x, origin.y); - updateBeziers (visibleGeometry.at (5), decayX, decay5, decay15, 0., 5., 15.); - updateBeziers (mouseOverGeometry.at (5), decayX, decay5, decay15, 0., 5., 15.); + updateBeziers(visibleGeometry.at(5), decayX, decay5, decay15, 0., 5., 15.); + updateBeziers(mouseOverGeometry.at(5), decayX, decay5, decay15, 0., 5., 15.); - updateBeziers (visibleGeometry.at (6), decay15, decay30, decay45, 15., 30., 45.); - updateBeziers (mouseOverGeometry.at (6), decay15, decay30, decay45, 15., 30., 45.); + updateBeziers(visibleGeometry.at(6), decay15, decay30, decay45, 15., 30., 45.); + updateBeziers(mouseOverGeometry.at(6), decay15, decay30, decay45, 15., 30., 45.); - updateBeziers (visibleGeometry.at (7), decay45, decay60, decay75, 45., 60., 75.); - updateBeziers (mouseOverGeometry.at (7), decay45, decay60, decay75, 45., 60., 75.); + updateBeziers(visibleGeometry.at(7), decay45, decay60, decay75, 45., 60., 75.); + updateBeziers(mouseOverGeometry.at(7), decay45, decay60, decay75, 45., 60., 75.); - updateBeziers (visibleGeometry.at (8), decay75, decay85, decayY, 75., 85., 90.); - updateBeziers (mouseOverGeometry.at (8), decay75, decay85, decayY, 75., 85., 90.); + updateBeziers(visibleGeometry.at(8), decay75, decay85, decayY, 75., 85., 90.); + updateBeziers(mouseOverGeometry.at(8), decay75, decay85, decayY, 75., 85., 90.); - updateBeziers (visibleGeometry.at (9), decayY, decay85L, decay75L, 90., 95., 105.); - updateBeziers (mouseOverGeometry.at (9), decayY, decay85L, decay75L, 90., 95., 105.); + updateBeziers(visibleGeometry.at(9), decayY, decay85L, decay75L, 90., 95., 105.); + updateBeziers(mouseOverGeometry.at(9), decayY, decay85L, decay75L, 90., 95., 105.); - updateBeziers (visibleGeometry.at (10), decay75L, decay60L, decay45L, 105., 120., 135.); - updateBeziers (mouseOverGeometry.at (10), decay75L, decay60L, decay45L, 105., 120., 135.); + updateBeziers(visibleGeometry.at(10), decay75L, decay60L, decay45L, 105., 120., 135.); + updateBeziers(mouseOverGeometry.at(10), decay75L, decay60L, decay45L, 105., 120., 135.); - updateBeziers (visibleGeometry.at (11), decay45L, decay30L, decay15L, 135., 150., 165.); - updateBeziers (mouseOverGeometry.at (11), decay45L, decay30L, decay15L, 135., 150., 165.); + updateBeziers(visibleGeometry.at(11), decay45L, decay30L, decay15L, 135., 150., 165.); + updateBeziers(mouseOverGeometry.at(11), decay45L, decay30L, decay15L, 135., 150., 165.); - updateBeziers (visibleGeometry.at (12), decay15L, decay5L, decayXL, 165., 175., 180.); - updateBeziers (mouseOverGeometry.at (12), decay15L, decay5L, decayXL, 165., 175., 180.); + updateBeziers(visibleGeometry.at(12), decay15L, decay5L, decayXL, 165., 175., 180.); + updateBeziers(mouseOverGeometry.at(12), decay15L, decay5L, decayXL, 165., 175., 180.); - updateBeziers (visibleGeometry.at (13), decayXL, decay5LT, decay15LT, 180., 185., 195.); - updateBeziers (mouseOverGeometry.at (13), decayXL, decay5LT, decay15LT, 180., 185., 195.); + updateBeziers(visibleGeometry.at(13), decayXL, decay5LT, decay15LT, 180., 185., 195.); + updateBeziers(mouseOverGeometry.at(13), decayXL, decay5LT, decay15LT, 180., 185., 195.); - updateBeziers (visibleGeometry.at (14), decay15LT, decay30LT, decay45LT, 195., 210., 225.); - updateBeziers (mouseOverGeometry.at (14), decay15LT, decay30LT, decay45LT, 195., 210., 225.); + updateBeziers(visibleGeometry.at(14), decay15LT, decay30LT, decay45LT, 195., 210., 225.); + updateBeziers(mouseOverGeometry.at(14), decay15LT, decay30LT, decay45LT, 195., 210., 225.); - updateBeziers (visibleGeometry.at (15), decay45LT, decay60LT, decay75LT, 225., 240., 255.); - updateBeziers (mouseOverGeometry.at (15), decay45LT, decay60LT, decay75LT, 225., 240., 255.); + updateBeziers(visibleGeometry.at(15), decay45LT, decay60LT, decay75LT, 225., 240., 255.); + updateBeziers(mouseOverGeometry.at(15), decay45LT, decay60LT, decay75LT, 225., 240., 255.); - updateBeziers (visibleGeometry.at (16), decay75LT, decay85LT, decayYT, 255., 265., 270.); - updateBeziers (mouseOverGeometry.at (16), decay75LT, decay85LT, decayYT, 255., 265., 270.); + updateBeziers(visibleGeometry.at(16), decay75LT, decay85LT, decayYT, 255., 265., 270.); + updateBeziers(mouseOverGeometry.at(16), decay75LT, decay85LT, decayYT, 255., 265., 270.); - updateBeziers (visibleGeometry.at (17), decayYT, decay85T, decay75T, 270., 275., 285.); - updateBeziers (mouseOverGeometry.at (17), decayYT, decay85T, decay75T, 270., 275., 285.); + updateBeziers(visibleGeometry.at(17), decayYT, decay85T, decay75T, 270., 275., 285.); + updateBeziers(mouseOverGeometry.at(17), decayYT, decay85T, decay75T, 270., 275., 285.); - updateBeziers (visibleGeometry.at (18), decay75T, decay60T, decay45T, 285., 300., 315.); - updateBeziers (mouseOverGeometry.at (18), decay75T, decay60T, decay45T, 285., 300., 315.); + updateBeziers(visibleGeometry.at(18), decay75T, decay60T, decay45T, 285., 300., 315.); + updateBeziers(mouseOverGeometry.at(18), decay75T, decay60T, decay45T, 285., 300., 315.); - updateBeziers (visibleGeometry.at (19), decay45T, decay30T, decay15T, 315., 330., 345.); - updateBeziers (mouseOverGeometry.at (19), decay45T, decay30T, decay15T, 315., 330., 345.); + updateBeziers(visibleGeometry.at(19), decay45T, decay30T, decay15T, 315., 330., 345.); + updateBeziers(mouseOverGeometry.at(19), decay45T, decay30T, decay15T, 315., 330., 345.); - updateBeziers (visibleGeometry.at (20), decay15T, decay5T, decayX, 345., 355., 360.); - updateBeziers (mouseOverGeometry.at (20), decay15T, decay5T, decayX, 345., 355., 360.); + updateBeziers(visibleGeometry.at(20), decay15T, decay5T, decayX, 345., 355., 360.); + updateBeziers(mouseOverGeometry.at(20), decay15T, decay5T, decayX, 345., 355., 360.); } @@ -2784,56 +2784,56 @@ void Locallab::updateGeometry (const int centerX_, const int centerY_, const int } -void Locallab::write (ProcParams* pp, ParamsEdited* pedited) +void Locallab::write(ProcParams* pp, ParamsEdited* pedited) { - pp->locallab.degree = degree->getValue (); - pp->locallab.locY = locY->getIntValue (); - pp->locallab.locX = locX->getValue (); - pp->locallab.locYT = locYT->getIntValue (); - pp->locallab.locXL = locXL->getValue (); - pp->locallab.centerX = centerX->getIntValue (); - pp->locallab.centerY = centerY->getIntValue (); - pp->locallab.circrad = circrad->getIntValue (); - pp->locallab.centerXbuf = centerXbuf->getIntValue (); - pp->locallab.centerYbuf = centerYbuf->getIntValue (); - pp->locallab.adjblur = adjblur->getIntValue (); - pp->locallab.proxi = proxi->getIntValue (); - pp->locallab.thres = thres->getIntValue (); - pp->locallab.lightness = lightness->getIntValue (); - pp->locallab.contrast = contrast->getIntValue (); - pp->locallab.chroma = chroma->getIntValue (); - pp->locallab.expcomp = expcomp->getValue (); - pp->locallab.black = (int)black->getValue (); - pp->locallab.hlcompr = (int)hlcompr->getValue (); - pp->locallab.hlcomprthresh = (int)hlcomprthresh->getValue (); - pp->locallab.shcompr = (int)shcompr->getValue (); - pp->locallab.noiselumc = noiselumc->getIntValue (); - pp->locallab.noiselumf = noiselumf->getIntValue (); - pp->locallab.noisechrof = noisechrof->getIntValue (); - pp->locallab.noisechroc = noisechroc->getIntValue (); - pp->locallab.sharradius = sharradius->getIntValue (); - pp->locallab.sharamount = sharamount->getIntValue (); - pp->locallab.shardamping = shardamping->getIntValue (); - pp->locallab.shariter = shariter->getIntValue (); - pp->locallab.sensisha = sensisha->getIntValue (); - pp->locallab.sensi = sensi->getIntValue (); - pp->locallab.sensiex = sensiex->getIntValue (); - pp->locallab.sensih = sensih->getIntValue (); - pp->locallab.retrab = retrab->getIntValue (); - pp->locallab.sensicb = sensicb->getIntValue (); - pp->locallab.sensiexclu = sensiexclu->getIntValue (); - pp->locallab.struc = struc->getIntValue (); - pp->locallab.sensibn = sensibn->getIntValue (); - pp->locallab.sensitm = sensitm->getIntValue (); - pp->locallab.radius = radius->getIntValue (); - pp->locallab.strength = strength->getIntValue (); - pp->locallab.stren = stren->getIntValue (); - pp->locallab.gamma = gamma->getIntValue (); - pp->locallab.estop = estop->getIntValue (); - pp->locallab.scaltm = scaltm->getIntValue (); - pp->locallab.rewei = rewei->getIntValue (); + pp->locallab.degree = degree->getValue(); + pp->locallab.locY = locY->getIntValue(); + pp->locallab.locX = locX->getValue(); + pp->locallab.locYT = locYT->getIntValue(); + pp->locallab.locXL = locXL->getValue(); + pp->locallab.centerX = centerX->getIntValue(); + pp->locallab.centerY = centerY->getIntValue(); + pp->locallab.circrad = circrad->getIntValue(); + pp->locallab.centerXbuf = centerXbuf->getIntValue(); + pp->locallab.centerYbuf = centerYbuf->getIntValue(); + pp->locallab.adjblur = adjblur->getIntValue(); + pp->locallab.proxi = proxi->getIntValue(); + pp->locallab.thres = thres->getIntValue(); + pp->locallab.lightness = lightness->getIntValue(); + pp->locallab.contrast = contrast->getIntValue(); + pp->locallab.chroma = chroma->getIntValue(); + pp->locallab.expcomp = expcomp->getValue(); + pp->locallab.black = (int)black->getValue(); + pp->locallab.hlcompr = (int)hlcompr->getValue(); + pp->locallab.hlcomprthresh = (int)hlcomprthresh->getValue(); + pp->locallab.shcompr = (int)shcompr->getValue(); + pp->locallab.noiselumc = noiselumc->getIntValue(); + pp->locallab.noiselumf = noiselumf->getIntValue(); + pp->locallab.noisechrof = noisechrof->getIntValue(); + pp->locallab.noisechroc = noisechroc->getIntValue(); + pp->locallab.sharradius = sharradius->getIntValue(); + pp->locallab.sharamount = sharamount->getIntValue(); + pp->locallab.shardamping = shardamping->getIntValue(); + pp->locallab.shariter = shariter->getIntValue(); + pp->locallab.sensisha = sensisha->getIntValue(); + pp->locallab.sensi = sensi->getIntValue(); + pp->locallab.sensiex = sensiex->getIntValue(); + pp->locallab.sensih = sensih->getIntValue(); + pp->locallab.retrab = retrab->getIntValue(); + pp->locallab.sensicb = sensicb->getIntValue(); + pp->locallab.sensiexclu = sensiexclu->getIntValue(); + pp->locallab.struc = struc->getIntValue(); + pp->locallab.sensibn = sensibn->getIntValue(); + pp->locallab.sensitm = sensitm->getIntValue(); + pp->locallab.radius = radius->getIntValue(); + pp->locallab.strength = strength->getIntValue(); + pp->locallab.stren = stren->getIntValue(); + pp->locallab.gamma = gamma->getIntValue(); + pp->locallab.estop = estop->getIntValue(); + pp->locallab.scaltm = scaltm->getIntValue(); + pp->locallab.rewei = rewei->getIntValue(); pp->locallab.enabled = getEnabled(); - pp->locallab.transit = transit->getIntValue (); + pp->locallab.transit = transit->getIntValue(); pp->locallab.avoid = avoid->get_active(); pp->locallab.activlum = activlum->get_active(); pp->locallab.invers = invers->get_active(); @@ -2843,23 +2843,23 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pp->locallab.inversrad = inversrad->get_active(); pp->locallab.inversret = inversret->get_active(); pp->locallab.inverssha = inverssha->get_active(); - pp->locallab.str = str->getIntValue (); - pp->locallab.neigh = neigh->getIntValue (); - pp->locallab.nbspot = nbspot->getIntValue (); - pp->locallab.anbspot = anbspot->getIntValue (); - pp->locallab.hueref = hueref->getValue (); - pp->locallab.chromaref = chromaref->getValue (); - pp->locallab.lumaref = lumaref->getValue (); - pp->locallab.sobelref = sobelref->getValue (); - pp->locallab.vart = vart->getIntValue (); - pp->locallab.chrrt = chrrt->getIntValue (); - pp->locallab.localTgaincurve = cTgainshape->getCurve (); - pp->locallab.localTgaincurverab = cTgainshaperab->getCurve (); - pp->locallab.llcurve = llshape->getCurve (); - pp->locallab.cccurve = ccshape->getCurve (); - pp->locallab.LHcurve = LHshape->getCurve (); - pp->locallab.HHcurve = HHshape->getCurve (); - pp->locallab.excurve = shape->getCurve (); + pp->locallab.str = str->getIntValue(); + pp->locallab.neigh = neigh->getIntValue(); + pp->locallab.nbspot = nbspot->getIntValue(); + pp->locallab.anbspot = anbspot->getIntValue(); + pp->locallab.hueref = hueref->getValue(); + pp->locallab.chromaref = chromaref->getValue(); + pp->locallab.lumaref = lumaref->getValue(); + pp->locallab.sobelref = sobelref->getValue(); + pp->locallab.vart = vart->getIntValue(); + pp->locallab.chrrt = chrrt->getIntValue(); + pp->locallab.localTgaincurve = cTgainshape->getCurve(); + pp->locallab.localTgaincurverab = cTgainshaperab->getCurve(); + pp->locallab.llcurve = llshape->getCurve(); + pp->locallab.cccurve = ccshape->getCurve(); + pp->locallab.LHcurve = LHshape->getCurve(); + pp->locallab.HHcurve = HHshape->getCurve(); + pp->locallab.excurve = shape->getCurve(); pp->locallab.expcolor = expcolor->getEnabled(); pp->locallab.expexpose = expexpose->getEnabled(); pp->locallab.expvibrance = expvibrance->getEnabled(); @@ -2878,71 +2878,71 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pp->locallab.chromacbdl = chromacbdl->getIntValue(); pp->locallab.pastels = pastels->getIntValue(); - pp->locallab.saturated = pastSatTog->get_active() ? pp->locallab.pastels : saturated->getIntValue (); + pp->locallab.saturated = pastSatTog->get_active() ? pp->locallab.pastels : saturated->getIntValue(); pp->locallab.psthreshold = psThreshold->getValue (); - pp->locallab.protectskins = protectSkins->get_active (); - pp->locallab.avoidcolorshift = avoidColorShift->get_active (); - pp->locallab.pastsattog = pastSatTog->get_active (); - pp->locallab.skintonescurve = skinTonesCurve->getCurve (); - pp->locallab.sensiv = sensiv->getIntValue (); + pp->locallab.protectskins = protectSkins->get_active(); + pp->locallab.avoidcolorshift = avoidColorShift->get_active(); + pp->locallab.pastsattog = pastSatTog->get_active(); + pp->locallab.skintonescurve = skinTonesCurve->getCurve(); + pp->locallab.sensiv = sensiv->getIntValue(); if (pedited) { - pedited->locallab.degree = degree->getEditedState (); - pedited->locallab.Smethod = Smethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.Exclumethod = Exclumethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.retinexMethod = retinexMethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.qualityMethod = qualityMethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.qualitycurveMethod = qualitycurveMethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.blurMethod = blurMethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.dustMethod = dustMethod->get_active_text() != M ("GENERAL_UNCHANGED"); - pedited->locallab.locY = locY->getEditedState (); - pedited->locallab.locX = locX->getEditedState (); - pedited->locallab.locYT = locYT->getEditedState (); - pedited->locallab.locXL = locXL->getEditedState (); - pedited->locallab.centerX = centerX->getEditedState (); - pedited->locallab.centerY = centerY->getEditedState (); - pedited->locallab.circrad = circrad->getEditedState (); - pedited->locallab.centerXbuf = centerXbuf->getEditedState (); - pedited->locallab.centerYbuf = centerYbuf->getEditedState (); - pedited->locallab.adjblur = adjblur->getEditedState (); - pedited->locallab.proxi = proxi->getEditedState (); - pedited->locallab.thres = thres->getEditedState (); - pedited->locallab.lightness = lightness->getEditedState (); - pedited->locallab.contrast = contrast->getEditedState (); - pedited->locallab.chroma = chroma->getEditedState (); - pedited->locallab.expcomp = expcomp->getEditedState (); - pedited->locallab.black = black->getEditedState (); - pedited->locallab.hlcompr = hlcompr->getEditedState (); - pedited->locallab.hlcomprthresh = hlcomprthresh->getEditedState (); - pedited->locallab.shcompr = shcompr->getEditedState (); + pedited->locallab.degree = degree->getEditedState(); + pedited->locallab.Smethod = Smethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.Exclumethod = Exclumethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.retinexMethod = retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.qualityMethod = qualityMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.qualitycurveMethod = qualitycurveMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.blurMethod = blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.dustMethod = dustMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.locY = locY->getEditedState(); + pedited->locallab.locX = locX->getEditedState(); + pedited->locallab.locYT = locYT->getEditedState(); + pedited->locallab.locXL = locXL->getEditedState(); + pedited->locallab.centerX = centerX->getEditedState(); + pedited->locallab.centerY = centerY->getEditedState(); + pedited->locallab.circrad = circrad->getEditedState(); + pedited->locallab.centerXbuf = centerXbuf->getEditedState(); + pedited->locallab.centerYbuf = centerYbuf->getEditedState(); + pedited->locallab.adjblur = adjblur->getEditedState(); + pedited->locallab.proxi = proxi->getEditedState(); + pedited->locallab.thres = thres->getEditedState(); + pedited->locallab.lightness = lightness->getEditedState(); + pedited->locallab.contrast = contrast->getEditedState(); + pedited->locallab.chroma = chroma->getEditedState(); + pedited->locallab.expcomp = expcomp->getEditedState(); + pedited->locallab.black = black->getEditedState(); + pedited->locallab.hlcompr = hlcompr->getEditedState(); + pedited->locallab.hlcomprthresh = hlcomprthresh->getEditedState(); + pedited->locallab.shcompr = shcompr->getEditedState(); - pedited->locallab.noiselumf = noiselumf->getEditedState (); - pedited->locallab.noiselumc = noiselumc->getEditedState (); - pedited->locallab.noisechrof = noisechrof->getEditedState (); - pedited->locallab.noisechroc = noisechroc->getEditedState (); - pedited->locallab.sharradius = sharradius->getEditedState (); - pedited->locallab.sharamount = sharamount->getEditedState (); - pedited->locallab.shardamping = shardamping->getEditedState (); - pedited->locallab.shariter = shariter->getEditedState (); - pedited->locallab.sensisha = sensisha->getEditedState (); - pedited->locallab.sensi = sensi->getEditedState (); - pedited->locallab.sensiex = sensiex->getEditedState (); - pedited->locallab.sensih = sensih->getEditedState (); - pedited->locallab.retrab = retrab->getEditedState (); - pedited->locallab.sensicb = sensicb->getEditedState (); - pedited->locallab.sensiexclu = sensiexclu->getEditedState (); - pedited->locallab.struc = struc->getEditedState (); - pedited->locallab.sensibn = sensibn->getEditedState (); - pedited->locallab.sensitm = sensitm->getEditedState (); - pedited->locallab.radius = radius->getEditedState (); - pedited->locallab.strength = strength->getEditedState (); - pedited->locallab.stren = stren->getEditedState (); - pedited->locallab.gamma = gamma->getEditedState (); - pedited->locallab.estop = estop->getEditedState (); - pedited->locallab.scaltm = scaltm->getEditedState (); - pedited->locallab.rewei = rewei->getEditedState (); - pedited->locallab.transit = transit->getEditedState (); + pedited->locallab.noiselumf = noiselumf->getEditedState(); + pedited->locallab.noiselumc = noiselumc->getEditedState(); + pedited->locallab.noisechrof = noisechrof->getEditedState(); + pedited->locallab.noisechroc = noisechroc->getEditedState(); + pedited->locallab.sharradius = sharradius->getEditedState(); + pedited->locallab.sharamount = sharamount->getEditedState(); + pedited->locallab.shardamping = shardamping->getEditedState(); + pedited->locallab.shariter = shariter->getEditedState(); + pedited->locallab.sensisha = sensisha->getEditedState(); + pedited->locallab.sensi = sensi->getEditedState(); + pedited->locallab.sensiex = sensiex->getEditedState(); + pedited->locallab.sensih = sensih->getEditedState(); + pedited->locallab.retrab = retrab->getEditedState(); + pedited->locallab.sensicb = sensicb->getEditedState(); + pedited->locallab.sensiexclu = sensiexclu->getEditedState(); + pedited->locallab.struc = struc->getEditedState(); + pedited->locallab.sensibn = sensibn->getEditedState(); + pedited->locallab.sensitm = sensitm->getEditedState(); + pedited->locallab.radius = radius->getEditedState(); + pedited->locallab.strength = strength->getEditedState(); + pedited->locallab.stren = stren->getEditedState(); + pedited->locallab.gamma = gamma->getEditedState(); + pedited->locallab.estop = estop->getEditedState(); + pedited->locallab.scaltm = scaltm->getEditedState(); + pedited->locallab.rewei = rewei->getEditedState(); + pedited->locallab.transit = transit->getEditedState(); pedited->locallab.enabled = !get_inconsistent(); pedited->locallab.avoid = !avoid->get_inconsistent(); pedited->locallab.invers = !invers->get_inconsistent(); @@ -2953,24 +2953,24 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pedited->locallab.inversret = !inversret->get_inconsistent(); pedited->locallab.inversrad = !inversrad->get_inconsistent(); pedited->locallab.inverssha = !inverssha->get_inconsistent(); - pedited->locallab.str = str->getEditedState (); - pedited->locallab.neigh = neigh->getEditedState (); - pedited->locallab.nbspot = nbspot->getEditedState (); - pedited->locallab.anbspot = anbspot->getEditedState (); - pedited->locallab.hueref = hueref->getEditedState (); - pedited->locallab.chromaref = chromaref->getEditedState (); - pedited->locallab.lumaref = lumaref->getEditedState (); - pedited->locallab.sobelref = sobelref->getEditedState (); + pedited->locallab.str = str->getEditedState(); + pedited->locallab.neigh = neigh->getEditedState(); + pedited->locallab.nbspot = nbspot->getEditedState(); + pedited->locallab.anbspot = anbspot->getEditedState(); + pedited->locallab.hueref = hueref->getEditedState(); + pedited->locallab.chromaref = chromaref->getEditedState(); + pedited->locallab.lumaref = lumaref->getEditedState(); + pedited->locallab.sobelref = sobelref->getEditedState(); - pedited->locallab.vart = vart->getEditedState (); - pedited->locallab.chrrt = chrrt->getEditedState (); - pedited->locallab.localTgaincurve = !cTgainshape->isUnChanged (); - pedited->locallab.localTgaincurverab = !cTgainshaperab->isUnChanged (); - pedited->locallab.llcurve = !llshape->isUnChanged (); - pedited->locallab.cccurve = !ccshape->isUnChanged (); - pedited->locallab.LHcurve = !LHshape->isUnChanged (); - pedited->locallab.excurve = !shape->isUnChanged (); - pedited->locallab.HHcurve = !HHshape->isUnChanged (); + pedited->locallab.vart = vart->getEditedState(); + pedited->locallab.chrrt = chrrt->getEditedState(); + pedited->locallab.localTgaincurve = !cTgainshape->isUnChanged(); + pedited->locallab.localTgaincurverab = !cTgainshaperab->isUnChanged(); + pedited->locallab.llcurve = !llshape->isUnChanged(); + pedited->locallab.cccurve = !ccshape->isUnChanged(); + pedited->locallab.LHcurve = !LHshape->isUnChanged(); + pedited->locallab.excurve = !shape->isUnChanged(); + pedited->locallab.HHcurve = !HHshape->isUnChanged(); pedited->locallab.expcolor = !expcolor->get_inconsistent(); pedited->locallab.expexpose = !expexpose->get_inconsistent(); pedited->locallab.expvibrance = !expvibrance->get_inconsistent(); @@ -2987,14 +2987,14 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) pedited->locallab.threshold = threshold->getEditedState(); pedited->locallab.chromacbdl = chromacbdl->getEditedState(); - pedited->locallab.pastels = pastels->getEditedState (); - pedited->locallab.saturated = saturated->getEditedState (); - pedited->locallab.psthreshold = psThreshold->getEditedState (); + pedited->locallab.pastels = pastels->getEditedState(); + pedited->locallab.saturated = saturated->getEditedState(); + pedited->locallab.psthreshold = psThreshold->getEditedState(); pedited->locallab.protectskins = !protectSkins->get_inconsistent(); pedited->locallab.avoidcolorshift = !avoidColorShift->get_inconsistent(); pedited->locallab.pastsattog = !pastSatTog->get_inconsistent(); - pedited->locallab.skintonescurve = !skinTonesCurve->isUnChanged (); - pedited->locallab.sensiv = sensiv->getEditedState (); + pedited->locallab.skintonescurve = !skinTonesCurve->isUnChanged(); + pedited->locallab.sensiv = sensiv->getEditedState(); } @@ -3076,85 +3076,85 @@ void Locallab::write (ProcParams* pp, ParamsEdited* pedited) } } -void Locallab::protectskins_toggled () +void Locallab::protectskins_toggled() { if (batchMode) { if (protectSkins->get_inconsistent()) { - protectSkins->set_inconsistent (false); - pskinsconn.block (true); - protectSkins->set_active (false); - pskinsconn.block (false); + protectSkins->set_inconsistent(false); + pskinsconn.block(true); + protectSkins->set_active(false); + pskinsconn.block(false); } else if (lastProtectSkins) { - protectSkins->set_inconsistent (true); + protectSkins->set_inconsistent(true); } - lastProtectSkins = protectSkins->get_active (); + lastProtectSkins = protectSkins->get_active(); } if (listener && getEnabled()) { - if (protectSkins->get_active ()) { - listener->panelChanged (EvlocallabProtectSkins, M ("GENERAL_ENABLED")); + if (protectSkins->get_active()) { + listener->panelChanged(EvlocallabProtectSkins, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvlocallabProtectSkins, M ("GENERAL_DISABLED")); + listener->panelChanged(EvlocallabProtectSkins, M("GENERAL_DISABLED")); } } } -void Locallab::avoidcolorshift_toggled () +void Locallab::avoidcolorshift_toggled() { if (batchMode) { if (avoidColorShift->get_inconsistent()) { - avoidColorShift->set_inconsistent (false); - ashiftconn.block (true); - avoidColorShift->set_active (false); - ashiftconn.block (false); + avoidColorShift->set_inconsistent(false); + ashiftconn.block(true); + avoidColorShift->set_active(false); + ashiftconn.block(false); } else if (lastAvoidColorShift) { - avoidColorShift->set_inconsistent (true); + avoidColorShift->set_inconsistent(true); } - lastAvoidColorShift = avoidColorShift->get_active (); + lastAvoidColorShift = avoidColorShift->get_active(); } if (listener && getEnabled()) { - if (avoidColorShift->get_active ()) { - listener->panelChanged (EvlocallabAvoidColorShift, M ("GENERAL_ENABLED")); + if (avoidColorShift->get_active()) { + listener->panelChanged(EvlocallabAvoidColorShift, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvlocallabAvoidColorShift, M ("GENERAL_DISABLED")); + listener->panelChanged(EvlocallabAvoidColorShift, M("GENERAL_DISABLED")); } } } -void Locallab::pastsattog_toggled () +void Locallab::pastsattog_toggled() { if (batchMode) { if (pastSatTog->get_inconsistent()) { - pastSatTog->set_inconsistent (false); - pastsattogconn.block (true); - pastSatTog->set_active (false); - pastsattogconn.block (false); + pastSatTog->set_inconsistent(false); + pastsattogconn.block(true); + pastSatTog->set_active(false); + pastsattogconn.block(false); } else if (lastPastSatTog) { - pastSatTog->set_inconsistent (true); + pastSatTog->set_inconsistent(true); } - lastPastSatTog = pastSatTog->get_active (); + lastPastSatTog = pastSatTog->get_active(); } if (pastSatTog->get_active()) { // Link both slider, so we set saturated and psThresholds unsensitive - psThreshold->set_sensitive (false); - saturated->set_sensitive (false); - saturated->setValue (pastels->getValue()); // Pastels and Saturated are linked + psThreshold->set_sensitive(false); + saturated->set_sensitive(false); + saturated->setValue(pastels->getValue()); // Pastels and Saturated are linked } else { // Separate sliders, so we set saturated and psThresholds sensitive again - psThreshold->set_sensitive (true); - saturated->set_sensitive (true); + psThreshold->set_sensitive(true); + saturated->set_sensitive(true); } if (listener && getEnabled()) { - if (pastSatTog->get_active ()) { - listener->panelChanged (EvlocallabPastSatTog, M ("GENERAL_ENABLED")); + if (pastSatTog->get_active()) { + listener->panelChanged(EvlocallabPastSatTog, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvlocallabPastSatTog, M ("GENERAL_DISABLED")); + listener->panelChanged(EvlocallabPastSatTog, M("GENERAL_DISABLED")); } } } @@ -3162,87 +3162,87 @@ void Locallab::pastsattog_toggled () -void Locallab::curveChanged (CurveEditor* ce) +void Locallab::curveChanged(CurveEditor* ce) { if (listener && getEnabled()) { if (ce == cTgainshape) { - listener->panelChanged (EvlocallabCTgainCurve, M ("HISTORY_CUSTOMCURVE"));//HISTORY_CUSTOMCURVE + listener->panelChanged(EvlocallabCTgainCurve, M("HISTORY_CUSTOMCURVE")); //HISTORY_CUSTOMCURVE int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); - adjusterChanged (retrab, strval); + adjusterChanged(retrab, strval); } else if (ce == cTgainshaperab) { - listener->panelChanged (EvlocallabCTgainCurverab, M ("")); + listener->panelChanged(EvlocallabCTgainCurverab, M("")); } else if (ce == LHshape) { - listener->panelChanged (EvlocallabLHshape, M ("")); + listener->panelChanged(EvlocallabLHshape, M("")); int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); - adjusterChanged (retrab, strval); + adjusterChanged(retrab, strval); } else if (ce == HHshape) { - listener->panelChanged (EvlocallabHHshape, M ("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvlocallabHHshape, M("HISTORY_CUSTOMCURVE")); int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); } else if (ce == shape) { - listener->panelChanged (Evlocallabshape, M ("HISTORY_CUSTOMCURVE")); + listener->panelChanged(Evlocallabshape, M("HISTORY_CUSTOMCURVE")); int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); - adjusterChanged (retrab, strval); + adjusterChanged(retrab, strval); } else if (ce == llshape) { - listener->panelChanged (Evlocallabllshape, M ("HISTORY_CUSTOMCURVE")); + listener->panelChanged(Evlocallabllshape, M("HISTORY_CUSTOMCURVE")); int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); - adjusterChanged (retrab, strval); + adjusterChanged(retrab, strval); } else if (ce == ccshape) { - listener->panelChanged (Evlocallabccshape, M ("HISTORY_CUSTOMCURVE")); + listener->panelChanged(Evlocallabccshape, M("HISTORY_CUSTOMCURVE")); int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); - adjusterChanged (retrab, strval); + adjusterChanged(retrab, strval); } else if (ce == skinTonesCurve) { - listener->panelChanged (EvlocallabSkinTonesCurve, M ("HISTORY_CUSTOMCURVE")); + listener->panelChanged(EvlocallabSkinTonesCurve, M("HISTORY_CUSTOMCURVE")); int strval = retrab->getValue(); //update MIP - retrab->setValue (strval + 1); - adjusterChanged (retrab, strval + 1); - usleep (10000); //to test - retrab->setValue (strval); + retrab->setValue(strval + 1); + adjusterChanged(retrab, strval + 1); + usleep(10000); //to test + retrab->setValue(strval); - adjusterChanged (retrab, strval); + adjusterChanged(retrab, strval); @@ -3261,7 +3261,7 @@ void Locallab::retinexMethodChanged() } if (listener) { - listener->panelChanged (EvlocallabretinexMethod, retinexMethod->get_active_text ()); + listener->panelChanged(EvlocallabretinexMethod, retinexMethod->get_active_text()); } } @@ -3278,7 +3278,7 @@ void Locallab::blurMethodChanged() } if (listener) { - listener->panelChanged (EvlocallabblurMethod, blurMethod->get_active_text ()); + listener->panelChanged(EvlocallabblurMethod, blurMethod->get_active_text()); } } @@ -3310,7 +3310,7 @@ void Locallab::qualityMethodChanged() } if (listener) { - listener->panelChanged (EvlocallabqualityMethod, qualityMethod->get_active_text ()); + listener->panelChanged(EvlocallabqualityMethod, qualityMethod->get_active_text()); } } @@ -3329,7 +3329,7 @@ void Locallab::qualitycurveMethodChanged() } if (listener) { - listener->panelChanged (EvlocallabqualitycurveMethod, qualitycurveMethod->get_active_text ()); + listener->panelChanged(EvlocallabqualitycurveMethod, qualitycurveMethod->get_active_text()); } } @@ -3345,13 +3345,13 @@ void Locallab::ExclumethodChanged() if (listener) { - listener->panelChanged (Evlocallabexclumethod, Exclumethod->get_active_text ()); + listener->panelChanged(Evlocallabexclumethod, Exclumethod->get_active_text()); } } -void Locallab::SmethodChanged () +void Locallab::SmethodChanged() { if (!batchMode) { if (Smethod->get_active_row_number() == 0) { //IND 0 @@ -3397,9 +3397,9 @@ void Locallab::SmethodChanged () if (listener && getEnabled()) { if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { - listener->panelChanged (EvlocallabSmet, Smethod->get_active_text ()); - locXL->setValue (locX->getValue()); - locYT->setValue (locY->getValue()); + listener->panelChanged(EvlocallabSmet, Smethod->get_active_text()); + locXL->setValue(locX->getValue()); + locYT->setValue(locY->getValue()); } // else if(Smethod->get_active_row_number()==2) { // listener->panelChanged (EvlocallabSmet, Smethod->get_active_text ()); @@ -3410,33 +3410,34 @@ void Locallab::SmethodChanged () else { - listener->panelChanged (EvlocallabSmet, Smethod->get_active_text ()); + listener->panelChanged(EvlocallabSmet, Smethod->get_active_text()); } } } -void Locallab::inversChanged () +void Locallab::inversChanged() { if (batchMode) { if (invers->get_inconsistent()) { - invers->set_inconsistent (false); - inversConn.block (true); - invers->set_active (false); - inversConn.block (false); + invers->set_inconsistent(false); + inversConn.block(true); + invers->set_active(false); + inversConn.block(false); } else if (lastinvers) { - invers->set_inconsistent (true); + invers->set_inconsistent(true); } - lastinvers = invers->get_active (); + lastinvers = invers->get_active(); } - if (invers->get_active ()) { - sensi->hide(); + if (invers->get_active()) { + //sensi->hide(); + sensi->show(); llCurveEditorG->hide(); curvactiv->hide(); qualitycurveMethod->hide(); - artifFrame->hide(); + artifFrame->show(); labqualcurv->hide(); } else { @@ -3451,27 +3452,27 @@ void Locallab::inversChanged () if (listener) { if (getEnabled()) { - listener->panelChanged (Evlocallabinvers, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinvers, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabinvers, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabinvers, M("GENERAL_DISABLED")); } } } -void Locallab::cutpastChanged () +void Locallab::cutpastChanged() { if (batchMode) { if (cutpast->get_inconsistent()) { - cutpast->set_inconsistent (false); - cutpastConn.block (true); - cutpast->set_active (false); - cutpastConn.block (false); + cutpast->set_inconsistent(false); + cutpastConn.block(true); + cutpast->set_active(false); + cutpastConn.block(false); } else if (lastcutpast) { - cutpast->set_inconsistent (true); + cutpast->set_inconsistent(true); } - lastcutpast = cutpast->get_active (); + lastcutpast = cutpast->get_active(); } @@ -3484,20 +3485,20 @@ void Locallab::cutpastChanged () } } -void Locallab::lastdustChanged () +void Locallab::lastdustChanged() { if (batchMode) { if (lastdust->get_inconsistent()) { - lastdust->set_inconsistent (false); - lastdustConn.block (true); - lastdust->set_active (false); - lastdustConn.block (false); + lastdust->set_inconsistent(false); + lastdustConn.block(true); + lastdust->set_active(false); + lastdustConn.block(false); } else if (lastlastdust) { - lastdust->set_inconsistent (true); + lastdust->set_inconsistent(true); } - lastlastdust = lastdust->get_active (); + lastlastdust = lastdust->get_active(); } @@ -3511,76 +3512,76 @@ void Locallab::lastdustChanged () } -void Locallab::curvactivChanged () +void Locallab::curvactivChanged() { if (batchMode) { if (curvactiv->get_inconsistent()) { - curvactiv->set_inconsistent (false); - curvactivConn.block (true); - curvactiv->set_active (false); - curvactivConn.block (false); + curvactiv->set_inconsistent(false); + curvactivConn.block(true); + curvactiv->set_active(false); + curvactivConn.block(false); } else if (lastcurvactiv) { - curvactiv->set_inconsistent (true); + curvactiv->set_inconsistent(true); } - lastcurvactiv = curvactiv->get_active (); + lastcurvactiv = curvactiv->get_active(); } if (listener) { if (getEnabled()) { - listener->panelChanged (Evlocallabcurvactiv, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabcurvactiv, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabcurvactiv, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabcurvactiv, M("GENERAL_DISABLED")); } } } -void Locallab::activlumChanged () +void Locallab::activlumChanged() { if (batchMode) { if (activlum->get_inconsistent()) { - activlum->set_inconsistent (false); - activlumConn.block (true); - activlum->set_active (false); - activlumConn.block (false); + activlum->set_inconsistent(false); + activlumConn.block(true); + activlum->set_active(false); + activlumConn.block(false); } else if (lastactivlum) { - activlum->set_inconsistent (true); + activlum->set_inconsistent(true); } - lastactivlum = activlum->get_active (); + lastactivlum = activlum->get_active(); } if (listener) { if (getEnabled()) { - listener->panelChanged (Evlocallabactivlum, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabactivlum, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabactivlum, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabactivlum, M("GENERAL_DISABLED")); } } } -void Locallab::inversradChanged () +void Locallab::inversradChanged() { if (batchMode) { if (inversrad->get_inconsistent()) { - inversrad->set_inconsistent (false); - inversradConn.block (true); - inversrad->set_active (false); - inversradConn.block (false); + inversrad->set_inconsistent(false); + inversradConn.block(true); + inversrad->set_active(false); + inversradConn.block(false); } else if (lastinversrad) { - inversrad->set_inconsistent (true); + inversrad->set_inconsistent(true); } - lastinversrad = inversrad->get_active (); + lastinversrad = inversrad->get_active(); } - if (inversrad->get_active ()) { + if (inversrad->get_active()) { sensibn->hide(); } else { sensibn->show(); @@ -3589,27 +3590,27 @@ void Locallab::inversradChanged () if (listener) { if (getEnabled()) { - listener->panelChanged (Evlocallabinversrad, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinversrad, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabinversrad, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabinversrad, M("GENERAL_DISABLED")); } } } -void Locallab::inversshaChanged () +void Locallab::inversshaChanged() { if (batchMode) { if (inverssha->get_inconsistent()) { - inverssha->set_inconsistent (false); - inversshaConn.block (true); - inverssha->set_active (false); - inversshaConn.block (false); + inverssha->set_inconsistent(false); + inversshaConn.block(true); + inverssha->set_active(false); + inversshaConn.block(false); } else if (lastinverssha) { - inverssha->set_inconsistent (true); + inverssha->set_inconsistent(true); } - lastinverssha = inverssha->get_active (); + lastinverssha = inverssha->get_active(); } /* @@ -3621,30 +3622,30 @@ void Locallab::inversshaChanged () */ if (listener) { if (getEnabled()) { - listener->panelChanged (Evlocallabinverssha, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinverssha, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabinverssha, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabinverssha, M("GENERAL_DISABLED")); } } } -void Locallab::inversretChanged () +void Locallab::inversretChanged() { if (batchMode) { if (inversret->get_inconsistent()) { - inversret->set_inconsistent (false); - inversretConn.block (true); - inversret->set_active (false); - inversretConn.block (false); + inversret->set_inconsistent(false); + inversretConn.block(true); + inversret->set_active(false); + inversretConn.block(false); } else if (lastinversret) { - inversret->set_inconsistent (true); + inversret->set_inconsistent(true); } - lastinversret = inversret->get_active (); + lastinversret = inversret->get_active(); } - if (inversret->get_active ()) { + if (inversret->get_active()) { sensih->hide(); } else { sensih->show(); @@ -3653,247 +3654,247 @@ void Locallab::inversretChanged () if (listener) { if (getEnabled()) { - listener->panelChanged (Evlocallabinversret, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabinversret, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabinversret, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabinversret, M("GENERAL_DISABLED")); } } } -void Locallab::setDefaults (const ProcParams * defParams, const ParamsEdited * pedited) +void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pedited) { - degree->setDefault (defParams->locallab.degree); - locY->setDefault (defParams->locallab.locY); - locX->setDefault (defParams->locallab.locX); - locYT->setDefault (defParams->locallab.locYT); - locXL->setDefault (defParams->locallab.locXL); - centerX->setDefault (defParams->locallab.centerX); - centerY->setDefault (defParams->locallab.centerY); - circrad->setDefault (defParams->locallab.circrad); - centerXbuf->setDefault (defParams->locallab.centerXbuf); - centerYbuf->setDefault (defParams->locallab.centerYbuf); - adjblur->setDefault (defParams->locallab.adjblur); - thres->setDefault (defParams->locallab.thres); - proxi->setDefault (defParams->locallab.proxi); - lightness->setDefault (defParams->locallab.lightness); - contrast->setDefault (defParams->locallab.contrast); - chroma->setDefault (defParams->locallab.chroma); - expcomp->setDefault (defParams->locallab.expcomp); - black->setDefault (defParams->locallab.black); - hlcompr->setDefault (defParams->locallab.hlcompr); - hlcomprthresh->setDefault (defParams->locallab.hlcomprthresh); - shcompr->setDefault (defParams->locallab.shcompr); + degree->setDefault(defParams->locallab.degree); + locY->setDefault(defParams->locallab.locY); + locX->setDefault(defParams->locallab.locX); + locYT->setDefault(defParams->locallab.locYT); + locXL->setDefault(defParams->locallab.locXL); + centerX->setDefault(defParams->locallab.centerX); + centerY->setDefault(defParams->locallab.centerY); + circrad->setDefault(defParams->locallab.circrad); + centerXbuf->setDefault(defParams->locallab.centerXbuf); + centerYbuf->setDefault(defParams->locallab.centerYbuf); + adjblur->setDefault(defParams->locallab.adjblur); + thres->setDefault(defParams->locallab.thres); + proxi->setDefault(defParams->locallab.proxi); + lightness->setDefault(defParams->locallab.lightness); + contrast->setDefault(defParams->locallab.contrast); + chroma->setDefault(defParams->locallab.chroma); + expcomp->setDefault(defParams->locallab.expcomp); + black->setDefault(defParams->locallab.black); + hlcompr->setDefault(defParams->locallab.hlcompr); + hlcomprthresh->setDefault(defParams->locallab.hlcomprthresh); + shcompr->setDefault(defParams->locallab.shcompr); - noiselumf->setDefault (defParams->locallab.noiselumf); - noiselumc->setDefault (defParams->locallab.noiselumc); - noisechrof->setDefault (defParams->locallab.noisechrof); - noisechroc->setDefault (defParams->locallab.noisechroc); - sharradius->setDefault (defParams->locallab.sharradius); - sharamount->setDefault (defParams->locallab.sharamount); - shardamping->setDefault (defParams->locallab.shardamping); - shariter->setDefault (defParams->locallab.shariter); - sensisha->setDefault (defParams->locallab.sensisha); - sensi->setDefault (defParams->locallab.sensi); - sensiex->setDefault (defParams->locallab.sensiex); - sensih->setDefault (defParams->locallab.sensih); - retrab->setDefault (defParams->locallab.retrab); - sensiexclu->setDefault (defParams->locallab.sensiexclu); - struc->setDefault (defParams->locallab.struc); - sensicb->setDefault (defParams->locallab.sensicb); - sensibn->setDefault (defParams->locallab.sensibn); - sensitm->setDefault (defParams->locallab.sensitm); - transit->setDefault (defParams->locallab.transit); - radius->setDefault (defParams->locallab.radius); - strength->setDefault (defParams->locallab.strength); - stren->setDefault (defParams->locallab.stren); - gamma->setDefault (defParams->locallab.gamma); - estop->setDefault (defParams->locallab.estop); - gamma->setDefault (defParams->locallab.gamma); - scaltm->setDefault (defParams->locallab.scaltm); - rewei->setDefault (defParams->locallab.rewei); - neigh->setDefault (defParams->locallab.neigh); - nbspot->setDefault (defParams->locallab.nbspot); - anbspot->setDefault (defParams->locallab.anbspot); - hueref->setDefault (defParams->locallab.hueref); - chromaref->setDefault (defParams->locallab.chromaref); - lumaref->setDefault (defParams->locallab.lumaref); - sobelref->setDefault (defParams->locallab.sobelref); + noiselumf->setDefault(defParams->locallab.noiselumf); + noiselumc->setDefault(defParams->locallab.noiselumc); + noisechrof->setDefault(defParams->locallab.noisechrof); + noisechroc->setDefault(defParams->locallab.noisechroc); + sharradius->setDefault(defParams->locallab.sharradius); + sharamount->setDefault(defParams->locallab.sharamount); + shardamping->setDefault(defParams->locallab.shardamping); + shariter->setDefault(defParams->locallab.shariter); + sensisha->setDefault(defParams->locallab.sensisha); + sensi->setDefault(defParams->locallab.sensi); + sensiex->setDefault(defParams->locallab.sensiex); + sensih->setDefault(defParams->locallab.sensih); + retrab->setDefault(defParams->locallab.retrab); + sensiexclu->setDefault(defParams->locallab.sensiexclu); + struc->setDefault(defParams->locallab.struc); + sensicb->setDefault(defParams->locallab.sensicb); + sensibn->setDefault(defParams->locallab.sensibn); + sensitm->setDefault(defParams->locallab.sensitm); + transit->setDefault(defParams->locallab.transit); + radius->setDefault(defParams->locallab.radius); + strength->setDefault(defParams->locallab.strength); + stren->setDefault(defParams->locallab.stren); + gamma->setDefault(defParams->locallab.gamma); + estop->setDefault(defParams->locallab.estop); + gamma->setDefault(defParams->locallab.gamma); + scaltm->setDefault(defParams->locallab.scaltm); + rewei->setDefault(defParams->locallab.rewei); + neigh->setDefault(defParams->locallab.neigh); + nbspot->setDefault(defParams->locallab.nbspot); + anbspot->setDefault(defParams->locallab.anbspot); + hueref->setDefault(defParams->locallab.hueref); + chromaref->setDefault(defParams->locallab.chromaref); + lumaref->setDefault(defParams->locallab.lumaref); + sobelref->setDefault(defParams->locallab.sobelref); - vart->setDefault (defParams->locallab.vart); - chrrt->setDefault (defParams->locallab.chrrt); + vart->setDefault(defParams->locallab.vart); + chrrt->setDefault(defParams->locallab.chrrt); for (int i = 0; i < 5; i++) { - multiplier[i]->setDefault (defParams->locallab.mult[i]); + multiplier[i]->setDefault(defParams->locallab.mult[i]); } - threshold->setDefault (defParams->locallab.threshold); - chromacbdl->setDefault (defParams->locallab.chromacbdl); - pastels->setDefault (defParams->locallab.pastels); - saturated->setDefault (defParams->locallab.saturated); + threshold->setDefault(defParams->locallab.threshold); + chromacbdl->setDefault(defParams->locallab.chromacbdl); + pastels->setDefault(defParams->locallab.pastels); + saturated->setDefault(defParams->locallab.saturated); psThreshold->setDefault (defParams->locallab.psthreshold); - sensiv->setDefault (defParams->locallab.sensiv); + sensiv->setDefault(defParams->locallab.sensiv); if (pedited) { - degree->setDefaultEditedState (pedited->locallab.degree ? Edited : UnEdited); - locY->setDefaultEditedState (pedited->locallab.locY ? Edited : UnEdited); - locX->setDefaultEditedState (pedited->locallab.locX ? Edited : UnEdited); - locYT->setDefaultEditedState (pedited->locallab.locYT ? Edited : UnEdited); - locXL->setDefaultEditedState (pedited->locallab.locXL ? Edited : UnEdited); - centerX->setDefaultEditedState (pedited->locallab.centerX ? Edited : UnEdited); - centerY->setDefaultEditedState (pedited->locallab.centerY ? Edited : UnEdited); - circrad->setDefaultEditedState (pedited->locallab.circrad ? Edited : UnEdited); - centerXbuf->setDefaultEditedState (pedited->locallab.centerXbuf ? Edited : UnEdited); - centerYbuf->setDefaultEditedState (pedited->locallab.centerYbuf ? Edited : UnEdited); - adjblur->setDefaultEditedState (pedited->locallab.adjblur ? Edited : UnEdited); - thres->setDefaultEditedState (pedited->locallab.thres ? Edited : UnEdited); - proxi->setDefaultEditedState (pedited->locallab.proxi ? Edited : UnEdited); - lightness->setDefaultEditedState (pedited->locallab.lightness ? Edited : UnEdited); - contrast->setDefaultEditedState (pedited->locallab.contrast ? Edited : UnEdited); - chroma->setDefaultEditedState (pedited->locallab.chroma ? Edited : UnEdited); - expcomp->setDefaultEditedState (pedited->locallab.expcomp ? Edited : UnEdited); - black->setDefaultEditedState (pedited->locallab.black ? Edited : UnEdited); - hlcompr->setDefaultEditedState (pedited->locallab.hlcompr ? Edited : UnEdited); - hlcomprthresh->setDefaultEditedState (pedited->locallab.hlcomprthresh ? Edited : UnEdited); - shcompr->setDefaultEditedState (pedited->locallab.shcompr ? Edited : UnEdited); + degree->setDefaultEditedState(pedited->locallab.degree ? Edited : UnEdited); + locY->setDefaultEditedState(pedited->locallab.locY ? Edited : UnEdited); + locX->setDefaultEditedState(pedited->locallab.locX ? Edited : UnEdited); + locYT->setDefaultEditedState(pedited->locallab.locYT ? Edited : UnEdited); + locXL->setDefaultEditedState(pedited->locallab.locXL ? Edited : UnEdited); + centerX->setDefaultEditedState(pedited->locallab.centerX ? Edited : UnEdited); + centerY->setDefaultEditedState(pedited->locallab.centerY ? Edited : UnEdited); + circrad->setDefaultEditedState(pedited->locallab.circrad ? Edited : UnEdited); + centerXbuf->setDefaultEditedState(pedited->locallab.centerXbuf ? Edited : UnEdited); + centerYbuf->setDefaultEditedState(pedited->locallab.centerYbuf ? Edited : UnEdited); + adjblur->setDefaultEditedState(pedited->locallab.adjblur ? Edited : UnEdited); + thres->setDefaultEditedState(pedited->locallab.thres ? Edited : UnEdited); + proxi->setDefaultEditedState(pedited->locallab.proxi ? Edited : UnEdited); + lightness->setDefaultEditedState(pedited->locallab.lightness ? Edited : UnEdited); + contrast->setDefaultEditedState(pedited->locallab.contrast ? Edited : UnEdited); + chroma->setDefaultEditedState(pedited->locallab.chroma ? Edited : UnEdited); + expcomp->setDefaultEditedState(pedited->locallab.expcomp ? Edited : UnEdited); + black->setDefaultEditedState(pedited->locallab.black ? Edited : UnEdited); + hlcompr->setDefaultEditedState(pedited->locallab.hlcompr ? Edited : UnEdited); + hlcomprthresh->setDefaultEditedState(pedited->locallab.hlcomprthresh ? Edited : UnEdited); + shcompr->setDefaultEditedState(pedited->locallab.shcompr ? Edited : UnEdited); - noiselumf->setDefaultEditedState (pedited->locallab.noiselumf ? Edited : UnEdited); - noiselumc->setDefaultEditedState (pedited->locallab.noiselumc ? Edited : UnEdited); - noisechrof->setDefaultEditedState (pedited->locallab.noisechrof ? Edited : UnEdited); - noisechroc->setDefaultEditedState (pedited->locallab.noisechroc ? Edited : UnEdited); - sharradius->setDefaultEditedState (pedited->locallab.sharradius ? Edited : UnEdited); - sharamount->setDefaultEditedState (pedited->locallab.sharamount ? Edited : UnEdited); - shardamping->setDefaultEditedState (pedited->locallab.shardamping ? Edited : UnEdited); - shariter->setDefaultEditedState (pedited->locallab.shariter ? Edited : UnEdited); - sensisha->setDefaultEditedState (pedited->locallab.sensisha ? Edited : UnEdited); - sensi->setDefaultEditedState (pedited->locallab.sensi ? Edited : UnEdited); - sensiex->setDefaultEditedState (pedited->locallab.sensiex ? Edited : UnEdited); - sensih->setDefaultEditedState (pedited->locallab.sensih ? Edited : UnEdited); - retrab->setDefaultEditedState (pedited->locallab.retrab ? Edited : UnEdited); - sensiexclu->setDefaultEditedState (pedited->locallab.sensiexclu ? Edited : UnEdited); - struc->setDefaultEditedState (pedited->locallab.struc ? Edited : UnEdited); - sensicb->setDefaultEditedState (pedited->locallab.sensicb ? Edited : UnEdited); - sensibn->setDefaultEditedState (pedited->locallab.sensibn ? Edited : UnEdited); - sensitm->setDefaultEditedState (pedited->locallab.sensitm ? Edited : UnEdited); - radius->setDefaultEditedState (pedited->locallab.radius ? Edited : UnEdited); - strength->setDefaultEditedState (pedited->locallab.strength ? Edited : UnEdited); - stren->setDefaultEditedState (pedited->locallab.stren ? Edited : UnEdited); - gamma->setDefaultEditedState (pedited->locallab.gamma ? Edited : UnEdited); - estop->setDefaultEditedState (pedited->locallab.estop ? Edited : UnEdited); - scaltm->setDefaultEditedState (pedited->locallab.scaltm ? Edited : UnEdited); - rewei->setDefaultEditedState (pedited->locallab.rewei ? Edited : UnEdited); - transit->setDefaultEditedState (pedited->locallab.transit ? Edited : UnEdited); - str->setDefaultEditedState (pedited->locallab.str ? Edited : UnEdited); - neigh->setDefaultEditedState (pedited->locallab.neigh ? Edited : UnEdited); - nbspot->setDefaultEditedState (pedited->locallab.nbspot ? Edited : UnEdited); - anbspot->setDefaultEditedState (pedited->locallab.anbspot ? Edited : UnEdited); - hueref->setDefaultEditedState (pedited->locallab.hueref ? Edited : UnEdited); - chromaref->setDefaultEditedState (pedited->locallab.chromaref ? Edited : UnEdited); - lumaref->setDefaultEditedState (pedited->locallab.lumaref ? Edited : UnEdited); - sobelref->setDefaultEditedState (pedited->locallab.sobelref ? Edited : UnEdited); - vart->setDefaultEditedState (pedited->locallab.vart ? Edited : UnEdited); - chrrt->setDefaultEditedState (pedited->locallab.chrrt ? Edited : UnEdited); + noiselumf->setDefaultEditedState(pedited->locallab.noiselumf ? Edited : UnEdited); + noiselumc->setDefaultEditedState(pedited->locallab.noiselumc ? Edited : UnEdited); + noisechrof->setDefaultEditedState(pedited->locallab.noisechrof ? Edited : UnEdited); + noisechroc->setDefaultEditedState(pedited->locallab.noisechroc ? Edited : UnEdited); + sharradius->setDefaultEditedState(pedited->locallab.sharradius ? Edited : UnEdited); + sharamount->setDefaultEditedState(pedited->locallab.sharamount ? Edited : UnEdited); + shardamping->setDefaultEditedState(pedited->locallab.shardamping ? Edited : UnEdited); + shariter->setDefaultEditedState(pedited->locallab.shariter ? Edited : UnEdited); + sensisha->setDefaultEditedState(pedited->locallab.sensisha ? Edited : UnEdited); + sensi->setDefaultEditedState(pedited->locallab.sensi ? Edited : UnEdited); + sensiex->setDefaultEditedState(pedited->locallab.sensiex ? Edited : UnEdited); + sensih->setDefaultEditedState(pedited->locallab.sensih ? Edited : UnEdited); + retrab->setDefaultEditedState(pedited->locallab.retrab ? Edited : UnEdited); + sensiexclu->setDefaultEditedState(pedited->locallab.sensiexclu ? Edited : UnEdited); + struc->setDefaultEditedState(pedited->locallab.struc ? Edited : UnEdited); + sensicb->setDefaultEditedState(pedited->locallab.sensicb ? Edited : UnEdited); + sensibn->setDefaultEditedState(pedited->locallab.sensibn ? Edited : UnEdited); + sensitm->setDefaultEditedState(pedited->locallab.sensitm ? Edited : UnEdited); + radius->setDefaultEditedState(pedited->locallab.radius ? Edited : UnEdited); + strength->setDefaultEditedState(pedited->locallab.strength ? Edited : UnEdited); + stren->setDefaultEditedState(pedited->locallab.stren ? Edited : UnEdited); + gamma->setDefaultEditedState(pedited->locallab.gamma ? Edited : UnEdited); + estop->setDefaultEditedState(pedited->locallab.estop ? Edited : UnEdited); + scaltm->setDefaultEditedState(pedited->locallab.scaltm ? Edited : UnEdited); + rewei->setDefaultEditedState(pedited->locallab.rewei ? Edited : UnEdited); + transit->setDefaultEditedState(pedited->locallab.transit ? Edited : UnEdited); + str->setDefaultEditedState(pedited->locallab.str ? Edited : UnEdited); + neigh->setDefaultEditedState(pedited->locallab.neigh ? Edited : UnEdited); + nbspot->setDefaultEditedState(pedited->locallab.nbspot ? Edited : UnEdited); + anbspot->setDefaultEditedState(pedited->locallab.anbspot ? Edited : UnEdited); + hueref->setDefaultEditedState(pedited->locallab.hueref ? Edited : UnEdited); + chromaref->setDefaultEditedState(pedited->locallab.chromaref ? Edited : UnEdited); + lumaref->setDefaultEditedState(pedited->locallab.lumaref ? Edited : UnEdited); + sobelref->setDefaultEditedState(pedited->locallab.sobelref ? Edited : UnEdited); + vart->setDefaultEditedState(pedited->locallab.vart ? Edited : UnEdited); + chrrt->setDefaultEditedState(pedited->locallab.chrrt ? Edited : UnEdited); for (int i = 0; i < 5; i++) { - multiplier[i]->setDefaultEditedState (pedited->locallab.mult[i] ? Edited : UnEdited); + multiplier[i]->setDefaultEditedState(pedited->locallab.mult[i] ? Edited : UnEdited); } - threshold->setDefaultEditedState (pedited->locallab.threshold ? Edited : UnEdited); - chromacbdl->setDefaultEditedState (pedited->locallab.chromacbdl ? Edited : UnEdited); + threshold->setDefaultEditedState(pedited->locallab.threshold ? Edited : UnEdited); + chromacbdl->setDefaultEditedState(pedited->locallab.chromacbdl ? Edited : UnEdited); - pastels->setDefaultEditedState (pedited->locallab.pastels ? Edited : UnEdited); - saturated->setDefaultEditedState (pedited->locallab.saturated ? Edited : UnEdited); - psThreshold->setDefaultEditedState (pedited->locallab.psthreshold ? Edited : UnEdited); - sensiv->setDefaultEditedState (pedited->locallab.sensiv ? Edited : UnEdited); + pastels->setDefaultEditedState(pedited->locallab.pastels ? Edited : UnEdited); + saturated->setDefaultEditedState(pedited->locallab.saturated ? Edited : UnEdited); + psThreshold->setDefaultEditedState(pedited->locallab.psthreshold ? Edited : UnEdited); + sensiv->setDefaultEditedState(pedited->locallab.sensiv ? Edited : UnEdited); } else { - degree->setDefaultEditedState (Irrelevant); - locY->setDefaultEditedState (Irrelevant); - locX->setDefaultEditedState (Irrelevant); - locYT->setDefaultEditedState (Irrelevant); - locXL->setDefaultEditedState (Irrelevant); - centerX->setDefaultEditedState (Irrelevant); - centerY->setDefaultEditedState (Irrelevant); - circrad->setDefaultEditedState (Irrelevant); - centerXbuf->setDefaultEditedState (Irrelevant); - centerYbuf->setDefaultEditedState (Irrelevant); - adjblur->setDefaultEditedState (Irrelevant); - thres->setDefaultEditedState (Irrelevant); - proxi->setDefaultEditedState (Irrelevant); - lightness->setDefaultEditedState (Irrelevant); - contrast->setDefaultEditedState (Irrelevant); - chroma->setDefaultEditedState (Irrelevant); - expcomp->setDefaultEditedState (Irrelevant); - black->setDefaultEditedState (Irrelevant); - hlcompr->setDefaultEditedState (Irrelevant); - hlcomprthresh->setDefaultEditedState (Irrelevant); - shcompr->setDefaultEditedState (Irrelevant); + degree->setDefaultEditedState(Irrelevant); + locY->setDefaultEditedState(Irrelevant); + locX->setDefaultEditedState(Irrelevant); + locYT->setDefaultEditedState(Irrelevant); + locXL->setDefaultEditedState(Irrelevant); + centerX->setDefaultEditedState(Irrelevant); + centerY->setDefaultEditedState(Irrelevant); + circrad->setDefaultEditedState(Irrelevant); + centerXbuf->setDefaultEditedState(Irrelevant); + centerYbuf->setDefaultEditedState(Irrelevant); + adjblur->setDefaultEditedState(Irrelevant); + thres->setDefaultEditedState(Irrelevant); + proxi->setDefaultEditedState(Irrelevant); + lightness->setDefaultEditedState(Irrelevant); + contrast->setDefaultEditedState(Irrelevant); + chroma->setDefaultEditedState(Irrelevant); + expcomp->setDefaultEditedState(Irrelevant); + black->setDefaultEditedState(Irrelevant); + hlcompr->setDefaultEditedState(Irrelevant); + hlcomprthresh->setDefaultEditedState(Irrelevant); + shcompr->setDefaultEditedState(Irrelevant); - noiselumf->setDefaultEditedState (Irrelevant); - noiselumc->setDefaultEditedState (Irrelevant); - noisechrof->setDefaultEditedState (Irrelevant); - noisechroc->setDefaultEditedState (Irrelevant); - sharradius->setDefaultEditedState (Irrelevant); - sharamount->setDefaultEditedState (Irrelevant); - shardamping->setDefaultEditedState (Irrelevant); - shariter->setDefaultEditedState (Irrelevant); - sensisha->setDefaultEditedState (Irrelevant); - sensi->setDefaultEditedState (Irrelevant); - sensiex->setDefaultEditedState (Irrelevant); - sensih->setDefaultEditedState (Irrelevant); - retrab->setDefaultEditedState (Irrelevant); - sensicb->setDefaultEditedState (Irrelevant); - sensiexclu->setDefaultEditedState (Irrelevant); - sensicb->setDefaultEditedState (Irrelevant); - struc->setDefaultEditedState (Irrelevant); - sensitm->setDefaultEditedState (Irrelevant); - radius->setDefaultEditedState (Irrelevant); - strength->setDefaultEditedState (Irrelevant); - stren->setDefaultEditedState (Irrelevant); - gamma->setDefaultEditedState (Irrelevant); - estop->setDefaultEditedState (Irrelevant); - scaltm->setDefaultEditedState (Irrelevant); - rewei->setDefaultEditedState (Irrelevant); - transit->setDefaultEditedState (Irrelevant); - str->setDefaultEditedState (Irrelevant); - neigh->setDefaultEditedState (Irrelevant); - nbspot->setDefaultEditedState (Irrelevant); - anbspot->setDefaultEditedState (Irrelevant); - hueref->setDefaultEditedState (Irrelevant); - chromaref->setDefaultEditedState (Irrelevant); - lumaref->setDefaultEditedState (Irrelevant); - sobelref->setDefaultEditedState (Irrelevant); - vart->setDefaultEditedState (Irrelevant); - chrrt->setDefaultEditedState (Irrelevant); + noiselumf->setDefaultEditedState(Irrelevant); + noiselumc->setDefaultEditedState(Irrelevant); + noisechrof->setDefaultEditedState(Irrelevant); + noisechroc->setDefaultEditedState(Irrelevant); + sharradius->setDefaultEditedState(Irrelevant); + sharamount->setDefaultEditedState(Irrelevant); + shardamping->setDefaultEditedState(Irrelevant); + shariter->setDefaultEditedState(Irrelevant); + sensisha->setDefaultEditedState(Irrelevant); + sensi->setDefaultEditedState(Irrelevant); + sensiex->setDefaultEditedState(Irrelevant); + sensih->setDefaultEditedState(Irrelevant); + retrab->setDefaultEditedState(Irrelevant); + sensicb->setDefaultEditedState(Irrelevant); + sensiexclu->setDefaultEditedState(Irrelevant); + sensicb->setDefaultEditedState(Irrelevant); + struc->setDefaultEditedState(Irrelevant); + sensitm->setDefaultEditedState(Irrelevant); + radius->setDefaultEditedState(Irrelevant); + strength->setDefaultEditedState(Irrelevant); + stren->setDefaultEditedState(Irrelevant); + gamma->setDefaultEditedState(Irrelevant); + estop->setDefaultEditedState(Irrelevant); + scaltm->setDefaultEditedState(Irrelevant); + rewei->setDefaultEditedState(Irrelevant); + transit->setDefaultEditedState(Irrelevant); + str->setDefaultEditedState(Irrelevant); + neigh->setDefaultEditedState(Irrelevant); + nbspot->setDefaultEditedState(Irrelevant); + anbspot->setDefaultEditedState(Irrelevant); + hueref->setDefaultEditedState(Irrelevant); + chromaref->setDefaultEditedState(Irrelevant); + lumaref->setDefaultEditedState(Irrelevant); + sobelref->setDefaultEditedState(Irrelevant); + vart->setDefaultEditedState(Irrelevant); + chrrt->setDefaultEditedState(Irrelevant); for (int i = 0; i < 5; i++) { - multiplier[i]->setDefaultEditedState (Irrelevant); + multiplier[i]->setDefaultEditedState(Irrelevant); } - threshold->setDefaultEditedState (Irrelevant); - chromacbdl->setDefaultEditedState (Irrelevant); + threshold->setDefaultEditedState(Irrelevant); + chromacbdl->setDefaultEditedState(Irrelevant); - pastels->setDefaultEditedState (Irrelevant); - saturated->setDefaultEditedState (Irrelevant); - psThreshold->setDefaultEditedState (Irrelevant); - sensiv->setDefaultEditedState (Irrelevant); + pastels->setDefaultEditedState(Irrelevant); + saturated->setDefaultEditedState(Irrelevant); + psThreshold->setDefaultEditedState(Irrelevant); + sensiv->setDefaultEditedState(Irrelevant); } } -void Locallab::adjusterChanged (ThresholdAdjuster* a, int newBottom, int newTop) +void Locallab::adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) { if (listener && getEnabled()) { - listener->panelChanged (EvlocallabPastSatThreshold, psThreshold->getHistoryString()); + listener->panelChanged(EvlocallabPastSatThreshold, psThreshold->getHistoryString()); } } -void Locallab::adjusterChanged (Adjuster * a, double newval) +void Locallab::adjusterChanged(Adjuster * a, double newval) { - updateGeometry (int (centerX->getValue()), int (centerY->getValue()), int (circrad->getValue()), (int)locY->getValue(), degree->getValue(), (int)locX->getValue(), (int)locYT->getValue(), (int)locXL->getValue()); + updateGeometry(int (centerX->getValue()), int (centerY->getValue()), int (circrad->getValue()), (int)locY->getValue(), degree->getValue(), (int)locX->getValue(), (int)locYT->getValue(), (int)locXL->getValue()); anbspot->hide(); hueref->hide(); chromaref->hide(); @@ -3903,15 +3904,15 @@ void Locallab::adjusterChanged (Adjuster * a, double newval) centerYbuf->hide(); if (a == pastels && pastSatTog->get_active()) { - saturated->setValue (newval); + saturated->setValue(newval); } if (listener && getEnabled()) { if (a == degree) { - listener->panelChanged (EvlocallabDegree, degree->getTextValue()); + listener->panelChanged(EvlocallabDegree, degree->getTextValue()); } else if (a == locY) { if (Smethod->get_active_row_number() == 0 || Smethod->get_active_row_number() == 2) { // 0 2 - listener->panelChanged (EvlocallablocY, locY->getTextValue()); + listener->panelChanged(EvlocallablocY, locY->getTextValue()); } /* else if(Smethod->get_active_row_number()==2) { listener->panelChanged (EvlocallablocY, locY->getTextValue()); @@ -3920,13 +3921,13 @@ void Locallab::adjusterChanged (Adjuster * a, double newval) locYT->setValue (locX->getValue()); }*/ else if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { - listener->panelChanged (EvlocallablocY, locY->getTextValue()); - locYT->setValue (locY->getValue()); + listener->panelChanged(EvlocallablocY, locY->getTextValue()); + locYT->setValue(locY->getValue()); } } else if (a == locX) { //listener->panelChanged (EvlocallablocX, locX->getTextValue()); if (Smethod->get_active_row_number() == 0 || Smethod->get_active_row_number() == 2) { - listener->panelChanged (EvlocallablocX, locX->getTextValue()); + listener->panelChanged(EvlocallablocX, locX->getTextValue()); } /* else if(Smethod->get_active_row_number()==2) { listener->panelChanged (EvlocallablocX, locX->getTextValue()); @@ -3935,12 +3936,12 @@ void Locallab::adjusterChanged (Adjuster * a, double newval) locYT->setValue (locX->getValue()); }*/ else if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { - listener->panelChanged (EvlocallablocX, locX->getTextValue()); - locXL->setValue (locX->getValue()); + listener->panelChanged(EvlocallablocX, locX->getTextValue()); + locXL->setValue(locX->getValue()); } } else if (a == locYT) { if (Smethod->get_active_row_number() == 0 || Smethod->get_active_row_number() == 2) { - listener->panelChanged (EvlocallablocYT, locYT->getTextValue()); + listener->panelChanged(EvlocallablocYT, locYT->getTextValue()); } /* else if(Smethod->get_active_row_number()==2) { listener->panelChanged (EvlocallablocYT, locYT->getTextValue()); @@ -3949,13 +3950,13 @@ void Locallab::adjusterChanged (Adjuster * a, double newval) locYT->setValue (locX->getValue()); }*/ else if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { - listener->panelChanged (EvlocallablocYT, locYT->getTextValue()); - locYT->setValue (locY->getValue()); + listener->panelChanged(EvlocallablocYT, locYT->getTextValue()); + locYT->setValue(locY->getValue()); } } else if (a == locXL) { if (Smethod->get_active_row_number() == 0 || Smethod->get_active_row_number() == 2) { - listener->panelChanged (EvlocallablocXL, locXL->getTextValue()); - listener->panelChanged (EvlocallablocXL, locXL->getTextValue()); + listener->panelChanged(EvlocallablocXL, locXL->getTextValue()); + listener->panelChanged(EvlocallablocXL, locXL->getTextValue()); } /* else if(Smethod->get_active_row_number()==2) { listener->panelChanged (EvlocallablocXL, locXL->getTextValue()); @@ -3964,142 +3965,142 @@ void Locallab::adjusterChanged (Adjuster * a, double newval) locYT->setValue (locX->getValue()); }*/ else if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { - listener->panelChanged (EvlocallablocXL, locXL->getTextValue()); - locXL->setValue (locX->getValue()); + listener->panelChanged(EvlocallablocXL, locXL->getTextValue()); + locXL->setValue(locX->getValue()); } } else if (a == lightness) { - listener->panelChanged (Evlocallablightness, lightness->getTextValue()); + listener->panelChanged(Evlocallablightness, lightness->getTextValue()); } else if (a == contrast) { - listener->panelChanged (Evlocallabcontrast, contrast->getTextValue()); + listener->panelChanged(Evlocallabcontrast, contrast->getTextValue()); } else if (a == chroma) { - listener->panelChanged (Evlocallabchroma, chroma->getTextValue()); + listener->panelChanged(Evlocallabchroma, chroma->getTextValue()); } else if (a == expcomp) { - listener->panelChanged (Evlocallabexpcomp, expcomp->getTextValue()); + listener->panelChanged(Evlocallabexpcomp, expcomp->getTextValue()); } else if (a == hlcompr) { - listener->panelChanged (Evlocallabhlcompr, hlcompr->getTextValue()); + listener->panelChanged(Evlocallabhlcompr, hlcompr->getTextValue()); } else if (a == hlcomprthresh) { - listener->panelChanged (Evlocallabhlcomprthresh, hlcomprthresh->getTextValue()); + listener->panelChanged(Evlocallabhlcomprthresh, hlcomprthresh->getTextValue()); } else if (a == black) { - listener->panelChanged (Evlocallabblack, black->getTextValue()); - shcompr->set_sensitive (! ((int)black->getValue () == 0)); //at black=0 shcompr value has no effect + listener->panelChanged(Evlocallabblack, black->getTextValue()); + shcompr->set_sensitive(!((int)black->getValue() == 0)); //at black=0 shcompr value has no effect } else if (a == shcompr) { - listener->panelChanged (Evlocallabshcompr, shcompr->getTextValue()); + listener->panelChanged(Evlocallabshcompr, shcompr->getTextValue()); } else if (a == sensiex) { - listener->panelChanged (Evlocallabsensiex, sensiex->getTextValue()); + listener->panelChanged(Evlocallabsensiex, sensiex->getTextValue()); - } else if (a == pastels ) { - listener->panelChanged (EvlocallabPastels, pastels->getTextValue() ); + } else if (a == pastels) { + listener->panelChanged(EvlocallabPastels, pastels->getTextValue()); } else if (a == saturated && !pastSatTog->get_active()) { - listener->panelChanged (EvlocallabSaturated, saturated->getTextValue() ); + listener->panelChanged(EvlocallabSaturated, saturated->getTextValue()); } else if (a == sensiv) { - listener->panelChanged (Evlocallabsensiv, sensiv->getTextValue()); + listener->panelChanged(Evlocallabsensiv, sensiv->getTextValue()); } else if (a == noiselumf) { - listener->panelChanged (Evlocallabnoiselumf, noiselumf->getTextValue()); + listener->panelChanged(Evlocallabnoiselumf, noiselumf->getTextValue()); } else if (a == noiselumc) { - listener->panelChanged (Evlocallabnoiselumc, noiselumc->getTextValue()); + listener->panelChanged(Evlocallabnoiselumc, noiselumc->getTextValue()); } else if (a == noisechrof) { - listener->panelChanged (Evlocallabnoisechrof, noisechrof->getTextValue()); + listener->panelChanged(Evlocallabnoisechrof, noisechrof->getTextValue()); } else if (a == noisechroc) { - listener->panelChanged (Evlocallabnoisechroc, noisechroc->getTextValue()); + listener->panelChanged(Evlocallabnoisechroc, noisechroc->getTextValue()); } else if (a == sharradius) { - listener->panelChanged (Evlocallabsharradius, sharradius->getTextValue()); + listener->panelChanged(Evlocallabsharradius, sharradius->getTextValue()); } else if (a == sharamount) { - listener->panelChanged (Evlocallabsharamount, sharamount->getTextValue()); + listener->panelChanged(Evlocallabsharamount, sharamount->getTextValue()); } else if (a == shardamping) { - listener->panelChanged (Evlocallabshardamping, shardamping->getTextValue()); + listener->panelChanged(Evlocallabshardamping, shardamping->getTextValue()); } else if (a == shariter) { - listener->panelChanged (Evlocallabshariter, shariter->getTextValue()); + listener->panelChanged(Evlocallabshariter, shariter->getTextValue()); } else if (a == sensisha) { - listener->panelChanged (Evlocallabsensis, sensisha->getTextValue()); + listener->panelChanged(Evlocallabsensis, sensisha->getTextValue()); } else if (a == sensi) { - listener->panelChanged (Evlocallabsensi, sensi->getTextValue()); + listener->panelChanged(Evlocallabsensi, sensi->getTextValue()); } else if (a == sensih) { - listener->panelChanged (Evlocallabsensih, sensih->getTextValue()); + listener->panelChanged(Evlocallabsensih, sensih->getTextValue()); } else if (a == retrab) { - listener->panelChanged (Evlocallabretrab, "");//retrab->getTextValue()); + listener->panelChanged(Evlocallabretrab, ""); //retrab->getTextValue()); } else if (a == radius) { - listener->panelChanged (Evlocallabradius, radius->getTextValue()); + listener->panelChanged(Evlocallabradius, radius->getTextValue()); } else if (a == strength) { - listener->panelChanged (Evlocallabstrength, strength->getTextValue()); + listener->panelChanged(Evlocallabstrength, strength->getTextValue()); } else if (a == stren) { - listener->panelChanged (Evlocallabstren, stren->getTextValue()); + listener->panelChanged(Evlocallabstren, stren->getTextValue()); } else if (a == gamma) { - listener->panelChanged (Evlocallabgamma, gamma->getTextValue()); + listener->panelChanged(Evlocallabgamma, gamma->getTextValue()); } else if (a == estop) { - listener->panelChanged (Evlocallabestop, estop->getTextValue()); + listener->panelChanged(Evlocallabestop, estop->getTextValue()); } else if (a == scaltm) { - listener->panelChanged (Evlocallabscaltm, scaltm->getTextValue()); + listener->panelChanged(Evlocallabscaltm, scaltm->getTextValue()); } else if (a == rewei) { - listener->panelChanged (Evlocallabrewei, rewei->getTextValue()); + listener->panelChanged(Evlocallabrewei, rewei->getTextValue()); } else if (a == sensitm) { - listener->panelChanged (Evlocallabsensitm, sensitm->getTextValue()); + listener->panelChanged(Evlocallabsensitm, sensitm->getTextValue()); } else if (a == transit) { - listener->panelChanged (Evlocallabtransit, transit->getTextValue()); + listener->panelChanged(Evlocallabtransit, transit->getTextValue()); } else if (a == str) { - listener->panelChanged (Evlocallabstr, str->getTextValue()); + listener->panelChanged(Evlocallabstr, str->getTextValue()); } else if (a == neigh) { - listener->panelChanged (Evlocallabneigh, neigh->getTextValue()); + listener->panelChanged(Evlocallabneigh, neigh->getTextValue()); } else if (a == nbspot) { - listener->panelChanged (Evlocallabnbspot, nbspot->getTextValue()); + listener->panelChanged(Evlocallabnbspot, nbspot->getTextValue()); } else if (a == anbspot) { - listener->panelChanged (Evlocallabanbspot, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallabanbspot, ""); //anbspot->getTextValue()); } else if (a == hueref) { - listener->panelChanged (Evlocallabhueref, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallabhueref, ""); //anbspot->getTextValue()); } else if (a == chromaref) { - listener->panelChanged (Evlocallabchromaref, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallabchromaref, ""); //anbspot->getTextValue()); } else if (a == lumaref) { - listener->panelChanged (Evlocallablumaref, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallablumaref, ""); //anbspot->getTextValue()); } else if (a == sobelref) { - listener->panelChanged (Evlocallabsobelref, "");//anbspot->getTextValue()); + listener->panelChanged(Evlocallabsobelref, ""); //anbspot->getTextValue()); } else if (a == vart) { - listener->panelChanged (Evlocallabvart, vart->getTextValue()); + listener->panelChanged(Evlocallabvart, vart->getTextValue()); } else if (a == chrrt) { - listener->panelChanged (Evlocallabchrrt, chrrt->getTextValue()); + listener->panelChanged(Evlocallabchrrt, chrrt->getTextValue()); } else if (a == circrad) { - listener->panelChanged (Evlocallabcircrad, circrad->getTextValue()); + listener->panelChanged(Evlocallabcircrad, circrad->getTextValue()); } else if (a == thres) { - listener->panelChanged (Evlocallabthres, thres->getTextValue()); + listener->panelChanged(Evlocallabthres, thres->getTextValue()); } else if (a == threshold) { - listener->panelChanged (EvlocallabThresho, threshold->getTextValue()); + listener->panelChanged(EvlocallabThresho, threshold->getTextValue()); } else if (a == chromacbdl) { - listener->panelChanged (Evlocallabchromacbdl, chromacbdl->getTextValue()); + listener->panelChanged(Evlocallabchromacbdl, chromacbdl->getTextValue()); } else if (a == sensicb) { - listener->panelChanged (Evlocallabsensicb, sensicb->getTextValue()); + listener->panelChanged(Evlocallabsensicb, sensicb->getTextValue()); } else if (a == sensiexclu) { - listener->panelChanged (Evlocallabsensiexclu, sensiexclu->getTextValue()); + listener->panelChanged(Evlocallabsensiexclu, sensiexclu->getTextValue()); } else if (a == struc) { - listener->panelChanged (Evlocallabstruc, struc->getTextValue()); + listener->panelChanged(Evlocallabstruc, struc->getTextValue()); } else if (a == sensibn) { - listener->panelChanged (Evlocallabsensibn, sensibn->getTextValue()); + listener->panelChanged(Evlocallabsensibn, sensibn->getTextValue()); } else if (a == proxi) { - listener->panelChanged (Evlocallabproxi, proxi->getTextValue()); + listener->panelChanged(Evlocallabproxi, proxi->getTextValue()); } else if (a == adjblur) { // listener->panelChanged (Evlocallabadjblur, adjblur->getTextValue()); } else if (a == centerX || a == centerY) { - listener->panelChanged (EvlocallabCenter, Glib::ustring::compose ("X=%1\nY=%2", centerX->getTextValue(), centerY->getTextValue())); + listener->panelChanged(EvlocallabCenter, Glib::ustring::compose("X=%1\nY=%2", centerX->getTextValue(), centerY->getTextValue())); } else if (a == centerXbuf || a == centerYbuf) { - listener->panelChanged (EvlocallabCenterbuf, Glib::ustring::compose ("X=%1\nY=%2", centerXbuf->getTextValue(), centerYbuf->getTextValue())); + listener->panelChanged(EvlocallabCenterbuf, Glib::ustring::compose("X=%1\nY=%2", centerXbuf->getTextValue(), centerYbuf->getTextValue())); } else { - listener->panelChanged (EvlocallabEqualizer, - Glib::ustring::compose ("%1, %2, %3, %4, %5", - Glib::ustring::format (std::fixed, std::setprecision (0), multiplier[0]->getValue()), - Glib::ustring::format (std::fixed, std::setprecision (0), multiplier[1]->getValue()), - Glib::ustring::format (std::fixed, std::setprecision (0), multiplier[2]->getValue()), - Glib::ustring::format (std::fixed, std::setprecision (0), multiplier[3]->getValue()), - Glib::ustring::format (std::fixed, std::setprecision (0), multiplier[4]->getValue())) - ); + listener->panelChanged(EvlocallabEqualizer, + Glib::ustring::compose("%1, %2, %3, %4, %5", + Glib::ustring::format(std::fixed, std::setprecision(0), multiplier[0]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), multiplier[1]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), multiplier[2]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), multiplier[3]->getValue()), + Glib::ustring::format(std::fixed, std::setprecision(0), multiplier[4]->getValue())) + ); } } } -void Locallab::enabledChanged () +void Locallab::enabledChanged() { anbspot->hide(); hueref->hide(); @@ -4109,207 +4110,207 @@ void Locallab::enabledChanged () if (listener) { if (get_inconsistent()) { - listener->panelChanged (EvlocallabEnabled, M ("GENERAL_UNCHANGED")); + listener->panelChanged(EvlocallabEnabled, M("GENERAL_UNCHANGED")); } else if (getEnabled()) { - listener->panelChanged (EvlocallabEnabled, M ("GENERAL_ENABLED")); + listener->panelChanged(EvlocallabEnabled, M("GENERAL_ENABLED")); } else { - listener->panelChanged (EvlocallabEnabled, M ("GENERAL_DISABLED")); + listener->panelChanged(EvlocallabEnabled, M("GENERAL_DISABLED")); } } } -void Locallab::avoidChanged () +void Locallab::avoidChanged() { if (batchMode) { 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) { if (getEnabled()) { - listener->panelChanged (Evlocallabavoid, M ("GENERAL_ENABLED")); + listener->panelChanged(Evlocallabavoid, M("GENERAL_ENABLED")); } else { - listener->panelChanged (Evlocallabavoid, M ("GENERAL_DISABLED")); + listener->panelChanged(Evlocallabavoid, M("GENERAL_DISABLED")); } } } -void Locallab::setAdjusterBehavior (bool degreeadd, bool locYadd, bool locXadd, bool locYTadd, bool locXLadd, bool centeradd, bool lightnessadd, bool contrastadd, bool chromaadd, bool sensiadd, bool transitadd, bool radiusadd, bool strengthadd) +void Locallab::setAdjusterBehavior(bool degreeadd, bool locYadd, bool locXadd, bool locYTadd, bool locXLadd, bool centeradd, bool lightnessadd, bool contrastadd, bool chromaadd, bool sensiadd, bool transitadd, bool radiusadd, bool strengthadd) { - degree->setAddMode (degreeadd); - locY->setAddMode (locYadd); - locX->setAddMode (locXadd); - locYT->setAddMode (locYTadd); - locXL->setAddMode (locXLadd); - centerX->setAddMode (centeradd); - centerY->setAddMode (centeradd); - lightness->setAddMode (lightnessadd); - contrast->setAddMode (contrastadd); - chroma->setAddMode (chromaadd); - sensi->setAddMode (sensiadd); - transit->setAddMode (transitadd); - radius->setAddMode (radiusadd); - strength->setAddMode (strengthadd); + degree->setAddMode(degreeadd); + locY->setAddMode(locYadd); + locX->setAddMode(locXadd); + locYT->setAddMode(locYTadd); + locXL->setAddMode(locXLadd); + centerX->setAddMode(centeradd); + centerY->setAddMode(centeradd); + lightness->setAddMode(lightnessadd); + contrast->setAddMode(contrastadd); + chroma->setAddMode(chromaadd); + sensi->setAddMode(sensiadd); + transit->setAddMode(transitadd); + radius->setAddMode(radiusadd); + strength->setAddMode(strengthadd); } -void Locallab::trimValues (rtengine::procparams::ProcParams * pp) +void Locallab::trimValues(rtengine::procparams::ProcParams * pp) { - degree->trimValue (pp->locallab.degree); - locY->trimValue (pp->locallab.locY); - locX->trimValue (pp->locallab.locX); - locYT->trimValue (pp->locallab.locYT); - locXL->trimValue (pp->locallab.locXL); - centerX->trimValue (pp->locallab.centerX); - centerY->trimValue (pp->locallab.centerY); - circrad->trimValue (pp->locallab.circrad); - centerXbuf->trimValue (pp->locallab.centerXbuf); - centerYbuf->trimValue (pp->locallab.centerYbuf); - adjblur->trimValue (pp->locallab.adjblur); - thres->trimValue (pp->locallab.thres); - proxi->trimValue (pp->locallab.proxi); - lightness->trimValue (pp->locallab.lightness); - contrast->trimValue (pp->locallab.contrast); - chroma->trimValue (pp->locallab.chroma); - expcomp->trimValue (pp->locallab.expcomp); - hlcompr->trimValue (pp->locallab.hlcompr); - hlcomprthresh->trimValue (pp->locallab.hlcomprthresh); - black->trimValue (pp->locallab.black); - shcompr->trimValue (pp->locallab.shcompr); + degree->trimValue(pp->locallab.degree); + locY->trimValue(pp->locallab.locY); + locX->trimValue(pp->locallab.locX); + locYT->trimValue(pp->locallab.locYT); + locXL->trimValue(pp->locallab.locXL); + centerX->trimValue(pp->locallab.centerX); + centerY->trimValue(pp->locallab.centerY); + circrad->trimValue(pp->locallab.circrad); + centerXbuf->trimValue(pp->locallab.centerXbuf); + centerYbuf->trimValue(pp->locallab.centerYbuf); + adjblur->trimValue(pp->locallab.adjblur); + thres->trimValue(pp->locallab.thres); + proxi->trimValue(pp->locallab.proxi); + lightness->trimValue(pp->locallab.lightness); + contrast->trimValue(pp->locallab.contrast); + chroma->trimValue(pp->locallab.chroma); + expcomp->trimValue(pp->locallab.expcomp); + hlcompr->trimValue(pp->locallab.hlcompr); + hlcomprthresh->trimValue(pp->locallab.hlcomprthresh); + black->trimValue(pp->locallab.black); + shcompr->trimValue(pp->locallab.shcompr); - noiselumf->trimValue (pp->locallab.noiselumf); - noiselumc->trimValue (pp->locallab.noiselumc); - noisechrof->trimValue (pp->locallab.noisechrof); - noisechroc->trimValue (pp->locallab.noisechroc); - sharradius->trimValue (pp->locallab.sharradius); - sharamount->trimValue (pp->locallab.sharamount); - shardamping->trimValue (pp->locallab.shardamping); - shariter->trimValue (pp->locallab.shariter); - sensisha->trimValue (pp->locallab.sensisha); - sensi->trimValue (pp->locallab.sensi); - sensiex->trimValue (pp->locallab.sensiex); - sensih->trimValue (pp->locallab.sensih); - retrab->trimValue (pp->locallab.retrab); - sensiexclu->trimValue (pp->locallab.sensiexclu); - struc->trimValue (pp->locallab.struc); - sensicb->trimValue (pp->locallab.sensicb); - sensibn->trimValue (pp->locallab.sensibn); - sensitm->trimValue (pp->locallab.sensitm); - radius->trimValue (pp->locallab.radius); - strength->trimValue (pp->locallab.strength); - stren->trimValue (pp->locallab.stren); - gamma->trimValue (pp->locallab.gamma); - estop->trimValue (pp->locallab.estop); - scaltm->trimValue (pp->locallab.scaltm); - rewei->trimValue (pp->locallab.rewei); - transit->trimValue (pp->locallab.transit); - str->trimValue (pp->locallab.str); - neigh->trimValue (pp->locallab.neigh); - nbspot->trimValue (pp->locallab.nbspot); - anbspot->trimValue (pp->locallab.anbspot); - hueref->trimValue (pp->locallab.hueref); - chromaref->trimValue (pp->locallab.chromaref); - lumaref->trimValue (pp->locallab.lumaref); - sobelref->trimValue (pp->locallab.sobelref); + noiselumf->trimValue(pp->locallab.noiselumf); + noiselumc->trimValue(pp->locallab.noiselumc); + noisechrof->trimValue(pp->locallab.noisechrof); + noisechroc->trimValue(pp->locallab.noisechroc); + sharradius->trimValue(pp->locallab.sharradius); + sharamount->trimValue(pp->locallab.sharamount); + shardamping->trimValue(pp->locallab.shardamping); + shariter->trimValue(pp->locallab.shariter); + sensisha->trimValue(pp->locallab.sensisha); + sensi->trimValue(pp->locallab.sensi); + sensiex->trimValue(pp->locallab.sensiex); + sensih->trimValue(pp->locallab.sensih); + retrab->trimValue(pp->locallab.retrab); + sensiexclu->trimValue(pp->locallab.sensiexclu); + struc->trimValue(pp->locallab.struc); + sensicb->trimValue(pp->locallab.sensicb); + sensibn->trimValue(pp->locallab.sensibn); + sensitm->trimValue(pp->locallab.sensitm); + radius->trimValue(pp->locallab.radius); + strength->trimValue(pp->locallab.strength); + stren->trimValue(pp->locallab.stren); + gamma->trimValue(pp->locallab.gamma); + estop->trimValue(pp->locallab.estop); + scaltm->trimValue(pp->locallab.scaltm); + rewei->trimValue(pp->locallab.rewei); + transit->trimValue(pp->locallab.transit); + str->trimValue(pp->locallab.str); + neigh->trimValue(pp->locallab.neigh); + nbspot->trimValue(pp->locallab.nbspot); + anbspot->trimValue(pp->locallab.anbspot); + hueref->trimValue(pp->locallab.hueref); + chromaref->trimValue(pp->locallab.chromaref); + lumaref->trimValue(pp->locallab.lumaref); + sobelref->trimValue(pp->locallab.sobelref); - vart->trimValue (pp->locallab.vart); - chrrt->trimValue (pp->locallab.chrrt); + vart->trimValue(pp->locallab.vart); + chrrt->trimValue(pp->locallab.chrrt); for (int i = 0; i < 5; i++) { - multiplier[i]->trimValue (pp->locallab.mult[i]); + multiplier[i]->trimValue(pp->locallab.mult[i]); } - chromacbdl->trimValue (pp->locallab.chromacbdl); + chromacbdl->trimValue(pp->locallab.chromacbdl); - threshold->trimValue (pp->locallab.threshold); - pastels->trimValue (pp->locallab.pastels); - saturated->trimValue (pp->locallab.saturated); - sensiv->trimValue (pp->locallab.sensiv); + threshold->trimValue(pp->locallab.threshold); + pastels->trimValue(pp->locallab.pastels); + saturated->trimValue(pp->locallab.saturated); + sensiv->trimValue(pp->locallab.sensiv); } -void Locallab::setBatchMode (bool batchMode) +void Locallab::setBatchMode(bool batchMode) { - removeIfThere (this, edit, false); - ToolPanel::setBatchMode (batchMode); + removeIfThere(this, edit, false); + ToolPanel::setBatchMode(batchMode); - hueref->hide (); - chromaref->hide (); - lumaref->hide (); - sobelref->hide (); + hueref->hide(); + chromaref->hide(); + lumaref->hide(); + sobelref->hide(); - degree->showEditedCB (); - locY->showEditedCB (); - locX->showEditedCB (); - locYT->showEditedCB (); - locXL->showEditedCB (); - centerX->showEditedCB (); - centerY->showEditedCB (); - circrad->showEditedCB (); - centerXbuf->showEditedCB (); - centerYbuf->showEditedCB (); - adjblur->showEditedCB (); - thres->showEditedCB (); - proxi->showEditedCB (); - lightness->showEditedCB (); - contrast->showEditedCB (); - chroma->showEditedCB (); - expcomp->showEditedCB (); - black->showEditedCB (); - hlcompr->showEditedCB (); - hlcomprthresh->showEditedCB (); - shcompr->showEditedCB (); + degree->showEditedCB(); + locY->showEditedCB(); + locX->showEditedCB(); + locYT->showEditedCB(); + locXL->showEditedCB(); + centerX->showEditedCB(); + centerY->showEditedCB(); + circrad->showEditedCB(); + centerXbuf->showEditedCB(); + centerYbuf->showEditedCB(); + adjblur->showEditedCB(); + thres->showEditedCB(); + proxi->showEditedCB(); + lightness->showEditedCB(); + contrast->showEditedCB(); + chroma->showEditedCB(); + expcomp->showEditedCB(); + black->showEditedCB(); + hlcompr->showEditedCB(); + hlcomprthresh->showEditedCB(); + shcompr->showEditedCB(); - noiselumf->showEditedCB (); - noiselumc->showEditedCB (); - noisechroc->showEditedCB (); - noiselumf->showEditedCB (); - sharradius->showEditedCB (); - sharamount->showEditedCB (); - shardamping->showEditedCB (); - shariter->showEditedCB (); - sensisha->showEditedCB (); - sensi->showEditedCB (); - sensiex->showEditedCB (); - sensih->showEditedCB (); - retrab->showEditedCB (); - sensiexclu->showEditedCB (); - struc->showEditedCB (); - sensicb->showEditedCB (); - sensibn->showEditedCB (); - sensitm->showEditedCB (); - radius->showEditedCB (); - strength->showEditedCB (); - stren->showEditedCB (); - gamma->showEditedCB (); - estop->showEditedCB (); - scaltm->showEditedCB (); - rewei->showEditedCB (); - transit->showEditedCB (); - Smethod->append (M ("GENERAL_UNCHANGED")); - str->showEditedCB (); - neigh->showEditedCB (); - nbspot->showEditedCB (); - anbspot->showEditedCB (); - hueref->showEditedCB (); - chromaref->showEditedCB (); - lumaref->showEditedCB (); - sobelref->showEditedCB (); - vart->showEditedCB (); - LocalcurveEditorgainT->setBatchMode (batchMode); - LocalcurveEditorgainTrab->setBatchMode (batchMode); - llCurveEditorG->setBatchMode (batchMode); + noiselumf->showEditedCB(); + noiselumc->showEditedCB(); + noisechroc->showEditedCB(); + noiselumf->showEditedCB(); + sharradius->showEditedCB(); + sharamount->showEditedCB(); + shardamping->showEditedCB(); + shariter->showEditedCB(); + sensisha->showEditedCB(); + sensi->showEditedCB(); + sensiex->showEditedCB(); + sensih->showEditedCB(); + retrab->showEditedCB(); + sensiexclu->showEditedCB(); + struc->showEditedCB(); + sensicb->showEditedCB(); + sensibn->showEditedCB(); + sensitm->showEditedCB(); + radius->showEditedCB(); + strength->showEditedCB(); + stren->showEditedCB(); + gamma->showEditedCB(); + estop->showEditedCB(); + scaltm->showEditedCB(); + rewei->showEditedCB(); + transit->showEditedCB(); + Smethod->append(M("GENERAL_UNCHANGED")); + str->showEditedCB(); + neigh->showEditedCB(); + nbspot->showEditedCB(); + anbspot->showEditedCB(); + hueref->showEditedCB(); + chromaref->showEditedCB(); + lumaref->showEditedCB(); + sobelref->showEditedCB(); + vart->showEditedCB(); + LocalcurveEditorgainT->setBatchMode(batchMode); + LocalcurveEditorgainTrab->setBatchMode(batchMode); + llCurveEditorG->setBatchMode(batchMode); // llCurveEditorG2->setBatchMode (batchMode); - chrrt->showEditedCB (); + chrrt->showEditedCB(); for (int i = 0; i < 5; i++) { multiplier[i]->showEditedCB(); @@ -4317,16 +4318,16 @@ void Locallab::setBatchMode (bool batchMode) threshold->showEditedCB(); chromacbdl->showEditedCB(); - pastels->showEditedCB (); - saturated->showEditedCB (); - psThreshold->showEditedCB (); - sensiv->showEditedCB (); + pastels->showEditedCB(); + saturated->showEditedCB(); + psThreshold->showEditedCB(); + sensiv->showEditedCB(); - curveEditorGG->setBatchMode (batchMode); + curveEditorGG->setBatchMode(batchMode); } -std::vector Locallab::getCurvePoints (ThresholdSelector* tAdjuster) const +std::vector Locallab::getCurvePoints(ThresholdSelector* tAdjuster) const { std::vector points; double threshold, transitionWeighting; @@ -4335,15 +4336,15 @@ std::vector Locallab::getCurvePoints (ThresholdSelector* tAdjuster) cons threshold /= 100.; // range 0., +1. // Initial point - points.push_back (0.); - points.push_back (0.); + points.push_back(0.); + points.push_back(0.); double p2 = 3.0 * threshold / 4.0; // same one than in ipvibrance.cc double s0 = threshold + (1.0 - threshold) / 4.0; // same one than in ipvibrance.cc // point at the beginning of the first linear transition - points.push_back (p2); - points.push_back (0.); + points.push_back(p2); + points.push_back(0.); // Y value of the chroma mean point, calculated to get a straight line between p2 and s0 double chromaMean = (threshold / 4.0) / (s0 - p2); @@ -4358,18 +4359,18 @@ std::vector Locallab::getCurvePoints (ThresholdSelector* tAdjuster) cons } // point at the location of the Top cursor, at the end of the first linear transition and the beginning of the second one - points.push_back (threshold); - points.push_back (chromaMean); + points.push_back(threshold); + points.push_back(chromaMean); if (threshold < 1.0) { // point at the end of the second linear transition - points.push_back (s0); - points.push_back (1.0); + points.push_back(s0); + points.push_back(1.0); // end point - points.push_back (1.0); - points.push_back (1.0); + points.push_back(1.0); + points.push_back(1.0); } return points; @@ -4378,15 +4379,15 @@ std::vector Locallab::getCurvePoints (ThresholdSelector* tAdjuster) cons -void Locallab::setEditProvider (EditDataProvider * provider) +void Locallab::setEditProvider(EditDataProvider * provider) { - EditSubscriber::setEditProvider (provider); - cTgainshape->setEditProvider (provider); - cTgainshaperab->setEditProvider (provider); + EditSubscriber::setEditProvider(provider); + cTgainshape->setEditProvider(provider); + cTgainshaperab->setEditProvider(provider); } -void Locallab::editToggled () +void Locallab::editToggled() { if (edit->get_active()) { subscribe(); @@ -4395,7 +4396,7 @@ void Locallab::editToggled () } } -void Locallab::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) +void Locallab::colorForValue(double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) { float R, G, B; @@ -4406,20 +4407,20 @@ void Locallab::colorForValue (double valX, double valY, enum ColorCaller::ElemTy if (callerId == 1) { // ch - main curve - Color::hsv2rgb01 (float (valX), float (valY), 0.5f, R, G, B); + Color::hsv2rgb01(float (valX), float (valY), 0.5f, R, G, B); } else if (callerId == 2) { // cc - bottom bar float value = (1.f - 0.7f) * float (valX) + 0.7f; // whole hue range // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) - Color::hsv2rgb01 (float (valY), float (valX), value, R, G, B); + Color::hsv2rgb01(float (valY), float (valX), value, R, G, B); } else if (callerId == 3) { // lc - bottom bar float value = (1.f - 0.7f) * float (valX) + 0.7f; // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) - Color::hsv2rgb01 (float (valY), float (valX), value, R, G, B); + Color::hsv2rgb01(float (valY), float (valX), value, R, G, B); } else if (callerId == 4) { // LH - bottom bar - Color::hsv2rgb01 (float (valX), 0.5f, float (valY), R, G, B); + Color::hsv2rgb01(float (valX), 0.5f, float (valY), R, G, B); } else if (callerId == 5) { // HH - bottom bar float h = float ((valY - 0.5) * 0.3 + valX); @@ -4429,7 +4430,7 @@ void Locallab::colorForValue (double valX, double valY, enum ColorCaller::ElemTy h += 1.0f; } - Color::hsv2rgb01 (h, 0.5f, 0.5f, R, G, B); + Color::hsv2rgb01(h, 0.5f, 0.5f, R, G, B); } caller->ccRed = double (R); @@ -4439,7 +4440,7 @@ void Locallab::colorForValue (double valX, double valY, enum ColorCaller::ElemTy -CursorShape Locallab::getCursor (int objectID) +CursorShape Locallab::getCursor(int objectID) { switch (objectID) { case (2): { @@ -4490,41 +4491,41 @@ CursorShape Locallab::getCursor (int objectID) } } -bool Locallab::mouseOver (int modifierKey) +bool Locallab::mouseOver(int modifierKey) { EditDataProvider* editProvider = getEditProvider(); if (editProvider && editProvider->object != lastObject) { if (lastObject > -1) { if (lastObject == 2 || lastObject == 3) { - EditSubscriber::visibleGeometry.at (2)->state = Geometry::NORMAL; - EditSubscriber::visibleGeometry.at (3)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(2)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(3)->state = Geometry::NORMAL; } else if (lastObject == 0 || lastObject == 1) { - EditSubscriber::visibleGeometry.at (0)->state = Geometry::NORMAL; - EditSubscriber::visibleGeometry.at (1)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(0)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(1)->state = Geometry::NORMAL; } else { - EditSubscriber::visibleGeometry.at (4)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(4)->state = Geometry::NORMAL; // EditSubscriber::visibleGeometry.at (lastObject)->state = Geometry::NORMAL; } } if (editProvider->object > -1) { if (editProvider->object == 2 || editProvider->object == 3) { - EditSubscriber::visibleGeometry.at (2)->state = Geometry::PRELIGHT; - EditSubscriber::visibleGeometry.at (3)->state = Geometry::PRELIGHT; + EditSubscriber::visibleGeometry.at(2)->state = Geometry::PRELIGHT; + EditSubscriber::visibleGeometry.at(3)->state = Geometry::PRELIGHT; } else if (editProvider->object == 0 || editProvider->object == 1) { - EditSubscriber::visibleGeometry.at (0)->state = Geometry::PRELIGHT; - EditSubscriber::visibleGeometry.at (1)->state = Geometry::PRELIGHT; + EditSubscriber::visibleGeometry.at(0)->state = Geometry::PRELIGHT; + EditSubscriber::visibleGeometry.at(1)->state = Geometry::PRELIGHT; } else { - EditSubscriber::visibleGeometry.at (4)->state = Geometry::PRELIGHT; + EditSubscriber::visibleGeometry.at(4)->state = Geometry::PRELIGHT; // EditSubscriber::visibleGeometry.at (editProvider->object)->state = Geometry::PRELIGHT; } } @@ -4536,7 +4537,7 @@ bool Locallab::mouseOver (int modifierKey) return false; } -bool Locallab::button1Pressed (int modifierKey) +bool Locallab::button1Pressed(int modifierKey) { if (lastObject < 0) { return false; @@ -4544,15 +4545,15 @@ bool Locallab::button1Pressed (int modifierKey) EditDataProvider *provider = getEditProvider(); - if (! (modifierKey & GDK_CONTROL_MASK)) { + if (!(modifierKey & GDK_CONTROL_MASK)) { // button press is valid (no modifier key) PolarCoord pCoord; // EditDataProvider *provider = getEditProvider(); int imW, imH; - provider->getImageSize (imW, imH); + provider->getImageSize(imW, imH); double halfSizeW = imW / 2.; double halfSizeH = imH / 2.; - draggedCenter.set (int (halfSizeW + halfSizeW * (centerX->getValue() / 1000.)), int (halfSizeH + halfSizeH * (centerY->getValue() / 1000.))); + draggedCenter.set(int (halfSizeW + halfSizeW * (centerX->getValue() / 1000.)), int (halfSizeH + halfSizeH * (centerY->getValue() / 1000.))); // trick to get the correct angle (clockwise/counter-clockwise) rtengine::Coord p1 = draggedCenter; @@ -4576,7 +4577,7 @@ bool Locallab::button1Pressed (int modifierKey) currPos.y = p; draggedPoint = currPos - centerPos; // compute the projected value of the dragged point - draggedlocYOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); + draggedlocYOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); if (lastObject == 2) { //draggedlocYOffset = -draggedlocYOffset; @@ -4600,7 +4601,7 @@ bool Locallab::button1Pressed (int modifierKey) // draggedPoint.setFromCartesian(centerPos, currPos); // compute the projected value of the dragged point - draggedlocYOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); + draggedlocYOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); if (lastObject == 3) { draggedlocYOffset = -draggedlocYOffset; @@ -4626,7 +4627,7 @@ bool Locallab::button1Pressed (int modifierKey) // draggedPoint.setFromCartesian(centerPos, currPos); // compute the projected value of the dragged point - draggedlocYOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); + draggedlocYOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); if (lastObject == 3) { draggedlocYOffset = -draggedlocYOffset; @@ -4656,7 +4657,7 @@ bool Locallab::button1Pressed (int modifierKey) // draggedPoint.setFromCartesian(centerPos, currPos); // compute the projected value of the dragged point //printf ("rad=%f ang=%f\n", draggedPoint.radius, draggedPoint.angle - degree->getValue()); - draggedlocXOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); + draggedlocXOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); // if (lastObject==1) // draggedlocXOffset = -draggedlocXOffset;//- draggedlocXOffset -= (locX->getValue() / 2000. * horiz); @@ -4675,7 +4676,7 @@ bool Locallab::button1Pressed (int modifierKey) // draggedPoint.setFromCartesian(centerPos, currPos); // printf ("rad=%f ang=%f\n", draggedPoint.radius, draggedPoint.angle - degree->getValue()); - draggedlocXOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); + draggedlocXOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); if (lastObject == 1) { draggedlocXOffset = -draggedlocXOffset; //- @@ -4699,7 +4700,7 @@ bool Locallab::button1Pressed (int modifierKey) // draggedPoint.setFromCartesian(centerPos, currPos); //printf ("rad=%f ang=%f\n", draggedPoint.radius, draggedPoint.angle - degree->getValue()); - draggedlocXOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); + draggedlocXOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); if (lastObject == 1) { draggedlocXOffset = -draggedlocXOffset; //- @@ -4759,16 +4760,16 @@ bool Locallab::button1Pressed (int modifierKey) // this will let this class ignore further drag events if (lastObject > -1) { // should theoretically always be true if (lastObject == 2 || lastObject == 3) { - EditSubscriber::visibleGeometry.at (2)->state = Geometry::NORMAL; - EditSubscriber::visibleGeometry.at (3)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(2)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(3)->state = Geometry::NORMAL; } if (lastObject == 0 || lastObject == 1) { - EditSubscriber::visibleGeometry.at (0)->state = Geometry::NORMAL; - EditSubscriber::visibleGeometry.at (1)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(0)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(1)->state = Geometry::NORMAL; } else { - EditSubscriber::visibleGeometry.at (4)->state = Geometry::NORMAL; + EditSubscriber::visibleGeometry.at(4)->state = Geometry::NORMAL; // EditSubscriber::visibleGeometry.at (lastObject)->state = Geometry::NORMAL; } } @@ -4786,12 +4787,12 @@ bool Locallab::button1Released() return true; } -bool Locallab::drag1 (int modifierKey) +bool Locallab::drag1(int modifierKey) { // compute the polar coordinate of the mouse position EditDataProvider *provider = getEditProvider(); int imW, imH; - provider->getImageSize (imW, imH); + provider->getImageSize(imW, imH); double halfSizeW = imW / 2.; double halfSizeH = imH / 2.; @@ -4809,7 +4810,7 @@ bool Locallab::drag1 (int modifierKey) draggedPoint = currPos - centerPos; // draggedPoint.setFromCartesian(centerPos, currPos); - double currDraggedlocYOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); + double currDraggedlocYOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); if (lastObject == 2) { currDraggedlocYOffset -= draggedlocYOffset; @@ -4821,14 +4822,14 @@ bool Locallab::drag1 (int modifierKey) currDraggedlocYOffset = currDraggedlocYOffset * 2000. / verti; if (int (currDraggedlocYOffset) != locYT->getIntValue()) { - locYT->setValue ((int (currDraggedlocYOffset))); + locYT->setValue((int (currDraggedlocYOffset))); double centX, centY; centX = centerX->getValue(); centY = centerY->getValue(); - updateGeometry (centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue() ); + updateGeometry(centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { - listener->panelChanged (EvlocallablocY, locYT->getTextValue()); + listener->panelChanged(EvlocallablocY, locYT->getTextValue()); } return true; @@ -4847,7 +4848,7 @@ bool Locallab::drag1 (int modifierKey) draggedPoint = currPos - centerPos; // draggedPoint.setFromCartesian(centerPos, currPos); - double currDraggedlocYOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); + double currDraggedlocYOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); // if (lastObject==2) // Dragging the upper locY bar @@ -4863,15 +4864,15 @@ bool Locallab::drag1 (int modifierKey) if (int (currDraggedlocYOffset) != locY->getIntValue()) { - locY->setValue ((int (currDraggedlocYOffset))); + locY->setValue((int (currDraggedlocYOffset))); double centX, centY; centX = centerX->getValue(); centY = centerY->getValue(); - updateGeometry (centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); + updateGeometry(centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { - listener->panelChanged (EvlocallablocY, locY->getTextValue()); + listener->panelChanged(EvlocallablocY, locY->getTextValue()); } return true; @@ -4893,7 +4894,7 @@ bool Locallab::drag1 (int modifierKey) draggedPoint = currPos - centerPos; // draggedPoint.setFromCartesian(centerPos, currPos); - double currDraggedlocYOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); + double currDraggedlocYOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue()) / 180.*rtengine::RT_PI); if (lastObject == 2) // Dragging the upper locY bar @@ -4908,17 +4909,17 @@ bool Locallab::drag1 (int modifierKey) currDraggedlocYOffset = currDraggedlocYOffset * 2000. / verti; if (int (currDraggedlocYOffset) != locY->getIntValue()) { - locY->setValue ((int (currDraggedlocYOffset))); + locY->setValue((int (currDraggedlocYOffset))); //Smethod->get_active_row_number()==2 double centX, centY; centX = centerX->getValue(); centY = centerY->getValue(); - updateGeometry (centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); + updateGeometry(centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { if (Smethod->get_active_row_number() == 1 || Smethod->get_active_row_number() == 3) { - listener->panelChanged (EvlocallablocY, locY->getTextValue()); + listener->panelChanged(EvlocallablocY, locY->getTextValue()); } // else listener->panelChanged (EvlocallablocY, locX->getTextValue()); @@ -4947,7 +4948,7 @@ bool Locallab::drag1 (int modifierKey) draggedPoint = currPos - centerPos; // draggedPoint.setFromCartesian(centerPos, currPos); - double currDraggedStrOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); + double currDraggedStrOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); if (lastObject == 0) //>=4 // Dragging the upper locY bar @@ -4962,14 +4963,14 @@ bool Locallab::drag1 (int modifierKey) currDraggedStrOffset = currDraggedStrOffset * 2000. / horiz; if (int (currDraggedStrOffset) != locX->getIntValue()) { - locX->setValue ((int (currDraggedStrOffset))); + locX->setValue((int (currDraggedStrOffset))); double centX, centY; centX = centerX->getValue(); centY = centerY->getValue(); - updateGeometry (centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); + updateGeometry(centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { - listener->panelChanged (EvlocallablocX, locX->getTextValue()); + listener->panelChanged(EvlocallablocX, locX->getTextValue()); } return true; @@ -4987,7 +4988,7 @@ bool Locallab::drag1 (int modifierKey) draggedPoint = currPos - centerPos; //draggedPoint.setFromCartesian(centerPos, currPos); - double currDraggedStrOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); + double currDraggedStrOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); if (lastObject == 0) // Dragging the upper locY bar @@ -5002,14 +5003,14 @@ bool Locallab::drag1 (int modifierKey) currDraggedStrOffset = currDraggedStrOffset * 2000. / horiz; if (int (currDraggedStrOffset) != locXL->getIntValue()) { - locXL->setValue ((int (currDraggedStrOffset))); + locXL->setValue((int (currDraggedStrOffset))); double centX, centY; centX = centerX->getValue(); centY = centerY->getValue(); - updateGeometry (centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); + updateGeometry(centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { - listener->panelChanged (EvlocallablocX, locX->getTextValue()); + listener->panelChanged(EvlocallablocX, locX->getTextValue()); } return true; @@ -5031,7 +5032,7 @@ bool Locallab::drag1 (int modifierKey) draggedPoint = currPos - centerPos; // draggedPoint.setFromCartesian(centerPos, currPos); - double currDraggedStrOffset = draggedPoint.radius * sin ((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); + double currDraggedStrOffset = draggedPoint.radius * sin((draggedPoint.angle - degree->getValue() + 90.) / 180.*rtengine::RT_PI); if (lastObject == 0) // Dragging the upper locY bar @@ -5046,14 +5047,14 @@ bool Locallab::drag1 (int modifierKey) currDraggedStrOffset = currDraggedStrOffset * 2000. / horiz; if (int (currDraggedStrOffset) != locX->getIntValue()) { - locX->setValue ((int (currDraggedStrOffset))); + locX->setValue((int (currDraggedStrOffset))); double centX, centY; centX = centerX->getValue(); centY = centerY->getValue(); - updateGeometry (centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); + updateGeometry(centX, centY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { - listener->panelChanged (EvlocallablocX, locX->getTextValue()); + listener->panelChanged(EvlocallablocX, locX->getTextValue()); } return true; @@ -5142,17 +5143,17 @@ bool Locallab::drag1 (int modifierKey) rtengine::Coord currPos; draggedCenter += provider->deltaPrevImage; currPos = draggedCenter; - currPos.clip (imW, imH); + currPos.clip(imW, imH); int newCenterX = int ((double (currPos.x) - halfSizeW) / halfSizeW * 1000.); int newCenterY = int ((double (currPos.y) - halfSizeH) / halfSizeH * 1000.); if (newCenterX != centerX->getIntValue() || newCenterY != centerY->getIntValue()) { - centerX->setValue (newCenterX); - centerY->setValue (newCenterY); - updateGeometry (newCenterX, newCenterY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); + centerX->setValue(newCenterX); + centerY->setValue(newCenterY); + updateGeometry(newCenterX, newCenterY, circrad->getValue(), locY->getValue(), degree->getValue(), locX->getValue(), locYT->getValue(), locXL->getValue()); if (listener) { - listener->panelChanged (EvlocallabCenter, Glib::ustring::compose ("X=%1\nY=%2", centerX->getTextValue(), centerY->getTextValue())); + listener->panelChanged(EvlocallabCenter, Glib::ustring::compose("X=%1\nY=%2", centerX->getTextValue(), centerY->getTextValue())); } return true; @@ -5162,15 +5163,15 @@ bool Locallab::drag1 (int modifierKey) return false; } -void Locallab::switchOffEditMode () +void Locallab::switchOffEditMode() { if (edit->get_active()) { // switching off the toggle button - bool wasBlocked = editConn.block (true); - edit->set_active (false); + bool wasBlocked = editConn.block(true); + edit->set_active(false); if (!wasBlocked) { - editConn.block (false); + editConn.block(false); } } diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index a407f6083..82327293f 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -72,10 +72,12 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan prsharpening = Gtk::manage (new PrSharpening()); crop = Gtk::manage (new Crop ()); icm = Gtk::manage (new ICMPanel ()); - if(!batch) { + + if (!batch) { exifpanel = Gtk::manage (new ExifPanel ()); iptcpanel = Gtk::manage (new IPTCPanel ()); } + wavelet = Gtk::manage (new Wavelet ()); dirpyrequalizer = Gtk::manage (new DirPyrEqualizer ()); hsvequalizer = Gtk::manage (new HSVEqualizer ()); @@ -155,7 +157,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan toolPanels.push_back (coarse); - if(!batch) { + if (!batch) { toolPanels.push_back (exifpanel); toolPanels.push_back (iptcpanel); metadataPanel = Gtk::manage (new Gtk::Notebook ()); @@ -165,6 +167,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan } else { metadataPanel = nullptr; } + toolPanelNotebook = new Gtk::Notebook (); toolPanelNotebook->set_name ("ToolPanelNotebook"); @@ -219,14 +222,15 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan TOITypes type = options.UseIconNoText ? TOI_ICON : TOI_TEXT; - toiE = Gtk::manage (new TextOrIcon ("exposure.png" , M ("MAIN_TAB_EXPOSURE") , M ("MAIN_TAB_EXPOSURE_TOOLTIP") , type)); - toiD = Gtk::manage (new TextOrIcon ("detail.png" , M ("MAIN_TAB_DETAIL") , M ("MAIN_TAB_DETAIL_TOOLTIP") , type)); - toiC = Gtk::manage (new TextOrIcon ("colour.png" , M ("MAIN_TAB_COLOR") , M ("MAIN_TAB_COLOR_TOOLTIP") , type)); - toiW = Gtk::manage (new TextOrIcon ("wavelet.png" , M ("MAIN_TAB_WAVELET") , M ("MAIN_TAB_WAVELET_TOOLTIP") , type)); - toiL = Gtk::manage (new TextOrIcon ("openhand.png" , M ("MAIN_TAB_LOCALLAB") , M ("MAIN_TAB_LOCALLAB_TOOLTIP") , type)); + toiE = Gtk::manage (new TextOrIcon ("exposure.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP"), type)); + toiD = Gtk::manage (new TextOrIcon ("detail.png", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP"), type)); + toiC = Gtk::manage (new TextOrIcon ("colour.png", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP"), type)); + toiW = Gtk::manage (new TextOrIcon ("wavelet.png", M ("MAIN_TAB_WAVELET"), M ("MAIN_TAB_WAVELET_TOOLTIP"), type)); + toiL = Gtk::manage (new TextOrIcon ("openhand.png", M ("MAIN_TAB_LOCALLAB"), M ("MAIN_TAB_LOCALLAB_TOOLTIP"), type)); toiT = Gtk::manage (new TextOrIcon ("transform.png", M ("MAIN_TAB_TRANSFORM"), M ("MAIN_TAB_TRANSFORM_TOOLTIP"), type)); toiR = Gtk::manage (new TextOrIcon ("raw.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP"), type)); - if(!batch) { + + if (!batch) { toiM = Gtk::manage (new TextOrIcon ("meta.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP"), type)); } else { toiM = nullptr; @@ -239,7 +243,8 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan toolPanelNotebook->append_page (*locallabPanelSW, *toiL); toolPanelNotebook->append_page (*transformPanelSW, *toiT); toolPanelNotebook->append_page (*rawPanelSW, *toiR); - if(!batch) { + + if (!batch) { toolPanelNotebook->append_page (*metadataPanel, *toiM); } @@ -565,12 +570,14 @@ void ToolPanelCoordinator::updateToolState() temp.push_back (options.tpOpen.at (i + expList.size())); } + locallab->updateToolState (temp); + locallab->setExpanded (true); + wavelet->updateToolState (temp); wavelet->setExpanded (true); retinex->updateToolState (temp); - locallab->updateToolState (temp); - locallab->setExpanded (true); - + + } } @@ -602,7 +609,7 @@ void ToolPanelCoordinator::writeToolExpandedStatus (std::vector &tpOpen) wavelet->writeOptions (tpOpen); retinex->writeOptions (tpOpen); locallab->writeOptions (tpOpen); - + } @@ -882,8 +889,8 @@ void ToolPanelCoordinator::updateTabsHeader (bool useIcons) toiC->switchTo (type); toiT->switchTo (type); toiR->switchTo (type); - toiL->switchTo (type); - + toiL->switchTo (type); + if (toiM) { toiM->switchTo (type); }