14 #include "../stdafx.h" 15 #include "../video/video_driver.hpp" 16 #include "32bpp_anim_sse2.hpp" 19 #include "../safeguards.h" 22 static FBlitter_32bppSSE2_Anim iFBlitter_32bppSSE2_Anim;
24 void Blitter_32bppSSE2_Anim::PaletteAnimate(
const Palette &palette)
28 this->palette = palette;
34 const uint16 *anim = this->anim_buf;
37 bool screen_dirty =
false;
40 const int width = this->anim_buf_width;
41 const int screen_pitch = _screen.pitch;
42 const int anim_pitch = this->anim_buf_pitch;
44 __m128i brightness_cmp = _mm_set1_epi16(Blitter_32bppBase::DEFAULT_BRIGHTNESS);
45 __m128i colour_mask = _mm_set1_epi16(0xFF);
46 for (
int y = this->anim_buf_height; y != 0 ; y--) {
47 Colour *next_dst_ln = dst + screen_pitch;
48 const uint16 *next_anim_ln = anim + anim_pitch;
51 __m128i data = _mm_load_si128((
const __m128i *) anim);
54 __m128i colour_data = _mm_and_si128(data, colour_mask);
57 int colour_cmp_result = _mm_movemask_epi8(_mm_cmpgt_epi16(colour_data, anim_cmp));
58 if (colour_cmp_result) {
60 if (x < 8 || colour_cmp_result != 0xFFFF ||
61 _mm_movemask_epi8(_mm_cmpeq_epi16(_mm_srli_epi16(data, 8), brightness_cmp)) != 0xFFFF) {
63 for (
int z = min<int>(x, 8); z != 0 ; z--) {
64 int value = _mm_extract_epi16(data, 0);
65 uint8 colour =
GB(value, 0, 8);
68 *dst = AdjustBrightneSSE(LookupColourInPalette(colour),
GB(value, 8, 8));
71 data = _mm_srli_si128(data, 2);
76 for (
int z = 0; z < 8; z++) {
77 *dst = LookupColourInPalette(_mm_extract_epi16(colour_data, 0));
78 colour_data = _mm_srli_si128(colour_data, 2);
virtual void MakeDirty(int left, int top, int width, int height)=0
Mark a particular area dirty.
Information about the currently used palette.
bool _screen_disable_anim
Disable palette animation (important for 32bpp-anim blitter during giant screenshot) ...
int first_dirty
The first dirty element.
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Functions related to SSE 32 bpp blitter.
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
Index in the _palettes array from which all animations are taking places (table/palettes.h)