color.h
Go to the documentation of this file.
1 /****************************************************************************
2 # GspcaGui: Gspca/Spca5xx Grabber #
3 # Copyright (C) 2004 2005 2006 Michel Xhaard #
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
18 # #
19 ****************************************************************************/
20 typedef struct Myrgb16 {
21  unsigned short blue:5;
22  unsigned short green:6;
23  unsigned short red:5;
24 } Myrgb16;
25 typedef struct Myrgb24 {
26  unsigned char blue;
27  unsigned char green;
28  unsigned char red;
29 } Myrgb24;
30 typedef struct Myrgb32 {
31  unsigned char blue;
32  unsigned char green;
33  unsigned char red;
34  unsigned char alpha;
35 } Myrgb32;
36 
37 typedef struct MyYUV422 {
38  unsigned char y0;
39  unsigned char u;
40  unsigned char y1;
41  unsigned char v;
42 } MyYUV422;
43 
44 typedef struct MyYUV444 {
45  unsigned char y;
46  unsigned char u;
47  unsigned char v;
48 } MyYUV444;
49 
50 #define CLIP(color) (unsigned char)(((color)>0xFF)?0xff:(((color)<0)?0:(color)))
51 
52 unsigned char
53 RGB24_TO_Y(unsigned char r, unsigned char g, unsigned char b);
54 
55 unsigned char
56 YR_TO_V(unsigned char r, unsigned char y);
57 
58 unsigned char
59 YB_TO_U(unsigned char b, unsigned char y);
60 
61 unsigned char
62 R_FROMYV(unsigned char y, unsigned char v);
63 
64 unsigned char
65 G_FROMYUV(unsigned char y, unsigned char u, unsigned char v);
66 
67 unsigned char
68 B_FROMYU(unsigned char y, unsigned char u);
69 
70 #define YfromRGB(r,g,b) CLIP((77*(r)+150*(g)+29*(b))>>8)
71 #define UfromRGB(r,g,b) CLIP(((128*(b)-85*(g)-43*(r))>>8 )+128)
72 #define VfromRGB(r,g,b) CLIP(((128*(r)-107*(g)-21*(b))>>8) +128)
73 
74 #define PACKRGB16(r,g,b) (__u16) ((((b) & 0xF8) << 8 ) | (((g) & 0xFC) << 3 ) | (((r) & 0xF8) >> 3 ))
75 #define UNPACK16(pixel,r,g,b) r=((pixel)&0xf800) >> 8; g=((pixel)&0x07e0) >> 3; b=(((pixel)&0x001f) << 3)
76 
77 void initLut(void);
78 void freeLut(void);
Definition: color.h:25
unsigned char B_FROMYU(unsigned char y, unsigned char u)
Definition: color.c:73
struct MyYUV444 MyYUV444
struct Myrgb32 Myrgb32
Definition: color.h:30
unsigned char G_FROMYUV(unsigned char y, unsigned char u, unsigned char v)
Definition: color.c:68
Definition: color.h:44
unsigned char y
Definition: color.h:45
void freeLut(void)
Definition: color.c:120
unsigned char YR_TO_V(unsigned char r, unsigned char y)
Definition: color.c:53
unsigned char u
Definition: color.h:46
unsigned char blue
Definition: color.h:31
unsigned char u
Definition: color.h:39
unsigned short blue
Definition: color.h:21
unsigned short green
Definition: color.h:22
Definition: color.h:37
unsigned char v
Definition: color.h:41
unsigned char red
Definition: color.h:28
unsigned char blue
Definition: color.h:26
unsigned char v
Definition: color.h:47
unsigned char RGB24_TO_Y(unsigned char r, unsigned char g, unsigned char b)
Definition: color.c:48
unsigned char green
Definition: color.h:27
unsigned char red
Definition: color.h:33
struct Myrgb16 Myrgb16
void initLut(void)
Definition: color.c:78
struct Myrgb24 Myrgb24
struct MyYUV422 MyYUV422
unsigned char R_FROMYV(unsigned char y, unsigned char v)
Definition: color.c:63
unsigned short red
Definition: color.h:23
unsigned char y1
Definition: color.h:40
unsigned char green
Definition: color.h:32
unsigned char YB_TO_U(unsigned char b, unsigned char y)
Definition: color.c:58
Definition: color.h:20
unsigned char alpha
Definition: color.h:34
unsigned char y0
Definition: color.h:38


tuw_uvc
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:39:24