Browse Source

Clarified diff logs

pull/1694/head
Dmitry Pentin 5 years ago
parent
commit
0c78c67627
  1. 14
      tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs

14
tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs

@ -57,11 +57,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
using var bufferedStream = new BufferedReadStream(Configuration.Default, ms); using var bufferedStream = new BufferedReadStream(Configuration.Default, ms);
using Image<Rgba32> image = decoder.Decode<Rgba32>(bufferedStream, cancellationToken: default); using Image<Rgba32> image = decoder.Decode<Rgba32>(bufferedStream, cancellationToken: default);
// TODO: Fix this
var data = LibJpegTools.SpectralData.LoadFromImageSharpDecoder(decoder); var data = LibJpegTools.SpectralData.LoadFromImageSharpDecoder(decoder);
VerifyJpeg.SaveSpectralImage(provider, data); VerifyJpeg.SaveSpectralImage(provider, data);
} }
//[Theory(Skip = "Temporary skipped due to new decoder core architecture")]
[Theory] [Theory]
[WithFileCollection(nameof(AllTestJpegs), PixelTypes.Rgba32)] [WithFileCollection(nameof(AllTestJpegs), PixelTypes.Rgba32)]
public void VerifySpectralCorrectness<TPixel>(TestImageProvider<TPixel> provider) public void VerifySpectralCorrectness<TPixel>(TestImageProvider<TPixel> provider)
@ -116,11 +117,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
LibJpegTools.ComponentData libJpegComponent = libJpegData.Components[i]; LibJpegTools.ComponentData libJpegComponent = libJpegData.Components[i];
LibJpegTools.ComponentData imageSharpComponent = imageSharpData.Components[i]; LibJpegTools.ComponentData imageSharpComponent = imageSharpData.Components[i];
(double total, double average) diff = LibJpegTools.CalculateDifference(libJpegComponent, imageSharpComponent); (double total, double average) = LibJpegTools.CalculateDifference(libJpegComponent, imageSharpComponent);
this.Output.WriteLine($"Component{i}: {diff}"); this.Output.WriteLine($"Component{i}: [total: {total} | average: {average}]");
averageDifference += diff.average; averageDifference += average;
totalDifference += diff.total; totalDifference += total;
tolerance += libJpegComponent.SpectralBlocks.DangerousGetSingleSpan().Length; tolerance += libJpegComponent.SpectralBlocks.DangerousGetSingleSpan().Length;
} }
@ -173,13 +174,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
this.converter.ConvertStrideBaseline(); this.converter.ConvertStrideBaseline();
// This would be called only for baseline non-interleaved images // This would be called only for baseline non-interleaved images
// We must test spectral strides here // We must copy spectral strides here
LibJpegTools.ComponentData[] components = this.spectralData.Components; LibJpegTools.ComponentData[] components = this.spectralData.Components;
for (int i = 0; i < components.Length; i++) for (int i = 0; i < components.Length; i++)
{ {
components[i].LoadSpectralStride(this.frame.Components[i].SpectralBlocks, this.baselineScanRowCounter); components[i].LoadSpectralStride(this.frame.Components[i].SpectralBlocks, this.baselineScanRowCounter);
} }
this.baselineScanRowCounter++; this.baselineScanRowCounter++;
} }

Loading…
Cancel
Save