Live data from Hacker News

Optimizing Gaussian blurs on a mobile GPU

sunsetlakesoftware.com

1–10 of 24 posts

Re: Optimizing Gaussian blurs on a mobile GPU

#2
In addition to what was already there, I'd suggest looking at trying to operate on the whole image at a time rather than pixel-by-pixel. To take a simple blur example, a blur that samples the local pixel at 50%, and each of the top, bottom, left, and right by 12.5% is equivalent to drawing the entire image half darkened, then drawing it in each of one pixel to the left, right, up, and down at 12.5% of the original brightness, merging additively. I don't know if this would be faster or not, you'd have to profile it, but I'd consider it worth a try.

Re: Optimizing Gaussian blurs on a mobile GPU

#3
Another opportunity for efficient blur would be to rescale the image if the blur radius is above a certain amount. This incurs overhead, so for smaller radii it might be more efficient to just blur the full-size image, but for larger radii you can first reduce the image, blur with a smaller radius, and then upscale the image.

You might need an Arbitrary Hack Constant (oh, sorry, "tuning parameter") to decide when to make that transition.

Re: Optimizing Gaussian blurs on a mobile GPU

#4
post #3

Another opportunity for efficient blur would be to rescale the image if the blur radius is above a certain amount. This incurs overhead, so for smaller radii it might be more efficient to just blur the full-size image, but for larger radii you can first reduce the image, blur with a smaller radius, and then upscale the image. You might need an Arbitrary Hack Constant (oh, sorry, "tuning parameter") to decide when to…

That's already in the article:

> Instead of filtering the image in its native resolution, I used OpenGL's native support for linear interpolation to downsample the source image by 4X in width and height, blurred that downsampled image, then linearly upsampled via OpenGL afterward.

Re: Optimizing Gaussian blurs on a mobile GPU

#5
I've done some research in doing live blurs and created my own hack solution [0]. The biggest bottleneck I've always seen people run into is doing the snapshot. Your solution looks really great, but I'm wondering how you would continuously snapshot the screen without running into issues? Or, have you found another solution.

Really great read!

[0]: http://whoisryannystrom.com/2013/09/17/Live-blur-in-iOS7/

Re: Optimizing Gaussian blurs on a mobile GPU

#10
post #3

Another opportunity for efficient blur would be to rescale the image if the blur radius is above a certain amount. This incurs overhead, so for smaller radii it might be more efficient to just blur the full-size image, but for larger radii you can first reduce the image, blur with a smaller radius, and then upscale the image. You might need an Arbitrary Hack Constant (oh, sorry, "tuning parameter") to decide when to…

That's already in the article: > Instead of filtering the image in its native resolution, I used OpenGL's native support for linear interpolation to downsample the source image by 4X in width and height, blurred that downsampled image, then linearly upsampled via OpenGL afterward.

Indeed it is, my bad for not RTFM
Post reply on HN