diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 50b178388..fadb74bac 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -71,6 +71,8 @@ namespace rtengine extern const Settings* settings; +extern MyMutex *fftwMutex; + void ImProcFunctions::Median_Denoise(float **src, float **dst, const int width, const int height, const Median medianType, const int iterations, const int numThreads, float **buffer) { @@ -445,8 +447,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef return; } - static MyMutex FftwMutex; - MyMutex::MyLock lock(FftwMutex); + MyMutex::MyLock lock(*fftwMutex); const nrquality nrQuality = (dnparams.smethod == "shal") ? QUALITY_STANDARD : QUALITY_HIGH;//shrink method const float qhighFactor = (nrQuality == QUALITY_HIGH) ? 1.f / static_cast( settings->nrhigh) : 1.0f; diff --git a/rtengine/init.cc b/rtengine/init.cc index 6c1f4b98a..8d2cf9174 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -38,6 +38,7 @@ namespace rtengine const Settings* settings; MyMutex* lcmsMutex = nullptr; +MyMutex *fftwMutex = nullptr; int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir, bool loadAll) { @@ -101,6 +102,7 @@ int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDi Color::init (); delete lcmsMutex; lcmsMutex = new MyMutex; + fftwMutex = new MyMutex; return 0; } diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index b44f1c1b6..0b9914e0f 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -74,6 +74,7 @@ namespace rtengine { extern const Settings *settings; +extern MyMutex *fftwMutex; using namespace std; @@ -629,6 +630,7 @@ void tmo_fattal02(size_t width, Array2Df U(width, height); // if (fftsolver) { + MyMutex::MyLock lock(*fftwMutex); solve_pde_fft(&DivG, &U, multithread);//, ph); } // else