Small optimization to ConvertRGBA5551ToRGBA8888().

This commit is contained in:
Unknown W. Brackets 2015-05-25 10:31:27 -07:00
parent 5d244229ba
commit b0a825ea9f

View File

@ -332,7 +332,6 @@ void ConvertRGBA5551ToRGBA8888(u32 *dst32, const u16 *src, const u32 numPixels)
#ifdef _M_SSE
const __m128i mask5 = _mm_set1_epi16(0x001f);
const __m128i mask8 = _mm_set1_epi16(0x00ff);
const __m128i one = _mm_set1_epi16(0x0001);
const __m128i *srcp = (const __m128i *)src;
__m128i *dstp = (__m128i *)dst32;
@ -359,8 +358,8 @@ void ConvertRGBA5551ToRGBA8888(u32 *dst32, const u16 *src, const u32 numPixels)
b = _mm_and_si128(b, mask8);
// 1 bit A to 00AA 00AA.
__m128i a = _mm_srli_epi16(c, 15);
a = _mm_slli_epi16(_mm_cmpeq_epi16(a, one), 8);
__m128i a = _mm_srai_epi16(c, 15);
a = _mm_slli_epi16(a, 8);
// Now combine them, RRGG RRGG and BBAA BBAA, and then interleave.
const __m128i rg = _mm_or_si128(r, g);