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