Browse Source

Additional test cases for webp lossy images

pull/1552/head
Brian Popow 6 years ago
parent
commit
c32b3f716d
  1. 81
      tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs
  2. 31
      tests/ImageSharp.Tests/TestImages.cs

81
tests/ImageSharp.Tests/Formats/WebP/WebPDecoderTests.cs

@ -49,10 +49,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP
[WithFile(Lossy.NoFilter03, PixelTypes.Rgba32)] [WithFile(Lossy.NoFilter03, PixelTypes.Rgba32)]
[WithFile(Lossy.NoFilter04, PixelTypes.Rgba32)] [WithFile(Lossy.NoFilter04, PixelTypes.Rgba32)]
[WithFile(Lossy.NoFilter05, PixelTypes.Rgba32)] [WithFile(Lossy.NoFilter05, PixelTypes.Rgba32)]
[WithFile(Lossy.NoFilter06, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationNoFilter01, PixelTypes.Rgba32)]
[WithFile(Lossy.NoFilter07, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationNoFilter02, PixelTypes.Rgba32)]
[WithFile(Lossy.NoFilter08, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationNoFilter03, PixelTypes.Rgba32)]
[WithFile(Lossy.NoFilter09, PixelTypes.Rgba32)]
public void WebpDecoder_CanDecode_Lossy_WithoutFilter<TPixel>(TestImageProvider<TPixel> provider) public void WebpDecoder_CanDecode_Lossy_WithoutFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
@ -79,6 +78,29 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP
} }
} }
[Theory]
[WithFile(Lossy.IccpComplexFilter, PixelTypes.Rgba32)]
[WithFile(Lossy.VeryShort, PixelTypes.Rgba32)]
[WithFile(Lossy.BikeComplexFilter, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter01, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter02, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter03, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter04, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter05, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter06, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter07, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter08, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter09, PixelTypes.Rgba32)]
public void WebpDecoder_CanDecode_Lossy_WithComplexFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(WebpDecoder))
{
image.DebugSave(provider);
image.CompareToOriginal(provider, ReferenceDecoder);
}
}
[Theory] [Theory]
[WithFile(Lossy.Small01, PixelTypes.Rgba32)] [WithFile(Lossy.Small01, PixelTypes.Rgba32)]
[WithFile(Lossy.Small02, PixelTypes.Rgba32)] [WithFile(Lossy.Small02, PixelTypes.Rgba32)]
@ -95,17 +117,46 @@ namespace SixLabors.ImageSharp.Tests.Formats.WebP
} }
[Theory] [Theory]
[WithFile(Lossy.IccpComplexFilter, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationNoFilter04, PixelTypes.Rgba32)]
[WithFile(Lossy.VeryShort, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationNoFilter05, PixelTypes.Rgba32)]
[WithFile(Lossy.BikeComplexFilter, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationNoFilter06, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter01, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationComplexFilter01, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter02, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationComplexFilter02, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter03, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationComplexFilter03, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter04, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationComplexFilter04, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter05, PixelTypes.Rgba32)] [WithFile(Lossy.SegmentationComplexFilter05, PixelTypes.Rgba32)]
[WithFile(Lossy.ComplexFilter06, PixelTypes.Rgba32)] public void WebpDecoder_CanDecode_Lossy_WithPartitions<TPixel>(TestImageProvider<TPixel> provider)
[WithFile(Lossy.ComplexFilter07, PixelTypes.Rgba32)] where TPixel : struct, IPixel<TPixel>
public void WebpDecoder_CanDecode_Lossy_WithComplexFilter<TPixel>(TestImageProvider<TPixel> provider) {
using (Image<TPixel> image = provider.GetImage(WebpDecoder))
{
image.DebugSave(provider);
image.CompareToOriginal(provider, ReferenceDecoder);
}
}
[Theory]
[WithFile(Lossy.Partitions01, PixelTypes.Rgba32)]
[WithFile(Lossy.Partitions02, PixelTypes.Rgba32)]
[WithFile(Lossy.Partitions03, PixelTypes.Rgba32)]
public void WebpDecoder_CanDecode_Lossy_WithSegmentation<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage(WebpDecoder))
{
image.DebugSave(provider);
image.CompareToOriginal(provider, ReferenceDecoder);
}
}
[Theory]
[WithFile(Lossy.Sharpness01, PixelTypes.Rgba32)]
[WithFile(Lossy.Sharpness02, PixelTypes.Rgba32)]
[WithFile(Lossy.Sharpness03, PixelTypes.Rgba32)]
[WithFile(Lossy.Sharpness04, PixelTypes.Rgba32)]
[WithFile(Lossy.Sharpness05, PixelTypes.Rgba32)]
[WithFile(Lossy.Sharpness06, PixelTypes.Rgba32)]
public void WebpDecoder_CanDecode_Lossy_WithSharpnessLevel<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
using (Image<TPixel> image = provider.GetImage(WebpDecoder)) using (Image<TPixel> image = provider.GetImage(WebpDecoder))

31
tests/ImageSharp.Tests/TestImages.cs

@ -435,10 +435,7 @@ namespace SixLabors.ImageSharp.Tests
public const string NoFilter03 = "WebP/vp80-00-comprehensive-005.webp"; public const string NoFilter03 = "WebP/vp80-00-comprehensive-005.webp";
public const string NoFilter04 = "WebP/vp80-01-intra-1417.webp"; public const string NoFilter04 = "WebP/vp80-01-intra-1417.webp";
public const string NoFilter05 = "WebP/vp80-02-inter-1402.webp"; public const string NoFilter05 = "WebP/vp80-02-inter-1402.webp";
public const string NoFilter06 = "WebP/vp80-03-segmentation-1401.webp"; public const string NoFilter06 = "WebP/test.webp";
public const string NoFilter07 = "WebP/vp80-03-segmentation-1403.webp";
public const string NoFilter08 = "WebP/vp80-03-segmentation-1407.webp";
public const string NoFilter09 = "WebP/test.webp";
// Lossy images with a simple filter. // Lossy images with a simple filter.
public const string SimpleFilter01 = "WebP/segment01.webp"; public const string SimpleFilter01 = "WebP/segment01.webp";
@ -461,6 +458,32 @@ namespace SixLabors.ImageSharp.Tests
public const string ComplexFilter08 = "WebP/vp80-00-comprehensive-016.webp"; public const string ComplexFilter08 = "WebP/vp80-00-comprehensive-016.webp";
public const string ComplexFilter09 = "WebP/vp80-00-comprehensive-017.webp"; public const string ComplexFilter09 = "WebP/vp80-00-comprehensive-017.webp";
// Lossy with partitions.
public const string Partitions01 = "WebP/vp80-04-partitions-1404.webp";
public const string Partitions02 = "WebP/vp80-04-partitions-1405.webp";
public const string Partitions03 = "WebP/vp80-04-partitions-1406.webp";
// Lossy with segmentation.
public const string SegmentationNoFilter01 = "WebP/vp80-03-segmentation-1401.webp";
public const string SegmentationNoFilter02 = "WebP/vp80-03-segmentation-1403.webp";
public const string SegmentationNoFilter03 = "WebP/vp80-03-segmentation-1407.webp";
public const string SegmentationNoFilter04 = "WebP/vp80-03-segmentation-1408.webp";
public const string SegmentationNoFilter05 = "WebP/vp80-03-segmentation-1409.webp";
public const string SegmentationNoFilter06 = "WebP/vp80-03-segmentation-1410.webp";
public const string SegmentationComplexFilter01 = "WebP/vp80-03-segmentation-1413.webp";
public const string SegmentationComplexFilter02 = "WebP/vp80-03-segmentation-1425.webp";
public const string SegmentationComplexFilter03 = "WebP/vp80-03-segmentation-1426.webp";
public const string SegmentationComplexFilter04 = "WebP/vp80-03-segmentation-1427.webp";
public const string SegmentationComplexFilter05 = "WebP/vp80-03-segmentation-1432.webp";
// Lossy with sharpness level.
public const string Sharpness01 = "WebP/vp80-05-sharpness-1428.webp";
public const string Sharpness02 = "WebP/vp80-05-sharpness-1429.webp";
public const string Sharpness03 = "WebP/vp80-05-sharpness-1430.webp";
public const string Sharpness04 = "WebP/vp80-05-sharpness-1431.webp";
public const string Sharpness05 = "WebP/vp80-05-sharpness-1433.webp";
public const string Sharpness06 = "WebP/vp80-05-sharpness-1434.webp";
// Very small images (all with complex filter). // Very small images (all with complex filter).
public const string Small01 = "WebP/small_13x1.webp"; public const string Small01 = "WebP/small_13x1.webp";
public const string Small02 = "WebP/small_1x1.webp"; public const string Small02 = "WebP/small_1x1.webp";

Loading…
Cancel
Save