• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How does compression work?

Stiganator

Platinum Member
Guys, can anyone explain to me how compression of data works. IE zip, winace, etc. I was wondering if I could make something similar with a C++ compiler.
 
zip, winace, rar, etc. are lossless compression schemes. What you put in and get out are the same, unlike mpeg and jpeg which is lossy since information is thrown away to reduce size. Lossless compression depends and the fact that most data is not totally random. The lower the entropy of the data the better the compression can posssibly be. These compression schemes use techniques to compress the data based on similar chunks occuring throughout the data. Most are based on some form of LZ.

If you want to start messing around with compression, you should probably start with simple algorithms like run length encoding (which fax machines use a form of) or Huffman coding. Reading up on some information theory and coding theory works might also be good.
 
The zip algorithm is also known as Lempel-Ziv compression, here is an explanation. I think you can easily make something similar in C++ if you understand what is going on.

Lossy video compression records a whole frame in a compressed picture format (gif, jpg, proprietary), then for the next x frames records the difference between the previous and current frame. I don't know how lossy audio compression works, but I think it just loses some "unimportant" frequency info.
 
Back
Top