00001 /* CCVT: ColourConVerT: simple library for converting colourspaces 00002 Copyright (C) 2002 Nemosoft Unv. 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 For questions, remarks, patches, etc. for this program, the author can be 00019 reached at nemosoft@smcc.demon.nl. 00020 */ 00021 00022 /* 00023 $Log$ 00024 Revision 1.2 2006/12/06 00:37:23 retrakker 00025 - Added an updated CCVT version which hopefully will work as expected on 00026 x64 systems. 00027 00028 Revision 1.1 2005/05/04 06:53:17 section314 00029 Added YUV420P-->RGB conversion 00030 00031 Revision 1.10 2003/10/24 16:55:18 nemosoft 00032 removed erronous log messages 00033 00034 Revision 1.9 2002/11/03 22:46:25 nemosoft 00035 Adding various RGB to RGB functions. 00036 Adding proper copyright header too. 00037 00038 Revision 1.8 2002/04/14 01:00:27 nemosoft 00039 Finishing touches: adding const, adding libs for 'show' 00040 */ 00041 00042 00043 #ifndef CCVT_H 00044 #define CCVT_H 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 /* Colour ConVerT: going from one colour space to another. 00051 ** NOTE: the set of available functions is far from complete! ** 00052 00053 Format descriptions: 00054 420i = "4:2:0 interlaced" 00055 YYYY UU YYYY UU even lines 00056 YYYY VV YYYY VV odd lines 00057 U/V data is subsampled by 2 both in horizontal 00058 and vertical directions, and intermixed with the Y values. 00059 00060 420p = "4:2:0 planar" 00061 YYYYYYYY N lines 00062 UUUU N/2 lines 00063 VVVV N/2 lines 00064 U/V is again subsampled, but all the Ys, Us and Vs are placed 00065 together in separate buffers. The buffers may be placed in 00066 one piece of contiguous memory though, with Y buffer first, 00067 followed by U, followed by V. 00068 00069 yuyv = "4:2:2 interlaced" 00070 YUYV YUYV YUYV ... N lines 00071 The U/V data is subsampled by 2 in horizontal direction only. 00072 00073 bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up 00074 with that idea...) 00075 rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible) 00076 rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with 00077 Alpha really being a filler byte (0) 00078 bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red 00079 Alpha, Alpha again a filler byte (0) 00080 */ 00081 00082 /* 4:2:0 YUV planar to RGB/BGR */ 00083 void ccvt_420p_bgr24(int width, int height, const void *src, void *dst); 00084 void ccvt_420p_rgb24(int width, int height, const void *src, void *dst); 00085 void ccvt_420p_bgr32(int width, int height, const void *src, void *dst); 00086 void ccvt_420p_rgb32(int width, int height, const void *src, void *dst); 00087 00088 /* 4:2:2 YUYV interlaced to RGB/BGR */ 00089 void ccvt_yuyv_rgb32(int width, int height, const void *src, void *dst); 00090 void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst); 00091 00092 /* 4:2:2 YUYV interlaced to 4:2:0 YUV planar */ 00093 void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00094 00095 /* RGB/BGR to 4:2:0 YUV interlaced */ 00096 00097 /* RGB/BGR to 4:2:0 YUV planar */ 00098 void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00099 void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00100 00101 /* RGB/BGR to RGB/BGR */ 00102 void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst); 00103 void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst); 00104 void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst); 00105 void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst); 00106 void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst); 00107 void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst); 00108 void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst); 00109 void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst); 00110 00111 00112 #ifdef __cplusplus 00113 } 00114 #endif 00115 00116 #endif