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 |
11 namespace media { | 11 namespace media { |
12 | 12 |
13 typedef void (*ConvertYUVToRGB32Proc)(const uint8*, | 13 typedef void (*ConvertYUVToRGB32Proc)(const uint8*, |
14 const uint8*, | 14 const uint8*, |
15 const uint8*, | 15 const uint8*, |
16 uint8*, | 16 uint8*, |
17 int, | 17 int, |
18 int, | 18 int, |
19 int, | 19 int, |
20 int, | 20 int, |
21 int, | 21 int, |
22 YUVType); | 22 YUVType); |
23 | 23 |
| 24 typedef void (*ConvertYUVAToARGBProc)(const uint8*, |
| 25 const uint8*, |
| 26 const uint8*, |
| 27 const uint8*, |
| 28 uint8*, |
| 29 int, |
| 30 int, |
| 31 int, |
| 32 int, |
| 33 int, |
| 34 int, |
| 35 YUVType); |
| 36 |
24 void ConvertYUVToRGB32_C(const uint8* yplane, | 37 void ConvertYUVToRGB32_C(const uint8* yplane, |
25 const uint8* uplane, | 38 const uint8* uplane, |
26 const uint8* vplane, | 39 const uint8* vplane, |
27 uint8* rgbframe, | 40 uint8* rgbframe, |
28 int width, | 41 int width, |
29 int height, | 42 int height, |
30 int ystride, | 43 int ystride, |
31 int uvstride, | 44 int uvstride, |
32 int rgbstride, | 45 int rgbstride, |
33 YUVType yuv_type); | 46 YUVType yuv_type); |
34 | 47 |
| 48 void ConvertYUVAToARGB_C(const uint8* yplane, |
| 49 const uint8* uplane, |
| 50 const uint8* vplane, |
| 51 const uint8* aplane, |
| 52 uint8* rgbframe, |
| 53 int width, |
| 54 int height, |
| 55 int ystride, |
| 56 int uvstride, |
| 57 int avstride, |
| 58 int rgbstride, |
| 59 YUVType yuv_type); |
| 60 |
35 void ConvertYUVToRGB32_SSE(const uint8* yplane, | 61 void ConvertYUVToRGB32_SSE(const uint8* yplane, |
36 const uint8* uplane, | 62 const uint8* uplane, |
37 const uint8* vplane, | 63 const uint8* vplane, |
38 uint8* rgbframe, | 64 uint8* rgbframe, |
39 int width, | 65 int width, |
40 int height, | 66 int height, |
41 int ystride, | 67 int ystride, |
42 int uvstride, | 68 int uvstride, |
43 int rgbstride, | 69 int rgbstride, |
44 YUVType yuv_type); | 70 YUVType yuv_type); |
45 | 71 |
46 void ConvertYUVToRGB32_MMX(const uint8* yplane, | 72 void ConvertYUVToRGB32_MMX(const uint8* yplane, |
47 const uint8* uplane, | 73 const uint8* uplane, |
48 const uint8* vplane, | 74 const uint8* vplane, |
49 uint8* rgbframe, | 75 uint8* rgbframe, |
50 int width, | 76 int width, |
51 int height, | 77 int height, |
52 int ystride, | 78 int ystride, |
53 int uvstride, | 79 int uvstride, |
54 int rgbstride, | 80 int rgbstride, |
55 YUVType yuv_type); | 81 YUVType yuv_type); |
56 | 82 |
| 83 void ConvertYUVAToARGB_MMX(const uint8* yplane, |
| 84 const uint8* uplane, |
| 85 const uint8* vplane, |
| 86 const uint8* aplane, |
| 87 uint8* rgbframe, |
| 88 int width, |
| 89 int height, |
| 90 int ystride, |
| 91 int uvstride, |
| 92 int avstride, |
| 93 int rgbstride, |
| 94 YUVType yuv_type); |
| 95 |
57 } // namespace media | 96 } // namespace media |
58 | 97 |
59 // Assembly functions are declared without namespace. | 98 // Assembly functions are declared without namespace. |
60 extern "C" { | 99 extern "C" { |
61 | 100 |
62 // We use ptrdiff_t instead of int for yasm routine parameters to portably | 101 // We use ptrdiff_t instead of int for yasm routine parameters to portably |
63 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack | 102 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack |
64 // home of int function parameters, and yasm routines are unaware of this lack | 103 // home of int function parameters, and yasm routines are unaware of this lack |
65 // of extension and fault. ptrdiff_t is portably sign-extended and fixes this | 104 // of extension and fault. ptrdiff_t is portably sign-extended and fixes this |
66 // issue on at least Win64. The C-equivalent RowProc versions' prototypes | 105 // issue on at least Win64. The C-equivalent RowProc versions' prototypes |
67 // include the same change to ptrdiff_t to reuse the typedefs. | 106 // include the same change to ptrdiff_t to reuse the typedefs. |
68 | 107 |
69 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, | 108 typedef void (*ConvertYUVToRGB32RowProc)(const uint8*, |
70 const uint8*, | 109 const uint8*, |
71 const uint8*, | 110 const uint8*, |
72 uint8*, | 111 uint8*, |
73 ptrdiff_t); | 112 ptrdiff_t); |
74 | 113 |
| 114 typedef void (*ConvertYUVAToARGBRowProc)(const uint8*, |
| 115 const uint8*, |
| 116 const uint8*, |
| 117 const uint8*, |
| 118 uint8*, |
| 119 ptrdiff_t); |
| 120 |
75 typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, | 121 typedef void (*ScaleYUVToRGB32RowProc)(const uint8*, |
76 const uint8*, | 122 const uint8*, |
77 const uint8*, | 123 const uint8*, |
78 uint8*, | 124 uint8*, |
79 ptrdiff_t, | 125 ptrdiff_t, |
80 ptrdiff_t); | 126 ptrdiff_t); |
81 | 127 |
82 void ConvertYUVToRGB32Row_C(const uint8* yplane, | 128 void ConvertYUVToRGB32Row_C(const uint8* yplane, |
83 const uint8* uplane, | 129 const uint8* uplane, |
84 const uint8* vplane, | 130 const uint8* vplane, |
85 uint8* rgbframe, | 131 uint8* rgbframe, |
86 ptrdiff_t width); | 132 ptrdiff_t width); |
87 | 133 |
| 134 void ConvertYUVAToARGBRow_C(const uint8* yplane, |
| 135 const uint8* uplane, |
| 136 const uint8* vplane, |
| 137 const uint8* aplane, |
| 138 uint8* rgbframe, |
| 139 ptrdiff_t width); |
| 140 |
88 void ConvertYUVToRGB32Row_MMX(const uint8* yplane, | 141 void ConvertYUVToRGB32Row_MMX(const uint8* yplane, |
89 const uint8* uplane, | 142 const uint8* uplane, |
90 const uint8* vplane, | 143 const uint8* vplane, |
91 uint8* rgbframe, | 144 uint8* rgbframe, |
92 ptrdiff_t width); | 145 ptrdiff_t width); |
93 | 146 |
| 147 void ConvertYUVAToARGBRow_MMX(const uint8* yplane, |
| 148 const uint8* uplane, |
| 149 const uint8* vplane, |
| 150 const uint8* aplane, |
| 151 uint8* rgbframe, |
| 152 ptrdiff_t width); |
| 153 |
94 void ConvertYUVToRGB32Row_SSE(const uint8* yplane, | 154 void ConvertYUVToRGB32Row_SSE(const uint8* yplane, |
95 const uint8* uplane, | 155 const uint8* uplane, |
96 const uint8* vplane, | 156 const uint8* vplane, |
97 uint8* rgbframe, | 157 uint8* rgbframe, |
98 ptrdiff_t width); | 158 ptrdiff_t width); |
99 | 159 |
100 void ScaleYUVToRGB32Row_C(const uint8* y_buf, | 160 void ScaleYUVToRGB32Row_C(const uint8* y_buf, |
101 const uint8* u_buf, | 161 const uint8* u_buf, |
102 const uint8* v_buf, | 162 const uint8* v_buf, |
103 uint8* rgb_buf, | 163 uint8* rgb_buf, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, | 217 void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf, |
158 const uint8* u_buf, | 218 const uint8* u_buf, |
159 const uint8* v_buf, | 219 const uint8* v_buf, |
160 uint8* rgb_buf, | 220 uint8* rgb_buf, |
161 ptrdiff_t width, | 221 ptrdiff_t width, |
162 ptrdiff_t source_dx); | 222 ptrdiff_t source_dx); |
163 | 223 |
164 } // extern "C" | 224 } // extern "C" |
165 | 225 |
166 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ | 226 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_ |
OLD | NEW |