ccvt.h
1 /* CCVT: ColourConVerT: simple library for converting colourspaces
2  Copyright (C) 2002 Nemosoft Unv.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18  For questions, remarks, patches, etc. for this program, the author can be
19  reached at nemosoft@smcc.demon.nl.
20 */
21 
22 /*
23  $Log$
24  Revision 1.1 2005/05/04 06:53:17 section314
25  Added YUV420P-->RGB conversion
26 
27  Revision 1.10 2003/10/24 16:55:18 nemosoft
28  removed erronous log messages
29 
30  Revision 1.9 2002/11/03 22:46:25 nemosoft
31  Adding various RGB to RGB functions.
32  Adding proper copyright header too.
33 
34  Revision 1.8 2002/04/14 01:00:27 nemosoft
35  Finishing touches: adding const, adding libs for 'show'
36 */
37 
38 
39 #ifndef CCVT_H
40 #define CCVT_H
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /* Colour ConVerT: going from one colour space to another.
47  ** NOTE: the set of available functions is far from complete! **
48 
49  Format descriptions:
50  420i = "4:2:0 interlaced"
51  YYYY UU YYYY UU even lines
52  YYYY VV YYYY VV odd lines
53  U/V data is subsampled by 2 both in horizontal
54  and vertical directions, and intermixed with the Y values.
55 
56  420p = "4:2:0 planar"
57  YYYYYYYY N lines
58  UUUU N/2 lines
59  VVVV N/2 lines
60  U/V is again subsampled, but all the Ys, Us and Vs are placed
61  together in separate buffers. The buffers may be placed in
62  one piece of contiguous memory though, with Y buffer first,
63  followed by U, followed by V.
64 
65  yuyv = "4:2:2 interlaced"
66  YUYV YUYV YUYV ... N lines
67  The U/V data is subsampled by 2 in horizontal direction only.
68 
69  bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up
70  with that idea...)
71  rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible)
72  rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with
73  Alpha really being a filler byte (0)
74  bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red
75  Alpha, Alpha again a filler byte (0)
76  */
77 
78 /* 4:2:0 YUV planar to RGB/BGR */
79 void ccvt_420p_bgr24(int width, int height, const void *src, void *dst);
80 void ccvt_420p_rgb24(int width, int height, const void *src, void *dst);
81 void ccvt_420p_bgr32(int width, int height, const void *src, void *dst);
82 void ccvt_420p_rgb32(int width, int height, const void *src, void *dst);
83 
84 /* 4:2:2 YUYV interlaced to RGB/BGR */
85 void ccvt_yuyv_rgb32(int width, int height, const void *src, void *dst);
86 void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst);
87 
88 /* 4:2:2 YUYV interlaced to 4:2:0 YUV planar */
89 void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
90 
91 /* RGB/BGR to 4:2:0 YUV interlaced */
92 
93 /* RGB/BGR to 4:2:0 YUV planar */
94 void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
95 void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
96 
97 /* RGB/BGR to RGB/BGR */
98 void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst);
99 void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst);
100 void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst);
101 void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst);
102 void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst);
103 void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst);
104 void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst);
105 void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst);
106 
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif

Last updated 12 September 2005 21:38:45