I will start with a question "why signal can be compressed?" I will then describe quantization, entropy-coding, difference-PCM, and Discrete Cosine Transform (DCT). My main motive will be to illustrate the basic principle rather than to describe the details of each method. Finally I will discuss how these various algorithm combined to get the JPEG standard for image compression. Time permitting, I will comment on various famous theories which lead to JPEG standard.
From the Un-Distinguished Lecture Series (http://ws.cs.ubc.ca/~udls/). The talk was given May 18, 2007.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
-1-
Overview
Sampling Fine Quantization
Transform Quantizer VLC encoding
A/D CONVERTER
COMPRESSION/SOURCE CODING
CHANNEL CODING
Error protect.Encipher
PCM encoded or “raw” signal(“wav”, “bmp”, …)
Compressed bit stream
(mp3, jpg, …)
Channel bit stream
Analog capturing
device(camera,
microphone)
-2-
Reduce the #Amplitudes
24 bit (16777200 different colors)
-3-
8 bit (256 different colors) CF 3
Reduce the #Amplitudes
-4-
6 bit (64 different colors) CF 4
Reduce the #Amplitudes
-5-
4 bit (16 different colors) CF 6
Reduce the #Amplitudes
-6-
1 bit (2 different colors) CF 24
Reduce the #Amplitudes
-7-
8 bit (256 different gray values) CF 3
Reduce the #Amplitudes
-8-
4 bit (16 different gray values) CF 6
Reduce the #Amplitudes
-9-
3 bit (8 different gray values) CF 8
Reduce the #Amplitudes
-10-
2 bit (4 different gray values) CF 12
Reduce the #Amplitudes
-11-
JPEG CF 15
But there are More Cleaver Ways
-12-
Why can Signals be Compressed?Because infinite accuracy of signal amplitudes is (perceptually) irrelevant
24 bit (16777200 different colors) 8 bit (256 different colors)Compression factor 3
Run Length CodingRepresenting “0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 ...”“Runs” : 8 (“zeros”) 2 (“ones”) 6 (“zeros”) 5 (“ones”) ……The run lengths are also encoded (e.g. with Huffman coding)Efficient transforms (like DCT) used in compression produce
A lot of “zero” valuesAnd a “few” (significant) non-zero values
Typical symbol sequences to be coded “5 1 0 0 0 0 0 0 0 3 0 0 6 0 0 0 0 1 0 0 0 0 …..”
will be done by {zero-run, non-zero symbol/0} pairsHere: “{0,5},{0,1},{7,3},{2,6},{4,1},…..”The pairs will now be assigned a Huffman codeThis is used in JPEG
-21-
General Compression System
Sampling Fine Quantization
Transform Quantizer VLC encoding
A/D CONVERTER
COMPRESSION/SOURCE CODING
CHANNEL CODING
Error protect.Encipher
PCM encoded or “raw” signal(“wav”, “bmp”, …)
Compressed bit stream(mp3, jpg, …)
Channel bit stream
Analog capturingdevice(camera, microphone)
-22-
Correlation in Signals - IMeaningful signals are often highly predictable:
(Linear) Predictability has something to do with the autocorrelation function
0 500 1000 1500 2000 2500 3000 3500 4000 450050
100
150
200
2504
500 1000 1500 2000 2500 3000 3500 4000 4500100
0
100
Δx(n)=x(n)-x(n-1)
n
-23-
Principle of Differential PCM
- Q VLC
Previoussignal values (“past”)
x(n) Δx(n) 001010010Δx*(n)
Predict x(n)
)(ˆ nx
x(n-1), x(n-2), x(n-3), ….
-24-
Works Really Good - I
Variance = 3240
-25-
Works Really Good - II
Variance = 315
-26-
DPCM
Predicted signal
Signal to be encoded Prediction difference/error
Reconstructed signal
-27-
What Linear Predictor to Use?Examples:
PCM
Simple differences
Average last two samples
General linear predictor
$( )x n = 0
$( ) ~( )x n x n= −1
$( ) ~( ) ~( )x n h x n h x n= − + −1 21 2
$( ) ~( )x n h x n kkk
N
= −=∑
1
-28-
DPCM on Images
Same principle as 1-DDefinition of “Past”and “Future” in Images:
DC: Difference with quantized DC coefficient of previous block is Huffman encoded AC: Zig-zag scan coefficients, and convert to (zero run-length, amplitude) combinations: