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.
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.
JPEG
Data compression is performed in the frequency domain.
Low frequency components are retained.
High frequency components are truncated
Color
Transform
Discrete
Cosine
Transform
Quantization
Bitstream
Formation
Color Transform
Discrete Cosine Transform
Quantization (I)
Quantization (II)
The X(u,v) and x(n,m) are related by
where
and
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
is the quantization table.
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)
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
groups:
(1)DC coefficient: Xq(0,0)
(2)AC coefficients: Xq(u,v), u≠0 or v≠ 0
These two groups are encoded independently.
The encoding of the DC coefficient is based on the DIFFf value ,defined as
DIFFf = Xqf(0,0)-Xqf-1(0,0)
where
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).
TABLE 1
The Huffman code representing each
class is shown in Table2.
TABLE 2
When DIFFf classes 1-11 ,the representation of DIFFf consists of two parts:
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
The Huffman coding of the AC coefficients can be separated into three stages:
Stage 1: ZigZag ordering of AC
coefficients.
Stage 2: Run/Size Representation of
Nonzero AC coefficients.
Stage 3: Huffman encoding based on
the 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.
TABLE 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 :
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.
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.
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 DIFFf , 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.
The R and S values for –3 is R=0 and S=2 ,
respectively.
The corresponding Huffman code is 01. Consequently, -3 is encoded as
Proceed in the similar fashion ,we have
(100101/0100/0110/001/000/001/11110100/1010)
Note that the last nonzero coefficient –1 has R=5 and S=1.
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