<PackageReference Include="System.Drawing.Common" Version="9.0.0-rc.1.24451.1" />

RunLengthEncoder

static class RunLengthEncoder
Simple run length encoder (RLE) that works on spans.
public static int GetDecodedLength(ReadOnlySpan<byte> encoded)

Get the decoded length, in bytes, of the given encoded data.

public static int GetEncodedLength(ReadOnlySpan<byte> data)

Get the encoded length, in bytes, of the given data.

public static bool TryDecode(ReadOnlySpan<byte> encoded, Span<byte> data, out int written)

public static bool TryEncode(ReadOnlySpan<byte> data, Span<byte> encoded, out int written)

Encode the given data into the given encoded span.