Browse Source

Add test case for tiled tiff, deflate compressed with predictor

pull/2878/head
Brian Popow 1 year ago
parent
commit
e186c52f32
  1. 3
      src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
  2. 1
      tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
  3. 1
      tests/ImageSharp.Tests/TestImages.cs
  4. 3
      tests/Images/Input/Tiff/tiled_rgba_deflate_compressed_predictor.tiff

3
src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs

@ -717,7 +717,8 @@ internal class TiffDecoderCore : ImageDecoderCore
// Undo the horziontal predictor for each tile row.
if (this.Predictor == TiffPredictor.Horizontal)
{
HorizontalPredictor.UndoRow(uncompressedPixelRow, tileLength, 0, this.ColorType);
int pixelsInTileRow = isLastHorizontalTile ? remainingPixelsInRow : tileLength;
HorizontalPredictor.UndoRow(uncompressedPixelRow, pixelsInTileRow, 0, this.ColorType);
}
tileBufferOffset += bytesPerTileRow;

1
tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs

@ -87,6 +87,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester
[WithFile(QuadTile, PixelTypes.Rgba32)]
[WithFile(TiledChunky, PixelTypes.Rgba32)]
[WithFile(TiledPlanar, PixelTypes.Rgba32)]
[WithFile(TiledDeflateCompressedWithPredictor, PixelTypes.Rgba32)]
public void TiffDecoder_CanDecode_Tiled<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);

1
tests/ImageSharp.Tests/TestImages.cs

@ -986,6 +986,7 @@ public static class TestImages
public const string QuadTile = "Tiff/quad-tile.tiff";
public const string TiledChunky = "Tiff/rgb_uncompressed_tiled_chunky.tiff";
public const string TiledPlanar = "Tiff/rgb_uncompressed_tiled_planar.tiff";
public const string TiledDeflateCompressedWithPredictor = "Tiff/tiled_rgba_deflate_compressed_predictor.tiff";
// Images with alpha channel.
public const string Rgba2BitUnassociatedAlpha = "Tiff/RgbaUnassociatedAlpha2bit.tiff";

3
tests/Images/Input/Tiff/tiled_rgba_deflate_compressed_predictor.tiff

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4f44a67086fafc1d8784922a491e0b944b4afcd09f14b66d951b042d2745e0c
size 166487
Loading…
Cancel
Save