Theses
Thesis/Dissertation Collections
5-1-1980
An investigation on the applicability of
multi-microprocessing in the two dimensional digital
filtering problem
Timothy J. Whitcher
Follow this and additional works at:
http://scholarworks.rit.edu/theses
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusion
in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact
.
Recommended Citation
AN
I
NVESTIGATION ON THE APPL
ICABIL ITY
OF
M
U
LTI
-MI CROPROCESSING
I
N THE TWO
D
IMENSIONAL
D
IG ITAL FIL
TERI NG PROBLEM
by
T
imo thy
J
.
Whitcher
A
T
hesi s Subm
itte d
i
n
Part
ia
l
F
ulf i llme nt
,
of
t
he
Requ
ireme
nts
for the Degree of
MAS
TER
OF SCIENCE
in
E
lectrica l
E
ng ineer ing
App
roved
by
:
(Thes
i.. A
dvisor
)
Prof.
R
==-.::;==.,--- -
-
--Prof.
_
Prof.
Prof.
(Depar
tment
Hea
d)
DEPAR
TMENT
OF ELECTR
ICAL
EN
G
INEER ING
COL
LEGE
OF ENG
INE ERING
ROCHES
TER
INST
ITUTE
OF TECHNOLOGY
ROCHES
TER,
NE
W
YORK
Digital
image
processing has
been
receiving
anincreasing
amountof
development in
recentyears,
largely
because
high
speeddigital
computers are
becoming
readily
available.In
addition,
the
advent ofthe
microprocessor
has
revolutionizedthe
capabilities of compact electronicsystems.
This
thesis
examinesthe
applicability
of microprocessorsto
digital
image
processing.Using
aZ8000
microprocessor as abaseline,
the
computationtime for
atwo-dimensional
fast
Fourier
transform
is
estimated
for
various microprocessor architectures.These
results arelater
comparedto the
manufacturer's specified computationtimes
on aTABLE OF CONTENTS
Page
I.
List
ofTables
iv
II.
List
ofFigures
viIII.
List
ofTerms
vii
IV.
List
ofPrograms
ix
V.
Introduction
1
VI.
Section
1
-Historical
Review
ofthe
Fast Fourier Transform
...6
VII.
Section 2
-An Overview
ofthe
Theory
ofOne
andTwo Dimensional
Fourier
Transforms,
Continuous
andDiscrete
9
2.1
The Continuous Fourier Transform in
One
andTwo
Dimensions
10
2.2
The
Discrete Fourier Transform
andConvolution.
The
One
Dimensional
Case
19
2.3
The Discrete Fourier Transform
andConvolution.
The
Two
Dimensional
Case
25
2.4
The
One
andTwo
Dimensional
Fast
Fourier
Transform
36
VIII.
Section 3
-Examination
ofArchitectures
44
3.1
Method
ofExamination
45
3.2
Presentation
ofArchitecture I
49
3.3
Presentation
ofArchitecture
II
57
3.4
Presentation
ofArchitecture III
59
3.5
Presentation
ofArchitecture
IV
63
3.6
Presentation
ofArchitecture V
65
3.7
Presentation
ofArchitecture
VI
66
IX.
Section
4
Conclusions
74
X.
Appendices
87
Appendix
A
-Program Listings
88
Appendix
B
-The
2D-FFT
in Matrix Notation
134
Appendix
C
-FFT Error Analysis
139
Appendix
D
-A Comparison
of
Cycle Times
147
XI.
References
157
XII.
Bibliography
158
LIST OF
TABLES
Section
2
Tab!
eNumber
2.
2-1
2.
2-2
2.3-1
2,4-1
Section 3
3.1
3.4
Title
Page
Number
Computational
Comparison
DFT
vs.Convolution
23
Computational
Comparison
FFT
vs.Convolution
24
Computational
Comparison
2D-FFT
vs.2D
Convolution
33
A
Description
of
Bit Reversal
Order
.41
Summary
ofArchitectures
49
Essential
Components,
Hardware
Floating-Point
Complex
Mulitplier
. .2
Section 4
4.1
4.2
4.3
Architecture
I
- single processor . .Architecture
II
- singleprocessor,
Wj,1look-up
Architecture
III
<- singleprocessor,
feL1
look-up,
hardware
complexmultiplier, floating-point
78
79
80
4.4
4.5
4.6
4.7
Appendix D
D.l
D.2
D.3
D.4
D.5
D.6
D.7
D.8
D.9
Architecture
IV
-single
processor,
WN
look-up
table,
hardware
complexmultiplier,
fixed-point
80
Architecture V
-single processor W.,1
look-up
table,
programmed multiply-81
Architecture VI
-the
multiprocessor
system
81
Computation Time
for Multiprocessor
Systems
82
Architecture I
Machine Cycles
....148
Architecture
I
Cycle Time
149
Architecture
II
Machine Cycles
....150
Architecture II
Cycle Time
151
Architecture
III
Summary
152
Architecture IV
Machine Cycles
....153
Architecture IV
Cycle Time
154
Architecture V
Summary
155
LIST OF
FIGURES
Section
2
-An Overview
of
the
Theory
ofOne
andTwo
Dimensional
Fourier
Transforms,
Continuous
andDiscrete
Figure
Number
Title
Page Number
2.1-1
2.1-2
2.1-3
2.1-4
2.1-5
A
Block Diagram
of aOne-Dimensional
Linear
System
An Example
ofHigh
Frequency
Imagery
An
Example
ofLow
Frequency
Imagery
.Fourier
Transform
ofFigure 2.1-2
. .Fourier
Transform
ofFigure 2.1-3
. .13
14
14
15
15
2.3-1
2.3-2
Convolution
Approach
(Image
Processing).
.32
2-DDFT
Approach
(Image
Processing)
...32
2.4-1
2.4-2
Section
3
-3.1-1
3.2-1
3,2-2
3.2-3
3.2-4
3.2-5
The Two Point
DFT
39
The
Eight
Point
DFT
40
Flow Chart
Showing
the
Major
Operation
of
the
2D-DFT Computations
46
Butterfly
Structures
49
Fourier Coefficients in
the
Z-plane-
...50
Process
Block
A
-Bit Reversal
51
Process
Block B
-A
Linear FFT
Algorithm
52
Process
Block C
3.3-1
Process Block B
Architecture
II
58
3.4-1
Hardware
Floating
Point Complex
Multiplier
(Input-half)
60
3.4-2
Hardware
Floating
Point
Complex
Multiplier
(Output-half)
61
3.5-1
Fixed-Point
hardware
Multiplier- .64
3.7-1
Computational
Flow
68
3.7-2
Two Port
Bus
Control
72
Appendix C
C-l
2's
Compliment Truncation
140
C-2
2's Compliment
Rounding
140
C-3
4 Point
FFT
141
LIST OF
TERMS
LSI
-large
scaleintegration
MOS
-metal oxide on silicon
DFT
-discrete Fourier
transform
DIT
-decimation in time
FFT
-fast
Fourier transform
CPU
-central
processing
unitMMU
-memory
management unitA.l
Base-Line Code
for floating-Point 2D
FFT
in
Architecture
I
89
A.
2
Code
for the Computation
ofW*
Coefficients
in
Architecture
II
116
A. 3
Base-Line Code
for
aFixed-Point
2D-FFT
in
Architecture IV
U9
A. 4
Code
for
Butterfly
Computation
Using
Fixed-Point Software
Multiply
in Architecture V
130
prevalent
in the
world of computing.The
advancement oflarge
semi-conductor
memory
andbubble
technology
has
enabledthis
new class of machinesto
have data buffers
withvery
low
accesstimes.
One
ofthe
mostfrequent
applications of
these
data
processorsis
the
computation ofthe discrete
Fourier
transform utilizing the
fast Fourier
transform
algorithm.Because
of
the
inherent lack
ofdrift
associated withdigital
circuits,
digital
signal
processing
is widely
usedin military
applications such asradar,
sonar,
and remoteimage
sensing.The
widely varying
environmentin
whichmilitary
hardware
must operate makesthe
drift-free
characteristic ofdigital
circuitsyery desirable.
While digital
computation suffersfrom
truncation
errors andlimit
cyclebehavior,
these
effects are consistentin
all environments.Consequently,
the
advantage of nodrift
enablesdigital
signalprocessing to
outweighits
analog
counterpartin
mostapplications.
Within the
last
decade,
the
onething
whichhas
had probably the
greatest
impact
onthe
electronic worldhas been the
microprocessor.These
inexpensive
single-chip
computershave
evolvedto the
point wherethey
rival
large
scale computersin
capability in
several applications.In
somecases,
these
singlechip
processing
unitsreadily
lend
themselves to
distributed
processing
applicationsthat
wouldbe
cumbersometo
implement
with
their larger
counterparts.Despite the popularity
ofthe
microprocessor,
they
have
not made ato
asarray
processors.There
are several reasonsfor
the
lack
ofimpact
by
the
microprocessor onthe
market ofarray
processors.Most
microprocessorshave
a one-byte word size andconsequently,
computationsrequiring 32 bits
or greater precision are awkward
to
implement.
Recently,
sixteen-bitmicroprocessors
have
arrived onthe
market,
but
these
stilllack the
precisionnecessary
for
many
applications.Multiplication
anddivision
which aretwo
operations usedfrequently
in
signalprocessing
algorithms canonly be
implemented
on most microprocessorsthrough
long
sequential add and shiftroutines.
When
such routines areused,
the
computationtime
of signalprocessing
algorithmsbecome exceedingly long.
Most
ofthe
new sixteenbit
mircroprocessorshave
specialhardware
which can shortenthe
computationtime
neededfor
multiplication anddivision,
but
these
are no matchfor
the
speed presentedby
the array
processor,
largely
because
ofthe
wordsize required
in
most signalprocessing
applications.Microprocessors
have
yet anotherdrawback
whichis
responsiblefor their lack
ofpopularity
in
applicationsthat
requirefrequent
multiplication anddivision.
Because
most microprocessors use
MOS
technology,
the
clock rates usedby
a microprocessor are
lower
than
that
of anarray
processor whichfeatures bipolar
technology
in its ALU.
Thus,
it becomes
evidentwhy
microprocessorshave
not made an
impact
in the
area ofarray
processing.Despite the many drawbacks
ofthe
microprocessor,
it
cannotbe
ruledout
in
all signalprocessing
applications.A
microprocessor represents avery
sophisticated
building
block
for
a system.The
microprocessorhas
apowerful
instruction
setthat
enablesthe
systemdesigner
to
build
apparatuscapable of
performing
complexfunctions
with a minimum amount ofhardware.
If
the
volume ofthe
product(that
is
the
numberto
be
produced)
is
small,
in
these
arehigh
speed expandable multipliers and avariety
ofmemory
devices.
In
addition,
most manufacturers of microprocessors offer a widevariety
of supportive services.It is
these features
that
makeit
attractiveto
use a microprocessorin
situations whereit is
only marginally
applicableor where
it
may
evenbe
an overkillin
the
design.
Some
areas ofdigital
signalprocessing
do
not requirevery
precisearithmetic.
One
such problemis
in
the
area ofdigital
image
processing.If
a quantizedimage is
to
be
characterizedby
its
spatialfrequency
distribution,
onemay
perform alow
precision two-dimensionaldiscrete
Fourier
transform
(DFT)
to
perform such a characterization.Simple
two-dimensional
pattern recognition canbe
performedutilizing
low
precisionDFT's along
with a two-dimensionalfilter
function.
It is for
this
kind
of problem, where
only
basic
image
characteristics aresought,
that the
microprocessor
may be
applicable.If
a microprocessoris
to
performimage
filtering
or pattern recognitionin
the
spatialfrequency
domain,
it
must performtwo primary tasks.
The
most straight
forward
ofthe
two
is
the
multiplication of each quantizedelement of an image's
two-dimensional
discrete Fourier
transform
by
acorresponding
element ofthe
two-dimensional
filter function.
The
othertask
is
to
processthe array
of picture elements or pixelsthat
composethe
image
and calculatethe
2-D
discrete Fourier transform
ofthat
image
through the
use ofthe
fast Fourier
transform
algorithm.In
the
problemmust
be
calculated,
however,
the
inverse
transform
is
essentially the
sameas
the
forward
transform
withthe
exception of some changesin
sign.The
calculation ofthe two-dimensional
DFT
is
the
most cumbersometask.
In this
thesis,
the
computation ofthe two-dimensional
discrete Fourier
transform
by
a microprocessor willbe
examined.Consideration
willbe
constrained
to the
decimation-in-time
(DIT)
version ofthe
FFT
algorithm.The
computationalflow
path willbe extensively flow
charted.Through
the
use offlow
charts and an exampleprogram,
the
computationtime for
a
two-dimensional
discrete
Fourier transform
willbe determined.
In
addition,
alternate methods of
executing the FFT
algorithm willbe
examined withthe
goal of
gaining
abetter understanding
ofthe
feasibility
ofusing
the
HISTORICAL REVIEW OF THE
The fast
Fourier transform
(FFT)
algorithmis
a method ofcomputing
the
discrete
Fourier transform
(DFT)
of a series ofN
complexdata
pointsin
approximately N
log2
N
operations.When
Cooley
andTurkey
[1
]
described
the
algorithmin
1965,
it
wasthought to be
newby
many
people.Until
that
time
most peoplebelieved discrete
Fourier
analysisto be
a processrequiring
2
N
operations.In
1942 G.C.
Danielson
andC.
Lanczos
[2
]
published a paperthat
described
a method ofFourier
analysisthat
is
usedin
X-ray
scattering
problems.
This
methodhad the
number of computational operations proportionalto N
log2
N.
The Danielson
andLanczos
paper refersto two
papersby
C.
Runge
[3]
published
in 1903
and1905
asthe
source ofthe
computational method.A
set of
lecture
notes ofC.
Runge
andH.
Konig
[5
]
publishedin 1924 described
how
one could usethe periodicity
ofthe
sine and cosinefunctions to
obtaina procedure
for
taking
a series oflength N
whereN
is
a power of2
andsplitting this
seriesinto
log2
N
subseries.Then using
adoubling
algorithm a2N
pointFourier
analysisis
obtainedfrom
two N
point analysesin N
operations.
Successive
applications ofthis
doubling
algorithmled to
the
computation of adiscrete Fourier transform
in
approximately N
log2
N
operation.
The
algorithm ofCooley
andTurkey
is
more generalin the
sensethat
methods are
described
to handle
cases whereN
is
a composite number notbe mutually
prime.Thus,
whileCooley
andTurkey
receive much ofthe
acclaim,
there
SECTION 2
AN OVERVIEW OF THE
THEORY OF ONE AND TWO
DIMENSIONAL
FOURIER
TRANSFORMS,
2,1
The Continuous
Fourier
11
The
Fourier
transform
is
afrequently
used mathematicaltool
that
transforms
a variable(or variables)
of one spaceto
adifferent
variable(or
variables)
of another space.Such transformations
are madegenerally
to
enable a computationto
be
performedin
a more convenientfashion
orto
presentinformation
in
a more useful manner.In the field
of signalprocessing,
analog
signals are convertedfrom
the time
domain to the
frequency
domain
by
the
Fourier transform.
The
Fourier
transform
of a signals(t)
canbe
givenby
oo
S(f)
=/s(t)e-j2^ft
dt
(2J.1)
-00
Generally
(2.1.1)
will notbe
convergent.In many engineering
applicationsthe
Fourier transform
is
used with periodic signals wherethe
realtime
signal
s(t)
is
composed of afinite
number ofknown frequencies.
The
transform may then be
rewritten asT
2
3(nf0)
=f
f
s(t)e-J'2Vdt
(2.1.2)
J
T
2
where: n
is
anindex
identifying
the
discrete
frequencies
that
make
up s(t)
f
is
the
lowest
ofthese frequencies
o
T
is the
period ofs(t)
t
is
time
This form has
the
inverse transform
s(t)
=B(nfo)
eJ2ft{2]3)
n=- 0Equations
(2)
and(3)
are sometimes referredto
asthe
exponentialform
ofthe
Fourier
series.If
a signalis bandlimited
but
notnecessarily
periodic,
the
form
of(1)
will converge andin
such a caseS(f)
willbe
calledthe
spectrum of s(t).
This
leads
the
following
one-dimensionaltransform
pair
for
continuous signals.00
S(f)
=/
s(t)e"j27Tftdt
00(2.1.4)
00s(t)
=/
S(f)ef^ft
df
00The
aboveis
a one-dimensionaltransform
pair.The Fourier transform
exists
in
multi-dimensionalforms
also.Here
we areinterested
in the
two-dimensional
form.
The
two-dimensional
transform
pairis
asfollows:
00
S(u,v)
=ff
s(x,y)
e"j(ux+
vy)
dx
dy
00
(2.1.5)
00s(x,y)
=1
ff
S(u,v)
ej(ux+
v^
13
A
sufficient conditionfor
the
existence ofthis
transform
pairis
that s(x,y) be
absolutely
integrable.
//
S(x,y)|dx
dy
<(2.1.6)
In
a one-dimensional application we are ofteninterested
in
the
notion offiltering
a signal with respectto
frequency.
This
is
oftenrepresented
in block
diagram
form
ass(t)
S(f)
q(t)
Q(f)
A Block Diagram
of aOne
Dimensional
Linear System
Fig.
2.1-1
where
H(f)
is
somefiltering
function
andQ(f)
=H(f)
S(f)
(2-1-7)
This
concept can alsobe
extendedto the two-dimensional
case.Here
we would
have
Q(u,v)
=H(u,v) S(u,v)
(2.1.8)
where
Q(u,v)
is
afiltered
output.H(u,v)
is
the two-dimensional
filter
function,
andS(u,v)
is
the input
spectrum.of
the
image
atthat
point.Thus,
the
entirefunction s(x,y) may describe
a picture over
the
coordinates x andy.The
function
S(u,v)
representsthe
spatialfrequency
spectrum of s(x,y).The
following
figures
serveto clarify the
concept of spatialfrequency.
s-,(x,y)
An Example
ofHigh
Frequency
Imagery
Fig.
2.1-2
->
T,
<-s2(x,y)
An
Example
ofLow
Frequency
Imagery
Fig.
2.1-3
In Figure
2,
s-,(x,y)
is
saidto be
morehighly
modulatedthan s2(x,y)
of
Figure 3.
Consequently,
s-,(x,y)
has
a greater content ofhigher
spatialfrequencies
than
s2(x,y).Therefore,
S-^yjv)
and.S2(y,v)
wouldlook
as15
S-|(y,v)
Deviation
from the
y,vplane can
be
representedby
increased
brightness.
Fourier Transform
ofFig.
2.1-2
Fin.
2.1-4
S2(y,v)
Here the
magnitudefalls
offfaster
indicating
less
high
freauency
content.Fourier Transform
ofFig.
2.1-3
Fig.
2.1-5
When
one understandsthe
concept ofimage
frequency,
one canreadily
comprehendhow
animage
canbe filtered.
If
animage
is
low
passfiltered,
allsharp
edges wouldbe
obscurred andonly the
largest,
most unmodulated
features
wouldbe discernible.
If
animage
is high
passfiltered,
edges wouldbe
visiblebut
notthe
broad
unmodulatedfeatures.
The Fourier
transform
is
alinear
transformation
in
both
the
one andmulti -dimensional
forms.
This
leads
to
avariety
ofproperties,
someof which are given
here.
In
eachcase,
F
is
the
Fourier transform
off
,One
Dimensional
a
F(w)
=F[af(x)]
F(w)+F2(w)
=F[f1(x)+f2(x)]
Two Dimensional
a
F(wx,
wy)
=F[af(x,y)]
Ft(wx.w
)
+F2(wx,w
)
(2.1.9)
(2.1.10)
FLf^x.y)
+f2(x,y)]
1
F()
=F[f(ax)]
a 'a1
"snF(T"
'
^
=FL"f<ax>b^
(2.1-n)
-jwx
e
F(w)
=F[f(x-xJ]
j(wxa +
wyb)
F(wx,wy)
=(2.1.12)
F[f(x-a,
y-b)]
jw
xF(w
-wn)
=fief(x)]
[F(wx
-ax,
wy
-by)]
j(a
x +by)
F[e
x^
f(x,y)]
(2.1.13)
(jw)n
F(w)
=F[^-f(x)]
dx,
-jwx
F(wx,w
)
=
F[^
f
(x,y)]
(2.1.14)
"jwy
F(wx,wy)
=
F[^f(x,y)]
F(-w)
=F[f(-x)]
F(-wx,-wy)
=F[f(-x,-y)]
(2.1.15)
F(w) 6(w)
=F[f(x)
*g(x)]
F(wx,wy) G(wx,wy)
(.2.1.16)
17
where *-
is the
symbol
for
convolution whichis
f(x)
*
g(x)
=/
f(x)
g(x-x)
dx
]
f(x,y
)
*-g(x,y)
=f
f
f(a,B)
g(x-a,
y-B)
dadB
The two
dimensional
Fourier transform property
ofseparability
is
shownbelow
r r -j(xu +
yv)
S(u,v)
=J
J
<s(x,y) edx
dy
(2.1.18)
/
g(x,v)
e_jxydx=
S(y,v)
Thus,
the
two
dimensional
Fourier
transform
canbe
separatedinto the
sequential application of
two
one-dimensionaltransforms.
As
afurther
condition,
if
the
image function
is
separable-*(x,y)
=
then
S(y,v)
=J J
4(x,y)
e"j(yx
"y^
dxdy
-to -TOO
LL
\(x)Vy)
e-jVXe-J>dxdy
/
.(x)
d)<
/^(y)e-JVVdy
X -oo
(2.1.20)
=
S
(y)
S
(v)
y v
If the
aboveis
true,
the
completeimage transform
requiresonly the
computation of
two
one-dimensionaltransforms
andtheir
product.This
is different from
the
former
case of sequential application ofthe
19
2,2
The Discrete Fourier
Transform
andConvolution
In
modernday
signalprocessing,
computationis
done digitally.
This
requiresthat
a signalbe
sampledin time
andits
value atthat
time
be
representedby
adigital
word.In
addition,
the
signal mustbe bandlimited
andthe
sampling
rate mustbe
equalto
or greaterthan
the
Nyquist
ratein
orderfor the
signalto
be
reconstructed withoutdistortion.
The Nyquist
rateis
twice the
highest
signalfrequency.
If
a continuous signalis
sampledevery T
seconds,
the
sampledsignal can
be
representedby
x(nT),
n =0,1,2...
These
sampledvalues
describe the
sequence x(n).The
sequencex(n)
is
offinite
length
when onedeals
with real signals.The
sequencex(n)
is
of
length N
andit
canbe
usedto
construct a periodic sequencex(n)
with a period ofN.
The
discrete Fourier
series ofx(n)
is
X(k)
whichis
also periodicin N.
This
leads
to
the
Discrete
Fourier
Transform
ofx(n)
givenby
N-l
X(k)
=
x(n)
WNkn
(2.2.1)
n=0
where
W.,
= eJ
N
The
Inverse
Discrete
Fourier
Transform
is
givenby
N-l
x(n)
=x
Y.
*(k)
Vkn
(2.2,2)
k=0
It
is
important to
notethat
both
x(n)
andX(K)
are periodicin
21
digital
filtering.
Usually
linear
filtering
is desired.
Let
H(K)
be
a onedimensional
linear
filtering
function
andh(n)
be its
corresponding
impulse
response sequence.(Note
that
H(K)
is the
Z-transform,
H(z),
ofthe
sequenceh(n)
evaluated at specific pointsalong
the
unit circle
in the z-plane.)
If
one performslinear
convolution onx(n),
a sequence oflength
N,
by
h(m),
a sequence oflength
M,
the
result
is y(n)
a sequence oflength N+M
wherey(n)
is
givenby
N+M-l
y(n)
=V
x(m)
h(n-m)
(2.2.3)
m =
0
The
sequencey(n)
can alsobe
obtainedthrough the
use ofthe
discrete
Fourier
transform.
However,
if
we aredealing
withthe
discrete Fourier
series,
it
mustbe
emphasizedthat this
series mustbe
obtainedfrom
aperiodic sequence.
Convolution
can alsobe
performed with periodicsequences.
This
is
called cyclic convolution.To
perform cyclicconvolution,
h(m)
mustbecome
fi(m)
andx(n)
mustbecome
x(n).Assume
that
N
>M.
Then
zeroes mustbe
appendedto
h(m)
sothat
fi(m)
andx(n)
both
have
a period ofN.
However,
cyclic convolution offf(m)
andx(n)
leads
to y,(n)
which alsohas
a period ofN.
This
operationis
givenby
N-l
y,(n)
=V
x(m)
fi(n-m)
(2.2.4)
m=0
This
is
notthe
same sequence asy(n)
whichis
oflength M
+N.
In
orderfor
the
cyclic convolutionto
yieldthe
sequencey(n),
x(n)
fi(m)
as
y(n)
formed
by
linear
convolution ofx(n)
andh(m).
Convolution is
a particulartype
oflinear
transformation.
The
discrete Fourier transform is
anothertype
oflinear
transformation.
It
is
possibleto
performin
a singlelinear
transformation,
namely
convolution,
the
same operation performedby
the
successive applicationsof several other
linear
transformations
such asthose utilizing the
DFT.
The
following
discussion
willeventually
showthat
there
areconditions where
the
successive application ofthree
linear
transformations
namely
adiscrete
Fourier
transform,
a simplefiltering
function
andan
inverse discrete Fourier
transform,
willlead
to
fewer
computationsthan
whenperforming the
same operationin
one consolidatedlinear
transform,
namely
convolution.Using
the
discrete Fourier
series,
we can calculatey(n)
through
the
following
steps.First
x(n)
andR(n)
mustbe formed
eachhaving
a period of
N
+M.
Then
their
DFS
mustbe
calculatedusing the DFT.
Next
the
DFS
ofy(n)
is formed
through
the
relationY(K)
=H(K) Y(K)
(2.2.5)
Taking
the
inverse discrete Fourier
transform
(IDFT)
ofY(K)
willlead
to y(n),
one cycle of which wouldbe
equalto y(n)
because
the
periods of
the
sequencesx(n)
andR(n)
wereboth
expandedto N
+M.
Thus,
dimensionality
is
animportant
consideration whenimplementing
23
The
number of computations neededto
perform a particulartrans
formation
canbe
comparedin
atable.
Let
x(n)
be
of periodN
andlet
h,
(n),
of periodU,
be
the
weighting function
usedin
cyclicconvolution.
Also
let
H2(k)
be the function
usedto
operate onthe
DFS
ofx(n)
whichis
X(k)
whereX
(k)
is
of periodN
andH2(K)
is
ofperiod
U.
Table
2.2-1,
Computational
Comparison DFT
vs.Convolution
No.
ofComputations
Type
ofOperation
k_NU convolution of
x(n)
withh\(n)
N2
finding
DFS
ofx(n)
kdNU
filtering X( k)
withH2(k)
U2
finding
the
IDFT
ofY(k)
The
constantsk
k,
are of a valuethat
is dependent
onthe
number of zeroes
in
the
sequencesfi,(n)
andH2(k),
respectively.For the DFT
approachto
involve fewer
computationsthan convolution,
kd<kc-"LT-T
(2.2.6)
If the fast Fourier
transform
algorithmis
usedto
computethe
No.
ofComputations
Type
ofOperation
k NU
convolution ofx(n)
withh-,(n)
N
log2N
finding
the
DFS
ofx(n)
kdNU
filtering
X(k)
withH2(k)
U
log2
U
finding
the
IDFS
ofY(k)
This
leads to the
relationlog2
N
log2
U
kd
*kc
D
(2.2.7)
as
the
conditionthat
mustbe
satisfiedto
enablethe DFT
approachto have fewer
computationsthan
the
convolution approach.The
valuesof
k.
andk
aredetermined
by
the
filtering
functions
selected[fi,(n)
and
H'(k)].
In
this
thesis
we arespecifically
dealing
withthe
25
2.3
The Discrete Fourier
Transform
andConvolution
An
image,
like
atime
varying,
signal canbe
sampled.In
addition,
the
concept ofNyquist-rate
canbe
extendedto
sampledimages.
If
it
is desired to
have
animage
resolution ofQ
lines
per millimeteralong
agiven
dimension,
then
there
mustbe
2Q
light
to dark
transitions
permillimeter.
If the
resolutionis to be the
samein both
the
x andy
dimensions,
then the
method chosenfor image
quantization must providefor
atotal
of2Q
light
anddark
regionsalong both
the
x andy
axis.This
leads to
animage sampling
rate of2Q
samples per millimeter perdimension
whichis
analogousto the Nyquist
rate.In
animage
the
sampling
rate correspondsto the
size ofthe
picture element orpixel.
If
animage
is
subdividedinto many
smallsquares,
each ofthese
squaresis
a pixel.The
averagebrightness
of each pixelis
the
digitized
valuethat
is
usedin digital
image
processing.The
greaterthe
number of pixelsin
animage,
the
higher the
resolution ofthe
quantized
image,
andthe
higher
the
image
sample rate.It is
the
values of
the
pixelsthat
providethe
input
to
the
two-dimensional
discrete Fourier
transform.
As
wasthe
casein
the
one-dimensionaldiscrete Fourier
transform,
the
two-dimensionaldiscrete Fourier
transform
deals
with periodicfunctions.
Let
p(n,,n2)
representthe individual
pixel values of animage.
Then
we can envision a quantizedimage to be
anarray
or matrixwith each element
in the array
being
a pixel.This
canbe
representedmathematically
asp(nrn2)
27
where
P
representsthe
array.To
develop
atwo-dimensional
discrete
Fourier
transform,
a periodictwo-dimensional
array
P
P(n-,,n2)
(2.3.2)
is
constructedfrom
the
image array
P.
The
two-dimensional
discrete
Fourier transform
relations can nowbe
givenby
the following.
N-l
N-l
P(krk2)
=x
Z
X
P(nTn2)
k,n,+k2n2
(2.3.3)
n-,=0 n2=0
N-l
N-l
p(nrn2)
=x
2_
Y.
^I'M
(k1n1+k2n2)
(2.3,4)
klnl+k2n2
k^O
k2=0
.2tt
-J"X
(k1n1+R2n2)
where
W
= eand we are
assuming
that
P
is
a squareNxN
array.Again,
it is
important to
notethat
both
p(n.j,n2)
andP(k],k2)
are periodicin N
in
two-dimensions.
That
is
to
say,
they
are periodicin NxN.
The
two-dimensionaldiscrete Fourier
transform
is
a specifickind
of two-dimensionallinear
transformation.The
general equation ofa two-dimensional
linear
transform
is
N-l
N-l
P(krk2)
=V
where
6(n-,
,k, ,n2,k2)is
aweighting
coefficientthat describes
the
transform
andp(n-,,n2)
is
assumedto
be
an element of asquare,
NxN,
array.
In the two-dimensional
DFT,
(k-,n1+k2n2)
WN
=W(n1,k1,n2,k2)
=6(n],k1,n2,k2).
(2.3.6)
The two-dimensional
DFT is
also whatis
called aunitary transform
because
it
is exactly invertible
andits weighting
coefficients meetthe
following
conditions.2-
L-
W(n],k1,n2,k2)
W*(j1
,k1
,j2,k2) =6(n1~j1
,n2-j2)kl
k2
2.
2_W(n1,k1,n2,k2)
(j-,
,k]
,j2,k2) =6(n]-j'1
,n2-j2)2.3.7)
kl
k2
2_
2-W(ni'kTn2'k2^
w*(ni'min2'm2^
=<5(k-1-m1,k2-m2)
nl
n2
2_
2.W"
(n1,k],n2,k2)
(n1
,m]
,n2,m2) =6(k-]-m1
,k2-m2)nl
n2
where
-j'X^lh
+n2k21
W
= e-1
J"F(nlkl
+
n2k2)
W* =
W
'
The 2D-DFT
is
also separable asis the
continuous case.In
the
discrete
case,
W(nI,k1,n2,k2)
=W,_(ni,k1)WR(n2,k2)
(2.3.8)
W
(n1,k1,n2,k2)
=W[
(n^k^W^
(n2,k2)
Any
NxN
image
array
[p
canbe
convertedinto
a1
xN
image
vector
p
by
a procedure called column scanning.This
is described
in
Appendix
B.
Using
matrix notation a2D-DFT operating
onthe array
IP
canbe
expressed as
Q-RPR
where
]]/J/|
and}\/Jj
R
areNxN
matricesdefined
in Appendix B.
When
U
has
been
convertedto
the
vectorp,
this
sameDFT
operationcan
be
expressed asq
=WJ
P
where
wNJ
is
anN
xN
matrixdefined
by
with
>
being
the
operatorfor
the left direct
product alsodefined in
Two-dimensional
convolutionis
another
kind
oftwo-dimensional
linear
transformation.
The
equationfor two-dimensional
convolution
is,
N-l
N-l
P(krk2)=2_
Y
P(nl'n2^
(k]
-nr
k2
-k2)
(2.3.9)
n.j
=0
n2=0Where
the array
p(nrn2)
P
is
convolved withthe array
r(krk2)
r
which can
be
written asp
*
r
=[p(kvk2)]
(2.3.10)
As
in
the
case of one-dimensionalconvolution,
the two-dimensional
case
has both linear
and cyclic convolution.We
are nowdealing
withperiodicity in
two-dimensions
when we consider cyclic convolution.The linear
convolution of anN
xN array
with aM
xM
array leads
to
an(N
+M)
x(N
+M)
result.If
cyclic convolutionis to
be
utilized,
then
zeroes mustbe
appendedto both the
NxN array
andthe M
xM array
in
such away
sothat both
arrays are ofdimension
(N
+M)
x(N
+M)
array
1
A
'11
'Nl
*NN
31
(2.3.11)
and
array 2
A.
'11
JM1
'1M
JMM
(2.3.12)
These
are changedto the
following
A
i =ln
alN
1,N+1
""Q
1N+M
"Nl
lNNl
0
N+1,1
0
N+M.l
-0
N+M,
N+M
_L(2.3.13)
and
K
Jn
'M,l
bl
,M1
,M+1JM,m
;1
,M+N0
M+1,1
0
M+N.l
M+N,M+N
J
(2.3.14)
From
the
two
(M+N)
x(M+N)
arrays,
two
periodic arrays are contructedconvolution can
be
performed onthese
periodic arrays.One
(N+M)
x(N+M)
period of
the
cyclic convolution willbe
the
same asthe
linear
convolutionresult.
To implement
atwo-dimensional
linear
convolutionusing
the
two-dimensional
DFT,
one mustinsure
that
the
dimensionality
ofthe
arraysis
large
enoughto
makethe
resultusing the DFT
the
same asthat
using
convolution.Not
allimage processing
techniques
requirelinear
convolution.
However,
whenit is
to
be
implemented,
zeroes mustbe
appended
to
the
originalimage array to
providefor
correct results.Two-dimensional
filtering
canbe
performedby
a singlelinear
transformation
such astwo-dimensional
convolution orby
severallinear
transformations
such as a2-D DFT
approachthat
transforms
animage into
its
spatialfrequencies.
Diagramatically,
the
two-dimensional
convolutionapproach can
be
represented asP
NxN array
2-D
->f convolution
function
Convolution Approach
Fig.
2.3-1
Q
U
xU array
The 2-D DFT
approach canbe
represented asUP
2D
-DFT
F
LI
NxN array
NxN array
2D-DFT Approach
->Spatial
Filter
function
U
xU array
Fig.
2.3-2
h
2D
-IDFT
>
&
33
where
in
each caseW
is
the
input
image,
(^
is
the
outputimage,
andIP
andG$
arethe
spatialfrequency
distributions
ofPand
Q.
,respectively
The
reasonfor using
athree-step
2D-DFT
approachin
animage
filtering
problem
is to transfix the data
into
aform
that
is
easierto
work with.The
goalhere is to
minimizethe
number of computations neededto transform
P
toQ.
To
directly
implement
the
2D-DFT
on anN
xN
array,N
operationsare required.
Similarly,
adirect implementation
ofthe
2D-IDFT
on aU
xU array
requiresU
operations.If
alinear
filtering
operationis
2
2
to
transform
anN
xN array
into
aU
xU
array,
at mostN
U
operationsare required.
It
appearsthat
athree
step transformation
such asthe
DFT
approach requires more computationsthan
a singletwo-dimensional
linear
transformation
such as a convolution approach.However,
asin
the
case of one-dimensionaltransforms,
the
three-step
process caninvolve
fewer
computations.Using
tables
similarto
those
usedin
the
one-dimensionalcase,
the
number of computations neededin
the
DFT
approach andin
the
convolution approach canbe
compared,
assuming
Pand
($
asthe
input
and output arrays respectively.Table 2.3-1
Computational
Comparison,
2D-DFT
vs.2D Convolution
No.
of computationsType
ofOperation
k
N2 U22D
convolutionc N4
2D
-DFT
k,
N2 U2
2D
spatialfiltering
d
U4
where
kd
andk
are sparseness coefficientsthat
have
a valuebetween
zero and one.
The
value ofkd
andkc
willtend to
zero as moreweighting
coefficients of
the
givenlinear
transformation
become
zero.This
assumesthat
ourfiltering
algorithmhas
softwarethat
willskip
an operationwhen a particular
weighting
coefficientis
equalto
zero.In
orderfor the two-dimensional
filtering
problemto
have fewer
computations
using DFT
techniques,
2
2
k
<k
_IT
_Ul
Kd
Kc
u2 N2'
(2.3.15)
If the two-dimensional
fast Fourier transform
algorithmis
usedto
computethe
2D-DFT
andthe
2D-IDFT,
then
the
following
table
applies.Table 2.3-2 Computational
Comparison
2D-FFT
vs2D Convolution
No.
ofComputations
Type
ofOperation
kc
N2U
2D
convolution2N2
log2N
2D-DFT
2
2
k
.N
U
spatialfiltering
function
2U2
log2U
2D-IDFT
For the DFT
approachto have fewer
computations4kd<kc-7ig2N-^l092u
(2-3J6)
This
conditionis
readily
achievablein
most applications.Again,
as35
the type
offiltering
desired.
In this
thesis,
only the
implementation
ofthe
2D-DFT
approachis
considered.Specifically,
the
implementation
of2,4
The One
andTwo
Dimensional
Fast Fourier
37
The fast Fourier
transform
algorithmis
used almostexclusively
to
computethe
discrete
Fourier transform
of akernel.
The FFT has
several
forms,
withthe
decimation-in-time
algorithm andthe
decimation-in
-frequency algorithmbeing
the
most oftendiscussed
algorithmsin
textbooks.
The
algorithm wasdeveloped
by
exploiting
varioussymmetry
properties
found in
the
DFT.
Consider the
one-dimensionalDFT
relationN-l
I
n=0X(k)
-Y
x(n)kn
0,1,
...,N-l
(2.4.1)
and
the
IDFT
N-l
x(n)
=-i-Y
X(k)
n=0
where
kn
k
=0,1,
...,N-l
(2.4.2)
W
kn
= eWN
e&
^
One symmetry
property
is
W
"kN = eWN
N
= ej2u=
]
(2.4.3)
If N is
a multiple oftwo
W
2
WN
2l _N_"JN
2
= e -J* -= -1(2.4.4)
Thus
for
some values ofW..,
no multiplication needbe done in
the
operationx(n)*W
kn.
If N is
a power oftwo
(N
=number of computations can
be
achievedby
dividing
the
DFT into
smallerDFT
computations until we aredealing
only
withtwo
pointDFT's.The first
step
ofthe decomposition
is
repeatedhere
to
indicate
the
methodsinvolved.
Algorithms
that
decompose
the
input
sequenceinto
smallersubsequences are called
dejcAxxitiAn-iti-tii-.'^,
algorithms.
WithN
=2
,the
DFT
of a sequencex(n)
with n =0,1,2
...,
N-l
is
N-l
X(k)
=Y
x(n)
WNPl<k
=0,1,
...,N-l
(2.4.5)
n=0
separating
x(n)
into its
even and odd points2
' r|<?
kr
X(k)
=V
x(2r)(WN2)
+WNk
V
x(2r+l)
(WN2)
(2.4.6)
r=0 r^t)
where n =
2r for
even points andn =
2r
+1
for
odd points-
2^
"J
ft,
2
-^
X
now
WN
=e = e =
wn
T
so
that
f-i
T
4--i
X(k)
=V
x(2r)
W
2
+WkY
r=i
-I
(2.4.7)
39
This
indicates
that
anN
pointDFT
whereN is
a power of2
canbe
N
N
decomposed
into
the
sum oftwo
-j-point
DFT
s.The
-j-point
DFT
canN
be
decomposed into
the
sum oftwo
-r-point
DFT
s.This
is
a processp
where each
p
pointtransform
is decomposed into
a sum oftwo
_ point2
transforms
can proceed untilleft
withonly two
pointtransforms.
This
requires v stages of computation where v =log2
N.
This
processleads
to the
FFT
algorithm withthe
number of complexmultiplications and additions equal
to N log2N for
a one-dimensionalsequence of
dimension N.
The
two
pointDFT
whichis
the
fundamental
computationin
a morecomplex
FFT has
cometo
be known
asthe
butterfly
computation.The
butterfly
computationis
showndiagramatically
in
its
basic form in
Fig.
2.4-1
The
Two Point DFT
xm+l(p)
xm+l(q)
Fig,
2.4-1
The
following
figure
revealsthe
structure of an eight pointdecimation-in-time
FFT
algorithm.This
structure caneasily be
extendedEight Point
DIT-FFT
>r-x(o)
41
The
eight pointFFT flow
graph reveals one significantpeculiarity
aboutthe
decimation-in-time
algorithm.The
input
sequence must
be in
whatis
calledbit-reversed-order
if the
output sequence
is to be in
normal order.Bit
reversed ordercan
be
understoodby
the
following
table.
Table
2.4.1
A Description
ofBit-Reversed-Order
Normal
Order
Binary
Designation
x(0)
000
x(l)
001
x(2)
010
x(3)
Oil
x(4)
100
x(5)
101
x(6)
110
x(7)
111
Bit-Reversed
Order in
Designation
FFT Computation
000
0
1st
100
4
5th
010
2
3rd
110
6
7th
001
1
2nd
101
5
6th
Oil
3
4th
By
referring to
the
chart above andFig.
2,4-23
the
role ofbit
reversal can
be
understood.If
adecimation
in time
algorithmis to
be
usedin
DFT
computation,
an additional algorithm must operate onthe
input
sequenceto
placethe
data
in
bit
reversed order.This
resultsin only
a small amount of additional overhead as willbe
shownlater
in this
paper.Other
algorithms existthat
do
not requirebit
reversedorder,
however,
these
have
other shortcomingsthat
will notbe discussed
here.
The
one-dimensionaldecimation
in
time
FFT
algorithm canbe easily
implemented
in
afashion
that
will compute atwo-dimensional
discrete
Fourier
transform.
This
resultsfrom
the
separability
ofthe two-dimensional
discrete
Fourier
transform.
The
computation ofthe
two-dimensional
discrete
Fourier
transform
canbe
done in the
following
way.With
the
image
arrangedin
anarray
or matrix ofdimension
N
xN
the
first
operationis to
perform separateDFT's
on each ofthe
N
columns(or
rowsl
ofthe
-matrix.Each
ofthese DFT's
willbe
ofdimension fl.
When
this
operation
is
complete,the
N
xN
matrixresulting
from
the
N
one-dimensionalFFT
operationsis
transposed.
After
the
transposition,
the
row values arenow
the
column values andN
one-dimensionalDFT's
are again performed onthe
columns.(The
purpose ofthe
transpositionis
sothat
a separatealgorithm need not
be
writtento
performN DFT's
onthe
rows ofthe matrix.)
Thus,
performing
a two-dimensionalDFT
on animage
representedby
anN
xN
43
,.2,
2
N times.
This
results in atotal
of2N log2N
operations neededfor
a
two-dimensional
DFT.
Because
ofbit
reversaloperations,
matrixtransposition,
andgeneral software overhead
the
total
number of operations neededfor
the
2
two-dimensional
DFT is
somewhat morethan
2N log2N.
In
this
paperthe
relative
importance
ofthis
additional overhead willbe indicated in
Section
3
45
3.1
Method
ofExamination
This
thesis
will examinehow
different hardware
microprocessorarchitectures will perform when
executing essentially
the
samedecimation-in-time
FFT
algorithmin the
calculation ofthe two-dimensional
discrete
Fourier transform.
It
willbe
assumedin this thesis that the data to be
transformed,
that
is the array
ofpixels,
is entirely memory
resident andthe
operationsused
to
load
this
data into memory
willbe ignored.
With the
aboveconditions,
the
overall computational path usedby
any
microprocessor architecturein the
calculation ofthe
2D-DFT
is
givenin the
following
flow
chart.The
loop
labeled
1
in
the
flow
chartis
executedN times
whentransforming
the
first N
columns of anN
xN array
of pixels.It
is
then
executed another
N
times
whenthe
rows of pixelarray
aretransformed.
This
meansthat
processblocks
A
+B
are executed atotal
of2N
times.
The
loop
labeled
2
is
executed once.Process C transposes the
pixelarray
sothat the
rowsbecome
columns.This
permitsthe
data addressing
schemes
for
processblocks A
andB to
be
used again.Because
ofthe
useof
this
data
transposition,
the
completed2D-DFT
output willbe
trans
posed unless
it is
transposed
back
againby
processC2>
It
is
notnecessary to
do
this
because
the
usermay desire
transposed
data.
In
addition,the
data may be
retainedin memory for further processing
at
the
completion ofthe
2D-DFT
computation.It is
notnecessary to
2D-DFT
Computation
Input Pixel
Data
into
Memory
I
Initialize
Software
Parameters
Perform
Bit
Reversal
on oneColumn
in
Array
H
is
aColumn
pointer
1
<H
<N
<-A
Perform
alinear
FFT
on oneColumn
in
Array
Output Pixel
Data
(optional
)
\ from
memory
Transpose
Pixel
Array
(optional
)
<-<
i
i
H-H
+1
->
'1
Transpose
Pixel
Array
47
Implementation
Scheme
The Z8000
microprocessor willbe
used asthe
baseline
processorin this thesis.
All
hardware
architectures considered will usethis
as
their processing
unit.This thesis
will consider sixhardware
architectures.
These
are summarizedbelow.
Architecture
I
This
willbe
a singleZ8000 MPU
equipped with memory.In
this
architecture and
in
allarchitectures,
square pixel arrays ofdimension
NxN
willbe
processed.Complex
floating
point arithmetric willbe
handled entirely in
software with multiplicationinstructions exercising
the
MPU's
onchip
multiplier.A 16-bit
mantissa and16-bit
exponentwill
be
assumed.Coefficients
usedin
the
FFT
computations willbe
calculated
recursively
withinthe
FFT
algorithm.The
pixelarray
need
only
be
square andits
dimension N be
a power oftwo.
Architecture
II
This
architectureis
a single processor with memory.The
pixelarray
willbe
constrainedto
afixed
squaredimension.
The
co