OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef MEDIA_BASE_YUV_CONVERT_H_ | 5 #ifndef MEDIA_BASE_YUV_CONVERT_H_ |
6 #define MEDIA_BASE_YUV_CONVERT_H_ | 6 #define MEDIA_BASE_YUV_CONVERT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 // Convert a frame of YV12 (aka YUV420) to 32 bit ARGB. | 12 // Type of YUV surface. |
13 void ConvertYV12ToRGB32(const uint8* yplane, | 13 // The value of these enums matter as they are used to shift vertical indices. |
14 const uint8* uplane, | 14 enum YUVType { |
15 const uint8* vplane, | 15 YV16 = 0, // YV16 is half width and full height chroma channels. |
16 uint8* rgbframe, | 16 YV12 = 1, // YV12 is half width and half height chroma channels. |
17 size_t frame_width, | 17 }; |
18 size_t frame_height, | |
19 int ystride, | |
20 int uvstride, | |
21 int rgbstride); | |
22 | 18 |
23 // Convert a frame of YV16 (aka YUV422) to 32 bit ARGB. | 19 // Mirror means flip the image horizontally, as in looking in a mirror. |
24 void ConvertYV16ToRGB32(const uint8* yplane, | 20 // Rotate happens after mirroring. |
25 const uint8* uplane, | 21 enum Rotate { |
26 const uint8* vplane, | 22 ROTATE_0, // Rotation off. |
27 uint8* rgbframe, | 23 ROTATE_90, // Rotate clockwise. |
28 size_t frame_width, | 24 ROTATE_180, // Rotate upside down. |
29 size_t frame_height, | 25 ROTATE_270, // Rotate counter clockwise. |
30 int ystride, | 26 MIRROR_ROTATE_0, // Mirror horizontally. |
31 int uvstride, | 27 MIRROR_ROTATE_90, // Mirror then Rotate clockwise. |
32 int rgbstride); | 28 MIRROR_ROTATE_180, // Mirror vertically. |
| 29 MIRROR_ROTATE_270, // Transpose. |
| 30 }; |
33 | 31 |
| 32 // Convert a frame of YUV to 32 bit ARGB. |
| 33 // Pass in YV16/YV12 depending on source format |
| 34 void ConvertYUVToRGB32(const uint8* yplane, |
| 35 const uint8* uplane, |
| 36 const uint8* vplane, |
| 37 uint8* rgbframe, |
| 38 int frame_width, |
| 39 int frame_height, |
| 40 int ystride, |
| 41 int uvstride, |
| 42 int rgbstride, |
| 43 YUVType yuv_type); |
| 44 |
| 45 // Scale a frame of YUV to 32 bit ARGB. |
| 46 // Supports rotation and mirroring. |
| 47 void ScaleYUVToRGB32(const uint8* yplane, |
| 48 const uint8* uplane, |
| 49 const uint8* vplane, |
| 50 uint8* rgbframe, |
| 51 int frame_width, |
| 52 int frame_height, |
| 53 int scaled_width, |
| 54 int scaled_height, |
| 55 int ystride, |
| 56 int uvstride, |
| 57 int rgbstride, |
| 58 YUVType yuv_type, |
| 59 Rotate view_rotate); |
| 60 |
| 61 } // namespace media |
34 | 62 |
35 #endif // MEDIA_BASE_YUV_CONVERT_H_ | 63 #endif // MEDIA_BASE_YUV_CONVERT_H_ |
36 | |
37 } // namespace media | |
OLD | NEW |