Commit bb851385 authored by Sam Lantinga's avatar Sam Lantinga

Removed Rafal Bursig's MMX RLE code, at his request.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403497
parent 97baa9c4
This diff is collapsed.
...@@ -476,48 +476,7 @@ do { \ ...@@ -476,48 +476,7 @@ do { \
case 3: pixel_copy_increment; \ case 3: pixel_copy_increment; \
case 2: pixel_copy_increment; \ case 2: pixel_copy_increment; \
case 1: pixel_copy_increment; \ case 1: pixel_copy_increment; \
} while ( --n > 0 ); \ } while (--n > 0); \
} \
}
/* 2 - times unrolled loop */
#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment, \
double_pixel_copy_increment, width) \
{ int n, w = width; \
if( w & 1 ) { \
pixel_copy_increment; \
w--; \
} \
if ( w > 0 ) { \
n = ( w + 2) / 4; \
switch( w & 2 ) { \
case 0: do { double_pixel_copy_increment; \
case 2: double_pixel_copy_increment; \
} while ( --n > 0 ); \
} \
} \
}
/* 2 - times unrolled loop 4 pixels */
#define DUFFS_LOOP_QUATRO2(pixel_copy_increment, \
double_pixel_copy_increment, \
quatro_pixel_copy_increment, width) \
{ int n, w = width; \
if(w & 1) { \
pixel_copy_increment; \
w--; \
} \
if(w & 2) { \
double_pixel_copy_increment; \
w -= 2; \
} \
if ( w > 0 ) { \
n = ( w + 7 ) / 8; \
switch( w & 4 ) { \
case 0: do { quatro_pixel_copy_increment; \
case 4: quatro_pixel_copy_increment; \
} while ( --n > 0 ); \
} \
} \ } \
} }
...@@ -525,41 +484,29 @@ do { \ ...@@ -525,41 +484,29 @@ do { \
#define DUFFS_LOOP(pixel_copy_increment, width) \ #define DUFFS_LOOP(pixel_copy_increment, width) \
DUFFS_LOOP8(pixel_copy_increment, width) DUFFS_LOOP8(pixel_copy_increment, width)
#else /* Special version of Duff's device for even more optimization */
#define DUFFS_LOOP_124(pixel_copy_increment1, \
/* Don't use Duff's device to unroll loops */ pixel_copy_increment2, \
#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment, \ pixel_copy_increment4, width) \
double_pixel_copy_increment, width) \ { int n = width; \
{ int n = width; \ if (n & 1) { \
if( n & 1 ) { \ pixel_copy_increment1; n -= 1; \
pixel_copy_increment; \ } \
n--; \ if (n & 2) { \
} \ pixel_copy_increment2; n -= 2; \
n=n>>1; \
for(; n > 0; --n) { \
double_pixel_copy_increment; \
} \
}
/* Don't use Duff's device to unroll loops */
#define DUFFS_LOOP_QUATRO2(pixel_copy_increment, \
double_pixel_copy_increment, \
quatro_pixel_copy_increment, width) \
{ int n = width; \
if(n & 1) { \
pixel_copy_increment; \
n--; \
} \ } \
if(n & 2) { \ if (n) { \
double_pixel_copy_increment; \ n = (n+7)/ 8; \
n -= 2; \ switch (n & 4) { \
case 0: do { pixel_copy_increment4; \
case 4: pixel_copy_increment4; \
} while (--n > 0); \
} \
} \ } \
n=n>>2; \
for(; n > 0; --n) { \
quatro_pixel_copy_increment; \
} \
} }
#else
/* Don't use Duff's device to unroll loops */ /* Don't use Duff's device to unroll loops */
#define DUFFS_LOOP(pixel_copy_increment, width) \ #define DUFFS_LOOP(pixel_copy_increment, width) \
{ int n; \ { int n; \
...@@ -571,6 +518,10 @@ do { \ ...@@ -571,6 +518,10 @@ do { \
DUFFS_LOOP(pixel_copy_increment, width) DUFFS_LOOP(pixel_copy_increment, width)
#define DUFFS_LOOP4(pixel_copy_increment, width) \ #define DUFFS_LOOP4(pixel_copy_increment, width) \
DUFFS_LOOP(pixel_copy_increment, width) DUFFS_LOOP(pixel_copy_increment, width)
#define DUFFS_LOOP_124(pixel_copy_increment1, \
pixel_copy_increment2, \
pixel_copy_increment4, width) \
DUFFS_LOOP(pixel_copy_increment1, width)
#endif /* USE_DUFFS_LOOP */ #endif /* USE_DUFFS_LOOP */
......
...@@ -1266,8 +1266,7 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) ...@@ -1266,8 +1266,7 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP_DOUBLE2({ DUFFS_LOOP4({
/* One Pixel Blend */
s = *srcp; s = *srcp;
d = *dstp; d = *dstp;
s1 = s & 0xff00ff; s1 = s & 0xff00ff;
...@@ -1280,35 +1279,6 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) ...@@ -1280,35 +1279,6 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
*dstp = d1 | d | 0xff000000; *dstp = d1 | d | 0xff000000;
++srcp; ++srcp;
++dstp; ++dstp;
},{
/* Two Pixels Blend */
s = *srcp;
d = *dstp;
s1 = s & 0xff00ff;
d1 = d & 0xff00ff;
d1 += (s1 - d1) * alpha >> 8;
d1 &= 0xff00ff;
s = ((s & 0xff00) >> 8) |
((srcp[1] & 0xff00) << 8);
d = ((d & 0xff00) >> 8) |
((dstp[1] & 0xff00) << 8);
d += (s - d) * alpha >> 8;
d &= 0x00ff00ff;
*dstp++ = d1 | ((d << 8) & 0xff00) | 0xff000000;
++srcp;
s1 = *srcp;
d1 = *dstp;
s1 &= 0xff00ff;
d1 &= 0xff00ff;
d1 += (s1 - d1) * alpha >> 8;
d1 &= 0xff00ff;
*dstp = d1 | ((d >> 8) & 0xff00) | 0xff000000;
++srcp;
++dstp;
}, width); }, width);
/* *INDENT-ON* */ /* *INDENT-ON* */
srcp += srcskip; srcp += srcskip;
...@@ -1588,7 +1558,7 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info) ...@@ -1588,7 +1558,7 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP_QUATRO2( DUFFS_LOOP_124(
{ {
s = *srcp++; s = *srcp++;
d = *dstp; d = *dstp;
...@@ -1726,7 +1696,7 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info) ...@@ -1726,7 +1696,7 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP_QUATRO2( DUFFS_LOOP_124(
{ {
s = *srcp++; s = *srcp++;
d = *dstp; d = *dstp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment