16
ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [1] An 8x8 block to focus on:

An 8x8 block to focus on

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [1]

An 8x8 block to focus on:

Page 2: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [2]

1263 -54 50 101 81 -37 -42 8

-18 -20 12 -41 -125 -87 -8 2

-30 16 10 -50 -35 5 15 5

19 1 2 20 2 -10 2 0

3 6 -7 -13 5 10 3 -1

1 -3 -2 -1 4 3 1 0

-1 -3 -3 -2 -2 0 0 1

0 0 2 -1 -3 -3 -1 0

120 195 154 101 153 166 162 173

131 190 134 101 160 167 164 171

143 171 117 120 176 166 168 172

176 151 105 152 195 167 168 173

202 147 96 160 207 172 167 173

213 133 91 164 207 169 166 172

214 121 101 171 187 149 160 170

204 110 119 183 166 128 154 165

Spatial Domain vs. DCT Domain

Page 3: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [3]

1263 -54 50 101 81 -37 -42 8

-18 -20 12 -41 -125 -87 -8 2

-30 16 10 -50 -35 5 15 5

19 1 2 20 2 -10 2 0

3 6 -7 -13 5 10 3 -1

1 -3 -2 -1 4 3 1 0

-1 -3 -3 -2 -2 0 0 1

0 0 2 -1 -3 -3 -1 0

Original DCT

16 11 10 16 24 40 51 61

12 12 14 19 26 58 60 55

14 13 16 24 40 57 69 56

14 17 22 29 51 87 80 62

18 22 37 56 68 109 103 77

24 35 55 64 81 104 113 92

49 64 78 87 103 121 120 101

72 92 95 98 112 100 103 99

Using Perceptual Quantization Table?

1264 -55 50 96 72 -40 -51 0

-24 -24 14 -38 -130 -58 0 0

-28 13 16 -48 -40 0 0 0

14 0 0 29 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

round(DCT./Q).*Q

Q

(quantization table)

Page 4: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [4]

Color InterleavingColor Interleaving

– Different components are ordered into Minimum Coding Unit (MCU)– MCUs define repeating interleaving patterns

Minimum coding unit (MCU)MCU1 = {Y00, Y01, Y10, Y11, U00, V00}MCU2 = {Y02, Y03, Y12, Y13, U01, V01}

• • • • • •• • • • • •

• • • • • •• • • • • •

• • •

• • •

• • •

• • •

YY UU VV

UM

CP

EN

EE

408G

Slid

es (c

reat

ed b

y M

.Wu

& R

.Liu

©20

02)

Page 5: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [5]

475 x 330 x 3 = 157 KB luminance

From

Liu

’s E

E330

(Prin

ceto

n)

Page 6: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [6]

RGB ComponentsRGB ComponentsFr

om L

iu’s

EE3

30 (P

rince

ton)

Page 7: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [7]

Y U V (Y Y U V (Y CbCb Cr) ComponentsCr) Components

Assign more bits to Y, less bits to Cb and Cr

From

Liu

’s E

E330

(Prin

ceto

n)

Page 8: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [8]

JPEG Compression (Q=75%)JPEG Compression (Q=75%)

45 KB, compression ration ~ 4:1From

Liu

’s E

E330

(Prin

ceto

n)

Page 9: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [9]

Lossless Coding Part in JPEGLossless Coding Part in JPEG

Differentially encode DC– (lossy part: DC differences are then quantized.)

AC coefficients in one block– Zig-zag scan after quantization for better run-length

save bits in coding consecutive zeros

– Represent each AC run-length using entropy coding use shorter codes for more likely AC run-length symbols

UM

CP

EN

EE

408G

Slid

es (c

reat

ed b

y M

.Wu

& R

.Liu

©20

02)

Page 10: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [10]

LossyLossy Part in JPEGPart in JPEGQuantization (adaptive bit allocation)– Different quantization step size for different coeff. bands– Use same quantization matrix for all blocks in one image– Choose quantization matrix to best suit the image– Different quantization matrices for luminance and color components

Default quantization table– “Generic” over a variety of images

Quality factor “Q”– Scale the quantization table– Medium quality Q = 50% ~ no scaling– High quality Q = 100% ~ unit quantization step size– Poor quality ~ small Q, larger quantization step

visible artifacts like ringing and blokiness

UM

CP

EN

EE

408G

Slid

es (c

reat

ed b

y M

.Wu

& R

.Liu

©20

02)

Page 11: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [11]

Uncompressed (100KB)

JPEG 75% (18KB)

JPEG 50% (12KB)

JPEG 30% (9KB)

JPEG 10% (5KB)

UM

CP

EN

EE

408G

Slid

es (c

reat

ed b

y M

.Wu

& R

.Liu

©20

02)

Page 12: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [12]

JPEG Compression (Q=75% & 30%)JPEG Compression (Q=75% & 30%)

45 KB 22 KBFrom

Liu

’s E

E330

(Prin

ceto

n)

Page 13: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [13]

Y Y CbCb Cr After JPEG (Q=30%)Cr After JPEG (Q=30%)Fr

om L

iu’s

EE3

30 (P

rince

ton)

JPEG Cb JPEG Cr

Page 14: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [14]

Lossless Coding Part in JPEG: DetailsLossless Coding Part in JPEG: Details

Differentially encode DC– ( SIZE, AMPLITUDE ), with amplitude range in [-2048, 2047]

AC coefficients in one block– Zig-zag scan for better run-length– Represent each AC with a pair of symbols

Symbol-1: ( RUNLENGTH, SIZE ) Huffman coded

Symbol-2: AMPLITUDE Variable length coded

RUNLENGTH ∈ [0,15] # of consecutive zero-valued AC coefficientspreceding the nonzero AC coefficient ∈ [0,15]

SIZE ∈ [0 to 10 in unit of bits] # of bits used to encode AMPLITUDE

AMPLITUDE ∈ in range of [-1023, 1024]

UM

CP

EN

EE

408G

Slid

es (c

reat

ed b

y M

.Wu

& R

.Liu

©20

02)

Page 15: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [15]

An example of JPEG Coding TableAn example of JPEG Coding TableU

MC

P E

NE

E63

1 S

lides

(cre

ated

by

M.W

u ©

2004

)

Table is from slides at Gonzalez/ Woods DIP book website (Chapter 8)

Page 16: An 8x8 block to focus on

ENEE631 Digital Image Processing (Spring'06) Lec13 – Transf. Coding & JPEG [16]

Summary of TodaySummary of Today’’s Lectures Lecture

JPEG compression standard– Baseline block-DCT based algorithm

lossy part: quantization with different step size for each coeff. Bandlossless part: differential coding, run-length coding, Huffman

Next week: – Subband coding and Wavelet based compression

Exercise 4: Transform coding

Readings– Jain’s book 11.5

Gonzalez’s book 8.5.2, 8.6.2– Wallace’s tutorial paper on JPEG (see course webpage)

UM

CP

EN

EE

631

Slid

es (c

reat

ed b

y M

.Wu

©20

04)