DC prediction

Jonathan Fabrizio <[email protected]> Fri, 25 Mar 2011 12:38:25 +0100
Newsgroups gmane.comp.multimedia.ogg.theora.devel
Message-ID <[email protected]>
Hi,
The specification points out a problem in the dc prediction :
"This procedure describes the complete process of undoing the DC prediction
to recover the original DC values. Because it is possible to add a value 
as large
as 580 to the predicted DC coefficient value at every block, which will 
then be
used to increase the predictor for the next block, the reconstructed DC 
value
could overflow a 16-bit integer."

And explains the solution :

"This is handled by truncating the result to a
16-bit signed representation, simply throwing away any higher bits in 
the two’s
complement representation of the number."

which is done in the algorithm:

* Truncate DC to a 16-bit representation by dropping any higher-order bits.

But why dropping higher-order bits ?
With a simple exemple with an unsigned integer 100001 If I truncate this 
number to a 4-bit representation by dropping any higher-order bits I get 
0001 which is far from the initial value. I think the value could be 
rounded to 1111 which is better ?
To round DC, which is signed with a 17-bit representation, to a 16 bit 
signed value, this gives :
if (DC<− (2^15)) DC = -2^15
else if (DC>2^(15)-1) DC = -2^(15)-1

Am I wrong ?

Regards
J.F.

_______________________________________________
theora-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/theora-dev