You are on page 1of 24

Still Image Data Compression Standard

School of Computer Science, University of Central Florida, VLSI and M-5 Research Group

JPEG

May, 1999

JPEG Introduction - The background

JPEG stands for Joint Photographic Expert Group A standard image compression method is needed to enable interoperability of equipment from different manufacturer It is the first international digital image compression standard for continuous-tone images (grayscale or color) The history of JPEG the selection process

JPEG Introduction whats the objective?

very good or excellent compression rate, reconstructed image quality, transmission rate be applicable to practically any kind of continuoustone digital source image good complexity have the following modes of operations:

sequential encoding progressive encoding lossless encoding hierarchical encoding

JPEG Overview
Source image data Encoder model descriptors encoder statistical model symbols entropy encoder compressed image data

model tables

entropy coding tables

The basic parts of an JPEG encoder

JPEG Overview (cont.)


JPEG has the following Operation Modes:

Sequential DCT-based mode Progressive DCT-based mode Sequential lossless mode Hierarchical mode

JPEG entropy coding supports:


Huffman encoding Arithmetic encoding

JPEG Baseline System

JPEG Baseline System


JPEG Baseline system is composed of:

Sequential DCT-based mode Huffman coding

88 blocks

DCT-based encoder
FDCT quantizer statistical model table specification entropy encoder compressed image data

Source image data

table specification

The basic architecture of JPEG Baseline system

JPEG Baseline System Why does it work?

Lossy encoding HVS is generally more sensitive to low frequencies Natural images

Frequency sensitivity of Human Visual System

The Baseline System DCT


The Discrete Cosine Transform (DCT) separates the frequencies contained in an image. The original data could be reconstructed by Inverse DCT.
The mathematical representation of FDCT (2-D):
7 7 1 F (u, v ) C (u)C (v ) f ( x, y ) cos(2(i 1)u / 16) cos(2( j 1)v / 16) 4 x 0 y 0

Where

1 / 2 x0 C( x) 1 otherwise
f(x,y): 2-D sample value F(u,v): 2-D DCT coefficient

The Baseline System-DCT (cont.)


An example of 1-D DCT decomposition
(b)
150 100 50 150 100 50

(c)

f(x)

0 1 -50 -100 -150 2 3 4 5 6 7 8

S(u)

0 1 -50 -100 -150 2 3 4 5 6 7 8

Before DCT (image data)


1

After DCT (coefficients)


1 1

Amplitude

Amplitude

0 1 2 3 4 5 6 7 8

Amplitude

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

Amplitude

0 1 2 3 4 5 6 7 8

-1

-1

-1

-1

U=0
1
1

U=1
1

U=2
1

U=3

Amplitude

Amplitude

Amplitude

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

Amplitude

0 1 2 3 4 5 6 7 8

-1

-1

-1

-1

U=4

U=5

U=6

U=7

The 8 basic functions for 1-D DCT

The Baseline System-DCT (cont.)


DC coefficient

The DCT coefficient values can be regarded as the relative amounts of the 2-D spatial frequencies contained in the 88 block the upper-left corner coefficient is called the DC coefficient, which is a measure of the average of the energy of the block Other coefficients are called AC coefficients, coefficients correspond to high frequencies tend to be zero or near zero for most natural images

The Baseline System Quantization


F (u , v) F ' (u , v) Round ( ) Q(u , v)
F(u,v): original DCT coefficient F(u,v): DCT coefficient after quantization Q(u,v): quantization value

Why quantization? .

to achieve further compression by representing DCT coefficients with no greater precision than is necessary to achieve the desired image quality

Generally, the high frequency coefficients has larger quantization values Quantization makes most coefficients to be zero, it makes the compression system efficient, but its the main source that make the system lossy

The Baseline System-Quantization (cont.)


16 12 14 14 18 24 49 72 11 12 13 17 22 35 64 92 10 14 16 22 37 55 78 95 16 19 24 29 56 64 87 98 24 26 40 51 68 81 103 112 40 58 57 87 109 104 121 100 51 60 69 80 103 113 120 103 61 55 56 62 77 92 101 99

JPEG Luminance quantization table

A simple example
O O X X X X O O O X X X X X X O O X X X X X X O X X X X X X X X X X X X X X X X O X X X X X X O O X X X X X X O O O X X X X O O

Original image pattern

-10 -10 10 10 10 10 -10 -10

-10 10 10 10 10 10 10 -10

-10 10 10 10 10 10 10 -10

10 10 10 10 10 10 10 10

10 10 10 10 10 10 10 10

-10 10 10 10 10 10 10 -10

-10 10 10 10 10 10 10 -10

-10 -10 10 10 10 10 -10 -10

40 0 -45 0 -20 0 -3 0

0 -26 0 0 0 -24 0 0 0 0 0 0 0 10 0 0

0 0 0 0 0 8 0 0 0 20 0 0 0 18 0 0

0 -11 0 0 0 -10 0 0 0 0 0 0 0 4 0 0

0 0 0 0 0 0 0 0

Digitized image

After FDCT(DCT coefficients)

A simple example(cont.)
16 12 14 14 18 24 49 72 11 12 13 17 22 35 64 92 10 14 16 22 37 55 78 95 16 19 24 29 56 64 87 98 24 26 40 51 68 81 103 112 40 58 57 87 109 104 121 100 51 60 69 80 103 113 120 103 61 55 56 62 77 92 101 99

40 0 -45 0 -20 0 -3 0

0 -26 0 0 0 -24 0 0 0 0 0 0 0 10 0 0

0 0 0 0 0 8 0 0 0 20 0 0 0 18 0 0

0 -11 0 0 0 -10 0 0 0 0 0 0 0 4 0 0

0 0 0 0 0 0 0 0

3 0 -3 0 -1 0 0 0

0 -3 0 0 0 -2 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

DCT coefficients

Quantized coefficients

Baseline System - DC coefficient coding

Since most image samples have correlation and DC coefficient is a measure of the average value of a 88 block, we make use of the correlation of DC coefficients

quantized DC coefficients

DPCM

DC difference

Differential pulse code modulation

Baseline System - AC coefficient coding

AC coefficients are arranged into a zig-zag sequence:


Horizontal frequency

0 2

1 4 8 11 19 22 34 36

5 7 12 18 23 33 37 49

6 13 17 24 32 38 47 48

14 16 25 31 39 46 50 57

15 26 30 40 45 51 56 58

27 29 41 44 52 55 59 62

28 42 43 53 54 60 61 63

Vertical frequency

3 9 10 20 21 35

Baseline System - Statistical modeling

Statistical modeling translate the inputs to a sequence of symbols for Huffman coding to use Statistical modeling on DC coefficients:

symbol 1: different size (SSSS) symbol 2: amplitude of difference (additional bits) symbol 1: RUN-SIZE=16*RRRR+SSSS symbol 2: amplitude of difference (additional bits)

Statistical modeling on AC coefficients:


Additional bits for sign and magnitude

Huffman AC statistical model run-length/amplitude combinations

Huffman coding of AC coefficients

An examples of statistical modeling


quantized DC value DPCM difference SSSS Additional bits
zigzag index AC descriptor RRRR SSSS RUN-SIZE Additional bits

Example 1: Huffman symbol assignment to DC descriptors +8 +9 +8 -6 -8 -3 0 +1 -1 -14 -2 +5 0 1 1 4 2 3 -1 0 0001 00 101


8 9 +1 0 1 33 1

+3 +6 3 110
EOB 0 0 --

+3 0 0 -63 0

Example 2: Huffman symbol assignment to AC descriptors 1 2 3 4 5 6 7 0 0 0 0 -14 0 0 4 2 4 68 0001

Other Operation Modes

JPEG Progressive Model

Why progressive model? Quick transmission Image built up in a coarse-to-fine passes First stage: encode a rough but recognizable version of the image Later stage(s): the image refined by successive scans till get the final image Two ways to do this: Spectral selection send DC, AC coefficients separately Successive approximation send the most significant bits first and then the least significant bits

JPEG Lossless Model


Sample values

DPCM

Descriptors

Differential pulse code modulation

Predictors for lossless coding selection value prediction strategy 0 no prediction 1 A 2 B 3 C 4 A+B-C 5 A+(B-C)/2 6 B+(A-C)/2 7 (A+B)/2

A X

JPEG Hierarchical Model

Hierarchical model is an alternative of progressive model (pyramid) Steps:

filter and down-sample the original images by the desired number of multiplies of 2 in each dimension Encode the reduced-size image using one of the above coding model Use the up-sampled image as a prediction of the origin at this resolution, encode the difference Repeat till the full resolution image has been encode