Dirk Lemstra
4 years ago
No known key found for this signature in database
GPG Key ID: 40B84DE7D6271D30
6 changed files with
4 additions and
12 deletions
-
src/ImageSharp/Configuration.cs
-
src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Rgb24.PixelOperations.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Rgba32.PixelOperations.cs
-
src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs
-
tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs
|
|
|
@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp |
|
|
|
get => this.maxDegreeOfParallelism; |
|
|
|
set |
|
|
|
{ |
|
|
|
if (value == 0 || value < -1) |
|
|
|
if (value is 0 or < -1) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException(nameof(this.MaxDegreeOfParallelism)); |
|
|
|
} |
|
|
|
|
|
|
|
@ -155,12 +155,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder |
|
|
|
// pack pixels to a temporary, padded proxy buffer, then copy the relevant values to the destination row.
|
|
|
|
if (this.pixelBuffer.DangerousTryGetPaddedRowSpan(yy, 3, out Span<TPixel> destRow)) |
|
|
|
{ |
|
|
|
PixelOperations<TPixel>.Instance.PackFromRgbPlanes(this.configuration, r, g, b, destRow); |
|
|
|
PixelOperations<TPixel>.Instance.PackFromRgbPlanes(r, g, b, destRow); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Span<TPixel> proxyRow = this.paddedProxyPixelRow.GetSpan(); |
|
|
|
PixelOperations<TPixel>.Instance.PackFromRgbPlanes(this.configuration, r, g, b, proxyRow); |
|
|
|
PixelOperations<TPixel>.Instance.PackFromRgbPlanes(r, g, b, proxyRow); |
|
|
|
proxyRow[..width].CopyTo(this.pixelBuffer.DangerousGetRowSpan(yy)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -24,13 +24,11 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void PackFromRgbPlanes( |
|
|
|
Configuration configuration, |
|
|
|
ReadOnlySpan<byte> redChannel, |
|
|
|
ReadOnlySpan<byte> greenChannel, |
|
|
|
ReadOnlySpan<byte> blueChannel, |
|
|
|
Span<Rgb24> destination) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
int count = redChannel.Length; |
|
|
|
GuardPackFromRgbPlanes(greenChannel, blueChannel, destination, count); |
|
|
|
|
|
|
|
|
|
|
|
@ -59,13 +59,11 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void PackFromRgbPlanes( |
|
|
|
Configuration configuration, |
|
|
|
ReadOnlySpan<byte> redChannel, |
|
|
|
ReadOnlySpan<byte> greenChannel, |
|
|
|
ReadOnlySpan<byte> blueChannel, |
|
|
|
Span<Rgba32> destination) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
int count = redChannel.Length; |
|
|
|
GuardPackFromRgbPlanes(greenChannel, blueChannel, destination, count); |
|
|
|
|
|
|
|
|
|
|
|
@ -166,20 +166,16 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// Bulk operation that packs 3 seperate RGB channels to <paramref name="destination"/>.
|
|
|
|
/// The destination must have a padding of 3.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="configuration">A <see cref="Configuration"/> to configure internal operations.</param>
|
|
|
|
/// <param name="redChannel">A <see cref="ReadOnlySpan{T}"/> to the red values.</param>
|
|
|
|
/// <param name="greenChannel">A <see cref="ReadOnlySpan{T}"/> to the green values.</param>
|
|
|
|
/// <param name="blueChannel">A <see cref="ReadOnlySpan{T}"/> to the blue values.</param>
|
|
|
|
/// <param name="destination">A <see cref="Span{T}"/> to the destination pixels.</param>
|
|
|
|
internal virtual void PackFromRgbPlanes( |
|
|
|
Configuration configuration, |
|
|
|
ReadOnlySpan<byte> redChannel, |
|
|
|
ReadOnlySpan<byte> greenChannel, |
|
|
|
ReadOnlySpan<byte> blueChannel, |
|
|
|
Span<TPixel> destination) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
|
|
|
|
int count = redChannel.Length; |
|
|
|
GuardPackFromRgbPlanes(greenChannel, blueChannel, destination, count); |
|
|
|
|
|
|
|
|
|
|
|
@ -1057,7 +1057,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|
|
|
public void PackFromRgbPlanes(int count) |
|
|
|
=> SimdUtilsTests.TestPackFromRgbPlanes<TPixel>( |
|
|
|
count, |
|
|
|
(r, g, b, actual) => PixelOperations<TPixel>.Instance.PackFromRgbPlanes(this.Configuration, r, g, b, actual)); |
|
|
|
(r, g, b, actual) => PixelOperations<TPixel>.Instance.PackFromRgbPlanes(r, g, b, actual)); |
|
|
|
|
|
|
|
public delegate void RefAction<T1>(ref T1 arg1); |
|
|
|
|
|
|
|
|