6
$\begingroup$

I thought the Gibbs phenomenom is the result of Fourier analysis estimation (but was it Fourier Series estimation or can it also be Fourier Transform estimation?)

http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Gibbs_phenomenon_50.svg/285px-Gibbs_phenomenon_50.svg.png

JPEG uses the Discrete cosines Transform. A DCT is similar to a Fourier transform in the sense that it produces a kind of spatial frequency spectrum.

JPEG example JPG RIP 001.jpg  Lowest quality

But what are the differences between the Gibbs phenomenom artefacts from Fourier and the artefacts from the Discrete Cosine?

$\endgroup$
5
$\begingroup$

There are three kinds of JPEG artifacts. The first and (arguably) most important one is described in Yuval's answer: To a first order the problem is that under high compression all the high frequency information is discarded, and the lowest frequency information remaining is the average color of each 8x8 square. When you take the inverse but leave out the high frequency information, the result is a square of a single color. A decoder can't perform any low-pass filtering to remove the blocky effect because that would cause significant error in the case that you used a high-quality setting to encode.

The second artifact is exactly the Gibbs phenomenon. Fine detail in the image will get "halos" if highly compressed. For example, here is a 64x64 image with a single dot at pixel 35,35:

Image with a single dot

Here's the same image saved by GIMP as a Jpeg with low quality (25%):

Image with a single dot, jpeg encoded at low quality

There is a halo around the pixel in the 8x8 block the pixel is in. (To make it easier to see, here is an image of that block scaled up by a factor of 8:

Zoom in on the noise created by the jpeg encoder

This effect is called ringing. (In audio processing it really produces a ringing noise.) This occurs because high levels of compression are chopping out the highest frequencies, which leaves ripples at the highest remaining frequency. (I.e., it's the Gibbs phenomenon.)

The third artifact is the inverse of the Gibbs phenomenon. The Gibbs phenom is because the multiplication of the brick-wall filter in the frequency domain is equivalent to convolution with the sinc function in the time domain. The inverse problem is using a box-car filter for downsampling in the time domain leads to a sinc function in the frequency domain, and thus a large amount of high-frequency noise gets aliased into the resulting downsampled image. This is essentially what JPEG is doing when it breaks the image into 8x8 blocks. The lowest-frequency component of each 8x8 block is the average (box-car) of the pixel values in that 8x8 block, so actually contains significant high-frequency aliasing. For example, consider the following image. (It is 64x64 with a horizontal stripe each third pixel. So has significant amount of high frequency information.

Image with a lot of high frequency

Now if I encode with jpeg at very low quality I get this:

jpeg encoding showing high frequency aliasing

The high frequency information from the original image is not being completely filtered by the box-car averaging, and thus gets aliased into a lower-frequency error in the image.

$\endgroup$
4
$\begingroup$

The artefact that you see in JPEG comes from the fact that JPEG divides the image into $8\times 8$ blocks of pixels and compresses them separately. The $8\times 8$ blocks are visible very clearly in the JPEG appearing in your question. When the image is decompressed, often there is no effort to smooth the boundary regions, and this results in a "blocking" effect.

(For the curious: in fact JPEG first converts your image into the YCbCr color space and downscales the Cb and Cr parts by 2 in one or two dimensions. Then each of the Y,Cb,Cr planes is compressed separately. So the effective blocks for Cb and Cr are even larger than $8\times 8$.)

$\endgroup$
  • $\begingroup$ But the blockiness wouldn't occur if we weren't discarding some of the high frequency components in each block. Casual intuition would suggest that throwing out high frequencies would give you a low pass filter, and thus a smoother picture. Can you explain why the casual intuition is wrong? $\endgroup$ – Wandering Logic Mar 28 '14 at 13:53
  • $\begingroup$ The image is smooth. Each $8\times 8$ block is smooth. But together the blocks do not fit. To make matters even worse, everything is quantized, including the DC component. So even a smooth gradient would become less smooth in a JPEG. $\endgroup$ – Yuval Filmus Mar 28 '14 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.