comparison src/video/SDL_blit.h @ 3035:ff602fdfdedc

Removed Rafal Bursig's MMX RLE code, at his request.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 13 Jan 2009 07:20:55 +0000
parents a0c837a16e4c
children 8d93bfecb9dc
comparison
equal deleted inserted replaced
3034:0e821769fc51 3035:ff602fdfdedc
474 switch (width & 3) { \ 474 switch (width & 3) { \
475 case 0: do { pixel_copy_increment; \ 475 case 0: do { pixel_copy_increment; \
476 case 3: pixel_copy_increment; \ 476 case 3: pixel_copy_increment; \
477 case 2: pixel_copy_increment; \ 477 case 2: pixel_copy_increment; \
478 case 1: pixel_copy_increment; \ 478 case 1: pixel_copy_increment; \
479 } while ( --n > 0 ); \ 479 } while (--n > 0); \
480 } \
481 }
482
483 /* 2 - times unrolled loop */
484 #define DUFFS_LOOP_DOUBLE2(pixel_copy_increment, \
485 double_pixel_copy_increment, width) \
486 { int n, w = width; \
487 if( w & 1 ) { \
488 pixel_copy_increment; \
489 w--; \
490 } \
491 if ( w > 0 ) { \
492 n = ( w + 2) / 4; \
493 switch( w & 2 ) { \
494 case 0: do { double_pixel_copy_increment; \
495 case 2: double_pixel_copy_increment; \
496 } while ( --n > 0 ); \
497 } \
498 } \
499 }
500
501 /* 2 - times unrolled loop 4 pixels */
502 #define DUFFS_LOOP_QUATRO2(pixel_copy_increment, \
503 double_pixel_copy_increment, \
504 quatro_pixel_copy_increment, width) \
505 { int n, w = width; \
506 if(w & 1) { \
507 pixel_copy_increment; \
508 w--; \
509 } \
510 if(w & 2) { \
511 double_pixel_copy_increment; \
512 w -= 2; \
513 } \
514 if ( w > 0 ) { \
515 n = ( w + 7 ) / 8; \
516 switch( w & 4 ) { \
517 case 0: do { quatro_pixel_copy_increment; \
518 case 4: quatro_pixel_copy_increment; \
519 } while ( --n > 0 ); \
520 } \
521 } \ 480 } \
522 } 481 }
523 482
524 /* Use the 8-times version of the loop by default */ 483 /* Use the 8-times version of the loop by default */
525 #define DUFFS_LOOP(pixel_copy_increment, width) \ 484 #define DUFFS_LOOP(pixel_copy_increment, width) \
526 DUFFS_LOOP8(pixel_copy_increment, width) 485 DUFFS_LOOP8(pixel_copy_increment, width)
527 486
487 /* Special version of Duff's device for even more optimization */
488 #define DUFFS_LOOP_124(pixel_copy_increment1, \
489 pixel_copy_increment2, \
490 pixel_copy_increment4, width) \
491 { int n = width; \
492 if (n & 1) { \
493 pixel_copy_increment1; n -= 1; \
494 } \
495 if (n & 2) { \
496 pixel_copy_increment2; n -= 2; \
497 } \
498 if (n) { \
499 n = (n+7)/ 8; \
500 switch (n & 4) { \
501 case 0: do { pixel_copy_increment4; \
502 case 4: pixel_copy_increment4; \
503 } while (--n > 0); \
504 } \
505 } \
506 }
507
528 #else 508 #else
529
530 /* Don't use Duff's device to unroll loops */
531 #define DUFFS_LOOP_DOUBLE2(pixel_copy_increment, \
532 double_pixel_copy_increment, width) \
533 { int n = width; \
534 if( n & 1 ) { \
535 pixel_copy_increment; \
536 n--; \
537 } \
538 n=n>>1; \
539 for(; n > 0; --n) { \
540 double_pixel_copy_increment; \
541 } \
542 }
543
544 /* Don't use Duff's device to unroll loops */
545 #define DUFFS_LOOP_QUATRO2(pixel_copy_increment, \
546 double_pixel_copy_increment, \
547 quatro_pixel_copy_increment, width) \
548 { int n = width; \
549 if(n & 1) { \
550 pixel_copy_increment; \
551 n--; \
552 } \
553 if(n & 2) { \
554 double_pixel_copy_increment; \
555 n -= 2; \
556 } \
557 n=n>>2; \
558 for(; n > 0; --n) { \
559 quatro_pixel_copy_increment; \
560 } \
561 }
562 509
563 /* Don't use Duff's device to unroll loops */ 510 /* Don't use Duff's device to unroll loops */
564 #define DUFFS_LOOP(pixel_copy_increment, width) \ 511 #define DUFFS_LOOP(pixel_copy_increment, width) \
565 { int n; \ 512 { int n; \
566 for ( n=width; n > 0; --n ) { \ 513 for ( n=width; n > 0; --n ) { \
569 } 516 }
570 #define DUFFS_LOOP8(pixel_copy_increment, width) \ 517 #define DUFFS_LOOP8(pixel_copy_increment, width) \
571 DUFFS_LOOP(pixel_copy_increment, width) 518 DUFFS_LOOP(pixel_copy_increment, width)
572 #define DUFFS_LOOP4(pixel_copy_increment, width) \ 519 #define DUFFS_LOOP4(pixel_copy_increment, width) \
573 DUFFS_LOOP(pixel_copy_increment, width) 520 DUFFS_LOOP(pixel_copy_increment, width)
521 #define DUFFS_LOOP_124(pixel_copy_increment1, \
522 pixel_copy_increment2, \
523 pixel_copy_increment4, width) \
524 DUFFS_LOOP(pixel_copy_increment1, width)
574 525
575 #endif /* USE_DUFFS_LOOP */ 526 #endif /* USE_DUFFS_LOOP */
576 527
577 /* Prevent Visual C++ 6.0 from printing out stupid warnings */ 528 /* Prevent Visual C++ 6.0 from printing out stupid warnings */
578 #if defined(_MSC_VER) && (_MSC_VER >= 600) 529 #if defined(_MSC_VER) && (_MSC_VER >= 600)