[theora-dev] DC prediction
jonathan.fabrizio at lrde.epita.fr
Fri Mar 25 04:38:25 PDT 2011
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 580 to the predicted DC coefficient value at every block, which will
used to increase the predictor for the next block, the reconstructed DC
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
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 ?
More information about the theora-dev