This is what run-length encoding requires. Correspondingly, delta encoding followed by Huffman and/or run-length encoding is a common strategy for compressing signals. LZW compression is named after ...
A lossless compression algorithm based on the LZW with compression ratios of 50 ? 60%, using 2K of RAM and 80% or more with 8K or 16K.