320 likes | 368 Views
JPEG Image Coding Standard. Jianping Fan. Department of Computer Science. University of North Carolina at Charlotte. Charlotte, NC 28223. jfan@uncc.edu. http://www.cs.uncc.edu/~jfan. 1. What’s meaning of JPEG ?. JPEG: Joint Photographic Experts Group. 2. Why we need JPEG ?.
E N D
JPEG Image Coding Standard Jianping Fan Department of Computer Science University of North Carolina at Charlotte Charlotte, NC 28223 jfan@uncc.edu http://www.cs.uncc.edu/~jfan
1. What’s meaning of JPEG? JPEG: Joint Photographic Experts Group 2. Why we need JPEG? a. Save our money for storage and transmission b. Good tradeoff between image quality and compression ratio c. Easy for VLSI chip design and software design d. Reasonable computation complexity e. Useful for most image source
3. Color Space for Image Representation RGB: (red, green, & blue) for image display R white black R=G=B G B Any color can be represented as a combination of R, G, B!
3. Color Space for Image Representation How to generate and display an image? Red sensor amplifier scene green sensor lens amplifier Blue sensor amplifier
4. Color Space for Image Coding RGB space is good for image display but not good for image coding because the separation of colors is not so efficient! YUV space: Y: luminance component (gray level version of the image) U & V: chrominance components (give the information to convert a gray level image to color image). Y = 0.299R + 0.587G + 0.114B U = 0.564(B-Y) V = 0.713(B-Y)
5. Color Space for Human Vision System Color spaces for image processing HSV: H: Hue S: Saturation V: Value
6. Image Quality Image resolution is related to the quality of image (fine details), storage size, …. Software MPEG 120*160 Workstation: 900*1152 Advanced TV: 720*1280 SIF image: 240*320 HDTV: 1080*1920 VGA: 480*640 XGA: 1024*768 VGA: video graphics array PC monitor: 600*800
7. JPEG Encoder JPEG encoder 010010000….. 1:80 Compressed image size Original image size 352*288*8 + 2*176*144*8 = 1216512 bits 15206 bits Spatial correlations among neighboring pixels
7. JPEG Encoder • Why we can reduce the bit rate? • How we can reduce the bit rate? Or • Why images can be compressed? • How can we compress images?
7. JPEG Encoder Spatial similarity or redundancy between the pixels How to exploit such spatial similarity or redundancy?
7. JPEG Encoder How to exploit such spatial similarity or redundancy? ---- Data Transformation Energy Concentration 2550 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 DCT 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0
7. JPEG Encoder JPEG Encoder Compressed image data stream Entropy encoder DCT quantizer 100111000…….. table table Reconstructed image JPEG Decoder Compressed image data stream Entropy decoder Dequantizer IDCT 100111000…….. IDCT: inverse DCT table table
8. How to realize JPEG Encoder? a. Image partition for coding: Macroblock Y block DCT U V Entropy coding 10010100010…………
8. How to realize JPEG Encoder? a. Image partition for coding: Macroblock Y block DCT U V Why uses 8x8 blocks? Entropy coding
8. How to realize JPEG Encoder? b. DCT (Discrete Cosine Transformation): 2550 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 DCT 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 Why DCT is helpful?
8. How to realize JPEG Encoder? c. Why we use DCT? DC Coefficient: average image component AC Coefficients: variance between original image and average 8 low Most energy of an image may concentrate on the low-frequency region! high What we can gain from this property? 8
8. How to realize JPEG Encoder? d. Quantization Fq(u,v) = Round {F(u,v)/Q(u,v)} Q(u,v) is defined by: Scale*q(u,v) q(u,v) is a table as: u 8 v 50
8. How to realize JPEG Encoder? e. Why we use quantization? If 16<x<32, [x] = 24; Just use one value! Quantization reduces the amplitude of the coefficients which contribute little or nothing to the quality of image! More zero high frequency coefficients!
8. How to realize JPEG Encoder? f. Zigzag scan Zigzag 255 217 120 110 0 0 0 0 7 2 2 1 0 0 0 0 120 110 0 0 0 0 0 0 5 3 0 0 0 0 0 0 DCT 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 120 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Run-length code Quantization (5,0), (2,0), (2,0), (3,4), (1,4), (1,41) Recall: what we can gain from this?
8. How to realize JPEG Encoder? g. Coding of DC Coefficient: DC(i,j) = DCi - DCj DCi DCj Adjacent blocks may have similar average intensities! DC(i,j) is small!
8. How to realize JPEG Encoder? h. Entropy Coding (table searching) Table & Table searching for DC coding: DC difference 3 100 Huffman codes 2 10 1 0 0 skip -1 1 -2 11 -3 101 Can you image the maximum value for DC? What you find from this table?
8. How to realize JPEG Encoder? h. Entropy Coding (table searching) Table & Table searching for AC coding: s: 0 for positive; 1 for negative. (run, length) code (run, length) code (30,1) 0000 0000 0001 1011s (0,1) 1s (0,2) 0100s How to design more efficient Huffman table searching technique?
9. Quality vs. Compression Ratio GIF JPEG 1:20
9. Quality vs. Compression Ratio original 1:8 1:50 1:15
10. Why not use large size blocks? Why not take whole image as a coding block? Why we can achieve image compression?
11. JPEG2000 & Hierarchical Coding Question: what kind of image can be compressed efficiently? a.wavelet transform b.scalable coding