| 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 2849cac28d658ceb7690ad0f8a1a02d0ac126ca9..e09ed137405638880051f1cb3ae4cfd5f32c57ed 100644 | 
| --- a/media/base/simd/convert_yuv_to_rgb_c.cc | 
| +++ b/media/base/simd/convert_yuv_to_rgb_c.cc | 
| @@ -39,6 +39,34 @@ static inline void ConvertYUVToRGB32_C(uint8 y, | 
| (packuswb(a) << 24); | 
| } | 
|  | 
| +static inline void ConvertYUVAToARGB_C(uint8 y, | 
| +                                       uint8 u, | 
| +                                       uint8 v, | 
| +                                       uint8 a, | 
| +                                       uint8* rgb_buf) { | 
| +  int b = kCoefficientsRgbY[256+u][0]; | 
| +  int g = kCoefficientsRgbY[256+u][1]; | 
| +  int r = kCoefficientsRgbY[256+u][2]; | 
| + | 
| +  b = paddsw(b, kCoefficientsRgbY[512+v][0]); | 
| +  g = paddsw(g, kCoefficientsRgbY[512+v][1]); | 
| +  r = paddsw(r, kCoefficientsRgbY[512+v][2]); | 
| + | 
| +  b = paddsw(b, kCoefficientsRgbY[y][0]); | 
| +  g = paddsw(g, kCoefficientsRgbY[y][1]); | 
| +  r = paddsw(r, kCoefficientsRgbY[y][2]); | 
| + | 
| +  b >>= 6; | 
| +  g >>= 6; | 
| +  r >>= 6; | 
| + | 
| +  b = packuswb(b) * a >> 8; | 
| +  g = packuswb(g) * a >> 8; | 
| +  r = packuswb(r) * a >> 8; | 
| + | 
| +  *reinterpret_cast<uint32*>(rgb_buf) = b | (g << 8) | (r << 16) | (a << 24); | 
| +} | 
| + | 
| extern "C" { | 
|  | 
| void ConvertYUVToRGB32Row_C(const uint8* y_buf, | 
| @@ -59,6 +87,27 @@ void ConvertYUVToRGB32Row_C(const uint8* y_buf, | 
| } | 
| } | 
|  | 
| +void ConvertYUVAToARGBRow_C(const uint8* y_buf, | 
| +                            const uint8* u_buf, | 
| +                            const uint8* v_buf, | 
| +                            const uint8* a_buf, | 
| +                            uint8* rgba_buf, | 
| +                            ptrdiff_t width) { | 
| +  for (int x = 0; x < width; x += 2) { | 
| +    uint8 u = u_buf[x >> 1]; | 
| +    uint8 v = v_buf[x >> 1]; | 
| +    uint8 y0 = y_buf[x]; | 
| +    uint8 a0 = a_buf[x]; | 
| +    ConvertYUVAToARGB_C(y0, u, v, a0, rgba_buf); | 
| +    if ((x + 1) < width) { | 
| +      uint8 y1 = y_buf[x + 1]; | 
| +      uint8 a1 = a_buf[x + 1]; | 
| +      ConvertYUVAToARGB_C(y1, u, v, a1, rgba_buf + 4); | 
| +    } | 
| +    rgba_buf += 8;  // Advance 2 pixels. | 
| +  } | 
| +} | 
| + | 
| // 16.16 fixed point is used.  A shift by 16 isolates the integer. | 
| // A shift by 17 is used to further subsample the chrominence channels. | 
| // & 0xffff isolates the fixed point fraction.  >> 2 to get the upper 2 bits, | 
| @@ -161,4 +210,33 @@ void ConvertYUVToRGB32_C(const uint8* yplane, | 
| } | 
| } | 
|  | 
| +void ConvertYUVAToARGB_C(const uint8* yplane, | 
| +                         const uint8* uplane, | 
| +                         const uint8* vplane, | 
| +                         const uint8* aplane, | 
| +                         uint8* rgbaframe, | 
| +                         int width, | 
| +                         int height, | 
| +                         int ystride, | 
| +                         int uvstride, | 
| +                         int astride, | 
| +                         int rgbastride, | 
| +                         YUVType yuv_type) { | 
| +  unsigned int y_shift = yuv_type; | 
| +  for (int y = 0; y < height; y++) { | 
| +    uint8* rgba_row = rgbaframe + y * rgbastride; | 
| +    const uint8* y_ptr = yplane + y * ystride; | 
| +    const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; | 
| +    const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; | 
| +    const uint8* a_ptr = aplane + y * astride; | 
| + | 
| +    ConvertYUVAToARGBRow_C(y_ptr, | 
| +                           u_ptr, | 
| +                           v_ptr, | 
| +                           a_ptr, | 
| +                           rgba_row, | 
| +                           width); | 
| +  } | 
| +} | 
| + | 
| }  // namespace media | 
|  |