Skip to content

Conversation

@JimBobSquarePants
Copy link
Member

@JimBobSquarePants JimBobSquarePants commented Feb 13, 2020

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Very simple PR. Refactors the WuFrameQuantizer<TPixel> to us a single pooled buffer instead of many. Makes code much easier to follow, improves performance, and reduces GC pressure.

@codecov
Copy link

codecov bot commented Feb 13, 2020

Codecov Report

Merging #1112 into master will increase coverage by <.01%.
The diff coverage is 94.27%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1112      +/-   ##
=========================================
+ Coverage      82%     82%   +<.01%     
=========================================
  Files         701     700       -1     
  Lines       28756   28797      +41     
  Branches     3273    3281       +8     
=========================================
+ Hits        23580   23616      +36     
- Misses       4492    4498       +6     
+ Partials      684     683       -1
Flag Coverage Δ
#unittests 82% <94.27%> (ø) ⬆️
Impacted Files Coverage Δ
...lFormats/Utils/Vector4Converters.RgbaCompatible.cs 91.42% <ø> (ø) ⬆️
src/ImageSharp/Primitives/Rectangle.cs 95% <ø> (ø) ⬆️
...c/ImageSharp/Advanced/ParallelExecutionSettings.cs 100% <ø> (ø) ⬆️
...ageSharp/Common/Extensions/EnumerableExtensions.cs 83.33% <ø> (ø) ⬆️
...ng/Processors/Transforms/Resize/ResizeKernelMap.cs 95.78% <ø> (ø) ⬆️
...ssing/Processors/Transforms/Resize/ResizeWorker.cs 98.7% <ø> (ø) ⬆️
...ocessors/Quantization/QuantizeProcessor{TPixel}.cs 0% <0%> (ø) ⬆️
...ing/Processors/Transforms/CropProcessor{TPixel}.cs 100% <100%> (ø) ⬆️
...ors/Convolution/EdgeDetector2DProcessor{TPixel}.cs 100% <100%> (ø) ⬆️
...ssors/Overlays/BackgroundColorProcessor{TPixel}.cs 100% <100%> (ø) ⬆️
... and 52 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acfe863...cb61820. Read the comment docs.

@JimBobSquarePants JimBobSquarePants merged commit f975498 into master Feb 14, 2020
@JimBobSquarePants JimBobSquarePants deleted the js/wu-color-moment branch February 14, 2020 05:57
Moment moment = Volume(ref this.colorCube[k], momentsSpan);

if (MathF.Abs(weight) > Constants.Epsilon)
if (moment.Weight > 0)
Copy link
Member

@antonfirsov antonfirsov Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the algorithm, but removing Epsilon changes behavior a bit. Are there any corner cases where this may have an impact?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None that I could find or test. I know the algorithm pretty well now and the epsilons were actually added as part of some bad design from me in the past. Weight should be a long.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! If the struct is uniform (all members Int64), it opens up nice SIMD optimization opportunities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants