# JPEG

### dct image coefficients original

**Definition:** JPEG is an image compression standard (ISO IS 10918-1) published by The Joint Photographic Experts Group in 1994.

JPEG has become the most widely used format for storing digital photographs ever since. The original JPEG specification defines four compression modes]:

- Sequential (baseline): based on the DCT and adequate for most applications;
- Hierarchical: used to encode the image in a hierarchy of several different resolutions;
- Progressive: delivers lower-quality versions of the image quickly, followed by higher-quality passes; enjoyed popularity in the early days of the World Wide Web;
- Lossless: a variant that employs a simple differential coding method instead of DCT followed by quantization.

In this discussion we will limit ourselves to the sequential (default) mode.

The JPEG encoder (Figure 1) consists of the following main stages:

- The original RGB color image is converted to an alternative color model (YCbCr) and the color information is subsampled.
- The image is divided into 8 × 8 blocks.
- The 2-D Discrete Cosine Transform (DCT) is applied to each block image; the resulting 64 values are referred to as DCT
*coefficients*. The first coefficient is usually referred to as DC coefficient and contains the average value of the original 8 × 8 block; the remaining 63 values are called AC coefficients. - DCT coefficients are quantized simply by dividing each value by an integer (stored in a quantization table, see Table 1) and rounding the result; this is the step where acceptable loss is introduced.
- Quantized DCT coefficients are then scanned in a zigzag fashion (from top-left to bottom-right, see Figure 2). The resulting sequence is run-length encoded, in preparation for the entropy encoding step.
- The run-length encoded sequences are converted to variable-length binary codewords using Huffman encoding Look-up tables.

At the decoder side, the process is reversed; it should be noted that the loss introduced at the quantizer stage in the encoder cannot be canceled at the ‘dequantizer’ stage in the decoder.

## User Comments