Changeset 60 for mppenc/branches/r2d/libmpcpsy/fft4g.c
- Timestamp:
- 09/28/06 18:15:21 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mppenc/branches/r2d/libmpcpsy/fft4g.c
r59 r60 18 18 */ 19 19 20 #include " mppenc.h"20 #include "libmpcpsy.h" 21 21 22 22 /* F U N C T I O N S */ … … 57 57 float xi; 58 58 59 ENTER(30);60 59 if ( n > 4) { 61 60 bitrv2 ( n, ip + 2, a ); … … 69 68 a[0] += a[1]; 70 69 a[1] = xi; 71 LEAVE(30);72 70 return; 73 71 } … … 84 82 double delta; 85 83 86 ENTER(31);87 84 ip[0] = nw; 88 85 ip[1] = 1; … … 106 103 } 107 104 } 108 LEAVE(31);109 105 return; 110 106 } … … 118 114 double delta; 119 115 120 ENTER(32);121 116 ip[1] = nc; 122 117 if ( nc > 1 ) { … … 130 125 } 131 126 } 132 LEAVE(32);133 127 return; 134 128 } … … 142 136 float xr, xi, yr, yi; 143 137 144 ENTER(33);145 138 ip[0] = 0; 146 139 l = n; … … 235 228 } 236 229 } 237 LEAVE(33);238 230 return; 239 231 } … … 246 238 float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; 247 239 248 ENTER(34);249 240 l = 2; 250 241 if ( n > 8 ) { … … 291 282 } while ( j += 2, j < l ); 292 283 } 293 LEAVE(34);294 284 return; 295 285 } … … 303 293 float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; 304 294 305 ENTER(35);306 295 x0r = a[ 0] + a[ 2]; 307 296 x0i = a[ 1] + a[ 3]; … … 401 390 a[j + 15] = wk3r * x0i + wk3i * x0r; 402 391 } while ( j += 16, j < n ); 403 LEAVE(35); 404 return; 405 } 406 407 extern void Cdecl cftmdl_3DNow_1 ( const int n, const int l, float* a, float* w ); 408 extern void Cdecl cftmdl_3DNow_2 ( const int n, const int l, float* a, float* w ); 392 return; 393 } 394 395 // extern void Cdecl cftmdl_3DNow_1 ( const int n, const int l, float* a, float* w ); 396 // extern void Cdecl cftmdl_3DNow_2 ( const int n, const int l, float* a, float* w ); 409 397 410 398 … … 416 404 float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; 417 405 418 ENTER(36);419 406 m = l << 2; 420 407 … … 467 454 a[j3 + 1] = wk1r * (x0i + x0r); 468 455 } 469 LEAVE(36); 470 471 ENTER(39); 456 472 457 k1 = 0; 473 458 m2 = 2 * m; … … 542 527 } while ( j += 2, j < l+k+m ); 543 528 } 544 LEAVE(39); 545 return; 546 } 547 548 549 static void 550 cftmdl_3DNow ( const int n, const int l, float* a, float* w ) 551 { 552 int j, j1, j2, j3, k, k1, m, m2; 553 float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i; 554 float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; 555 556 ENTER(36); 557 cftmdl_3DNow_1 (n,l,a,w); 558 LEAVE(36); 559 560 ENTER(39); 561 m = l << 2; 562 k1 = 0; 563 m2 = 2 * m; 564 for ( k = m2; k < n; k += m2 ) { 565 k1 += 2; 566 wk2r = w[k1]; 567 wk2i = w[k1 + 1]; 568 wk1r = w[2*k1]; 569 wk1i = w[2*k1 + 1]; 570 wk3r = wk1r - 2 * wk2i * wk1i; 571 wk3i = 2 * wk2i * wk1r - wk1i; 572 j = k; 573 do { 574 j1 = j + l; 575 j2 = j1 + l; 576 j3 = j2 + l; 577 x0r = a[j] + a[j1]; 578 x0i = a[j + 1] + a[j1 + 1]; 579 x1r = a[j] - a[j1]; 580 x1i = a[j + 1] - a[j1 + 1]; 581 x2r = a[j2] + a[j3]; 582 x2i = a[j2 + 1] + a[j3 + 1]; 583 x3r = a[j2] - a[j3]; 584 x3i = a[j2 + 1] - a[j3 + 1]; 585 a[j] = x0r + x2r; 586 a[j + 1] = x0i + x2i; 587 x0r -= x2r; 588 x0i -= x2i; 589 a[j2] = wk2r * x0r - wk2i * x0i; 590 a[j2 + 1] = wk2r * x0i + wk2i * x0r; 591 x0r = x1r - x3i; 592 x0i = x1i + x3r; 593 a[j1] = wk1r * x0r - wk1i * x0i; 594 a[j1 + 1] = wk1r * x0i + wk1i * x0r; 595 x0r = x1r + x3i; 596 x0i = x1i - x3r; 597 a[j3] = wk3r * x0r - wk3i * x0i; 598 a[j3 + 1] = wk3r * x0i + wk3i * x0r; 599 } while ( j += 2, j < l + k ); 600 601 wk1r = w[2*k1 + 2]; 602 wk1i = w[2*k1 + 3]; 603 wk3r = wk1r - 2 * wk2r * wk1i; 604 wk3i = 2 * wk2r * wk1r - wk1i; 605 j = k + m; 606 do { 607 j1 = j + l; 608 j2 = j1 + l; 609 j3 = j2 + l; 610 x0r = a[j] + a[j1]; 611 x0i = a[j + 1] + a[j1 + 1]; 612 x1r = a[j] - a[j1]; 613 x1i = a[j + 1] - a[j1 + 1]; 614 x2r = a[j2] + a[j3]; 615 x2i = a[j2 + 1] + a[j3 + 1]; 616 x3r = a[j2] - a[j3]; 617 x3i = a[j2 + 1] - a[j3 + 1]; 618 a[j] = x0r + x2r; 619 a[j + 1] = x0i + x2i; 620 x0r -= x2r; 621 x0i -= x2i; 622 a[j2] = -wk2i * x0r - wk2r * x0i; 623 a[j2 + 1] = -wk2i * x0i + wk2r * x0r; 624 x0r = x1r - x3i; 625 x0i = x1i + x3r; 626 a[j1] = wk1r * x0r - wk1i * x0i; 627 a[j1 + 1] = wk1r * x0i + wk1i * x0r; 628 x0r = x1r + x3i; 629 x0i = x1i - x3r; 630 a[j3] = wk3r * x0r - wk3i * x0i; 631 a[j3 + 1] = wk3r * x0i + wk3i * x0r; 632 } while ( j += 2, j < l+k+m ); 633 } 634 LEAVE(39); 635 return; 636 } 529 return; 530 } 531 532 533 // static void 534 // cftmdl_3DNow ( const int n, const int l, float* a, float* w ) 535 // { 536 // int j, j1, j2, j3, k, k1, m, m2; 537 // float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i; 538 // float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; 539 // 540 // cftmdl_3DNow_1 (n,l,a,w); 541 // 542 // m = l << 2; 543 // k1 = 0; 544 // m2 = 2 * m; 545 // for ( k = m2; k < n; k += m2 ) { 546 // k1 += 2; 547 // wk2r = w[k1]; 548 // wk2i = w[k1 + 1]; 549 // wk1r = w[2*k1]; 550 // wk1i = w[2*k1 + 1]; 551 // wk3r = wk1r - 2 * wk2i * wk1i; 552 // wk3i = 2 * wk2i * wk1r - wk1i; 553 // j = k; 554 // do { 555 // j1 = j + l; 556 // j2 = j1 + l; 557 // j3 = j2 + l; 558 // x0r = a[j] + a[j1]; 559 // x0i = a[j + 1] + a[j1 + 1]; 560 // x1r = a[j] - a[j1]; 561 // x1i = a[j + 1] - a[j1 + 1]; 562 // x2r = a[j2] + a[j3]; 563 // x2i = a[j2 + 1] + a[j3 + 1]; 564 // x3r = a[j2] - a[j3]; 565 // x3i = a[j2 + 1] - a[j3 + 1]; 566 // a[j] = x0r + x2r; 567 // a[j + 1] = x0i + x2i; 568 // x0r -= x2r; 569 // x0i -= x2i; 570 // a[j2] = wk2r * x0r - wk2i * x0i; 571 // a[j2 + 1] = wk2r * x0i + wk2i * x0r; 572 // x0r = x1r - x3i; 573 // x0i = x1i + x3r; 574 // a[j1] = wk1r * x0r - wk1i * x0i; 575 // a[j1 + 1] = wk1r * x0i + wk1i * x0r; 576 // x0r = x1r + x3i; 577 // x0i = x1i - x3r; 578 // a[j3] = wk3r * x0r - wk3i * x0i; 579 // a[j3 + 1] = wk3r * x0i + wk3i * x0r; 580 // } while ( j += 2, j < l + k ); 581 // 582 // wk1r = w[2*k1 + 2]; 583 // wk1i = w[2*k1 + 3]; 584 // wk3r = wk1r - 2 * wk2r * wk1i; 585 // wk3i = 2 * wk2r * wk1r - wk1i; 586 // j = k + m; 587 // do { 588 // j1 = j + l; 589 // j2 = j1 + l; 590 // j3 = j2 + l; 591 // x0r = a[j] + a[j1]; 592 // x0i = a[j + 1] + a[j1 + 1]; 593 // x1r = a[j] - a[j1]; 594 // x1i = a[j + 1] - a[j1 + 1]; 595 // x2r = a[j2] + a[j3]; 596 // x2i = a[j2 + 1] + a[j3 + 1]; 597 // x3r = a[j2] - a[j3]; 598 // x3i = a[j2 + 1] - a[j3 + 1]; 599 // a[j] = x0r + x2r; 600 // a[j + 1] = x0i + x2i; 601 // x0r -= x2r; 602 // x0i -= x2i; 603 // a[j2] = -wk2i * x0r - wk2r * x0i; 604 // a[j2 + 1] = -wk2i * x0i + wk2r * x0r; 605 // x0r = x1r - x3i; 606 // x0i = x1i + x3r; 607 // a[j1] = wk1r * x0r - wk1i * x0i; 608 // a[j1 + 1] = wk1r * x0i + wk1i * x0r; 609 // x0r = x1r + x3i; 610 // x0i = x1i - x3r; 611 // a[j3] = wk3r * x0r - wk3i * x0i; 612 // a[j3 + 1] = wk3r * x0i + wk3i * x0r; 613 // } while ( j += 2, j < l+k+m ); 614 // } 615 // return; 616 // } 637 617 638 618 … … 643 623 float wkr, wki, xr, xi, yr, yi; 644 624 645 ENTER(37);646 625 m = n >> 1; 647 626 ks = 2 * nc / m; … … 664 643 kk += ks; 665 644 } while ( j += 2, j < m ); 666 LEAVE(37);667 645 return; 668 646 }
Note: See TracChangeset
for help on using the changeset viewer.