[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd/internal convert_pixel_types.h name_...
From: |
Edward Rosten |
Subject: |
[libcvd-members] libcvd/cvd/internal convert_pixel_types.h name_... |
Date: |
Sat, 20 Mar 2010 13:42:57 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Edward Rosten <edrosten> 10/03/20 13:42:57
Modified files:
cvd/internal : convert_pixel_types.h name_CVD_rgb_types.h
rgb_components.h
Log message:
Added Bgrx type:
This type has blue, green, red, dummy. It differes from Bgra as it does
not
pretend to have an alpha channel for the purposes of conversion.
NB: it appears that the Abgr type is misnamed. It looks much more like
BGRA.
Also, the connversion code from grey to luma-alpha, to RGB colour to
RGBA
colour appears to require quadratic code in the number of types!
Image loading works on Bgrx types.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/convert_pixel_types.h?cvsroot=libcvd&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/name_CVD_rgb_types.h?cvsroot=libcvd&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/rgb_components.h?cvsroot=libcvd&r1=1.11&r2=1.12
Patches:
Index: convert_pixel_types.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/convert_pixel_types.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- convert_pixel_types.h 26 Oct 2009 15:44:58 -0000 1.13
+++ convert_pixel_types.h 20 Mar 2010 13:42:57 -0000 1.14
@@ -240,6 +240,7 @@
// Scalar to X
template <class S, class T> struct DefaultConversion<S,Rgb<T>,1,3> { typedef
Replicate<S,Rgb<T> > type; };
template <class S> struct DefaultConversion<S,Rgb8,1,3> { typedef
Replicate<S,Rgb8> type; };
+ template <class S, class T> struct DefaultConversion<S,Bgrx<T>,1,3> {
typedef Replicate<S,Bgrx<T> > type; };
template <class S, class T> struct DefaultConversion<S,Rgba<T>,1,4> {
typedef GreyToRgba<S,T> type; };
// Rgb<T> to X
@@ -248,16 +249,27 @@
template <class T, class S> struct DefaultConversion<Rgb<T>,Rgba<S>,3,4> {
typedef RgbishToRgbish<Rgb<T>, Rgba<S> > type; };
template <class T, class S> struct DefaultConversion<Rgb<T>,Rgb<S>,3,3> {
typedef RgbishToRgbish<Rgb<T>, Rgb<S> > type; };
template <class T> struct DefaultConversion<Rgb<T>,Rgb<T>,3,3> { typedef
GenericConversion<Rgb<T>, Rgb<T> > type; };
+ template <class T> struct DefaultConversion<Rgb<T>,Bgrx<T>,3,3> { typedef
RgbishToRgbish<Rgb<T>, Bgrx<T> > type; };
+
+ // Bgrx<T> to X
+ template <class T, class S> struct DefaultConversion<Bgrx<T>,S,3,1> {
typedef CIE<Bgrx<T>,S> type; };
+ template <class T> struct DefaultConversion<Bgrx<T>,Rgb8, 3,3> { typedef
RgbishToRgbish<Bgrx<T>, Rgb8> type; };
+ template <class T, class S> struct DefaultConversion<Bgrx<T>,Rgba<S>,3,4> {
typedef RgbishToRgbish<Bgrx<T>, Rgba<S> > type; };
+ template <class T, class S> struct DefaultConversion<Bgrx<T>,Rgb<S>,3,3> {
typedef RgbishToRgbish<Bgrx<T>, Rgb<S> > type; };
+ template <class T> struct DefaultConversion<Bgrx<T>,Rgb<T>,3,3> { typedef
GenericConversion<Bgrx<T>, Rgb<T> > type; };
+ template <class T> struct DefaultConversion<Bgrx<T>,Bgrx<T>,3,3> { typedef
RgbishToRgbish<Bgrx<T>, Bgrx<T> > type; };
// Rgb8 to X
template <class S> struct DefaultConversion<Rgb8,S,3,1> { typedef
CIE<Rgb8,S> type; };
template <class S> struct DefaultConversion<Rgb8,Rgb<S>,3,3> { typedef
RgbishToRgbish<Rgb8, Rgb<S> > type; };
template <class S> struct DefaultConversion<Rgb8,Rgba<S>,3,4> { typedef
RgbishToRgbish<Rgb8, Rgba<S> > type; };
+ template <class S> struct DefaultConversion<Rgb8,Bgrx<S>,3,4> { typedef
RgbishToRgbish<Rgb8, Bgrx<S> > type; };
template <> struct DefaultConversion<Rgb8,Rgb8,3,3> { typedef
GenericConversion<Rgb8, Rgb8> type; };
// Rgba<T> to X
template <class T, class S> struct DefaultConversion<Rgba<T>,S,4,1> {
typedef CIE<Rgba<T>,S> type; };
template <class T, class S> struct DefaultConversion<Rgba<T>,Rgb<S>,4,3> {
typedef RgbishToRgbish<Rgba<T>, Rgb<S> > type; };
+ template <class T, class S> struct DefaultConversion<Rgba<T>,Bgrx<S>,4,3> {
typedef RgbishToRgbish<Rgba<T>, Bgrx<S> > type; };
template <class T> struct DefaultConversion<Rgba<T>,Rgb8,4,3> { typedef
RgbishToRgbish<Rgba<T>, Rgb8> type; };
template <class T, class S> struct DefaultConversion<Rgba<T>,Rgba<S>,4,4> {
typedef RgbishToRgbish<Rgba<T>, Rgba<S> > type; };
template <class T, class S> struct DefaultConversion<Rgba<T>,Argb<S>,4,4> {
typedef RgbishToRgbish<Rgba<T>, Argb<S> > type; };
@@ -310,6 +322,11 @@
static const int is = std::numeric_limits<C>::is_specialized;
};
+ template<class C> struct DefaultConvertible<Bgrx<C> >
+ {
+ static const int is = std::numeric_limits<C>::is_specialized;
+ };
+
template<> struct DefaultConvertible<Rgb8>
{
static const int is = 1;
Index: name_CVD_rgb_types.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/name_CVD_rgb_types.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- name_CVD_rgb_types.h 9 May 2005 11:54:59 -0000 1.3
+++ name_CVD_rgb_types.h 20 Mar 2010 13:42:57 -0000 1.4
@@ -38,6 +38,10 @@
{
static const std::string name(){return "CVD::Rgba<" +
type_name<O>::name() + ">";}
};
+ template<class O> struct type_name<CVD::Bgrx<O> >
+ {
+ static const std::string name(){return "CVD::Bgrx<" +
type_name<O>::name() + ">";}
+ };
}
}
Index: rgb_components.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/rgb_components.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- rgb_components.h 25 Jun 2009 08:45:03 -0000 1.11
+++ rgb_components.h 20 Mar 2010 13:42:57 -0000 1.12
@@ -25,6 +25,7 @@
#include <cvd/rgba.h>
#include <cvd/rgb8.h>
#include <cvd/argb.h>
+#include <cvd/bgrx.h>
#include <cvd/la.h>
#include <cvd/internal/builtin_components.h>
#include <cvd/internal/pixel_traits.h>
@@ -54,6 +55,27 @@
}
};
+ template<class P> struct Component<Bgrx<P> >
+ {
+ typedef P type;
+ static const size_t count = 3;
+
+
+ //This version is much faster, with -funroll-loops
+ static const P& get(const Bgrx<P>& pixel, size_t i)
+ {
+ return *(reinterpret_cast<const P*>(&pixel)+i);
+ //return i == 0 ? pixel.blue : (i==1 ?
pixel.green : pixel.red);
+ }
+
+ static P& get(Bgrx<P>& pixel, size_t i)
+ {
+ return *(reinterpret_cast<P*>(&pixel)+i);
+ // return i == 0 ? pixel.blue : (i==1 ?
pixel.green : pixel.red);
+ }
+ };
+
+
template<> struct Component<Rgb8>
{
typedef unsigned char type;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd/cvd/internal convert_pixel_types.h name_...,
Edward Rosten <=