Browse Source

Use magick Reference decoder

pull/3096/head
Brian Popow 2 months ago
parent
commit
d409a3b7d3
  1. 3
      src/ImageSharp/Formats/Exr/Compression/Compressors/ZipExrCompressor.cs
  2. 2
      src/ImageSharp/Formats/Exr/ExrDecoderCore.cs
  3. 6
      tests/ImageSharp.Tests/Formats/Exr/ExrEncoderTests.cs

3
src/ImageSharp/Formats/Exr/Compression/Compressors/ZipExrCompressor.cs

@ -11,7 +11,7 @@ internal class ZipExrCompressor : ExrBaseCompressor
{
private readonly DeflateCompressionLevel compressionLevel;
private readonly MemoryStream memoryStream = new();
private readonly MemoryStream memoryStream;
private readonly System.Buffers.IMemoryOwner<byte> buffer;
@ -20,6 +20,7 @@ internal class ZipExrCompressor : ExrBaseCompressor
{
this.compressionLevel = compressionLevel;
this.buffer = allocator.Allocate<byte>((int)bytesPerBlock);
this.memoryStream = new();
}
/// <inheritdoc/>

2
src/ImageSharp/Formats/Exr/ExrDecoderCore.cs

@ -53,7 +53,7 @@ internal sealed class ExrDecoderCore : ImageDecoderCore
: base(options.GeneralOptions)
{
this.configuration = options.GeneralOptions.Configuration;
this.memoryAllocator = this.configuration.MemoryAllocator;
this.memoryAllocator = this.configuration.MemoryAllocator;
}
/// <summary>

6
tests/ImageSharp.Tests/Formats/Exr/ExrEncoderTests.cs

@ -19,17 +19,17 @@ public class ExrEncoderTests
[Theory]
[WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)]
public void ExrEncoder_WithNoCompression_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestExrEncoderCore(provider, "NoCompression", compression: ExrCompression.None, imageDecoder: ExrDecoder.Instance);
where TPixel : unmanaged, IPixel<TPixel> => TestExrEncoderCore(provider, "NoCompression", compression: ExrCompression.None);
[Theory]
[WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)]
public void ExrEncoder_WithZipCompression_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestExrEncoderCore(provider, "ZipCompression", compression: ExrCompression.Zip, imageDecoder: ExrDecoder.Instance);
where TPixel : unmanaged, IPixel<TPixel> => TestExrEncoderCore(provider, "ZipCompression", compression: ExrCompression.Zip);
[Theory]
[WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)]
public void ExrEncoder_WithZipsCompression_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestExrEncoderCore(provider, "ZipsCompression", compression: ExrCompression.Zips, imageDecoder: ExrDecoder.Instance);
where TPixel : unmanaged, IPixel<TPixel> => TestExrEncoderCore(provider, "ZipsCompression", compression: ExrCompression.Zips);
protected static void TestExrEncoderCore<TPixel>(
TestImageProvider<TPixel> provider,

Loading…
Cancel
Save