Вы находитесь на странице: 1из 6

Chapter 9

Jpeg Image Compression


Lossy data Compression used for compressing images and video files (our eyes cannot
distinguish subtle changes, so lossy data is acceptable).

It includes

Image/JPEG: compress pictures and graphics

MPEG: compress video

MP3: compress audio

These methods are cheaper, less time and space.

Image Compression Standards

JPEG (Joint Photographic Experts Group)

an image compression standard

accepted as an international standard in 1992.

a lossy image compression method by using DCT

Useful when image contents change relatively slowly

human less to notice loss of very high spatial frequency component

Visual acuity is much greater for gray than for color.

Unlike audio data image data is defined over spatial domain, hence a DCT is applied to
reduce the high frequency contents of the spatial domain. Generally an image contains a
spatial redundancy i.e. similar image data is repeated for successive pixels. Such set of
pixels data is descretized by using DCT.

Basic Idea:
Block Diagram for Jpeg Compression

Main Steps in JPEG Image Compression

Transform RGB to YIQ or YUV and subsample color.

Perform DCT on image blocks.

Apply Quantization and Compression.

Perform Zig-zag ordering and run-length encoding.

Perform Entropy coding.

1. Transform RGB to YIQ and YUV

JPEG works for both color and grayscale images.Int he case of color images, such as YIQ or
YUV the Encode works on each component separately, using the same routines. If the source
image is in a different color format, the encoder performs a color-space conversion to YIQ or
YUV .

2. Perform DCT on Image Blocks

2D Each image is divided into 8X8 blocks. DCT is applied to each block image f(i,j), with output
being the DCT coefficients F(u,v) for each block.The choice of a small block size in JPEG is a
compromise reached by the committee:a number larger than 8 would have made accuracy at low
frequencies better, but using 8 makes the DCT computation very fast.It isolates the each block
from its neighbouring context.It makes image choppy(blocky) when the user specifies high
compression ratio.

3.Quantization and Compression: The quantization step in JPEG is aimed at reducing the total
number of bits needed for a compressed image. It consists of simple dividing each entry in the
frequency space block by an integer, than rounding

After T table is created, the values are quantized to reduce


the number of bits needed for encoding. Quantization divides the number of bits by a constant,
then drops the fraction. This is done to optimize the number of bits and the number of 0s for each
particular application.

Compression:

Quantized values are read from the table and redundant 0s are removed.

To cluster the 0s together, the table is read diagonally in an zigzag fashion.


The reason is if the table doesnt have fine changes, the bottom right
corner of the table is all 0s.

JPEG usually uses lossless run-length encoding at the compression phase.

F(u,v) represents a DCT coefficient, Q(u,v) is a quantization matrix" entry, and ^ F(u,v)
represents the quantized DCT coefficients which JPEG will use in the succeeding entropy coding

4. Zig-zag ordering and run-length encoding

RLC on AC coefficients

make to hit a long run of zeros: a zig-zag scan used to turn the 8X8 matrix
into a 64-vector.
5. Entropy coding:

The resultant code after Zig-Zag scan will undergo an Entropy coding. It uses Huffman coding
and supports only 8-bit pixel in the original images.

Chapter 10: Video Compression

Video compression based on Motion compensation:


The image compression techniques exploits spatial redundancy, the phenomenon that picture
contents often change relatively slowly across images, making a large suppression of higher
spatial frequency components viable.

A video can be viewed as a sequence of images in the temporal dimension. Since the frame rate
of the video is often relatively high (15 frames per second) and the camera parameters (focal
length, position, viewing angle) usually do not change rapidly between frames, the contents of
the consecutive frames are usually similar, unless certain objects in the scene move extremely
fast. In other words the video has temporal redundancy.

Temporal redundancy is often significant and it is exploited, so that not every frame of the video
needs to be code independently as a new image. Instead the difference between the current frame
end other frames in the sequence is coded. if redundancy between them is great enough, the
difference images could consists mainly of small values and low entropy, which is good for
compression.

The simplistic way of deriving the difference image is to subtract one image from the other
(pixel by pixel), such an approach is ineffective in yielding a high compression ratio. Since the
main cause of the difference between frames is cameras and/or object motion, these motion
generators can be compensated by detecting the displacement of corresponding pixels or regions
in these frames and measuring their differences. Video compression algorithms that adopt this
approach are said to be based on motion compensation.

It includes

1. Motion Estimation (motion vector search)

2. Motion compensation based prediction

3. Derivation of the prediction error-The difference.


For efficiency each image is divided in to macro blocks of size N*N. By default N=16 for
luminance images. For chromatic images N=8 if 4:2:0 chroma sub sampling is adopted. Motion
compensation is not performed at the pixel level, nor at the level of video object, But at macro
block level.

The current image is referred to as the Target frame A match is sought between the macro block
under consideration in the Target frame and the most similar macro block in previous and/or
future frames[referred as reference frame].In that sense, Target macro block is predicted from the
Reference macro blocks.

The displacement for the reference macro block to the target macro block is called a motion
vector MV. If a reference frame is previous frame to Target frame it is called forward prediction.
If a reference frame is a future frame to Target frame it is called as Back ward prediction. The
difference of the two corresponding macro blocks is the prediction error.

For video compression based on motion compensation, after the first frame, only the motion
vectors and difference macro blocks need to be coded, since they are sufficient for the decoder to
regenerate all macro blocks in subsequent frames.

Вам также может понравиться