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 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)
|
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;
|
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 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;
|
const float qhighFactor = (nrQuality == QUALITY_HIGH) ? 1.f / static_cast<float>( settings->nrhigh) : 1.0f;
|
||||||
|
@@ -38,6 +38,7 @@ namespace rtengine
|
|||||||
const Settings* settings;
|
const Settings* settings;
|
||||||
|
|
||||||
MyMutex* lcmsMutex = nullptr;
|
MyMutex* lcmsMutex = nullptr;
|
||||||
|
MyMutex *fftwMutex = nullptr;
|
||||||
|
|
||||||
int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir, bool loadAll)
|
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 ();
|
Color::init ();
|
||||||
delete lcmsMutex;
|
delete lcmsMutex;
|
||||||
lcmsMutex = new MyMutex;
|
lcmsMutex = new MyMutex;
|
||||||
|
fftwMutex = new MyMutex;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,6 +74,7 @@
|
|||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
|
||||||
extern const Settings *settings;
|
extern const Settings *settings;
|
||||||
|
extern MyMutex *fftwMutex;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -629,6 +630,7 @@ void tmo_fattal02(size_t width,
|
|||||||
Array2Df U(width, height);
|
Array2Df U(width, height);
|
||||||
// if (fftsolver)
|
// if (fftsolver)
|
||||||
{
|
{
|
||||||
|
MyMutex::MyLock lock(*fftwMutex);
|
||||||
solve_pde_fft(&DivG, &U, multithread);//, ph);
|
solve_pde_fft(&DivG, &U, multithread);//, ph);
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
|
Reference in New Issue
Block a user