apps,fceux,drivers,vidblit: loop unroll

This commit is contained in:
Zihao Yu 2020-02-05 01:22:54 +08:00
parent a569922d53
commit a27b40c09d
1 changed files with 8 additions and 5 deletions

View File

@ -142,18 +142,21 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale,
int x,y; int x,y;
assert(Bpp == 4); assert(Bpp == 4);
uint32 * dest32 = (uint32 *)dest;
int pinc=pitch-(xr<<2); int pinc=pitch-(xr<<2);
assert(xr % 8 == 0);
assert(pinc % 4 == 0);
for(y=yr;y;y--,src+=256-xr) { for(y=yr;y;y--,src+=256-xr) {
for(x=xr;x;x--) { for(x=xr;x;x-=8) {
//THE MAIN BLITTING CODEPATH (there may be others that are important) //THE MAIN BLITTING CODEPATH (there may be others that are important)
//*(uint32 *)dest = ModernDeemphColorMap(src,XBuf,1,1); //*(uint32 *)dest = ModernDeemphColorMap(src,XBuf,1,1);
//look up the legacy translation, //look up the legacy translation,
//do not support deemph palette to optimize performance //do not support deemph palette to optimize performance
*(uint32 *)dest = palettetranslate[*src]; #define macro() *dest32 ++ = palettetranslate[*src ++]
dest+=4; macro(); macro(); macro(); macro();
src++; macro(); macro(); macro(); macro();
} }
dest+=pinc; dest32+=(pinc / 4);
} }
} }