320 likes | 663 Views
JPEG: Joint Photographic Expert Group. JPEG is an standard for compression and decompression of still images. It was developed jointly by ITU and ISO. JPEG applies to color and gray-scaled still images. There are four main steps in the JPEG compression process:. Image Preparation. Plane:
E N D
JPEG: Joint Photographic Expert Group • JPEG is an standard for compression and decompression of still images. It was developed jointly by ITU and ISO. • JPEG applies to color and gray-scaled still images. • There are four main steps in the JPEG compression process: Multimedia Communications
Image Preparation Plane: • N is at least one and at most 255 components Ci (e.g. one plane per color) • Different resolution of individual components possible. Multimedia Communications
Image Preparation (con’t) Components may be assigned to three colors in RGB, YIQ or YUV signals. • RGB color space model • Most computer display and input devices use the RGB color space model where red, green and blue pixels are represented by a number of bits per component. Multimedia Communications
Image Preparation (con’t) • Luma/Croma Representation • Luma or luminance (Y) is the perceived intensity of the image and is calculate by Y = 0.299R + 0.587G + 0.114B • Chroma or chrominance is the perceived color of image and it can be processed to define a YUV model as V = (R-Y)/1.14 = 0.877 (R-Y) U = (B-Y)/2.03 = 0.493 (B-Y) The picture is represented as a luminance component and two chroma components. Multimedia Communications
Image Preparation (con’t) • A gray-scale image will, in most case, consists of a single component. • RGB color representation has three components with equal resolution (i.e., same number of lines: X1 =X2 = X3 and the same number of columns Y1 = Y2 = Y3) Multimedia Communications
JPEG Compression Process Multimedia Communications
JPEG – 4 Modes of Compression Multimedia Communications
JPEG – 4 Modes of Compression (con’t) • The lossy sequential DCT-based mode (baseline process) must be supported by every JPEG implementation. • The expanded lossy DCT-based mode provides a set of further enhancements to the baseline process. • The lossless mode has a low compression ratio that allows perfect reconstruction of the original image. • The hierarchical mode accommodates image of different resolutions and selects its algorithms from the three modes defined above. Multimedia Communications
Lossy Sequential DCT-based Mode Image Processing • After image preparation, the uncompressed image samples are grouped into data unit of 8x8 pixels and passed to the encoder. Each pixel is an integer in the range of 0 to 255. • The first step of image processing in the baseline mode is a transformation by DCT. Multimedia Communications
Image Processing (con’t) • These data units of 8x8 shifted pixel values are defined by f(x,y), where x and y are in the range of 0 to 7. • Each of these values is then transformed using Forward DCT (FDCT). • This transformation is carried out 64 times per data unit. • The result is 64 corresponding coefficients F(u,v), where u and v are in the range 0 to 7. Multimedia Communications
Image Processing (con’t) (a) (b) (a) one block of the Y matrix (b) The DCT coefficients Multimedia Communications
Quantization For this step, the JPEG application provides a table with 64 entries. Multimedia Communications
Entropy Encoding • During the initial step of entropy encoding, the quantized DC-coefficients are treated separately from the quantized AC-coefficients. • The processing order of the whole set of coefficients is specified by the zigzag sequence. • The DC-coefficients determine the basic color of the data units. Multimedia Communications
Entropy Encoding (con’t) • Since between the adjacent data units, the variation of color is fairly small, a DC-coefficient is encoded as the difference between the current DC-coefficient and the previous one. Use the difference instead of the Dci values. Multimedia Communications
Entropy Encoding (con’t) For 63 AC coefficients, there are ordered in ‘zigzag’ form. • The result is an extended sequence of similar data bytes, permitting very efficient entropy encoding. JPEG specifies Huffman and Arithmetic encoding as entropy encoding methods. Multimedia Communications
Entropy Encoding (con’t) • For the lossy sequential DCT-based mode, only Huffman encoding is allowed. • In both methods, the run-length encoding of zero values of the quantized AC-coefficients is applied first. • The major advantages of Huffman encoding over Arithmetic encoding is the free implementation. Arithmetic encoding is covered by a patent. Multimedia Communications
Expanded Lossy DCT-based Mode • For expanded lossy DCT-based mode, JPEG specifies progressive encoding in addition to sequential encoding. • In the first run, a very rough representation of the image appears which is refined during successive steps. Multimedia Communications
Lossless Mode • In this mode, image processing and quantization use a predictive technique instead of a transformation encoding technique. Multimedia Communications
Hierarchical mode • The hierarchical mode uses either the lossy DCT-based mode or the lossless compression technique. • The main features of this mode is that the encoded data contains image at several resolutions. • The prepared image is initially sampled at a lower resolution. Subsequently, samples of higher resolutions are compressed until the full resolution of the image is compressed. • Hierarchical encoding requires much more storage capacity, but compressed image is immediately available at different resolutions. Multimedia Communications
JPEG Compression Rates • JPEG can typically achieve 10:1 to 20:1 compression without visible loss, bringing the effective storage requirement down to 1-2 bits/pixel. (Recall that for full-color, we need 24 bits/pixel) • 30:1 to 50:1 compression is possible with small to moderate defects. • For comparison, GIF for the same image would start with only 256 colors (8 bits/pixel) and at best can achieve a 5:1 compression. Multimedia Communications
DCT Tutorial DCT Equation For 8x8 block, Multimedia Communications
DCT Tutorial (con’t) DCT Matrix Multimedia Communications
DCT Tutorial (con’t) Doing DCT on 8x8 Block “Leveled off” by 128 Multimedia Communications
DCT Tutorial (con’t) Doing DCT on 8x8 Block This block matrix now consists of 64 DCT coefficients Multimedia Communications
DCT Tutorial (con’t) Quantization For quality level greater than 50 (less compression, higher image quality), the standard quantization matrix is multiplied by (100-quality level)/50. Multimedia Communications
DCT Tutorial (con’t) Quantization Coding Multimedia Communications
DCT Tutorial (con’t) Decompression IDCT Multimedia Communications
DCT Tutorial (con’t) Comparison of Matrices Multimedia Communications