Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / base / simd / convert_yuv_to_rgb.h
blob7feb0079c383e1f75db5f11501e03323939ccc88
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.
5 #ifndef MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
6 #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
8 #include "base/basictypes.h"
9 #include "media/base/yuv_convert.h"
11 namespace media {
13 // These methods are exported for testing purposes only. Library users should
14 // only call the methods listed in yuv_convert.h.
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);
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);
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);
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);
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);
66 MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane,
67 const uint8* uplane,
68 const uint8* vplane,
69 const uint8* aplane,
70 uint8* rgbframe,
71 int width,
72 int height,
73 int ystride,
74 int uvstride,
75 int avstride,
76 int rgbstride,
77 YUVType yuv_type);
79 MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf,
80 const uint8* u_buf,
81 const uint8* v_buf,
82 uint8* rgb_buf,
83 ptrdiff_t width,
84 ptrdiff_t source_dx,
85 const int16* convert_table);
87 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
88 const uint8* u_buf,
89 const uint8* v_buf,
90 uint8* rgb_buf,
91 ptrdiff_t width,
92 ptrdiff_t source_dx,
93 const int16* convert_table);
95 MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(
96 const uint8* y_buf,
97 const uint8* u_buf,
98 const uint8* v_buf,
99 uint8* rgb_buf,
100 int dest_width,
101 int source_x,
102 int source_dx,
103 const int16* convert_table);
105 } // namespace media
107 // Assembly functions are declared without namespace.
108 extern "C" {
110 // 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
112 // 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
114 // issue on at least Win64. The C-equivalent RowProc versions' prototypes
115 // include the same change to ptrdiff_t to reuse the typedefs.
117 MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
118 const uint8* uplane,
119 const uint8* vplane,
120 const uint8* aplane,
121 uint8* rgbframe,
122 ptrdiff_t width,
123 const int16* convert_table);
125 MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
126 const uint8* uplane,
127 const uint8* vplane,
128 uint8* rgbframe,
129 ptrdiff_t width,
130 const int16* convert_table);
132 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
133 const uint8* u_buf,
134 const uint8* v_buf,
135 uint8* rgb_buf,
136 ptrdiff_t width,
137 ptrdiff_t source_dx,
138 const int16* convert_table);
140 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
141 const uint8* u_buf,
142 const uint8* v_buf,
143 uint8* rgb_buf,
144 ptrdiff_t width,
145 ptrdiff_t source_dx,
146 const int16* convert_table);
148 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf,
149 const uint8* u_buf,
150 const uint8* v_buf,
151 uint8* rgb_buf,
152 ptrdiff_t width,
153 ptrdiff_t source_dx,
154 const int16* convert_table);
156 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
157 const uint8* u_buf,
158 const uint8* v_buf,
159 uint8* rgb_buf,
160 ptrdiff_t width,
161 ptrdiff_t source_dx,
162 const int16* convert_table);
164 } // extern "C"
166 #endif // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_