You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I am running the latest version of ImageSharp
I have searched open and closed issues to ensure it has not already been reported
Description
This issue has been opened to track and discuss perf improvements that could be made to ResizeProcessor:
Use PinnedBuffer<Vector4> for firstPassPixels and utilize bulk conversion
Apply microoptimizations to ResamplingWeightedProcessor<TColor>.Weights to make it more cache friendly
Investigate possibilities to reduce the size of resampler windows without loss of quality.
Operate on a transposed variant of firstPassPixels to utilize BulkPixelOperations<TColor>.PackFromVector4().
Drop repetitive weight values in WeightsBuffer
Use Value Type Kernels as Weights windows
Investigate possibilities for faster Compress and Expand execution to speedup the Compand variant.
Update
After analyzing the precomputed weights data, I found out the windows are much smaller than I thought (I misread the code first time), so we can not reduce the window size.
However:
This is how the WeightsBuffer looks like with a Bicubic 500->200 resize operation. 90% of the data is repetitive. We can allocate + precalculate less!
The size of IResampler.Radius is known at compile time for each reasmpler. It means we can achieve significant improvements by utilizing Value Type Kernels. (See Proposal: Value Type Kernels #142)
Reacted by Steffen Habermehl, Pete and Jarrod Alexander
Completed the first 2 points in #141 resulting in a 30% drop in execution time. Switching to a Vector4 -based pixeltype could bring in additional 10% or more for the non-compand case because of the faster bulk-conversions.
I'm not planning to touch the others before the beta. Anyone who has interest: feel free to contribute or write your suggestions :)
Activity
antonfirsov commentedon Mar 21, 2017
Completed the first 2 points in #141 resulting in a 30% drop in execution time. Switching to a
Vector4-based pixeltype could bring in additional 10% or more for the non-compand case because of the faster bulk-conversions.I'm not planning to touch the others before the beta. Anyone who has interest: feel free to contribute or write your suggestions :)
JimBobSquarePants commentedon Mar 22, 2017
Thanks for working on this. It's great improvement. 💯
JimBobSquarePants commentedon Apr 26, 2019
Closing. We've come a long way since this was opened. And with #888 we've dramatically reduced memory pressure.
Any further changes can be opened as individual issues.