OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 // Type of YUV surface. | 24 // Type of YUV surface. |
25 // The value of these enums matter as they are used to shift vertical indices. | 25 // The value of these enums matter as they are used to shift vertical indices. |
26 enum YUVType { | 26 enum YUVType { |
27 YV16 = 0, // YV16 is half width and full height chroma channels. | 27 YV16 = 0, // YV16 is half width and full height chroma channels. |
28 YV12 = 1, // YV12 is half width and half height chroma channels. | 28 YV12 = 1, // YV12 is half width and half height chroma channels. |
29 }; | 29 }; |
30 | 30 |
31 enum YUVRange { | |
32 MPEG, // [16,235] Y channel, [16,239] U/V | |
Sergey Ulanov
2013/12/02 21:49:09
nit: Maybe call it YUV_RANGE_MPEG and YUV_RANGE_JP
rileya (GONE FROM CHROMIUM)
2013/12/02 23:10:30
It's possible that a different range may eventuall
| |
33 JPEG, // Full [0,255] color range for all channels | |
34 }; | |
35 | |
31 // Mirror means flip the image horizontally, as in looking in a mirror. | 36 // Mirror means flip the image horizontally, as in looking in a mirror. |
32 // Rotate happens after mirroring. | 37 // Rotate happens after mirroring. |
33 enum Rotate { | 38 enum Rotate { |
34 ROTATE_0, // Rotation off. | 39 ROTATE_0, // Rotation off. |
35 ROTATE_90, // Rotate clockwise. | 40 ROTATE_90, // Rotate clockwise. |
36 ROTATE_180, // Rotate upside down. | 41 ROTATE_180, // Rotate upside down. |
37 ROTATE_270, // Rotate counter clockwise. | 42 ROTATE_270, // Rotate counter clockwise. |
38 MIRROR_ROTATE_0, // Mirror horizontally. | 43 MIRROR_ROTATE_0, // Mirror horizontally. |
39 MIRROR_ROTATE_90, // Mirror then Rotate clockwise. | 44 MIRROR_ROTATE_90, // Mirror then Rotate clockwise. |
40 MIRROR_ROTATE_180, // Mirror vertically. | 45 MIRROR_ROTATE_180, // Mirror vertically. |
(...skipping 14 matching lines...) Expand all Loading... | |
55 // Pass in YV16/YV12 depending on source format | 60 // Pass in YV16/YV12 depending on source format |
56 MEDIA_EXPORT void ConvertYUVToRGB32(const uint8* yplane, | 61 MEDIA_EXPORT void ConvertYUVToRGB32(const uint8* yplane, |
57 const uint8* uplane, | 62 const uint8* uplane, |
58 const uint8* vplane, | 63 const uint8* vplane, |
59 uint8* rgbframe, | 64 uint8* rgbframe, |
60 int width, | 65 int width, |
61 int height, | 66 int height, |
62 int ystride, | 67 int ystride, |
63 int uvstride, | 68 int uvstride, |
64 int rgbstride, | 69 int rgbstride, |
65 YUVType yuv_type); | 70 YUVType yuv_type, |
71 YUVRange yuv_range); | |
66 | 72 |
67 // Convert a frame of YUVA to 32 bit ARGB. | 73 // Convert a frame of YUVA to 32 bit ARGB. |
68 // Pass in YV12A | 74 // Pass in YV12A |
69 MEDIA_EXPORT void ConvertYUVAToARGB(const uint8* yplane, | 75 MEDIA_EXPORT void ConvertYUVAToARGB(const uint8* yplane, |
70 const uint8* uplane, | 76 const uint8* uplane, |
71 const uint8* vplane, | 77 const uint8* vplane, |
72 const uint8* aplane, | 78 const uint8* aplane, |
73 uint8* rgbframe, | 79 uint8* rgbframe, |
74 int width, | 80 int width, |
75 int height, | 81 int height, |
76 int ystride, | 82 int ystride, |
77 int uvstride, | 83 int uvstride, |
78 int astride, | 84 int astride, |
79 int rgbstride, | 85 int rgbstride, |
80 YUVType yuv_type); | 86 YUVType yuv_type, |
87 YUVRange yuv_range); | |
81 | 88 |
82 // Scale a frame of YUV to 32 bit ARGB. | 89 // Scale a frame of YUV to 32 bit ARGB. |
83 // Supports rotation and mirroring. | 90 // Supports rotation and mirroring. |
84 MEDIA_EXPORT void ScaleYUVToRGB32(const uint8* yplane, | 91 MEDIA_EXPORT void ScaleYUVToRGB32(const uint8* yplane, |
85 const uint8* uplane, | 92 const uint8* uplane, |
86 const uint8* vplane, | 93 const uint8* vplane, |
87 uint8* rgbframe, | 94 uint8* rgbframe, |
88 int source_width, | 95 int source_width, |
89 int source_height, | 96 int source_height, |
90 int width, | 97 int width, |
91 int height, | 98 int height, |
92 int ystride, | 99 int ystride, |
93 int uvstride, | 100 int uvstride, |
94 int rgbstride, | 101 int rgbstride, |
95 YUVType yuv_type, | 102 YUVType yuv_type, |
103 YUVRange yuv_range, | |
96 Rotate view_rotate, | 104 Rotate view_rotate, |
97 ScaleFilter filter); | 105 ScaleFilter filter); |
98 | 106 |
99 // Biliner Scale a frame of YV12 to 32 bits ARGB on a specified rectangle. | 107 // Biliner Scale a frame of YV12 to 32 bits ARGB on a specified rectangle. |
100 // |yplane|, etc and |rgbframe| should point to the top-left pixels of the | 108 // |yplane|, etc and |rgbframe| should point to the top-left pixels of the |
101 // source and destination buffers. | 109 // source and destination buffers. |
102 MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8* yplane, | 110 MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8* yplane, |
103 const uint8* uplane, | 111 const uint8* uplane, |
104 const uint8* vplane, | 112 const uint8* vplane, |
105 uint8* rgbframe, | 113 uint8* rgbframe, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 uint8* vplane, | 156 uint8* vplane, |
149 int width, | 157 int width, |
150 int height); | 158 int height); |
151 | 159 |
152 // Empty SIMD register state after calling optimized scaler functions. | 160 // Empty SIMD register state after calling optimized scaler functions. |
153 MEDIA_EXPORT void EmptyRegisterState(); | 161 MEDIA_EXPORT void EmptyRegisterState(); |
154 | 162 |
155 } // namespace media | 163 } // namespace media |
156 | 164 |
157 #endif // MEDIA_BASE_YUV_CONVERT_H_ | 165 #endif // MEDIA_BASE_YUV_CONVERT_H_ |
OLD | NEW |