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
18namespace libyuv {
19extern "C" {
20#endif
21
22// See Also convert.h for conversions from formats to I420.
23
24// I420Copy in convert to I420ToI420.
25
26LIBYUV_API
27int 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
35LIBYUV_API
36int 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
44LIBYUV_API
45int 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.
54LIBYUV_API
55int 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): I420ToNV12
60// TODO(fbarchard): I420ToM420
61// TODO(fbarchard): I420ToQ420
62
63LIBYUV_API
64int I420ToYUY2(const uint8* src_y, int src_stride_y,
65               const uint8* src_u, int src_stride_u,
66               const uint8* src_v, int src_stride_v,
67               uint8* dst_frame, int dst_stride_frame,
68               int width, int height);
69
70LIBYUV_API
71int I420ToUYVY(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_frame, int dst_stride_frame,
75               int width, int height);
76
77LIBYUV_API
78int I420ToV210(const uint8* src_y, int src_stride_y,
79               const uint8* src_u, int src_stride_u,
80               const uint8* src_v, int src_stride_v,
81               uint8* dst_frame, int dst_stride_frame,
82               int width, int height);
83
84LIBYUV_API
85int I420ToARGB(const uint8* src_y, int src_stride_y,
86               const uint8* src_u, int src_stride_u,
87               const uint8* src_v, int src_stride_v,
88               uint8* dst_argb, int dst_stride_argb,
89               int width, int height);
90
91LIBYUV_API
92int I420ToBGRA(const uint8* src_y, int src_stride_y,
93               const uint8* src_u, int src_stride_u,
94               const uint8* src_v, int src_stride_v,
95               uint8* dst_argb, int dst_stride_argb,
96               int width, int height);
97
98LIBYUV_API
99int I420ToABGR(const uint8* src_y, int src_stride_y,
100               const uint8* src_u, int src_stride_u,
101               const uint8* src_v, int src_stride_v,
102               uint8* dst_argb, int dst_stride_argb,
103               int width, int height);
104
105LIBYUV_API
106int I420ToRGBA(const uint8* src_y, int src_stride_y,
107               const uint8* src_u, int src_stride_u,
108               const uint8* src_v, int src_stride_v,
109               uint8* dst_rgba, int dst_stride_rgba,
110               int width, int height);
111
112LIBYUV_API
113int I420ToRGB24(const uint8* src_y, int src_stride_y,
114                const uint8* src_u, int src_stride_u,
115                const uint8* src_v, int src_stride_v,
116                uint8* dst_frame, int dst_stride_frame,
117                int width, int height);
118
119LIBYUV_API
120int I420ToRAW(const uint8* src_y, int src_stride_y,
121              const uint8* src_u, int src_stride_u,
122              const uint8* src_v, int src_stride_v,
123              uint8* dst_frame, int dst_stride_frame,
124              int width, int height);
125
126LIBYUV_API
127int I420ToRGB565(const uint8* src_y, int src_stride_y,
128                 const uint8* src_u, int src_stride_u,
129                 const uint8* src_v, int src_stride_v,
130                 uint8* dst_frame, int dst_stride_frame,
131                 int width, int height);
132
133LIBYUV_API
134int I420ToARGB1555(const uint8* src_y, int src_stride_y,
135                   const uint8* src_u, int src_stride_u,
136                   const uint8* src_v, int src_stride_v,
137                   uint8* dst_frame, int dst_stride_frame,
138                   int width, int height);
139
140LIBYUV_API
141int I420ToARGB4444(const uint8* src_y, int src_stride_y,
142                   const uint8* src_u, int src_stride_u,
143                   const uint8* src_v, int src_stride_v,
144                   uint8* dst_frame, int dst_stride_frame,
145                   int width, int height);
146
147// Note Bayer formats (BGGR) To I420 are in format_conversion.h.
148
149// Convert I420 to specified format.
150// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
151//    buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
152LIBYUV_API
153int ConvertFromI420(const uint8* y, int y_stride,
154                    const uint8* u, int u_stride,
155                    const uint8* v, int v_stride,
156                    uint8* dst_sample, int dst_sample_stride,
157                    int width, int height,
158                    uint32 format);
159
160#ifdef __cplusplus
161}  // extern "C"
162}  // namespace libyuv
163#endif
164
165#endif  // INCLUDE_LIBYUV_CONVERT_FROM_H_  NOLINT
166