color.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 #               GspcaGui:  Gspca/Spca5xx Grabber                            #
00003 #               Copyright (C) 2004 2005 2006 Michel Xhaard                  #
00004 #                                                                           #
00005 # This program is free software; you can redistribute it and/or modify      #
00006 # it under the terms of the GNU General Public License as published by      #
00007 # the Free Software Foundation; either version 2 of the License, or         #
00008 # (at your option) any later version.                                       #
00009 #                                                                           #
00010 # This program is distributed in the hope that it will be useful,           #
00011 # but WITHOUT ANY WARRANTY; without even the implied warranty of            #
00012 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             #
00013 # GNU General Public License for more details.                              #
00014 #                                                                           #
00015 # You should have received a copy of the GNU General Public License         #
00016 # along with this program; if not, write to the Free Software               #
00017 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA #
00018 #                                                                           #
00019 ****************************************************************************/ 
00020 typedef struct Myrgb16 {
00021         unsigned short blue:5;
00022         unsigned short green:6;
00023         unsigned short red:5;
00024 } Myrgb16;
00025 typedef struct Myrgb24 {
00026         unsigned char blue;
00027         unsigned char green;
00028         unsigned char red;
00029 } Myrgb24;
00030 typedef struct Myrgb32 {
00031         unsigned char blue;
00032         unsigned char green;
00033         unsigned char red;
00034         unsigned char alpha;
00035 } Myrgb32;
00036 
00037 typedef struct MyYUV422 {
00038         unsigned char y0;
00039         unsigned char u;
00040         unsigned char y1;
00041         unsigned char v;
00042 } MyYUV422;
00043 
00044 typedef struct MyYUV444 {
00045         unsigned char y;
00046         unsigned char u;
00047         unsigned char v;
00048 } MyYUV444;
00049 
00050 #define CLIP(color) (unsigned char)(((color)>0xFF)?0xff:(((color)<0)?0:(color)))
00051 
00052 unsigned char
00053 RGB24_TO_Y(unsigned char r, unsigned char g, unsigned char b);
00054 
00055 unsigned char
00056 YR_TO_V(unsigned char r, unsigned char y);
00057 
00058 unsigned char
00059 YB_TO_U(unsigned char b, unsigned char y);
00060 
00061 unsigned char
00062 R_FROMYV(unsigned char y, unsigned char v);
00063 
00064 unsigned char
00065 G_FROMYUV(unsigned char y, unsigned char u, unsigned char v);
00066 
00067 unsigned char
00068 B_FROMYU(unsigned char y, unsigned char u);
00069 
00070 #define YfromRGB(r,g,b) CLIP((77*(r)+150*(g)+29*(b))>>8)
00071 #define UfromRGB(r,g,b) CLIP(((128*(b)-85*(g)-43*(r))>>8 )+128)
00072 #define VfromRGB(r,g,b) CLIP(((128*(r)-107*(g)-21*(b))>>8) +128)
00073 
00074 #define PACKRGB16(r,g,b) (__u16) ((((b) & 0xF8) << 8 ) | (((g) & 0xFC) << 3 ) | (((r) & 0xF8) >> 3 ))
00075 #define UNPACK16(pixel,r,g,b) r=((pixel)&0xf800) >> 8;  g=((pixel)&0x07e0) >> 3; b=(((pixel)&0x001f) << 3)
00076 
00077 void initLut(void);
00078 void freeLut(void);


tuw_uvc
Author(s):
autogenerated on Sun May 29 2016 02:50:28