// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.IO; using System.Runtime.CompilerServices; namespace SixLabors.ImageSharp.Formats.Tiff { /// /// Class to handle cases where TIFF image data is compressed using LZW compression. /// internal static class LzwTiffCompression { /// /// Decompresses image data into the supplied buffer. /// /// The to read image data from. /// The number of bytes to read from the input stream. /// The output buffer for uncompressed data. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Decompress(Stream stream, int byteCount, byte[] buffer) { SubStream subStream = new SubStream(stream, byteCount); using (var decoder = new TiffLzwDecoder(subStream)) { decoder.DecodePixels(buffer.Length, 8, buffer); } } } }