cogman10 5 days ago

I don't believe this is correct.

What the DCT does along with the color representation transformation is to turn fine details into higher frequencies and core details into low frequencies. From there, the quality of the image and thus compression ratio is as simple as dropping high frequency representations.

And besides that, jpegs use a Huffman table to further reduce the size of the image.

AFAIK, it doesn't do anything special to reduce runs. So lining up zeros really doesn't help much.

3
IshKebab 5 days ago

This is true, but OP was also correct. The DCT components are quantised and encoded in an order such that you get a long string of 0s at the end (the high frequencies).

Retr0id 5 days ago

Dropping (or rather, heavily quantizing) the high frequency components does create runs of zeroes with high probability. The order the components are stored (a diagonal zig-zag) pushes the likely-to-be-zero elements together. At higher quality settings you might not have actual runs of zeroes, but you'll at the least have runs of low-entropy values.

brigade 5 days ago

Dropping the high frequencies does create zero runs, and even JPEG encodes zero runs as a run-length (RRRR in the spec)

But DCT isn't very useful for lossless since any lossless frequency domain representation requires more range than the source, and you can't quantize to counter it.

Sesse__ 4 days ago

JPEG even has a special code from “the rest from here is all zeros, so we stop this block now”. The entire format is pretty much organized around trying to get as many zero coefficients as possible.