Embedded Systems September 2000 Vol13_10

Issue link:

Contents of this Issue


Page 131 of 229

Whi le the Fourier transform works II Fast Hartley Transform- optimi zed for speed #include typedef float DataType; void InitTrigTable(DataType *TrigPtr, int nBits) II Pre-compute sine function for first quadrant only { unsigned int dataNdiv4,i; DataType Radianlncrement; dataNdiv4 = 1 << (nBits-2); Radianlncrement = 3.141592653589793238 I 2 I dataNdiv4; for(i=O; i; } It turns out that using the Hartley DataType *fastHartleyTransform( DataType *DataArray, DataType *WorkArray, DataType *TrigPtr, int nBits ) 11 DataArray[O ... NJ are to be transformed. Results will be in either II DataArray[J or WorkArray[J. This function returns a pointer to II whichever array it is. TrigPtr is a pointer to a pre-computed 11 table of sines for angles in the first quadrant. If there are 11 dataN elements in the first two arrays, then there are dataN14 II elements in TrigPtr[J, and nBits is the Log base 2 of dataN. II dataN must be a power of 2 and be at Least 16. { DataType *fromArray,*ToArray,*SwapTemp; DataType *from,*To,*fromRetrograde; DataType *To_ArrayEnd,*To_QuadrantEnd; DataType *SinPtr,*CosPtr; unsigned int ButterflyBLocks,ButterflyWidth; unsigned int dataN,baseN,TrigArraySize; unsigned int RegularBase,ReversedBase; dataN = 1 << nBits; TrigArraySize = dataNI4; From = DataArray; To = WorkArray; II Reorder the From[] array and place it in the To[J array ... II according to bit-reversed indices. baseN = dataNI16; for(RegularBase=O; RegularBase

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems September 2000 Vol13_10