-
-
Notifications
You must be signed in to change notification settings - Fork 886
Bokeh blur speedup and memory usage improvement #1058
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
Bokeh blur speedup and memory usage improvement #1058
Conversation
Updated master from SixLabors/ImageSharp
Master cleanup (#952)
Changes from master
Changes from master
Latest changes from official master
Changes from master
Codecov Report
@@ Coverage Diff @@
## master #1058 +/- ##
==========================================
+ Coverage 89.9% 89.91% +0.01%
==========================================
Files 1131 1131
Lines 50654 50605 -49
Branches 3717 3713 -4
==========================================
- Hits 45539 45502 -37
+ Misses 4357 4347 -10
+ Partials 758 756 -2
Continue to review full report at Codecov.
|
JimBobSquarePants
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Really nice optimization.
|
Wo-hooo! 😄🍻 |
Prerequisites
Description
This PR includes a refactoring of the bokeh blur effect, with a complete removal of the two "low memory usage" and "maximum performance" options, and a single implementation that is both faster than the previous "maximum performance", and uses less memory than the previous "low memory usage" mode. Basically, the best of both worlds, and even better than that! 🚀
Here's a benchmark with the 3 different modes. The images are of size 720, 1080 and 2160.
In particular:
ComplexVector4values, so that's a reduction ofsizeof(Vector4) 2 * imageHeight * imageWidthcompared to the "maximum performance" mode, and a reduction ofsizeof(Vector4) * 2 * kernelRadius * imageWidthcompared to the previous "low memory usage" mode. This is achieved by modifying the vertical convolution step so that the partial components of the fourier transformation for the bokeh kernels are directly added to the target processing buffer, which makes is possible to only use a temporary buffer for the results of the first horizontal 1D convolution pass.Parallel.Forinvocation on the entire image is not needed anymore. Additionally, this new implementation can always execute the code in parallel, unlike the previous "low memory usage" mode which was forced to execute the second 1D convolution sequentially, to be able to work on a shared buffer.@JimBobSquarePants @antonfirsov I think you'll be pretty happy with this new PR 😊
Also, please make sure that everything checks out on your end (all the checks are passing for me, so this should be easy to do) and merge this as soon as possible, since it includes a breaking change in a couple of exposed APIs, so it'd be better to do this while the lib is still in beta.