argb_sse2: cosmetics

clarify some variable names in PackARGB() + add some comments

Change-Id: I2bb91d6c52dcbcdebe0f92d5f2136c2d7d11af2a
This commit is contained in:
pascal massimino 2015-01-08 00:17:24 -08:00 committed by James Zern
parent 67f601cd46
commit c6d3292738
2 changed files with 6 additions and 5 deletions

View File

@ -27,14 +27,14 @@ static void PackARGB(const uint8_t* a, const uint8_t* r, const uint8_t* g,
const uint8_t* b, int len, uint32_t* out) {
if (g == r + 1) { // RGBA input order. Need to swap R and B.
int i = 0;
const int len4 = len & ~3;
const __m128i mask = _mm_set1_epi32(0x00ff00ffu);
const int len_max = len & ~3; // max length processed in main loop
const __m128i red_blue_mask = _mm_set1_epi32(0x00ff00ffu);
assert(b == r + 2);
assert(a == r + 3);
for (; i < len4; i += 4) {
for (; i < len_max; i += 4) {
const __m128i A = _mm_loadu_si128((__m128i*)(r + 4 * i));
const __m128i B = _mm_and_si128(A, mask); // R 0 B 0
const __m128i C = _mm_andnot_si128(mask, A); // 0 G 0 A
const __m128i B = _mm_and_si128(A, red_blue_mask); // R 0 B 0
const __m128i C = _mm_andnot_si128(red_blue_mask, A); // 0 G 0 A
const __m128i D = _mm_shufflelo_epi16(B, _MM_SHUFFLE(2, 3, 0, 1));
const __m128i E = _mm_shufflehi_epi16(D, _MM_SHUFFLE(2, 3, 0, 1));
const __m128i F = _mm_or_si128(E, C);

View File

@ -341,6 +341,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void);
extern void (*VP8PackARGB)(const uint8_t* a, const uint8_t* r,
const uint8_t* g, const uint8_t* b, int len,
uint32_t* out);
// RGB packing function. 'step' can be 3 or 4. r/g/b input is rgb or bgr order.
extern void (*VP8PackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b,
int len, int step, uint32_t* out);