NUMfft_core.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggSQUISH SOFTWARE CODEC SOURCE CODE. *
  4. * *
  5. ********************************************************************
  6. function: Fast discrete Fourier and cosine transforms and inverses
  7. author: Monty <xiphmont@mit.edu>
  8. modifications by: Monty
  9. last modification date: Jul 1 1996
  10. djmw 20030630 Adapted for praat (replaced 'int' declarations with 'long').
  11. djmw 20040511 Made all local variables type double to increase numerical precision.
  12. djmw 20171003 Replaced `long` declarations with `integer`).
  13. ********************************************************************/
  14. /* These Fourier routines were originally based on the Fourier routines of
  15. the same names from the NETLIB bihar and fftpack fortran libraries
  16. developed by Paul N. Swarztrauber at the National Center for Atmospheric
  17. Research in Boulder, CO USA. They have been reimplemented in C and
  18. optimized in a few ways for OggSquish. */
  19. /* As the original fortran libraries are public domain, the C Fourier
  20. routines in this file are hereby released to the public domain as well.
  21. The C routines here produce output exactly equivalent to the original
  22. fortran routines. Of particular interest are the facts that (like the
  23. original fortran), these routines can work on arbitrary length vectors
  24. that need not be powers of two in length. */
  25. #include "melder.h" /* for integer */
  26. static void drfti1 (integer n, FFT_DATA_TYPE * wa, integer *ifac)
  27. {
  28. static integer ntryh[4] = { 4, 2, 3, 5 };
  29. static double tpi = 6.28318530717958647692528676655900577;
  30. double arg, argh, argld, fi;
  31. integer ntry = 0, i, j = -1;
  32. integer k1, l1, l2, ib;
  33. integer ld, ii, ip, is, nq, nr;
  34. integer ido, ipm, nfm1;
  35. integer nl = n;
  36. integer nf = 0;
  37. L101:
  38. j++;
  39. if (j < 4)
  40. ntry = ntryh[j];
  41. else
  42. ntry += 2;
  43. L104:
  44. nq = nl / ntry;
  45. nr = nl - ntry * nq;
  46. if (nr != 0)
  47. goto L101;
  48. nf++;
  49. ifac[nf + 1] = ntry;
  50. nl = nq;
  51. if (ntry != 2)
  52. goto L107;
  53. if (nf == 1)
  54. goto L107;
  55. for (i = 1; i < nf; i++)
  56. {
  57. ib = nf - i + 1;
  58. ifac[ib + 1] = ifac[ib];
  59. }
  60. ifac[2] = 2;
  61. L107:
  62. if (nl != 1)
  63. goto L104;
  64. ifac[0] = n;
  65. ifac[1] = nf;
  66. argh = tpi / n;
  67. is = 0;
  68. nfm1 = nf - 1;
  69. l1 = 1;
  70. if (nfm1 == 0)
  71. return;
  72. for (k1 = 0; k1 < nfm1; k1++)
  73. {
  74. ip = ifac[k1 + 2];
  75. ld = 0;
  76. l2 = l1 * ip;
  77. ido = n / l2;
  78. ipm = ip - 1;
  79. for (j = 0; j < ipm; j++)
  80. {
  81. ld += l1;
  82. i = is;
  83. argld = (double) ld *argh;
  84. fi = 0.;
  85. for (ii = 2; ii < ido; ii += 2)
  86. {
  87. fi += 1.;
  88. arg = fi * argld;
  89. wa[i++] = cos (arg);
  90. wa[i++] = sin (arg);
  91. }
  92. is += ido;
  93. }
  94. l1 = l2;
  95. }
  96. }
  97. static void NUMrffti (integer n, FFT_DATA_TYPE * wsave, integer *ifac)
  98. {
  99. if (n == 1)
  100. return;
  101. drfti1 (n, wsave + n, ifac);
  102. }
  103. /* void NUMcosqi(integer n, FFT_DATA_TYPE *wsave, integer *ifac){ static
  104. double pih = 1.57079632679489661923132169163975; static integer k;
  105. static double fk, dt;
  106. dt=pih/n; fk=0.; for(k=0;k<n;k++){ fk+=1.; wsave[k] = cos(fk*dt); }
  107. NUMrffti(n, wsave+n,ifac); } */
  108. static void dradf2 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1)
  109. {
  110. integer i, k;
  111. double ti2, tr2;
  112. integer t0, t1, t2, t3, t4, t5, t6;
  113. t1 = 0;
  114. t0 = (t2 = l1 * ido);
  115. t3 = ido << 1;
  116. for (k = 0; k < l1; k++)
  117. {
  118. ch[t1 << 1] = cc[t1] + cc[t2];
  119. ch[(t1 << 1) + t3 - 1] = cc[t1] - cc[t2];
  120. t1 += ido;
  121. t2 += ido;
  122. }
  123. if (ido < 2)
  124. return;
  125. if (ido == 2)
  126. goto L105;
  127. t1 = 0;
  128. t2 = t0;
  129. for (k = 0; k < l1; k++)
  130. {
  131. t3 = t2;
  132. t4 = (t1 << 1) + (ido << 1);
  133. t5 = t1;
  134. t6 = t1 + t1;
  135. for (i = 2; i < ido; i += 2)
  136. {
  137. t3 += 2;
  138. t4 -= 2;
  139. t5 += 2;
  140. t6 += 2;
  141. tr2 = wa1[i - 2] * cc[t3 - 1] + wa1[i - 1] * cc[t3];
  142. ti2 = wa1[i - 2] * cc[t3] - wa1[i - 1] * cc[t3 - 1];
  143. ch[t6] = cc[t5] + ti2;
  144. ch[t4] = ti2 - cc[t5];
  145. ch[t6 - 1] = cc[t5 - 1] + tr2;
  146. ch[t4 - 1] = cc[t5 - 1] - tr2;
  147. }
  148. t1 += ido;
  149. t2 += ido;
  150. }
  151. if (ido % 2 == 1)
  152. return;
  153. L105:
  154. t3 = (t2 = (t1 = ido) - 1);
  155. t2 += t0;
  156. for (k = 0; k < l1; k++)
  157. {
  158. ch[t1] = -cc[t2];
  159. ch[t1 - 1] = cc[t3];
  160. t1 += ido << 1;
  161. t2 += ido;
  162. t3 += ido;
  163. }
  164. }
  165. static void dradf4 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
  166. FFT_DATA_TYPE * wa2, FFT_DATA_TYPE * wa3)
  167. {
  168. static double hsqt2 = .70710678118654752440084436210485;
  169. integer i, k, t0, t1, t2, t3, t4, t5, t6;
  170. double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
  171. t0 = l1 * ido;
  172. t1 = t0;
  173. t4 = t1 << 1;
  174. t2 = t1 + (t1 << 1);
  175. t3 = 0;
  176. for (k = 0; k < l1; k++)
  177. {
  178. tr1 = cc[t1] + cc[t2];
  179. tr2 = cc[t3] + cc[t4];
  180. ch[t5 = t3 << 2] = tr1 + tr2;
  181. ch[(ido << 2) + t5 - 1] = tr2 - tr1;
  182. ch[(t5 += (ido << 1)) - 1] = cc[t3] - cc[t4];
  183. ch[t5] = cc[t2] - cc[t1];
  184. t1 += ido;
  185. t2 += ido;
  186. t3 += ido;
  187. t4 += ido;
  188. }
  189. if (ido < 2)
  190. return;
  191. if (ido == 2)
  192. goto L105;
  193. t1 = 0;
  194. for (k = 0; k < l1; k++)
  195. {
  196. t2 = t1;
  197. t4 = t1 << 2;
  198. t5 = (t6 = ido << 1) + t4;
  199. for (i = 2; i < ido; i += 2)
  200. {
  201. t3 = (t2 += 2);
  202. t4 += 2;
  203. t5 -= 2;
  204. t3 += t0;
  205. cr2 = wa1[i - 2] * cc[t3 - 1] + wa1[i - 1] * cc[t3];
  206. ci2 = wa1[i - 2] * cc[t3] - wa1[i - 1] * cc[t3 - 1];
  207. t3 += t0;
  208. cr3 = wa2[i - 2] * cc[t3 - 1] + wa2[i - 1] * cc[t3];
  209. ci3 = wa2[i - 2] * cc[t3] - wa2[i - 1] * cc[t3 - 1];
  210. t3 += t0;
  211. cr4 = wa3[i - 2] * cc[t3 - 1] + wa3[i - 1] * cc[t3];
  212. ci4 = wa3[i - 2] * cc[t3] - wa3[i - 1] * cc[t3 - 1];
  213. tr1 = cr2 + cr4;
  214. tr4 = cr4 - cr2;
  215. ti1 = ci2 + ci4;
  216. ti4 = ci2 - ci4;
  217. ti2 = cc[t2] + ci3;
  218. ti3 = cc[t2] - ci3;
  219. tr2 = cc[t2 - 1] + cr3;
  220. tr3 = cc[t2 - 1] - cr3;
  221. ch[t4 - 1] = tr1 + tr2;
  222. ch[t4] = ti1 + ti2;
  223. ch[t5 - 1] = tr3 - ti4;
  224. ch[t5] = tr4 - ti3;
  225. ch[t4 + t6 - 1] = ti4 + tr3;
  226. ch[t4 + t6] = tr4 + ti3;
  227. ch[t5 + t6 - 1] = tr2 - tr1;
  228. ch[t5 + t6] = ti1 - ti2;
  229. }
  230. t1 += ido;
  231. }
  232. if (ido % 2 == 1)
  233. return;
  234. L105:
  235. t2 = (t1 = t0 + ido - 1) + (t0 << 1);
  236. t3 = ido << 2;
  237. t4 = ido;
  238. t5 = ido << 1;
  239. t6 = ido;
  240. for (k = 0; k < l1; k++)
  241. {
  242. ti1 = -hsqt2 * (cc[t1] + cc[t2]);
  243. tr1 = hsqt2 * (cc[t1] - cc[t2]);
  244. ch[t4 - 1] = tr1 + cc[t6 - 1];
  245. ch[t4 + t5 - 1] = cc[t6 - 1] - tr1;
  246. ch[t4] = ti1 - cc[t1 + t0];
  247. ch[t4 + t5] = ti1 + cc[t1 + t0];
  248. t1 += ido;
  249. t2 += ido;
  250. t4 += t3;
  251. t6 += ido;
  252. }
  253. }
  254. static void dradfg (integer ido, integer ip, integer l1, integer idl1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * c1,
  255. FFT_DATA_TYPE * c2, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * ch2, FFT_DATA_TYPE * wa)
  256. {
  257. static double tpi = 6.28318530717958647692528676655900577;
  258. integer idij, ipph, i, j, k, l, ic, ik, is;
  259. integer t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
  260. double dc2, ai1, ai2, ar1, ar2, ds2;
  261. integer nbd;
  262. double dcp, arg, dsp, ar1h, ar2h;
  263. integer idp2, ipp2;
  264. arg = tpi / (double) ip;
  265. dcp = cos (arg);
  266. dsp = sin (arg);
  267. ipph = (ip + 1) >> 1;
  268. ipp2 = ip;
  269. idp2 = ido;
  270. nbd = (ido - 1) >> 1;
  271. t0 = l1 * ido;
  272. t10 = ip * ido;
  273. if (ido == 1)
  274. goto L119;
  275. for (ik = 0; ik < idl1; ik++)
  276. ch2[ik] = c2[ik];
  277. t1 = 0;
  278. for (j = 1; j < ip; j++)
  279. {
  280. t1 += t0;
  281. t2 = t1;
  282. for (k = 0; k < l1; k++)
  283. {
  284. ch[t2] = c1[t2];
  285. t2 += ido;
  286. }
  287. }
  288. is = -ido;
  289. t1 = 0;
  290. if (nbd > l1)
  291. {
  292. for (j = 1; j < ip; j++)
  293. {
  294. t1 += t0;
  295. is += ido;
  296. t2 = -ido + t1;
  297. for (k = 0; k < l1; k++)
  298. {
  299. idij = is - 1;
  300. t2 += ido;
  301. t3 = t2;
  302. for (i = 2; i < ido; i += 2)
  303. {
  304. idij += 2;
  305. t3 += 2;
  306. ch[t3 - 1] = wa[idij - 1] * c1[t3 - 1] + wa[idij] * c1[t3];
  307. ch[t3] = wa[idij - 1] * c1[t3] - wa[idij] * c1[t3 - 1];
  308. }
  309. }
  310. }
  311. }
  312. else
  313. {
  314. for (j = 1; j < ip; j++)
  315. {
  316. is += ido;
  317. idij = is - 1;
  318. t1 += t0;
  319. t2 = t1;
  320. for (i = 2; i < ido; i += 2)
  321. {
  322. idij += 2;
  323. t2 += 2;
  324. t3 = t2;
  325. for (k = 0; k < l1; k++)
  326. {
  327. ch[t3 - 1] = wa[idij - 1] * c1[t3 - 1] + wa[idij] * c1[t3];
  328. ch[t3] = wa[idij - 1] * c1[t3] - wa[idij] * c1[t3 - 1];
  329. t3 += ido;
  330. }
  331. }
  332. }
  333. }
  334. t1 = 0;
  335. t2 = ipp2 * t0;
  336. if (nbd < l1)
  337. {
  338. for (j = 1; j < ipph; j++)
  339. {
  340. t1 += t0;
  341. t2 -= t0;
  342. t3 = t1;
  343. t4 = t2;
  344. for (i = 2; i < ido; i += 2)
  345. {
  346. t3 += 2;
  347. t4 += 2;
  348. t5 = t3 - ido;
  349. t6 = t4 - ido;
  350. for (k = 0; k < l1; k++)
  351. {
  352. t5 += ido;
  353. t6 += ido;
  354. c1[t5 - 1] = ch[t5 - 1] + ch[t6 - 1];
  355. c1[t6 - 1] = ch[t5] - ch[t6];
  356. c1[t5] = ch[t5] + ch[t6];
  357. c1[t6] = ch[t6 - 1] - ch[t5 - 1];
  358. }
  359. }
  360. }
  361. }
  362. else
  363. {
  364. for (j = 1; j < ipph; j++)
  365. {
  366. t1 += t0;
  367. t2 -= t0;
  368. t3 = t1;
  369. t4 = t2;
  370. for (k = 0; k < l1; k++)
  371. {
  372. t5 = t3;
  373. t6 = t4;
  374. for (i = 2; i < ido; i += 2)
  375. {
  376. t5 += 2;
  377. t6 += 2;
  378. c1[t5 - 1] = ch[t5 - 1] + ch[t6 - 1];
  379. c1[t6 - 1] = ch[t5] - ch[t6];
  380. c1[t5] = ch[t5] + ch[t6];
  381. c1[t6] = ch[t6 - 1] - ch[t5 - 1];
  382. }
  383. t3 += ido;
  384. t4 += ido;
  385. }
  386. }
  387. }
  388. L119:
  389. for (ik = 0; ik < idl1; ik++)
  390. c2[ik] = ch2[ik];
  391. t1 = 0;
  392. t2 = ipp2 * idl1;
  393. for (j = 1; j < ipph; j++)
  394. {
  395. t1 += t0;
  396. t2 -= t0;
  397. t3 = t1 - ido;
  398. t4 = t2 - ido;
  399. for (k = 0; k < l1; k++)
  400. {
  401. t3 += ido;
  402. t4 += ido;
  403. c1[t3] = ch[t3] + ch[t4];
  404. c1[t4] = ch[t4] - ch[t3];
  405. }
  406. }
  407. ar1 = 1.;
  408. ai1 = 0.;
  409. t1 = 0;
  410. t2 = ipp2 * idl1;
  411. t3 = (ip - 1) * idl1;
  412. for (l = 1; l < ipph; l++)
  413. {
  414. t1 += idl1;
  415. t2 -= idl1;
  416. ar1h = dcp * ar1 - dsp * ai1;
  417. ai1 = dcp * ai1 + dsp * ar1;
  418. ar1 = ar1h;
  419. t4 = t1;
  420. t5 = t2;
  421. t6 = t3;
  422. t7 = idl1;
  423. for (ik = 0; ik < idl1; ik++)
  424. {
  425. ch2[t4++] = c2[ik] + ar1 * c2[t7++];
  426. ch2[t5++] = ai1 * c2[t6++];
  427. }
  428. dc2 = ar1;
  429. ds2 = ai1;
  430. ar2 = ar1;
  431. ai2 = ai1;
  432. t4 = idl1;
  433. t5 = (ipp2 - 1) * idl1;
  434. for (j = 2; j < ipph; j++)
  435. {
  436. t4 += idl1;
  437. t5 -= idl1;
  438. ar2h = dc2 * ar2 - ds2 * ai2;
  439. ai2 = dc2 * ai2 + ds2 * ar2;
  440. ar2 = ar2h;
  441. t6 = t1;
  442. t7 = t2;
  443. t8 = t4;
  444. t9 = t5;
  445. for (ik = 0; ik < idl1; ik++)
  446. {
  447. ch2[t6++] += ar2 * c2[t8++];
  448. ch2[t7++] += ai2 * c2[t9++];
  449. }
  450. }
  451. }
  452. t1 = 0;
  453. for (j = 1; j < ipph; j++)
  454. {
  455. t1 += idl1;
  456. t2 = t1;
  457. for (ik = 0; ik < idl1; ik++)
  458. ch2[ik] += c2[t2++];
  459. }
  460. if (ido < l1)
  461. goto L132;
  462. t1 = 0;
  463. t2 = 0;
  464. for (k = 0; k < l1; k++)
  465. {
  466. t3 = t1;
  467. t4 = t2;
  468. for (i = 0; i < ido; i++)
  469. cc[t4++] = ch[t3++];
  470. t1 += ido;
  471. t2 += t10;
  472. }
  473. goto L135;
  474. L132:
  475. for (i = 0; i < ido; i++)
  476. {
  477. t1 = i;
  478. t2 = i;
  479. for (k = 0; k < l1; k++)
  480. {
  481. cc[t2] = ch[t1];
  482. t1 += ido;
  483. t2 += t10;
  484. }
  485. }
  486. L135:
  487. t1 = 0;
  488. t2 = ido << 1;
  489. t3 = 0;
  490. t4 = ipp2 * t0;
  491. for (j = 1; j < ipph; j++)
  492. {
  493. t1 += t2;
  494. t3 += t0;
  495. t4 -= t0;
  496. t5 = t1;
  497. t6 = t3;
  498. t7 = t4;
  499. for (k = 0; k < l1; k++)
  500. {
  501. cc[t5 - 1] = ch[t6];
  502. cc[t5] = ch[t7];
  503. t5 += t10;
  504. t6 += ido;
  505. t7 += ido;
  506. }
  507. }
  508. if (ido == 1)
  509. return;
  510. if (nbd < l1)
  511. goto L141;
  512. t1 = -ido;
  513. t3 = 0;
  514. t4 = 0;
  515. t5 = ipp2 * t0;
  516. for (j = 1; j < ipph; j++)
  517. {
  518. t1 += t2;
  519. t3 += t2;
  520. t4 += t0;
  521. t5 -= t0;
  522. t6 = t1;
  523. t7 = t3;
  524. t8 = t4;
  525. t9 = t5;
  526. for (k = 0; k < l1; k++)
  527. {
  528. for (i = 2; i < ido; i += 2)
  529. {
  530. ic = idp2 - i;
  531. cc[i + t7 - 1] = ch[i + t8 - 1] + ch[i + t9 - 1];
  532. cc[ic + t6 - 1] = ch[i + t8 - 1] - ch[i + t9 - 1];
  533. cc[i + t7] = ch[i + t8] + ch[i + t9];
  534. cc[ic + t6] = ch[i + t9] - ch[i + t8];
  535. }
  536. t6 += t10;
  537. t7 += t10;
  538. t8 += ido;
  539. t9 += ido;
  540. }
  541. }
  542. return;
  543. L141:
  544. t1 = -ido;
  545. t3 = 0;
  546. t4 = 0;
  547. t5 = ipp2 * t0;
  548. for (j = 1; j < ipph; j++)
  549. {
  550. t1 += t2;
  551. t3 += t2;
  552. t4 += t0;
  553. t5 -= t0;
  554. for (i = 2; i < ido; i += 2)
  555. {
  556. t6 = idp2 + t1 - i;
  557. t7 = i + t3;
  558. t8 = i + t4;
  559. t9 = i + t5;
  560. for (k = 0; k < l1; k++)
  561. {
  562. cc[t7 - 1] = ch[t8 - 1] + ch[t9 - 1];
  563. cc[t6 - 1] = ch[t8 - 1] - ch[t9 - 1];
  564. cc[t7] = ch[t8] + ch[t9];
  565. cc[t6] = ch[t9] - ch[t8];
  566. t6 += t10;
  567. t7 += t10;
  568. t8 += ido;
  569. t9 += ido;
  570. }
  571. }
  572. }
  573. }
  574. static void drftf1 (integer n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa, integer *ifac)
  575. {
  576. integer i, k1, l1, l2;
  577. integer na, kh, nf;
  578. integer ip, iw, ido, idl1, ix2, ix3;
  579. nf = ifac[1];
  580. na = 1;
  581. l2 = n;
  582. iw = n;
  583. for (k1 = 0; k1 < nf; k1++)
  584. {
  585. kh = nf - k1;
  586. ip = ifac[kh + 1];
  587. l1 = l2 / ip;
  588. ido = n / l2;
  589. idl1 = ido * l1;
  590. iw -= (ip - 1) * ido;
  591. na = 1 - na;
  592. if (ip != 4)
  593. goto L102;
  594. ix2 = iw + ido;
  595. ix3 = ix2 + ido;
  596. if (na != 0)
  597. dradf4 (ido, l1, ch, c, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
  598. else
  599. dradf4 (ido, l1, c, ch, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
  600. goto L110;
  601. L102:
  602. if (ip != 2)
  603. goto L104;
  604. if (na != 0)
  605. goto L103;
  606. dradf2 (ido, l1, c, ch, wa + iw - 1);
  607. goto L110;
  608. L103:
  609. dradf2 (ido, l1, ch, c, wa + iw - 1);
  610. goto L110;
  611. L104:
  612. if (ido == 1)
  613. na = 1 - na;
  614. if (na != 0)
  615. goto L109;
  616. dradfg (ido, ip, l1, idl1, c, c, c, ch, ch, wa + iw - 1);
  617. na = 1;
  618. goto L110;
  619. L109:
  620. dradfg (ido, ip, l1, idl1, ch, ch, ch, c, c, wa + iw - 1);
  621. na = 0;
  622. L110:
  623. l2 = l1;
  624. }
  625. if (na == 1)
  626. return;
  627. for (i = 0; i < n; i++)
  628. c[i] = ch[i];
  629. }
  630. static void dradb2 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1)
  631. {
  632. integer i, k, t0, t1, t2, t3, t4, t5, t6;
  633. double ti2, tr2;
  634. t0 = l1 * ido;
  635. t1 = 0;
  636. t2 = 0;
  637. t3 = (ido << 1) - 1;
  638. for (k = 0; k < l1; k++)
  639. {
  640. ch[t1] = cc[t2] + cc[t3 + t2];
  641. ch[t1 + t0] = cc[t2] - cc[t3 + t2];
  642. t2 = (t1 += ido) << 1;
  643. }
  644. if (ido < 2)
  645. return;
  646. if (ido == 2)
  647. goto L105;
  648. t1 = 0;
  649. t2 = 0;
  650. for (k = 0; k < l1; k++)
  651. {
  652. t3 = t1;
  653. t5 = (t4 = t2) + (ido << 1);
  654. t6 = t0 + t1;
  655. for (i = 2; i < ido; i += 2)
  656. {
  657. t3 += 2;
  658. t4 += 2;
  659. t5 -= 2;
  660. t6 += 2;
  661. ch[t3 - 1] = cc[t4 - 1] + cc[t5 - 1];
  662. tr2 = cc[t4 - 1] - cc[t5 - 1];
  663. ch[t3] = cc[t4] - cc[t5];
  664. ti2 = cc[t4] + cc[t5];
  665. ch[t6 - 1] = wa1[i - 2] * tr2 - wa1[i - 1] * ti2;
  666. ch[t6] = wa1[i - 2] * ti2 + wa1[i - 1] * tr2;
  667. }
  668. t2 = (t1 += ido) << 1;
  669. }
  670. if (ido % 2 == 1)
  671. return;
  672. L105:
  673. t1 = ido - 1;
  674. t2 = ido - 1;
  675. for (k = 0; k < l1; k++)
  676. {
  677. ch[t1] = cc[t2] + cc[t2];
  678. ch[t1 + t0] = -(cc[t2 + 1] + cc[t2 + 1]);
  679. t1 += ido;
  680. t2 += ido << 1;
  681. }
  682. }
  683. static void dradb3 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
  684. FFT_DATA_TYPE * wa2)
  685. {
  686. static double taur = -.5;
  687. static double taui = .86602540378443864676372317075293618;
  688. integer i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
  689. double ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2;
  690. t0 = l1 * ido;
  691. t1 = 0;
  692. t2 = t0 << 1;
  693. t3 = ido << 1;
  694. t4 = ido + (ido << 1);
  695. t5 = 0;
  696. for (k = 0; k < l1; k++)
  697. {
  698. tr2 = cc[t3 - 1] + cc[t3 - 1];
  699. cr2 = cc[t5] + (taur * tr2);
  700. ch[t1] = cc[t5] + tr2;
  701. ci3 = taui * (cc[t3] + cc[t3]);
  702. ch[t1 + t0] = cr2 - ci3;
  703. ch[t1 + t2] = cr2 + ci3;
  704. t1 += ido;
  705. t3 += t4;
  706. t5 += t4;
  707. }
  708. if (ido == 1)
  709. return;
  710. t1 = 0;
  711. t3 = ido << 1;
  712. for (k = 0; k < l1; k++)
  713. {
  714. t7 = t1 + (t1 << 1);
  715. t6 = (t5 = t7 + t3);
  716. t8 = t1;
  717. t10 = (t9 = t1 + t0) + t0;
  718. for (i = 2; i < ido; i += 2)
  719. {
  720. t5 += 2;
  721. t6 -= 2;
  722. t7 += 2;
  723. t8 += 2;
  724. t9 += 2;
  725. t10 += 2;
  726. tr2 = cc[t5 - 1] + cc[t6 - 1];
  727. cr2 = cc[t7 - 1] + (taur * tr2);
  728. ch[t8 - 1] = cc[t7 - 1] + tr2;
  729. ti2 = cc[t5] - cc[t6];
  730. ci2 = cc[t7] + (taur * ti2);
  731. ch[t8] = cc[t7] + ti2;
  732. cr3 = taui * (cc[t5 - 1] - cc[t6 - 1]);
  733. ci3 = taui * (cc[t5] + cc[t6]);
  734. dr2 = cr2 - ci3;
  735. dr3 = cr2 + ci3;
  736. di2 = ci2 + cr3;
  737. di3 = ci2 - cr3;
  738. ch[t9 - 1] = wa1[i - 2] * dr2 - wa1[i - 1] * di2;
  739. ch[t9] = wa1[i - 2] * di2 + wa1[i - 1] * dr2;
  740. ch[t10 - 1] = wa2[i - 2] * dr3 - wa2[i - 1] * di3;
  741. ch[t10] = wa2[i - 2] * di3 + wa2[i - 1] * dr3;
  742. }
  743. t1 += ido;
  744. }
  745. }
  746. static void dradb4 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
  747. FFT_DATA_TYPE * wa2, FFT_DATA_TYPE * wa3)
  748. {
  749. static double sqrt2 = 1.4142135623730950488016887242097;
  750. integer i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8;
  751. double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
  752. t0 = l1 * ido;
  753. t1 = 0;
  754. t2 = ido << 2;
  755. t3 = 0;
  756. t6 = ido << 1;
  757. for (k = 0; k < l1; k++)
  758. {
  759. t4 = t3 + t6;
  760. t5 = t1;
  761. tr3 = cc[t4 - 1] + cc[t4 - 1];
  762. tr4 = cc[t4] + cc[t4];
  763. tr1 = cc[t3] - cc[(t4 += t6) - 1];
  764. tr2 = cc[t3] + cc[t4 - 1];
  765. ch[t5] = tr2 + tr3;
  766. ch[t5 += t0] = tr1 - tr4;
  767. ch[t5 += t0] = tr2 - tr3;
  768. ch[t5 += t0] = tr1 + tr4;
  769. t1 += ido;
  770. t3 += t2;
  771. }
  772. if (ido < 2)
  773. return;
  774. if (ido == 2)
  775. goto L105;
  776. t1 = 0;
  777. for (k = 0; k < l1; k++)
  778. {
  779. t5 = (t4 = (t3 = (t2 = t1 << 2) + t6)) + t6;
  780. t7 = t1;
  781. for (i = 2; i < ido; i += 2)
  782. {
  783. t2 += 2;
  784. t3 += 2;
  785. t4 -= 2;
  786. t5 -= 2;
  787. t7 += 2;
  788. ti1 = cc[t2] + cc[t5];
  789. ti2 = cc[t2] - cc[t5];
  790. ti3 = cc[t3] - cc[t4];
  791. tr4 = cc[t3] + cc[t4];
  792. tr1 = cc[t2 - 1] - cc[t5 - 1];
  793. tr2 = cc[t2 - 1] + cc[t5 - 1];
  794. ti4 = cc[t3 - 1] - cc[t4 - 1];
  795. tr3 = cc[t3 - 1] + cc[t4 - 1];
  796. ch[t7 - 1] = tr2 + tr3;
  797. cr3 = tr2 - tr3;
  798. ch[t7] = ti2 + ti3;
  799. ci3 = ti2 - ti3;
  800. cr2 = tr1 - tr4;
  801. cr4 = tr1 + tr4;
  802. ci2 = ti1 + ti4;
  803. ci4 = ti1 - ti4;
  804. ch[(t8 = t7 + t0) - 1] = wa1[i - 2] * cr2 - wa1[i - 1] * ci2;
  805. ch[t8] = wa1[i - 2] * ci2 + wa1[i - 1] * cr2;
  806. ch[(t8 += t0) - 1] = wa2[i - 2] * cr3 - wa2[i - 1] * ci3;
  807. ch[t8] = wa2[i - 2] * ci3 + wa2[i - 1] * cr3;
  808. ch[(t8 += t0) - 1] = wa3[i - 2] * cr4 - wa3[i - 1] * ci4;
  809. ch[t8] = wa3[i - 2] * ci4 + wa3[i - 1] * cr4;
  810. }
  811. t1 += ido;
  812. }
  813. if (ido % 2 == 1)
  814. return;
  815. L105:
  816. t1 = ido;
  817. t2 = ido << 2;
  818. t3 = ido - 1;
  819. t4 = ido + (ido << 1);
  820. for (k = 0; k < l1; k++)
  821. {
  822. t5 = t3;
  823. ti1 = cc[t1] + cc[t4];
  824. ti2 = cc[t4] - cc[t1];
  825. tr1 = cc[t1 - 1] - cc[t4 - 1];
  826. tr2 = cc[t1 - 1] + cc[t4 - 1];
  827. ch[t5] = tr2 + tr2;
  828. ch[t5 += t0] = sqrt2 * (tr1 - ti1);
  829. ch[t5 += t0] = ti2 + ti2;
  830. ch[t5 += t0] = -sqrt2 * (tr1 + ti1);
  831. t3 += ido;
  832. t1 += t2;
  833. t4 += t2;
  834. }
  835. }
  836. static void dradbg (integer ido, integer ip, integer l1, integer idl1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * c1,
  837. FFT_DATA_TYPE * c2, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * ch2, FFT_DATA_TYPE * wa)
  838. {
  839. static double tpi = 6.28318530717958647692528676655900577;
  840. integer idij, ipph, i, j, k, l, ik, is, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12;
  841. double dc2, ai1, ai2, ar1, ar2, ds2;
  842. integer nbd;
  843. double dcp, arg, dsp, ar1h, ar2h;
  844. integer ipp2;
  845. t10 = ip * ido;
  846. t0 = l1 * ido;
  847. arg = tpi / (double) ip;
  848. dcp = cos (arg);
  849. dsp = sin (arg);
  850. nbd = (ido - 1) >> 1;
  851. ipp2 = ip;
  852. ipph = (ip + 1) >> 1;
  853. if (ido < l1)
  854. goto L103;
  855. t1 = 0;
  856. t2 = 0;
  857. for (k = 0; k < l1; k++)
  858. {
  859. t3 = t1;
  860. t4 = t2;
  861. for (i = 0; i < ido; i++)
  862. {
  863. ch[t3] = cc[t4];
  864. t3++;
  865. t4++;
  866. }
  867. t1 += ido;
  868. t2 += t10;
  869. }
  870. goto L106;
  871. L103:
  872. t1 = 0;
  873. for (i = 0; i < ido; i++)
  874. {
  875. t2 = t1;
  876. t3 = t1;
  877. for (k = 0; k < l1; k++)
  878. {
  879. ch[t2] = cc[t3];
  880. t2 += ido;
  881. t3 += t10;
  882. }
  883. t1++;
  884. }
  885. L106:
  886. t1 = 0;
  887. t2 = ipp2 * t0;
  888. t7 = (t5 = ido << 1);
  889. for (j = 1; j < ipph; j++)
  890. {
  891. t1 += t0;
  892. t2 -= t0;
  893. t3 = t1;
  894. t4 = t2;
  895. t6 = t5;
  896. for (k = 0; k < l1; k++)
  897. {
  898. ch[t3] = cc[t6 - 1] + cc[t6 - 1];
  899. ch[t4] = cc[t6] + cc[t6];
  900. t3 += ido;
  901. t4 += ido;
  902. t6 += t10;
  903. }
  904. t5 += t7;
  905. }
  906. if (ido == 1)
  907. goto L116;
  908. if (nbd < l1)
  909. goto L112;
  910. t1 = 0;
  911. t2 = ipp2 * t0;
  912. t7 = 0;
  913. for (j = 1; j < ipph; j++)
  914. {
  915. t1 += t0;
  916. t2 -= t0;
  917. t3 = t1;
  918. t4 = t2;
  919. t7 += (ido << 1);
  920. t8 = t7;
  921. for (k = 0; k < l1; k++)
  922. {
  923. t5 = t3;
  924. t6 = t4;
  925. t9 = t8;
  926. t11 = t8;
  927. for (i = 2; i < ido; i += 2)
  928. {
  929. t5 += 2;
  930. t6 += 2;
  931. t9 += 2;
  932. t11 -= 2;
  933. ch[t5 - 1] = cc[t9 - 1] + cc[t11 - 1];
  934. ch[t6 - 1] = cc[t9 - 1] - cc[t11 - 1];
  935. ch[t5] = cc[t9] - cc[t11];
  936. ch[t6] = cc[t9] + cc[t11];
  937. }
  938. t3 += ido;
  939. t4 += ido;
  940. t8 += t10;
  941. }
  942. }
  943. goto L116;
  944. L112:
  945. t1 = 0;
  946. t2 = ipp2 * t0;
  947. t7 = 0;
  948. for (j = 1; j < ipph; j++)
  949. {
  950. t1 += t0;
  951. t2 -= t0;
  952. t3 = t1;
  953. t4 = t2;
  954. t7 += (ido << 1);
  955. t8 = t7;
  956. t9 = t7;
  957. for (i = 2; i < ido; i += 2)
  958. {
  959. t3 += 2;
  960. t4 += 2;
  961. t8 += 2;
  962. t9 -= 2;
  963. t5 = t3;
  964. t6 = t4;
  965. t11 = t8;
  966. t12 = t9;
  967. for (k = 0; k < l1; k++)
  968. {
  969. ch[t5 - 1] = cc[t11 - 1] + cc[t12 - 1];
  970. ch[t6 - 1] = cc[t11 - 1] - cc[t12 - 1];
  971. ch[t5] = cc[t11] - cc[t12];
  972. ch[t6] = cc[t11] + cc[t12];
  973. t5 += ido;
  974. t6 += ido;
  975. t11 += t10;
  976. t12 += t10;
  977. }
  978. }
  979. }
  980. L116:
  981. ar1 = 1.;
  982. ai1 = 0.;
  983. t1 = 0;
  984. t9 = (t2 = ipp2 * idl1);
  985. t3 = (ip - 1) * idl1;
  986. for (l = 1; l < ipph; l++)
  987. {
  988. t1 += idl1;
  989. t2 -= idl1;
  990. ar1h = dcp * ar1 - dsp * ai1;
  991. ai1 = dcp * ai1 + dsp * ar1;
  992. ar1 = ar1h;
  993. t4 = t1;
  994. t5 = t2;
  995. t6 = 0;
  996. t7 = idl1;
  997. t8 = t3;
  998. for (ik = 0; ik < idl1; ik++)
  999. {
  1000. c2[t4++] = ch2[t6++] + ar1 * ch2[t7++];
  1001. c2[t5++] = ai1 * ch2[t8++];
  1002. }
  1003. dc2 = ar1;
  1004. ds2 = ai1;
  1005. ar2 = ar1;
  1006. ai2 = ai1;
  1007. t6 = idl1;
  1008. t7 = t9 - idl1;
  1009. for (j = 2; j < ipph; j++)
  1010. {
  1011. t6 += idl1;
  1012. t7 -= idl1;
  1013. ar2h = dc2 * ar2 - ds2 * ai2;
  1014. ai2 = dc2 * ai2 + ds2 * ar2;
  1015. ar2 = ar2h;
  1016. t4 = t1;
  1017. t5 = t2;
  1018. t11 = t6;
  1019. t12 = t7;
  1020. for (ik = 0; ik < idl1; ik++)
  1021. {
  1022. c2[t4++] += ar2 * ch2[t11++];
  1023. c2[t5++] += ai2 * ch2[t12++];
  1024. }
  1025. }
  1026. }
  1027. t1 = 0;
  1028. for (j = 1; j < ipph; j++)
  1029. {
  1030. t1 += idl1;
  1031. t2 = t1;
  1032. for (ik = 0; ik < idl1; ik++)
  1033. ch2[ik] += ch2[t2++];
  1034. }
  1035. t1 = 0;
  1036. t2 = ipp2 * t0;
  1037. for (j = 1; j < ipph; j++)
  1038. {
  1039. t1 += t0;
  1040. t2 -= t0;
  1041. t3 = t1;
  1042. t4 = t2;
  1043. for (k = 0; k < l1; k++)
  1044. {
  1045. ch[t3] = c1[t3] - c1[t4];
  1046. ch[t4] = c1[t3] + c1[t4];
  1047. t3 += ido;
  1048. t4 += ido;
  1049. }
  1050. }
  1051. if (ido == 1)
  1052. goto L132;
  1053. if (nbd < l1)
  1054. goto L128;
  1055. t1 = 0;
  1056. t2 = ipp2 * t0;
  1057. for (j = 1; j < ipph; j++)
  1058. {
  1059. t1 += t0;
  1060. t2 -= t0;
  1061. t3 = t1;
  1062. t4 = t2;
  1063. for (k = 0; k < l1; k++)
  1064. {
  1065. t5 = t3;
  1066. t6 = t4;
  1067. for (i = 2; i < ido; i += 2)
  1068. {
  1069. t5 += 2;
  1070. t6 += 2;
  1071. ch[t5 - 1] = c1[t5 - 1] - c1[t6];
  1072. ch[t6 - 1] = c1[t5 - 1] + c1[t6];
  1073. ch[t5] = c1[t5] + c1[t6 - 1];
  1074. ch[t6] = c1[t5] - c1[t6 - 1];
  1075. }
  1076. t3 += ido;
  1077. t4 += ido;
  1078. }
  1079. }
  1080. goto L132;
  1081. L128:
  1082. t1 = 0;
  1083. t2 = ipp2 * t0;
  1084. for (j = 1; j < ipph; j++)
  1085. {
  1086. t1 += t0;
  1087. t2 -= t0;
  1088. t3 = t1;
  1089. t4 = t2;
  1090. for (i = 2; i < ido; i += 2)
  1091. {
  1092. t3 += 2;
  1093. t4 += 2;
  1094. t5 = t3;
  1095. t6 = t4;
  1096. for (k = 0; k < l1; k++)
  1097. {
  1098. ch[t5 - 1] = c1[t5 - 1] - c1[t6];
  1099. ch[t6 - 1] = c1[t5 - 1] + c1[t6];
  1100. ch[t5] = c1[t5] + c1[t6 - 1];
  1101. ch[t6] = c1[t5] - c1[t6 - 1];
  1102. t5 += ido;
  1103. t6 += ido;
  1104. }
  1105. }
  1106. }
  1107. L132:
  1108. if (ido == 1)
  1109. return;
  1110. for (ik = 0; ik < idl1; ik++)
  1111. c2[ik] = ch2[ik];
  1112. t1 = 0;
  1113. for (j = 1; j < ip; j++)
  1114. {
  1115. t2 = (t1 += t0);
  1116. for (k = 0; k < l1; k++)
  1117. {
  1118. c1[t2] = ch[t2];
  1119. t2 += ido;
  1120. }
  1121. }
  1122. if (nbd > l1)
  1123. goto L139;
  1124. is = -ido - 1;
  1125. t1 = 0;
  1126. for (j = 1; j < ip; j++)
  1127. {
  1128. is += ido;
  1129. t1 += t0;
  1130. idij = is;
  1131. t2 = t1;
  1132. for (i = 2; i < ido; i += 2)
  1133. {
  1134. t2 += 2;
  1135. idij += 2;
  1136. t3 = t2;
  1137. for (k = 0; k < l1; k++)
  1138. {
  1139. c1[t3 - 1] = wa[idij - 1] * ch[t3 - 1] - wa[idij] * ch[t3];
  1140. c1[t3] = wa[idij - 1] * ch[t3] + wa[idij] * ch[t3 - 1];
  1141. t3 += ido;
  1142. }
  1143. }
  1144. }
  1145. return;
  1146. L139:
  1147. is = -ido - 1;
  1148. t1 = 0;
  1149. for (j = 1; j < ip; j++)
  1150. {
  1151. is += ido;
  1152. t1 += t0;
  1153. t2 = t1;
  1154. for (k = 0; k < l1; k++)
  1155. {
  1156. idij = is;
  1157. t3 = t2;
  1158. for (i = 2; i < ido; i += 2)
  1159. {
  1160. idij += 2;
  1161. t3 += 2;
  1162. c1[t3 - 1] = wa[idij - 1] * ch[t3 - 1] - wa[idij] * ch[t3];
  1163. c1[t3] = wa[idij - 1] * ch[t3] + wa[idij] * ch[t3 - 1];
  1164. }
  1165. t2 += ido;
  1166. }
  1167. }
  1168. }
  1169. static void drftb1 (integer n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa, integer *ifac)
  1170. {
  1171. integer i, k1, l1, l2;
  1172. integer na;
  1173. integer nf, ip, iw, ix2, ix3, ido, idl1;
  1174. nf = ifac[1];
  1175. na = 0;
  1176. l1 = 1;
  1177. iw = 1;
  1178. for (k1 = 0; k1 < nf; k1++)
  1179. {
  1180. ip = ifac[k1 + 2];
  1181. l2 = ip * l1;
  1182. ido = n / l2;
  1183. idl1 = ido * l1;
  1184. if (ip != 4)
  1185. goto L103;
  1186. ix2 = iw + ido;
  1187. ix3 = ix2 + ido;
  1188. if (na != 0)
  1189. dradb4 (ido, l1, ch, c, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
  1190. else
  1191. dradb4 (ido, l1, c, ch, wa + iw - 1, wa + ix2 - 1, wa + ix3 - 1);
  1192. na = 1 - na;
  1193. goto L115;
  1194. L103:
  1195. if (ip != 2)
  1196. goto L106;
  1197. if (na != 0)
  1198. dradb2 (ido, l1, ch, c, wa + iw - 1);
  1199. else
  1200. dradb2 (ido, l1, c, ch, wa + iw - 1);
  1201. na = 1 - na;
  1202. goto L115;
  1203. L106:
  1204. if (ip != 3)
  1205. goto L109;
  1206. ix2 = iw + ido;
  1207. if (na != 0)
  1208. dradb3 (ido, l1, ch, c, wa + iw - 1, wa + ix2 - 1);
  1209. else
  1210. dradb3 (ido, l1, c, ch, wa + iw - 1, wa + ix2 - 1);
  1211. na = 1 - na;
  1212. goto L115;
  1213. L109:
  1214. /* The radix five case can be translated later..... */
  1215. /* if(ip!=5)goto L112;
  1216. ix2=iw+ido; ix3=ix2+ido; ix4=ix3+ido; if(na!=0)
  1217. dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); else
  1218. dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); na=1-na;
  1219. goto L115;
  1220. L112: */
  1221. if (na != 0)
  1222. dradbg (ido, ip, l1, idl1, ch, ch, ch, c, c, wa + iw - 1);
  1223. else
  1224. dradbg (ido, ip, l1, idl1, c, c, c, ch, ch, wa + iw - 1);
  1225. if (ido == 1)
  1226. na = 1 - na;
  1227. L115:
  1228. l1 = l2;
  1229. iw += (ip - 1) * ido;
  1230. }
  1231. if (na == 0)
  1232. return;
  1233. for (i = 0; i < n; i++)
  1234. c[i] = ch[i];
  1235. }
  1236. /* End of file NUMfft_core.h */