Advanced JPEG Dinesh Ganotra Organizations Involved Joint Photographic Experts Group ISO International Organization for Standards CCITT International Telegraph and Telephone Consultative Committee IEC International Electro-technical Commission Recap Contrast Sensitivity of the Eye ◦ At a 1 meter viewing distance an ideal digital image 40cm wide should have about 4,000 pixels. ◦ The contrast sensitivity curve for luminance is different from chrominance. QUANTIZATION TABLE Luminance Quantization Table Chrominance Quantization Table ZERO SHIFT The 8-bit image data is zero-shifted by subtracting 128 from the data before the DCT is calculated. For 12-bit data the zero shift is accomplished by subtracting 2048. This reduces the internal precision requirement for DCT calculation. DCT One multiplication and nine additions per coefficient ×+ + + + + + + + + Entropy PCM 600 500 DPCM 400 300 200 101 100 11 10 0 0 001 100 Huffman Coding Arithmatic Coding DPCM lossless Sequential DCT lossy Progressive Huffman Arithmetic Hierarchical Huffman Computationally Simpler Requires code tables to be known Arithmetic Higher Performance ( 10%) code book adapts dynamically to the data being coded. Sequential codes the image in a single scan or passes through the data. The decoder necessarily follows the same order in decoding the data Progressive encodes the image in two or more scans or passes through the data, first coding an approximation of the entire image with each succeeding scan. decoder follows the same order in decoding, first reconstructing the approximating of the image, and then adding finer detail with each succeeding scan AC band 1 AC band 2 AC band 3 DC band 1 magnitude bit plane Progressive 2 1 0 AC band 4 DC band 4 AC band 5 AC band 6 Hierarchical progressive coding with increasing spatial resolution between progressive stages Data Unit Y1 Y2 Y3 Y4 Cb1 Cb2 Cr1 Cr2 Y5 Y6 Y7 Y8 Cb3 Cb4 Cr3 Cr4 Horizontally interleaved data units Vertically interleaved data units Y1 Y2 Cb1 Cb2 Cr1 Cr2 Y3 Y4 Cb3 Cb4 Cr3 Cr4 Y5 Y6 Y7 Y8 Non interleaved, horizontal , and vertical interleaved Scan1 : Y1 , Y2 , Y3 , Y4 , Y5 , Y6 , Y7 , Y8 Scan2 : Cb1 , Cb2 , Cb3 , Cb4 Scan3 : Cr1 , Cr2 , Cr3 , Cr4 Scan1 : Y1 , Y2 , Cb1 , Cr1, Y3 , Y4 , Cb2 , Cr2, Y5 , Y6 , Cb3 , Cr3 , Y7 , Y8 , Cb4 , Cr4 Scan1 : Y1 , Y3 , Cb1 , Cr1, , Y2 , Y4 , Y5 , Y7 , Cb3 , Cr3 , Y6 , Y8 , Y7 , Y8 , Cb4 , Cr4 Example FFD8 FFC9 00 11 08 00 80 00 80 03 01 11 00 02 11 00 03 11 00 FFCC 00 06 00 10 10 05 FFDA 00 08 01 01 01 00 00 3F 00 … FFCC 00 06 01 10 11 05 FFDA 00 08 01 02 11 00 3F 00 … FFDA 00 08 01 03 11 00 3F 00 … FFD9 Markers Code FF01 FF02-FFBF FFC0 FFC1 FFC2 FFC3 FFC4 FFC5 FFC6 FFC7 FFC8 FFC9 FFCA FFCB Name TEM RES SOF0 SOF1 SOF2 SOF3 DHT SOF5 SOF6 SOF7 JPG SOF9 SOF10 SOF11 Category For temporary use in arithmetic coding Reserved Nondifferential Huffman –coding frames Nondifferential Huffman –coding frames Nondifferential Huffman –coding frames Nondifferential Huffman –coding frames Define Huffman Table(s) Differential Huffman –coding frames Differential Huffman –coding frames Differential Huffman –coding frames Reserved for JPEG extension Nondifferential arithmetic–coding frames Nondifferential arithmetic–coding frames Nondifferential arithmetic–coding frames Baseline DCT Extended sequential DCT Progressive DCT Lossless sequential differential sequential DCT differential progressive DCT differential lossless Extended sequential DCT Progressive DCT Lossless sequential Markers Cont.. FFCC FFCD FFCE FFCF FFD0-FFD7 FFD8 FFD9 FFDA FFDB FFDC FFDD FFDE FFDF FFE0-FFEF FFF0-FFFD FFFE DAC Define Arithmatic Coding SOF13 Differential arithmetic- coding frames differential sequential SOF14 Differential arithmetic- coding frames differential progressive SOF15 Differential arithmetic- coding frames differential lossless RSTm Restart with modulo 8 counter m SOI Start of image EOI End of Image SOS Start of Scan DQT Define quantization table DNL Define number of lines DRI Define restart interval DHP Define Hierarchical progression EXP Expand reference images APPn Reserved for application use (two different applications may have conflicting usage of APPn) JPGn Reserved for JPEG extension COM Comment Frames and Scans Frame Header SOFn Parameter Marker ( FFC0-3, 5-7, 9-B,D-F) Frame header length Sample precision Number of lines Number of samples per line Number of components in frame Frame component specification Component identifier Horizontal sampling factor Vertical sampling factor Quantization table destination selector Nf 03 C1 00 H1 2 V1 1 Tq 00 C2 01 H2 11 V2 01 Symbol SOFn Lf P Y X Nf Size 16 16 8 16 16 8 Ci Hi Vi Tqi 8 4 4 8 Tq2 02 C3 02 H3 1 V3 1 Tq3 01 The above example shows a three component system.YCrCb with identical sampling for all components in the vertical direction and twice as many Y samples as Cr or Cb samples in the horizontal direction. Let the first component use quantization table 0 and the rest use quantization table 1. If Y, Cr and Cb are numbered 0, 1, and 2 respectively, the components specification is as given above. Other Header Structures Scan Header DHT Marker Segment DAC Marker Segment DQT Marker Segment Restart Segment References JPEG still image data compression standard, William B Pennebaker, JL Mitchell, VNR , International Thomson Publishing Inc.