XXX PDF
XXX PDF
Processing (DSP)
Elena Punskaya
www-sigproc.eng.cam.ac.uk/~op205
1
Books
Books:
2
What is Digital Signal Processing?
3
Applications of DSP - Biomedical
Speech applications:
Examples
1) noise reduction – reducing background noise
in the sequence produced by a sensing device (microphone)
5
Applications of DSP - Communications
Communications:
Examples
1) telephony – transmission of information in digital form via
telephone lines, modem technology, mobile phones
6
Applications of DSP - Radar
Examples
2) tracking
7
Applications of DSP – Image Processing
Image Processing:
Examples
1) content based image retrieval – browsing,
searching and retrieving images from database
2) image enhancement
Music Applications:
Examples:
1) Recording
2) Playback
9
Applications of DSP - Multimedia
Multimedia:
generation storage and
transmission of sound, still
images, motion pictures
Examples:
1) digital TV
2) video conferencing
10
DSP Implementation - Operations
11
DSP chips
limited frequency
resolution
quantisation error
Elena Punskaya
www-sigproc.eng.cam.ac.uk/~op205
21
Time domain
difficult to differentiate
between different sounds
in time domain
tiny segment
sound /i/
as in see
sound /a/
as in father
22
How do we hear?
Fourier Series
for periodic
square wave
!
The Fourier transform
∞
is −jnωT
an equation to
X (ω) = xn e .
calculate the frequency,
n=−∞ amplitude and
phase of each sine wave "∞needed to
make up any X given
(ω)signal
= x(t)e: −jωt
dt.
"∞ −∞
X (ω) = x(t)e−jωt dt.
here T is the sampling interval.
−∞
Analogy:
a prism which splits
white light into a
spectrum of colors
White Spectrum
light of colours
white light consists of all
frequencies mixed
together
signal spectrum
cosine t ω
added higher
frequency t ω
component
peaks correspond to
t the resonances of
sound /a/ ω
the vocal tract shape
as in father in logarithmis units of dB
Xs (ω) = xs (t)e
−jωt
dt 1. The Discrete Time Fourier Transform (DTFT) of a sam
. 6.
−∞
"∞ {xn }, n = 0, ±1, ±2, . . . , ±∞ is given by
5.
"∞
"∞ X
∞s (ω) =
! xs (t)e−jωt!
dt
∞
X (ω) = x(t)
!
∞
δ(t!
− nT )e−jωt
∞ dt
s
Xs (ω) = x(t) δ(t − nT
−∞ )e−jωt
Xs dt
(ω) = x(nT−∞)eX (ω) =
−jωnT
n=−∞ xn e
−jnωT
.
n=−∞ n=−∞ n=−∞
"∞ −∞
!∞
−jωt6.
5. Xs (ω) = x(t) δ(t − nT )e dt
where T is the sampling interval.
using 2.
−∞the “sifting
n=−∞ property of the δ-function to reach the
. ∞ last line
!
−jωnT
Xs (ω) = x(nT∞)e
(a)!
∞ "∞
Explain how !
the
∞ problems
with −jωt
computing the DTFT on 30
"
a digital
n=−∞
Xs (ω) =
X (ω) = x(nT )e−jωnT
x(t)can where
δ(t − nT )e dt X (ω) = x(t)e−jωt
dt.
s computer
n=−∞
be overcome by choosing a
T is the sampling interval. uniformly spaced grip
!
∞ of −∞ n=−∞covering the range of ω from 0 to 2π/T and
N frequencies
−∞
4.
"∞
Discrete Time Fourier Transform
Xs (ω) = – Signal
xs (t)e−jωt dt Samples
−∞
5.
1. The Discrete Time Fourier "∞ Transform (DTFT) of a sampled sequence
Note that this expression known as DTFT ! is a periodic function of
∞
{xn }, n = 0, ±1, ±2,
X .
(ω). . ,=±∞ is given
x(t) byδ(t − nT )e−jωt dt
the frequency usually written as
s
n=−∞
−∞ !
∞
X (ω) = xn e−jnωT .
6. n=−∞
!
∞
The signal sample valuesX may
s (ω)be=expressedx(nT in)eterms
−jωnT of DTFT by
2.
noting that the equation above has n=−∞ the form of Fourier series (as a
function of ω) and hence the sampled "∞ signal can be obtained directly
7. X (ω) = x(t)e−jωt dt.
as
"2π
1 −∞
xn = X(ω)e+jnωT dωT
2π
3. 0
4. 32
"∞
Overcoming problems with computing DTFT
35
uncate the summation inN
N!−1 the expression above to just
n=0 2π N data points we get the n=0 DFT:
−j N np
ts wexget
n e the DFT:
, p = 0, . . . , N − 1 N −1
n=0 2π 2π !N! −1 −j 2π np
) 2π Properties !
N −1 X p = X(
X2π
p =ofNthe
X( p) =
Discrete
p) = xnxen e−j N , ,pp=
N 2π np
= 0,
0, . .. ..,,NN−−1 1
Fourier Transform (DFT)
.
= X( p) = N
xn eN−j−1N np , Np−1
= 0,n=0
. . .n=0
,N −1
N ! N −1!
! ! ! ! !
2π
−jN −1np j 2πn=0
pq N −1j 2π (q−n)p2π N −1 N −1 2π
xn ep −j 2π npe 2π j N=pq! xn! j 2πep(q−n)p N
1 (c)N
(c)N 2π N −1 N −1
N
−j np j 2π
pq j (q−n)p
xn ep N X ejpNepqN = = N xn ep e = N −1 xn ep
N N
n=0 x n e
p=0p
−1 ! −1 ! −1!
N −1 N −1 !
N −1 !
p=0 N! ! ! ! !
−1 N N 2π N −1 N −1 j 2π2π
n=0 j 2π p=0
pqp=0 n=0 2π N np 2π
−j j 2π pq n=0 (q−n)p
p=0
jX2π
pqe N = x−je np je Npq = x e j
N (q−n)p
Xp+N !
N −1=!
N X
−1
p
Xp=0e 2π np =2π p=0N!
p−j N p −1xn epN!
n p
−1 e2π
N N = n=0 xn p=0 ep
n p N
= p+N• =p=0
Xis
p nperiodic,
ep N eforNp=0 each
pq X j pq p x
n=0 j (q−n)p
x =n=0 n e p
N
Xp+N = Xp n=0 p=0
p=0 n=0 n=0 Xp=0
p+N = Xp
Xp+N = Xp
) • =(d) is X p+N = X
xn+N
x(d)
n+N =xx periodic,
n
forp each n
xn+N = xn
(e)realx data = x
xxn+N
n+N = =
xn
xn
• for
∗ n+N n
X
) p =(e)
X∗−p = XN∗ −p
∗
= X−p = XN −p Xp = X−p
∗
= XN∗ −p
ted in detecting the presence ofXap single
= X ∗ ∗
= X ∗
d in [You(f)
detecting
X should
Assume
= the
X ∗ check
you that
are
presence
= X ∗ you
Xofp can
interested
a= Xshow
in
single
−p these
=
detectingNX results
−pthe
N from first principles]
∗ presence of a single
dal tone in a ptime-domain
continuous-wave
−p data sequence.
N −psinusoidal −p −p
tone in a time-domain data sequence.
lDFT
tone
(f) ofin{xa ntime-domain
Assume youhow
can
}Show beare
computed
the data sequence.
interested
64-point in
thedetecting
at DFT of {xn } can the be
presence
computed of at
a single
the
) Assume
DFT
kHzare interested
if of
the {x n}
you
sampling canare
in
continuous-wave rate
discrete interested
detecting
be of the
computed
{xn }ofwas
sinusoidal
frequency
presence
30kHz in
sat
ftone=if thedetecting
of
in
the
a single
asampling
time-domaintheof {x
rate presence
data
n } of
sequence.
was fs = a single
wave sinusoidal tone in a time-domain data sequence.
continuous-wave
Hztotal number
if the Show of
how
sampling complex
128kHz. the
rate sinusoidal
multiplications
64-point
of
Determine }DFT
{xnthe was tone
total inn }aofcan
fofsnumber
={x time-domain
be computed
complex data 36sequence.
at the
multiplications
he 64-point DFT of {x
required. n } can be computed at the
[20%].
otalShow discrete
number how of frequency
the ofmultiplications
64-point
complex 30kHzDFT if theofsampling{x n } rate
can ofbe } was fs = at the
{xncomputed
uency of 30kHz if the sampling 128kHz rate of {xn } was fs = 128kHz
DFT Interpolation
37
Zero padding
38
Padded sequence
39
Zero-padding
40
Zero-padding
circular convolution
42
Example of Circular Convolution
3
5 4
0 2 folded sequence
3 5 4
0 spins 1 spin 2 spins
…
5 4 4 3 3 5
0 2 0 2 0 2
x1(n)x2(0-n)|mod3 x1(n)x2(1-n)|mod3 x1(n)x2(2-n)|mod3 43
Example of Circular Convolution
clock-wise anticlock-wise
44
Example of Circular Convolution
45
Standard Convolution using Circular Convolution
46
Example of Circular Convolution
clock-wise anticlock-wise
1
3
0 2 5 0
4
folded sequence
3 5 4
0 spins 1 spin 2 spins
0 5 0 2 0 4 3 2 0 0 5 2
4 0 3
…
x1(n)x2(0-n)|mod3 x1(n)x2(1-n)|mod3 x1(n)x2(2-n)|mod3 47
0 0 0
Standard Convolution using Circular Convolution
48
Proof of Validity
49
Linear Filtering using the DFT
FIR filter:
50
Summary So Far
Elena Punskaya
www-sigproc.eng.cam.ac.uk/~op205
52
Computations for Evaluating the DFT
53
Operation Count
Modern DSP:
a real multiplication and addition is a single machine
cycle y=ax+b called MAC (multiply/accumulate)
55
Discrete Fourier Transform as a Vector Operation
Let us denote:
Then:
56
Matrix Interpretation of the DFT
complex
as follows: numbers
can be
X0 0 0 0
… 0
x0 computed
X1 0 1 2
…
N-1
x1 off-line
= and
… … …
…
…
…
…
stored
N-1 2(N-1) (N-1) 2
XN-1 0
… x N-1
N x N matrix 57
DFT Evaluation – Operation Count
59
Discovery of the Fast Fourier Transform (FFT)
60
The Fast Fourier Transform (FFT)
Now, split the summation into two parts: one for even n and one for odd n:
Take
outside
62
FFT Derivation 2
Thus, we have:
63
FFT Derivation 3
Now, take the same equation again where we split the summation
into two parts: one for even n and one for odd n:
64
FFT Derivation 4
simplified
65
FFT Derivation 5
66
FFT Derivation - Butterfly
(‘Butterfly’)
67
FFT Derivation - Redundancy
68
FFT Derivation - Computational Load
69
Flow Diagram for a N=8 DFT
Input: Output:
70
Flow Diagram for a N=8 DFT - Decomposition
71
Flow Diagram for a N=8 DFT – Decomposition 2
72
Bit-reversal
73
FFT Derivation Summary
74
Computational Load of full FFT algorithm
Direct DFT
FFT
76
Further advantage of the FFT algorithm
Input Output
77
The Inverse FFT (IFFT)
The "radix 2" FFT must have length N a power of 2. Slightly more efficient
is the "radix 4" FFT, in which 2-input 2-output butterflies are replaced by 4-
input 4-output units. The transform length must then be a power of 4
(more restrictive).
Efficient algorithms exist for FFTing real (not complex) data at about 60%
the effort of the same-sized complex-data FFT.
The Discrete Cosine and Sine Transforms (DCT and DST) are
79
similar real-signal algorithms used in image coding.
Applications of the FFT
There FFT is surely the most widely used signal processing
algorithm of all. It is the basic building block for a large
percentage of algorithms in current usage
82
Short-Time Spectral Analysis – Computational Load
Sample rate is
10.025 kHz
(T=1/10,025 s)
X=fft(x(1:512));
Looks almost
periodic over short time 84
interval
Case Study: Spectral analysis of a Musical Signal, FFT
Symmetric Anti-Symmetric
85
Case Study: Spectral analysis of a Musical Signal - Frequencies
86
The Effect of data length N
Low
N=32 resolution
FFT
N=128 FFT
87
The DFT approximation to the DTFT
89
Pre-multiplying by rectangular window
90
Spectrum of the windowed signal
91
Fourier Transform of the Rectangular Window
92
Rectangular Window Spectrum
Sidelobes
93
Rectangular Window Spectrum – Lobe Width
N=32
N=16
N=8
N=4
Hence the windowed spectrum is just the convolution of the window spectrum with
the delta functions:
95
DFT for the data
Both components
separately
Both components
Together
96
ωΤ
Brief summary
97
Summary so far …
• The Fourier Transform (FT) is a way of transforming
a continuous signal into the frequency domain
99