Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/yuv_convert.h" | 5 #include "media/base/yuv_convert.h" |
| 6 #include "media/base/yuv_convert_internal.h" | 6 #include "media/base/yuv_convert_internal.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 static int clip_byte(int x) { | 10 static int clip_byte(int x) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 | 41 |
| 42 rgbframe += rgbstride; | 42 rgbframe += rgbstride; |
| 43 yplane += ystride; | 43 yplane += ystride; |
| 44 if (i % 2 == 0) { | 44 if (i % 2 == 0) { |
| 45 uplane += uvstride; | 45 uplane += uvstride; |
| 46 vplane += uvstride; | 46 vplane += uvstride; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ConvertRGB24ToYUV_C(const uint8* rgbframe, | |
| 52 uint8* yplane, | |
|
scherkus (not reviewing)
2011/05/23 05:05:09
indentation
Per K
2011/05/23 12:05:47
Done.
| |
| 53 uint8* uplane, | |
| 54 uint8* vplane, | |
| 55 int width, | |
| 56 int height, | |
| 57 int rgbstride, | |
| 58 int ystride, | |
| 59 int uvstride) { | |
| 60 for (int i = 0; i < height; ++i) { | |
| 61 for (int j = 0; j < width; ++j) { | |
| 62 // Since the input pixel format is RGB24, there are 3 bytes per pixel. | |
| 63 const uint8* pixel = rgbframe + 3 * j; | |
| 64 yplane[j] = clip_byte(((pixel[2] * 66 + pixel[1] * 129 + | |
| 65 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.
| |
| 66 if (i % 2 == 0 && j % 2 == 0) { | |
| 67 uplane[j / 2] = clip_byte(((pixel[2] * -38 + pixel[1] * -74 + | |
| 68 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.
| |
| 69 vplane[j / 2] = clip_byte(((pixel[2] * 112 + pixel[1] * -94 + | |
| 70 pixel[1] * -18 + 128) >> 8) + 128); | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 rgbframe += rgbstride; | |
| 75 yplane += ystride; | |
| 76 if (i % 2 == 0) { | |
| 77 uplane += uvstride; | |
| 78 vplane += uvstride; | |
| 79 } | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 void ConvertYUY2ToYUV_C(const uint8* src, | |
| 84 uint8* yplane, | |
| 85 uint8* uplane, | |
| 86 uint8* vplane, | |
| 87 int width, | |
| 88 int height) { | |
| 89 for (int i = 0; i < height / 2; ++i) { | |
| 90 for (int j = 0; j < (width / 2); ++j) { | |
| 91 yplane[0] = src[0]; | |
| 92 *uplane = src[1]; | |
| 93 yplane[1] = src[2]; | |
| 94 *vplane = src[3]; | |
| 95 src += 4; | |
| 96 yplane += 2; | |
| 97 uplane++; | |
| 98 vplane++; | |
| 99 } | |
| 100 for (int j = 0; j < (width / 2); ++j) { | |
| 101 yplane[0] = src[0]; | |
| 102 yplane[1] = src[2]; | |
| 103 src += 4; | |
| 104 yplane += 2; | |
| 105 } | |
| 106 } | |
| 107 } | |
| 108 | |
| 51 } // namespace media | 109 } // namespace media |
| OLD | NEW |