You are on page 1of 12

Ch.

9 Scalar Quantization

1
Encoder: Scalar Quantization
Samples w/ Samples w/
In practice: Large # Bits Small # Bits
(Fine Quantization) (Coarse Quantization)

Analog Signal ADC Encoder Bit Stream


(Samples & (SQ)
Quantizes)

Samples w/
In practice: Real-Valued Small # Bits
Samples in Time (Coarse Quantization)

Analog Signal Sampler Encoder Bit Stream


(Samples in (SQ)
Time Only)

2
Samples w/
Real-Valued Small # Bits
Samples in Time (Coarse Quantization)

Encoder Bit Stream


(SQ)

Encoder: Maps real #s into finitely many binary codewords


ℜ → Binary Code
Assigns M codes to M input intervals
M+1 Decision M
Boundaries Codewords

b0 b1 b2 b3 … bM-1 bM x [b0,b1)
[b1,b2)


C1
C2
[b2,b3) → C3
:
Binary
Codewords: C1 C2 C3 … CM :
[bM-1,bM) → CM
3
Decoder: Scalar Quantization
Quantized
Bit Stream DT Signal
Decoder
(SQ)
Real #s… but only
M M Reconstruction finitely many
Codewords Levels possible values
C1 → y1
C2 → y2


C3 y3 Binary
: Codewords: C1 C2 C3 CM
:
CM → yM
y1 y2 y3 yM y
b0 b1 b2 b3 … bM-1 bM

4
Encoder-Decoder = Quantizer
For analysis: View Encoder & Decoder as a Pair
Codeword w/ Real #… but only
Real # Small # Bits finitely many
possible values

Encoder Decoder
Input x (SQ) Bit (SQ) Output y
Stream
Measure Distortion

b0 b1 b2 b3 … bM-1 bM x

y1 y2 y3 yM y
b0 b1 b2 b3 … bM-1 bM
5
Scalar Quantizer Input-Output Map
Q(x)=yi iff bi-1 < x ≤ bi

{ yi }i =1
M

Recon.
Levels

Step Size

Decision
{bi }i =0
M

Boundaries

6
Quantizer Design DBs Impact Rate if
Entropy Coding is used
Specify: 1. Decision Boundaries (DBs)
Set
2. Codewords Set Rate
Distortion
3. Reconstruction Levels (RLs)
To Meet: 1. Distortion Criteria
Sometimes
2. Rate Criteria just MSE

Distortion We’ll use Mean Square Quantization Error (MSQE)


∫ [ x − Q ( x )] f
Theory: σ q2 = ( x )dx
X We use this theoretical view
−∞
in the design process.
M bi

=∑ ∫ [x − y ] f
i X ( x )dx
i =1 bi −1

DBs RLs 7
Experimental: For a sequence of signal values s[n], n= 0, 1, 2, …

sq[n]
1 N

∑ [Q( s[n]) − s[n]]


2
σˆ =
2
q
N i =1

e[n] is called Quantization Error


…or…
sq [n ] = s[n ] + e[n ] Quantization Noise

Leads to a view of the quantization noise being


added to the original signal… not really what
happens but a nice viewpoint sometimes.

+
s[n] Σ sq[n]
+
e[n] 8
Rate We’ll use Avg # of bits/sample
Let li be the length of the binary code for RL yi.

M
Theory: Then the theoretical Rate is: R = ∑ li P( yi )
i =1

This depends on how likely it is to encode the signal at RL yi


bi
That probability depends on the choice of the DLs: P ( yi ) = ∫ f X ( x )dx
bi −1
⎡M bi

R = ∑ ⎢ li ∫ f X ( x )dx ⎥
i =1 ⎢
⎣ bi−1 ⎥⎦ Experimental:
1 N

f X ( x) Rˆ =
N
∑ Length {Q( s[n])}
i =1

P(y2)

y1 y2 y3 … yM x
b0 b1 b2 b3 … bM-1 bM 9
Quantizer Design Problem
Two “Flavors” of the problem:
1. Given a Distortion Constraint σ q ≤ D
2 *

Find DBs, RLs, & Codes to minimize rate while satisfying


2. Given a Rate ConstraintR ≤ R*
Find DBs, RLs, & Codes to minimize Dist. while satisfying

In general, solving this is pretty complex… So, in practice it is


quite common to use fixed-length codes rather than trying to
optimally choose code lengths as part of the design:
Given R = ⎡⎢log 2 M ⎤⎥ bits / sample
Find DBs & RLs to minimize distortion

10
Tractable Quantizer Design
Two-Stage Encoder Two-Stage Decoder

SQ w/ Entropy Decoder to
Entropy
Fixed-Length Coder Assign RLs
Decoder
Codes (e.g. Huffman)

Design to
Minimize Rate

Design to
Minimize Distortion

We’ll first focus on outside blocks… and design to minimize MSQE:


Scalar Quantizer
SQ w/
Decoder to
Fixed-Length
Assign RLs
Codes
11
Hierarchy of SQ Types
Scalar Quantizers
Uniform Quantizers Non-Uniform Quantizers
(Equal Step Sizes) (Unqqual Step Sizes)

PDF Optimized Adaptive Uniform PDF Optimized Compander w/ UQ


Select Δ to min. Δ adapted to signal’s -Lloyd-Max Q - Use nonlinear
MSQE for assumed local PDF -Iteratively find DB/RL compander around UQ
PDF - Suffers mismatch - Robust to mismatch

Forward Adaptive Backward Adaptive


- Uses current block to Uses past values to
choose Δ choose Δ for current
- Must send side info sample

Uniform Jayant Non-Uniform Jayant


Uses single past Uses single past
sample to adapt sample to adapt
12

You might also like