~3-4% faster lossless encoding

by re-arranging some code from SkipRepeatedPixel()

Change-Id: I6c1fd7cd9af22cd9be4234217ff67d7b94f44137
This commit is contained in:
skal 2014-03-04 00:00:40 +01:00
parent b33e8a05ee
commit c60de26099

View File

@ -884,16 +884,18 @@ static WEBP_INLINE uint8_t TransformColorBlue(uint8_t green_to_blue,
static WEBP_INLINE int SkipRepeatedPixels(const uint32_t* const argb, static WEBP_INLINE int SkipRepeatedPixels(const uint32_t* const argb,
int ix, int xsize) { int ix, int xsize) {
const uint32_t v = argb[ix]; const uint32_t v = argb[ix];
if (ix >= xsize + 3) { if (ix >= 3) {
if (v == argb[ix - xsize] && if (v == argb[ix - 3] && v == argb[ix - 2] && v == argb[ix - 1]) {
argb[ix - 1] == argb[ix - xsize - 1] &&
argb[ix - 2] == argb[ix - xsize - 2] &&
argb[ix - 3] == argb[ix - xsize - 3]) {
return 1; return 1;
} }
return v == argb[ix - 3] && v == argb[ix - 2] && v == argb[ix - 1]; if (ix >= xsize + 3) {
} else if (ix >= 3) { if (v == argb[ix - xsize] &&
return v == argb[ix - 3] && v == argb[ix - 2] && v == argb[ix - 1]; argb[ix - 3] == argb[ix - xsize - 3] &&
argb[ix - 2] == argb[ix - xsize - 2] &&
argb[ix - 1] == argb[ix - xsize - 1]) {
return 1;
}
}
} }
return 0; return 0;
} }