Differential Coding

From MultimediaWiki
Jump to: navigation, search

Differential coding explained:

1 + 1 = 2

Got that?

Some people like to over-explain things in order to make themselves sound smart. Differential coding, a.k.a. delta coding, prediction coding, predictive coding, delta/differential pulse code modulation or DPCM, is just a fancy name for “adding numbers” (or subtracting numbers, or adding negative numbers so the net result is subtraction).


Differential coding operates by making numbers small. This is a major goal in compression technology: Making numbers small. Why? Smaller numbers require less information to code than larger numbers. Actually, I think it would be more accurate to claim that similar numbers require less information to code. However, sticking to that approach requires the video codec to figure out information about what the set of similar numbers is. Instead, it is more efficient to build a video codec around the assumption that the set of similar numbers will consist of small numbers. The specific reasons why this matters will be discussed in a later article.

Suppose you are working with a string of bytes. Bytes range from 0..255. Here is a string:

150 152 149 150 151 156 153 151 152

On the scale of 0..255, those are reasonably large. However, they are quite similar to each other. Instead of coding each number separately, code the differences. Of course, the sequence has to start somewhere, so the first number is coded as-is, and the subsequent numbers are coded as differences from the previous number:

150 +2 -3 +1 +1 +5 -3 -2 +1

When decoding this string of numbers, start with the first number and start adding the deltas to get the remaining numbers:

150 + 2 = 152
152 + -3 = 149
149 + 1 = 150

… and so on. That’s really all there is to differential coding.

What A Multimedia Hacker Needs To Know