Issue link: http://dc.ee.ubm-us.com/i/71837

LISTING 1, continued Working implementation of FHT .. ·:. · To[1] = (c=From[QJ - From[1J) + (d=From[2J - From[3]); To[2J = a - b; To[3] = c - d; To ~ 4; From ~ 4; } II Start general butterfly calculations with round 3 ... FromArray = DataArray; ToArray = WorkArray; ButterflyWidth = 4; while( ButterflyBlocks ) { From = FromArray; To = ToArray; To_ArrayEnd = ToArray + dataN; while(To != To_ArrayEnd) { II This while loop does a single butterfly block DataType CSTerm; II Special 0 degrees case ..• To[OJ = From[OJ + From[ButterflyWidthJ; To[ButterflyWidthJ = From[OJ - From[ButterflyWidthJ; II .. then the rest of the first quadrant ... To_QuadrantEnd = To + ButterflyWidth12; SinPtr = TrigPtr; CosPtr = TrigPtr + TrigArraySize; II beyond end of trig array FromRetrograde = From + ButterflyWidth + ButterflyWidth; while(1) { From++; To++; FromRetrograde--; if( To == To_QuadrantEnd ) break; SinPtr ~ ButterflyBlocks; CosPtr -= ButterflyBlocks; CSTerm = *CosPtr * From[ButterflyWidthJ + *SinPtr * FromRetrograde[OJ; To[QJ = From[QJ + CSTerm; To[ButterflyWidthJ = From[OJ - CSTerm; } II Special 90 degrees case •.• To[OJ = From[OJ + FromRetrograde[OJ; To[ButterflyWidthJ = From[OJ - FromRetrograde[OJ; II .. then the rest of the second quadrant •.. To_QuadrantEnd = To + ButterflyWidthl2; Listing 1 continued on p. 138 134 SEPTEMBER 2000 Embedded Systems Programming · ··::, indexed values. As before, we will con- sider all indices to be interpreted modulo-N. But since Xo and X1 are defined in terms of 2t, they actually repeat modulo N/ 2. So consider Xo and X1 as sequences oflength N/ 2 and let H0 and H1 be their Hartley trans- forms. Let M tand for N/ 2. Then, by the definiti on of the Hartley transfom1 in Equation 1 we have: H0(f)= ~ %x0(r{cos( :)+sin( Zt)] 2 2 I I first two rounds are done ... ButterflyBlocks = dataNIB; II these parameters are set for round 3. H,(f) = ~ %x,(r{cos( :)+sin( 2 2 : )J I leave it as an exercise for the read- er to verify that: (3) (If you are reading the Byte article, note that this equation is incorrectly shown with N, instead of N.) It took me about half an hour to verify this equation with paper and pencil, using only ilie trig identities: sin(A)cos(B) = sin( A+ B)+ sin( A- B) 2 sin(A)sin(B) = cos( A - B) - cos( A + B) 2 cos(A)cos(B) = cos( A- B)+ cos( A+ B) 2 If you want to develop an appreciation of the basis of the Hartley transform, I recommend performing ilie exercise. Keeping in mind that ilie Hartley transforms on the righ t side of Equation 3 repeat modulo N/ 2, we can recognize the following symmeu-y: H ~) ~~H0(f)-H (! + = ,(f)cos(::)) - H,(N- f)sin( :) (4) Equations 3 and 4 taken together

- September001
- September002
- September003
- September004
- September005
- September006
- September007
- September008
- September009
- September010
- September011
- September012
- September013
- September014
- September015
- September016
- September017
- September018
- September019
- September020
- September021
- September022
- September023
- September024
- September025
- September026
- September027
- September028
- September029
- September030
- September031
- September032
- September033
- September034
- September035
- September036
- September037
- September038
- September039
- September040
- September041
- September042
- September043
- September044
- September045
- September046
- September047
- September048
- September049
- September050
- September051
- September052
- September053
- September054
- September055
- September056
- September057
- September058
- September059
- September060
- September061
- September062
- September063
- September064
- September065
- September066
- September067
- September068
- September069
- September070
- September071
- September072
- September073
- September074
- September075
- September076
- September077
- September078
- September079
- September080
- September081
- September082
- September083
- September084
- September085
- September086
- September087
- September088
- September089
- September090
- September091
- September092
- September093
- September094
- September095
- September096
- September097
- September098
- September099
- September100
- September101
- September102
- September103
- September104
- September105
- September106
- September107
- September108
- September109
- September110
- September111
- September112
- September113
- September114
- September115
- September116
- September117
- September118
- September119
- September120
- September121
- September122
- September123
- September124
- September125
- September126
- September127
- September128
- September129
- September130
- September131
- September132
- September133
- September134
- September135
- September136
- September137
- September138
- September139
- September140
- September141
- September142
- September143
- September144
- September145
- September146
- September147
- September148
- September149
- September150
- September151
- September152
- September153
- September154
- September155
- September156
- September157
- September158
- September159
- September160
- September161
- September162
- September163
- September164
- September165
- September166
- September167
- September168
- September169
- September171
- September172
- September173
- September174
- September175
- September176
- September177
- September178
- September179
- September180
- September181
- September182
- September183
- September184
- September185
- September186
- September187
- September188
- September189
- September190
- September191
- September192
- September193
- September194
- September195
- September196
- September197
- September198
- September199
- September200
- September201
- September202
- September203
- September204
- September205
- September206
- September207
- September208
- September209
- September210
- September211
- September212
- September213
- September214
- September215
- September216
- September217
- September218
- September219
- September220
- September221
- September222
- September223
- September224
- September225
- September226
- September227
- September228
- September229
- September230
- September231