# why DCT

Started by May 3, 2005
```Hi guys,
I was curious to know why is it that DCT is used in image compression.
why not FFT?

```
```never mind, I got it.

```
```Neo wrote:
>
> never mind, I got it.

You got it?
I doubt it.
Can you elaborate?

Regards
Guido
```
```Closest approximation to the Karhonen Loeve transform?

```
```porterbo...@yahoo.com wrote:

> Closest approximation to the Karhonen Loeve transform?

Same acronym as the Dallas Children's Theater? (www.dct.org)

Ciao,

Peter K.

```
```porterboy76@yahoo.com wrote:
>
> Closest approximation to the Karhonen Loeve transform?

That is usually mentioned, but I have discovered a more
compelling reason.
But I would like to know what the original poster has found.

Regards
Guido
```
```Neo wrote:

> I was curious to know why is it that DCT is used in image compression.
> why not FFT?

The difference in use between DST, DCT, and DFT are the boundary
conditions.  (This is explained in Numerical Recipes, where I looked
when I wondered some time ago.)

DFT has periodic boundary conditions, DST has the function go to
zero at the boundary, and DCT has the derivative go to zero at the
boundary.  It seems that DCT has a smaller effect on the image
than the others.   That is, the effect of the blocks is less
visible with DCT than DFT or DST.   FFT is an algorithm,
or class of algorithms, for evaluating DFT.

-- glen

```
```glen herrmannsfeldt wrote:
> Neo wrote:
>
>
> > I was curious to know why is it that DCT is used in image
compression.
> > why not FFT?
>
>
> The difference in use between DST, DCT, and DFT are the boundary
> conditions.  (This is explained in Numerical Recipes, where I looked
> when I wondered some time ago.)
>
> DFT has periodic boundary conditions, DST has the function go to
> zero at the boundary, and DCT has the derivative go to zero at the
> boundary.  It seems that DCT has a smaller effect on the image
> than the others.   That is, the effect of the blocks is less
> visible with DCT than DFT or DST.   FFT is an algorithm,
> or class of algorithms, for evaluating DFT.
>
> -- glen

Hi

Can you explain what is meant by "derivative go to zero" or "function
go to zero" ? and when does it go to zero ?

Thanks
Sandeep

```
```guido,
I found out that the DCT distributes most of the energy in the lower
order co-efficients compared to the FFT and also gives a purely real
output. This energy localisation aids in more efficient encoding later
on.
Is this reasonable?

```
```Neo wrote:
>
> guido,
> I found out that the DCT distributes most of the energy in the lower
> order co-efficients compared to the FFT and also gives a purely real
> output. This energy localisation aids in more efficient encoding later
> on.
> Is this reasonable?

No!;-)
Your question was why is the DCT used in *image* compression!
The general term "energy compaction" does not explain why it is good
just for *image* compression, you could say the same thing for any
other compression object.

The actual reason is much simpler, and therefore apparently very
difficult to recognize by complicated-thinking people.

Here is the explanation:

What are people doing when they have a bunch of images and want
a quick preview?  They use thumbnails!  What are thumbnails?
Thumbnails are small downscaled versions of the original image!
If you want more details of the image, you can zoom in stepwise
by enlarging (upscaling) the image.
That is the key to understanding the use of DCT for image compression:

The fundamental property of lossy image compression is the similarity
of different resolutions of the same image.  "Lossy" compression means
that we assign *the same* output representation to *multiple*, *similar*
input representations.  The basic similarity relation for images is
resolution, or scale, invariance:  If we see the same image in different
resolutions (scales, sizes), or the same subject from different distances,
we talk about *the same* image (or subject).

The  DCT provides the best resolution separation property for digital images.
The 8-point DCT gives you 8 linearly increasing resolution representations
from 8 spatial sample values.  You can hardly do better than that.
Wavelet transforms, as used in JPEG2000, for example, do *not*
provide such optimal resolution separation.

Everybody who knows the DCT knows that the DC term represents a
1/8 scale  of the input sequence ("thumbnail" version).
The DC and first AC together represent a 2/8 or 1/4 scale of the
input sequence.  The DC and first 2 ACs together represent a 3/8
scale of the input sequence, and so on.
Every DCT coefficient adds corresponding resolution detail.
This is easy to demonstrate, but was not known before.
(See new JPEG scaling features presented at http://jpegclub.org
which directly apply this property.)
This fundamental DCT property explains why the DCT is the best
transform for image compression.

Regards
Guido
```