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.1 2005/05/04 06:53:17 section314 00025 Added YUV420P-->RGB conversion 00026 00027 Revision 1.10 2003/10/24 16:55:18 nemosoft 00028 removed erronous log messages 00029 00030 Revision 1.9 2002/11/03 22:46:25 nemosoft 00031 Adding various RGB to RGB functions. 00032 Adding proper copyright header too. 00033 00034 Revision 1.8 2002/04/14 01:00:27 nemosoft 00035 Finishing touches: adding const, adding libs for 'show' 00036 */ 00037 00038 00039 #ifndef CCVT_H 00040 #define CCVT_H 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /* Colour ConVerT: going from one colour space to another. 00047 ** NOTE: the set of available functions is far from complete! ** 00048 00049 Format descriptions: 00050 420i = "4:2:0 interlaced" 00051 YYYY UU YYYY UU even lines 00052 YYYY VV YYYY VV odd lines 00053 U/V data is subsampled by 2 both in horizontal 00054 and vertical directions, and intermixed with the Y values. 00055 00056 420p = "4:2:0 planar" 00057 YYYYYYYY N lines 00058 UUUU N/2 lines 00059 VVVV N/2 lines 00060 U/V is again subsampled, but all the Ys, Us and Vs are placed 00061 together in separate buffers. The buffers may be placed in 00062 one piece of contiguous memory though, with Y buffer first, 00063 followed by U, followed by V. 00064 00065 yuyv = "4:2:2 interlaced" 00066 YUYV YUYV YUYV ... N lines 00067 The U/V data is subsampled by 2 in horizontal direction only. 00068 00069 bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up 00070 with that idea...) 00071 rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible) 00072 rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with 00073 Alpha really being a filler byte (0) 00074 bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red 00075 Alpha, Alpha again a filler byte (0) 00076 */ 00077 00078 /* 4:2:0 YUV planar to RGB/BGR */ 00079 void ccvt_420p_bgr24(int width, int height, const void *src, void *dst); 00080 void ccvt_420p_rgb24(int width, int height, const void *src, void *dst); 00081 void ccvt_420p_bgr32(int width, int height, const void *src, void *dst); 00082 void ccvt_420p_rgb32(int width, int height, const void *src, void *dst); 00083 00084 /* 4:2:2 YUYV interlaced to RGB/BGR */ 00085 void ccvt_yuyv_rgb32(int width, int height, const void *src, void *dst); 00086 void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst); 00087 00088 /* 4:2:2 YUYV interlaced to 4:2:0 YUV planar */ 00089 void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00090 00091 /* RGB/BGR to 4:2:0 YUV interlaced */ 00092 00093 /* RGB/BGR to 4:2:0 YUV planar */ 00094 void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00095 void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00096 00097 /* RGB/BGR to RGB/BGR */ 00098 void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst); 00099 void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst); 00100 void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst); 00101 void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst); 00102 void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst); 00103 void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst); 00104 void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst); 00105 void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst); 00106 00107 00108 #ifdef __cplusplus 00109 } 00110 #endif 00111 00112 #endif