1/*
2 *  Copyright 2012 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_ARGB_H_  // NOLINT
12#define INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_
13
14#include "libyuv/basic_types.h"
15
16#ifdef __cplusplus
17namespace libyuv {
18extern "C" {
19#endif
20
21// Copy ARGB to ARGB.
22#define ARGBToARGB ARGBCopy
23LIBYUV_API
24int ARGBCopy(const uint8* src_argb, int src_stride_argb,
25             uint8* dst_argb, int dst_stride_argb,
26             int width, int height);
27
28// Convert ARGB To BGRA.
29LIBYUV_API
30int ARGBToBGRA(const uint8* src_argb, int src_stride_argb,
31               uint8* dst_bgra, int dst_stride_bgra,
32               int width, int height);
33
34// Convert ARGB To ABGR.
35LIBYUV_API
36int ARGBToABGR(const uint8* src_argb, int src_stride_argb,
37               uint8* dst_abgr, int dst_stride_abgr,
38               int width, int height);
39
40// Convert ARGB To RGBA.
41LIBYUV_API
42int ARGBToRGBA(const uint8* src_argb, int src_stride_argb,
43               uint8* dst_rgba, int dst_stride_rgba,
44               int width, int height);
45
46// Convert ARGB To RGB24.
47LIBYUV_API
48int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
49                uint8* dst_rgb24, int dst_stride_rgb24,
50                int width, int height);
51
52// Convert ARGB To RAW.
53LIBYUV_API
54int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
55              uint8* dst_rgb, int dst_stride_rgb,
56              int width, int height);
57
58// Convert ARGB To RGB565.
59LIBYUV_API
60int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
61                 uint8* dst_rgb565, int dst_stride_rgb565,
62                 int width, int height);
63
64// Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes).
65// Values in dither matrix from 0 to 7 recommended.
66// The order of the dither matrix is first byte is upper left.
67// TODO(fbarchard): Consider pointer to 2d array for dither4x4.
68// const uint8(*dither)[4][4];
69LIBYUV_API
70int ARGBToRGB565Dither(const uint8* src_argb, int src_stride_argb,
71                       uint8* dst_rgb565, int dst_stride_rgb565,
72                       const uint8* dither4x4, int width, int height);
73
74// Convert ARGB To ARGB1555.
75LIBYUV_API
76int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
77                   uint8* dst_argb1555, int dst_stride_argb1555,
78                   int width, int height);
79
80// Convert ARGB To ARGB4444.
81LIBYUV_API
82int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
83                   uint8* dst_argb4444, int dst_stride_argb4444,
84                   int width, int height);
85
86// Convert ARGB To I444.
87LIBYUV_API
88int ARGBToI444(const uint8* src_argb, int src_stride_argb,
89               uint8* dst_y, int dst_stride_y,
90               uint8* dst_u, int dst_stride_u,
91               uint8* dst_v, int dst_stride_v,
92               int width, int height);
93
94// Convert ARGB To I422.
95LIBYUV_API
96int ARGBToI422(const uint8* src_argb, int src_stride_argb,
97               uint8* dst_y, int dst_stride_y,
98               uint8* dst_u, int dst_stride_u,
99               uint8* dst_v, int dst_stride_v,
100               int width, int height);
101
102// Convert ARGB To I420. (also in convert.h)
103LIBYUV_API
104int ARGBToI420(const uint8* src_argb, int src_stride_argb,
105               uint8* dst_y, int dst_stride_y,
106               uint8* dst_u, int dst_stride_u,
107               uint8* dst_v, int dst_stride_v,
108               int width, int height);
109
110// Convert ARGB to J420. (JPeg full range I420).
111LIBYUV_API
112int ARGBToJ420(const uint8* src_argb, int src_stride_argb,
113               uint8* dst_yj, int dst_stride_yj,
114               uint8* dst_u, int dst_stride_u,
115               uint8* dst_v, int dst_stride_v,
116               int width, int height);
117
118// Convert ARGB to J422.
119LIBYUV_API
120int ARGBToJ422(const uint8* src_argb, int src_stride_argb,
121               uint8* dst_yj, int dst_stride_yj,
122               uint8* dst_u, int dst_stride_u,
123               uint8* dst_v, int dst_stride_v,
124               int width, int height);
125
126// Convert ARGB To I411.
127LIBYUV_API
128int ARGBToI411(const uint8* src_argb, int src_stride_argb,
129               uint8* dst_y, int dst_stride_y,
130               uint8* dst_u, int dst_stride_u,
131               uint8* dst_v, int dst_stride_v,
132               int width, int height);
133
134// Convert ARGB to J400. (JPeg full range).
135LIBYUV_API
136int ARGBToJ400(const uint8* src_argb, int src_stride_argb,
137               uint8* dst_yj, int dst_stride_yj,
138               int width, int height);
139
140// Convert ARGB to I400.
141LIBYUV_API
142int ARGBToI400(const uint8* src_argb, int src_stride_argb,
143               uint8* dst_y, int dst_stride_y,
144               int width, int height);
145
146// Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB)
147LIBYUV_API
148int ARGBToG(const uint8* src_argb, int src_stride_argb,
149            uint8* dst_g, int dst_stride_g,
150            int width, int height);
151
152// Convert ARGB To NV12.
153LIBYUV_API
154int ARGBToNV12(const uint8* src_argb, int src_stride_argb,
155               uint8* dst_y, int dst_stride_y,
156               uint8* dst_uv, int dst_stride_uv,
157               int width, int height);
158
159// Convert ARGB To NV21.
160LIBYUV_API
161int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
162               uint8* dst_y, int dst_stride_y,
163               uint8* dst_vu, int dst_stride_vu,
164               int width, int height);
165
166// Convert ARGB To NV21.
167LIBYUV_API
168int ARGBToNV21(const uint8* src_argb, int src_stride_argb,
169               uint8* dst_y, int dst_stride_y,
170               uint8* dst_vu, int dst_stride_vu,
171               int width, int height);
172
173// Convert ARGB To YUY2.
174LIBYUV_API
175int ARGBToYUY2(const uint8* src_argb, int src_stride_argb,
176               uint8* dst_yuy2, int dst_stride_yuy2,
177               int width, int height);
178
179// Convert ARGB To UYVY.
180LIBYUV_API
181int ARGBToUYVY(const uint8* src_argb, int src_stride_argb,
182               uint8* dst_uyvy, int dst_stride_uyvy,
183               int width, int height);
184
185#ifdef __cplusplus
186}  // extern "C"
187}  // namespace libyuv
188#endif
189
190#endif  // INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_  NOLINT
191