Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.
-
date post
21-Dec-2015 -
Category
Documents
-
view
221 -
download
2
Transcript of Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.
![Page 1: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/1.jpg)
Losslessy Compression of Multimedia Data
Hao JiangComputer Science Department
Sept. 25, 2007
![Page 2: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/2.jpg)
Lossy Compression
Apart from lossless compression, we can further reduce the bits to represent media data by discarding “unnecessary” information.
Media such as image, audio and video can be “modified” without seriously affecting the perceived quality.
Lossy multimedia data compression standards include JPEG, MPEG, etc.
![Page 3: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/3.jpg)
Methods of Discarding Information
Reducing resolution
Original image 1/2 resolution and zoom in
![Page 4: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/4.jpg)
Reduce pixel color levels
½ color levelsOriginal image
![Page 5: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/5.jpg)
For audios and videos we can similarly reduce the sampling rate, the sample levels, etc.
These methods usually introduce large distortion. Smarter schemes are necessary!
2.3bits/pixel (JPEG)
![Page 6: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/6.jpg)
Distortion Distortion: the amount of difference between
the encoded media data and the original one.
Distortion measurement– Mean Square Error (MSE)
mean( ||xorg – xdecoded||2)
– Signal to Noise Ratio (SNR) SNR = 10log10 (Signal_Power)/(MSE) (dB)
– Peak Signal to Noise Ratio PSNR = 10log10(255^2/MSE) (dB)
![Page 7: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/7.jpg)
The Relation of Rate and Distortion
The lowest possible rate (average codeword length per symbol) is correlated with the distortion.
D
Bit Rate
0 D_max
H
![Page 8: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/8.jpg)
Quantization
Maps a continuous or discrete set of values into a smaller set of values.
The basic method to “throw away” information.
Quantization can be used for both scalars (single numbers) or vectors (several numbers together).
After quantization, we can generate a fixed length code directly.
![Page 9: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/9.jpg)
Uniform Scalar Quantization
xmin xmax
Quantization step =(xmax-xmin)/N
Decision boundaries
Quantization value
Assume x is in [xmin, xmax]. We partition the intervaluniformly into N nonoverlapping regions.
A quantizer Q(x) maps x to the quantization value in the regionwhere x falls in.
![Page 10: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/10.jpg)
Quantization ExampleQ(x) = [floor(x/) + 0.5]
Q(x)/
x/0 1 2 3-3 -2 -1
0.5
1.5
-0.5
-1.5
-2.5
2.5
Midrise quantization
![Page 11: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/11.jpg)
Quantization ExampleQ(x) = [round(x/)]
Q(x)/
x/0 1 2 3-3 -2 -1
1
2
-1
-2
-3
3
Midrise quantization
![Page 12: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/12.jpg)
Quantization Error
To minimize the possible maximum error, the quantization value should be at the center of each decision interval.
If x randomly occurs, Q(x) is uniformly distributed in [-/2, /2]
xnxn+1
Quantization error
x Quantization value
![Page 13: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/13.jpg)
Quantization and Codewords
xmin xmax
Each quantization value can be associated with a binarycodeword.
In the above example, the codeword corresponds to theindex of each quantization value.
000 001 010 011 100 101
![Page 14: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/14.jpg)
Another Coding Scheme
Gray code
xmin xmax
000 001 011 010 110 111
• The above codeword is different in only 1bit for each neighbors.
• Gray code is more resistant to bit errors than the natural binary code.
![Page 15: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/15.jpg)
Bit Assignment
If the # of quantization interval is N, we can use log2(N) bits to represent each quantized value.
For uniform distributed x, The SNR of Q(x) is proportional to 20log(N) = 6.02n, where N=2n
bits
dB
1 more bit
About 6db gain
![Page 16: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/16.jpg)
Non-uniform Quantizer For audio and visual, the tolerance of a
distortion is proportional to the signal size.
So, we can make quantization step proportional to the signal level.
If signal is not uniformly distributed, we also prefer non-uniform quantization.
0
Perceived distortion ~ / s
![Page 17: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/17.jpg)
Vector Quantization
Decision Region
Quantization Value
![Page 18: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/18.jpg)
Predictive Coding
Lossless difference coding revisited
1 3 4 5 3 2 1 0 3 4 5 6 70
1 2 1 1 -2 -1 -1 -1 3 1 1 1 10
1 3 4 5 3 2 1 0 3 4 5 6 7
+ + … +
+-
+-
+-…+
-
encoder
decoder
![Page 19: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/19.jpg)
Local decoder
Predictive Coding in Lossy Compression
1 3 4 5 3 2 1 0 3 4 5 6 70
1 1 1 1 -1 -1 -1 -1 1 1 1 1 1
0 1 2 3 4 3 2 1 0 1 2 3 4 5
Q
+-
Q
+ +
+ +
+
- …
Encoder
…
-+-
Q
Q(x) = 1 if x > 0, 0 if x == 0 and –1 if x < 0
![Page 20: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/20.jpg)
A Different Notation
Buffer
+Audio samples or image pixels
Entropycoding
0101…
Lossless Predictive Encoder Diagram
-
![Page 21: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/21.jpg)
A Different Notation
Buffer
+Reconstructedaudio samples or image pixels+
Entropydecoding
Lossless Predictive Decoder Diagram
Codestream
![Page 22: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/22.jpg)
Local Decompression
A different Notation
Buffer
+Audio samples or image pixels
-
Coding
0101…
Q
+
Lossy Predictive Coding
![Page 23: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/23.jpg)
General Prediction Method For image:
For Audio:
Issues with Predictive Coding– Not resistant to bit errors.– Random access problem.
C B
A X
ABCD X
![Page 24: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/24.jpg)
Transform Coding
1 3 4 5 3 2 1 0 3 4 5 6
2 4.5 2.5 0.5 3.5 5.5
+ + + + + +
1 3 4 5 3 2 1 0 3 4 5 6
+ + + + + +- - - - - -
½ ½ ½ ½ ½ ½
-1 -0.5 0.5 0.5 -0.5 0.5
½ ½ ½ ½ ½ ½
![Page 25: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/25.jpg)
Transform and Inverse Transform
y1y2
= ½ ½½ -½
x1x2
We did a transform for a block of input data using
The inverse transform is:
x1x2
= 1 11 -1
y1y2
![Page 26: Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.](https://reader038.fdocuments.net/reader038/viewer/2022103022/56649d565503460f94a33b0d/html5/thumbnails/26.jpg)
Transform Coding
A proper transform focuses the energy into small number of numbers.
We can then quantize these values differently and achieve high compression ratio.
Useful transforms in compressing multimedia data:– Fourier Transform– Discrete Cosine Transform