Improved Gauss kernel generation#2844
Conversation
There was a problem hiding this comment.
This looks like a strict improvement over the preceding code; I do not see any new floating point issues.
(It doesn't fix all of them -- the calculation of sum_norm is of course increasingly affected by floating point error when sigma and width are huge. But fixing this would make the function much slower or much more complicated, and has no benefit when the image filtering code doesn't do the same. And huge sigma and width are incredibly slow to evaluate anyway.)
|
Thanks for the review!
Yes, but I don't think we need to worry about the precision of |
Changes:
f32::powfand cache more divisions. The performance impact will likely be negligible, but I'd rather remove functions of unknown complexity.Taken together,$\sigma\ge 0$ .
get_gaussian_kernel_1dnow generates correct kernels for allSince I only changed the behavior for edge cases (very small sigma), the behavior of our Gaussian blur remains unchanged.