jpeg encoding
TRANSCRIPT
-
8/7/2019 JPEG encoding
1/14
JPEGCOMPRESSI
ONBy :Sunny Duvani (07MC17)
Satya Bhatt (07MC05)
Harsh Brahmbhatt (07MC06)
-
8/7/2019 JPEG encoding
2/14
Typical usage
The JPEG compression algorithm is at its best on
photographs and paintings of realistic scenes with smooth
variations of tone and color.
For web usage, where the amount of data used for an
image is important.
JPEG is also not well suited to files that will undergo
multiple edits, as some image quality will usually be lost
each time the image is decompressed and recompressed
-
8/7/2019 JPEG encoding
3/14
Steps
1. ColorTransformation
2. Down sampling
3. Block Splitting
4. DCT (discrete cosine transform)
5. Quantization & Entropy Encoding
6. Removing Artifacts
-
8/7/2019 JPEG encoding
4/14
Baseline Sequential JPEG Encodingand Decoding
Processes
-
8/7/2019 JPEG encoding
5/14
Color space transformation
First, the image should be converted from RGB into a
different color space called YCBCR (or, informally, YCbCr). It
has three components Y', CB and CR: the Y' component
represents the brightness of a pixel, and the CB and
CR components represent the chrominance .
The compression is more efficient because the brightness
information, which is more important to the eventual perceptual
quality of the image, is confined to a single channel. This more
closely corresponds to the perception of color in the human
visual system. The color transformation also improves
compression by statistical decorrelation.
-
8/7/2019 JPEG encoding
6/14
Downsampling
The transformation into the YCBCR color model to reduce the spatial resolution ofthe Cb and Cr components .The ratios at which the downsampling is ordinarily
done for JPEG images are :
4:4:4 (no downsampling).
4:2:2 (reduction by a factor of 2 in the horizontal direction).
4:2:0 (reduction by a factor of 2 in both the horizontal and vertical directions).
Block splitting
After subsampling, each channel must be split into 88 blocks.
If the data for achannel does not represent an integer num
ber of
block
s then theencoder must fill the remaining area of the incomplete blocks with some form of
dummy data.
Filling the edges with a fixed color (for example, black) can create ringing
artifacts along the visible part of the border.
-
8/7/2019 JPEG encoding
7/14
DCT (Discrete Cosine Transform)
Each 88 block of each component (Y, Cb, Cr) is converted to a frequency-
domain representation, using a normalized, 2D type-II DCT.
Example : DCT of an 8 x 8 Gray Scale Image
8 x 8 Gray Scale Image
-
8/7/2019 JPEG encoding
8/14
For an 8-bit image, each entry in the original block falls in the
range [0,255]. The mid-point of the range (in this case, the value 128)
is subtracted from each entry to produce a data range that is centeredaround zero.
so that the modified range is [ 128,127]. This step reduces the
dynamic range requirements in the DCT processing
-
8/7/2019 JPEG encoding
9/14
TheDiscrete Cosine Functioncan begiven by the Equation
given below :
-
8/7/2019 JPEG encoding
10/14
Quantization
The human eye is good at seeing small differences in brightness over
a relatively large area, but not so good at distinguishing the exact
strength of a high frequency brightness variation.
This allows one to greatly reduce the amount of information in the
high frequency components.
This is done by simply dividing each component in the frequency
domain by a constant for that component, and then rounding to the
nearest integer.
This rounding operation is the only lossy operation in the whole
process if the DCT computation is performed with sufficiently high
precision.
-
8/7/2019 JPEG encoding
11/14
-
8/7/2019 JPEG encoding
12/14
Entropy Encoding
Entropy coding is a special form of lossless data compression. It
involves arranging the image components in a "zigzag" order
employing run-length encoding (RLE) algorithm that groups similar
frequencies together, inserting length coding zeros, and thenusing Huffman coding on what is left.
The previous quantized DC coefficient is used to predict the current
quantized DC coefficient. The difference between the two is encoded
rather than the actual value.
The encoding of the 63 quantized AC coefficients does not use such
prediction differencing.
-
8/7/2019 JPEG encoding
13/14
-
8/7/2019 JPEG encoding
14/14
Compression Ratio & Artifacts
The resulting compression ratio can be varied according to need by
being more or less aggressive in the divisors used in the
quantization phase.
The appropriate level of compression depends on the use to which
the image will be put.
Those who use the World Wide Web may be familiar with the
irregularities known as compression artifacts that appear in JPEG
images, which may take the form of noise around contrasting edges(especially curves and corners), or blocky images, commonly known
as jaggies'.