Date: Tue, 19 Aug 2003 17:57:00 +0200
From: Stephane Marchesin Subject: Re: [SDL] [patch] MMX alpha blit patches with MMX detection I think everything is correct now. I've done as much testing as I could, but some real-world testing wouldn't hurt, I think. The patch is here : http://icps.u-strasbg.fr/~marchesin/sdl_mmxblit.patch If you do byte-by-byte comparison of the output between C and MMX functions, you'll notice that the results for 555 and 565 RGB alpha blits aren't exactly the same. This is because MMX functions for 555 and 565 RGB have an higher accuracy. If you want the exact same behaviour that's possible by masking the three lower alpha bits in the MMX functions. Just ask ! I removed one MMX function because after I fixed it to match its C equivalent, it revealed to be slower than the C version on a PIII (although a bit faster on an Athlon XP). I've also added MMX and PIII replacements for SDL_memcpy. Those provide some speed up in testvidinfo -benchmark (at least for me, under linux & X11). --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40690
This commit is contained in:
parent
d8ae01f168
commit
3095e05ea7
6 changed files with 1981 additions and 21 deletions
|
@ -410,12 +410,86 @@ do { \
|
|||
} \
|
||||
}
|
||||
|
||||
/* 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 ); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Use the 8-times version of the loop by default */
|
||||
#define DUFFS_LOOP(pixel_copy_increment, width) \
|
||||
DUFFS_LOOP8(pixel_copy_increment, width)
|
||||
|
||||
#else
|
||||
|
||||
/* Don't use Duff's device to unroll loops */
|
||||
#define DUFFS_LOOP_DOUBLE2(pixel_copy_increment, \
|
||||
double_pixel_copy_increment, width) \
|
||||
{ int n = width; \
|
||||
if( n & 1 ) { \
|
||||
pixel_copy_increment; \
|
||||
n--; \
|
||||
} \
|
||||
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) { \
|
||||
double_pixel_copy_increment; \
|
||||
n -= 2; \
|
||||
} \
|
||||
n=n>>2; \
|
||||
for(; n > 0; --n) { \
|
||||
quatro_pixel_copy_increment; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Don't use Duff's device to unroll loops */
|
||||
#define DUFFS_LOOP(pixel_copy_increment, width) \
|
||||
{ int n; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue