QUOTE (chrizoo @ Jun 11 2009, 13:33)

QUOTE (doccolinni @ Jun 11 2009, 11:50)

001 = -2
010 = -1
011 = 0
100 = +1
101 = +2
110 = +3
Of course, you used 3 bit.
1 bit = 0,1
2 bit = 00,01,10,11
3 bit = 001,010,011,100,101,110,111
4 bit = 0000,0001,etc...
Well of course I used three bits - I used three bits in order to store the differences! If you actually read my post carefully you'd perfectly understand what was going on. :-/
QUOTE (chrizoo @ Jun 11 2009, 13:36)

No. If A and B represent any value between 0 and 255 (8 bit), the difference can also be encoded with 8 bit (as the difference can be 255 at most if A=0 and B=255 and vice versa). This holds true for any bit depth x.
I'm sorry, but you are wrong. The
absolute value of the difference will, indeed, always be in-between 0 and 255. But it's not the absolute value of the difference we're interested in, but the actual difference - meaning that whether the difference is positive or negative also matters. If you want you can try re-reading the post in which I've explained it already. If not, here is a shorter version again:
Ok, let's say it is 8-bit this time. So values range from 0 to 255. Nice. And we want to store the difference between each two samples - so far everything is clear. But carefully now:
If one sample has a value of 200 and the next sample has a value of 201, the difference is +1. If, however, one sample has a value of 200 and the next value is 199, the difference is -1.
Is that clear? I hope it is. So, therefore, you need to be able to store
both +1
and -1.
The same goes if one value is 200 and the next is 202, or one value is 200 and the next value is 198 - you need to be able to store
both +2
and -2.
Increasing the difference like that, we'll finally get to the maximum possible difference in both positive and negative directions:
- when first value is 0 and the next value is 255, the difference is +255,
- when first value is 255 and the next value is 0, the difference is -255.
So
notice that
for every number from 1 to 255 we have two possible differences involving that number - positive and negative. For zero, we've got only one possibility.
How many values did we start with? Here they are: 0, 1, 2, 3, 4, 5,..., 255.
And how many values did we end up with? Here they are: 0, -1, +1, -2, +2, -3, +3, -4, +4, -5, +5,...,-255, +255.
Is it now obvious that we have two times more values than what we started with (actually two times minus one, because zero wasn't doubled)?