052600 VU Signal and Image Processing Torsten Möller...
Transcript of 052600 VU Signal and Image Processing Torsten Möller...
052600 VUSignal and Image Processing
Torsten Möller + Hrvoje Bogunović + Raphael Sahann
vda.cs.univie.ac.at/Teaching/SIP/17s/
All Fourier Transforms
5© Prof. Branko Jeren, FER, 2010
ContinuousAperiodic
DiscreteAperiodic
ContinuousPeriodic
DiscretePeriodic
CTFT
DTFT
CTFS
DTFS
SIGNAL
2D DFT: Separability property
• First across rows then across columns
• Alternatively: First across columns then across rows
• Equivalent for the inverse IDFT
9
where
DFT and FFT: Introduction
• Allows to numerically compute the spectrum of a signal
• Efficient implementation of convolution
• You can also identify impulse response of unknown black-box LTI system• h(t) = IDFT( DFT[y(t)] / DFT[x(t)] )
• Signal coding. With the usage of e.g. DCT (a variant of DFT with real numbers only)• JPEG
• In 1994, Gilbert Strang described the FFT as "the most important numerical algorithm of our lifetime" and it was included in Top 10 Algorithms of 20th Century by the IEEE journal Computing in Science & Engineering.
19
FFT: Decimation in time
• Separate x[n] into two sequences of length N/2• Even indexed samples in the first sequence• Odd indexed samples in the other sequence
• Substitute variables n=2r for n even and n=2r+1 for odd
• G[k] and H[k] are the N/2-point DFT’s of each subsequence
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 25
1N
odd n
knN/2j1N
even n
knN/2j1N
0n
knN/2j e]n[xe]n[xe]n[xkX
kHWkG
W]1r2[xWW]r2[x
W]1r2[xW]r2[xkX
kN
12/N
0r
rk2/N
kN
12/N
0r
rk2/N
12/N
0r
k1r2N
12/N
0r
rk2N
FFT: Decimation in time
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 26
• 8-point DFT example using decimation-in-time
• Two N/2-point DFTs• 2(N/2)2 complex multiplications
• 2(N/2)2 complex additions
• Combining the DFT outputs• N complex multiplications
• N complex additions
• Total complexity• N2/2+N complex multiplications
• N2/2+N complex additions
• More efficient than direct DFT
• Repeat same process • Divide N/2-point DFTs into
• Two N/4-point DFTs
• Combine outputs
FFT: Decimation in time
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 27
• After two steps of decimation in time
• Repeat until we’re left with two-point DFT’s
• Butterfly structure
FFT: Decimation in time
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 28
• Final flow graph for 8-point decimation in time
• Complexity:• Nlog2N complex multiplications
and additions
FFT: Butterfly Computation
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 29
• Flow graph constitutes of butterflies
• We can implement each butterfly with one multiplication
• Final complexity for decimation-in-time FFT• (N/2)log2N complex multiplications and additions
FFT: In-Place Computation
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 30
• Note the arrangement of the input indices to allow in-place computation• Input is overwritten by the output. no auxiliary data structure.
• One physical register needed for both input and output
• Bit reversed indexing
111x111X7x7X
011x110X3x6X
101x101X5x5X
001x100X1x4X
110x011X6x3X
010x010X2x2X
100x001X4x1X
000x000X0x0X
00
00
00
00
00
00
00
00
FFT: Decimation in frequency
• The DFT equation
• Split the DFT equation into even and odd frequency indexes
• Substitute variables to get
• Similarly for odd-numbered frequencies
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 31
1N
0n
nkNW]n[xkX
1N
2/Nn
r2nN
12/N
0n
r2nN
1N
0n
r2nN W]n[xW]n[xW]n[xr2X
12/N
0n
nr2/N
12/N
0n
r22/NnN
12/N
0n
r2nN W]2/Nn[x]n[xW]2/Nn[xW]n[xr2X
12/N
0n
1r2n2/NW]2/Nn[x]n[x1r2X
FFT: Decimation in frequency
Copyright (C) 2005 Güner Arslan 351M Digital Signal Processing 32
• Final flow graph for 8-point decimation in frequency
LTI system analysis using FFT
• Important application when filtering long signals
• Signal x(n) of length L if filtered with FIR filter with impulse response of length M.
• Output is given by a convolution
1
0
)()()(M
m
mnxmhny
• y(n) is of length L+M-1
• To find y(n) it is enough to applyDFT of length: N L+M-1
• Both h and u need to be zero-padded to length N)()()( kXkHkY
L L L
x1(n)
M-1 zeros
x2(n)
M-1 zeros
x3(n)
M-1 zeros
LTI system analysis using FFT: Overlap and add
LTI system analysis using FFT: Overlap and add
• The length of input block is L samples
• Length of DFT and IDFT is N=L+M-1
• To every block we add M-1 zeros and compute N-point DFT
0,...0,0),1(),...,1(),0()(1 Lxxxnx
0,...0,0),12(),...,1(),()(2 LxLxLxnx
0,...0,0),13(),...,12(),2()(3 LxLxLxnx
LTI system analysis using FFT: Overlap and add
• Ym(k)=H(k)Xm(k) k=0,1,…,N-1
• We obtain output blocks of N where there is no aliasing as the length of DFT-a (IDFT) is N=L+M-1
• We need to overlap the last M-1 samples of each output block with the first M-1 samples of the next block
y1(n)
L
+
y n y y y L( ) ( ), ( )..., ( ), 1 1 10 1 1
y2(n)
, ( ) ( ), ( ) ( ),...y L y y L y1 2 1 20 1 1
+
. . . , ( ) ( )y N y M1 21 1
y3(n)
, ( ), . . .y M2
LTI system analysis using FFT: Overlap and add
LTI system analysis using FFT
• To apply FFT with radix-2 the length of the input block L has to beadjusted so that N (N=L+M-1) is exponent of 2
• Signals x(n) and h(n) have to be zero padded to the lenght of N
• Transformation H(k) of the impulse response is performed only onceas it is time-invariant.
LTI system analysis using FFT
• Block convolution: “overlap and add”
• Input is split into non-overlapping segments
• Perform linear convolution• Need for zero-padding (P-1 zeros)
• Overlap at output: • last P-1 samples of the previous output segment
are added to the current segment
41
• H(k) is computed only once so it can be neglected
• Every FFT needs multiplications
• We perform two of them: 1 x DFT and 1 x IDFT
• To compute Ym(k) we further need N complex multiplications
N N N
N M
N
M
log log2 2 1
• Ratio of number of multiplications by filteringwith FFT vs. linear convolution
log2 1024 1
128
11
128
• E.g. for N=1024 i M=128
LTI system analysis using FFT: Complexity
( / ) logN N2 2