Speedup fftw for blur and noise

This commit is contained in:
Desmis 2019-12-11 18:18:29 +01:00
parent d28bce3fb0
commit e4c2ec4d2d

View File

@ -8863,21 +8863,28 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
if (((radius > 1.5 * GAUSS_SKIP && lp.rad > 1.6) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image
std::unique_ptr<LabImage> tmp1;
std::unique_ptr<LabImage> tmp2;
const int ystart = std::max(static_cast<int>(lp.yc - lp.lyT) - cy, 0);
const int yend = std::min(static_cast<int>(lp.yc + lp.ly) - cy, original->H);
const int xstart = std::max(static_cast<int>(lp.xc - lp.lxL) - cx, 0);
const int xend = std::min(static_cast<int>(lp.xc + lp.lx) - cx, original->W);
int ystart = std::max(static_cast<int>(lp.yc - lp.lyT) - cy, 0);
int yend = std::min(static_cast<int>(lp.yc + lp.ly) - cy, original->H);
int xstart = std::max(static_cast<int>(lp.xc - lp.lxL) - cx, 0);
int xend = std::min(static_cast<int>(lp.xc + lp.lx) - cx, original->W);
int bfh = yend - ystart;
int bfw = xend - xstart;
int bfhr = bfh;
int bfwr = bfw;
bool reduH = false;
bool reduW = false;
bool fft = params->locallab.spots.at(sp).fftwbl;
int isogr = params->locallab.spots.at(sp).isogr;
int strengr = params->locallab.spots.at(sp).strengr;
int scalegr = params->locallab.spots.at(sp).scalegr;
//here no optimization FFTW, complex to do ! only cost time
if (bfw >= mSP && bfh >= mSP) {
if (lp.blurmet == 0 && (fft || lp.rad > 30.f)) {
optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, reduH, reduW, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy);
}
JaggedArray<float> bufchroi(GW, GH);
std::unique_ptr<LabImage> bufgbi(new LabImage(GW, GH));
@ -8922,11 +8929,11 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
if (lp.blurmet == 0 && lp.blmet == 0 && radius > (1.5 * GAUSS_SKIP) && lp.rad > 1.6) {
if (fft || lp.rad > 30.f) {
ImProcFunctions::fftw_convol_blur2(tmp1->L, tmp1->L, bfw, bfh, radius, 0, 0);
ImProcFunctions::fftw_convol_blur2(tmp1->L, tmp1->L, bfwr, bfhr, radius, 0, 0);
if (!lp.actsp) {
ImProcFunctions::fftw_convol_blur2(tmp1->a, tmp1->a, bfw, bfh, radius, 0, 0);
ImProcFunctions::fftw_convol_blur2(tmp1->b, tmp1->b, bfw, bfh, radius, 0, 0);
ImProcFunctions::fftw_convol_blur2(tmp1->a, tmp1->a, bfwr, bfhr, radius, 0, 0);
ImProcFunctions::fftw_convol_blur2(tmp1->b, tmp1->b, bfwr, bfhr, radius, 0, 0);
}
} else {