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