Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

JPEG

Still Image Data Compression Standard

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)
Why compression is needed?

Ex) VGA(640x480) 640x480x8x3=7,372,800bits


with compression 200,000bits without any visual
degradation

JPEG Introduction whats the objective?

very good or excellent compression rate,


reconstructed image quality, transmission
rate
be applicable to practically any kind of
continuous-tone digital source image
good complexity
have the following modes of operations:

sequential encoding
Progressive encoding
lossless encoding

JPEG Overview
Source
image data

descriptors

Encoder
model

model
tables

encoder
statistical
model

symbols

entropy
encoder

entropy
coding tables

The basic parts of an JPEG encoder

compressed
image data

JPEG Baseline System

JPEG Baseline System


JPEG Baseline system is composed of:

Sequential DCT-based mode


Huffman coding

88 blocks

DCT-based encoder
FDCT

Source
image data

quantizer

statistical
model

entropy
encoder

table
specification

The basic architecture of JPEG Baseline system

compressed
image data

table
specification

JPEG Baseline System


Why does it work?

Lossy encoding
HVS is generally more sensitive to low frequencies
Natural images
s e n s itivity

fre q u e n c y

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
x=0
C( x) =
1 otherwise
f(x,y): 2-D sample value
F(u,v): 2-D DCT coefficient

Basis of DCT transform

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

The Baseline System-DCT (cont.)


An example of 1-D DCT decomposition
(c)

(b)
150

150

100

100
50

50

S(u)

0
1

0
1

-50

-50

-100

-100

Before DCT (image data)

-1

0
1

U=4

0
1

U=3
1

0
1

-1

U=5

-1

-1

-1

U=2

Amplitude

Amplitude

0
3

-1

U=1

Amplitude

-1

U=0

Amplitude

Amplitude

0
4

After DCT (coefficients)

Amplitude

Amplitude

-150

-150

Amplitude

f(x)

0
1

-1

U=6

The 8 basic functions for 1-D DCT

U=7

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

11

10

16

24

40

51

61

12

12

14

19

26

58

60

55

14

13

16

24

40

57

69

56

14

17

22

29

51

87

80

62

18

22

37

56

68

109

103

77

24

35

55

64

81

104

113

92

49

64

78

87

103

121

120

101

72

92

95

98

112

100

103

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

Digitized image

-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

After FDCT(DCT coefficients)

0
0
0
0
0
0
0
0

A simple example(cont.)

40
0
-45
0
-20
0
-3
0

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

16

11

10

16

24

40

51

61

12

12

14

19

26

58

60

55

14

13

16

24

40

57

69

56

14

17

22

29

51

87

80

62

18

22

37

56

68

109

103

77

24

35

55

64

81

104

113

92

49

64

78

87

103

121

120

101

72

92

95

98

112

100

103

99

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

DCT coefficients

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

Quantized coefficients

0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0

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:

Vertical frequency

Horizontal frequency

14

15

27

28

13

16

26

29

42

12

17

25

30

41

43

11

18

24

31

40

44

53

10

19

23

32

39

45

52

54

20

22

33

38

46

51

55

60

21

34

37

47

50

56

59

61

35

36

49

48

57

58

62

63

3
0
-3
0
-1
0
0
0

0
0
0
0
0
0
0
0

-3
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

3 0 0 -3 0 -3 0 0 0 0
-1 0 -2(EOB)

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)

Statistical modeling on AC coefficients:

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

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

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

8 9
+1 0
1
33
1

+3
+6
3
110

+3
0
0
--

63
0
EOB
0
0
--

Other Operation Modes:


JPEG2000 ROI coding

JPEG 2000

Allow efficient lossy and lossless compression within


a single unified coding framework
Progressive transmission by quality, resolution,
component, or spatial locality
Compressed domain processing
Region of Interest coding
JPEG2000 is NOT an extension of JPEG
Wavelet Transform
An extremely flexible bitstream structure

DCT Transform vs.


Space-Scale Transform

JPEG2000 ROI coding

Bit plane shift


Finer Quantization level used

Experiment

http://www.sfu.ca/~cjenning/toybox/hj
peg/index.html

You might also like