Import: extract condition from loop
do_copy is a loop invariant, but based on a variable parameter; it would only be extracted if Import was inlined. Change-Id: Id5b4a1a4a83a4f2083444da4934e4c994df65b44
This commit is contained in:
parent
3b07d32712
commit
1e3dfc48fb
@ -1110,10 +1110,14 @@ static int Import(WebPPicture* const picture,
|
|||||||
uint32_t* dst = picture->argb;
|
uint32_t* dst = picture->argb;
|
||||||
const int do_copy = (ALPHA_OFFSET == 3) && swap_rb;
|
const int do_copy = (ALPHA_OFFSET == 3) && swap_rb;
|
||||||
assert(step == 4);
|
assert(step == 4);
|
||||||
for (y = 0; y < height; ++y) {
|
|
||||||
if (do_copy) {
|
if (do_copy) {
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
memcpy(dst, rgb, width * 4);
|
memcpy(dst, rgb, width * 4);
|
||||||
|
rgb += rgb_stride;
|
||||||
|
dst += picture->argb_stride;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
// BGRA or RGBA input order.
|
// BGRA or RGBA input order.
|
||||||
const uint8_t* a_ptr = rgb + 3;
|
const uint8_t* a_ptr = rgb + 3;
|
||||||
@ -1125,10 +1129,10 @@ static int Import(WebPPicture* const picture,
|
|||||||
// RGBA input order. Need to swap R and B.
|
// RGBA input order. Need to swap R and B.
|
||||||
VP8LConvertBGRAToRGBA((const uint32_t*)rgb, width, (uint8_t*)dst);
|
VP8LConvertBGRAToRGBA((const uint32_t*)rgb, width, (uint8_t*)dst);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
rgb += rgb_stride;
|
rgb += rgb_stride;
|
||||||
dst += picture->argb_stride;
|
dst += picture->argb_stride;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uint32_t* dst = picture->argb;
|
uint32_t* dst = picture->argb;
|
||||||
assert(step >= 3);
|
assert(step >= 3);
|
||||||
|
Loading…
Reference in New Issue
Block a user