[theora-dev] Bug in reference idct.

Timothy B. Terriberry tterribe at email.unc.edu
Fri Mar 7 07:18:36 PST 2008


Chris Brien wrote:
> Lines 106, 150 and 190 in idct.c do the same thing - the spec says the
> result of (T[4] - T[5]) should be negated before being multiplied. I
> believe this is a bug in the reference implementation.

I'm pretty sure the actual error is in the spec. The current reference
implementation decoder is based on theora-exp, so naturally they will
have the same bugs. However, you will find in
http://svn.xiph.org/trunk/theora-old the original VP3-based decoder,
which uses a completely different iDCT implementation. Using
(t[4]-t[5]), the two match exactly (tested on 65536 random inputs).
Using (t[5]-t[4]), they differ completely.

You will also notice that in the diagram in Figure 7.1, it is output
line 5 that is negated in this butterfly, not 4. Therefore I believe
this is an error in the spec.

I didn't check the output against an exact matrix-mul iDCT
implementation, but even if they did differ, we would need a compelling
reason to change the code now, for compatibility reasons.

> This is impossible as X is defined to be an array. I believe the intent
> was to assign R the value of (T[1] - T[6]). The reference decoder states:
>   _y[6<<3]=(ogg_int16_t)(t[1]-t[6]);
> 
> which would achieve the same result as assigning to R. I believe this is a
> bug in the spec.

Yes, it is.

Both errors have been fixed in svn r14555. Thanks for the report.


More information about the theora-dev mailing list