You are on page 1of 28

Media Compression Techniques

The JPEG Standard 

JPEG(Joint Photographic Experts Group) is an image compression standard which was accepted as an international standard in 1992.  Developed by the Joint Photographic Expert Group of the ISO/IEC  JPEG is a commonly used method of lossy compression for digital photography (image)  For coding and compression of color/gray scale images  Yields acceptable compression in the 10:1 range  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 very popular. JPEG/Exif is also the most common format saved by digital cameras.

~150KB JPEG compressed. Losslessly compressed image.JPEG Compression: Basics    Human vision is insensitive to high spatial frequencies JPEG Takes advantage of this by compressing high frequencies more plainly and storing image as frequency data JPEG is a ³lossy´ compression scheme. ~14KB .

with Chrominance sub sampled due to human vision insensitivity Uncompressed spatial color data components are stored in quantized values (8.Digital Image Representation    JPEG can handle arbitrary color spaces (RGB. etc). 24bit. CMYK. YCbCr (separates colors into grayscale components) Luminance(It describes the amount of light that passes through)/Chrominance (Chrominance is usually represented as two color-difference components) commonly used. . 16.

JPEG Encoding Overview  The main steps in JPEG encoding are the following  Transform RGB to Y CBCRand subsample color  DCT on 8x8 image blocks (The DCT transforms an 8™8 block of input values to a linear combination of 64 patterns.  Quantization  Zig-zag ordering and run-length encoding  Entropy coding .

and lowfrequency information present in the image.) Apply quantization to high spatial frequency components Huffman compression will losslessly remove the redundancies. We can discard highfrequency data easily without losing low-frequency information. resulting in smaller JPEG data   8x8 pixel blocks DCT Frequency Dependent quantization Zig-zag scan Huffman encoding Entropy coding Quantization Table Output(Encod ed JPEG image) .Flow Chart of JPEG Compression Process   Divide image into 8x8 pixel blocks Apply 2D Discrete Cosine Transform (DCT) Transform (The point of doing it is that we have now separated out the high.

... .JPEG Compression Process Image Take 8x8 Pixel Blocks Discrete Cosine Transform Quantizer Binary Encoder .1011001..

. ..JPEG Compression Process Image Take 8x8 Pixel Blocks Discrete Cosine Transform Quantizer Binary Encoder .1011001...

1011001...JPEG Compression Process Image Take 8x8 Pixel Blocks Discrete Cosine Transform Quantizer Binary Encoder .. Bk1 ..k2 ! N1 1 N 2 1 § i !0 ¨ T k1 .

2i  1 ¸ ¨ T k 2 .

2 j  1 ¸ § 4 Aij cos © 2 N ¹ cos © 2 N ¹ j !0 1 2 ª º ª º .

... but not so good at distinguishing the exact strength of a high frequency variation.JPEG Compression Process Image Take 8x8 Pixel Blocks Discrete Cosine Transform Quantizer Binary Encoder . This is done by simply dividing each component in the frequency domain by a constant for that component. This allows one to greatly reduce the amount of information in the high frequency components.1011001. with . and then rounding to the nearest integer Weights the various spectral coefficients according to their importance.. Quantization: The human eye is good at seeing small differences in brightness over a relatively large area.

JPEG encoding and decoding processes .

each entry in the original block falls in the range [0.255] modified range is [ 128.For an 8-bit image.127]. The DCT transforms an 8™8 block of input values to a linear combination of these 64 patterns .

Quantization Matrix The quantized DCT coefficients are computed with .

26 3 2 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 1 5 1 1 2 1 0 0 0 0 3 2 0 1 0 0 0 0 0 0 0 0 0 Zigzag ordering of JPEG image components 0 0 0 0 .

. low bits per channel. whereas JPEG is better for 16-bit images.GIF 89a Image Compression    Compuserve¶s image compression format Best for images with sharp edges. computer graphics where JPEG spatial averaging is inadequate Usually used with 8-bit images.

animated GIFs contain multiple images which stream to create an animation effect. and can produce very large files. GIF images are compressed using the LempelZiv-Welch (LZW) lossless data compression technique to reduce the file size without degrading the visual quality . An animated GIF can loop endlessly are not scalable.cont..     Though not technically movies.

The color limitation makes the GIF format unsuitable for reproducing color photographs and other images with continuous color.). but it is well-suited for simpler images such as graphics or logos with solid areas of color. It also supports animations and allows a separate palette of 256 colors for each frame. The colors are chosen from the 24-bit RGB color space. .   The format supports up to 8 bits per pixel thus allowing a single image to reference a palette of up to 256 distinct colors.

The GIF Format Control block A file generated from the grammar <GIF Data Stream> ::= Header <Logical Screen><Data>* Trailer <Logical Stream> ::= Logical Screen Descriptor [Global Color Table] <Data> ::= <Graphic Block> <Special Purpose Block> <Graphic Block> ::= [Graphic Control Extension] <Graphic Rendering Block> <Graphic Rendering Block> ::= <Table-Based Image> | Plain Text Extension <Table-Based Image> ::= Image Descriptor [Local Color Table] Image Data <Special Purpose Block> ::= Application Extension | Comment Extension Not used for decoding .

The GIF Format  Structure of a block   Block Size:byte Data Value: byte Logical Screen Width Logical Screen Height Packed Bits      Logical Screen Descriptor    Global Color Table Flag Color Resolution: number of bits per primary color .1 Sort Flag Size of Global Color Table   Background Color Index Pixel Aspect Ratio .

The GIF Format  Image Descriptor       Image Separator Image Left Position Image Top Position Image Width Image Height Packed Fields     Local Color Table Flag Interlace Flag: Interlace patter is 4-pass Sort Flag Size of Local Color Table .

The GIF Format  Table-Based Image Data  LZW Minimum Code Size: same as number of color bits  Compression Steps     Establish Code Size Perform Compression Build Series of Bytes Package bytes into blocks  Image Data in sub-blocks of at most 255 bytes Extension Introducer Graphic Control Labrl Block Size Packed Bits   Graphic Control Extension     Disposal method. user input flag. transparent color flag   Delay Time Transparent Color Index .

.

MPEG Audio basics    The MPEG compression methodology is considered asymmetric as the encoder is more complex than the decoder.[1] The encoder needs to be algorithmic or adaptive whereas the decoder is 'dumb' and carries out fixed Stereo audio streams contain largely redundant information MPEG audio compression takes advantage of these facts to reduce extent and detail of mostly inaudible frequency ranges .

It describes a combination of lossy video compression and lossy audio data compression methods which permit storage and transmission of movies using currently available storage media and transmission bandwidth.  MPEG-2 is a standard for "the generic coding of moving pictures and associated audio information". .

TV stations. MPEG-2 was the second of several standards developed by the Moving Pictures Expert Group (MPEG) and is an international standard (ISO/IEC 13818). cable. TV receivers.  MPEG-2 is widely used as the format of digital television signals that are broadcast by terrestrial (over-the-air). DVD players. It also specifies the format of movies and other programs that are distributed on DVD and similar discs. As such. and direct broadcast satellite TV systems. and other equipment are often designed to this standard. .

MPEG-2 Advanced Audio Coding (AAC) codec (next generation)     Sampling frequencies from 8kHz to 96kHz 1 to 48 channels per stream Temporal Noise Shaping (TNS) smooths quantization noise by making frequency domain predictions Prediction: Allows predictable sound patterns such as speech to be predicted and compressed with better quality .

MPEG-Layer3 Overview MP3 Compression Flow Chart .

Conclusion   Media compression is indispensable even as storage and streaming capacities increase Future goals oriented towards increasing ease of access to media information (similar to google for text based information) .