What’s Compression?
Monday January 05th 2009, 4:05 pm
Filed under: Concepts

My tutorial What’s 24-bit Color? explains how a computer draws an image, by flipping billions of microscopic switches. Compression, in a nutshell, means a way to flip fewer switches but get the same, or approximately the same, result.

Your average digital still camera, for instance, automatically compresses the images it shoots. Without compression, you would need to flip about 150 million switches on your memory card to save a six-megapixel photo. But the camera feeds numbers representing the image’s grid of colored dots through a series of equations, and comes up with a way to save your photograph using perhaps only 20 or 25 million switches. That means the final file takes up less space on your memory card–and if the math is clever enough, your eye might not be able to see any difference between it and the original.

If you’re interested in learning more, AVPreserve has a detailed description of this process. But for a useful everyday analogy, just look at a page of sheet music:

See the repeat signs–those heavy vertical black lines with pairs of dots?

Before printing, when music was all copied by hand, composers invented a number of special instructions to save the copyists time. The repeat sign is one of these. The composer figures out which parts of the piece repeat themselves, and replaces them with a repeat sign that takes up much less space on the page. Here, a piece of music taking up two pages is reduced to one. If all the repeat signs were taken out, it would look something like this:

And that’s pretty much how the simplest kinds of compression work–millions, billions, and trillions of times over. For an explanation of more complex approaches, like H.264, see here.

Comments Off on What’s Compression?