📄 fouriertransformfh.h
字号:
// file: $isip/class/algo/FourierTransform/FourierTransformFh.h// version: $Id: FourierTransformFh.h,v 1.3 2001/03/05 23:59:31 peng Exp $//// This file defines the functions required by the FHT code//// this header file is a part of the public domain fht code by ron mayer.// this is supposedly proprietary.//// this code is based on the algorithm as described in the work by ron// mayer whose code is available as a free-ware. the algorithm is// described in the paper://// Hsieh S. Hou, "the fast hartley transform algorithm", IEEE// Transactions on Computers, pp. 147-153, February 1987.//// isip include files//// make sure definitions are only made once//#ifndef ISIP_FT_FHT#define ISIP_FT_FHT// the fht code seems to require these macro definitions// it is called from within the fht routine and cannot be// removed.//#ifdef FT_FHT_GOOD_TRIG#else#define FT_FHT_FAST_TRIG#endif#if defined(FT_FHT_GOOD_TRIG)#define FHT_SWAP(a,b,t) {(t)=(a);(a)=(b);(b)=(t);}#define TRIG_VARS \ long t_lam = 0; \#define TRIG_INIT(k,c,s) \ { \ long i; \ for (i=2 ; i<=k ; ++i) { \ coswrk[i]=costab[i];sinwrk[i]=sintab[i]; } \ t_lam = 0; \ c = 1; \ s = 0; \ }#define TRIG_NEXT(k,c,s) \ { \ long i,j; \ ++(t_lam); \ for (i=0 ; !(1 << i))&(long)t_lam) ; ++i); \ i = k - i; \ s = sinwrk[i]; \ p = t_lam; \ c = coswrk[i]; \ fprintf(stdout, "%d\n", (t_lam)); \ if (i>1) \ { \ for (j=k-i+2 ; (1<<j)&(long)t_lam ; ++j); \ j = k - j; \ sinwrk[i] = halsec[i] * (sinwrk[i - 1] + sinwrk[j]); \ coswrk[i] = halsec[i] * (coswrk[i - 1] + coswrk[j]); \ } \ }#define TRIG_RESET(k,c,s)#endif#if defined(FT_FHT_FAST_TRIG)#define TRIG_VARS \ double t_c,t_s;#define TRIG_INIT(k,c,s) \ { \ t_c = costab[k]; \ t_s = sintab[k]; \ c = 1; \ s = 0; \ }#define TRIG_NEXT(k,c,s) \ { \ double t = c;\ c = t * t_c - s * t_s; \ s = t * t_s + s * t_c; \ }#define TRIG_RESET(k,c,s)#endifstatic double costab[20]= { .00000000000000000000000000000000000000000000000000, .70710678118654752440084436210484903928483593768847, .92387953251128675612818318939678828682241662586364, .98078528040323044912618223613423903697393373089333, .99518472667219688624483695310947992157547486872985, .99879545620517239271477160475910069444320361470461, .99969881869620422011576564966617219685006108125772, .99992470183914454092164649119638322435060646880221, .99998117528260114265699043772856771617391725094433, .99999529380957617151158012570011989955298763362218, .99999882345170190992902571017152601904826792288976, .99999970586288221916022821773876567711626389934930, .99999992646571785114473148070738785694820115568892, .99999998161642929380834691540290971450507605124278, .99999999540410731289097193313960614895889430318945, .99999999885102682756267330779455410840053741619428 };static double sintab[20]= { 1.0000000000000000000000000000000000000000000000000, .70710678118654752440084436210484903928483593768846, .38268343236508977172845998403039886676134456248561, .19509032201612826784828486847702224092769161775195, .09801714032956060199419556388864184586113667316749, .04906767432741801425495497694268265831474536302574, .02454122852291228803173452945928292506546611923944, .01227153828571992607940826195100321214037231959176, .00613588464915447535964023459037258091705788631738, .00306795676296597627014536549091984251894461021344, .00153398018628476561230369715026407907995486457522, .00076699031874270452693856835794857664314091945205, .00038349518757139558907246168118138126339502603495, .00019174759731070330743990956198900093346887403385, .00009587379909597734587051721097647635118706561284, .00004793689960306688454900399049465887274686668768 };// end of file// #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -