owenthewizard / i3lockr

Distort a screenshot and run i3lock
Other
23 stars 6 forks source link

Implement Stackblur in Rust #13

Closed owenthewizard closed 2 years ago

owenthewizard commented 5 years ago

Ideally the blur routine would be in Rust and multithreaded. Currently it is written in C. Possible algorithms are "fastest guardian blur (O(n))"[1], and "stackblur"[2]

1: http://blog.ivank.net/fastest-gaussian-blur.html 2: https://github.com/Quasimondo/QuasimondoJS/blob/master/blur/stackblur.pdf

takase1121 commented 4 years ago

There is an implementation of 1. in pure rust AFAIK: https://github.com/fschutt/fastblur

Hope this helps.

takase1121 commented 4 years ago

Follow up to my previous comment, there seems to be an improved version of the blur algorithm in resvg. This might help too.

owenthewizard commented 3 years ago

I got fastblur to work but it's pretty slow. Probably because it's unoptimized and does a lot of allocations. I'm thinking stackblur would be better, it can be done in-place with just a small (kernel * pixel size) additional buffer allocated.

I've tried to implement stackblur in Rust several times but I haven't been successful yet 😞 .

owenthewizard commented 3 years ago

I finally got stackblur implemented. Soon I'll get it up to snuff with the current C version, stabilized, and then used with i3lockr.

owenthewizard commented 2 years ago

Better implementation: https://github.com/LoganDark/stackblur-iter