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 #ifdef __GNUC__
29 #pragma GCC visibility push(default)
30 #endif
31 
40 // Colormodels
41 #define BC_COMPRESSED 1
42 
49 #define BC_RGB565 2
50 
57 #define BC_BGR565 3
58 
64 #define BC_BGR888 4
65 
71 #define BC_BGR8888 5
72 
79 #define BC_RGB888 6
80 
86 #define BC_RGBA8888 7
87 
93 #define BC_RGB161616 8
94 
100 #define BC_RGBA16161616 9
101 
107 #define BC_YUVA8888 10
108 
114 #define BC_YUV422 13
115 // Planar
116 
123 #define BC_YUV420P 14
124 
130 #define BC_YUV422P 15
131 
137 #define BC_YUV444P 16
138 
144 #define BC_YUV411P 17
145 /* JPEG scaled colormodels */
146 
152 #define BC_YUVJ420P 18
153 
159 #define BC_YUVJ422P 19
160 
166 #define BC_YUVJ444P 20
167 /* 16 bit per component planar formats */
168 
174 #define BC_YUV422P16 21
175 
181 #define BC_YUV444P16 22
182 
187 #define BC_YUV422P10 23
188 
194 #define BC_YUVJ422P10 24
195 
196 // Colormodels purely used by Quicktime are done in Quicktime.
197 
198 // For communication with the X Server
199 #define FOURCC_YV12 0x32315659 /* YV12 YUV420P */
200 #define FOURCC_YUV2 0x32595559 /* YUV2 YUV422 */
201 #define FOURCC_I420 0x30323449 /* I420 Intel Indeo 4 */
202 
203 // #undef RECLIP
204 // #define RECLIP(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x))))
205 
206 #ifdef __cplusplus
207 extern "C" {
208 #endif
209 
210 int cmodel_calculate_pixelsize(int colormodel);
211 int cmodel_calculate_datasize(int w, int h, int bytes_per_line, int color_model);
212 int cmodel_calculate_max(int colormodel);
213 int cmodel_components(int colormodel);
214 int cmodel_is_yuv(int colormodel);
215 
216 void cmodel_transfer(unsigned char **output_rows, /* Leave NULL if non existent */
217  unsigned char **input_rows,
218  int in_x, /* Dimensions to capture from input frame */
219  int in_y,
220  int in_w,
221  int in_h,
222  int out_w,
223  int out_h,
224  int in_colormodel,
225  int out_colormodel,
226  int in_rowspan, /* For planar use the luma rowspan */
227  int out_rowspan, /* For planar use the luma rowspan */
228  int in_rowspan_uv, /* Chroma rowspan */
229  int out_rowspan_uv /* Chroma rowspan */);
230 
231 int cmodel_bc_to_x(int color_model);
232 // Tell when to use plane arguments or row pointer arguments to functions
233 int cmodel_is_planar(int color_model);
234 
235 
236 
237 
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #ifdef __GNUC__
244 #pragma GCC visibility pop
245 #endif
246 
247 #endif