Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gaussian blur #2388

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Gaussian blur #2388

wants to merge 10 commits into from

Conversation

awxkee
Copy link
Contributor

@awxkee awxkee commented Dec 3, 2024

This is some initial implementation of gaussian blur, at the moment, it is more too have a look rather than merge.
This implementation is ~x20+ faster than current, faster than fast blur until radius goes reasonable huge (~50+) and will be probably faster than any other blur implementation (stack blur etc ) on low radius, with rayon it should even more effective, parallelization level of this algorithm is very high.

Here is some concerns:

- Old implementation considers sigma something different, more like radius base instead of flattening level
- I'm not sure how to handle GenericImageView without explicit going unsafe; and even with unsafe I'm not sure I know best way to get direct typed buffer without copying.

  • Loops are hardly unrolled what is not common practice in this crate, and this is important.
  • This unrolling not really good adopted for x86 with low registers bank.
  • Loops unrolled in current implementation with target u8 storage type in mind, for other types performance variance is higher
  • It is named filter_1d, but at the moment only kernels with symmetry is handled properly. Are there some point to finalize it?
  • This algorithm requires more memory than previous
  • Some beautiful types as ColorGroup also is not common practice in this crate

@awxkee awxkee marked this pull request as ready for review December 5, 2024 10:09
@awxkee
Copy link
Contributor Author

awxkee commented Dec 17, 2024

I think this is ready at most.
I modified sigma to follow previous implementation, but it was incorrect, thus on higher radii it produces notable ringing and aliasing. This is unavoidable without breaking compatibiltiy with previous implementation.

output

Here is blurred image without ringing and aliasing:

without_ringing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant