top | item 42226839

(no title)

mkbosmans | 1 year ago

Do browsers really use a box filter to approximate a gaussian blur? That seems implausible to me, as they produce pretty different looking blurs.

discuss

order

djmips|1 year ago

It doesn't seem improbable considering it's a huge performance win and perhaps many won't notice?

mkbosmans|1 year ago

It is the performance win for similar looking results that I find improbable. For a box blur to look like gaussian blur, you would need multiple passes. Even though each pass is now O(1) instead of O(n) (with n the blur radius), due to caching effects I think a gaussian kernel would still be faster, especially for the small blur radius as described in the article.

tyleo|1 year ago

Yeah because the GPU has special hardware which you can take advantage of for an optimized box filter.

https://www.rastergrid.com/blog/2010/09/efficient-gaussian-b...

mkbosmans|1 year ago

That link is not a box filter, as it still uses weights to approximate a gaussian convolution kernel. It just uses some special hardware to do less texture fetches. But that is a constant 2x improvement over the full 1D convolution, not the box filter O(1) approach that the article suggests that browsers are using.