Thursday, February 7, 2008

Theora Codec encoding process........

Discrete Cosine Transform (DCT):

This is a magical mathematical function that takes a group of numbers and turns it into another group of numbers. The transformed group of numbers exhibits some curious properties. Notably, larger numbers are concentrated in certain areas of the transformed group.

A video codec like VP3 often operates on 8x8 blocks of numbers. When these 8x8 blocks are transformed using a DCT the larger numbers occur mostly in the up and left areas of the block with the largest number occurring as the first in the block (up-left corner). This number is called the DC coefficient. The other 63 numbers are called the AC coefficients.

Quantization:

This coding step tosses out information by essentially dividing a number to be coded by a factor and throwing away the remainder. The inverse process (dequantization) involves multiplying by the same factor to obtain a number that is close enough to the original.

Zigzag Ordering:

After transforming and quantizing a block of samples, the samples are not in an optimal order for run length encoding. Zigzag ordering rearranges the samples to put more zeros between non-zero samples.

Run Length Encoding (RLE):

The concept behind RLE is to shorten runs of numbers that are the same. For example, the string "88888" is encoded as (5, 8), indicating a run of 5 '8' numbers.

e.g. 0 0 0 0 5 0 2 0 0 0 9 is encoded as: (4, 5), (1, 2), (3, 9)

Differential (or Delta) Pulse Code Modulation (DPCM):

PCM means rather than encoding absolute values, encode the differences between successive values.

e.g. 82 84 81 80 86 88 85 Can be delta-encoded as: 82 +2 -3 -1 +6 +2 -3

Motion Compensation:

Simply, this coding method specifies that a block from a certain position in the previous frame is to be copied into a new position in the current frame. This technique is often combined with DCT and DPCM coding, as well as fractional pixel motion.

Entropy Coding (Huffman Coding):

This is the process of coding frequently occurring symbols with fewer bits than symbols that are not likely to occur as frequently.

Refference : http://www.theora.org