Chromium Code Reviews| Index: media/base/simd/convert_yuv_to_rgb_c.cc |
| diff --git a/media/base/simd/convert_yuv_to_rgb_c.cc b/media/base/simd/convert_yuv_to_rgb_c.cc |
| index f04a89dbf9c7eb97825a37ff5ddf5c35164fca0f..ed7530fe0696da54844494e5772bb367bcb943a0 100644 |
| --- a/media/base/simd/convert_yuv_to_rgb_c.cc |
| +++ b/media/base/simd/convert_yuv_to_rgb_c.cc |
| @@ -11,6 +11,22 @@ namespace media { |
| #define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \ |
| (((x) + (y)) > 32767 ? 32767 : ((x) + (y)))) |
| +// On Android, pixel layout is RGBA |
| +// (see third_party/skia/include/core/SkColorPriv.h); |
| +// however, other Chrome platforms use BGRA |
| +// (see skia/config/SkUserConfig.h). |
| +#if defined(OS_ANDROID) |
| +#define SK_A32_SHIFT 24 |
|
scherkus (not reviewing)
2013/06/14 21:32:42
nit: can you reorder these so that it follows the
hkuang1
2013/06/15 00:24:40
Done.
|
| +#define SK_B32_SHIFT 16 |
| +#define SK_G32_SHIFT 8 |
| +#define SK_R32_SHIFT 0 |
| +#else |
| +#define SK_A32_SHIFT 24 |
| +#define SK_R32_SHIFT 16 |
| +#define SK_G32_SHIFT 8 |
| +#define SK_B32_SHIFT 0 |
| +#endif |
| + |
| static inline void ConvertYUVToRGB32_C(uint8 y, |
|
scherkus (not reviewing)
2013/06/14 21:17:52
OOC does this mean we're using C routines for doin
hkuang1
2013/06/14 21:28:35
Yes. It uses this routine. Not quite efficient, bu
scherkus (not reviewing)
2013/06/14 21:32:42
I see. Have you looked at whether libyuv has a neo
hkuang1
2013/06/14 21:50:58
I did not check it yet. But I thought I could not
scherkus (not reviewing)
2013/06/14 22:17:30
libyuv is a separate collection of yuv routines
i
fgalligan1
2013/06/14 23:07:18
That is fine, but I think that is a separate issue
|
| uint8 u, |
| uint8 v, |
| @@ -35,10 +51,10 @@ static inline void ConvertYUVToRGB32_C(uint8 y, |
| r >>= 6; |
| a >>= 6; |
| - *reinterpret_cast<uint32*>(rgb_buf) = (packuswb(b)) | |
| - (packuswb(g) << 8) | |
| - (packuswb(r) << 16) | |
| - (packuswb(a) << 24); |
| + *reinterpret_cast<uint32*>(rgb_buf) = (packuswb(b) << SK_B32_SHIFT) | |
| + (packuswb(g) << SK_G32_SHIFT) | |
| + (packuswb(r) << SK_R32_SHIFT) | |
| + (packuswb(a) << SK_A32_SHIFT); |
| } |
| static inline void ConvertYUVAToARGB_C(uint8 y, |
| @@ -66,7 +82,10 @@ static inline void ConvertYUVAToARGB_C(uint8 y, |
| g = packuswb(g) * a >> 8; |
| r = packuswb(r) * a >> 8; |
| - *reinterpret_cast<uint32*>(rgb_buf) = b | (g << 8) | (r << 16) | (a << 24); |
| + *reinterpret_cast<uint32*>(rgb_buf) = (b << SK_B32_SHIFT) | |
| + (g << SK_G32_SHIFT) | |
| + (r << SK_R32_SHIFT) | |
| + (a << SK_A32_SHIFT); |
| } |
| void ConvertYUVToRGB32Row_C(const uint8* y_buf, |