2
$\begingroup$

Is this piece of text (written by me) true about Discrete Cosine Transform ?

Discrete Cosine Transform (DCT) is a lossy data compression algorithm that is used in many compressed image and video formats, including JPEG, MJPEG, DV and MPEG. In this algorithm, special DCT coefficients are calculated for each 8x8 image block. Then the coefficients are quantized and the image block is represented as a matrix of these quantized coefficients. The algorithm utilizes the fact that human visual system does not distinguish small changes in color or intensity.

$\endgroup$
0

4 Answers 4

9
$\begingroup$

To illustrate Justme's answer:

Discrete Cosine Transform (DCT) is a lossy

The DCT can't be a lossy algorithm, since there's an inverse operation that restores the original input exactly.

data compression algorithm

Also, it's not a compression algorithm: in- and output have the same size.

So, both your central statements are wrong :(

that is used in many compressed image and video formats,

yes.

including JPEG, MJPEG, DV and MPEG.

What's DV? And: MPEG is a huge family of video compression methods. There's not "the MPEG algorithm", there's dozens of different video compression standards under that name.

In this algorithm, special DCT coefficients are calculated for each 8x8 image block.

That applies to JPEG, and probably a few of the many MPEG codecs. It's not true for all MPEG compressors! (For example, MPEG-H Part II, also called H.265, uses blocks of 64×64, 32×32, or 16×16, 8×8 or 4×4, depending on the image content.)

Then the coefficients are quantized

And that's where the lossiness happens: it's not in the DCT, it's what happens to the output of it!

and the image block is represented as a matrix of these quantized coefficients.

Again, only applies to JPEG. Be clear about that!

The matrix is how it's often visualized. The matrix representation is actually non-existent in the memory or storage formats, usually. On the very contrary, the elements are typically stored in a zigzag diagonal ordering if we imagine the matrix. (that's because that puts values that tend to be correlated closer to each other, making the result better to compress using subsequently applied lossless methods like LZW, Huffmann.)

The algorithm utilizes the fact that human visual system does not distinguish small changes in color or intensity.

No, it uses the fact that human perception often cares about high-frequency changes less than about small changes in low-frequency components. Otherwise, the selective quantization would make no sense.


Hm, you've not written the greatest paragraph. But I think you understand a lot of things correctly. Be more careful in really being aware what exactly does what, and you'll be fine!

$\endgroup$
11
  • $\begingroup$ Actually, I don't understand much about it, that's why I asked. Can you point me to some good and preferably SIMPLE sources about it? With Google I didn't find anything simple enough. $\endgroup$
    – Suvi
    Aug 8, 2020 at 13:29
  • $\begingroup$ about what, specifically? $\endgroup$ Aug 8, 2020 at 13:49
  • $\begingroup$ about DCT and how it is computed $\endgroup$
    – Suvi
    Aug 10, 2020 at 14:16
  • 1
    $\begingroup$ That's not the problem I have. There's just very clear material on the DCT out there, for example wikipedia (which is really a pretty obvious source to read...). If you don't understand something in such an article, sure, ask! But asking "can you write another introduction to the DCT" makes no sense: there's already thousands of introductions, so it's unlikely my intro will be any better than those you've already read. you must ask a precise question, not "explain the world to me". $\endgroup$ Aug 10, 2020 at 14:42
  • 1
    $\begingroup$ So, really, go to the wikipedia article on the DCT. Read the first sentence. Do you understand it? Good, move on to the next sentence. No? Then: can you read up on the content of that sentence yourself? Well, then read. If not: ask a new question on this site! Afterwards, move on to the next sentence. Repeat. That's literally the process everyone uses to understand complicated literature. $\endgroup$ Aug 10, 2020 at 14:44
5
$\begingroup$

No, because DCT is not a compression algorithm itself. But different lossy compression algorithms do use DCT as part of the process.

DCT can be used to transform data such as audio or image data into frequency domain, and then by analysing the frequency domain data it can be determined how much detail can be described more coarsely or completely omitted, and to keep only the data that is important.

So the lossy compression happens when the DCT output is quantized after the analysis how much to quantize.

$\endgroup$
3
$\begingroup$

Good start. Let us adjust a bit, in an other narrative point of view. Here is the compiled version:

Discrete Cosine Transform (DCT) is a lossy data compression algorithm that is used in many compressed image and video formats, including JPEG, MJPEG, DV and MPEG. In this algorithm, special DCT coefficients are calculated for each 8x8 image block, in the luminance and chrominance domains. Then the coefficients are quantized and the image block is represented as a matrix of these quantized coefficients. The algorithm utilizes the fact that human visual system does not distinguish small changes in color or intensity (but differently depending on the orientation, say horizontal or vertical), especially with proper transformation on the colored image data.

Now, the same version, block by block:

Discrete Cosine Transform (DCT)

It is not uniquely defined. There are several continuous and discrete versions, even integer-approximations (Int-DCT). The most classical is the discrete version named DCT-II, sometimes called "the DCT", but it would be better to be more precise: "The discrete cosine transform (known as DCT-II) is"

is a lossy data compression algorithm

DCTs are all theoretically invertible (up to computational precision). DCT-II comes with nice properties, fast forward and inverse algorithms, yet it is a more a concentration method than a true compression: "one of many discrete data (signal, image) transformations that can concentrate information in a fast manner"

that is used in many compressed image and video formats, including JPEG, MJPEG, DV and MPEG.

As there are variations (like MDCT for audio): "It is used, directly or in adapted forms, in many standard implementations of JPEG, Motion JPEG, DV, MPEG, AVC formats for audio, image or video compression"

In this algorithm, special DCT coefficients are calculated for each 8x8 image block, in the luminance and chrominance domains.

I guess you meant "spatial"? Using smaller sizes is mean to capture stationarity in images, and different sizes are often present in standards. Plus, in video, they are computed on differences between reference images and their prediction using complicated motion compensation algorithms. "For image or video compression, the DCT is often computed in 2D on blocks of pixels (or differences with respect to reference frames), for instance on $8\times 8$ image blocks for baseline JPEG"

Then the coefficients are quantized and the image block is represented as a matrix of these quantized coefficients.

The algorithm utilizes the fact that human visual system does not distinguish small changes in color or intensity (but differently depending on the orientation, say horizontal or vertical), especially with proper transformation on the colored image data.

I would swap the arguments: "Wnen image blocks or their predictions are well-concentrated, quantizing they allow to store information on less bits (for compression), using the fact that human visual system is not so sensitive to small changes in color or intensity".

Additional links:

$\endgroup$
1
$\begingroup$

The popular variants of the DCT is a invertible linear orthogonal block transform that happens to approximate the (optimal) KLT transform well for many image inputs, it can be efficiently computed using FFT-like factorizations and lends itself to perceptually meaningful «frequencies» that can be used in exploiting limitations of the human sensory systems.

By concentrating much of the signal energy into a few energic components, long runs of remaining small/unimportant coefficients can often be efficiently encoded using run-length coding.

DCTs for image/video compression is usually not overlapped. This can lead to false discontinuities along block edges as compression ratio is increased.

By not being signal adaptive, there will be inputs that are «de-consentrated» by the dct. Different codecs might have fallbacks such as non-transformed for those cases.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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