Sampling & Quantization
Sampling & Quantization
2007 NHK-CTI
2007.7.24
NHK Communications Training Institute
Hideo Tsuji [email protected]
1
Training material of NHK-CTI
2
Training material
2007 NHK-CTI
Overview of digital
Training material of NHK-CTI
system
3
Training material of NHK-CTI
4
Training material of NHK-CTI
• Analog
– Represents a level or a
state with continuously
level
variable physical
quantities time
• Digital
– Represents a level or a 0 1 0 1 1 0
level
state with discrete
numerical units
time
5
Training material of NHK-CTI
analog
digital
quantization error
Actual Time
12:34.00 12:35.00 6
Training material of NHK-CTI
8
Training material of NHK-CTI
Sender (broadcaster)
A/D Source
Modulation
Conversion Coding
Channel
Receiver (audience)
D/A De-
Decoding
Conversion modulation
9
Training material of NHK-CTI
Multi--media multiplexing
Multi
Training material of NHK-CTI
Video
A/D Source
Modulation
Conversion Coding
Multiplexing
A/D Source
Conversion Coding
Audio
Source
Data Coding
10
Training material
2007 NHK-CTI
Hexadecimal
Notation
11
Training material of NHK-CTI
Hexa-
• Binary number Decimal Binary
decimal
0 0 0
– Computers can distinguish 1 1 1
only two states; high and 2 10 2
3 11 3
low voltage 4 100 4
5 101 5
• Hexadecimal number 6 110 6
7 111 7
– Integrate every 4 digits of a 8 1000 8
binary number to shorten 9 1001 9
10 1010 A
the length 11 1011 B
(easy to understand for us) 12 1100 C
13 1101 D
14 1110 E
15 1111 F
16 10000 10
12
Training material of NHK-CTI
14
Training material of NHK-CTI
16
Training material
2007 NHK-CTI
Analog to Digital
Training material of NHK-CTI
Conversion
17
Training material of NHK-CTI
A/D Source
Modulation
Conversion Coding
Sampling
Quantization
18
Training material
2007 NHK-CTI
19
Training material of NHK-CTI
level
level
• Pick out samples from a input signal
continuous signal at every
temporal interval Ts
– Sampling interval Ts time
level
– Sampling frequency fs Ts
sampling pulse
fs=1/Ts
• Amplitude of samples is time
analog value PAM
level
series of samples
(Pulse Amplitude Modulation)
time
21
Training material of NHK-CTI
level
time time
D/A conversion D/A conversion
level
level
time time
– Able to reproduce – Impossible to restore original
original waveform input signal
– Increase the number of
samples 22
Training material of NHK-CTI
x4 resolution
23
Training material of NHK-CTI
input signal:
2kHz sine wave
Sampling point
:6kHz
time :2kHz
Mathematical analysis
• Temporal waveform: • Frequency waveform:
∞ ∞
x (t ) = ∫ X ( f ) exp( j 2πft ) df X ( f ) = ∫ x( t ) exp( − j 2πft )dt
−∞ −∞
level
level
time fh frequency
level
X(f) fh : highest frequency
level
level
level
time
level
fs 2fs frequency
level
time frequency 27
Training material of NHK-CTI
level
fh 2fh frequency fh 2fh frequency
level
level
frequency frequency
fh fh
fs/2 fs/2
28
Training material of NHK-CTI
29
Training material of NHK-CTI
A/D Source
LPF Conversion Coding
level
level
frequency frequency
31
Training material
2007 NHK-CTI
32
Training material of NHK-CTI
Quantization error
Training material of NHK-CTI
level
level
34
Training material of NHK-CTI
level
time time
14 15 12 5 3 4 8 9 7 ... 3 3 3 1 1 1 2 2 2...
1110 1111 1100 0101 0011 0100 1000 1001 0111... 11 11 11 01 01 01 10 10 10...
36
Training material of NHK-CTI
37
Training material of NHK-CTI
• Non-linear quantization
• Scale factor
• Dithering
38
Training material of NHK-CTI
Non--linear quantization
Non
Training material of NHK-CTI
• Linear quantization
level • Non-linear quantization
level
– Quantization error is larger
in low level signals – Solution of an affection of
quantization error
6.5”7” … 8%
High level signal
1.5”2” … 33%
Coarse quantization
(Quantity of error is same,
but ratio or error is different) Low level signal
Fine quantization
71
39
Training material of NHK-CTI
level
Scale factor
time time
– High quantization error – Quantize signals based on
– Waste of higher bits maximum level in certain
interval
– Need to transmit scale
factor value
40
Training material of NHK-CTI
Dithering
Training material of NHK-CTI
level
level
time time time
– With dithering
Sampling Quantize
level
level
level
time time time
41
Training material of NHK-CTI
– Represent pseudo
– Contouring appears
gradations
at quantizing thresholds
42
Training material of NHK-CTI
Summary: Quantization
Training material of NHK-CTI
(or Encoding)
45
Training material of NHK-CTI
A/D Source
Modulation
Conversion Coding
Data compression
46
Training material
2007 NHK-CTI
Data compression
Training material of NHK-CTI
47
Training material of NHK-CTI
48
Training material of NHK-CTI
49
Training material of NHK-CTI
Run-length Coding
Entropy Encoding Huffman Coding
Arithmetic Coding
DPCM
Prediction
DM
Source Coding FFT
Transformation
DCT
Vector Quantization
JPEG
MPEG
Hybrid Coding
H.261
DVI RTV, DVI PLV
50
Training material of NHK-CTI
Non--reversible compression
Non
• Reversible compression
(loss-less compression)
– Decoded data is the same as original
– Applied for computer, medical data
• Non-reversible compression
(lossy compression)
– Decoded data is not the same as original
– Compression ratio is better than reversible
compression
– Applied for audio and video
51
Training material of NHK-CTI
52
Training material of NHK-CTI
53
Training material of NHK-CTI
• Original data
AABACEAAACABGAAADBCACAF DEDABAA
001001010001011
011101
101001001001011001010 111 001001001100010011001011001110100101100001010001001 90bits
110111010000111101010110000011100101101010101000010010001001101111 66bits
• Huffman code 1
A B
011
C
010
D
001
E
0001
F
00001 00000
G
54
Training material of NHK-CTI
Perceptual coding
81
• Aural masking effect
– the presence of a strong audio signal makes a temporal
or spectral neighborhood of weaker audio signals
imperceptible
Threshold of audibility
Signals are inaudible if its level is lower than certain
threshold Aural masking
Threshold of audibility
level (dB)
57
Training material
2007 NHK-CTI
Digital to Analog
Training material of NHK-CTI
Conversion
58
Training material of NHK-CTI
D/A De-
Conversion
Decoding modulation
59
Training material of NHK-CTI
A/D 7 7 6 3 2 2 4 5 4 ...
conversion
not same! 111 111 110 011 010 010 100 101 100 …
D/A
conversion 7 7 6 3 2 2 4 5 4 ...
level PCM
level
7
6
= 5
4
3
2
1
0
time time 60
Training material of NHK-CTI
level
Ts 2Ts time Ts 2Ts time
LPF
level
freq. 61
Training material of NHK-CTI
• Principal of interpolation
– When the pulse signal passes through LPF, it becomes a
sampling function (sinc function)
– Assumed that cutoff frequency of LPF is same as the
sampling frequency, it is theoretically completely
restorable (However, ideal LPF cannot be produced)
1 1
T=1/2f
‐T
0 time ‐2T 0 T 2T time
sinc = sin(x)/x
1 LPF
0 frequency
62
Training material of NHK-CTI
LPF (interpolation)
Training material of NHK-CTI
• Interpolation
– Interpolate by passing the PAM signal through
LPF and reproduce the original shape of waves
– Ideal LPF cannot be produced, therefore the
interpolation error is inevitable
PAM signal Analog signal
0 T 2T 3T 4T time 0 T 2T 3T 4T time
1 LPF
0 frequency
63
Training material of NHK-CTI
level
freq. freq.
64
Training material
2007 NHK-CTI
reference
65
Training material of NHK-CTI
66
Training material of NHK-CTI
1.5
0.5
V
-0.5
-1
-1.5
-2
0 0.01 0.02 0.03 0.04 0.05 0.06
Time [sec]
2-bit midriser
67
Training material of NHK-CTI
1.5
Quantization
1
error
0.5
V
-0.5
-1
-1.5
-2
0 0.01 0.02 0.03 0.04 0.05 0.06
Time [sec]
2-bit midriser
68
Training material of NHK-CTI
Level
∆V
approximated by stairs
∆V
∆V – ∆V / 2 12
V 2 V2
Signal power is S =( ) =
2 2 8
V 2 /8 3 V2 3 2b
S / Nq = = = 2
∆V / 12 2 ∆V
2 2
2
V2
Where number of quantization step: 2 = 2b
∆V 2
Therefore 6dB is improved by increasing one bit of b
S / N (dB ) = 10 log(3 / 2 * 22b ) = 6b + 1.8
70
Training material of NHK-CTI
QUANTIZER CHARACTERISTIC
1 log ( µ x + 1 )
y = sign( x )
e
0.8
log ( µ + 1 )
e
0.4 0≤ x ≤1
: output
y is quantized
OUTPUT
0.2
− 1( x < 0)
0
255 sign( x) = 0 ( x = 0)
1( x > 0)
-0.2 128
32
-0.4 ITU standard :µ=255
(Japan, USA)
-0.6
-0.8
In Europe: A-Low
-1
-1 -0.5 0 0.5 1
INPUT
G.711 A-LAW/µ-LAW(8 bits/sample)
71
Training material of NHK-CTI
Output Output
0 0
Input Input
Compression Extension
10 Q 00
Q
(Uni-polar)
) 0
+1
NRZ
0
(Bi-polar)
) -1
+1
NRZI 0
RZ +1
(Uni-polar)
) 0
+1
RZ
0
(Bi-polar)
) -1
+1
Manchester 0
-1
76
Training material of NHK-CTI
-10 -5 5 10
78
Training material of NHK-CTI
(1 + a)
0 , f > W F: Nyquist function
2
1 1 W (1 + a ) (1 − a)
F ( f ) = (1 − sin( π ( f − ))), W> f > W a: Roll off rate
2 aW 2 2 2
1, (1 − a )
f > W
2
The Nyquist pulse becomes zero every T cycle, and has the feature with a small
amplitude in the part of the tail of the vibration. The occupied frequency band
becomes (1+a) W. When a roll off rate (a) is small, although the amplitude in the
part of the tail becomes large, the occupied frequency band narrows. When a roll off
rate (a) is large, although the amplitude in the part of the tail is small, the occupied
frequency band extends. Usually it is used 0.1.. ..<.. a<0.8.
Occupied
F(f) bandwidth F(f) F(f) F(f)
1 1 1 1
1
1
0.75
0.75
0.5 0.5
0.25 0.25
-10 -5 5 10 -10 -5 5 10
a=0.0 a=0.1
-10 -5 5 10
-10 -5 5 10 -10 -5 5 10
a=0.5 a=0.8
a=0.3
80
Training material of NHK-CTI
60 C (masker)
A (threshold in quiet)
B (masking threshold)
40 D (masked sound)
20
0
0.02 0.05 0.1 0.2 0.5 1 2 5 10 20
Frequency(kHz)
SPL
(in db)
Masker on
Pre-masking
Post-masking
Simultaneous
Masking
Time
82
Training material of NHK-CTI
Scrambler
Pulse sequence
Descrambler
From channel pulse sequence
Reception side
Same as original pulse sequence
83
Training material of NHK-CTI
• Maximal-length sequences
– Longest cyclic code generated by using shift register and
feedback
Scrambled output
Input data
D D D
Clock
84