Vous êtes sur la page 1sur 7

Chapter 5

Bit-Reversed Input to the


Radix-2 DIF FFT
Technically speaking, the correctness of Algorithm 4.2 depends on the fact that xm is
initially contained in a[m]. For easy reference, the contents of a[J] and a[J + HalfSize]
()
have been added to Table 4.2 to obtain Table 5.1. The notation xm is used to denote
xm s derivative, which overwrites xm after an in-place buttery computation in Stage
(3)
. Accordingly, after Stage 3 is completed, xi2 i1 i0 = Xi0 i1 i2 as explained in Chapter 4.
Table 5.1 The contents of a[J] and a[J + HalfSize] in Algorithm 4.2.
Buttery

Current

Decimal

Binary

Decimal

Binary

Computation

HalfSize

a[J]

a[J + HalfSize]

J + HalfSize

Stage 1

N/2 = 22 = 4

a[0] = x0

000

a[4] = x4

100

a[1] = x1

001

a[5] = x5

101

a[2] = x2

010

a[6] = x6

110

a[3] = x3

011

a[7] = x7

111

Stage 2

N/22 = 21 = 2

(1)

a[0] = x0
a[1] =

N/22 = 21 = 2

a[4] =
a[5] =

Stage 3

N/23 = 20 = 1
3

a[0] =

N/2 = 2 = 1

a[2] =

N/23 = 20 = 1

a[4] =

N/2 = 2 = 1

a[6] =

(1)
x1
(1)
x4
(1)
x5
(2)
x0
(2)
x2
(2)
x4
(2)
x6

000

(1)

010

(1)
x3
(1)
x6
(1)
x7
(2)
x1
(2)
x3
(2)
x5
(2)
x7

011

a[2] = x2

001

a[3] =

100

a[6] =

101

a[7] =

000

a[1] =

010

a[3] =

100

a[5] =

110

a[7] =

110
111
001
011
101
111

(1)

(2)

However, the following program is correct, regardless of where xi2 i1 i0 , xi2 i1 i0 , xi2 i1 i0 ,
(3)

and xi2 i1 i0 are found in a.

2000 by CRC Press LLC

Algorithm 5.1 The iterative DIF FFT algorithm applied to the x elements.
begin
k := n 1
Initial problem size N = 2n
while k 0 do
Halve each problem
Apply Gentleman-Sande buttery computation
to all pairs of elements of x whose
(binary) subscripts dier in bit ik
k := k 1
end while
end

Thus, the input data could be permuted arbitrarily; if the butteries are applied
correctly to the data, the correct answers would be obtained. Moreover, the element
(3)
of a that initially contained xi2 i1 i0 would contain xi2 i1 i0 = Xi0 i1 i2 at the end of the
computation.

5.1

The Eect of Bit-Reversed Input

Suppose the objective is to nd an initial ordering of the input so that the resulting
output is in natural order. The observation above implies that initially, a[i0 i1 i2 ] should
contain xi2 i1 i0 , since at the end of the computation one wants a[i0 i1 i2 ] to contain
(3)
xi2 i1 i0 = Xi0 i1 i2 . That is, the input should be placed in bit-reversed order before the
computation begins as shown in Figure 5.1.
Figure 5.1 Bit-reversed input to the FFT and the naturally ordered output.

A separate program is needed to handle the bit-reversed input data. Algorithm 5.2
contains the pseudo-code. The twiddle factors are assumed to have been pre-computed
and stored in array w in bit-reversed order as shown in Figure 5.2. This allows one
to relate the binary addresses in w to the shorthand notations for the twiddle factors
i1 i0
i0 0
0
using w[i0 i1 ] = N
, w[0i0 ] = N
, and w[00] = N
= 1.

2000 by CRC Press LLC

Figure 5.2 Store the N/2 = 4 pre-computed twiddle factors in bit-reversed order.

Algorithm 5.2 The radix-2 DIF FFT algorithm for bit-reversed input.
begin
NumOfProblems := 1
Initially: One problem of size N
ProblemSize := N
HalfSize = ProblemSize/2
Distance := 1
while ProblemSize > 1 do
Halve each problem
for JFirst := 0 to NumOfProblems 1 do
J := JFirst; Jtwiddle := 0
while J < N 1 do

W := w[Jtwiddle]
Assume w[m] = N
, m bit-reversed 
Temp := a[J]
a[J] := Temp + a[J + Distance]
a[J + Distance] := (Temp a[J + Distance]) W
Jtwiddle := Jtwiddle + 1
Access consecutive w[m]
J := J + 2 NumOfProblems
end while
end for
NumOfProblems := NumOfProblems 2
ProblemSize := ProblemSize/2
Distance := Distance 2
end while
end

2000 by CRC Press LLC

Applying Algorithm 5.2 to the bit-reversed data in the example with N = 8 in


Figure 5.1, all pairs of a[J] and a[J + Distance] are identied in Table 5.2 and they
()
show that each xm is paired up with the same partner as previously shown in Table 5.1.
T

a
c

. o hu

C u

Dt

1
(

Dt
(

3
(

5.2

nln

= 2

= 4
= 1

ia

= 1
= 4

ia
H

ia
H

[i

r t

mk a

= 2

Dt

u 2 f+ eD[

u t

o & H
S

oba

J
et d 5.2
sJn
Algorithm

+ D u

r e

t
f

et

eB e r
t

[ J + Di

a
S

n f
a

is

t
i

in

t l
t

st

sg

= tx e

[4 0 a

l 0 n

] 1 c

=lz

[ 0 f 6

3 1&

] 1 e

[5 1

5 0

1 1

sg

t e

sg

t e

A Taxonomy for Radix-2 FFT Algorithms

Shorthand Notation for the DIFRN Algorithm

For the case N = 8, a shorthand notation describing the three-stage process, together
with the initial permutation to bit-reversed order, is the sequence

2000 by CRC Press LLC

ci

In this and the previous chapter, two similar but not identical DIF FFT algorithms were
developed. The rst accepts its input in natural order, and produces its output in bitreversed order, while the second accepts its input in bit-reversed order, and produces
its output in natural order. In later chapters, similar variations will be developed for
the DIT FFT algorithm. In addition, versions of both DIT and DIF FFT algorithms
will be developed that accept naturally ordered input and produce naturally ordered
output. In order to be able to refer to these six variations in a succinct and suggestive
way, a two-letter convention will be used in the sequel: NR will mean naturally
ordered input and bit-reversed output, with RN and NN denoting the obvious other
possibilities mentioned above. Thus, the DITRN algorithm would refer to the version
of the DIT FFT algorithm that accepts its input in bit-reversed order and produces
its output in natural order. If it makes no dierence whether the DITNR or DIFNR
algorithms are intended, the term an NR algorithm will be used. It is common in
the literature to refer to NN algorithms as ordered FFTs.

5.3

n
S

c
i

n
S

c
i

i2 i1 i0

i0 i1 i2

i0 i1 2

i0 1 2

Here the sequence begins with i2 i1 i0 , which is intended to imply that xi2 i1 i0 is assumed


to be in a[i2 i1 i0 ] as before; the notation i0 i1 i2 is intended to imply that xi2 i1 i0 has been
permuted to a[i0 i1 i2 ] before the rst buttery computation is performed. That is, i2 i1 i0
always represents the binary representation of the subscripts of x; the order in which
the bits appear, or are permuted during the computation, refer to movements that
xi2 i1 i0 or its derivatives undergo in a during the computation.
For N = 32, the sequence describing the ve-stage process, together with the initial
permutation to bit-reversed order, is shown below.

i4 i3 i2 i1 i0

5.3.1

i0 i1 i2 i3 i4

i0 i1 i2 i3 4

i0 i1 i2 3 4

i0 i1 2 3 4

i0 1 2 3 4

Shorthand notation for the twiddle factors

To express the twiddle factors corresponding to the n-stage sequence shown in Section 5.3, one only needs to recall that a[i0 i1 i2 i3 i4 ] contains xi4 i3 i2 i1 i0 or its derivative.


For example, when the content of a[i0 i1 i2 i3 1] is modied during stage i0 i1 i2 i3 i4 , the
element being updated is x1i3 i2 i1 i0 ; when the content of a[i0 i1 i2 14 ] is modied during


(1)

stage i0 i1 i2 i3 4 , the element being updated is the derivative x4 1i2 i1 i0 , and so on.
Therefore, the shorthand notation for the twiddle factors is exactly the same as
those derived in Chapter 4 for xi4 i3 i2 i1 i0 and its derivatives, namely,

Ni3 i2 i1 i0 , Ni2 i1 i0 0 , Ni1 i0 00 , Ni0 000 , N0 = 1 .

5.3.2

Applying algorithm 5.2 to a N = 32 example.

The complete process of applying Algorithm 5.2 to a N = 32 example is depicted


in Figure 5.3. It is important to recognize that the ve-stage sequence shown in Section 5.3, together with the twiddle factors shown above, capture all of the details shown
in Figure 5.3.
For easy comparison with Figure 4.4, the pairs of subproblems resulting from every
stage of buttery computation are again identied by highlighting a particular pair
which involves a[0] = x0 in Figure 5.3the two subproblems forming the pair are
shaded in dierent grey tones so one can be easily distinguished from the other.
Comparing Figure 5.3 with Figure 4.4, one sees that the same pair of subproblems
are located in dierent parts of the data array due to dierent initial and intermediate orderings. Thus, the computations performed DIFNR and DIFRN algorithms are
essentially identical, although they must access the data arrays in dierent manners.

2000 by CRC Press LLC

Figure 5.3 Butteries for the DIFRN FFT algorithm.

2000 by CRC Press LLC

5.4

Using Scrambled Output for Input to the Inverse


FFT

As demonstrated in Chapter 1, the DFT and the IDFT (inverse discrete Fourier transform) are essentially the same computation, apart from a scale factor and conjugation
of the twiddle factors. Thus, algorithms essentially identical to the DIT and DIF methods already introduced, including their data scrambling characteristics, can be used
to implement the IDFT as well. One may combine forward DIFNR with inverse FFT
using IDIFRN , and the latter will automatically transform the bit-reversed frequency
output back into naturally ordered time series. This process is depicted for a N = 8
example in Figure 5.4.
Figure 5.4 Using DIFNR and DIFRN in computing forward and inverse FFT.

On the other hand, if the input data to the forward FFT are given in bit-reversed
order, one has the exibility of of using an RN algorithm in the forward FFT and a
complementary NR algorithm for the inverse FFT. Again, the nal time series will be
in the same (bit-reversed) order as the given input.
In any case, by appropriate combination of RN and NR algorithms for the forward
and inverse FFT, the user may be completely shielded from the complications caused
by the dierent ordering of data in the middle of the computation. Thus, it is useful
to have the two dierent implementations.

5.5

Notes and References

Many bit-reversal algorithms that reorder data corresponding to reversing the order
of bits in the array index have been proposed in the FFT literature. In [60], Karp
reviewed, tested, and compared 30 methods he had recoded in a uniform style on computers with dierent memory systems. Two new algorithms that perform substantially
better than the others were also proposed in [60].

2000 by CRC Press LLC

Vous aimerez peut-être aussi