-
-
Couldn't load subscription status.
- Fork 888
Introduce extended pixel conversion #869
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
| /// knowing the pixel type. | ||
| /// </summary> | ||
| [Flags] | ||
| internal enum PixelConversionModifiers |
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.
Please review my namings here!
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.
Naming is good! 👍
Codecov Report
@@ Coverage Diff @@
## master #869 +/- ##
==========================================
- Coverage 88.89% 88.87% -0.02%
==========================================
Files 1014 1017 +3
Lines 44295 44438 +143
Branches 3209 3228 +19
==========================================
+ Hits 39376 39495 +119
+ Misses 4198 4181 -17
- Partials 721 762 +41
Continue to review full report at Codecov.
|
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 much, much, much prefer this approach to the tree of methods in my PR. Much easier for us to optimize single methods.
| PixelConversionModifiers conversionModifiers = PixelConversionModifiers.Premultiply; | ||
| if (this.Compand) | ||
| { | ||
| conversionModifiers |= PixelConversionModifiers.Scale | PixelConversionModifiers.SRgbCompand; |
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.
Maybe we could shortcut this? It's something to remember every time. (Unless that's a good thing for greater understanding?)
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 think we'll leave it as-is. It's explicit and should be well understood.
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.
Companding always indicates scaling (otherwise colors are incorrect), right?
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.
Yeah, the algorithm requires scaling.
| /// knowing the pixel type. | ||
| /// </summary> | ||
| [Flags] | ||
| internal enum PixelConversionModifiers |
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.
Naming is good! 👍
| internal static class PixelConversionModifiersExtensions | ||
| { | ||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static bool IsDefined(this PixelConversionModifiers modifiers, PixelConversionModifiers expected) => |
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.
Nice!
| /// <summary> | ||
| /// Select <see cref="IPixel.ToScaledVector4"/> and <see cref="IPixel.FromScaledVector4"/> instead the standard (non scaled) variants. | ||
| /// </summary> | ||
| Scale = 1 << 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.
@JimBobSquarePants I keep thinking whether we should replace Scaled / Scale with Normalized / Normalize in our terminology. Seems more precize to me. Or is this wrong thinking?
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.
Or is this wrong thinking?
Actually no. Normalization in our situation is exactly what we are doing and I think I prefer it!
It means breaking IPixel for consistency but you have my blessing to do so. I'd really like to ensure we have our naming correct for RC1.
|
I'm merging this now to unblock stuff like #870. Naming tweaks could be added in a follow-up PR. |
Prerequisites
Description
This is a replacement PR for #847 introducing extended bulk conversion controlled by flags.
Vector4buffers is destructive for performance, yet it's cleanRgb24andBgr24.