220 likes | 339 Views
The JPEG Standard. J. D. Huang Graduate Institute of Communication Engineering National Taiwan University, Taipei, Taiwan, ROC. 1. Introduction. JPEG standard is a collaboration among : International Telecommunication Union (ITU) International Organization for Standardization (ISO)
E N D
The JPEG Standard J. D. Huang Graduate Institute of Communication Engineering National Taiwan University, Taipei, Taiwan, ROC
1. Introduction • JPEG standard is a collaboration among : • International Telecommunication Union (ITU) • International Organization for Standardization (ISO) • International Electrotechnical Commission (IEC) • The official names of JPEG : • Joint Photographic Experts Group • ISO/IEC 10918-1 Digital compression and coding of continuous-tone still image • ITU-T Recommendation T.81 Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
1. Introduction • JPEG have the following mods : • Lossless mode, predictive coding • Sequential mode, DCT-based coding • Progressive mode, DCT-based coding • Hierarchical mode • Baseline system • Sequential mode, DCT-based coding, Huffman coding for entropy encoding • The most widely used mode in practice Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
1. Introduction HuffmanTable AC Zig-zag reordering Huffmancoding Color components(Y, Cb, or Cr) 88 FDCT Quantizer JPEGbit-stream DifferenceEncoding Huffmancoding DC QuantizationTable HuffmanTable Figure 1. Baseline JPEG encoder Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
2. Color Space Conversion (a) translate from RGB to YCbCr (b) translate from YCbCr to RGB Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
3. Downsampling W W W Y Y Y H H H W W W Cb Cb Cb H H H W W W Cr Cr Cr H H H (a) 4:4:4 (b) 4:2:2 (c) 4:2:0 Figure 2. Three color format in the baseline system Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
4. Discrete Cosine Transform Forward DCT: Inverse DCT: Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
4. Discrete Cosine Transform u 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 v The 8x8 DCT basis Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
4. Discrete Cosine Transform Example : W Y H the luminance of an image 8x8 values of luminance DCT 8x8 DCT coefficiences Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
5. Quantization Figure 3. Luminance and Chrominance quantization matrix Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
5. Quantization Example : F(u,v) 8x8 DCT coefficiences Q(u,v) Quantization matrix Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
5. Quantization Example : Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
6. Zig-Zag Reordering Figure 4. Zig-Zag reordering matrix Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
6. Zig-Zag Reordering Example : Zig-Zag Reordering : 44, 4,-11, 6,-6,6, 5,-5,2,-3, -9,1,4,-4,1, -1,2,2,-1,-2,4, -1,0,0,-2,0,0,0, 0,0,0,1,0,1,-1,0, -1,0,-1,0,0,0,0, 0,0,0,-1,0,0, 0,1,0,0,0, 0,0,0,0, 0,0,0, 0,0, 0 Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
7. Zero Run Length Coding • Example 1 • 63 AC coefficience: • 57, 45, 0, 0, 0, 0, 23, 0, -30, -16, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,..., 0 • Run Length Coding : • (0,57) ; (0,45) ; (4,23) ; (1,-30) ; (0,-16) ; (2,1) ; EOB • Example 2 • 63 AC coefficience: • 57, 0, 0, ... , 0, 3, 0, 0, 0, 0, 2, 0, 0, ... , 0, 895, EOB • Run Length Coding : • (0,57) ; (15,0) ; (2,3) ; (4,2) ; (15,0) ; (15,0) ; (1,895) ; (0,0) 50 zeros (0,0) 18 zeros 33 zeros Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
8. Difference Coding Decode : DCi = DCi1 + Diffi Encode : Diffi = DCi DCi1 Diffi1= DCi1 DCi2 Diffi= DCi DCi1 Diff1=DC1 … … DC0 DC1 DCi1 DCi 0 … … block i1 block 1 block i Figure 5. DCs of 88 blocks Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
9. Huffman Coding Figure 6. Table of values and bits for the value Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
9. Huffman Coding • Example Run lenth coding of 63 AC coefficiences : (0,57) ; (0,45) ; (4,23) ; (1,-30) ; (0,-8) ; (2,1) ; (0,0) Encode the right value of these pair as category and bits for the value, except the special markers like (0,0) or (15,0) : (0,6,111001) ; (0,6,101101) ; (4,5,10111); (1,5,00001) ; (0,4,0111) ; (2,1,1) ; (0,0) The difference of DC coefficience : -511 Encode the value as category and bits for the value : 9, 000000000 Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
9. Huffman Coding Figure 7. Huffman table of luminance AC coefficience Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
9. Huffman Coding Figure 8. Huffman table of luminance DC coefficience Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
9. Huffman Coding • Example The AC coefficiences : (0,6,111001) ; (0,6,101101) ; (4,5,10111); (1,5,00001) ; (0,4,0111) ; (2,1,1) ; (0,0) Encode the left two value in () using Huffman encoding : • 1111000 111001 , 1111000 101101 , 1111111110011000 10111 , • 11111110110 00001 , 1011 0111 , 11100 1 , 1010 • The DC coefficience : • 9, 000000000 • Encode the category using Huffman encoding : • 1111110 000000000 Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC
End Graduate Institute of Communication Engineering, National Taiwan University, Taipei, Taiwan, ROC