🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Improving Huffman compression ratio

Started by
2 comments, last by Odiseo 24 years, 5 months ago
I understand very well the Huffman encoding algorithm and I am using it to compress the data in my game, but its compression ratio seems too bad for me. What can I do to improve the compression ratio? To compress the data I get the full data buffer and calculate the Huffman tree from it. Is it better to take portions of the buffer and encode them separately? Thanks in advance!
Advertisement
Take a look at the lzhuffman algorithm. I recall attaining quite good compression ratios with it. Im not sure at what speed it was performing at though.

Edited by - staffan on 1/20/00 4:57:18 PM
I remember reading a book that explains adaptive huffman encoding that achieves good compression rates. Try doing a search on that.

In essence, it basically started with a table that had no entries, and as you add entries, the bit codes may change to allow for weight differences in the tree.

Jim
How large in bit-size are the pieces you''re trying to huffman encode? Are you putting in 8 bit or 16 bit pieces? Sometimes a encoding smaller chunks can improve compression ratio. Sometimes larger chunks improve the compression. For giggles you might try 6 bits a chunk. Or 12 bits. I recommend sticking with even bit sizes as that tends to optimize compression on existing regularity in the data. Maybe performing an RLE on the data first?
Just odd thoughts off the top of my head.

This topic is closed to new replies.

Advertisement