1 / 43

JPEG - PowerPoint PPT Presentation

  • Uploaded on

JPEG. Introduction. JPEG (Joint Photographic Experts Group) Basic Concept Data compression is performed in the frequency domain. Low frequency components are retained. High frequency components are truncated. JPEG System Overview.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' JPEG' - norina

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript


  • JPEG (Joint Photographic Experts Group)

  • Basic Concept

    Data compression is performed in the frequency domain.

    Low frequency components are retained.

    High frequency components are truncated

Jpeg system overview
JPEG System Overview

  • The JPEG is a transform coding scheme. Its encoding process can be separated into 3 stages:









Color Transform

  • Process the data in blocks of 8×8 samples

  • Convert RGB into Luminance (Y) and Chrominance (Cr and Cb).

  • Use half resolution for Chrominance (because eye is more sensitive to Luminance)

Discrete Cosine Transform

  • Transform each block of 8×8 samples into 64 DCT coefficients

    • energy tends to be concentrated into a few significant coefficients

Quantization (I)

  • Divide each DCT coefficient by an integer, discard remainder

  • Typically, a few non-zero coefficients are left.

Dct transform
DCT Transform

  • The JPEG is based on the 8 × 8 DCT.

  • To use the DCT ,we first divide an image into non-overlapping 8 × 8 blocks.

  • Let x(n,m), 0≦n,m≦7, be the pixel values in the block.

  • Let X(u,v), 0≦u,v≦7, be the DCT coefficients.

The X(u,v) and x(n,m) are related by



N = 8


In the JPEG,each of the 64 resulting DCT coefficients is quantized by an uniform scalar quantizer according to the following equation:

where Xq(u,v) is the quantized coefficient and

Note that Q should be the same at the encoder and decoder.

Given Xq(u,v) and Q(u,v), 0≦ u,v≦ 7,the dequantized DCT coefficients Xr(u,v),

0≦ u,v≦ 7, are then obtained by

Xr(u,v) = Xq(u,v) Q(u,v)


  • Original Image block x(m,n)

Bitstream formation
Bitstream Formation

Here we use the Huffman code to form bitstream representing the quantized DCT coefficients.

Before performing the Huffman coding, all the

quantized coefficients are separated into two


(1)DC coefficient: Xq(0,0)

(2)AC coefficients: Xq(u,v), u≠0 or v≠ 0

These two groups are encoded independently.

Dc coefficient
DC coefficient

The encoding of the DC coefficient is based on the DIFFf value ,defined as

DIFFf = Xqf(0,0)-Xqf-1(0,0)


Xqf(0,0) = The DC coefficient of the

current block.

Xqf-1(0,0) = The DC coefficient of the

previous block.

The DIFFf values are classified into 12 classes (Table1).


The Huffman code representing each

class is shown in Table2.


When diff f class 0 diff f is represented by codeword 00
When DIFFf class 0,DIFFf is represented by codeword 00.

When DIFFf classes 1-11 ,the representation of DIFFf consists of two parts:

The extra bits can be expressed in the following form
The Extra Bits can be expressed in the following form:

Extra Bits = Sign bit + Amplitude

When DIFFf> 0,Sign bit = 1

When DIFFf< 0, Sign bit = 0

When DIFFf> 0:

Amplitude=Lower-order bit of DIFFf

(MSB is not include.)

When DIFFf< 0:

Amplitude = 1’s complement of

lower-order bits of |DIFFf|


If DIFFf= 5,then it is represented as

If DIFFf = -5,then it is represented as

Ac coefficients
AC coefficients

The Huffman coding of the AC coefficients can be separated into three stages:

Stage 1: ZigZag ordering of AC


Stage 2: Run/Size Representation of

Nonzero AC coefficients.

Stage 3: Huffman encoding based on

the Run/Size Representation.

Run size representation
Run/Size Representation

Because many AC coefficients become zero after quantization, runs of zeros along the zigzag scan are identified and compacted.

Each nonzero AC coefficientis descibed

by a composite R/S,where R(Run) is

a 4-bit zero-run from the previous

non-zero value, and S(Size) represents

the size of the non-zero AC coefficient.

Huffman encoding
Huffman Encoding 3.

A Huffman table has been generated for each composite R/S. The Huffman encoding process of the AC coefficients is based on the table.

The additional bits to the Huffman codes are the same as those for coding the DC coefficients.

There are two special cases that describe some attention : 3.

Case 1 : all the remaining coefficientsalong the zigzag scan are zero.

In this case,we set R/S =x’00’, which is coded as an EOB code of 1010.

Case 2 : zero-run are greater than 16. 3.

In this case ,we set R/S = x’F0’(15 zero-

runs and 1 zero value).

Therefore 16 zero-runs are coded. The

same procedure is repeated until the

length of zero-runs is less than 16.

Example 3.

Consider the Xq matrix shown below:

After the zig-zag ordering process ,we have

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

To encode 39 , we first have to compute DIFF 3.f , Note that Xqf(0,0) = 39 ,Assume

Xqf-1(0,0) = 34.

Then DIFFf= 5 ,From the previous example,

We conclude that 39 can be encoded as 100101

The first AC coefficient is –3. 3.

The R and S values for –3 is R=0 and S=2 ,


The corresponding Huffman code is 01. Consequently, -3 is encoded as

Proceed in the similar fashion ,we have


Note that the last nonzero coefficient –1 has R=5 and S=1. 3.

The Huffman code therefore is 1111010. Consequently, -1 is encode as

A total of 35 bits are needed to deliver this block. The bit rate for this block is

Discussions 3.

  • The major drawbacks of JPEG are:

    • The algorithm may have block artifact.

    • It is difficult to perform accurate rate control.