Question

We found out that run length is much better than huffman coding (JAVA) considering compression ratio. Is it true for all cases?

Was it helpful?

Solution

Of course not. Consider ABABABAB, it will compress better with huffman than run-length encoding.

Run length will only work for data that have repeated values; that's not guaranteed in images.

OTHER TIPS

RLE generally works well for things like charts and graphs that have large areas of identical colors.

It tends to work poorly (often causes expansion) for things like photographs that almost always exhibit at least minor differences between pixels, even in areas that look like a solid color.

Although the same general idea tends to apply to Huffman as well, it tends to work better across a wider variety of inputs. In theory it can cause expansion as well, but about the only times I've seen that happen was trying to use it on data that was already compressed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top