lossy compression: math basicscmliu/courses/compression/chap8.pdf · c.m. liu. perceptual signal...

23
C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung University Lossy Compression: Math Basics wOffice: EC538 w(03)5731877 w[email protected] w http://www.csie.nctu.edu.tw/~cmliu/Courses/Compression/

Upload: others

Post on 27-Sep-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

C.M. LiuPerceptual Signal Processing Lab College of Computer ScienceNational Chiao-Tung University

Lossy Compression: Math Basics

Office: EC538(03)5731877

[email protected]

http://www.csie.nctu.edu.tw/~cmliu/Courses/Compression/

Page 2: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Definitions

Lossless compression: x = x’A.k.a. entropy coding, reversible coding

Lossy compression: x ≠ x’A.k.a. irreversible coding

2

Encoder Decoderx y x’original compressed decompressed

Page 3: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Motivation

Why use lossy compression?Fundamental limits on lossless compressionHuman cognitive apparatus

Fundamental limits on human perceptionIf you can’t see/hear it, why encode it?

Abilities to recover from partial lossE.g. lower frame rate will make movement jerky but perceptible (think video via satellite phone)

Many sources have very high “natural” bit ratesAudio/video/etc.

3

Page 4: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Measures of Difference Distortion

Notation{xn} original source output{yn} reconstructed output

Squared errord(x, y) = (x – y)2

Absolute differenced(x, y) = |x – y|

4

Page 5: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Measures of Difference Distortion (2)

Mean squared error (MSE)

5

( )∑=

−=N

nnn yx

N 1

22 1σ

Signal-to-noise ratio (SNR)

2

2

SNRd

x

σσ

=

Decibel (dBel)

2

2

10log10SNR(dB)d

x

σσ

=

Page 6: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Measures of Difference Distortion (3)

Peak-signal-to-noise ratio (PSNR)

6

Average absolute difference

2

2

10log10PSNR(dB)d

peakxσ

=

∑=

−=N

nnn yx

N 1

2 1σ

Absolute maximum error

nnnyxd −=∞ max

Page 7: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Eye Phyiology

ConeaLensRetina

ConesRods

Outer Synaptic LayerBipolar CellsIner Synaptic LayerGanglion Cell

7

Page 8: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Eye Phyiology (c.1)

Visual Pathways

8

Page 9: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Eye Phyiology (c.2)

Two Types of Photoreceptors in Retina

RodsAbout 100 million in number

Relatively long and thin

Provides scotopic vision or dim-light vision

ConesAbout 6.5 million in number

Shorter and thicker

Provide photopic vision or bright-light vision

Highly sensitive to color

Densely packed in the center of Retina (called forvea)

Spectral Absorption of Three Types of

Cones

9

Page 10: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Visual Phenomena

Contrast SensitivitySensitive to luminance contrast rather than the absolute luminance values.

Weber’s Ratio

Related to surrounding and background luminance

ΔII

cons t d I= =tan [ log{ }]

10

Page 11: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Visual Phenomena-- Contrast Sensitivity

Logarithmic LawPower LawBackground Ratio

11

Page 12: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Visual Phenomena-- Mach Band

OvershootUniform luminance in the strip

The visual appearance is darker at its right side than its left.

12

Page 13: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Visual Phenomena-- MTF of the System

The Frequency ResponseThe peak varies with the viewer and generally lies between 3 and 10 cycles/degree.

The contrast sensitivity also depends on the orientation of the grating, being maximum for horizontal and vertical gratings.

The angular sensitivity variations are within 3 dB ( maximum deviation is at 45o).

The curve fitting procedure has yielded.

ex. A=2.6, α = 0.0192, β=1.1, and ρ0=(0.114)-1 = 8.772

H H A

where cycles ree

p( , ) ( ) [ ( )]exp[ ( ) ]

/ deg

ξ ξ ρ α ρρ

ρρ

ρ ξ ξ

β1 2

0 0

12

22

= = + −

= +

13

Page 14: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Probability Models

Lossless approachBased on empirical probability distributions… we needed an exact match

Lossy compressionWe can afford to approximate the actual distribution using a ‘nice’ analytical modelAdvantages

Use the analytical properties to improveCompressionReconstruction

14

Page 15: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Probability Models (2)

Uniform distributionIgnorance model—all values equally probable

15

⎩⎨⎧ ≤≤−

=otherwise0

for)(1 bxaabf X

Gaussian distributionVery common model

Analytically tractableLimiting distribution turns Gaussian

2

2

2)(

221 σ

μ

πσ

−−

=x

X ef

Page 16: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Probability Models (3)

Laplacian distributionMost of the weight of the pdf is around the mean (=0)

16

σ

πσ

||2

221 x

X ef−

=

Gamma distributionEven more concentrated around the mean (=0)

σ

πσ2

||34

||83 x

X ex

f−

=

Page 17: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Probability Models Comparison17

1,0 2 == σμ

Page 18: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Linear System Models18

∑∑=

−=

− ++=M

jnjnj

N

iinin bxax

11

εε⎩⎨⎧ =

=otherwise0

0for)(

2 kkR ε

εεσ

AutoRegressive Moving Average—ARMA(N,M)

Autoregressive Moving average

AutoRegressive—AR(N) == ARMA(N,0)

n

N

iinin xax ε∑

=− +=

1( ) ( )Nnnnnnnn xxxxPxxxP −−−−− = ,,,|,,| 2121 KK

Page 19: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

AR(1) Autocorrelation Function19

Page 20: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Example AR(1) Processes20

a1 = 0.99 a1 = 0.60

Page 21: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Example AR(1) Processes (2)21

a1 = -0.99 a1 = -0.60

Page 22: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Negative Autocorrelation Function22

Page 23: Lossy Compression: Math Basicscmliu/Courses/Compression/chap8.pdf · C.M. Liu. Perceptual Signal Processing Lab . College of Computer Science. National Chiao-Tung University. Lossy

Homeworks & References23

Problems

ReferencesR. C. Gonzalez and R.E. Woods, “Digital Image Processing: Chapter 2” 3nd Edition, Prentice Hall, 2007