| OLD | NEW |
| 1 /* | 1 /* |
| 2 * http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html | 2 * http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html |
| 3 * Copyright Takuya OOURA, 1996-2001 | 3 * Copyright Takuya OOURA, 1996-2001 |
| 4 * | 4 * |
| 5 * You may use, copy, modify and distribute this code for any purpose (include | 5 * You may use, copy, modify and distribute this code for any purpose (include |
| 6 * commercial use) and without fee. Please refer to this package when you modify | 6 * commercial use) and without fee. Please refer to this package when you modify |
| 7 * this code. | 7 * this code. |
| 8 * | 8 * |
| 9 * Changes: | 9 * Changes: |
| 10 * Trivial type modifications by the WebRTC authors. | 10 * Trivial type modifications by the WebRTC authors. |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 641 |
| 642 static void makewt(int nw, int *ip, float *w) | 642 static void makewt(int nw, int *ip, float *w) |
| 643 { | 643 { |
| 644 int j, nwh; | 644 int j, nwh; |
| 645 float delta, x, y; | 645 float delta, x, y; |
| 646 | 646 |
| 647 ip[0] = nw; | 647 ip[0] = nw; |
| 648 ip[1] = 1; | 648 ip[1] = 1; |
| 649 if (nw > 2) { | 649 if (nw > 2) { |
| 650 nwh = nw >> 1; | 650 nwh = nw >> 1; |
| 651 delta = (float)atan(1.0f) / nwh; | 651 delta = atanf(1.0f) / nwh; |
| 652 w[0] = 1; | 652 w[0] = 1; |
| 653 w[1] = 0; | 653 w[1] = 0; |
| 654 w[nwh] = (float)cos(delta * nwh); | 654 w[nwh] = (float)cos(delta * nwh); |
| 655 w[nwh + 1] = w[nwh]; | 655 w[nwh + 1] = w[nwh]; |
| 656 if (nwh > 2) { | 656 if (nwh > 2) { |
| 657 for (j = 2; j < nwh; j += 2) { | 657 for (j = 2; j < nwh; j += 2) { |
| 658 x = (float)cos(delta * j); | 658 x = (float)cos(delta * j); |
| 659 y = (float)sin(delta * j); | 659 y = (float)sin(delta * j); |
| 660 w[j] = x; | 660 w[j] = x; |
| 661 w[j + 1] = y; | 661 w[j + 1] = y; |
| 662 w[nw - j] = y; | 662 w[nw - j] = y; |
| 663 w[nw - j + 1] = x; | 663 w[nw - j + 1] = x; |
| 664 } | 664 } |
| 665 bitrv2(nw, ip + 2, w); | 665 bitrv2(nw, ip + 2, w); |
| 666 } | 666 } |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 | 669 |
| 670 | 670 |
| 671 static void makect(int nc, int *ip, float *c) | 671 static void makect(int nc, int *ip, float *c) |
| 672 { | 672 { |
| 673 int j, nch; | 673 int j, nch; |
| 674 float delta; | 674 float delta; |
| 675 | 675 |
| 676 ip[1] = nc; | 676 ip[1] = nc; |
| 677 if (nc > 1) { | 677 if (nc > 1) { |
| 678 nch = nc >> 1; | 678 nch = nc >> 1; |
| 679 delta = (float)atan(1.0f) / nch; | 679 delta = atanf(1.0f) / nch; |
| 680 c[0] = (float)cos(delta * nch); | 680 c[0] = (float)cos(delta * nch); |
| 681 c[nch] = 0.5f * c[0]; | 681 c[nch] = 0.5f * c[0]; |
| 682 for (j = 1; j < nch; j++) { | 682 for (j = 1; j < nch; j++) { |
| 683 c[j] = 0.5f * (float)cos(delta * j); | 683 c[j] = 0.5f * (float)cos(delta * j); |
| 684 c[nc - j] = 0.5f * (float)sin(delta * j); | 684 c[nc - j] = 0.5f * (float)sin(delta * j); |
| 685 } | 685 } |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 | 688 |
| 689 | 689 |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 kk += ks; | 1317 kk += ks; |
| 1318 wkr = c[kk] - c[nc - kk]; | 1318 wkr = c[kk] - c[nc - kk]; |
| 1319 wki = c[kk] + c[nc - kk]; | 1319 wki = c[kk] + c[nc - kk]; |
| 1320 xr = wki * a[k] - wkr * a[j]; | 1320 xr = wki * a[k] - wkr * a[j]; |
| 1321 a[k] = wkr * a[k] + wki * a[j]; | 1321 a[k] = wkr * a[k] + wki * a[j]; |
| 1322 a[j] = xr; | 1322 a[j] = xr; |
| 1323 } | 1323 } |
| 1324 a[m] *= c[0]; | 1324 a[m] *= c[0]; |
| 1325 } | 1325 } |
| 1326 #endif // Not used. | 1326 #endif // Not used. |
| OLD | NEW |