-
-
Notifications
You must be signed in to change notification settings - Fork 888
Use Moment struct in WuQuantizer. #1112
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
| Moment moment = Volume(ref this.colorCube[k], momentsSpan); | ||
|
|
||
| if (MathF.Abs(weight) > Constants.Epsilon) | ||
| if (moment.Weight > 0) |
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.
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?
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.
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.
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.
Cool! If the struct is uniform (all members Int64), it opens up nice SIMD optimization opportunities.
Prerequisites
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.