Download presentation
Presentation is loading. Please wait.
Published byRussell Brandon Burns Modified over 9 years ago
1
Introduction to JPEG Alireza Shafaei (79136107) Fall 2005
2
Bitmap Images RGB Color Model (Red, Green & Blue) 3 bytes of Information for each Pixel: 1 byte for Red, 1 byte for Green & 1 byte for Blue Memory space of a 640 × 480 24-bit RGB color image: 640 × 480 = 307,200 pixels 307,200 × 3 = 921,600 bytes = 900 kilobytes Image Compression Methods (like JPEG)
3
What is JPEG? “Joint Photographic Expert Group”, A joint effort by the CCITT and the ISO. (1991) An Image Compression Method for continuous- tone still images, both grayscale and color. Facts on Human Visual System used in JPEG: 1. The eye seems to be more sensitive at the luminance of a colour than at the nuance of that colour. (Y & C b C r ) 2. The eye is much more sensitive to lower spatial frequencies than to higher frequencies
4
JPEG Encoding Steps JPEG Baseline Sequential Mode: 1. Color Space Transformation & Sampling 2. DCT 3. Quantization 4. Zig-Zag Scan 5. DPCM & RLE 6. Entropy Coding
5
Color Space Transformation RGB to YC b C r Y is Luminance (Brightness). C b C r is the Chrominance. Sampling: RGB Y CbCb CrCr + (Down Sampling)
6
RGB to YC b C r First the image is divided into 8x8 blocks. RGB YY YY CbCb CrCr + 8 8 8 8 8 8 88 8 8 8 4 x 64 x 3 byte 4 x 64 x 1 byte 2 x 64 x 1 byte Y =0.299 R+0.587 G + 0.114 B Cb =- 0.169 R-0.331 G + 0.500 B Cr =0.500 R-0.419 G - 0.081 B
7
Discrete Cosine Transform (DCT) DCT Coefficients s xy DCT 8 88 8
8
DCT (cont’d) Why we apply DCT? To move from Spatial Domain to Frequency Domain. Why not FFT? DCT is like FFT, but can approximate linear signals well with few [real] coefficients. DCT is slow 1024 multiplications and 896 additions. JPEG 2000: Wavelet Transforms.
9
Quantization DCT Coefficients are 12 bits per sample. Why Quantization? To reduce number of bits per sample. F'[u, v] = round ( F[u, v] / Q[u, v] ) Two Quantization Tables are used in JPEG Header File (Q Y & Q CbCr ). Quantization error is the main source of the Lossy Compression.
10
Zig Zag Scan 8x8 Blocks to a 1x64 Vector. Why Zig Zag Scan? To sort 8x8 DCT coefficients based on the spatial frequencies (low frequency coefficients in top of vector). 012...63 DC Component (No Frequency) Highest Frequency 1x64 Vector:
11
DPCM & RLE 1. DPCM on DC Component Differential Pulse Code Modulation. DC component is large and varied, but often close to previous value. 2. RLE on AC Components Zero Run Length Encoding. 1 x 64 vector has lots of zeros in it. 57,45,0,0,0,0,23,0,-30,-16,0,0,1,0,0,0, 0, 0,0, only 0,..,0 RLC: (0,57); (0,45); (4,23); (1,-30); (0,-16); (2,1); EOB EOB = (0,0)
12
Entropy Coding Entropy Coding is a form of compression that relies on developing "code" words in a library for the input values or "symbols". Huffman Coding in JPEG. 4 Huffman Tables are stored in JPEG Header File: 2 tables for DC Component (Y & C b C r ) 2 tables for AC Components (Y & C b C r )
13
JPEG Encoding Diagram
14
JPEG Decoding Inverse of Encoding. Steps: 1. Decode Huffman Bit Stream 2. Decode DC Component (DPCM) and AC Components (RLE) 3. Unpack Anti-ZigZag 4. Multiply by Quantization 5. Apply Inverse DCT 6. YC b C r to RGB
15
JPEG Decoding (cont’d) Inverse DCT: YC b C r to RGB:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.