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_SIMD_CONVERT_YUV_TO_RGB_H_ | 5 #ifndef MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
6 #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ | 6 #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 const uint8*, | 27 const uint8*, |
28 uint8*, | 28 uint8*, |
29 int, | 29 int, |
30 int, | 30 int, |
31 int, | 31 int, |
32 int, | 32 int, |
33 int, | 33 int, |
34 int, | 34 int, |
35 YUVType); | 35 YUVType); |
36 | 36 |
37 void ConvertYUVToRGB32_C(const uint8* yplane, | 37 MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8* yplane, |
38 const uint8* uplane, | 38 const uint8* uplane, |
39 const uint8* vplane, | 39 const uint8* vplane, |
40 uint8* rgbframe, | 40 uint8* rgbframe, |
41 int width, | 41 int width, |
42 int height, | 42 int height, |
43 int ystride, | 43 int ystride, |
44 int uvstride, | 44 int uvstride, |
45 int rgbstride, | 45 int rgbstride, |
46 YUVType yuv_type); | 46 YUVType yuv_type); |
47 | 47 |
48 void ConvertYUVAToARGB_C(const uint8* yplane, | 48 MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane, |
49 const uint8* uplane, | 49 const uint8* uplane, |
50 const uint8* vplane, | 50 const uint8* vplane, |
51 const uint8* aplane, | 51 uint8* rgbframe, |
52 uint8* rgbframe, | 52 ptrdiff_t width); |
53 int width, | |
54 int height, | |
55 int ystride, | |
56 int uvstride, | |
57 int avstride, | |
58 int rgbstride, | |
59 YUVType yuv_type); | |
60 | 53 |
61 void ConvertYUVToRGB32_SSE(const uint8* yplane, | 54 MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane, |
62 const uint8* uplane, | 55 const uint8* uplane, |
63 const uint8* vplane, | 56 const uint8* vplane, |
64 uint8* rgbframe, | 57 const uint8* aplane, |
65 int width, | 58 uint8* rgbframe, |
66 int height, | 59 int width, |
67 int ystride, | 60 int height, |
68 int uvstride, | 61 int ystride, |
69 int rgbstride, | 62 int uvstride, |
70 YUVType yuv_type); | 63 int avstride, |
| 64 int rgbstride, |
| 65 YUVType yuv_type); |
71 | 66 |
72 void ConvertYUVToRGB32_MMX(const uint8* yplane, | 67 MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane, |
73 const uint8* uplane, | 68 const uint8* uplane, |
74 const uint8* vplane, | 69 const uint8* vplane, |
75 uint8* rgbframe, | 70 const uint8* aplane, |
76 int width, | 71 uint8* rgbframe, |
77 int height, | 72 ptrdiff_t width); |
78 int ystride, | |
79 int uvstride, | |
80 int rgbstride, | |
81 YUVType yuv_type); | |
82 | 73 |
83 void ConvertYUVAToARGB_MMX(const uint8* yplane, | 74 MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, |
84 const uint8* uplane, | 75 const uint8* uplane, |
85 const uint8* vplane, | 76 const uint8* vplane, |
86 const uint8* aplane, | 77 uint8* rgbframe, |
87 uint8* rgbframe, | 78 int width, |
88 int width, | 79 int height, |
89 int height, | 80 int ystride, |
90 int ystride, | 81 int uvstride, |
91 int uvstride, | 82 int rgbstride, |
92 int avstride, | 83 YUVType yuv_type); |
93 int rgbstride, | 84 |
94 YUVType yuv_type); | 85 MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8* yplane, |
| 86 const uint8* uplane, |
| 87 const uint8* vplane, |
| 88 uint8* rgbframe, |
| 89 int width, |
| 90 int height, |
| 91 int ystride, |
| 92 int uvstride, |
| 93 int rgbstride, |
| 94 YUVType yuv_type); |
| 95 |
| 96 MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane, |
| 97 const uint8* uplane, |
| 98 const uint8* vplane, |
| 99 const uint8* aplane, |
| 100 uint8* rgbframe, |
| 101 int width, |
| 102 int height, |
| 103 int ystride, |
| 104 int uvstride, |
| 105 int avstride, |
| 106 int rgbstride, |
| 107 YUVType yuv_type); |
| 108 |
| 109 MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf, |
| 110 const uint8* u_buf, |
| 111 const uint8* v_buf, |
| 112 uint8* rgb_buf, |
| 113 ptrdiff_t width, |
| 114 ptrdiff_t source_dx); |
| 115 |
| 116 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, |
| 117 const uint8* u_buf, |
| 118 const uint8* v_buf, |
| 119 uint8* rgb_buf, |
| 120 ptrdiff_t width, |
| 121 ptrdiff_t source_dx); |
| 122 |
| 123 MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, |
| 124 const uint8* u_buf, |
| 125 const uint8* v_buf, |
| 126 uint8* rgb_buf, |
| 127 int dest_width, |
| 128 int source_x, |
| 129 int source_dx); |
95 | 130 |
96 } // namespace media | 131 } // namespace media |
97 | 132 |
98 // Assembly functions are declared without namespace. | 133 // Assembly functions are declared without namespace. |
99 extern "C" { | 134 extern "C" { |
100 | 135 |
101 // We use ptrdiff_t instead of int for yasm routine parameters to portably | 136 // We use ptrdiff_t instead of int for yasm routine parameters to portably |
102 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack | 137 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack |
103 // home of int function parameters, and yasm routines are unaware of this lack | 138 // home of int function parameters, and yasm routines are unaware of this lack |
104 // of extension and fault. ptrdiff_t is portably sign-extended and fixes this | 139 // of extension and fault. ptrdiff_t is portably sign-extended and fixes this |
105 // issue on at least Win64. The C-equivalent RowProc versions' prototypes | 140 // issue on at least Win64. The C-equivalent RowProc versions' prototypes |
106 // include the same change to ptrdiff_t to reuse the typedefs. | 141 // include the same change to ptrdiff_t to reuse the typedefs. |
107 | 142 |
108 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, | 143 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, |
109 const uint8*, | 144 const uint8*, |
110 const uint8*, | 145 const uint8*, |
111 uint8*, | 146 uint8*, |
112 ptrdiff_t); | 147 ptrdiff_t); |
113 | 148 |
114 typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, | 149 typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, |
115 const uint8*, | 150 const uint8*, |
116 const uint8*, | 151 const uint8*, |
117 const uint8*, | 152 const uint8*, |
118 uint8*, | 153 uint8*, |
119 ptrdiff_t); | 154 ptrdiff_t); |
120 | 155 |
121 typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, | 156 typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, |
122 const uint8*, | 157 const uint8*, |
123 const uint8*, | 158 const uint8*, |
124 uint8*, | 159 uint8*, |
125 ptrdiff_t, | 160 ptrdiff_t, |
126 ptrdiff_t); | 161 ptrdiff_t); |
127 | 162 |
128 void ConvertYUVToRGB32Row_C(const uint8* yplane, | 163 MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane, |
129 const uint8* uplane, | 164 const uint8* uplane, |
130 const uint8* vplane, | 165 const uint8* vplane, |
131 uint8* rgbframe, | 166 uint8* rgbframe, |
132 ptrdiff_t width); | 167 ptrdiff_t width); |
133 | 168 |
134 void ConvertYUVAToARGBRow_C(const uint8* yplane, | 169 MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane, |
135 const uint8* uplane, | 170 const uint8* uplane, |
136 const uint8* vplane, | 171 const uint8* vplane, |
137 const uint8* aplane, | 172 const uint8* aplane, |
138 uint8* rgbframe, | 173 uint8* rgbframe, |
139 ptrdiff_t width); | 174 ptrdiff_t width); |
140 | 175 |
141 void ConvertYUVToRGB32Row_MMX(const uint8* yplane, | 176 MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane, |
142 const uint8* uplane, | 177 const uint8* uplane, |
143 const uint8* vplane, | 178 const uint8* vplane, |
144 uint8* rgbframe, | 179 uint8* rgbframe, |
145 ptrdiff_t width); | 180 ptrdiff_t width); |
146 | 181 |
147 void ConvertYUVAToARGBRow_MMX(const uint8* yplane, | 182 MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf, |
148 const uint8* uplane, | |
149 const uint8* vplane, | |
150 const uint8* aplane, | |
151 uint8* rgbframe, | |
152 ptrdiff_t width); | |
153 | |
154 void ConvertYUVToRGB32Row_SSE(const uint8* yplane, | |
155 const uint8* uplane, | |
156 const uint8* vplane, | |
157 uint8* rgbframe, | |
158 ptrdiff_t width); | |
159 | |
160 void ScaleYUVToRGB32Row_C(const uint8* y_buf, | |
161 const uint8* u_buf, | |
162 const uint8* v_buf, | |
163 uint8* rgb_buf, | |
164 ptrdiff_t width, | |
165 ptrdiff_t source_dx); | |
166 | |
167 void ScaleYUVToRGB32Row_MMX(const uint8* y_buf, | |
168 const uint8* u_buf, | |
169 const uint8* v_buf, | |
170 uint8* rgb_buf, | |
171 ptrdiff_t width, | |
172 ptrdiff_t source_dx); | |
173 | |
174 void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, | |
175 const uint8* u_buf, | |
176 const uint8* v_buf, | |
177 uint8* rgb_buf, | |
178 ptrdiff_t width, | |
179 ptrdiff_t source_dx); | |
180 | |
181 void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf, | |
182 const uint8* u_buf, | |
183 const uint8* v_buf, | |
184 uint8* rgb_buf, | |
185 ptrdiff_t width, | |
186 ptrdiff_t source_dx); | |
187 | |
188 void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, | |
189 const uint8* u_buf, | |
190 const uint8* v_buf, | |
191 uint8* rgb_buf, | |
192 ptrdiff_t width, | |
193 ptrdiff_t source_dx); | |
194 | |
195 void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf, | |
196 const uint8* u_buf, | 183 const uint8* u_buf, |
197 const uint8* v_buf, | 184 const uint8* v_buf, |
198 uint8* rgb_buf, | 185 uint8* rgb_buf, |
199 int dest_width, | 186 ptrdiff_t width, |
200 int source_x, | 187 ptrdiff_t source_dx); |
201 int source_dx); | |
202 | 188 |
203 void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf, | 189 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, |
204 const uint8* u_buf, | 190 const uint8* u_buf, |
205 const uint8* v_buf, | 191 const uint8* v_buf, |
206 uint8* rgb_buf, | 192 uint8* rgb_buf, |
207 ptrdiff_t width, | 193 ptrdiff_t width, |
208 ptrdiff_t source_dx); | 194 ptrdiff_t source_dx); |
209 | 195 |
210 void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, | 196 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf, |
211 const uint8* u_buf, | 197 const uint8* u_buf, |
212 const uint8* v_buf, | 198 const uint8* v_buf, |
213 uint8* rgb_buf, | 199 uint8* rgb_buf, |
214 ptrdiff_t width, | 200 ptrdiff_t width, |
215 ptrdiff_t source_dx); | 201 ptrdiff_t source_dx); |
216 | 202 |
217 void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, | 203 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf, |
218 const uint8* u_buf, | 204 const uint8* u_buf, |
219 const uint8* v_buf, | 205 const uint8* v_buf, |
220 uint8* rgb_buf, | 206 uint8* rgb_buf, |
221 ptrdiff_t width, | 207 ptrdiff_t width, |
222 ptrdiff_t source_dx); | 208 ptrdiff_t source_dx); |
| 209 |
| 210 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, |
| 211 const uint8* u_buf, |
| 212 const uint8* v_buf, |
| 213 uint8* rgb_buf, |
| 214 ptrdiff_t width, |
| 215 ptrdiff_t source_dx); |
| 216 |
| 217 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, |
| 218 const uint8* u_buf, |
| 219 const uint8* v_buf, |
| 220 uint8* rgb_buf, |
| 221 ptrdiff_t width, |
| 222 ptrdiff_t source_dx); |
223 | 223 |
224 } // extern "C" | 224 } // extern "C" |
225 | 225 |
226 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ | 226 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
OLD | NEW |