Skip to content
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

Add Abgr32 pixel type, extend IPixel<T> #1886

Merged
merged 12 commits into from
Dec 18, 2021

Conversation

ynse01
Copy link
Contributor

@ynse01 ynse01 commented Dec 10, 2021

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 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

This adds the Abgr32 Pixel Format, as described in issue #1345.

For most of its implementation, I took inspiration from the Bgra32 pixel format code. It includes the SIMD conversions to other RGB based formats, so conversion performance should be pretty good.

I also fixed, what I think is a bug, in IComponentShuffle. Please check if my understanding of byte shuffling is correct.

I've not added Benchmarks, as there weren't any for Bgra32 also. I expect the performance will be similar to the other RGBA Pixel Formats. Let me know if you want me to add benchmarks.

@brianpopow
Copy link
Collaborator

@antonfirsov there seem to be failing tests on macos, which may be related to #1730, could you take a look at this: Failing Tests

@brianpopow brianpopow mentioned this pull request Dec 10, 2021
4 tasks
src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs Outdated Show resolved Hide resolved
src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs Outdated Show resolved Hide resolved
src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs Outdated Show resolved Hide resolved
/// <summary>
/// Provides optimized overrides for bulk operations.
/// </summary>
internal partial class PixelOperations : PixelOperations<Abgr32>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be sealed?
Sealing would open the door in the JIT to allow de-virtualization, especially with dynamic profile guided optimizaiton (D-PGO).

.gitattributes Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 12, 2021

Codecov Report

Merging #1886 (a94b8c4) into master (ecd3db2) will increase coverage by 0%.
The diff coverage is 96%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #1886    +/-   ##
=======================================
  Coverage      87%     87%            
=======================================
  Files         957     960     +3     
  Lines       50474   50972   +498     
  Branches     6291    6310    +19     
=======================================
+ Hits        44252   44731   +479     
- Misses       5185    5202    +17     
- Partials     1037    1039     +2     
Flag Coverage Δ
unittests 87% <96%> (+<1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/ImageSharp/Color/Color.Conversions.cs 66% <50%> (-3%) ⬇️
...eSharp/PixelFormats/PixelImplementations/Abgr32.cs 86% <86%> (ø)
src/ImageSharp/Common/Helpers/Numerics.cs 97% <100%> (+<1%) ⬆️
...eSharp/Common/Helpers/Shuffle/IComponentShuffle.cs 100% <100%> (ø)
...ImageSharp/PixelFormats/PixelImplementations/A8.cs 90% <100%> (+<1%) ⬆️
...eSharp/PixelFormats/PixelImplementations/Argb32.cs 90% <100%> (+<1%) ⬆️
...geSharp/PixelFormats/PixelImplementations/Bgr24.cs 95% <100%> (+<1%) ⬆️
...eSharp/PixelFormats/PixelImplementations/Bgr565.cs 85% <100%> (+<1%) ⬆️
...eSharp/PixelFormats/PixelImplementations/Bgra32.cs 95% <100%> (+<1%) ⬆️
...harp/PixelFormats/PixelImplementations/Bgra4444.cs 84% <100%> (+<1%) ⬆️
... and 38 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 ecd3db2...a94b8c4. Read the comment docs.

@antonfirsov antonfirsov added API breaking Signifies a binary breaking change. labels Dec 17, 2021
antonfirsov
antonfirsov previously approved these changes Dec 17, 2021
Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

This is a breaking change due to IPixel<T> interface extension.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

Nevermind, all good.

@JimBobSquarePants JimBobSquarePants merged commit 5e060ba into SixLabors:master Dec 18, 2021
@ynse01 ynse01 mentioned this pull request Jan 3, 2022
@antonfirsov antonfirsov changed the title Add Abgr32 pixel type Add Abgr32 pixel type, extend IPixel<T> Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API area:pixelformats breaking Signifies a binary breaking change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants