diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index d494771e9..d35840656 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -83,7 +83,7 @@ namespace rtengine { - void ImProcFunctions::RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe) + void ImProcFunctions::RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -150,7 +150,7 @@ namespace rtengine { //srand((unsigned)time(0));//test with random data - const float gain = pow (2.0f, dnparams.expcomp); + const float gain = pow (2.0f, expcomp); float incr=1.f; float noisevar_Ldetail = SQR((SQR(100.f-dnparams.Ldetail) + 50.f*(100.f-dnparams.Ldetail)) * TS * 0.5f * incr); diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 1af138719..2f8e7cc8e 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -109,7 +109,7 @@ void Crop::update (int todo) { if (todo & M_LINDENOISE) { if (skip==1 && params.dirpyrDenoise.enabled) { - parent->ipf.RGB_denoise(origCrop, origCrop, parent->imgsrc->isRAW(), /*Roffset,*/ params.dirpyrDenoise, params.defringe); + parent->ipf.RGB_denoise(origCrop, origCrop, parent->imgsrc->isRAW(), /*Roffset,*/ params.dirpyrDenoise, params.defringe, parent->imgsrc->getDirPyrDenoiseExpComp()); } } parent->imgsrc->convertColorSpace(origCrop, params.icm, params.raw); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 0bffc9255..8add1a032 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -54,9 +54,10 @@ class ImageSource : public InitialImage { Glib::ustring fileName; ImageData* idata; ImageMatrices imatrices; + double dirpyrdenoiseExpComp; public: - ImageSource () : references (1), embProfile(NULL), idata(NULL) {} + ImageSource () : references (1), embProfile(NULL), idata(NULL), dirpyrdenoiseExpComp(INFINITY) {} virtual ~ImageSource () {} virtual int load (Glib::ustring fname, bool batch = false) =0; @@ -100,7 +101,7 @@ class ImageSource : public InitialImage { virtual void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw) { histRedRaw.clear(); histGreenRaw.clear(); histBlueRaw.clear(); // only some sources will supply this } - + double getDirPyrDenoiseExpComp ( ) { return dirpyrdenoiseExpComp; } // functions inherited from the InitialImage interface virtual Glib::ustring getFileName () { return fileName; } virtual cmsHPROFILE getEmbeddedProfile () { return embProfile; } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 16ccba9fc..d2520e468 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -192,12 +192,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { highDetailRawComputed = false; - LUTu aehist; int aehistcompr; - double clip; - int brightness, contrast, black, hlcompr, hlcomprthresh; - - imgsrc->getAutoExpHistogram (aehist, aehistcompr); - ipf.getAutoExp (aehist, aehistcompr, imgsrc->getDefGain(), clip, params.dirpyrDenoise.expcomp, brightness, contrast, black, hlcompr, hlcomprthresh); } @@ -239,7 +233,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { if (todo & M_LINDENOISE) { //printf("denoising!\n"); if (scale==1 && params.dirpyrDenoise.enabled) { - ipf.RGB_denoise(orig_prev, orig_prev, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe); + ipf.RGB_denoise(orig_prev, orig_prev, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp()); } } imgsrc->convertColorSpace(orig_prev, params.icm, params.raw); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 9512aba78..d8da28a25 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -137,7 +137,7 @@ class ImProcFunctions { //void RGB_InputTransf(Imagefloat * src, LabImage * dst, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe); //void RGB_OutputTransf(LabImage * src, Imagefloat * dst, const procparams::DirPyrDenoiseParams & dnparams); //void output_tile_row (float *Lbloxrow, float ** Lhipassdn, float ** tilemask, int height, int width, int top, int blkrad ); - void RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe); + void RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp); void RGBtile_denoise (float * fLblox, int vblproc, int hblproc, int numblox_H, int numblox_W, float noisevar_L ); //for DCT void RGBoutput_tile_row (float *Lbloxrow, float ** Ldetail, float ** tilemask_out, int height, int width, int top ); //void WaveletDenoise(cplx_wavelet_decomposition &DualTreeCoeffs, float noisevar ); @@ -178,7 +178,7 @@ class ImProcFunctions { 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 LCPMapper *pLCPMap=NULL); bool transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LCPMapper *pLCPMap=NULL); - void getAutoExp (LUTu & histogram, int histcompr, double defgain, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); + static void getAutoExp (LUTu & histogram, int histcompr, double defgain, 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 LCPMapper *pLCPMap=NULL); }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8849ee147..cb713b0c2 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -260,7 +260,6 @@ void ProcParams::setDefaults () { dirpyrDenoise.redchro = 0; dirpyrDenoise.bluechro = 0; dirpyrDenoise.gamma = 1.7; - dirpyrDenoise.expcomp = 0.0; dirpyrDenoise.dmethod = "RGB"; edgePreservingDecompositionUI.enabled = false; diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 9022fc4a3..e9a1bf627 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -464,7 +464,6 @@ class WBParams { double redchro; double bluechro; double gamma; - double expcomp; Glib::ustring dmethod; }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 8c2a98678..5577fcc10 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1076,6 +1076,14 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } if ( raw.expos !=1 ) processRawWhitepoint(raw.expos, raw.preser); + + if(dirpyrdenoiseExpComp == INFINITY) { + LUTu aehist; int aehistcompr; + double clip=0; + int brightness, contrast, black, hlcompr, hlcomprthresh; + getAutoExpHistogram (aehist, aehistcompr); + ImProcFunctions::getAutoExp (aehist, aehistcompr, getDefGain(), clip, dirpyrdenoiseExpComp, brightness, contrast, black, hlcompr, hlcomprthresh); + } t2.set(); if( settings->verbose ) diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index af2675698..981c6149c 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -116,7 +116,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p LabImage* labView = new LabImage (fw,fh); if (params.dirpyrDenoise.enabled) { - ipf.RGB_denoise(baseImg, baseImg, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe); + ipf.RGB_denoise(baseImg, baseImg, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp()); } imgsrc->convertColorSpace(baseImg, params.icm, params.raw);