5.8. Hybrid Coding Steps for Images, Video, and Audio Basic encoding steps: 1
5.8.2. Image Compression - JPEG (1) Image preparation and coding: (baseline system) select color space, color-subsampling, DCT, quantization, coding 2
Image Compression - JPEG (2) 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding color space greyscale RGB The following example shows an 8x8 pixel image section 8-bit numbers represent greyscales YC b C r 3
Image Compression - JPEG (3) 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding Assuming a given 16x16 block with C b or C r The eye can sense local differences only poorly Averaged values of 2x2 sections 4
Image Compression - JPEG (4) 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding 8x8 block with 8-bit values thus P=8; left shift of all items corresponds to -128 this is the source matrix X DCT 1) normalize values 2) enforce NxN blocks 3) apply 2-D DCT 5
Image Compression - JPEG (5) 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding 8x8 block contains only values between -128 and 127 Application of the 2-D DCT leads to the transformed matrix D = A X A T DCT 1) normalize values 2) enforce NxN blocks 3) apply 2-D DCT 6
Image Compression - JPEG (6) Quantization 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding select table Q quantify DCTcoefficients select a quantization table Q with items q ij according to JPEG recommendation quantify according to stated formula and obtain table L with quantified DCT-coefficients store results in L 7
Image Compression - JPEG (7) Coding 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding DC-coefficient AC-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 8
Image Compression - JPEG (8) Coding 1) select color space 2) color-subsampling 3) DCT 4) quantization 5) coding DC-coefficient AC-coefficients AC-coefficients are traversed in zick-zack and coded absolutely The (Z,C) table contains Huffman codes for ACsequences 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 9
Image Compression - JPEG (9) 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 %] 10
Image Compression - JPEG (10) Interactive examples: JPEG Lines Applet JPEG Parrots - Applet 11
Image Compression - JPEG (11) Interactive examples: Do it yourself with ImageTrans (*) (*) This is a Java Webstart application; you'll probably need to install this software from http://www.java.com/en/download/faq/java_webstart.xml 12
Image Compression - JPEG (12) JPEG PNG Size: 3,164 bytes Size: 810 bytes Size: 3,564 bytes Size: 19,047 bytes 13
5.8.3. Overview Wavelets in practice JPEG 2000 Preprocessing DWT Quantizer Tier 1 / Tier 2 coding Comparison of JPEG 2000 with JPEG 14
JPEG 2000 block diagram 15
Baboon original 16
Baboon rgb colorspace 17
Baboon YCrCb colorspace 18
Baboon luma subsampled 2x 19
Baboon luma subsampled 4x 20
Baboon luma subsampled 8x 21
Baboon original 22
Baboon chroma subsampled 2x 23
Baboon chroma subsampled 4x 24
Baboon chroma subsampled 8x 25
Baboon original 26
JPEG 2000 block diagram 27
Transformation in JPEG 2000 DWT provides frequency band decomposition of the image Multi-resolution image representation Full-frame transformation -> no blocking artifacts Uses daubechies (9,7) floating point or (5,3) integer filter Use of integer filters -> both lossless and lossy compression Two implementation approaches: filter based / lifting scheme 28
1-D two-band DWT 29
1-D two-band DWT 30
2-D wavelet decomposition 31
Lena original 32
Lena horizontal high-pass 33
Lena horizontal low-pass 34
Lena low + high-pass subsampled 35
1-level 2-D wavelet decomposition 36
2-level 2-D wavelet decomposition 37
3-level 2-D wavelet decomposition 38
JPEG 2000 block diagram 39
Quantization and Dequantization 40
Quantization in JPEG 2000 41
Quantization by bit-plane coding 42
Bit-plane example Wavelet coefficient = 83; Quantizer step size = 3 Quantizer index = 83/3 = 27 = 00011011 Dequantized value based on fully decoded index (27 + 0.5)*3 = 82, Dequantized value after decoding 6 BP s: Decoded index = 000110 = 6; Step size = 12 Dequantized value = (6 + 0,5)*12 = 78 Dequantized value after decoding 4 BP s: Decoded index = 0001 = 1; Step size = 48 Dequantized value = (1 + 0.5)*48 = 72 43
JPEG 2000 block diagram 44
Entropy coding in JPEG 2000 45
JPEG 2000 Entropy coder blocks 46
Bit-plane 1 47
Bit-plane 1 enlarged by 8x 48
Bit-plane 2 49
Bit-plane 2 enlarged by 8x 50
Bit-plane 3 51
Bit-plane 4 52
Bit-plane 5 53
Bit-plane 6 54
Bit-plane 7 55
Bit-plane 8 56
Bit-plane 9 57
Bit-plane 10 58
Bit-plane 11 59
JPEG 2000 block diagram 60
Tier 2 role Tier 1 generates a collection of bitstreams One independent bitstream for each code-block Tier 2 multiplexes the bitstreams for inclusion in the codestream and signals the ordering of the resulting coded bitplane passes in an efficient manner Tier 2 enables SNR, resolution, spatial, ROI and arbitrary progression and scalability 61
Example of coded data 62
Example of coded data 63
Lowest resolution, highest quality 64
Medium resolution, highest quality 65
Highest resolution, highest quality 66
Highest resolution, target SNR quality 67
Highest resolution, target visual quality 68
SNR progressive example 69
SNR progressive example 70
SNR progressive example 71
Resolution progressive example 72
Resolution progressive example 73
Resolution progressive example 74
Resolution progressive example 75
JPEG vs. JPEG 2000 original JPEG 2000 (43:1) JPEG (43:1) 76