Changeset 5c6b264
- Timestamp:
- Dec 23, 2013, 2:29:12 AM (11 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 4087d54, 634c12f
- Parents:
- 3a00b1e7
- Location:
- src/spectral
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/fft.c
r3a00b1e7 r5c6b264 85 85 #else // using OOURA 86 86 // let's use ooura instead 87 extern void rdft(int, int, double *, int *, double*);87 extern void rdft(int, int, smpl_t *, int *, smpl_t *); 88 88 89 89 #endif /* HAVE_ACCELERATE */ … … 110 110 #endif 111 111 #else // using OOURA 112 double*in, *out;113 double*w;112 smpl_t *in, *out; 113 smpl_t *w; 114 114 int *ip; 115 115 #endif /* HAVE_ACCELERATE */ … … 171 171 s->fft_size = winsize / 2 + 1; 172 172 s->compspec = new_fvec(winsize); 173 s->in = AUBIO_ARRAY( double, s->winsize);174 s->out = AUBIO_ARRAY( double, s->winsize);173 s->in = AUBIO_ARRAY(smpl_t, s->winsize); 174 s->out = AUBIO_ARRAY(smpl_t, s->winsize); 175 175 s->ip = AUBIO_ARRAY(int , s->fft_size); 176 s->w = AUBIO_ARRAY( double, s->fft_size);176 s->w = AUBIO_ARRAY(smpl_t, s->fft_size); 177 177 s->ip[0] = 0; 178 178 #endif /* HAVE_ACCELERATE */ -
src/spectral/ooura_fft8g.c
r3a00b1e7 r5c6b264 1 // 2 modifications made for aubio: 2 // - replace all 'double' with 'smpl_t' 3 // - include "aubio_priv.h" (for config.h and types.h) 4 5 #include "aubio_priv.h" 6 1 7 /* 2 8 Fast Fourier/Cosine/Sine Transform … … 15 21 dfst: Sine Transform of RDFT (Real Anti-symmetric DFT) 16 22 function prototypes 17 void cdft(int, int, double *, int *, double*);18 void rdft(int, int, double *, int *, double*);19 void ddct(int, int, double *, int *, double*);20 void ddst(int, int, double *, int *, double*);21 void dfct(int, double *, double *, int *, double*);22 void dfst(int, double *, double *, int *, double*);23 void cdft(int, int, smpl_t *, int *, smpl_t *); 24 void rdft(int, int, smpl_t *, int *, smpl_t *); 25 void ddct(int, int, smpl_t *, int *, smpl_t *); 26 void ddst(int, int, smpl_t *, int *, smpl_t *); 27 void dfct(int, smpl_t *, smpl_t *, int *, smpl_t *); 28 void dfst(int, smpl_t *, smpl_t *, int *, smpl_t *); 23 29 24 30 … … 40 46 2*n :data length (int) 41 47 n >= 1, n = power of 2 42 a[0...2*n-1] :input/output data ( double*)48 a[0...2*n-1] :input/output data (smpl_t *) 43 49 input data 44 50 a[2*j] = Re(x[j]), … … 53 59 2+(1<<(int)(log(n+0.5)/log(2))/2). 54 60 ip[0],ip[1] are pointers of the cos/sin table. 55 w[0...n/2-1] :cos/sin table ( double*)61 w[0...n/2-1] :cos/sin table (smpl_t *) 56 62 w[],ip[] are initialized if ip[0] == 0. 57 63 [remark] … … 85 91 n :data length (int) 86 92 n >= 2, n = power of 2 87 a[0...n-1] :input/output data ( double*)93 a[0...n-1] :input/output data (smpl_t *) 88 94 <case1> 89 95 output data … … 102 108 2+(1<<(int)(log(n/2+0.5)/log(2))/2). 103 109 ip[0],ip[1] are pointers of the cos/sin table. 104 w[0...n/2-1] :cos/sin table ( double*)110 w[0...n/2-1] :cos/sin table (smpl_t *) 105 111 w[],ip[] are initialized if ip[0] == 0. 106 112 [remark] … … 131 137 n :data length (int) 132 138 n >= 2, n = power of 2 133 a[0...n-1] :input/output data ( double*)139 a[0...n-1] :input/output data (smpl_t *) 134 140 output data 135 141 a[k] = C[k], 0<=k<n … … 140 146 2+(1<<(int)(log(n/2+0.5)/log(2))/2). 141 147 ip[0],ip[1] are pointers of the cos/sin table. 142 w[0...n*5/4-1] :cos/sin table ( double*)148 w[0...n*5/4-1] :cos/sin table (smpl_t *) 143 149 w[],ip[] are initialized if ip[0] == 0. 144 150 [remark] … … 170 176 n :data length (int) 171 177 n >= 2, n = power of 2 172 a[0...n-1] :input/output data ( double*)178 a[0...n-1] :input/output data (smpl_t *) 173 179 <case1> 174 180 input data … … 187 193 2+(1<<(int)(log(n/2+0.5)/log(2))/2). 188 194 ip[0],ip[1] are pointers of the cos/sin table. 189 w[0...n*5/4-1] :cos/sin table ( double*)195 w[0...n*5/4-1] :cos/sin table (smpl_t *) 190 196 w[],ip[] are initialized if ip[0] == 0. 191 197 [remark] … … 210 216 n :data length - 1 (int) 211 217 n >= 2, n = power of 2 212 a[0...n] :input/output data ( double*)218 a[0...n] :input/output data (smpl_t *) 213 219 output data 214 220 a[k] = C[k], 0<=k<=n 215 t[0...n/2] :work area ( double*)221 t[0...n/2] :work area (smpl_t *) 216 222 ip[0...*] :work area for bit reversal (int *) 217 223 length of ip >= 2+sqrt(n/4) … … 220 226 2+(1<<(int)(log(n/4+0.5)/log(2))/2). 221 227 ip[0],ip[1] are pointers of the cos/sin table. 222 w[0...n*5/8-1] :cos/sin table ( double*)228 w[0...n*5/8-1] :cos/sin table (smpl_t *) 223 229 w[],ip[] are initialized if ip[0] == 0. 224 230 [remark] … … 246 252 n :data length + 1 (int) 247 253 n >= 2, n = power of 2 248 a[0...n-1] :input/output data ( double*)254 a[0...n-1] :input/output data (smpl_t *) 249 255 output data 250 256 a[k] = S[k], 0<k<n 251 257 (a[0] is used for work area) 252 t[0...n/2-1] :work area ( double*)258 t[0...n/2-1] :work area (smpl_t *) 253 259 ip[0...*] :work area for bit reversal (int *) 254 260 length of ip >= 2+sqrt(n/4) … … 257 263 2+(1<<(int)(log(n/4+0.5)/log(2))/2). 258 264 ip[0],ip[1] are pointers of the cos/sin table. 259 w[0...n*5/8-1] :cos/sin table ( double*)265 w[0...n*5/8-1] :cos/sin table (smpl_t *) 260 266 w[],ip[] are initialized if ip[0] == 0. 261 267 [remark] … … 276 282 277 283 278 void cdft(int n, int isgn, double *a, int *ip, double*w)279 { 280 void makewt(int nw, int *ip, double*w);281 void bitrv2(int n, int *ip, double*a);282 void bitrv2conj(int n, int *ip, double*a);283 void cftfsub(int n, double *a, double*w);284 void cftbsub(int n, double *a, double*w);284 void cdft(int n, int isgn, smpl_t *a, int *ip, smpl_t *w) 285 { 286 void makewt(int nw, int *ip, smpl_t *w); 287 void bitrv2(int n, int *ip, smpl_t *a); 288 void bitrv2conj(int n, int *ip, smpl_t *a); 289 void cftfsub(int n, smpl_t *a, smpl_t *w); 290 void cftbsub(int n, smpl_t *a, smpl_t *w); 285 291 286 292 if (n > (ip[0] << 2)) { … … 301 307 302 308 303 void rdft(int n, int isgn, double *a, int *ip, double*w)304 { 305 void makewt(int nw, int *ip, double*w);306 void makect(int nc, int *ip, double*c);307 void bitrv2(int n, int *ip, double*a);308 void cftfsub(int n, double *a, double*w);309 void cftbsub(int n, double *a, double*w);310 void rftfsub(int n, double *a, int nc, double*c);311 void rftbsub(int n, double *a, int nc, double*c);309 void rdft(int n, int isgn, smpl_t *a, int *ip, smpl_t *w) 310 { 311 void makewt(int nw, int *ip, smpl_t *w); 312 void makect(int nc, int *ip, smpl_t *c); 313 void bitrv2(int n, int *ip, smpl_t *a); 314 void cftfsub(int n, smpl_t *a, smpl_t *w); 315 void cftbsub(int n, smpl_t *a, smpl_t *w); 316 void rftfsub(int n, smpl_t *a, int nc, smpl_t *c); 317 void rftbsub(int n, smpl_t *a, int nc, smpl_t *c); 312 318 int nw, nc; 313 doublexi;319 smpl_t xi; 314 320 315 321 nw = ip[0]; … … 348 354 349 355 350 void ddct(int n, int isgn, double *a, int *ip, double*w)351 { 352 void makewt(int nw, int *ip, double*w);353 void makect(int nc, int *ip, double*c);354 void bitrv2(int n, int *ip, double*a);355 void cftfsub(int n, double *a, double*w);356 void cftbsub(int n, double *a, double*w);357 void rftfsub(int n, double *a, int nc, double*c);358 void rftbsub(int n, double *a, int nc, double*c);359 void dctsub(int n, double *a, int nc, double*c);356 void ddct(int n, int isgn, smpl_t *a, int *ip, smpl_t *w) 357 { 358 void makewt(int nw, int *ip, smpl_t *w); 359 void makect(int nc, int *ip, smpl_t *c); 360 void bitrv2(int n, int *ip, smpl_t *a); 361 void cftfsub(int n, smpl_t *a, smpl_t *w); 362 void cftbsub(int n, smpl_t *a, smpl_t *w); 363 void rftfsub(int n, smpl_t *a, int nc, smpl_t *c); 364 void rftbsub(int n, smpl_t *a, int nc, smpl_t *c); 365 void dctsub(int n, smpl_t *a, int nc, smpl_t *c); 360 366 int j, nw, nc; 361 doublexr;367 smpl_t xr; 362 368 363 369 nw = ip[0]; … … 407 413 408 414 409 void ddst(int n, int isgn, double *a, int *ip, double*w)410 { 411 void makewt(int nw, int *ip, double*w);412 void makect(int nc, int *ip, double*c);413 void bitrv2(int n, int *ip, double*a);414 void cftfsub(int n, double *a, double*w);415 void cftbsub(int n, double *a, double*w);416 void rftfsub(int n, double *a, int nc, double*c);417 void rftbsub(int n, double *a, int nc, double*c);418 void dstsub(int n, double *a, int nc, double*c);415 void ddst(int n, int isgn, smpl_t *a, int *ip, smpl_t *w) 416 { 417 void makewt(int nw, int *ip, smpl_t *w); 418 void makect(int nc, int *ip, smpl_t *c); 419 void bitrv2(int n, int *ip, smpl_t *a); 420 void cftfsub(int n, smpl_t *a, smpl_t *w); 421 void cftbsub(int n, smpl_t *a, smpl_t *w); 422 void rftfsub(int n, smpl_t *a, int nc, smpl_t *c); 423 void rftbsub(int n, smpl_t *a, int nc, smpl_t *c); 424 void dstsub(int n, smpl_t *a, int nc, smpl_t *c); 419 425 int j, nw, nc; 420 doublexr;426 smpl_t xr; 421 427 422 428 nw = ip[0]; … … 466 472 467 473 468 void dfct(int n, double *a, double *t, int *ip, double*w)469 { 470 void makewt(int nw, int *ip, double*w);471 void makect(int nc, int *ip, double*c);472 void bitrv2(int n, int *ip, double*a);473 void cftfsub(int n, double *a, double*w);474 void rftfsub(int n, double *a, int nc, double*c);475 void dctsub(int n, double *a, int nc, double*c);474 void dfct(int n, smpl_t *a, smpl_t *t, int *ip, smpl_t *w) 475 { 476 void makewt(int nw, int *ip, smpl_t *w); 477 void makect(int nc, int *ip, smpl_t *c); 478 void bitrv2(int n, int *ip, smpl_t *a); 479 void cftfsub(int n, smpl_t *a, smpl_t *w); 480 void rftfsub(int n, smpl_t *a, int nc, smpl_t *c); 481 void dctsub(int n, smpl_t *a, int nc, smpl_t *c); 476 482 int j, k, l, m, mh, nw, nc; 477 doublexr, xi, yr, yi;483 smpl_t xr, xi, yr, yi; 478 484 479 485 nw = ip[0]; … … 562 568 563 569 564 void dfst(int n, double *a, double *t, int *ip, double*w)565 { 566 void makewt(int nw, int *ip, double*w);567 void makect(int nc, int *ip, double*c);568 void bitrv2(int n, int *ip, double*a);569 void cftfsub(int n, double *a, double*w);570 void rftfsub(int n, double *a, int nc, double*c);571 void dstsub(int n, double *a, int nc, double*c);570 void dfst(int n, smpl_t *a, smpl_t *t, int *ip, smpl_t *w) 571 { 572 void makewt(int nw, int *ip, smpl_t *w); 573 void makect(int nc, int *ip, smpl_t *c); 574 void bitrv2(int n, int *ip, smpl_t *a); 575 void cftfsub(int n, smpl_t *a, smpl_t *w); 576 void rftfsub(int n, smpl_t *a, int nc, smpl_t *c); 577 void dstsub(int n, smpl_t *a, int nc, smpl_t *c); 572 578 int j, k, l, m, mh, nw, nc; 573 doublexr, xi, yr, yi;579 smpl_t xr, xi, yr, yi; 574 580 575 581 nw = ip[0]; … … 654 660 #include <math.h> 655 661 656 void makewt(int nw, int *ip, double*w)657 { 658 void bitrv2(int n, int *ip, double*a);662 void makewt(int nw, int *ip, smpl_t *w) 663 { 664 void bitrv2(int n, int *ip, smpl_t *a); 659 665 int j, nwh; 660 doubledelta, x, y;666 smpl_t delta, x, y; 661 667 662 668 ip[0] = nw; … … 690 696 691 697 692 void makect(int nc, int *ip, double*c)698 void makect(int nc, int *ip, smpl_t *c) 693 699 { 694 700 int j, nch; 695 doubledelta;701 smpl_t delta; 696 702 697 703 ip[1] = nc; … … 712 718 713 719 714 void bitrv2(int n, int *ip, double*a)720 void bitrv2(int n, int *ip, smpl_t *a) 715 721 { 716 722 int j, j1, k, k1, l, m, m2; 717 doublexr, xi, yr, yi;723 smpl_t xr, xi, yr, yi; 718 724 719 725 ip[0] = 0; … … 812 818 813 819 814 void bitrv2conj(int n, int *ip, double*a)820 void bitrv2conj(int n, int *ip, smpl_t *a) 815 821 { 816 822 int j, j1, k, k1, l, m, m2; 817 doublexr, xi, yr, yi;823 smpl_t xr, xi, yr, yi; 818 824 819 825 ip[0] = 0; … … 921 927 922 928 923 void cftfsub(int n, double *a, double*w)924 { 925 void cft1st(int n, double *a, double*w);926 void cftmdl(int n, int l, double *a, double*w);929 void cftfsub(int n, smpl_t *a, smpl_t *w) 930 { 931 void cft1st(int n, smpl_t *a, smpl_t *w); 932 void cftmdl(int n, int l, smpl_t *a, smpl_t *w); 927 933 int j, j1, j2, j3, l; 928 doublex0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;934 smpl_t x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; 929 935 930 936 l = 2; … … 973 979 974 980 975 void cftbsub(int n, double *a, double*w)976 { 977 void cft1st(int n, double *a, double*w);978 void cftmdl(int n, int l, double *a, double*w);981 void cftbsub(int n, smpl_t *a, smpl_t *w) 982 { 983 void cft1st(int n, smpl_t *a, smpl_t *w); 984 void cftmdl(int n, int l, smpl_t *a, smpl_t *w); 979 985 int j, j1, j2, j3, j4, j5, j6, j7, l; 980 doublewn4r, x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i,986 smpl_t wn4r, x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, 981 987 y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, 982 988 y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; … … 1090 1096 1091 1097 1092 void cft1st(int n, double *a, double*w)1098 void cft1st(int n, smpl_t *a, smpl_t *w) 1093 1099 { 1094 1100 int j, k1; 1095 doublewn4r, wtmp, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i,1101 smpl_t wn4r, wtmp, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, 1096 1102 wk4r, wk4i, wk5r, wk5i, wk6r, wk6i, wk7r, wk7i; 1097 doublex0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i,1103 smpl_t x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, 1098 1104 y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, 1099 1105 y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; … … 1305 1311 1306 1312 1307 void cftmdl(int n, int l, double *a, double*w)1313 void cftmdl(int n, int l, smpl_t *a, smpl_t *w) 1308 1314 { 1309 1315 int j, j1, j2, j3, j4, j5, j6, j7, k, k1, m; 1310 doublewn4r, wtmp, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i,1316 smpl_t wn4r, wtmp, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, 1311 1317 wk4r, wk4i, wk5r, wk5i, wk6r, wk6i, wk7r, wk7i; 1312 doublex0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i,1318 smpl_t x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, 1313 1319 y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, 1314 1320 y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; … … 1548 1554 1549 1555 1550 void rftfsub(int n, double *a, int nc, double*c)1556 void rftfsub(int n, smpl_t *a, int nc, smpl_t *c) 1551 1557 { 1552 1558 int j, k, kk, ks, m; 1553 doublewkr, wki, xr, xi, yr, yi;1559 smpl_t wkr, wki, xr, xi, yr, yi; 1554 1560 1555 1561 m = n >> 1; … … 1573 1579 1574 1580 1575 void rftbsub(int n, double *a, int nc, double*c)1581 void rftbsub(int n, smpl_t *a, int nc, smpl_t *c) 1576 1582 { 1577 1583 int j, k, kk, ks, m; 1578 doublewkr, wki, xr, xi, yr, yi;1584 smpl_t wkr, wki, xr, xi, yr, yi; 1579 1585 1580 1586 a[1] = -a[1]; … … 1600 1606 1601 1607 1602 void dctsub(int n, double *a, int nc, double*c)1608 void dctsub(int n, smpl_t *a, int nc, smpl_t *c) 1603 1609 { 1604 1610 int j, k, kk, ks, m; 1605 doublewkr, wki, xr;1611 smpl_t wkr, wki, xr; 1606 1612 1607 1613 m = n >> 1; … … 1621 1627 1622 1628 1623 void dstsub(int n, double *a, int nc, double*c)1629 void dstsub(int n, smpl_t *a, int nc, smpl_t *c) 1624 1630 { 1625 1631 int j, k, kk, ks, m; 1626 doublewkr, wki, xr;1632 smpl_t wkr, wki, xr; 1627 1633 1628 1634 m = n >> 1;
Note: See TracChangeset
for help on using the changeset viewer.