summaryrefslogtreecommitdiffstats
path: root/media/base/simd/convert_yuv_to_rgb.h
blob: d05f039977f68bf8ee54441246baf9e3f6270b29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
#define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_

#include "base/basictypes.h"
#include "media/base/yuv_convert.h"

namespace media {

typedef void (*ConvertYUVToRGB32Proc)(const uint8*,
                                      const uint8*,
                                      const uint8*,
                                      uint8*,
                                      int,
                                      int,
                                      int,
                                      int,
                                      int,
                                      YUVType);

void ConvertYUVToRGB32_C(const uint8* yplane,
                         const uint8* uplane,
                         const uint8* vplane,
                         uint8* rgbframe,
                         int width,
                         int height,
                         int ystride,
                         int uvstride,
                         int rgbstride,
                         YUVType yuv_type);

void ConvertYUVToRGB32_SSE(const uint8* yplane,
                           const uint8* uplane,
                           const uint8* vplane,
                           uint8* rgbframe,
                           int width,
                           int height,
                           int ystride,
                           int uvstride,
                           int rgbstride,
                           YUVType yuv_type);

void ConvertYUVToRGB32_MMX(const uint8* yplane,
                           const uint8* uplane,
                           const uint8* vplane,
                           uint8* rgbframe,
                           int width,
                           int height,
                           int ystride,
                           int uvstride,
                           int rgbstride,
                           YUVType yuv_type);

}  // namespace media

// Assembly functions are declared without namespace.
extern "C" {

// We use ptrdiff_t instead of int for yasm routine parameters to portably
// sign-extend int. On Win64, MSVC does not sign-extend the value in the stack
// home of int function parameters, and yasm routines are unaware of this lack
// of extension and fault.  ptrdiff_t is portably sign-extended and fixes this
// issue on at least Win64.  The C-equivalent RowProc versions' prototypes
// include the same change to ptrdiff_t to reuse the typedefs.

typedef void (*ConvertYUVToRGB32RowProc)(const uint8*,
                                          const uint8*,
                                          const uint8*,
                                          uint8*,
                                          ptrdiff_t);

typedef void (*ScaleYUVToRGB32RowProc)(const uint8*,
                                       const uint8*,
                                       const uint8*,
                                       uint8*,
                                       ptrdiff_t,
                                       ptrdiff_t);

void ConvertYUVToRGB32Row_C(const uint8* yplane,
                            const uint8* uplane,
                            const uint8* vplane,
                            uint8* rgbframe,
                            ptrdiff_t width);

void ConvertYUVToRGB32Row_MMX(const uint8* yplane,
                              const uint8* uplane,
                              const uint8* vplane,
                              uint8* rgbframe,
                              ptrdiff_t width);

void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
                              const uint8* uplane,
                              const uint8* vplane,
                              uint8* rgbframe,
                              ptrdiff_t width);

void ScaleYUVToRGB32Row_C(const uint8* y_buf,
                          const uint8* u_buf,
                          const uint8* v_buf,
                          uint8* rgb_buf,
                          ptrdiff_t width,
                          ptrdiff_t source_dx);

void ScaleYUVToRGB32Row_MMX(const uint8* y_buf,
                            const uint8* u_buf,
                            const uint8* v_buf,
                            uint8* rgb_buf,
                            ptrdiff_t width,
                            ptrdiff_t source_dx);

void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
                            const uint8* u_buf,
                            const uint8* v_buf,
                            uint8* rgb_buf,
                            ptrdiff_t width,
                            ptrdiff_t source_dx);

void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
                                 const uint8* u_buf,
                                 const uint8* v_buf,
                                 uint8* rgb_buf,
                                 ptrdiff_t width,
                                 ptrdiff_t source_dx);

void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
                                const uint8* u_buf,
                                const uint8* v_buf,
                                uint8* rgb_buf,
                                ptrdiff_t width,
                                ptrdiff_t source_dx);

void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf,
                                         const uint8* u_buf,
                                         const uint8* v_buf,
                                         uint8* rgb_buf,
                                         int dest_width,
                                         int source_x,
                                         int source_dx);

void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf,
                                  const uint8* u_buf,
                                  const uint8* v_buf,
                                  uint8* rgb_buf,
                                  ptrdiff_t width,
                                  ptrdiff_t source_dx);

void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf,
                                  const uint8* u_buf,
                                  const uint8* v_buf,
                                  uint8* rgb_buf,
                                  ptrdiff_t width,
                                  ptrdiff_t source_dx);

void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
                                      const uint8* u_buf,
                                      const uint8* v_buf,
                                      uint8* rgb_buf,
                                      ptrdiff_t width,
                                      ptrdiff_t source_dx);

}  // extern "C"

#endif  // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_