diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 631f45a91..aec11e59b 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -41,6 +41,7 @@ #ifdef _OPENMP #include #endif +#include "StopWatch.h" #define TS 64 // Tile size #define offset 25 // shift between tiles @@ -475,6 +476,7 @@ enum nrquality {QUALITY_STANDARD, QUALITY_HIGH}; SSEFUNCTION void ImProcFunctions::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) { +BENCHFUN //#ifdef _DEBUG MyTime t1e, t2e; t1e.set(); @@ -1781,7 +1783,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftwf_destroy_plan(plan_backward_blox[0]); fftwf_destroy_plan(plan_forward_blox[1]); fftwf_destroy_plan(plan_backward_blox[1]); - fftwf_cleanup(); } } while (memoryAllocationFailed && numTries < 2 && (options.rgbDenoiseThreadLimit == 0) && !ponder); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index b4edab549..37241bbe0 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -199,11 +199,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) imgsrc->preprocess ( rp, params.lensProf, params.coarse ); imgsrc->getRAWHistogram ( histRedRaw, histGreenRaw, histBlueRaw ); - if (highDetailNeeded) { - highDetailPreprocessComputed = true; - } else { - highDetailPreprocessComputed = false; - } + highDetailPreprocessComputed = highDetailNeeded; } /* @@ -269,21 +265,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - - // Updating toneCurve.hrenabled if necessary - // It has to be done there, because the next 'if' statement will use the value computed here - if (todo & M_AUTOEXP) { - if (params.toneCurve.autoexp) {// this enabled HLRecovery - if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { - // switching params.toneCurve.hrenabled to true -> shouting in listener's ears! - params.toneCurve.hrenabled = true; - - // forcing INIT to be done, to reconstruct HL again - todo |= M_INIT; - } - } - } - if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { MyMutex::MyLock initLock (minit); // Also used in crop window diff --git a/rtengine/init.cc b/rtengine/init.cc index 8d2cf9174..0d4560c6b 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include #include "../rtgui/profilestorecombobox.h" #include "rtengine.h" #include "iccstore.h" @@ -108,10 +109,15 @@ int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDi void cleanup () { - ProcParams::cleanup (); Color::cleanup (); RawImageSource::cleanup (); +#ifdef RT_FFTW3F_OMP + fftwf_cleanup_threads(); +#else + fftwf_cleanup(); +#endif + } StagedImageProcessor* StagedImageProcessor::create (InitialImage* initialImage) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index dfce03797..2c9da96f5 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -359,22 +359,6 @@ bool ToneCurveParams::operator !=(const ToneCurveParams& other) const return !(*this == other); } -bool ToneCurveParams::HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw) -{ - if (options.rtSettings.verbose) { - printf("histRedRaw[ 0]=%07d, histGreenRaw[ 0]=%07d, histBlueRaw[ 0]=%07d\nhistRedRaw[255]=%07d, histGreenRaw[255]=%07d, histBlueRaw[255]=%07d\n", - histRedRaw[0], histGreenRaw[0], histBlueRaw[0], histRedRaw[255], histGreenRaw[255], histBlueRaw[255]); - } - - return - histRedRaw[255] > 50 - || histGreenRaw[255] > 50 - || histBlueRaw[255] > 50 - || histRedRaw[0] > 50 - || histGreenRaw[0] > 50 - || histBlueRaw[0] > 50; -} - RetinexParams::RetinexParams() : enabled(false), cdcurve{ diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 7cabc3aef..46c29774c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -287,7 +287,6 @@ struct ToneCurveParams { bool operator ==(const ToneCurveParams& other) const; bool operator !=(const ToneCurveParams& other) const; - static bool HLReconstructionNecessary(const LUTu& histRedRaw, const LUTu& histGreenRaw, const LUTu& histBlueRaw); }; /** diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 7b636797e..2910b6b43 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -200,16 +200,6 @@ private: imgsrc->setCurrentFrame (params.raw.bayersensor.imageNum); imgsrc->preprocess ( params.raw, params.lensProf, params.coarse, params.dirpyrDenoise.enabled); - if (params.toneCurve.autoexp) {// this enabled HLRecovery - LUTu histRedRaw (256), histGreenRaw (256), histBlueRaw (256); - imgsrc->getRAWHistogram (histRedRaw, histGreenRaw, histBlueRaw); - - if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { - params.toneCurve.hrenabled = true; - // WARNING: Highlight Reconstruction is being forced 'on', should we force a method here too? - } - } - if (pl) { pl->setProgress (0.20); } diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index c1cae20f6..c5e7c407f 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -907,18 +907,6 @@ void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/* for (int i = 0; i < width * height; i++) { (*U) (i) -= max; } - - // fft parallel threads cleanup, better handled outside this function? -#ifdef RT_FFTW3F_OMP - - if (multithread) { - fftwf_cleanup_threads(); - } - -#endif - - // ph.setValue(90); - //DEBUG_STR << "solve_pde_fft: done" << std::endl; }