Index: media/base/simd/convert_rgb_to_yuv_c.cc |
diff --git a/media/base/simd/convert_rgb_to_yuv_c.cc b/media/base/simd/convert_rgb_to_yuv_c.cc |
index ae4c7313cd701cafcdf97286c2242e52e40d070d..4917d37bf36b6bc8a21442251b0badef48f141e3 100644 |
--- a/media/base/simd/convert_rgb_to_yuv_c.cc |
+++ b/media/base/simd/convert_rgb_to_yuv_c.cc |
@@ -24,20 +24,29 @@ void ConvertRGB32ToYUV_C(const uint8* rgbframe, |
int rgbstride, |
int ystride, |
int uvstride) { |
+#if defined(OS_ANDROID) |
+ const int r = 0; |
+ const int g = 1; |
+ const int b = 2; |
+#else |
+ const int r = 2; |
+ const int g = 1; |
+ const int b = 0; |
+#endif |
+ |
for (int i = 0; i < height; ++i) { |
for (int j = 0; j < width; ++j) { |
// Since the input pixel format is RGB32, there are 4 bytes per pixel. |
const uint8* pixel = rgbframe + 4 * j; |
- yplane[j] = clip_byte(((pixel[2] * 66 + pixel[1] * 129 + |
- pixel[0] * 25 + 128) >> 8) + 16); |
+ yplane[j] = clip_byte(((pixel[r] * 66 + pixel[g] * 129 + |
+ pixel[b] * 25 + 128) >> 8) + 16); |
if (i % 2 == 0 && j % 2 == 0) { |
- uplane[j / 2] = clip_byte(((pixel[2] * -38 + pixel[1] * -74 + |
- pixel[0] * 112 + 128) >> 8) + 128); |
- vplane[j / 2] = clip_byte(((pixel[2] * 112 + pixel[1] * -94 + |
- pixel[0] * -18 + 128) >> 8) + 128); |
+ uplane[j / 2] = clip_byte(((pixel[r] * -38 + pixel[g] * -74 + |
+ pixel[b] * 112 + 128) >> 8) + 128); |
+ vplane[j / 2] = clip_byte(((pixel[r] * 112 + pixel[g] * -94 + |
+ pixel[b] * -18 + 128) >> 8) + 128); |
} |
} |
- |
rgbframe += rgbstride; |
yplane += ystride; |
if (i % 2 == 0) { |