conversions.h
1 /*
2  * Copyright (C) 2000-2003 Damien Douxchamps <ddouxchamps@users.sf.net>
3  * Dan Dennedy <dan@dennedy.org>
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 Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __CONVERSIONS_H__
21 #define __CONVERSIONS_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <stdlib.h>
28 #include <stdio.h>
29 
30 typedef enum
31 {
32  NO_BAYER_DECODING,
33  BAYER_DECODING_NEAREST,
34  BAYER_DECODING_EDGE_SENSE,
35  BAYER_DECODING_DOWNSAMPLE
36 } bayer_decoding_t;
37 
38 typedef enum
39 {
40  NO_STEREO_DECODING,
41  STEREO_DECODING_INTERLACED,
42  STEREO_DECODING_FIELD
43 } stereo_decoding_t;
44 
45 typedef enum
46 {
47  BAYER_PATTERN_BGGR,
48  BAYER_PATTERN_GRBG,
49  BAYER_PATTERN_RGGB,
50  BAYER_PATTERN_GBRG
51 } bayer_pattern_t;
52 
53 // UYVY <-> YUYV
54 void
55 uyvy2yuyv (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
56 
57 void
58 yuyv2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
59 
60 // XXX -> UYVY
61 void
62 uyyvyy2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
63 
64 void
65 uyv2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
66 
67 void
68 y2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
69 
70 void
71 y162uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits);
72 
73 void
74 y162y (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits);
75 
76 void
77 rgb2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
78 
79 void
80 rgb482uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
81 
82 // XXX -> RGB
83 void
84 rgb482rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
85 
86 void
87 uyv2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
88 
89 void
90 uyvy2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
91 
92 void
93 uyyvyy2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
94 
95 void
96 y2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
97 
98 void
99 y162rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits);
100 
101 // BAYER -> RGB
102 void
103 BayerNearestNeighbor(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type);
104 
105 void
106 BayerEdgeSense(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type);
107 
108 void
109 BayerDownsample(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type);
110 
111 void
112 StereoDecode(unsigned char *src, unsigned char *dest, unsigned long long int NumPixels);
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif