libquicktime
colormodels.h
1 /*******************************************************************************
2  colormodels.h
3 
4  libquicktime - A library for reading and writing quicktime/avi/mp4 files.
5  http://libquicktime.sourceforge.net
6 
7  Copyright (C) 2002 Heroine Virtual Ltd.
8  Copyright (C) 2002-2011 Members of the libquicktime project.
9 
10  This library is free software; you can redistribute it and/or modify it under
11  the terms of the GNU Lesser General Public License as published by the Free
12  Software Foundation; either version 2.1 of the License, or (at your option)
13  any later version.
14 
15  This library is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18  details.
19 
20  You should have received a copy of the GNU Lesser General Public License along
21  with this library; if not, write to the Free Software Foundation, Inc., 51
22  Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 *******************************************************************************/
24 
25 #ifndef COLORMODELS_H
26 #define COLORMODELS_H
27 
28 #pragma GCC visibility push(default)
29 
38 // Colormodels
39 #define BC_COMPRESSED 1
40 
47 #define BC_RGB565 2
48 
55 #define BC_BGR565 3
56 
62 #define BC_BGR888 4
63 
69 #define BC_BGR8888 5
70 
77 #define BC_RGB888 6
78 
84 #define BC_RGBA8888 7
85 
91 #define BC_RGB161616 8
92 
98 #define BC_RGBA16161616 9
99 
105 #define BC_YUVA8888 10
106 
112 #define BC_YUV422 13
113 // Planar
114 
121 #define BC_YUV420P 14
122 
128 #define BC_YUV422P 15
129 
135 #define BC_YUV444P 16
136 
142 #define BC_YUV411P 17
143 /* JPEG scaled colormodels */
144 
150 #define BC_YUVJ420P 18
151 
157 #define BC_YUVJ422P 19
158 
164 #define BC_YUVJ444P 20
165 /* 16 bit per component planar formats */
166 
172 #define BC_YUV422P16 21
173 
179 #define BC_YUV444P16 22
180 
185 #define BC_YUV422P10 23
186 
192 #define BC_YUVJ422P10 24
193 
194 // Colormodels purely used by Quicktime are done in Quicktime.
195 
196 // For communication with the X Server
197 #define FOURCC_YV12 0x32315659 /* YV12 YUV420P */
198 #define FOURCC_YUV2 0x32595559 /* YUV2 YUV422 */
199 #define FOURCC_I420 0x30323449 /* I420 Intel Indeo 4 */
200 
201 // #undef RECLIP
202 // #define RECLIP(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x))))
203 
204 #ifdef __cplusplus
205 extern "C" {
206 #endif
207 
208 int cmodel_calculate_pixelsize(int colormodel);
209 int cmodel_calculate_datasize(int w, int h, int bytes_per_line, int color_model);
210 int cmodel_calculate_max(int colormodel);
211 int cmodel_components(int colormodel);
212 int cmodel_is_yuv(int colormodel);
213 
214 void cmodel_transfer(unsigned char **output_rows, /* Leave NULL if non existent */
215  unsigned char **input_rows,
216  int in_x, /* Dimensions to capture from input frame */
217  int in_y,
218  int in_w,
219  int in_h,
220  int out_w,
221  int out_h,
222  int in_colormodel,
223  int out_colormodel,
224  int in_rowspan, /* For planar use the luma rowspan */
225  int out_rowspan, /* For planar use the luma rowspan */
226  int in_rowspan_uv, /* Chroma rowspan */
227  int out_rowspan_uv /* Chroma rowspan */);
228 
229 int cmodel_bc_to_x(int color_model);
230 // Tell when to use plane arguments or row pointer arguments to functions
231 int cmodel_is_planar(int color_model);
232 
233 
234 
235 
236 
237 #ifdef __cplusplus
238 }
239 #endif
240 
241 #pragma GCC visibility pop
242 
243 #endif