Skip to content

Component shuffling for RGB(A)-like formats with SIMD Intrinsics #1354

@antonfirsov

Description

@antonfirsov

We need cheap bulk-conversion between the following formats:
Argb32, Bgra32, Rgba32, Bgr24, Rgb24

We are especially interested in Rgb24, Bgr24 <=> Rgba32. I'm having sweat dreams about a community PR dealing with this problem. Should be easy for anyone having basic knowledge of System.Runtime.Intrinsics.

Implementation should be added to new span-based methods in PixelConverter.cs, those could be invoked than from T4 generated PixelOperations<TPixel> implementors like here:
https://github.com/SixLabors/ImageSharp/blob/78a584e8482b052d7a9885682299e2f37518d83d/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.cs

If a PR would only add the PixelConverter helpers + tests, I'm happy to provide guidance or even finish the code for the rest of the work.

@john-h-k @Sergio0694 any chance you are interested?

Tasks:

  • Add 4=>4 channel shuffling methods to SimdUtils
  • Add 3=>4 channel shuffling methods to SimdUtils
  • Add 4=>3 channel shuffling methods to SimdUtils
  • Update Rgba32 compatible pixel operations to utilize new shuffle methods.
  • Update Rgb24 compatible pixel operations to utilize new shuffle methods.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions