Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104887100
1_quantization.tex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Mar 13, 03:32
Size
18 KB
Mime Type
text/x-tex
Expires
Sat, Mar 15, 03:32 (2 d)
Engine
blob
Format
Raw Data
Handle
24870462
Attached To
R2653 epfl
1_quantization.tex
View Options
\documentclass
[aspectratio=169]
{
beamer
}
\def\stylepath
{
../styles
}
\usepackage
{
\stylepath
/com303
}
\begin
{
document
}
\begin
{
frame
}
\frametitle
{
Overview:
}
\begin
{
itemize
}
\item
Quantization
\item
Uniform quantization and error analysis
\item
Clipping, saturation, companding
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Quantization
}
\begin
{
itemize
}
\item
digital devices can only deal with integers (
$
R
$
bits per sample)
\item
we need to map the range of a signal onto a finite set of values
\item
irreversible loss of information
$
\rightarrow
$
quantization noise
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Quantization schemes
}
\begin
{
figure
}
\center
\begin
{
dspBlocks
}{
1.2
}{
.11
}
$
x
[
n
]
$
~~
&
{
\BDfilter
{
$
\mathcal
{Q}
\{\cdot\}
$
}}
&
~~
$
\hat
{x}
[
n
]
$
\\
&
&
\\
\ncline
{
->
}{
1,1
}{
1,2
}
\ncline
{
->
}{
1,2
}{
1,3
}
\end
{
dspBlocks
}
\end
{
figure
}
\vspace
{
1em
}
Several factors at play:
\begin
{
itemize
}
\item
storage budget (bits per sample)
\item
storage scheme (fixed point, floating point)
\item
properties of the input
\begin
{
itemize
}
\item
range
\item
probability distribution
\end
{
itemize
}
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Scalar quantization
}
\begin
{
figure
}
\center
\begin
{
dspBlocks
}{
1.2
}{
.1
}
$
x
[
n
]
$
~~
&
{
\BDfilter
{
$
\mathcal
{Q}
\{\cdot\}
$
}}
&
~~
$
\hat
{x}
[
n
]
$
\\
&
&
\only
<3->
{
$
R
$
bps
}
\\
\ncline
{
->
}{
1,1
}{
1,2
}
\ncline
{
->
}{
1,2
}{
1,3
}
\end
{
dspBlocks
}
\end
{
figure
}
\vspace
{
1em
}
The simplest quantizer:
\begin
{
itemize
}
\item
each sample is encoded individually (hence
{
\em
scalar
}
)
\item
each sample is quantized independently (memoryless quantization)
\item
each sample is encoded using
$
R
$
bits
\end
{
itemize
}
\end
{
frame
}
\def\btick
#1
{
\psline
[linewidth=0.6pt]
(#1,-.1)(#1,.1)
}
\def\qtick
#1#2
{
\btick
{
#1
}
\uput
{
10pt
}
[-90](#1,0)
{
$
i_{#
2
}
$
}}
\def\qdot
#1#2
{
\pscircle*
(#1,0)
{
2pt
}
\uput
[90]
(#1,0)
{
$
\hat
{x}_{#
2
}
$
}}
\def\qbrace
#1#2#3#4
{
%
\psbrace
[braceWidth=0.5pt,braceWidthOuter=3pt,rot=90,nodesepB=10pt]
%
(! #1 0.1 add -0.3)(! #2 0.1 sub -0.3)
{
$
I_{#
3
}
$
}
%
\uput
[-90]
(! #1 #2 add 0.5 mul 0.7)
{
$
k
=
#
4
$
}}
\def\dbrace
#1#2#3
{
%
\psbrace
[braceWidth=0.5pt,braceWidthOuter=3pt,rot=90,nodesepB=10pt]
%
(! #1 0.1 add -0.3)(! #2 0.1 sub -0.3)
{
#3
}}
\begin
{
frame
}
\frametitle
{
Scalar quantization
}
Input signal:
$
A
\le
x
[
n
]
\le
B
$
(
$
A, B
$
can be
$
\infty
$
)
\begin
{
itemize
}
\item
<2-> each sample quantized over
$
2
^R
$
possible values
$
\Rightarrow
$
$
2
^R
$
intervals.
\item
<3-> each interval associated to a quantization value
\end
{
itemize
}
\setbeamercovered
{
invisible
}
\begin
{
figure
}
\center
\psset
{
xunit=2.4cm,yunit=2cm
}
\begin
{
pspicture
}
(0.5,-1)(5.5,1)
\psline
[linewidth=1pt,tickwidth=2pt,]
(1,0)(5,0)
%
\btick
{
1
}
\uput
{
8pt
}
[90](1,0)
{
$
A
$
}
\btick
{
5
}
\uput
{
8pt
}
[90](5,0)
{
$
B
$
}
\uncover
<2->
{
\btick
{
1
}
\btick
{
2
}
\btick
{
5
}
\btick
{
2.5
}
\btick
{
4
}}
\uncover
<3->
{
\qdot
{
4.4
}{
3
}
\qdot
{
1.5
}{
0
}
\qdot
{
2.4
}{
1
}
\qdot
{
3
}{
2
}}
\end
{
pspicture
}
\end
{
figure
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Scalar quantization
}
Example for
$
R
=
2
$
:
\begin
{
figure
}
[t]
\center
\psset
{
xunit=2.4cm,yunit=2cm
}
\begin
{
pspicture
}
(0.5,-1)(5.5,1)
\psline
[linewidth=1pt,tickwidth=2pt,]
(1,0)(5,0)
\uput
{
8pt
}
[90](1,0)
{
$
A
$
}
\uput
{
8pt
}
[90](5,0)
{
$
B
$
}
\qtick
{
1
}{
0
}
\qtick
{
2
}{
1
}
\qdot
{
1.5
}{
0
}
\qbrace
{
1
}{
2
}{
0
}{
00
}
\qtick
{
2.5
}{
2
}
\qdot
{
2.4
}{
1
}
\qbrace
{
2
}{
2.5
}{
1
}{
01
}
\qtick
{
4
}{
3
}
\qdot
{
3
}{
2
}
\qbrace
{
2.5
}{
4
}{
2
}{
10
}
\qtick
{
5
}{
4
}
\qdot
{
4.4
}{
3
}
\qbrace
{
4
}{
5
}{
3
}{
11
}
\end
{
pspicture
}
\end
{
figure
}
\pause
\begin
{
itemize
}
\item
what are the optimal interval boundaries
$
i_k
$
?
\item
what are the optimal quantization values
$
\hat
{x}_k
$
?
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Optimal Quantization
}
\centering
The optimal quantizer minimizes the energy of the quantization error:
\[
e
[
n
]
=
\mathcal
{Q}
\{
x
[
n
]
\}
-
x
[
n
]
=
\hat
{x}
[
n
]
-
x
[
n
]
\]
\vspace
{
1em
}
\begin
{
itemize
}
\item
model
$
x
[
n
]
$
as a stochastic process
\item
find the optimal
$
i_k
$
and
$
\hat
{x}_k
$
that minimize
$
\sigma
_e^
2
=
\expt
{e^
2
[
n
]
}
$
\item
optimal quantizer will depend on the input's statistics
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Quantization MSE
}
\centering
\begin
{
align*
}
\sigma
_
e
^
2
&
=
\int
_{
-
\infty
}^{
\infty
}
(x -
\mathcal
{
Q
}
\{
x
\}
)
^
2
\,
f
_
x(x)
\,
dx
\\
&
=
\sum
_{
k=0
}^{
2
^
R - 1
}
\int
_{
i
_
k
}^{
i
_{
k+1
}}
(x -
\hat
{
x
}_
k)
^
2
\,
f
_
x(x)
\,
dx
\end
{
align*
}
\vspace
{
2em
}
find global minimum wrt
$
i_k
$
,
$
\hat
{x}_k
$
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Simple example: optimal one-bit quantizer
}
\centering
\begin
{
figure
}
[t]
\psset
{
xunit=2.4cm,yunit=2cm
}
\begin
{
pspicture
}
(0.5,-1)(5.5,1)
\psline
[linewidth=1pt,tickwidth=2pt,]
(1,0)(5,0)
\uput
{
8pt
}
[90](1,0)
{
$
A
$
}
\uput
{
8pt
}
[90](5,0)
{
$
B
$
}
\qtick
{
1
}{
0
}
\qtick
{
2.5
}{
1
}
\qtick
{
5
}{
2
}
\qdot
{
2.2
}{
0
}
\qdot
{
4.2
}{
1
}
\end
{
pspicture
}
\end
{
figure
}
3 free parameters:
$
i_
1
,
\hat
{x}_
0
,
\hat
{x}_
1
$
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Simple example: optimal one-bit quantizer
}
\centering
\[
\sigma
_e^
2
=
\int
_{A}^{i_
1
}
(
x
-
\hat
{x}_
0
)
^
2
\,
f_x
(
x
)
\,
dx
+
\int
_{i_
1
}^{B}
(
x
-
\hat
{x}_
1
)
^
2
\,
f_x
(
x
)
\,
dx
\]
\pause
\vspace
{
1em
}
find
$
i_
1
,
\hat
{x}_
0
,
\hat
{x}_
1
$
such that
\[
\frac
{
\partial
\sigma
_e^
2
}{
\partial
i_
1
}
=
\frac
{
\partial
\sigma
_e^
2
}{
\hat
{x}_
0
}
=
\frac
{
\partial
\sigma
_e^
2
}{
\hat
{x}_
1
}
=
0
\]
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
little calculus reminder
}
\[
\frac
{
\partial
}{
\partial
t}
\int
_{
\alpha
}^{t} f
(
\tau
)
\,
d
\tau
=
\frac
{
\partial
}{
\partial
t}
\left
[
F
(
t
)
-
F
(
\alpha
)
\right
]
=
f
(
t
)
\]
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Optimal one-bit quantizer: threshold
}
\centering
\begin
{
align*
}
\frac
{
\partial
\sigma
_
e
^
2
}{
\partial
i
_
1
}
&
=
\frac
{
\partial
}{
\partial
i
_
1
}
\left
[\int_{A}^{i_1} (x - \hat{x}_0)^2\,f_x(x)\,dx + \int_{i_1}^{B} (x - \hat{x}_1)^2\,f_x(x)\,dx \right]
\\
\pause
&
= (i
_
1 -
\hat
{
x
}_
0)
^
2
\,
f
_
x(i
_
1) - (i
_
1 -
\hat
{
x
}_
1)
^
2
\,
f
_
x(i
_
1) = 0
\\
\\
\pause
&
\Rightarrow
(i
_
1 -
\hat
{
x
}_
0)
^
2 - (i
_
1 -
\hat
{
x
}_
1)
^
2 = 0
\\
\\
\pause
&
\Rightarrow
i
_
1 =
\frac
{
\hat
{
x
}_
0 +
\hat
{
x
}_
1
}{
2
}
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Optimal one-bit quantizer: values
}
\centering
\begin
{
align*
}
\frac
{
\partial
\sigma
_
e
^
2
}{
\partial
\hat
x
_
0
}
&
=
\frac
{
\partial
}{
\partial
x
_
0
}
\int
_{
A
}^{
i
_
1
}
(x -
\hat
{
x
}_
0)
^
2
\,
f
_
x(x)
\,
dx
\\
\pause
&
=
\int
_{
A
}^{
i
_
1
}
2(
\hat
{
x
}_
0 - x)
\,
f
_
x(x)
\,
dx = 0
\\
\\
\pause
&
\Rightarrow
\hat
x
_
0 =
\frac
{
\int
_{
A
}^{
i
_
1
}
x
\,
f
_
x(x)
\,
dx
}{
\int
_{
A
}^{
i
_
1
}
f
_
x(x)
\,
dx
}
\qquad\mbox
{
\it
(center of mass)
}
\\
&
\Rightarrow
\hat
x
_
1 =
\frac
{
\int
_{
i
_
1
}^{
B
}
x
\,
f
_
x(x)
\,
dx
}{
\int
_{
i
_
1
}^{
B
}
f
_
x(x)
\,
dx
}
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
For uniformly-distributed input
}
\centering
\begin
{
align*
}
f
_
x(x)
&
=
\frac
{
1
}{
B-A
}
\\
\\
\pause
\hat
x
_
0
&
=
\frac
{
\int
_{
A
}^{
i
_
1
}
x
\,
dx
}{
\int
_{
A
}^{
i
_
1
}
dx
}
=
\frac
{
A + i
_
1
}{
2
}
\\
\hat
x
_
1
&
=
\frac
{
\int
_{
i
_
1
}^{
B
}
x
\,
dx
}{
\int
_{
i
_
1
}^{
B
}
dx
}
=
\frac
{
i
_
1 + B
}{
2
}
\\
\\
\pause
i
_
1
&
=
\frac
{
\hat
{
x
}_
0 +
\hat
{
x
}_
1
}{
2
}
=
\frac
{
A + B
}{
2
}
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Optimal one-bit quantizer
}
\centering
\begin
{
figure
}
[t]
\psset
{
xunit=2.4cm,yunit=2cm
}
\begin
{
pspicture
}
(0.5,-1)(5.5,1)
\psline
[linewidth=1pt,tickwidth=2pt,]
(1,0)(5,0)
\uput
{
8pt
}
[90](1,0)
{
$
A
$
}
\uput
{
8pt
}
[90](5,0)
{
$
B
$
}
\qtick
{
1
}{
0
}
\qtick
{
3
}{
1
}
\qtick
{
5
}{
2
}
\qdot
{
2
}{
0
}
\qdot
{
4
}{
1
}
\end
{
pspicture
}
\end
{
figure
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform quantization of uniform input
}
\begin
{
itemize
}
\item
simple but very general case
\item
optimal subdivision:
$
2
^R
$
\emph
{
equal
}
intervals of width
$
\Delta
=
(
B
-
A
)
2
^{
-
R}
$
\item
optimal quantization values: interval's midpoint
\end
{
itemize
}
\setbeamercovered
{
invisible
}
{
\begin
{
figure
}
[t]
\center
\psset
{
xunit=2.4cm,yunit=2cm
}
\begin
{
pspicture
}
(0.5,-1)(5.5,1)
\psline
[linewidth=1pt,tickwidth=2pt,]
(1,0)(5,0)
\uput
{
8pt
}
[90](1,0)
{
$
A
$
}
\uput
{
8pt
}
[90](5,0)
{
$
B
$
}
\btick
{
1
}
\btick
{
2
}
\btick
{
3
}
\btick
{
4
}
\btick
{
5
}
\qdot
{
1.5
}{
0
}
\qdot
{
2.5
}{
1
}
\qdot
{
3.5
}{
2
}
\qdot
{
4.5
}{
3
}
\dbrace
{
1
}{
2
}{
$
\Delta
$
}
\end
{
pspicture
}
\end
{
figure
}}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform 3-Bit quantization function
}
\begin
{
figure
}
\center
\psset
{
xunit=3cm,yunit=3cm
}
\begin
{
pspicture
}
(-1.2,-1.2)(1.2,1.2)
\tiny
\psaxes
[linewidth=1pt,tickwidth=0.5pt,
%
Dx=.25,Dy=.25,
%
showorigin=false](0,0)(-1.1,-1)(1.1,1)
\uput
[90]
(0,1)
{
$
\hat
{x}
[
n
]
$
}
\uput
[90]
(1.1,0)
{
$
x
[
n
]
$
}
\multido
{
\n
=0.875+-.250
}{
8
}{
%
\pscircle*
[linecolor=orange]
(0,
\n
)
{
2pt
}
}
\psline
[linecolor=blue,linestyle=dotted]
(-1,-1)(1,1)
\psplot
[plotpoints=800,
%
linewidth=1pt,linecolor=orange]
{
-.99
}{
.99
}
%
{
x abs 0.25 div floor 0.25 mul 0.125 add x abs x div mul
}
\uput
[90]
(! -1 0.125 add 0.25 0 mul add dup)
{
\gray
000
}
\uput
[90]
(! -1 0.125 add 0.25 1 mul add dup)
{
\gray
001
}
\uput
[90]
(! -1 0.125 add 0.25 2 mul add dup)
{
\gray
010
}
%\uput[90](! -1 0.125 add 0.25 3 mul add dup){\gray 011}
\uput
[90]
(! -1 0.125 add 0.25 4 mul add dup)
{
\gray
100
}
\uput
[90]
(! -1 0.125 add 0.25 5 mul add dup)
{
\gray
101
}
\uput
[90]
(! -1 0.125 add 0.25 6 mul add dup)
{
\gray
110
}
\uput
[90]
(! -1 0.125 add 0.25 7 mul add dup)
{
\gray
111
}
\end
{
pspicture
}
\end
{
figure
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform quantization of uniform input: error analysis
}
\begin
{
align*
}
\sigma
_
e
^
2
&
=
\int
_
A
^
B f
_
x(x)(
\mathcal
{
Q
}
\{
x
\}
- x)
^
2
\,
dx
\\
\pause
&
=
\sum
_{
k=0
}^{
2
^
R-1
}
\int
_{
I
_
k
}
f
_
x(x)(
\hat
{
x
}_
k - x)
^
2
\,
dx
\\
\\
\pause
f
_
x(s)
&
=
\frac
{
1
}{
B-A
}
\\
\Delta
&
=
\frac
{
B-A
}{
2
^
R
}
\\
I
_
k
&
= [A + k
\Delta
, A+(k+1)
\Delta
]
\\
\hat
x
_
k
&
= A+k
\Delta
+
\Delta
/2
\end
{
align*
}
\end
{
frame
}
\begin
{
comment
}
\begin
{
frame
}
\frametitle
{
Uniform quantization
}
\begin
{
itemize
}
[<+->]
\item
simple but very general case
\item
range is split into
$
2
^R
$
\emph
{
equal
}
intervals of width
$
\Delta
=
(
B
-
A
)
2
^{
-
R}
$
%\item quantization value is interval's midpoint
\end
{
itemize
}
\setbeamercovered
{
invisible
}
\uncover
<3->
{
\begin
{
figure
}
[t]
\center
\psset
{
xunit=2.4cm,yunit=2cm
}
\begin
{
pspicture
}
(0.5,-1)(5.5,1)
\psline
[linewidth=1pt,tickwidth=2pt,]
(1,0)(5,0)
\uput
{
8pt
}
[90](1,0)
{
$
A
$
}
\uput
{
8pt
}
[90](5,0)
{
$
B
$
}
\btick
{
1
}
\btick
{
2
}
\btick
{
3
}
\btick
{
4
}
\btick
{
5
}
\dbrace
{
1
}{
2
}{
$
\Delta
$
}
\end
{
pspicture
}
\end
{
figure
}}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform quantization
}
Mean Square Error is the second moment of the error signal:
\begin
{
align*
}
\sigma
_
e
^
2
&
=
\expt
{
|
\mathcal
{
Q
}
\{
x[n]
\}
- x[n]|
^
2
}
\\
\pause
&
=
\int
_
A
^
B f
_
x(
\tau
)(
\mathcal
{
Q
}
\{
\tau
\}
-
\tau
)
^
2
\,
d
\tau
\\
\pause
&
=
\sum
_{
k=0
}^{
2
^
R-1
}
\int
_{
I
_
k
}
f
_
x(
\tau
)(
\hat
{
x
}_
k -
\tau
)
^
2
\,
d
\tau
\\
\pause
\end
{
align*
}
\centering
error depends on the probability distribution of the input
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform quantization of uniform input
}
Uniform-input hypothesis:
\[
f_x
(
\tau
)
=
\frac
{
1
}{B
-
A}
\]
\vspace
{
1em
}
\[
\sigma
_e^
2
=
\,\sum
_{k
=
0
}^{
2
^R
-
1
}
\int
_{I_k}
\frac
{
(
\hat
{x}_k
-
\tau
)
^
2
}{B
-
A}
\,
d
\tau
\]
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform quantization of uniform input
}
Let's find the optimal quantization point by minimizing the error
\begin
{
align*
}
\frac
{
\partial\sigma
_
e
^
2
}{
\partial
\hat
{
x
}_
m
}
&
=
\frac
{
\partial
}{
\partial
\hat
{
x
}_
m
}
\,\sum
_{
k=0
}^{
2
^
R-1
}
\int
_{
I
_
k
}
\frac
{
(
\hat
{
x
}_
k -
\tau
)
^
2
}{
B-A
}
\,
d
\tau
\\
\pause
&
=
\int
_{
I
_
m
}
\frac
{
2(
\hat
{
x
}_
m -
\tau
)
}{
B-A
}
\,
d
\tau
\\
\pause
&
=
\left
.
\frac
{
(
\hat
{
x
}_
m -
\tau
)
^
2
}{
B-A
}
\right
|
_{
A + m
\Delta
}^{
A + m
\Delta
+
\Delta
}
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Uniform quantization of uniform input
}
Minimizing the error:
\[
\frac
{
\partial\sigma
_e^
2
}{
\partial
\hat
{x}_m}
=
0
\quad
\mbox
{for $
\hat
{x}_m
=
A
+
m
\Delta
+
\frac
{
\Delta
}{
2
}$}
\]
\vspace
{
1em
}
\centering
optimal quantization point is the interval's midpoint, for all intervals
\end
{
frame
}
\end
{
comment
}
\begin
{
frame
}
\frametitle
{
Uniform quantization of uniform input: error analysis
}
\begin
{
align*
}
\sigma
_
e
^
2
&
=
\sum
_{
k=0
}^{
2
^
R-1
}
\int
_{
A+k
\Delta
}^{
A+k
\Delta
+
\Delta
}
\frac
{
(A + k
\Delta
+
\Delta
/2 - x)
^
2
}{
B-A
}
\,
dx
\\
\pause
&
= 2
^
R
\int
_{
0
}^{
\Delta
}
\frac
{
(
\Delta
/2 - x)
^
2
}{
B-A
}
\,
dx
\\
\pause
&
=
\frac
{
\Delta
^
2
}{
12
}
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Error analysis
}
\begin
{
itemize
}
[<+->]
\item
error energy
\[
\sigma
^
2
_e
=
\Delta
^
2
/
12
,
\qquad
\Delta
=
(
B
-
A
)/
2
^R
\]
\item
signal energy
\[
\sigma
_x^
2
=
(
B
-
A
)
^
2
/
12
\]
\item
signal to noise ratio
\[
\mbox
{SNR}
=
2
^{
2
R}
\]
\item
in dB
\[
\mbox
{SNR}_{
\mbox
{dB}}
=
10
\log
_{
10
}
2
^{
2
R}
\approx
6
R
\,\,\mbox
{dB}
\]
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
The ``6dB/bit'' rule of thumb
}
\begin
{
itemize
}
\item
a compact disk has 16 bits/sample:
\[
\mbox
{max SNR}
=
96
\mbox
{dB}
\]
\item
a DVD has 24 bits/sample:
\[
\mbox
{max SNR}
=
144
\mbox
{dB}
\]
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Rate/Distortion Curve
}
\begin
{
figure
}
\begin
{
dspPlot
}
[width=5cm,height=5cm,sidegap=0,xticks=none,yticks=none,xlabel=
{
rate (
$
R
$
)
}
,ylabel=
{
distortion (
$
\sigma
_e^
2
$
)
}
]
{
0,6
}{
0,1
}
\moocStyle
\dspFunc
{
x -2 mul 2 exch exp
}
\end
{
dspPlot
}
\end
{
figure
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Other quantization errors
}
If input is not bounded to
$
[
A,B
]
$
several options; eg:
\begin
{
itemize
}
\item
clip samples to
$
[
A,B
]
$
: linear distortion (can be put to good use in guitar effects!)
\item
smoothly saturate input: this simulates the saturation curves of analog electronics
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Clipping vs saturation
}
\begin
{
columns
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
dspPlot
}
[width=5cm,height=5cm,sidegap=0]
{
-2.5,2.5
}{
-1.5,1.5
}
\moocStyle
\dspFunc
{
x abs 1 gt
{
x abs x div
}
{
x
}
ifelse
}
\end
{
dspPlot
}
\end
{
figure
}
\end
{
column
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
dspPlot
}
[width=5cm,height=5cm,sidegap=0]
{
-2.5,2.5
}{
-1.5,1.5
}
\moocStyle
\dspFunc
{
2.7 2 x mul exp dup 1 sub exch 1 add div
}
\end
{
dspPlot
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Other quantization errors
}
If input is not uniform, several options:
\begin
{
itemize
}
\item
use uniform quantizer and accept increased error.
\\
For instance, if input is Gaussian:
\[
\sigma
^
2
_e
=
\frac
{
\sqrt
{
3
}
\pi
}{
2
}
\,
\sigma
^
2
\,
\Delta
^
2
\]
\item
use ``companders''
\item
design optimal quantizer for input distribution, if known (Lloyd-Max algorithm)
\end
{
itemize
}
\end
{
frame
}
\def\muval
{
255
}
\def\mulaw
{
dup dup abs div exch abs
\muval
mul 1 add ln 1
\muval
add ln div mul
}
\def\imulaw
{
abs 1
\muval
add exch exp 1 sub
\muval
div
}
\begin
{
frame
}
\frametitle
{
$
\mu
$
-law compander
}
\begin
{
columns
}
\begin
{
column
}{
0.3
\paperwidth
}
\[
\mathcal
{C}
\{
x
[
n
]
\}
=
\mbox
{sgn}
(
x
[
n
])
\frac
{
\ln
(
1
+
\mu
|x
[
n
]
|
)
}{
\ln
(
1
+
\mu
)
}
\]
\end
{
column
}
\begin
{
column
}{
0.5
\paperwidth
}
\begin
{
figure
}
\center
\psset
{
xunit=3cm,yunit=3cm
}
\begin
{
pspicture
}
(-1.2,-1.2)(1.2,1.2)
\psgrid
[gridlabels=0,subgriddiv=10,subgriddots=5]
(0,0)(-1,-1)(1,1)
\psaxes
[linewidth=1pt,labels=none,showorigin=false]
(0,0)(-1,-1)(1,1)
\psaxes
[linewidth=1pt,axesstyle=frame,yAxis=false,ticks=none,labels=none]
(0,0)(-1,-1)(1,1)
\uput
[90]
(0,1)
{
$
\mathcal
{C}
\{
x
\}
$
}
\uput
[0]
(1,0)
{
$
x
$
}
\psplot
[plotpoints=800,linewidth=2pt,linecolor=darkred]
{
-.99
}{
.99
}{
x
\mulaw
}
\end
{
pspicture
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Lloyd-Max Quantizer design
}
\begin
{
align*
}
\sigma
_
e
^
2
&
=
\sum
_{
k=0
}^{
2
^
R - 1
}
\int
_{
i
_
k
}^{
i
_{
k+1
}}
(x -
\hat
{
x
}_
k)
^
2
\,
f
_
x(x)
\,
dx
\\
\\
\mbox
{
A)
}
\quad
\frac
{
\partial
\sigma
_
e
^
2
}{
\partial
\hat
x
_
k
}
= 0
&
\Rightarrow
\hat
x
_
k =
\frac
{
\displaystyle\int
_{
i
_{
k-1
}}^{
i
_
k
}
x
\,
f
_
x(x)
\,
dx
}{
\displaystyle\int
_{
i
_{
k-1
}}^{
i
_
k
}
f
_
x(x)
\,
dx
}
\\
\mbox
{
B)
}
\quad\frac
{
\partial
\sigma
_
e
^
2
}{
\partial
i
_
k
}
= 0
&
\Rightarrow
i
_
k =
\frac
{
\hat
{
x
}_{
k-1
}
+
\hat
{
x
}_
k
}{
2
}
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Lloyd-Max Quantizer design
}
\begin
{
itemize
}
\item
start with a guess for the
$
i_k
$
\item
solve A and B iteratively until convergence
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Analysis of the quantization error
}
\begin
{
itemize
}
\item
so far we have only a
\textit
{
quantitative
}
result on the error (its power)
\item
to understand the distortion we need the error's spectrum
\item
quantizer is nonlinear: impossible to compute the spectrum exactly
\item
the common approach is to make
\textit
{
assumptions
}
on the error statistics
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
High-resolution hypothesis
}
drastic simplification of the problem: if
\begin
{
itemize
}
\item
input samples are iid (they are not)
\item
$
R
$
is relatively large
\end
{
itemize
}
\vspace
{
2em
}
then we can try to use the following model:
\begin
{
itemize
}
\item
error samples are iid
\item
error is uncorrelated to the signal
\item
quantization error eqivalent to additive white noise with
$
P_e
(
\omega
)
=
\Delta
^
2
/
12
$
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
High-resolution hypothesis
}
\begin
{
center
}
\begin
{
dspBlocks
}{
1.5
}{
0.5
}
$
x
[
n
]
$
~~
&
\BDadd
&
~~
$
\hat
{x}
[
n
]
$
\\
&
\raisebox
{
-12pt
}{
$
e
[
n
]
$
}
\psset
{
arrows=->,linewidth=1.5pt
}
\ncline
{
1,1
}{
1,2
}
\ncline
{
1,2
}{
1,3
}
\ncline
{
2,2
}{
1,2
}
\end
{
dspBlocks
}
\end
{
center
}
\vspace
{
.5em
}
problems with this model:
\begin
{
itemize
}
\item
error is not random!
\item
error is not white or uncorrelated to the input
\end
{
itemize
}
\vspace
{
.5em
}
common approaches:
\begin
{
itemize
}
\item
use
\textit
{
dithering
}
to whiten the noise spectrum
\item
use
\textit
{
feedback
}
in the quantization loop to perform
\textit
{
noise shaping
}
\end
{
itemize
}
\end
{
frame
}
\end
{
document
}
Event Timeline
Log In to Comment