What Are the 63 AC Coefficients in JPEG DCT?

In JPEG image compression, an image is divided into 8x8 pixel blocks and converted into frequency space using the Discrete Cosine Transform (DCT), resulting in 64 frequency coefficients per block. While the single Direct Current (DC) coefficient represents the average color or brightness across the block, the remaining 63 Alternating Current (AC) coefficients represent the specific spatial frequencies, textures, edges, and directional patterns within that block. This article explains what these 63 AC coefficients capture, how they are structured across the 8x8 matrix, and why they are central to the JPEG compression process.

Spatial Frequencies and Gradients

Each of the 63 AC coefficients corresponds to a specific basic cosine wave pattern running at different frequencies across the 8x8 grid:

Low vs. High Frequencies

The position of an AC coefficient dictates the scale of the visual feature it describes:

Role in Quantization and Compression

The purpose of isolating the 63 AC coefficients by frequency is to make compression possible through quantization:

  1. Quantization: JPEG applies a quantization matrix that divides the high-frequency AC coefficients by larger step sizes than the low-frequency ones. This deliberately rounds many high-frequency coefficients down to zero.
  2. Zig-Zag Scanning: After quantization, the 64 coefficients are read in a zig-zag order, starting at the DC coefficient and traversing from lowest to highest frequency AC coefficients.
  3. Entropy Encoding: Because the high-frequency AC values are frequently rounded to zero, the zig-zag sequence produces long runs of trailing zeros. These sequences are then compressed using run-length encoding and Huffman coding, drastically reducing file size while preserving the visually essential components of the image.