From f2a2ed9ea14730a9bb329f5bd4d6a7a19cd473ae Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 1 Jul 2019 14:45:17 +0200 Subject: [PATCH] Improvment to FFTW Retinex --- rtengine/ipretinex.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 1878b682d..29a7ca4ee 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -1012,11 +1012,19 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L } else { if (scale == scal - 1) { - ImProcFunctions::fftw_convol_blur2(src, out, W_L, H_L, (kr * RetinexScales[scale]), 0, 0); + if(settings->fftwsigma == false) {//empirical formula + ImProcFunctions::fftw_convol_blur2(src, out, W_L, H_L, (kr * RetinexScales[scale]), 0, 0); + } else { + ImProcFunctions::fftw_convol_blur2(src, out, W_L, H_L, (SQR(RetinexScales[scale])), 0, 0); + } } else // reuse result of last iteration { // out was modified in last iteration => restore it - ImProcFunctions::fftw_convol_blur2(out, out, W_L, H_L,sqrtf(SQR(kr * RetinexScales[scale]) - SQR(kr * RetinexScales[scale + 1])), 0, 0); + if(settings->fftwsigma == false) {//empirical formula + ImProcFunctions::fftw_convol_blur2(out, out, W_L, H_L,sqrtf(SQR(kr * RetinexScales[scale]) - SQR(kr * RetinexScales[scale + 1])), 0, 0); + } else { + ImProcFunctions::fftw_convol_blur2(out, out, W_L, H_L,sqrtf(SQR(SQR(RetinexScales[scale])) - SQR(SQR(RetinexScales[scale + 1]))), 0, 0); + } } }