• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2011 The LibYuv Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS. All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef INCLUDE_LIBYUV_CONVERT_FROM_H_  // NOLINT
12 #define INCLUDE_LIBYUV_CONVERT_FROM_H_
13 
14 #include "libyuv/basic_types.h"
15 #include "libyuv/rotate.h"
16 
17 #ifdef __cplusplus
18 namespace libyuv {
19 extern "C" {
20 #endif
21 
22 // See Also convert.h for conversions from formats to I420.
23 
24 // I420Copy in convert to I420ToI420.
25 
26 LIBYUV_API
27 int I420ToI422(const uint8* src_y, int src_stride_y,
28                const uint8* src_u, int src_stride_u,
29                const uint8* src_v, int src_stride_v,
30                uint8* dst_y, int dst_stride_y,
31                uint8* dst_u, int dst_stride_u,
32                uint8* dst_v, int dst_stride_v,
33                int width, int height);
34 
35 LIBYUV_API
36 int I420ToI444(const uint8* src_y, int src_stride_y,
37                const uint8* src_u, int src_stride_u,
38                const uint8* src_v, int src_stride_v,
39                uint8* dst_y, int dst_stride_y,
40                uint8* dst_u, int dst_stride_u,
41                uint8* dst_v, int dst_stride_v,
42                int width, int height);
43 
44 LIBYUV_API
45 int I420ToI411(const uint8* src_y, int src_stride_y,
46                const uint8* src_u, int src_stride_u,
47                const uint8* src_v, int src_stride_v,
48                uint8* dst_y, int dst_stride_y,
49                uint8* dst_u, int dst_stride_u,
50                uint8* dst_v, int dst_stride_v,
51                int width, int height);
52 
53 // Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21.
54 LIBYUV_API
55 int I400Copy(const uint8* src_y, int src_stride_y,
56              uint8* dst_y, int dst_stride_y,
57              int width, int height);
58 
59 // TODO(fbarchard): I420ToM420
60 // TODO(fbarchard): I420ToQ420
61 
62 LIBYUV_API
63 int I420ToNV12(const uint8* src_y, int src_stride_y,
64                const uint8* src_u, int src_stride_u,
65                const uint8* src_v, int src_stride_v,
66                uint8* dst_y, int dst_stride_y,
67                uint8* dst_uv, int dst_stride_uv,
68                int width, int height);
69 
70 LIBYUV_API
71 int I420ToNV21(const uint8* src_y, int src_stride_y,
72                const uint8* src_u, int src_stride_u,
73                const uint8* src_v, int src_stride_v,
74                uint8* dst_y, int dst_stride_y,
75                uint8* dst_vu, int dst_stride_vu,
76                int width, int height);
77 
78 LIBYUV_API
79 int I420ToYUY2(const uint8* src_y, int src_stride_y,
80                const uint8* src_u, int src_stride_u,
81                const uint8* src_v, int src_stride_v,
82                uint8* dst_frame, int dst_stride_frame,
83                int width, int height);
84 
85 LIBYUV_API
86 int I420ToUYVY(const uint8* src_y, int src_stride_y,
87                const uint8* src_u, int src_stride_u,
88                const uint8* src_v, int src_stride_v,
89                uint8* dst_frame, int dst_stride_frame,
90                int width, int height);
91 
92 LIBYUV_API
93 int I420ToARGB(const uint8* src_y, int src_stride_y,
94                const uint8* src_u, int src_stride_u,
95                const uint8* src_v, int src_stride_v,
96                uint8* dst_argb, int dst_stride_argb,
97                int width, int height);
98 
99 LIBYUV_API
100 int I420ToBGRA(const uint8* src_y, int src_stride_y,
101                const uint8* src_u, int src_stride_u,
102                const uint8* src_v, int src_stride_v,
103                uint8* dst_argb, int dst_stride_argb,
104                int width, int height);
105 
106 LIBYUV_API
107 int I420ToABGR(const uint8* src_y, int src_stride_y,
108                const uint8* src_u, int src_stride_u,
109                const uint8* src_v, int src_stride_v,
110                uint8* dst_argb, int dst_stride_argb,
111                int width, int height);
112 
113 LIBYUV_API
114 int I420ToRGBA(const uint8* src_y, int src_stride_y,
115                const uint8* src_u, int src_stride_u,
116                const uint8* src_v, int src_stride_v,
117                uint8* dst_rgba, int dst_stride_rgba,
118                int width, int height);
119 
120 LIBYUV_API
121 int I420ToRGB24(const uint8* src_y, int src_stride_y,
122                 const uint8* src_u, int src_stride_u,
123                 const uint8* src_v, int src_stride_v,
124                 uint8* dst_frame, int dst_stride_frame,
125                 int width, int height);
126 
127 LIBYUV_API
128 int I420ToRAW(const uint8* src_y, int src_stride_y,
129               const uint8* src_u, int src_stride_u,
130               const uint8* src_v, int src_stride_v,
131               uint8* dst_frame, int dst_stride_frame,
132               int width, int height);
133 
134 LIBYUV_API
135 int I420ToRGB565(const uint8* src_y, int src_stride_y,
136                  const uint8* src_u, int src_stride_u,
137                  const uint8* src_v, int src_stride_v,
138                  uint8* dst_frame, int dst_stride_frame,
139                  int width, int height);
140 
141 LIBYUV_API
142 int I420ToARGB1555(const uint8* src_y, int src_stride_y,
143                    const uint8* src_u, int src_stride_u,
144                    const uint8* src_v, int src_stride_v,
145                    uint8* dst_frame, int dst_stride_frame,
146                    int width, int height);
147 
148 LIBYUV_API
149 int I420ToARGB4444(const uint8* src_y, int src_stride_y,
150                    const uint8* src_u, int src_stride_u,
151                    const uint8* src_v, int src_stride_v,
152                    uint8* dst_frame, int dst_stride_frame,
153                    int width, int height);
154 
155 // Note Bayer formats (BGGR) To I420 are in format_conversion.h.
156 
157 // Convert I420 to specified format.
158 // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
159 //    buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
160 LIBYUV_API
161 int ConvertFromI420(const uint8* y, int y_stride,
162                     const uint8* u, int u_stride,
163                     const uint8* v, int v_stride,
164                     uint8* dst_sample, int dst_sample_stride,
165                     int width, int height,
166                     uint32 format);
167 
168 #ifdef __cplusplus
169 }  // extern "C"
170 }  // namespace libyuv
171 #endif
172 
173 #endif  // INCLUDE_LIBYUV_CONVERT_FROM_H_  NOLINT
174