This presentation is about JPEG compression algorithm. It briefly describes all the underlying steps in JPEG compression like picture preparation, DCT, Quantization, Rendering and Encoding.
2. WHAT IS IMAGE
COMPRESSION?
Image compression is a type of data
compression applied to digital images, to reduce their
cost for storage or transmission. The objective of image
compression is to reduce irrelevant and redundant image
data in order to be able to store or transmit data in an
efficient form.
3. TYPES OF COMPRESSION
•Lossless image compression is a compression algorithm
that allows the original image to be perfectly
reconstructed from the original data.
•Lossy image compression is a type of compression where
a certain amount of information is discarded which
means that some data are lost and hence the image
cannot be decompressed with 100% originality
4. INTRODUCTION
JPEG (pronounced "jay-peg") is a standardized image
compression mechanism. JPEG stands for Joint
Photographic Experts Group, the original name of the
committee that wrote the standard.
JPEG compresses either full-color or grayscale images,
and works best with photographs and artwork. JPEG uses
a lossy compression method, meaning that the
decompressed image isn't quite the same as the original.
This method fools the eye by using the fact that people
perceive small changes in color less accurately than small
changes in brightness.
5. JPEG COMPRESSION MODES
1.Sequential(lossy): In this mode, 8x8 blocks of the image input are
formatted for compression by scanning the image left to right and top
to bottom. A block consists of 64 samples of one component that make
up the image. Each block of samples is transformed to a block of
coefficients by the forward discrete cosine transform (FDCT). The
coefficients are then quantized and entropy-encoded either with
Huffman encoding or arithmetic encoding.
6. 1. IMAGE PREPARATION
The representation of the colors in the image is
converted from RGB to Y′CBCR, consisting of
one luma component (Y'), representing
brightness, and two chroma components,
(CB and CR), representing color.
Y = Brightness Cb = Color blueness Cr = Color
redness
The resolution of the chroma data is reduced,
usually by a factor of 2 or 3 called chroma
sampling. Chroma subsampling is the practice
of encoding images by implementing less
resolution for chroma information than for
luma information, taking advantage of the
human visual system's lower acuity for color
7. Figure 2 describes the basic parts of a JPEG compression system.
The color image (which is represented by three basic color images
Red, Green, and Blue) are transformed into the equivalent
luminance and chrominance images (Y, U, and V), using the
transform formula as shown in the previous section. The level
offset is included in the color transformation. The chrominance
images U and V then are subsampled by a certain factor to reduce
the number of samples for saving bit-rate.
8. DCT ON IMAGE BLOCKS 8X8
BLOCKS
Each image f(i,j) is divided into 8X8 blocks
Next, each 8×8 block of each component (Y, Cb, Cr)
is converted to a frequency-domain representation,
using a normalized, two-dimensional type-II discrete
cosine transform (DCT).
9. Human vision is insensitive to high frequency
components, due to which it is possible to treat the data
corresponding to high frequencies as redundant. To
segregate the raw image data on the basis of frequency,
it needs to be converted into frequency domain, which is
the primary function of DCT.
10. COEFFICIENT QUANTIZATION
Quantization is the process of reducing the
number of bits needed to store an integer value
by reducing the precision of the integer. Given
a matrix of DCT coefficients, we can generally
reduce the precision of the coefficients more
and more as we move away from the DC
coefficient. This is because the farther away we
are from the DC coefficient, the less the
element contributes to the graphical image,
and therefore, the less we care about
maintaining rigorous precision in its value.
11. The DCT coefficients are then quantized by divided then
for the quantization values defined in the luminance and
chrominance quantization tables. The quantization values
can be set individually for each DCT coefficient, using
criteria based on visibility of the basis functions. The
quantization generates error by its nature. Therefore, the
fault tolerance systems need to distinguish between the
quantization errors and the computer failure errors. This
is one of the challenges in the research project.
12. ZIGZAG SCANNING AND
ENCODING
Zig Zag scanning maps 8 x 8 matrix to a 1 x 64 vector. It
is done to group low frequency coefficients at the top of
the vector and high frequency coefficients at the bottom.
In order to exploit the presence of the large number of
zeros in the quantized matrix, a zigzag of the matrix is
used.
13. Then, in the baseline system, the vector is Huffman coded.
In non-baseline systems, Huffman or the more efficient
arithmetic coding can be applied. In both cases, the
Huffman or arithmetic tables must be available to the
decoder. This supports sequential encoding, where the
image is encoded and decoded in a single run.
DC and AC components finally need to be represented by a
smaller number of bits. Normally a table of code words is
used with the set of code words precomputed using the
Huffman Coding Algorithm. In Huffman Coding, each
DPCM-coded DC coefficient is represented by a pair of
symbols : (Size, Amplitude) where Size indicates number of
bits needed to represent the coefficient and Amplitude
contains actual bits.
14. EXPANDED LOSSY DCT OR
PROGRESSIVE
In addition to the method described previously, JPEG
specifies progressive encoding. Instead of using just one
quantization step, progressive encoding supports several
which are applied iteratively. Basically, the bigger the
quantization block, the less definition is encoded. So,
using an 8x8 quantization table will directly match the
8x8 data blocks extracted from the image in the first
place, and apart from the rounding error, will give a fairly
accurate decompressed image. However, consider the
situation where a 64x64 quantization table is used. Now
8 8x8 blocks will be quantized at a time, resulting in a
significant loss in precision. The greater the quantization
table, the lower the overall precision of the
decompressed image. However, if many quantization
tables are used and reapplied to the same DCT-
coefficients, then as the image is being decompressed, it
will be possible to gradually discern more and more
definition.
15. LOSSLESS MODE
This mode exists because the discrete cosine transform (DCT)
based form cannot guarantee that encoder input would exactly
match decoder output. Unlike the lossy mode which is based on
the DCT, the lossless coding process employs a simple
predictive coding model called differential pulse-code
modulation (DPCM). This is a model in which predictions of the
sample values are estimated from the neighboring samples that
are already coded in the image. Most predictors take the average
of the samples immediately above and to the left of the target
sample. DPCM encodes the differences between the predicted
samples instead of encoding each sample independently. The
differences from one sample to the next are usually close to
zero.
16. HIERARCHICAL MODE
In hierarchical coding scheme the image is first sub-
sampled by 2 in (both) dimension(s). This new reduced
size image is encoded using one of the sequential,
progressive or loss-less modes described previously.
Then the encoded reduced-size image is decoded and
up sampled by 2 horizontally and/or vertically. This up
sampled image is used as a prediction of the original
image at this resolution and the difference image is
computed. The difference image (called the differential
frame) is then encoded and finally, the last two steps are
repeated until the original image at full resolution has
been encoded.
17. ADVANTAGES OF JPEG
1. Wide range: It is commonly used by digital cameras to
store photos since it supports 224 or 16,777,216
colors. The format also supports varying levels
of compression, which makes it ideal for web
graphics.
2. Compression: The JPEG compression algorithm may
reduce the file size of a bitmap (BMP) image by ten
times with almost no degradation in quality. Still, the
compression algorithm is lossy, meaning some image
quality is lost during the compression process. For
this reason, professional digital photographers often
choose to capture images in a raw format so they can
edit their photos in the highest quality possible. They
typically export the pictures as JPEG (.JPG) images
when they are shared or published on the web.
18. 3. High Resolution: One of the notable advantages of the JPEG
standard is that it supports 24-bit color with up to 16 million
colors. Hence, it has been widely used for compressing and
encoding digital images with high resolutions.
4. Smaller File Size: When compared to the PNG file format, JPEG
has the advantage of compressing a digital image at a smaller
file size. In other words, a JPEG image with a relatively similar
quality and resolution as its PNG counterpart can have a
smaller size. This makes the standard more suitable for
storage, online distribution, and online consumption.
5. Adjustable Compression: Another interesting feature of the
JPEF standard is that users can adjust the degree of the
compression of a particular digital image. More specifically,
users can find the right balance or tradeoff between image
quality and file size
19. DISADVANTAGES
1. Lossy Compression: A key disadvantage of the JPEG
standard is that it is lossy compression. To be specific,
this standard works by dropping unneeded color data as
it compresses the digital image. Note that editing and
resaving the image lead to quality degradation.
2. Inflexible Application: The standard is ideal for digital
images with smooth variations in colors such as portraits
and nature photographs. However, it is not ideal for
images with texts or sharp lines and edges. The standard
specifically produces noticeable artifacts along the edges
of two or more colors and objects.
3. No Support for Opacity: Unlike the PNG format,
another drawback of the JPEG standard is that it does not
support opacity or transparency. Raw digital images with
opaque or transparent areas would be saved with a solid
white color under the JPEG format.