Cleanup fftw when closing RT, instead of after each time fftw is used. Speeds up fattal and luminance denoise

This commit is contained in:
heckflosse
2018-01-17 20:39:01 +01:00
parent f644d41ff2
commit 53ec11eea9
3 changed files with 9 additions and 14 deletions

View File

@@ -41,6 +41,7 @@
#ifdef _OPENMP
#include <omp.h>
#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);

View File

@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fftw3.h>
#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)

View File

@@ -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;
}