cvd/colourspaces.h

00001 /*
00002     This file is part of the CVD Library.
00003 
00004     Copyright (C) 2005 The Authors
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc.,
00019     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00021 #ifndef CVD_COLOURSPACES_H
00022 #define CVD_COLOURSPACES_H
00023 
00024 #include <cvd/internal/is_pod.h>
00025 #include <cvd/internal/builtin_components.h>
00026 #include <cvd/internal/pixel_traits.h>
00027 
00028 namespace CVD
00029 {
00030 
00034     struct bayer
00035     {
00036         unsigned char val;
00037         operator unsigned char() const {
00038             return val;
00039         }
00040         template <typename T> bayer( T in ) : val((unsigned char) in)
00041         {}
00042         bayer(void) : val(0)
00043         {}
00044     };
00045 
00049     struct yuv411
00050     {
00051         unsigned char val;
00052     };
00053 
00056     struct yuv422
00057     {
00058         unsigned short val;
00059     };
00060 
00063     struct yuv420p
00064     {
00065         unsigned short val;
00066     };
00067     
00072     struct vuy422
00073     {
00074         unsigned short val;
00075     };
00076 
00077   namespace Pixel {
00078       // Should be able to delete the following, since Component now defaults to 1 for unknown types
00079       //template<> struct Component<bayer> : public component_base<bayer, 1>
00080       //{
00081       //};
00082       
00083         template<int LIFT> struct traits<bayer, LIFT>
00084         {
00085             typedef int wider_type;
00086             typedef float float_type;
00087             static const bool integral = true;
00088             static const bool is_signed = false;
00089             static const int bits_used = 8;
00090             static const unsigned char max_intensity=(1 << bits_used) - 1;
00091         };
00092     }
00093 
00094    
00095 #ifndef DOXYGEN_IGNORE_INTERNAL
00096     namespace Internal
00097     {
00098       template<> struct is_POD<bayer>
00099       {
00100     enum { is_pod = 1 };
00101       };
00102       template<> struct is_POD<yuv411>
00103       {
00104     enum { is_pod = 1 };
00105       };
00106     }
00107 #endif
00108 }
00109 
00110 #endif

Generated on Wed Feb 18 10:23:00 2009 for CVD by  doxygen 1.5.3