Browse Source
Use ReadOnlySpan
Co-authored-by: Günther Foidl <gue@korporal.at>
pull/1799/head
Brian Popow
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
2 deletions
-
src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs
-
src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs
|
|
|
@ -17,7 +17,8 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless |
|
|
|
/// </summary>
|
|
|
|
internal static unsafe class PredictorEncoder |
|
|
|
{ |
|
|
|
private static readonly sbyte[] DeltaLut = { 16, 16, 8, 4, 2, 2, 2 }; |
|
|
|
// This uses C#'s compiler optimization to refer to assembly's static data directly.
|
|
|
|
private static ReadOnlySpan<sbyte> DeltaLut => new sbyte[] { 16, 16, 8, 4, 2, 2, 2 }; |
|
|
|
|
|
|
|
private static readonly sbyte[][] Offset = |
|
|
|
{ |
|
|
|
|
|
|
|
@ -85,7 +85,8 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless |
|
|
|
|
|
|
|
private const int PaletteInvSize = 1 << PaletteInvSizeBits; |
|
|
|
|
|
|
|
private static readonly byte[] Order = { 1, 2, 0, 3 }; |
|
|
|
// This uses C#'s compiler optimization to refer to assembly's static data directly.
|
|
|
|
private static ReadOnlySpan<byte> Order => new byte[] { 1, 2, 0, 3 }; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="Vp8LEncoder"/> class.
|
|
|
|
|