What I'm struggling with is understanding JPEG.

Now that noone is reading anymore , what I don't understand is the DCT.

Wikipedia shows it as (in Discrete cosine transform - Wikipedia, the free encyclopedia) (DCT-II):

Assuming N = 8, in doing one row (or column, but lets just assume row):

Xk = sum(0..7) { Xn * cos((PI/8)(n+.5)(k)) }

Now if X is a 8 element array of ints, and k and n are indeces, then:

Code:

float sum = 0;

for(int n=0;n<8;n++)

{

sum += X[ n] * cos((PI/8)*(n+.5)*k);

}

I have no idea what 'k' is supposed to be. I think it's either 1..8, or it could be

1..7. It could be one of those ranges incrementing through the sum, or incrementing for each new Xk.

Can anyone help me out?

Many thanks in advance!

## Enter your message below

Sign in or Join us (it's free).