Browse Source
Merge branch 'master' into bp/dofiltersse2
pull/1871/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
20 additions and
2 deletions
-
src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs
-
tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs
|
|
|
@ -192,7 +192,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless |
|
|
|
public bool UseCrossColorTransform { get; set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets a value indicating whether to use the substract green transform.
|
|
|
|
/// Gets or sets a value indicating whether to use the subtract green transform.
|
|
|
|
/// </summary>
|
|
|
|
public bool UseSubtractGreenTransform { get; set; } |
|
|
|
|
|
|
|
@ -1049,7 +1049,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless |
|
|
|
return EntropyIx.Palette; |
|
|
|
} |
|
|
|
|
|
|
|
using IMemoryOwner<uint> histoBuffer = this.memoryAllocator.Allocate<uint>((int)HistoIx.HistoTotal * 256); |
|
|
|
using IMemoryOwner<uint> histoBuffer = this.memoryAllocator.Allocate<uint>((int)HistoIx.HistoTotal * 256, AllocationOptions.Clean); |
|
|
|
Span<uint> histo = histoBuffer.Memory.Span; |
|
|
|
uint pixPrev = bgra[0]; // Skip the first pixel.
|
|
|
|
ReadOnlySpan<uint> prevRow = null; |
|
|
|
|
|
|
|
@ -101,6 +101,24 @@ namespace SixLabors.ImageSharp.Tests.Formats.Webp |
|
|
|
image.VerifyEncoder(provider, "webp", testOutputDetails, encoder); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Lossy.NoFilter06, PixelTypes.Rgba32, 15114)] |
|
|
|
public void Encode_Lossless_WithBestQuality_HasExpectedSize<TPixel>(TestImageProvider<TPixel> provider, int expectedBytes) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
var encoder = new WebpEncoder() |
|
|
|
{ |
|
|
|
FileFormat = WebpFileFormatType.Lossless, |
|
|
|
Method = WebpEncodingMethod.BestQuality |
|
|
|
}; |
|
|
|
|
|
|
|
using Image<TPixel> image = provider.GetImage(); |
|
|
|
using var memoryStream = new MemoryStream(); |
|
|
|
image.Save(memoryStream, encoder); |
|
|
|
|
|
|
|
Assert.Equal(memoryStream.Length, expectedBytes); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(RgbTestPattern100x100, PixelTypes.Rgba32, 85)] |
|
|
|
[WithFile(RgbTestPattern100x100, PixelTypes.Rgba32, 60)] |
|
|
|
|