ArticleslgStudy

computer science

Discrete cosine transform

Discrete cosine transform is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Discrete cosine transform rather than just read about it. In short: A discrete cosine transform (DCT) expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies. The DCT, first proposed by Nasir Ahmed in 1972, is a widely used transformation technique in signal processing and data compression.

Discrete cosine transform — main illustration
Discrete cosine transform — illustration

Key takeaways

  • Discrete cosine transform belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Discrete cosine transform to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Discrete cosine transform from memory before moving on to harder problems.

Reference excerpt

A discrete cosine transform (DCT) expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies. The DCT, first proposed by Nasir Ahmed in 1972, is a widely used transformation technique in signal processing and data compression. It is used in most digital media, including digital images (such as JPEG and HEIF), digital video (such as MPEG and H.26x), digital audio (such as Dolby Digital, MP3 and AAC), digital television (such as SDTV, HDTV and VOD), digital radio (such as AAC+ and DAB+), and speech coding (such as AAC-LD, Siren and Opus). DCTs are also important to numerous other applications in science and engineering, such as digital signal processing, telecommunication devices, reducing network bandwidth usage, and spectral methods for the numerical solution of partial differential equations. A DCT is a Fourier-related transform similar to the discrete Fourier transform (DFT), but using only real numbers. The DCTs are generally related to Fourier series coefficients of a periodically and symmetrically extended sequence, whereas DFTs are related to Fourier series coefficients of only periodically extended sequences. DCTs are equivalent to DFTs of roughly twice the length, operating on real data with even symmetry (since the Fourier transform of a real and even function is real and even), whereas in some variants the input or output data are shifted by half a sample. From the perspective of algebraic signal processing, the relationship between the DCT and the DFT reflects their different underlying algebraic structures: the DFT basis functions are the irreducible representations of the cyclic group, making the DFT the natural spectral transform for signals with periodic (circular) boundary conditions, while the DCT basis functions are the irreducible representations of the dihedral group, making the DCT natural for signals with symmetric (even) boundary conditions. There are eight standard DCT variants, of which four are common. The most common variant of discrete cosine transform is the type-II DCT, which is often called simply the DCT. This was the original DCT as first proposed by Ahmed. Its inverse, the type-III DCT, is correspondingly often called simply the inverse DCT or the IDCT. Two related transforms are the discrete sine transform (DST), which is equivalent to a DFT of real and odd functions, and the modified discrete cosine transform (MDCT), which is based on a DCT of overlapping data. Multidimensional DCTs (MD DCTs) are developed to extend the concept of DCT to multidimensional signals. A variety of fast algorithms have been developed to reduce the computational complexity of implementing DCT. One of these is the integer DCT (IntDCT), an integer approximation of the standard DCT, used in several ISO/IEC and ITU-T international standards. DCT compression, also known as block compression, compresses data in sets of discrete DCT blocks. DCT block sizes include 8 × 8 pixels for the standard DCT, and varied integer DCT sizes between 4 × 4 and 32 × 32 pixels. The DCT has a strong energy compaction property, capable of achieving high quality at high data compression ratios. However, blocky compression artifacts can appear when heavy DCT compression is applied.

History The DCT was first conceived by Nasir Ahmed while working at Kansas State University. The concept was proposed to the National Science Foundation in 1972. The DCT was originally intended for image compression. Ahmed developed a practical DCT algorithm with his PhD students T. Raj Natarajan and K. R. Rao at the University of Texas at Arlington in 1973. They presented their results in a January 1974 paper, titled Discrete Cosine Transform. It described what is now called the type-II DCT (DCT-II), as well as the type-III inverse DCT (IDCT). Since its introduction in 1974, there has been significant research on the DCT. In 1977, Wen-Hsiung Chen published a paper with C. Harrison Smith and Stanley C. Fralick presenting a fast DCT algorithm. Further developments include a 1978 paper by M. J. Narasimha and A. M. Peterson, and a 1984 paper by B. G. Lee. These research papers, along with the original 1974 Ahmed paper and the 1977 Chen paper, were cited by the Joint Photographic Experts Group as the basis for JPEG's lossy image compression algorithm in 1992. The discrete sine transform (DST) was derived from the DCT, by replacing the Neumann condition at x=0 with a Dirichlet condition. The DST was described in the 1974 DCT paper by Ahmed, Natarajan and Rao. A type-I DST (DST-I) was later described by Anil K. Jain in 1976, and a type-II DST (DST-II) was then described by H.B. Kekra and J.K. Solanka in 1978. In 1975, John A. Roese and Guner S. Robinson adapted the DCT for inter-frame motion-compensated video coding. They experimented with the DCT and the fast Fourier transform (FFT), developing inter-frame hybrid coders for both, and found that the DCT is the most efficient due to its reduced complexity, capable of compressing image data down to 0.25 bit per pixel for a videotelephone scene with image quality comparable to an intra-frame coder requiring 2 bits per pixel. In 1979, Anil K. Jain and Jaswant R. Jain further developed motion-compensated DCT video compression, also called block motion compensation. This led to Chen developing a practical video compression algorithm, called motion-compensated DCT or adaptive scene coding, in 1981. Motion-compensated DCT later became the standard coding technique for video compression from the late 1980s onwards. A DCT variant, the modified discrete cosine transform (MDCT), was developed by John P. Princen, A.W. Johnson and Alan B. Bradley at the University of Surrey in 1987, following earlier work by Princen and Bradley in 1986. The MDCT is used in most modern audio compression formats, such as Dolby Digital (AC-3), MP3 (which uses a hybrid DCT-FFT algorithm), Advanced Audio Coding (AAC), and Vorbis (Ogg). Nasir Ahmed also developed a lossless DCT algorithm with Giridhar Mandyam and Neeraj Magotra at the University of New Mexico in 1995. This allows the DCT technique to be used for lossless compression of images. It is a modification of the original DCT algorithm and incorporates elements of inverse DCT and delta modulation. It is a more effective lossless compression algorithm than entropy coding. Lossless DCT is also known as LDCT.

… excerpt ends here. Continue reading the full article.

Illustrations

Discrete cosine transform: The four basic stages of computing 3D DCT-II using the VR DIF Algorithm.
The four basic stages of computing 3D DCT-II using the VR DIF Algorithm.
Discrete cosine transform: The single butterfly stage of the VR DIF algorithm.
The single butterfly stage of the VR DIF algorithm.
Discrete cosine transform: Two-dimensional DCT frequencies from the JPEG DCT
Two-dimensional DCT frequencies from the JPEG DCT
Discrete cosine transform: An example showing eight different filters applied to a test image (top left) by multiplying its DCT spectrum (top right) with each filter.
An example showing eight different filters applied to a test image (top left) by multiplying its DCT spectrum (top right) with each filter.
Discrete cosine transform: Original size, scaled 10x (nearest neighbor), scaled 10x (bilinear).
Original size, scaled 10x (nearest neighbor), scaled 10x (bilinear).

Worked examples

Example 1 — a first encounter with Discrete cosine transform

Start with the simplest possible case. Write down what Discrete cosine transform claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Discrete cosine transform before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Discrete cosine transform ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Discrete cosine transform

In research
Discrete cosine transform appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Discrete cosine transform in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Discrete cosine transform is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data compression, Digital signal processing, Discrete transforms, so understanding it makes those chapters shorter.
In everyday life
Look for Discrete cosine transform outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Discrete cosine transform” →

How to study Discrete cosine transform in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Discrete cosine transform means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Discrete cosine transform out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Discrete cosine transform in simple terms?

A discrete cosine transform (DCT) expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies. The DCT, first proposed by Nasir Ahmed in 1972, is a widely used transformation technique in signal processing and data compression.

Why does Discrete cosine transform matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Discrete cosine transform?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Discrete cosine transform.

Tags

  • Data compression
  • Digital signal processing
  • Discrete transforms
  • Fourier analysis
  • H.26x
  • Image compression
  • JPEG
  • Lossy compression algorithms
  • Video compression

Keep exploring