(svn r26214) -Add: specialised animated SSE4 blitter (MJP)

With 32bpp base set about 15-20% faster in the Draw function (slower with 8bpp base set). Overall, with 32bpp base set, about 5% faster.
This commit is contained in:
rubidium
2014-01-02 23:52:13 +00:00
parent 78df732a7b
commit 4c84d13454
13 changed files with 516 additions and 18 deletions

View File

@@ -200,7 +200,7 @@ void Blitter_32bppSSE2::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
}
}
Sprite *Blitter_32bppSSE2::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
/* First uint32 of a line = ~1 & the number of transparent pixels from the left.
* Second uint32 of a line = the number of transparent pixels from the right.
@@ -252,10 +252,10 @@ Sprite *Blitter_32bppSSE2::Encode(const SpriteLoader::Sprite *sprite, AllocatorP
if (src->m != 0) {
/* Get brightest value (or default brightness if it's a black pixel). */
const uint8 rgb_max = max(src->r, max(src->g, src->b));
dst_mv->v = (rgb_max == 0) ? DEFAULT_BRIGHTNESS : rgb_max;
dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max;
/* Pre-convert the mapping channel to a RGB value. */
const Colour colour = AdjustBrightness(LookupColourInPalette(src->m), dst_mv->v);
const Colour colour = AdjustBrightness(Blitter_32bppBase::LookupColourInPalette(src->m), dst_mv->v);
dst_rgba->r = colour.r;
dst_rgba->g = colour.g;
dst_rgba->b = colour.b;
@@ -263,7 +263,7 @@ Sprite *Blitter_32bppSSE2::Encode(const SpriteLoader::Sprite *sprite, AllocatorP
dst_rgba->r = src->r;
dst_rgba->g = src->g;
dst_rgba->b = src->b;
dst_mv->v = DEFAULT_BRIGHTNESS;
dst_mv->v = Blitter_32bppBase::DEFAULT_BRIGHTNESS;
}
} else {
dst_rgba->data = 0;
@@ -310,10 +310,10 @@ inline Colour Blitter_32bppSSE2::AdjustBrightness(Colour colour, uint8 brightnes
/* Shortcut for normal brightness. */
if (brightness == DEFAULT_BRIGHTNESS) return colour;
return this->ReallyAdjustBrightness(colour, brightness);
return Blitter_32bppSSE2::ReallyAdjustBrightness(colour, brightness);
}
Colour Blitter_32bppSSE2::ReallyAdjustBrightness(Colour colour, uint8 brightness)
/* static */ Colour Blitter_32bppSSE2::ReallyAdjustBrightness(Colour colour, uint8 brightness)
{
ALIGN(16) uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
c16 *= brightness;