
Virtualdub Developer
  
Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02

|
Not this again!
First, you have to make sure you are referring to the correct DCT. The Discrete Cosine Transform (DCT) has both a forward incarnation (FDCT) used for encoding and an inverse one (IDCT) for decoding. The IDCT is also used during encoding to verify the coding error. However, some have dubbed the term "iDCT" to refer to any DCT that has been implemented in integer math. This acronym is misleading and isn't used in any academic literature, but you may see it in some forums. Try to stomp it out whenever possible.
VirtualDub has both forward and reverse DCTs. The MPEG-1 video decoder uses an integer 8x8 2D inverse DCT, with both scalar and MMX (Intel AP-922) incarnations. The MPEG-1 audio decoder uses a forward DCT as part of the subband synthesis transform, and an inverse modified DCT (IMDCT) in the layer III decoder, both of which are implemented in floating-point. However, VirtualDub has no encoder of its own -- all encoding is handled by external codecs. When you are encoding AVI-to-AVI, VirtualDub isn't using its MPEG-1 decoder and thus its IDCT routines don't matter.
A reference IDCT is a IDCT that has been coded brute-force:
| CODE | for(int i=0; i<8; ++i) { double s = 0; for(int j=0; j<8; ++j) s += in[j] * cos((pi/36) * (2*i+1) * j); out[i] = s; }
|
It is strictly by the definition and is the dumbest, slowest possible way to implement the IDCT. It is also the hardest to get wrong, which is the reason why it is implemented -- it is used as a reference to check faster implementations for accuracy. It is true that a floating-point reference IDCT will have a tiny bit more accuracy than a compliant integer IDCT, but not necessarily more than a compliant floating-point IDCT. Just applying Byeong Gi Lee's decomposition to the IDCT will speed up the algorithm by a factor of three but still give you ~22 bits of accuracy in single precision, which is way more than you need for video work. Going to Feig-Winograd shaves another 20% or so off the complexity. |