How to contact
Transcription
How to contact
How to contact Prof. Dr. Paul Müller Raum: 34/312 Telefon: 0631/205−2263 Email: mueller@uni−kl.de Bernd Reuther Raum: 32/344 Telefon: 0631/205−2161 Email: [email protected]−kl.de Dirk Henrici Raum: 32/414 Telefon: 0631/205−2891 Email: [email protected]−kl.de 1 JPEG as an application of the discrete cosine transform How to contact 2 Overview Seminar Basics of Compression • Motivation • Derivation of the DCT out of the DFT • JPEG overview • JPEG baseline codec • JPEG summary • Summary and Perspectives Ulrich Dauenhauer Student of the University of Kaiserslautern, MatNr.: 309 941 email: [email protected]−kl.de JPEG as an application of the discrete cosine transform 3 Overview 4 Motivation From DFT to DCT (1) • Periodic extension of the DFT leads to leaps at the boundaries of the analyzed section • Compression is important despite of higher computing performance and faster networks. • The concept of the DFT to transform pixels from a viewable plane of spacial coordinates (pixel representation) into an abstract plain of frequency representation is excellent but has weaknesses. • Definition of a platform−spanning standard for picture exchange is reasonable Motivation • Concept of the DCT: Symmetric extension ♦ DFT−analysis over signal part of length 2N ♦ Symmetry about the center n=−1/2, thus DFT needs phase shift 5 From DFT to DCT (2) 6 From DFT to DCT (3) • This 1−D DCT is invertible like the DFT, but • FDCT (Forward DCT) equals its IDCT • More appropriate for image processing is the 2−D DCT • Deductible from the 1−D DCT since ♦ linear transform ♦ separately applicable to rows and columns • For the DFT, symmetry results in an even function and real coefficients • Splitting into a sum, each term with (existing) positive n−coordinates • Euler's identity leads to the DCT From DFT to DCT (2) From DFT to DCT (1) 7 From DFT to DCT (3) 8 JPEG overview JPEG baseline codec (1) • Joint Photographic Experts Group (JPEG) • Developer consortium on the field of image compression • Goal: generic standard for all kinds of images (true−color 24bit or grayscale) • portability • JPEG “standard”: collection of algorithms • smallest common denominator: JPEG baseline codec JPEG overview • JPEG compression program using baseline codec • select color space • color−subsampling • DCT • quantization • coding 9 JPEG baseline codec (2) • select color space ♦ grayscale ♦ RGB ♦ YCbCr JPEG baseline codec (1) 10 JPEG baseline codec (3) • select color space • color−subsampling • DCT • quantization • coding • The following example shows an 8x8 pixel image section • 8−bit numbers represent grayscales • Assuming a given 16x16 block with Cb or Cr • The eye can sense local differences only poorly • Averaged values of 2x2 sections • color−subsampling • DCT • quantization • coding JPEG baseline codec (2) 11 JPEG baseline codec (3) 12 JPEG baseline codec (4) • select color space • color−subsampling • DCT ♦ left−shift 2P−1 ♦ enforce NxN blocks ♦ apply 2−D DCT • quantization • coding JPEG baseline codec (5) • 8x8 block with 8−bit values • thus P=8; left shift of all items corresponds to −128 JPEG baseline codec (4) • select color space • color−subsampling • DCT ♦ left−shift 2P−1 ♦ enforce NxN blocks ♦ apply 2−D DCT • quantization • coding 13 JPEG baseline codec (6) • select color space • color−subsampling • DCT • quantization ♦ select table Q ♦ quantify DCT−coefficients • Der 8x8 Block enthält nun Werte zwischen −128 und 127 • Application of the 2−D DCT leads to the transform matrix ¸ with the items Æi,j JPEG baseline codec (5) 14 JPEG baseline codec (7) • select color space • color−subsampling • DCT • quantization • coding ♦ DC−coefficient ♦ AC−coefficients • select a quantization table Q with items qij according to JPEG recommendation • quantify according to stated formula and obtain table L with quantified DCT−coefficients • DC−coefficient • coding table: 16 categories with increasing number of entries • code difference to preceding DC−coefficient: ♦ here: 3 ♦ 3 is in group 2 and is on position 4 there (thus bitword 11) ♦ assuming Huffman−Code for group 2 is 2−bit long (e.g. 01) ♦ resulting sequence for DC: 0111 ♦ store results in L • coding JPEG baseline codec (6) 15 JPEG baseline codec (7) 16 JPEG baseline codec (8) JPEG baseline codec (9) • AC−coefficients are traversed in zick−zack and coded absolutely • select color space • color−subsampling • DCT • quantization • coding ♦ DC−coefficient ♦ AC−coefficients • select color space • color−subsampling • DCT • quantization • coding • result • 8x8 section coded with 23 bit 0111 0011 0110 1100 1111 010 • i.e. in average 23/64 instead of 8 bit per pixel • the reconstructed block has only small errors [values in %] • The (Z,C) table contains Huffman codes for AC−sequences ♦ Z: number of preceding zeros ♦ C: category of the AC coefficient ♦ For the example the results are: ◊ 1 −> (0,1) −> 00 1 (2nd position in 1st category) ◊ −9 −> (0,4) −> 1011 0110 ◊ 3 −> (0,2) −> 01 11 ◊ 0…0 −> (0,0) −> 1010 JPEG baseline codec (8) 17 JPEG summary • speed ♦ fast compression and decompression ♦ images can be viewed without long waiting even on slow PCs • image quality ♦ using low compression very good image quality ♦ depending on image type ♦ quantization can lead to visible color distortion ♦ sharp edges problematic 18 Summary (1) • Summary ♦ DCT has better characteristics than DFT ♦ DCT is used in JPEG • Outlook on JPEG 2000 ♦ JPEG 2000 addresses the stated problems • Fault liability ♦ blocks are interconnected systematically ♦ errors in bitstream affect whole image • Implementation ♦ no provision for metadata ♦ provision for a ROI (Region of Interest) JPEG summary JPEG baseline codec (9) 19 Summary (1) 20 Summary (2) References • Demonstration of JPEG vs. JPEG2000 • Link to seminar of Matthias Klapperstück, Stefanie Kreide ♦ satellite images ♦ radiograms ♦ TV still images ♦ forrest ♦ buildings ♦ test image ♦ test image 2 ♦ chessboard ♦ text Summary (2) • Khalid Sayood: Introduction to Data Compression • Prof. Dr. A. Schmidt: Seminar Multimedia Datenformate; WS 94/95; University of Karlsruhe • Internet ♦ (see above) ♦ FAQ located at www.jpeg.org 21 References 22