Session
Compression Crash Course
Have you ever zipped a 10KB file down to only 6KB, and wondered what happened to the other 4KB?
How is it that we can make up that 4KB correctly using compression?
The concept of compression is really simple, it boils down to not having to write out the 5-letter word "seven", but instead use the single character "7" which is 4 letters shorter...4 letters that we don't have to send as data.
The generalized approach to data is what makes it more difficult to understand, so today I will explain compression from the ground up with some interactive examples:
https://blaarkies.com/
In any long piece of text, there is probably some repetition of words. We could replace these words with short codes, a sequence of characters that will never appear in normal text. We also need to tell the other party which short code corresponds to which actual word. With this information, we can send less data in total, and have the other party just replace the short codes with the actual words, thus getting the full message as intended.
Using a similar approach, we can add compression to documents that are saved as images. Since we have many white pixels in horizontal lines, we could replace them all with a shorter code that describes the colour, and also the number of pixels that are repeated. The other party will use this information to build the original image, even if only non-complete parts of the image were originally sent.
There is however much more compression to be achieved. For one, we save every character as an 8-bit value which we use as a lookup on a ASCII table to find the character. This 8-bit value allows for 256 different characters, yet we most often don't use that many different characters. We have 26 lowercase Latin alphabet characters, and 26 uppercase ones, and also the 10 digits. This counts up to 62 characters. The problem with the 8-bit value is that it does not store information densely in this example.

Pierre Roux
Entelect Software, Intermediate Software Engineer
Pretoria, South Africa
Links
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top