Chromium Code Reviews| Index: media/base/yuv_convert_c.cc |
| =================================================================== |
| --- media/base/yuv_convert_c.cc (revision 86049) |
| +++ media/base/yuv_convert_c.cc (working copy) |
| @@ -48,4 +48,62 @@ |
| } |
| } |
| +void ConvertRGB24ToYUV_C(const uint8* rgbframe, |
| + uint8* yplane, |
|
scherkus (not reviewing)
2011/05/23 05:05:09
indentation
Per K
2011/05/23 12:05:47
Done.
|
| + uint8* uplane, |
| + uint8* vplane, |
| + int width, |
| + int height, |
| + int rgbstride, |
| + int ystride, |
| + int uvstride) { |
| + for (int i = 0; i < height; ++i) { |
| + for (int j = 0; j < width; ++j) { |
| + // Since the input pixel format is RGB24, there are 3 bytes per pixel. |
| + const uint8* pixel = rgbframe + 3 * j; |
| + yplane[j] = clip_byte(((pixel[2] * 66 + pixel[1] * 129 + |
| + pixel[0] * 25 + 128) >> 8) + 16); |
|
scherkus (not reviewing)
2011/05/23 05:05:09
indent this line one more space
Per K
2011/05/23 12:05:47
Done.
|
| + if (i % 2 == 0 && j % 2 == 0) { |
| + uplane[j / 2] = clip_byte(((pixel[2] * -38 + pixel[1] * -74 + |
| + pixel[0] * 112 + 128) >> 8) + 128); |
|
scherkus (not reviewing)
2011/05/23 05:05:09
indent this line one more space
Per K
2011/05/23 12:05:47
Done.
|
| + vplane[j / 2] = clip_byte(((pixel[2] * 112 + pixel[1] * -94 + |
| + pixel[1] * -18 + 128) >> 8) + 128); |
| + } |
| + } |
| + |
| + rgbframe += rgbstride; |
| + yplane += ystride; |
| + if (i % 2 == 0) { |
| + uplane += uvstride; |
| + vplane += uvstride; |
| + } |
| + } |
| +} |
| + |
| +void ConvertYUY2ToYUV_C(const uint8* src, |
| + uint8* yplane, |
| + uint8* uplane, |
| + uint8* vplane, |
| + int width, |
| + int height) { |
| + for (int i = 0; i < height / 2; ++i) { |
| + for (int j = 0; j < (width / 2); ++j) { |
| + yplane[0] = src[0]; |
| + *uplane = src[1]; |
| + yplane[1] = src[2]; |
| + *vplane = src[3]; |
| + src += 4; |
| + yplane += 2; |
| + uplane++; |
| + vplane++; |
| + } |
| + for (int j = 0; j < (width / 2); ++j) { |
| + yplane[0] = src[0]; |
| + yplane[1] = src[2]; |
| + src += 4; |
| + yplane += 2; |
| + } |
| + } |
| +} |
| + |
| } // namespace media |