View Single Post
  #29  
Old 04-08-07, 00:31
robski robski is offline
Senior Member
 
Join Date: Dec 2005
Location: Kent UK
Posts: 3,739
Default

Let's set off by saying the Discrete Cosine Transform is a tedious sequence of additions, subtractions and multiplication on all the rows and columns. It is not my intention to drill down that deep. Besides it would take an age to sit there with a calculator pressing all the buttons to step through the sequence of processing an 8 x 8 array of image data. Best left to your PC CPU or a dedicated chip found in your camera.

The following information I pulled from a DCT microchip data sheet. It is my intention just to give you an overview of the complex processing involved. Part of the process is to use values of different frequency Cosine waves ( a cosine is the same as sine it just starts from a different point). It is senseless to keep calculating these values every time you want to use them so they are stored in a table. The table is a 8 x 8 matrix. The table stores a steady value term (DC) and 7 frequencies (AC) terms. The first frequency ( the fundamental ) is chosen so that the first half cycle covers the 8 image pixels. The other frequencies are harmonics of the fundamental frequency. I have attached a table used by this microchip and plotted the values in the table to show the DC term (0th) and the 7 other frequencies (1th - 7th terms).

In the JPEG processing of the 8 x 8 image data uses a Two Dimensional DCT process. In practice this is executed by using a One Dimensional DCT on the columns ( left to right ) in the 8 x 8 matrix followed by another One Dimensional DCT on the rows ( top to bottom ).

The other attachment is a block diagram showing the processing of a One Dimensional DCT. The inputs are XK0 though to XK7 taken from the 8 image pixels in a row. The unit will add together the image pixels for even numbered rows or subtract one from the other on odd numbered rows. These results are then multiplied by one of the cosine values from the table. The value used will also depend on what part of the 8 x 8 image it is processing. Is you head hurting yet ?

The results are stored in memory. Another One Dimensional DCT takes the values from the memory but works on them from top to bottom to give the final Two Dimensional DCT terms.

In the next post I will show you the results from a C program I've been dabbling with that converts the 8 x 8 image values to DCT value and back to image values.
__________________
Rob

-----------------------------------------------------
Solar powered Box Brownie Mk2

Captain Sunshine, to be such a man as he, and walk so pure between the earth and the sea.

WPF Gallery
Birdforum Gallery
http://www.robertstocker.co.uk updated

Last edited by robski; 26-07-11 at 22:34.
Reply With Quote