kstars
ccvt.h
Go to the documentation of this file.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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.4 2005/04/29 16:51:20 mutlaqja 00025 Adding initial support for Video 4 Linux 2 drivers. This mean that KStars can probably control Meade Lunar Planetary Imager (LPI). V4L2 requires a fairly recent kernel (> 2.6.9) and many drivers don't fully support it yet. It will take sometime. KStars still supports V4L1 and will continue so until V4L1 is obselete. Please test KStars video drivers if you can. Any comments welcomed. 00026 00027 CCMAIL: kstars-devel@kde.org 00028 00029 Revision 1.3 2004/06/26 23:12:03 mutlaqja 00030 Hopefully this will fix compile issues on 64bit archs, and FreeBSD, among others. The assembly code is replaced with a more portable, albeit slower C implementation. I imported the videodev.h header after cleaning it for user space. 00031 00032 Anyone who has problems compiling this, please report the problem to kstars-devel@kde.org 00033 00034 I noticed one odd thing after updating my kdelibs, the LEDs don't change color when state is changed. Try that by starting any INDI device, and hit connect, if the LED turns to yellow and back to grey then it works fine, otherwise, we've got a problem. 00035 00036 CCMAIL: kstars-devel@kde.org 00037 00038 Revision 1.10 2003/10/24 16:55:18 nemosoft 00039 removed erronous log messages 00040 00041 Revision 1.9 2002/11/03 22:46:25 nemosoft 00042 Adding various RGB to RGB functions. 00043 Adding proper copyright header too. 00044 00045 Revision 1.8 2002/04/14 01:00:27 nemosoft 00046 Finishing touches: adding const, adding libs for 'show' 00047 */ 00048 00049 00050 #ifndef CCVT_H 00051 #define CCVT_H 00052 00053 #ifdef __cplusplus 00054 extern "C" { 00055 #endif 00056 00057 /* Colour ConVerT: going from one colour space to another. 00058 ** NOTE: the set of available functions is far from complete! ** 00059 00060 Format descriptions: 00061 420i = "4:2:0 interlaced" 00062 YYYY UU YYYY UU even lines 00063 YYYY VV YYYY VV odd lines 00064 U/V data is subsampled by 2 both in horizontal 00065 and vertical directions, and intermixed with the Y values. 00066 00067 420p = "4:2:0 planar" 00068 YYYYYYYY N lines 00069 UUUU N/2 lines 00070 VVVV N/2 lines 00071 U/V is again subsampled, but all the Ys, Us and Vs are placed 00072 together in separate buffers. The buffers may be placed in 00073 one piece of contiguous memory though, with Y buffer first, 00074 followed by U, followed by V. 00075 00076 yuyv = "4:2:2 interlaced" 00077 YUYV YUYV YUYV ... N lines 00078 The U/V data is subsampled by 2 in horizontal direction only. 00079 00080 bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up 00081 with that idea...) 00082 rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible) 00083 rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with 00084 Alpha really being a filler byte (0) 00085 bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red 00086 Alpha, Alpha again a filler byte (0) 00087 */ 00088 00089 /* 4:2:0 YUV planar to RGB/BGR */ 00090 void ccvt_420p_bgr24(int width, int height, const void *src, void *dst); 00091 void ccvt_420p_rgb24(int width, int height, const void *src, void *dst); 00092 void ccvt_420p_bgr32(int width, int height, const void *src, void *dst); 00093 void ccvt_420p_rgb32(int width, int height, const void *src, void *dst); 00094 00095 /* 4:2:2 YUYV interlaced to RGB/BGR */ 00096 void ccvt_yuyv_rgb32(int width, int height, const void *src, void *dst); 00097 void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst); 00098 00099 /* 4:2:2 YUYV interlaced to 4:2:0 YUV planar */ 00100 void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00101 00102 /* RGB/BGR to 4:2:0 YUV interlaced */ 00103 00104 /* RGB/BGR to 4:2:0 YUV planar */ 00105 void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00106 void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv); 00107 00108 /* RGB/BGR to RGB/BGR */ 00109 void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst); 00110 void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst); 00111 void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst); 00112 void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst); 00113 void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst); 00114 void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst); 00115 void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst); 00116 void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst); 00117 00118 int RGB2YUV (int x_dim, int y_dim, void *bmp, void *y_out, void *u_out, void *v_out, int flip); 00119 00120 /* 00121 * BAYER2RGB24 ROUTINE TAKEN FROM: 00122 * 00123 * Sonix SN9C101 based webcam basic I/F routines 00124 * Copyright (C) 2004 Takafumi Mizuno <taka-qce@ls-a.jp> 00125 * 00126 * Redistribution and use in source and binary forms, with or without 00127 * modification, are permitted provided that the following conditions 00128 * are met: 00129 * 1. Redistributions of source code must retain the above copyright 00130 * notice, this list of conditions and the following disclaimer. 00131 * 2. Redistributions in binary form must reproduce the above copyright 00132 * notice, this list of conditions and the following disclaimer in the 00133 * documentation and/or other materials provided with the distribution. 00134 * 00135 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 00136 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00137 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00138 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 00139 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00140 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00141 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00142 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00143 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00144 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00145 * SUCH DAMAGE. 00146 */ 00147 00148 void bayer2rgb24(unsigned char *dst, unsigned char *src, long int WIDTH, long int HEIGHT); 00149 00150 #ifdef __cplusplus 00151 } 00152 #endif 00153 00154 enum Options { 00155 ioNoBlock=(1<<0), 00156 ioUseSelect=(1<<1), 00157 haveBrightness=(1<<2), 00158 haveContrast=(1<<3), 00159 haveHue=(1<<4), 00160 haveColor=(1<<5), 00161 haveWhiteness=(1<<6) }; 00162 00163 00164 #endif