Re: I am Puzzled! How come my JPEG algorithm doesnt work?




Thomas Richter wrote:
fulltime wrote:
Hi all,

I am trying to include an addition step into the basic JPEG algorithm,
but it puzzles me as to why it WUN work. I included an addition step
which i call it as DPM(differential pixel method) tat is it takes the
1st pixel, (0,0) as the reference. The subsequent neighbours will have
their pixel values subtracted from their previous neighbours, eg. 1st
row of the image array is like [40, 55, 60, 75, 50, 10, 40, 80], after
taking the difference as i mentioned above, it becomes, [40, 15(55-40),
5(60-55), 15(75-60), -25(50-75), -30, -40]. This subtraction of
neighbors will proceed with the 1st element of 2nd row(2,1) It will
subtract from the last element of the 1st row(1,8)

After which, i will take the DCT and then quantize it b4 i reordered
the codes via zig zag manner. In short, this is wat i do

Image --> take DPM --> DCT --->, Quantize ----> Encode
Decode --> Un-Qunatize--> IDCT--> take iverse DPM --> Image

Baaaad idea.

However, the image i reconstructed is very unacceptable, any reasons
why isit so?

Because you are *quantizing* the DCT coefficients. Remember, what you
now reconstruct aren't pixel values, but pixel differences. If you now
introduce an error in one pixel by quantization, this error accumulates
to all other pixels that require the reconstructed pixel.

Why cant i take the DCT of the difference btwn the pixels?

You can. It just won't work well.

In theory, i think it shld work perfectly fine..

No, as soon as you quantize, you're lost.

BTW, the DCT AC coefficients *are* already pixel deltas, so why do you
bother?

If you want a transformation that goes accross blocks, then using DCT as
basis might be a bad idea to begin with - you need a different function
basis that still creates "visually appealing" errors after quantization.

So long,
Thomas

hi thomas,

I didnt know AC coefficients are already pixel deltas, i tot they were
just a coefficient beside the DC coefficient, can u elaborate? --> BTW,
the DCT AC coefficients *are* already pixel deltas, so why do you
bother?

.