Re:The Magic Kernel
by johncostella on Monday March 22, 2021 @11:09PM
(#26550577)
Ah nice, I will correct that statement, which I was sure was bound to have a counterargument. :)
I see that now your page links to my comment, saying, "More efficient ways of performing Gaussian blur have been noted; the Magic Blur was convenient in that it made use of existing hardware libraries and calling code stack."
But in fact what I described above is the Magic Blur algorithm, just in a slightly different guise, and it can probably take advantage of existing hardware libraries in the same way. However, I don't know what your hardware libraries are doing in the blur case!
GCC unrolled the loop twice, so it was 34 instructions that processed two samples per iteration. The instructions are mostly things like this:
That should clarify a bit how one core of my mere 2.8GHz Core i7 is managing to run over ten billion instructions per second.Godbolt link for those who want to play: https://godbolt.org/z/MfEqYn3Pd
Gaussian blur gets used for this a lot precisely because it's so easy to compute this way — it's the only convolution kernel that's anisotropic and separable. So people press it into service doing things like camera bokeh that it's not really very good at.