convert_yuv_to_rgb.h revision 90dce4d38c5ff5333bea97d859d4e484e27edf0c
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
11namespace 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
16MEDIA_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
27MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane,
28                                         const uint8* uplane,
29                                         const uint8* vplane,
30                                         uint8* rgbframe,
31                                         ptrdiff_t width);
32
33MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane,
34                                      const uint8* uplane,
35                                      const uint8* vplane,
36                                      const uint8* aplane,
37                                      uint8* rgbframe,
38                                      int width,
39                                      int height,
40                                      int ystride,
41                                      int uvstride,
42                                      int avstride,
43                                      int rgbstride,
44                                      YUVType yuv_type);
45
46MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane,
47                                         const uint8* uplane,
48                                         const uint8* vplane,
49                                         const uint8* aplane,
50                                         uint8* rgbframe,
51                                         ptrdiff_t width);
52
53MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane,
54                                        const uint8* uplane,
55                                        const uint8* vplane,
56                                        uint8* rgbframe,
57                                        int width,
58                                        int height,
59                                        int ystride,
60                                        int uvstride,
61                                        int rgbstride,
62                                        YUVType yuv_type);
63
64MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8* yplane,
65                                        const uint8* uplane,
66                                        const uint8* vplane,
67                                        uint8* rgbframe,
68                                        int width,
69                                        int height,
70                                        int ystride,
71                                        int uvstride,
72                                        int rgbstride,
73                                        YUVType yuv_type);
74
75MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane,
76                                        const uint8* uplane,
77                                        const uint8* vplane,
78                                        const uint8* aplane,
79                                        uint8* rgbframe,
80                                        int width,
81                                        int height,
82                                        int ystride,
83                                        int uvstride,
84                                        int avstride,
85                                        int rgbstride,
86                                        YUVType yuv_type);
87
88MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf,
89                                       const uint8* u_buf,
90                                       const uint8* v_buf,
91                                       uint8* rgb_buf,
92                                       ptrdiff_t width,
93                                       ptrdiff_t source_dx);
94
95MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
96                                             const uint8* u_buf,
97                                             const uint8* v_buf,
98                                             uint8* rgb_buf,
99                                             ptrdiff_t width,
100                                             ptrdiff_t source_dx);
101
102MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf,
103                                                      const uint8* u_buf,
104                                                      const uint8* v_buf,
105                                                      uint8* rgb_buf,
106                                                      int dest_width,
107                                                      int source_x,
108                                                      int source_dx);
109
110}  // namespace media
111
112// Assembly functions are declared without namespace.
113extern "C" {
114
115// We use ptrdiff_t instead of int for yasm routine parameters to portably
116// sign-extend int. On Win64, MSVC does not sign-extend the value in the stack
117// home of int function parameters, and yasm routines are unaware of this lack
118// of extension and fault.  ptrdiff_t is portably sign-extended and fixes this
119// issue on at least Win64.  The C-equivalent RowProc versions' prototypes
120// include the same change to ptrdiff_t to reuse the typedefs.
121
122MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane,
123                                           const uint8* uplane,
124                                           const uint8* vplane,
125                                           uint8* rgbframe,
126                                           ptrdiff_t width);
127
128MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
129                                           const uint8* uplane,
130                                           const uint8* vplane,
131                                           const uint8* aplane,
132                                           uint8* rgbframe,
133                                           ptrdiff_t width);
134
135MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
136                                           const uint8* uplane,
137                                           const uint8* vplane,
138                                           uint8* rgbframe,
139                                           ptrdiff_t width);
140
141MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf,
142                                         const uint8* u_buf,
143                                         const uint8* v_buf,
144                                         uint8* rgb_buf,
145                                         ptrdiff_t width,
146                                         ptrdiff_t source_dx);
147
148MEDIA_EXPORT void ScaleYUVToRGB32Row_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
155MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
156                                              const uint8* u_buf,
157                                              const uint8* v_buf,
158                                              uint8* rgb_buf,
159                                              ptrdiff_t width,
160                                              ptrdiff_t source_dx);
161
162MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf,
163                                               const uint8* u_buf,
164                                               const uint8* v_buf,
165                                               uint8* rgb_buf,
166                                               ptrdiff_t width,
167                                               ptrdiff_t source_dx);
168
169MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf,
170                                               const uint8* u_buf,
171                                               const uint8* v_buf,
172                                               uint8* rgb_buf,
173                                               ptrdiff_t width,
174                                               ptrdiff_t source_dx);
175
176MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
177                                                   const uint8* u_buf,
178                                                   const uint8* v_buf,
179                                                   uint8* rgb_buf,
180                                                   ptrdiff_t width,
181                                                   ptrdiff_t source_dx);
182
183}  // extern "C"
184
185#endif  // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
186