Add AVX version of CollectColorBlueTransforms and CollectColorRedTransforms#1824
Add AVX version of CollectColorBlueTransforms and CollectColorRedTransforms#1824JimBobSquarePants merged 12 commits intomasterfrom
Conversation
|
The AVX version does not produce the same results as the SSE41 version. Can't tell why that is so far, both versions look the same. edit: I am guessing somethings wrong with the shuffle masks. |
|
@brianpopow I’ll try and have a look later. Are the masks a byte? If so there’s a method in the source MMShuffle you could use to compare to. |
The masks are explicitly defined following the pattern from SSE41: Mask Maybe it was naive from me to assume, I could just use the same pattern as in SSE41. This time there is no reference in I was testing it with simple test pattern images, like only red, only blue, only green images and it seems to work, but not with more complex examples: See the failing |
|
@brianpopow my recommendation is to extract the AVX, the SSE and the scalar path to separate unit-testable methods and debug them side-by side to spot the issue. |
|
Ah right, my bad. My input was in byte ranges. Looks to me like you're not crossing the boundaries properly.
private static readonly Vector256<byte> CollectColorBlueTransformsShuffleLowMask256 = Vector256.Create(255, 2, 255, 6, 255, 10, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 18, 255, 22, 255, 26, 255, 30, 255, 255, 255, 255, 255, 255, 255, 255);
private static readonly Vector256<byte> CollectColorBlueTransformsShuffleHighMask256 = Vector256.Create(255, 255, 255, 255, 255, 255, 255, 255, 255, 2, 255, 6, 255, 10, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 18, 255, 22, 255, 26, 255, 30); |
Codecov Report
@@ Coverage Diff @@
## master #1824 +/- ##
=======================================
- Coverage 87% 87% -1%
=======================================
Files 936 937 +1
Lines 48320 48385 +65
Branches 6038 6048 +10
=======================================
- Hits 42225 42185 -40
- Misses 5094 5194 +100
- Partials 1001 1006 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@brianpopow I updated the masks for you and everything is passing now. I won't approve/merge yet until you're happy that you've covered everything you need to. |
Awesome, thanks for your help! I think Anton is right. The color transform methods are not easily unit testable. I want to do a favor to "future me" and separate them into a own class. |
|
I think this is now ready for a final review |
src/ImageSharp/Formats/Webp/Lossless/ColorSpaceTransformUtils.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Formats/Webp/Lossless/ColorSpaceTransformUtils.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Formats/Webp/Lossless/ColorSpaceTransformUtils.cs
Outdated
Show resolved
Hide resolved
src/ImageSharp/Formats/Webp/Lossless/ColorSpaceTransformUtils.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Günther Foidl <gue@korporal.at>



Prerequisites
Description
This PR adds a AVX version of CollectColorBlueTransforms and CollectColorRedTransforms, which is used during encoding of lossless webp images.
Related to: #1786
TODO:
- There are still 2 failing tests.Fixed by @JimBobSquarePants with 55f04f6Profiling results with test image:
Images\Input\Webp\earth_lossless.webp:Master
PR