0% found this document useful (0 votes)
54 views12 pages

Compression:: Source Image Data FDCT Quantizer Compressed Image Data

The document discusses the JPEG image compression standard. It was jointly developed by ISO, CCITT, and IEC. JPEG uses lossy compression and supports several modes including lossless, sequential, progressive, and hierarchical coding. It applies discrete cosine transform (DCT) to image blocks, then quantizes and entropy encodes the DCT coefficients for compression. The inverse process is applied for decompression. Quantization uses adjustable tables to control quality and file size. Common tables include uniform and perceptual variants.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views12 pages

Compression:: Source Image Data FDCT Quantizer Compressed Image Data

The document discusses the JPEG image compression standard. It was jointly developed by ISO, CCITT, and IEC. JPEG uses lossy compression and supports several modes including lossless, sequential, progressive, and hierarchical coding. It applies discrete cosine transform (DCT) to image blocks, then quantizes and entropy encodes the DCT coefficients for compression. The inverse process is applied for decompression. Quantization uses adjustable tables to control quality and file size. Common tables include uniform and perceptual variants.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 12

JPEG

 JPEG (Joint photographic experts group) is joint result by:
o International organization for standardization (ISO)
o International Telegraph and Telephone Consultative Committee (CCITT)
o International Electrotechnical Committee (IEC)
 The JPEG standard includes the following modes of operation:
o Lossless coding
o Sequential coding
o Progressive coding
o Hierarchical coding

Compression:
   Source FDCT Q u a n tiz e r E n tro p y Compressed
Image Data E ncoder Image Data

8x8 blocks
        T a b le         T a b l e
S p e c if ic a t io n s S p e c if ic a t io n s

Decompression:
Compressed Entropy
D e q u a n tiz e r IDCT Reconstructed
Image Data Decoder   Image Data

      Table       Table
Specifications Specifications
Discrete cosine transform
1-dimensional

DCT transform:

N 1
  2 x  1 u 
C  u     u   f  x   cos  
x 0  2N

Inverse transform:

N 1
  2 x  1 u 
f  x      u  C  u   cos  
u 0  2N

Scaling factor:

 1 for u  0
 N
 u  
 2 for u  1,2,..., N 1
 N
Discrete cosine transform
2-dimensional

DCT transform:

N 1 N 1
  2 x  1 u    2 y  1 v 
C  u , v     u   v   f  x, y   cos    cos 
x 0 y 0  2N   2N 

Inverse transform:

N 1 N 1
  2 x  1 u    2 y  1 v 
f  x, y      u   v  C  u , v   cos    cos 
u  0 v 0  2N   2N

DCT basis functions for N=8:

u=0 u=1 u=2 u=3


1.0 1.0 1.0 1.0

0.5 0.5 0.5 0.5

  0   0   0   0

­0.5 ­0.5 ­0.5 ­0.5

­1.0 ­1.0 ­1.0 ­1.0

u=4 u=5 u=6 u=7


1.0 1.0 1.0 1.0

0.5 0.5 0.5 0.5

  0   0   0   0

­0.5 ­0.5 ­0.5 ­0.5

­1.0 ­1.0 ­1.0 ­1.0


2-D DCT basis functions for N=4

v
0 1 2 3

3
Examples of DCT for sample 44 blocks
ORIGINAL TRANSFORMED
IMAGE IMAGE
FLAT
10 10 10 10 40.0 0.0 0.0 0.0
10 10 10 10 0.0 0.0 0.0 0.0
10 10 10 10 0.0 0.0 0.0 0.0
10 10 10 10 0.0 0.0 0.0 0.0
RANDOM TEXTURE
11 15 18 14 58.8 0.3 ­1.8 1.3
14 11 13 12 ­3.9 ­2.8 ­3.5 2.6
15 16 19 12 2.7 ­1.7 1.2 ­3.4
18 17 12 18 3.0 ­0.9 ­5.3 1.8
IMPULSE
10 10 10 10 42.5 1.4 ­2.5 ­3.2
10 20 10 10 1.4 0.7 ­1.4 ­1.8
10 10 10 10 ­2.5 ­1.4 2.5 3.3
10 10 10 10 ­3.2 ­1.8 3.3 4.3
LINE (horizontal)
10 10 10 10 50.0 0.0 0.0 0.0
10 10 10 10 ­5.4 0.0 0.0 0.0
20 20 20 20 ­10.1 0.0 0.0 0.0
10 10 10 10 13.1 0.0 0.0 0.0
EDGE (vertical)
10 10 20 20 60.0 ­18.4 0.0 7.7
10 10 20 20 0.0 0.0 0.0 0.0
10 10 20 20 0.0 0.0 0.0 0.0
10 10 20 20 0.0 0.0 0.0 0.0
EDGE (horizontal)
10 10 10 10 60.0 0.0 0.0 0.0
10 10 10 10 ­18.4 0.0 0.0 0.0
20 20 20 20 0.0 0.0 0.0 0.0
20 20 20 20 7.7 0.0 0.0 0.0
EDGE (diagonal)
10 10 10 10 55.0 ­11.1 0.0 ­0.7
10 10 10 20 ­11.1 5.0 4.6 0.0
10 10 20 20 0.0 4.6 ­5.0 ­1.9
10 20 20 20 ­0.7 0.0 ­1.9 5.0
SLOPE (horizontal)
10 12 14 16 52.0 ­8.9 0.0 ­0.6
10 12 14 16 0.0 0.0 0.0 0.0
10 12 14 16 0.0 0.0 0.0 0.0
10 12 14 16 0.0 0.0 0.0 0.0
Quantization in JPEG

Quantization equation:

c 
ĉi  round  i 
 qi 

- ci is the original transform coefficient (real number)
- q is the quantization factor (ingeteger between 1..255)
- The result is rounded to the nearest integer 

Example of quantization by factor of 2:

10
9
8
7
6
5 5
4 4
3 3
2 2
1 1
0 0

Dequantization:

ri  cˆi  qi
Possible quantization tables:

Uniform quantization More accurate quantization Less accurate quantization


16 16 16 16 16 16 16 16 1 2 2 4 4 8 16 16 8 64 64 128 256 256 256 256
16 16 16 16 16 16 16 16 2 4 8 8 8 16 16 32 64 128 128 128 256 256 256 256
16 16 16 16 16 16 16 16 4 4 8 16 16 16 32 32 128 256 256 256 256 256 256 256
16 16 16 16 16 16 16 16 4 8 16 16 16 32 32 32 256 256 256 256 256 256 256 256
16 16 16 16 16 16 16 16 8 16 16 32 32 32 32 32 256 256 256 256 256 256 256 256
16 16 16 16 16 16 16 16 8 16 16 32 32 32 64 64 256 256 256 256 256 256 256 256
16 16 16 16 16 16 16 16 16 16 32 32 32 32 64 64 256 256 256 256 256 256 256 256
16 16 16 16 16 16 16 16 16 16 32 32 32 64 64 64 256 256 256 256 256 256 256 256

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

Entropy coding:
- Huffman or arithmetic coding.
- The first coefficient (denoted by DC­coefficient) is separately coded from the rest of
the coefficients (AC­coefficients). 
- The DC­coefficient is by predicting from the DC­coefficient of the previous block.
- The prediction error is coded using as in lossless JPEG 
- The AC­coefficients are coded one in the order given by zig­zag scanning 
- Simple run­length coding is applied:
o All sub­sequent zero­value coefficients are coded by the run­length
o Huffman coding is then applied to the non­zero coefficients. 
JPEG for color images:

RGB color images are compressed in JPEG by transforming the image first into YUV (or
YIQ   in   the   case   of   North   America)   and   then   compressing   the   three   color   components
separately.  The chrominance  components  are often sub­sampled so that  22 block of the
original pixels forms a new pixel in the sub­sampled image. The color component images are
then upsampled to their original resolution in the decompression phase.

Progressive mode:

Progressive JPEG is rather trivial. Instead of coding the image block after block, the coding is
divided into several stages. At the first stages the DC­coefficients are coded from each block.
The   decoder   can   get   rather   good   approximation   of   the   image   on   the   basis   on   the
DC­coefficients alone, since they contain the information of the average value of the blocks.
At the second stage, the first significant AC­coefficients (determined by the zig­zag order) are
coded. At the third phase the next significant AC­coefficients are coded, and so on. In total,
there are 64 coefficients in each block, so the progressive coding can have at most 64 stages.
In practice, the progressive coding can be changed back to the sequential order for example
already after the first stage. This is because the DC­coefficients are usually enough for the
decoder to decide whether the image is worth retrieving.

Hierarchical mode:

- A reduced resolution version of the image is compressed 
- followed by the higher resolution versions in increasing order. 
- In each case the resolution is doubled

Example of a block compressed by JPEG:

Original block Transformed block
139 144 149 153 155 155 155 155 235.6 ­1.0 ­12.1 ­5.2 2.1 ­1.7 ­2.7 1.3
144 151 153 156 159 156 156 156 ­22.6 ­17.5 ­6.2 ­3.2 ­2.9 ­0.1 0.4 ­1.2
150 155 160 163 158 156 156 156 ­10.9 ­9.3 ­1.6 1.5 0.2 ­0.9 ­0.6 ­0.1
159 161 162 160 160 159 159 159 ­7.1 ­1.9 0.2 1.5 0.9 ­0.1 0.0 0.3
159 160 161 162 162 155 155 155 ­0.6 ­0.8 1.5 1.6 ­0.1 ­0.7 0.6 1.3
161 161 161 161 160 157 157 157 1.8 ­0.2 1.6 ­0.3 ­0.8 1.5 1.0 ­1.0
162 162 161 163 162 157 157 157 ­1.3 ­0.4 ­0.3 ­1.5 ­0.5 1.7 1.1 ­0.8
162 162 161 161 163 158 158 158 ­2.6 1.6 ­3.8 ­1.8 1.9 1.2 ­0.6 ­0.4
Quantization matrix Quantized coefficients
16 11 10 16 24 40 51 61 15 0 ­1 0 0 0 0 0
12 12 14 19 26 58 60 55 ­2 ­1 0 0 0 0 0 0
14 13 16 24 40 57 69 56 ­1 ­1 0 0 0 0 0 0
14 17 22 29 51 87 80 62 ­1 0 0 0 0 0 0 0
18 22 37 56 68 109 103 77 0 0 0 0 0 0 0 0
24 35 55 64 81 104 113 92 0 0 0 0 0 0 0 0
49 64 78 87 103 121 120 101 0 0 0 0 0 0 0 0
72 92 95 98 112 100 103 99 0 0 0 0 0 0 0 0

Dequantized coefficients Decompressed block
240 0 ­10 0 0 0 0 0 144 146 149 152 154 156 156 156
­24 ­12 0 0 0 0 0 0 148 150 152 154 156 156 156 156
­14 ­13 0 0 0 0 0 0 155 156 157 158 158 157 156 156
0 0 0 0 0 0 0 0 160 161 161 162 161 159 157 155
0 0 0 0 0 0 0 0 163 163 164 163 162 160 158 156
0 0 0 0 0 0 0 0 163 164 164 164 162 160 158 157
0 0 0 0 0 0 0 0 160 161 162 162 162 161 159 158
0 0 0 0 0 0 0 0 158 159 161 161 162 161 159 158
Original JPEG
bpp = 8.00  mse = 0.00 bpp = 1.00  mse = 17.26

JPEG JPEG
bpp = 0.50  mse = 33.08 bpp = 0.25  mse = 79.11

Figure 4.26: Magnifications of Lena compressed by JPEG.

You might also like