Fattal: protect fftwf calls with a mutex (shared also with the denoise routine)
Initialization of the fftwMutex now happens in rtengine::init()
This commit is contained in:
@@ -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<float>( settings->nrhigh) : 1.0f;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user