source: BAORadio/libindi/v1.0.1/libs/webcam/ccvt.h @ 614

Last change on this file since 614 was 490, checked in by campagne, 14 years ago

import libindi (JEC)

File size: 7.2 KB
Line 
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
51#ifndef CCVT_H
52#define CCVT_H
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/* Colour ConVerT: going from one colour space to another.
59   ** NOTE: the set of available functions is far from complete! **
60
61   Format descriptions:
62   420i = "4:2:0 interlaced"
63           YYYY UU YYYY UU   even lines
64           YYYY VV YYYY VV   odd lines
65           U/V data is subsampled by 2 both in horizontal
66           and vertical directions, and intermixed with the Y values.
67   
68   420p = "4:2:0 planar"
69           YYYYYYYY      N lines
70           UUUU          N/2 lines
71           VVVV          N/2 lines
72           U/V is again subsampled, but all the Ys, Us and Vs are placed
73           together in separate buffers. The buffers may be placed in
74           one piece of contiguous memory though, with Y buffer first,
75           followed by U, followed by V.
76
77   yuyv = "4:2:2 interlaced"
78           YUYV YUYV YUYV ...   N lines
79           The U/V data is subsampled by 2 in horizontal direction only.
80
81   bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up
82           with that idea...)
83   rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible)
84   rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with
85           Alpha really being a filler byte (0)
86   bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red
87           Alpha, Alpha again a filler byte (0)
88 */
89
90/* 4:2:0 YUV planar to RGB/BGR     */
91void ccvt_420p_bgr24(int width, int height, const void *src, void *dst);
92void ccvt_420p_rgb24(int width, int height, const void *src, void *dst);
93void ccvt_420p_bgr32(int width, int height, const void *src, void *dst);
94void ccvt_420p_rgb32(int width, int height, const void *src, void *dst);
95
96/* 4:2:2 YUYV interlaced to RGB/BGR */
97void ccvt_yuyv_rgb32(int width, int height, const void *src, void *dst);
98void ccvt_yuyv_bgr32(int width, int height, const void *src, void *dst);
99
100/* 4:2:2 YUYV interlaced to 4:2:0 YUV planar */
101void ccvt_yuyv_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
102
103/* RGB/BGR to 4:2:0 YUV interlaced */
104
105/* RGB/BGR to 4:2:0 YUV planar     */
106void ccvt_rgb24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
107void ccvt_bgr24_420p(int width, int height, const void *src, void *dsty, void *dstu, void *dstv);
108
109/* RGB/BGR to RGB/BGR */
110void ccvt_bgr24_bgr32(int width, int height, const void *const src, void *const dst);
111void ccvt_bgr24_rgb32(int width, int height, const void *const src, void *const dst);
112void ccvt_bgr32_bgr24(int width, int height, const void *const src, void *const dst);
113void ccvt_bgr32_rgb24(int width, int height, const void *const src, void *const dst);
114void ccvt_rgb24_bgr32(int width, int height, const void *const src, void *const dst);
115void ccvt_rgb24_rgb32(int width, int height, const void *const src, void *const dst);
116void ccvt_rgb32_bgr24(int width, int height, const void *const src, void *const dst);
117void ccvt_rgb32_rgb24(int width, int height, const void *const src, void *const dst);
118
119int RGB2YUV (int x_dim, int y_dim, void *bmp, void *y_out, void *u_out, void *v_out, int flip);
120
121/*
122 * BAYER2RGB24 ROUTINE TAKEN FROM:
123 *
124 * Sonix SN9C101 based webcam basic I/F routines
125 * Copyright (C) 2004 Takafumi Mizuno <taka-qce@ls-a.jp>
126 *
127 * Redistribution and use in source and binary forms, with or without
128 * modification, are permitted provided that the following conditions
129 * are met:
130 * 1. Redistributions of source code must retain the above copyright
131 *    notice, this list of conditions and the following disclaimer.
132 * 2. Redistributions in binary form must reproduce the above copyright
133 *    notice, this list of conditions and the following disclaimer in the
134 *    documentation and/or other materials provided with the distribution.
135 *
136 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
137 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
138 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
139 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
140 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
141 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
142 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
143 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
144 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
145 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
146 * SUCH DAMAGE.
147 */
148
149void bayer2rgb24(unsigned char *dst, unsigned char *src, long int WIDTH, long int HEIGHT);
150
151#ifdef __cplusplus
152}
153#endif
154
155enum Options {
156      ioNoBlock=(1<<0),
157      ioUseSelect=(1<<1),
158      haveBrightness=(1<<2),
159      haveContrast=(1<<3),
160      haveHue=(1<<4),
161      haveColor=(1<<5),
162      haveWhiteness=(1<<6) };
163
164
165#endif
Note: See TracBrowser for help on using the repository browser.