Fix blur radius when using the Fourier method
Fix the formula, adapt old pp3s, and change the maximum blur radius where applicable.
This commit is contained in:
@@ -1314,14 +1314,26 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red
|
||||
if (settings->fftwsigma == false) { //empirical formula
|
||||
ImProcFunctions::fftw_convol_blur2(src, out, bfwr, bfhr, (kr * RetinexScales[scale]), 0, 0);
|
||||
} else {
|
||||
ImProcFunctions::fftw_convol_blur2(src, out, bfwr, bfhr, (SQR(RetinexScales[scale])), 0, 0);
|
||||
// FFT blur radius fixed in 5.12, resulting in different
|
||||
// blur amount. Here we preserve the original behavior by
|
||||
// multiplying the original sigma SQR(RetinexScales[scale])
|
||||
// with 2 then taking the square root.
|
||||
const auto gaussianSigma = std::sqrt(2.f) * RetinexScales[scale];
|
||||
ImProcFunctions::fftw_convol_blur2(src, out, bfwr, bfhr, gaussianSigma, 0, 0);
|
||||
}
|
||||
} else { // reuse result of last iteration
|
||||
// out was modified in last iteration => restore it
|
||||
if (settings->fftwsigma == false) { //empirical formula
|
||||
ImProcFunctions::fftw_convol_blur2(out, out, bfwr, bfhr, sqrtf(SQR(kr * RetinexScales[scale]) - SQR(kr * RetinexScales[scale + 1])), 0, 0);
|
||||
} else {
|
||||
ImProcFunctions::fftw_convol_blur2(out, out, bfwr, bfhr, (SQR(RetinexScales[scale]) - SQR(RetinexScales[scale + 1])), 0, 0);
|
||||
// FFT blur radius fixed in 5.12, resulting in different
|
||||
// blur amount. Here we preserve the original behavior by
|
||||
// multiplying the original sigma
|
||||
// SQR(RetinexScales[scale]) - SQR(RetinexScales[scale + 1])
|
||||
// with 2 then taking the square root.
|
||||
const auto gaussianSigma =
|
||||
std::sqrt(2 * (SQR(RetinexScales[scale]) - SQR(RetinexScales[scale + 1])));
|
||||
ImProcFunctions::fftw_convol_blur2(out, out, bfwr, bfhr, gaussianSigma, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user