Instrument Neutral Distributed Interface INDI  2.0.2
ccvt.h
Go to the documentation of this file.
1 /* CCVT: ColourConVerT: simple library for converting colourspaces
2  Copyright (C) 2002 Nemosoft Unv.
3  Email:athomas@nemsoft.co.uk
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
19  For questions, remarks, patches, etc. for this program, the author can be
20  reached at nemosoft@smcc.demon.nl.
21 */
22 
23 /*
24  $Log$
25  Revision 1.4 2005/04/29 16:51:20 mutlaqja
26  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.
27 
28  CCMAIL: kstars-devel@kde.org
29 
30  Revision 1.3 2004/06/26 23:12:03 mutlaqja
31  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.
32 
33  Anyone who has problems compiling this, please report the problem to kstars-devel@kde.org
34 
35  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.
36 
37  CCMAIL: kstars-devel@kde.org
38 
39  Revision 1.10 2003/10/24 16:55:18 nemosoft
40  removed erronous log messages
41 
42  Revision 1.9 2002/11/03 22:46:25 nemosoft
43  Adding various RGB to RGB functions.
44  Adding proper copyright header too.
45 
46  Revision 1.8 2002/04/14 01:00:27 nemosoft
47  Finishing touches: adding const, adding libs for 'show'
48 */
49 
50 #pragma once
51 
52 #include<stdint.h>
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
86 
88 void ccvt_420p_bgr24(int width, int height, const void *src, void *dst);
90 void ccvt_420p_rgb24(int width, int height, const void *src, void *dst);
92 void ccvt_420p_bgr32(int width, int height, const void *src, void *dst);
94 void ccvt_420p_rgb32(int width, int height, const void *src, void *dst);
95 
97 //void ccvt_yuyv_rgb32(int width, int height, const void *src, void *dst);
99 void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst);
101 void ccvt_yuyv_bgr24(int width, int height, const void *src, void *dst);
103 void ccvt_yuyv_rgb24(int width, int height, const void *src, void *dst);
104 
106 void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
107 
108 /* RGB/BGR to 4:2:0 YUV interlaced */
109 
111 void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
113 void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
114 
116 void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst);
118 void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst);
120 void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst);
122 void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst);
124 void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst);
126 void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst);
128 void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst);
130 void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst);
131 
133 int RGB2YUV(int x_dim, int y_dim, void *bmp, void *y_out, void *u_out, void *v_out, int flip);
134 
136 int BGR2YUV(int x_dim, int y_dim, void *bmp, void *y_out, void *u_out, void *v_out, int flip);
137 
151 int mjpegtoyuv420p(unsigned char *map, unsigned char *cap_map, int width, int height, unsigned int size);
152 
153 /*
154  * BAYER2RGB24 ROUTINE TAKEN FROM:
155  *
156  * Sonix SN9C101 based webcam basic I/F routines
157  * Copyright (C) 2004 Takafumi Mizuno <taka-qce@ls-a.jp>
158  *
159  * Redistribution and use in source and binary forms, with or without
160  * modification, are permitted provided that the following conditions
161  * are met:
162  * 1. Redistributions of source code must retain the above copyright
163  * notice, this list of conditions and the following disclaimer.
164  * 2. Redistributions in binary form must reproduce the above copyright
165  * notice, this list of conditions and the following disclaimer in the
166  * documentation and/or other materials provided with the distribution.
167  *
168  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
169  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
170  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
171  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
172  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
173  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
174  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
175  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
176  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
177  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
178  * SUCH DAMAGE.
179  */
180 
182 void bayer2rgb24(unsigned char *dst, unsigned char *src, long int WIDTH, long int HEIGHT);
184 void bayer16_2_rgb24(unsigned short *dst, unsigned short *src, long int WIDTH, long int HEIGHT);
186 void bayer_rggb_2rgb24(unsigned char *dst, unsigned char *srcc, long int WIDTH, long int HEIGHT);
187 
188 void bayer_grbg_to_rgb24(unsigned char *dst, unsigned char *srcc, long int WIDTH, long int HEIGHT);
189 // void convert_border_bayer_line_to_bgr24( uint8_t* bayer, uint8_t* adjacent_bayer, uint8_t *bgr, int width, uint8_t start_with_green, uint8_t blue_line);
190 // void bayer_to_rgbbgr24(uint8_t *bayer, uint8_t *bgr, int width, int height, uint8_t start_with_green, uint8_t blue_line);
191 
194 #ifdef __cplusplus
195 }
196 #endif
197 
199 {
200  ioNoBlock = (1 << 0),
201  ioUseSelect = (1 << 1),
202  haveBrightness = (1 << 2),
203  haveContrast = (1 << 3),
204  haveHue = (1 << 4),
205  haveColor = (1 << 5),
206  haveWhiteness = (1 << 6)
207 };
int BGR2YUV(int x_dim, int y_dim, void *bmp, void *y_out, void *u_out, void *v_out, int flip)
Definition: ccvt_misc.c:894
void bayer_grbg_to_rgb24(unsigned char *dst, unsigned char *srcc, long int WIDTH, long int HEIGHT)
Definition: ccvt_misc.c:545
void ccvt_420p_rgb24(int width, int height, const void *src, void *dst)
Definition: ccvt_c2.c:128
void bayer16_2_rgb24(unsigned short *dst, unsigned short *src, long int WIDTH, long int HEIGHT)
Definition: ccvt_misc.c:357
void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst)
Definition: ccvt_misc.c:81
void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst)
void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv)
void bayer2rgb24(unsigned char *dst, unsigned char *src, long int WIDTH, long int HEIGHT)
Definition: ccvt_misc.c:263
int mjpegtoyuv420p(unsigned char *map, unsigned char *cap_map, int width, int height, unsigned int size)
mjpegtoyuv420p MPEG to YUV 420 P
Definition: ccvt_misc.c:721
void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst)
void bayer_rggb_2rgb24(unsigned char *dst, unsigned char *srcc, long int WIDTH, long int HEIGHT)
Definition: ccvt_misc.c:451
void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst)
void ccvt_420p_rgb32(int width, int height, const void *src, void *dst)
Definition: ccvt_c2.c:123
void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst)
void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst)
void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv)
void ccvt_yuyv_rgb24(int width, int height, const void *src, void *dst)
Definition: ccvt_misc.c:173
Options
Definition: ccvt.h:199
@ ioUseSelect
Definition: ccvt.h:201
@ ioNoBlock
Definition: ccvt.h:200
@ haveContrast
Definition: ccvt.h:203
@ haveWhiteness
Definition: ccvt.h:206
@ haveColor
Definition: ccvt.h:205
@ haveBrightness
Definition: ccvt.h:202
@ haveHue
Definition: ccvt.h:204
void ccvt_yuyv_bgr24(int width, int height, const void *src, void *dst)
Definition: ccvt_misc.c:127
void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst)
void ccvt_420p_bgr32(int width, int height, const void *src, void *dst)
Definition: ccvt_c2.c:113
void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst)
void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv)
Definition: ccvt_misc.c:219
void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst)
int RGB2YUV(int x_dim, int y_dim, void *bmp, void *y_out, void *u_out, void *v_out, int flip)
Definition: ccvt_misc.c:785
void ccvt_420p_bgr24(int width, int height, const void *src, void *dst)
Definition: ccvt_c2.c:118