libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd cvd/convolution.h cvd/cpu_hacks.h cvd/di...


From: Gerhard Reitmayr
Subject: [libcvd-members] libcvd cvd/convolution.h cvd/cpu_hacks.h cvd/di...
Date: Thu, 12 Jun 2008 13:04:17 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      08/06/12 13:04:16

Modified files:
        cvd            : convolution.h cpu_hacks.h diskbuffer2.h 
                         gl_helpers.h glwindow.h image.h timer.h 
                         utility.h vision.h 
        cvd/internal   : aligned_mem.h builtin_components.h 
                         rgb_components.h scalar_convert.h 
        cvd/internal/io: bmp.h 
        cvd_src        : convolution.cc cvd_timer.cc diskbuffer2.cc 
                         draw.cc eventobject.cpp nonmax_suppression.cxx 
                         thread.cpp utility_helpers.h 
        cvd_src/i686   : convolve_gaussian.cc gradient.cc 
                         utility_byte_differences.cc 
                         utility_double_int.cc utility_float.cc 
        pnm_src        : jpeg.cxx save_postscript.cxx 
Added files:
        build/vc2005   : config.h libcvd.sln libcvd.vcproj 
        cvd_src/Win32  : glwindow.cpp win32.cpp win32.h 
        cvd_src/noarch : default_memalign.cpp posix_memalign.cpp 

Log message:
        porting libcvd to Win32:
        - added VC2005 build files
          - these create a static libcvd library (to avoid dllimport/dllexport 
hassle)
          - the library is created in release and debug version
          - runtime library is the static one /MT or /MTd for debug
          - the configuration directory contains a Win32 specific config.h 
header file which is copied by the build system to cvd/ before compilation. 
make any changes there
        - a new OS specific cvd_src/Win32 directory contains platform specific 
implementations of GLWindow and aligned memory allocation and some helpers
        - aligned mem has now a unified interface and at build time switches 
between the buildin implementation and posix_memalign and Win32 aligned 
allocation.
        - the port depends on the pthreads-win32 library 
http://sourceware.org/pthreads-win32/ and libjpeg. other image libraries should 
be usable as well, need to be added to config.h and build system
        
        I didn't make any attempt to come up with a solution to specifying 
where other libraries and header files are. Use the project settings to 
configure these.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/convolution.h?cvsroot=libcvd&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/cpu_hacks.h?cvsroot=libcvd&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/diskbuffer2.h?cvsroot=libcvd&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/gl_helpers.h?cvsroot=libcvd&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/glwindow.h?cvsroot=libcvd&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/image.h?cvsroot=libcvd&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/timer.h?cvsroot=libcvd&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/utility.h?cvsroot=libcvd&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/vision.h?cvsroot=libcvd&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/aligned_mem.h?cvsroot=libcvd&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/builtin_components.h?cvsroot=libcvd&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/rgb_components.h?cvsroot=libcvd&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/scalar_convert.h?cvsroot=libcvd&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/io/bmp.h?cvsroot=libcvd&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/convolution.cc?cvsroot=libcvd&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/cvd_timer.cc?cvsroot=libcvd&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/diskbuffer2.cc?cvsroot=libcvd&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/draw.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/eventobject.cpp?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/nonmax_suppression.cxx?cvsroot=libcvd&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/thread.cpp?cvsroot=libcvd&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/utility_helpers.h?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/i686/convolve_gaussian.cc?cvsroot=libcvd&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/i686/gradient.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/i686/utility_byte_differences.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/i686/utility_double_int.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/i686/utility_float.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/libcvd/pnm_src/jpeg.cxx?cvsroot=libcvd&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/libcvd/pnm_src/save_postscript.cxx?cvsroot=libcvd&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/libcvd/build/vc2005/config.h?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/build/vc2005/libcvd.sln?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/build/vc2005/libcvd.vcproj?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/Win32/glwindow.cpp?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/Win32/win32.cpp?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/Win32/win32.h?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/noarch/default_memalign.cpp?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/noarch/posix_memalign.cpp?cvsroot=libcvd&rev=1.1

Patches:
Index: cvd/convolution.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/convolution.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- cvd/convolution.h   6 May 2008 19:56:01 -0000       1.13
+++ cvd/convolution.h   12 Jun 2008 13:04:12 -0000      1.14
@@ -443,17 +443,17 @@
        const sum_type* input = getPixelRowTyped(I[i], w, rowbuf);
        // beginning of row
        for (int j=0; j<ksize; j++) {
-           sum_type hsum = input[j] * factor;
+           sum_type hsum = static_cast<sum_type>(input[j] * factor);
            for (int k=0; k<ksize; k++)
                hsum += (input[std::max(j-k-1,0)] + input[j+k+1]) * kernel[k];
            next_row[j] = hsum;
        }
        // middle of row
        input += ksize;
-       input = convolveMiddle<sum_type, sum_comp_type>(input, factor, 
&kernel.front(), ksize, w-swin, next_row+ksize);
+       input = convolveMiddle<sum_type, sum_comp_type>(input, 
static_cast<sum_comp_type>(factor), &kernel.front(), ksize, w-swin, 
next_row+ksize);
        // end of row
        for (int j=w-ksize; j<w; j++, input++) {
-           sum_type hsum = *input * factor;
+           sum_type hsum = static_cast<sum_type>(*input * factor);
            const int room = w-j;
            for (int k=0; k<ksize; k++) {
                hsum += (input[-k-1] + input[std::min(k+1,room-1)]) * kernel[k];

Index: cvd/cpu_hacks.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/cpu_hacks.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cvd/cpu_hacks.h     31 Jul 2006 16:19:18 -0000      1.5
+++ cvd/cpu_hacks.h     12 Jun 2008 13:04:13 -0000      1.6
@@ -28,6 +28,10 @@
        #include <fenv.h>
 #endif
 
+#if CVD_HAVE_MMXEXT
+    #include <xmmintrin.h>
+#endif
+
 namespace CVD
 {
 
@@ -73,22 +77,22 @@
                #ifdef  CVD_HAVE_MMXEXT 
                        template<int I> inline void prefetch(const void* ptr)
                        {
-                               asm( "prefetchnta %0\n": :"m"(ptr));
+                _mm_prefetch((char *)ptr, _MM_HINT_NTA);
                        }
 
                        template<> inline void prefetch<0>(const void* ptr)
                        {
-                               asm( "prefetcht0 %0\n": :"m"(ptr));
+                               _mm_prefetch((char *)ptr, _MM_HINT_T0);
                        }
                        
                        template<> inline void prefetch<1>(const void* ptr)
                        {
-                               asm( "prefetcht1 %0\n": :"m"(ptr));
+                               _mm_prefetch((char *)ptr, _MM_HINT_T1);
                        }
 
                        template<> inline void prefetch<2>(const void* ptr)
                        {
-                               asm( "prefetcht2 %0\n": :"m"(ptr));
+                _mm_prefetch((char *)ptr, _MM_HINT_T2);
                        }
                
                        inline void prefetch(const void* ptr)

Index: cvd/diskbuffer2.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/diskbuffer2.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- cvd/diskbuffer2.h   28 Feb 2008 00:27:21 -0000      1.15
+++ cvd/diskbuffer2.h   12 Jun 2008 13:04:13 -0000      1.16
@@ -32,7 +32,6 @@
 #include <cvd/image_io.h>
 #include <cvd/config.h>
 
-#include <sys/time.h>
 namespace CVD
 {
        //

Index: cvd/gl_helpers.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/gl_helpers.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- cvd/gl_helpers.h    30 Oct 2007 15:06:25 -0000      1.35
+++ cvd/gl_helpers.h    12 Jun 2008 13:04:13 -0000      1.36
@@ -32,6 +32,9 @@
 #include <cvd/rgb8.h>
 #include <cvd/rgba.h>
 #include <cvd/config.h>
+#ifdef WIN32
+#include <windows.h>
+#endif
 #include <GL/gl.h>
 #include <GL/glu.h>
 #include <cvd/internal/gl_types.h>
@@ -206,7 +209,7 @@
     /// @ingroup gGL
     inline void glTranslate( const ImageRef & v )
     {
-        glTranslatef( v.x, v.y, 0);
+        glTranslatef( static_cast<GLfloat>(v.x), static_cast<GLfloat>(v.y), 0);
     }
 
        /// add a translation specified from the first three coordinates of a 
vector

Index: cvd/glwindow.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/glwindow.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- cvd/glwindow.h      25 Apr 2008 22:37:13 -0000      1.9
+++ cvd/glwindow.h      12 Jun 2008 13:04:13 -0000      1.10
@@ -135,8 +135,9 @@
        void activate();
        /// Make this GL context active
        void make_current() { activate(); }
-    private:
+
        struct State;
+    private:
        State* state;
        void init(const ImageRef& size, int bpp, const std::string& title);
     };

Index: cvd/image.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/image.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- cvd/image.h 15 May 2008 17:39:14 -0000      1.39
+++ cvd/image.h 12 Jun 2008 13:04:13 -0000      1.40
@@ -40,7 +40,6 @@
 #include <utility>
 #include <iterator>
 #include <cvd/internal/aligned_mem.h>
-#include <stdlib.h>
 
 namespace CVD {
 
@@ -744,14 +743,7 @@
                        *num_copies = 1;
                        this->my_size = size;
                        this->my_stride = size.x;
-#if CVD_HAVE_MEMALIGN
-                       void* mem=0;
-                       const int alloc_err = posix_memalign(&mem, 16, 
this->totalsize()*sizeof(T));
-                       assert(alloc_err == 0);
-                       this->my_data = new (mem) T[this->totalsize()];
-#else
-                       this->my_data = 
Internal::aligned_mem<T,16>::alloc(this->totalsize());
-#endif
+            this->my_data = Internal::aligned_alloc<T>(this->totalsize(), 16);
                }
 
                ///Create a filled image of a given size
@@ -817,12 +809,7 @@
                {
                        if(this->my_data && *num_copies && --(*num_copies) == 0)
                        {
-#if CVD_HAVE_MEMALIGN
-                           Internal::placement_delete<T>::free(this->my_data, 
this->totalsize());
-                           free(this->my_data);
-#else
-                           Internal::aligned_mem<T,16>::release(this->my_data);
-#endif
+                Internal::aligned_free<T>(this->my_data, this->totalsize());
                            this->my_data = 0;
                            delete   num_copies;
                            num_copies = 0;
@@ -852,4 +839,3 @@
 
 } // end namespace
 #endif
-

Index: cvd/timer.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/timer.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- cvd/timer.h 5 Mar 2008 00:35:43 -0000       1.10
+++ cvd/timer.h 12 Jun 2008 13:04:13 -0000      1.11
@@ -28,7 +28,7 @@
 #ifndef __CVD_TIMER_H
 #define __CVD_TIMER_H
 
-#include <sys/time.h>
+struct timeval;
 
 namespace CVD {
 

Index: cvd/utility.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/utility.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cvd/utility.h       28 Feb 2008 00:27:21 -0000      1.6
+++ cvd/utility.h       12 Jun 2008 13:04:13 -0000      1.7
@@ -98,7 +98,7 @@
   /// Compute pointwise differences (a_i - b_i) and store in diff_i
   /// This is accelerated using SIMD for some platforms and data types 
(alignment is checked at runtime)
   /// Do not specify template parameters explicitly so that overloading can 
choose the right implementation
-  template <class A, class B> inline void differences(const A* a, const A* b, 
B* diff, unsigned int count)
+  template <class A, class B> inline void differences(const A* a, const A* b, 
B* diff, size_t count)
   {
       while (count--)
          *(diff++) = (B)*(a++) - (B)*(b++);
@@ -107,7 +107,7 @@
   /// Compute pointwise (a_i + b_i) * c and add to out_i
   /// This is accelerated using SIMD for some platforms and data types 
(alignment is checked at runtime)
   /// Do not specify template parameters explicitly so that overloading can 
choose the right implementation
-  template <class A, class B> inline void add_multiple_of_sum(const A* a, 
const A* b, const A& c,  B* out, unsigned int count)
+  template <class A, class B> inline void add_multiple_of_sum(const A* a, 
const A* b, const A& c,  B* out, size_t count)
   {
       while (count--)
          *(out++) += (*(a++) + *(b++)) * c;
@@ -116,7 +116,7 @@
   /// Compute pointwise a_i * c and store in out_i
   /// This is accelerated using SIMD for some platforms and data types 
(alignment is checked at runtime)
   /// Do not specify template parameters explicitly so that overloading can 
choose the right implementation
-      template <class A, class B, class C> inline void assign_multiple(const 
A* a, const B& c,  C* out, unsigned int count)
+      template <class A, class B, class C> inline void assign_multiple(const 
A* a, const B& c,  C* out, size_t count)
   {
       while (count--)
          *(out++) = static_cast<C>(*(a++) * c);
@@ -125,7 +125,7 @@
   /// Compute sum(a_i*b_i)
   /// This is accelerated using SIMD for some platforms and data types 
(alignment is checked at runtime)
   /// Do not specify template parameters explicitly so that overloading can 
choose the right implementation
-  template <class T> double inner_product(const T* a, const T* b, unsigned int 
count) {
+  template <class T> double inner_product(const T* a, const T* b, size_t 
count) {
       double dot = 0;
       while (count--)
          dot += *(a++) * *(b++);
@@ -181,19 +181,19 @@
   void differences(const short* a, const short* b, short* diff, unsigned int 
size);
 
 
-  void differences(const float* a, const float* b, float* diff, unsigned int 
size);
-  void add_multiple_of_sum(const float* a, const float* b, const float& c,  
float* out, unsigned int count);
-  void assign_multiple(const float* a, const float& c,  float* out, unsigned 
int count);
-  double inner_product(const float* a, const float* b, unsigned int count);
+  void differences(const float* a, const float* b, float* diff, size_t size);
+  void add_multiple_of_sum(const float* a, const float* b, const float& c,  
float* out, size_t count);
+  void assign_multiple(const float* a, const float& c,  float* out, size_t 
count);
+  double inner_product(const float* a, const float* b, size_t count);
   double sum_squared_differences(const float* a, const float* b, size_t count);
   void square(const float* in, float* out, size_t count);
   void subtract_square(const float* in, float* out, size_t count);
 
-  void differences(const int32_t* a, const int32_t* b, int32_t* diff, unsigned 
int size);
-  void differences(const double* a, const double* b, double* diff, unsigned 
int size);
-  void add_multiple_of_sum(const double* a, const double* b, const float& c,  
double* out, unsigned int count);
-  void assign_multiple(const double* a, const double& c,  double* out, 
unsigned int count);
-  double inner_product(const double* a, const double* b, unsigned int count);
+  void differences(const int32_t* a, const int32_t* b, int32_t* diff, size_t 
size);
+  void differences(const double* a, const double* b, double* diff, size_t 
size);
+  void add_multiple_of_sum(const double* a, const double* b, const float& c,  
double* out, size_t count);
+  void assign_multiple(const double* a, const double& c,  double* out, size_t 
count);
+  double inner_product(const double* a, const double* b, size_t count);
   double sum_squared_differences(const double* a, const double* b, size_t 
count);
   long long sum_squared_differences(const byte* a, const byte* b, size_t 
count);
 

Index: cvd/vision.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/vision.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- cvd/vision.h        12 May 2008 17:30:36 -0000      1.29
+++ cvd/vision.h        12 Jun 2008 13:04:13 -0000      1.30
@@ -260,7 +260,7 @@
     float e = a-b;
     x-=lx;
     y-=ly;
-    result = x*(y*(e-c+d)-e)+y*(c-a)+a;
+    result = (float)(x*(y*(e-c+d)-e)+y*(c-a)+a);
   }
 
 #if defined (CVD_HAVE_TOON)

Index: cvd/internal/aligned_mem.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/aligned_mem.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- cvd/internal/aligned_mem.h  22 Feb 2008 15:24:34 -0000      1.11
+++ cvd/internal/aligned_mem.h  12 Jun 2008 13:04:13 -0000      1.12
@@ -1,17 +1,8 @@
 #ifndef CVD_ALIGNED_MEM_H
 #define CVD_ALIGNED_MEM_H
-#include <map>
 #include <cassert>
 #include <cvd/config.h>
 
-#ifdef _REENTRANT
-    #ifndef CVD_HAVE_PTHREAD
-       #error "CVD is not compiled with thread support. This code is not 
thread safe."
-    #else 
-       #include <cvd/synchronized.h>
-    #endif
-#endif
-
 namespace CVD {
   namespace Internal
   {
@@ -44,72 +35,35 @@
       static inline void free(T*, size_t ) {}
     };
 
+    void * aligned_alloc(size_t count, size_t alignment);
+    void aligned_free(void * memory);
 
-    template <class T, int N> struct aligned_mem {
-       struct entry {
-           char* buffer;
-           size_t count;
-       };
-       static std::map<T*, entry> buffers;
-
-       #if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
-           static Synchronized mutex;
-       #endif
-
-
-       static T* alloc(size_t count)
-       {
-           char* start = new char[count*sizeof(T) + N];
-           size_t val = (size_t)start;
-           T* astart = new (start + (N-(val % N))) T[count];
-           entry e = {start, count};
-
-
-           #if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
-           Lock lock(mutex);
-           #endif
-
-           buffers[astart] = e;
-
-           return astart;
+    template <class T> 
+    inline T * aligned_alloc(size_t count, size_t alignment){
+        void * data = aligned_alloc(sizeof(T)* count, alignment);
+        return new (data) T[count];
        }
 
-       static void release(T* ptr) 
-       {
-           #if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
-           Lock lock(mutex);
-           #endif
-
-           typename std::map<T*,entry>::iterator it = buffers.find(ptr);
-           assert(it != buffers.end());
-           placement_delete<T>::free(ptr, it->second.count);
-           delete[] it->second.buffer;
-
-
-           buffers.erase(it);
+    template <class T>
+    inline void aligned_free(T * memory, size_t count){
+        placement_delete<T>::free(memory, count);   
+        aligned_free(memory);
        }
-    };
-       #if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
-               template<class T, int N> Synchronized aligned_mem<T,N>::mutex;
-       #endif
 
-    template <class T, int N> std::map<T*,typename aligned_mem<T,N>::entry> 
aligned_mem<T,N>::buffers;
-
-  }
+  } // namespace Internal
 
     template <class T, int N> struct AlignedMem {
        T* mem;
-       AlignedMem(size_t count) {
-           mem = Internal::aligned_mem<T,N>::alloc(count);
+    size_t count;
+    AlignedMem(size_t c) : count(c) {
+           mem = Internal::aligned_alloc<T>(count, N);
        }
        ~AlignedMem() {
-           Internal::aligned_mem<T,N>::release(mem);
+           Internal::aligned_free<T>(mem, count);
        }
        T* data() { return mem; }
        const T* data() const { return mem; }
     };    
-
-    
 }
 
 #endif

Index: cvd/internal/builtin_components.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/builtin_components.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cvd/internal/builtin_components.h   2 Nov 2007 21:21:45 -0000       1.7
+++ cvd/internal/builtin_components.h   12 Jun 2008 13:04:13 -0000      1.8
@@ -52,14 +52,14 @@
     template<class P> struct Component
     {
       typedef P type;
-      static const unsigned int count = 1;
+      static const size_t count = 1;
                  
-      static const P& get(const P& pixel, int)
+      static const P& get(const P& pixel, size_t)
       {
        return pixel;
       }
 
-      static P& get(P& pixel, int)
+      static P& get(P& pixel, size_t)
       {
        return pixel;
       }
@@ -69,14 +69,14 @@
     template<class P, int I> struct Component<P[I]>
     {
       typedef P type;
-      static const unsigned int count=I;
+      static const size_t count=I;
       
-      static const P& get(const P pixel[I], unsigned int i)
+      static const P& get(const P pixel[I], size_t i)
       {
        return pixel[i];
       }
 
-      static inline P& get(P pixel[I], unsigned int i)
+      static inline P& get(P pixel[I], size_t i)
       {
        return pixel[i];
       }
@@ -86,14 +86,14 @@
     template<int N> struct Component<TooN::Vector<N> >
     {
       typedef double type;
-      static const unsigned int count=N;
+      static const size_t count=N;
       
-      static const type& get(const TooN::Vector<N>& pixel, unsigned int i)
+      static const type& get(const TooN::Vector<N>& pixel, size_t i)
       {
        return pixel[i];
       }
 
-      static inline type& get(TooN::Vector<N>& pixel, unsigned int i)
+      static inline type& get(TooN::Vector<N>& pixel, size_t i)
       {
        return pixel[i];
       }

Index: cvd/internal/rgb_components.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/rgb_components.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cvd/internal/rgb_components.h       7 Dec 2005 14:45:19 -0000       1.6
+++ cvd/internal/rgb_components.h       12 Jun 2008 13:04:13 -0000      1.7
@@ -35,17 +35,17 @@
                template<class P> struct Component<Rgb<P> >
                {
                        typedef P type;
-                       static const unsigned int count = 3;
+                       static const size_t count = 3;
 
                        
                        //This version is much faster, with -funroll-loops
-                       static const P& get(const Rgb<P>& pixel, unsigned int i)
+                       static const P& get(const Rgb<P>& pixel, size_t i)
                        {
                                return *(reinterpret_cast<const P*>(&pixel)+i);
                                //return i == 0 ? pixel.red : (i==1 ? 
pixel.green : pixel.blue);
                        }
 
-                       static P& get(Rgb<P>& pixel, unsigned int i)
+                       static P& get(Rgb<P>& pixel, size_t i)
                        {
                                return *(reinterpret_cast<P*>(&pixel)+i);
                                // return i == 0 ? pixel.red : (i==1 ? 
pixel.green : pixel.blue);
@@ -55,15 +55,15 @@
                template<> struct Component<Rgb8>
                {
                        typedef unsigned char type;
-                       static const unsigned int count = 3;
+                       static const size_t count = 3;
 
-                       static const type& get(const Rgb8& pixel, unsigned int 
i)
+                       static const type& get(const Rgb8& pixel, size_t i)
                        {
                                return *(reinterpret_cast<const unsigned 
char*>(&pixel)+i);
                                //return i == 0 ? pixel.red : (i==1 ? 
pixel.green : pixel.blue);
                        }
 
-                       static type& get(Rgb8& pixel, unsigned int i)
+                       static type& get(Rgb8& pixel, size_t i)
                        {
                                return *(reinterpret_cast<unsigned 
char*>(&pixel)+i);
                                //return i == 0 ? pixel.red : (i==1 ? 
pixel.green : pixel.blue);
@@ -73,15 +73,15 @@
                template<class P> struct Component<Rgba<P> >
                {
                        typedef P type;
-                       static const unsigned int count = 4;
+                       static const size_t count = 4;
 
-                       static const P& get(const Rgba<P>& pixel, unsigned int 
i)
+                       static const P& get(const Rgba<P>& pixel, size_t i)
                        {
                                return *(reinterpret_cast<const P*>(&pixel)+i);
                                //return i == 0 ? pixel.red : (i==1 ? 
pixel.green : (i==2 ?pixel.blue: pixel.alpha));
                        }
 
-                       static P& get(Rgba<P>& pixel, unsigned int i)
+                       static P& get(Rgba<P>& pixel, size_t i)
                        {
                                return *(reinterpret_cast<P*>(&pixel)+i);
                                //return i == 0 ? pixel.red : (i==1 ? 
pixel.green : (i==2 ?pixel.blue: pixel.alpha));

Index: cvd/internal/scalar_convert.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/scalar_convert.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- cvd/internal/scalar_convert.h       12 May 2008 17:52:01 -0000      1.12
+++ cvd/internal/scalar_convert.h       12 Jun 2008 13:04:14 -0000      1.13
@@ -106,7 +106,7 @@
                
                template <class S> bool buildLookupTable(S table[]) {
                  for (int i=0; i<=511; i++)
-                   table[i] = (i-255)/255.0;    
+                   table[i] = (S)((i-255)/255.0);    
                  return true;
                }
                const static bool init_float_for_byte = 
buildLookupTable(float_for_byte);
@@ -135,7 +135,7 @@
                
                template <class D> struct 
ScalarConvert<byte,float,D,false,false> {
                    static inline float from(const D& from) {
-                       return from * (1.0/255.0);
+                       return static_cast<float>(from * (1.0/255.0));
                    }
                };
 

Index: cvd/internal/io/bmp.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/io/bmp.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cvd/internal/io/bmp.h       15 May 2008 22:57:02 -0000      1.7
+++ cvd/internal/io/bmp.h       12 Jun 2008 13:04:14 -0000      1.8
@@ -62,13 +62,13 @@
          Internal::simple_vector<T> cvt(256);
          Pixel::ConvertPixels<Rgb<byte>,T>::convert(&palette[0], &cvt[0], 256);
          for (int r=im.size().y-1; r>=0; r--) {
-           in.read((char*)&rowbuf[0], rowSize);
+          in.read((char*)&rowbuf[0], static_cast<std::streamsize>(rowSize));
            for (int c=0; c<im.size().x; c++)
              im[r][c] = cvt[rowbuf[c]];
          } 
        } else {          
          for (int r=im.size().y-1; r>=0; r--) {
-           in.read((char*)&rowbuf[0], rowSize);
+           in.read((char*)&rowbuf[0], static_cast<std::streamsize>(rowSize));
            Pixel::ConvertPixels<byte,T>::convert(&rowbuf[0], im[r], 
im.size().x);
          }
        }
@@ -81,7 +81,7 @@
          rowSize += 4 - (rowSize%4);
        Internal::simple_vector<byte> rowbuf(rowSize);
        for (int r=im.size().y-1; r>=0; r--) {
-         in.read((char*)&rowbuf[0], rowSize);
+         in.read((char*)&rowbuf[0], static_cast<std::streamsize>(rowSize));
          for (int c=0; c<im.size().x*3; c+=3) {
            byte tmp = rowbuf[c];
            rowbuf[c] = rowbuf[c+2];

Index: cvd_src/convolution.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/convolution.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cvd_src/convolution.cc      4 Jun 2008 22:27:49 -0000       1.6
+++ cvd_src/convolution.cc      12 Jun 2008 13:04:14 -0000      1.7
@@ -8,7 +8,7 @@
 
 void convolveSeparableGray(unsigned char* I, unsigned int width, unsigned int 
height, const int kernel[], unsigned int size, int divisor)
 {
-    unsigned char buffer[width>height ? width : height];
+    std::vector<unsigned char> buffer(width>height ? width : height);
     unsigned char* p = I;
     unsigned int i,j,m;
     if (size%2 == 0) {
@@ -22,41 +22,7 @@
                 sum += p[j+m] * kernel[m];
             buffer[j] = (unsigned char)(sum/divisor);
         }
-        memcpy(p+size/2, buffer, width-size+1);
-        p += width;
-    }
-    for (j=0;j<width-size+1;j++) {
-        p = I+j+(size/2)*width;
-        for (i=0; i<height;i++)
-            buffer[i] = I[i*width+j];
-        for (i=0;i<height-size+1;i++) {
-            int sum = 0;
-            for (m=0; m<size; m++)
-                sum += buffer[i+m] * kernel[m];
-            *p = (unsigned char)(sum/divisor);
-            p += width;
-        }
-    }
-}
-
-// TODO:: not used at all ?
-void convolveSeparableRGB(unsigned char* I, unsigned int width, unsigned int 
height, const int kernel[], unsigned int size, int divisor)
-{
-    unsigned char buffer[(width>height ? width : height)*3];
-    unsigned char* p = I;
-    unsigned int i,j,m;
-    if (size%2 == 0) {
-        printf("In convolveSeparable, size must be odd.\n");
-        return;
-    }
-    for (i=height; i>0; i--) {
-        for (j=0;j<width-size+1;j++) {
-            int sum = 0;
-            for (m=0; m<size; m++)
-                sum += p[j+m] * kernel[m];
-            buffer[j] = (unsigned char)(sum/divisor);
-        }
-        memcpy(p+size/2, buffer, width-size+1);
+        memcpy(p+size/2, &buffer.front(), width-size+1);
         p += width;
     }
     for (j=0;j<width-size+1;j++) {
@@ -303,15 +269,15 @@
            y3 = tmp[j+1] - (b0*y0 + b1*y1 + b2 * y2);
            y2 = tmp[j+2] - (b0*y3 + b1*y0 + b2 * y1);
            y1 = tmp[j+3] - (b0*y2 + b1*y3 + b2 * y0);
-           o[0] = y0;
-           o[1] = y3;
-           o[2] = y2;
-           o[3] = y1;
+           o[0] = (float)y0;
+           o[1] = (float)y3;
+           o[2] = (float)y2;
+           o[3] = (float)y1;
        }
 
        for (int j=w-rw; j<w; ++j, ++o) {
            double y0 = tmp[j] - (b0*y1 + b1*y2 + b2 * y3);
-           o[0] = y0;
+           o[0] = (float)y0;
            y3 = y2; y2 = y1; y1 = y0;
        }
 
@@ -362,19 +328,19 @@
            y3 = tmp[j+1] - (b0*y0 + b1*y1 + b2 * y2);
            y2 = tmp[j+2] - (b0*y3 + b1*y0 + b2 * y1);
            y1 = tmp[j+3] - (b0*y2 + b1*y3 + b2 * y0);
-           o[0] = alpha_fourth*y0;//clamp01(alpha_fourth*y0); 
+           o[0] = (float)(alpha_fourth*y0);//clamp01(alpha_fourth*y0); 
            o+=stride;
-           o[0] = alpha_fourth*y3;//clamp01(alpha_fourth*y3); 
+           o[0] = (float)(alpha_fourth*y3);//clamp01(alpha_fourth*y3); 
            o+=stride;
-           o[0] = alpha_fourth*y2;//clamp01(alpha_fourth*y2); 
+           o[0] = (float)(alpha_fourth*y2);//clamp01(alpha_fourth*y2); 
            o+=stride;
-           o[0] = alpha_fourth*y1;//clamp01(alpha_fourth*y1); 
+           o[0] = (float)(alpha_fourth*y1);//clamp01(alpha_fourth*y1); 
            o+=stride;
        }
 
        for (int j=h-rh; j<h; ++j, o+=stride) {
            double y0 = tmp[j] - (b0*y1 + b1*y2 + b2 * y3);
-           o[0] = alpha_fourth*y0;//clamp01(alpha_fourth*y0);
+           o[0] = (float)(alpha_fourth*y0);//clamp01(alpha_fourth*y0);
            y3 = y2; y2 = y1; y1 = y0;
        }
     }

Index: cvd_src/cvd_timer.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/cvd_timer.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- cvd_src/cvd_timer.cc        5 Mar 2008 00:35:43 -0000       1.8
+++ cvd_src/cvd_timer.cc        12 Jun 2008 13:04:14 -0000      1.9
@@ -28,7 +28,11 @@
 #include "cvd/timer.h"
 #include <iostream>
 
+#ifdef WIN32
+#include "Win32/win32.h"
+#else
 #include <sys/time.h>  //gettimeofday
+#endif
 
 namespace CVD {
 

Index: cvd_src/diskbuffer2.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/diskbuffer2.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cvd_src/diskbuffer2.cc      9 May 2005 11:54:59 -0000       1.5
+++ cvd_src/diskbuffer2.cc      12 Jun 2008 13:04:14 -0000      1.6
@@ -18,6 +18,7 @@
        Foundation, Inc., 
     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
+#include <cvd/config.h>
 #include <cvd/exceptions.h>
 #include <cvd/diskbuffer2.h>
 

Index: cvd_src/draw.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/draw.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/draw.cc     29 Jun 2005 18:07:08 -0000      1.1
+++ cvd_src/draw.cc     12 Jun 2008 13:04:14 -0000      1.2
@@ -34,7 +34,7 @@
                ++y;
         }
     }
-    unsigned int i;
+    size_t i;
     for (i=points.size()-1;i>0;i--)
         points.push_back(ImageRef(-points[i-1].x, points[i-1].y));
     for (i=points.size()-1;i>1;i--)

Index: cvd_src/eventobject.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/eventobject.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/eventobject.cpp     20 Jan 2006 14:25:27 -0000      1.1
+++ cvd_src/eventobject.cpp     12 Jun 2008 13:04:14 -0000      1.2
@@ -1,5 +1,9 @@
 #include <cvd/eventobject.h>
+#ifdef WIN32
+#include "Win32/win32.h"
+#else
 #include <sys/time.h>
+#endif
 
 namespace CVD {
 EventObject::EventObject()

Index: cvd_src/nonmax_suppression.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/nonmax_suppression.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cvd_src/nonmax_suppression.cxx      12 May 2008 17:34:55 -0000      1.7
+++ cvd_src/nonmax_suppression.cxx      12 Jun 2008 13:04:14 -0000      1.8
@@ -47,7 +47,7 @@
        int point_above = 0;
        int point_below = 0;
        
-       const int sz = corners.size(); 
+       const int sz = (int)corners.size(); 
        
        for(int i=0; i < sz; i++)
        {

Index: cvd_src/thread.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/thread.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cvd_src/thread.cpp  24 Jan 2006 23:09:54 -0000      1.2
+++ cvd_src/thread.cpp  12 Jun 2008 13:04:14 -0000      1.3
@@ -2,6 +2,10 @@
 #include <cvd/thread.h>
 #include <time.h>
 
+#ifdef WIN32
+#include <windows.h>
+#endif
+
 namespace CVD {
 //Static variables
 bool Thread::ourInitializedFlag = false;
@@ -78,8 +82,12 @@
 /** Uses nanosleep. */
 void Thread::sleep(unsigned int milli) 
 {
+#ifdef WIN32
+    Sleep(milli);
+#else
    struct timespec ts = { milli/1000, (milli%1000)*1000000 };
    nanosleep(&ts, 0);
+#endif
 }
 
 void Thread::yield()
@@ -89,7 +97,7 @@
 #elif defined(CVD_HAVE_PTHREAD_YIELD_NP)
   pthread_yield_np();
 #else
-#warning "Thread::yield() not implemented"
+//#warning "Thread::yield() not implemented"
 #endif
 }
 

Index: cvd_src/utility_helpers.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/utility_helpers.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/utility_helpers.h   28 Feb 2008 00:27:22 -0000      1.1
+++ cvd_src/utility_helpers.h   12 Jun 2008 13:04:14 -0000      1.2
@@ -1,19 +1,19 @@
 #ifndef CVD_INCLUDE_UTILITY_HELPERS_H
 #define CVD_INCLUDE_UTILITY_HELPERS_H
 
-#include "cvd/utility.h"
+#include <cvd/utility.h>
 #include <xmmintrin.h>
 using namespace std;
 
 namespace CVD{
-    template <class F, class T1, class T2, int A, int M> inline void 
maybe_aligned_differences(const T1* a, const T1* b, T2* c, unsigned int count)
+    template <class F, class T1, class T2, int A, int M> inline void 
maybe_aligned_differences(const T1* a, const T1* b, T2* c, size_t count)
     {
        if (count < M*2) {
            F::unaligned_differences(a,b,c,count);
            return;
        }
        if (!is_aligned<A>(a)) {            
-           unsigned int steps = steps_to_align<A>(a);
+           size_t steps = steps_to_align<A>(a);
            F::unaligned_differences(a,b,c,steps);
            count -= steps;
            a += steps;
@@ -24,21 +24,21 @@
            F::unaligned_differences(a,b,c,count);
            return;
        }       
-       unsigned int block = (count/M)*M;
+       size_t block = (count/M)*M;
        F::aligned_differences(a,b,c,block);
        if (count > block) {
            F::unaligned_differences(a+block,b+block,c+block,count-block);
        }
     }    
     
-    template <class F, class T1, class T2, int A, int M> inline void 
maybe_aligned_add_mul_add(const T1* a, const T1* b, const T1& c, T2* out, 
unsigned int count)
+    template <class F, class T1, class T2, int A, int M> inline void 
maybe_aligned_add_mul_add(const T1* a, const T1* b, const T1& c, T2* out, 
size_t count)
     {
        if (count < M*2) {
            F::unaligned_add_mul_add(a,b,c,out,count);
            return;
        }
        if (!is_aligned<A>(a)) {      
-           unsigned int steps = steps_to_align<A>(a);
+           size_t steps = steps_to_align<A>(a);
            F::unaligned_add_mul_add(a,b,c,out,steps);
            count -= steps;
            a += steps;
@@ -53,20 +53,20 @@
            F::unaligned_add_mul_add(a,b,c,out,count);
            return;
        }
-       unsigned int block = (count/M)*M;
+       size_t block = (count/M)*M;
        F::aligned_add_mul_add(a,b,c,out,block);
        if (count > block)
            F::unaligned_add_mul_add(a+block,b+block,c, out+block,count-block);
     }    
 
-    template <class F, class T1, class T2, int A, int M> inline void 
maybe_aligned_assign_mul(const T1* a, const T1& c, T2* out, unsigned int count)
+    template <class F, class T1, class T2, int A, int M> inline void 
maybe_aligned_assign_mul(const T1* a, const T1& c, T2* out, size_t count)
     {
        if (count < M*2) {
            F::unaligned_assign_mul(a,c,out,count);
            return;
        }
        if (!is_aligned<A>(a)) {      
-           unsigned int steps = steps_to_align<A>(a);
+           size_t steps = steps_to_align<A>(a);
            F::unaligned_assign_mul(a,c,out,steps);
            count -= steps;
            a += steps;
@@ -76,21 +76,21 @@
                return;
            }
        }
-       unsigned int block = (count/M)*M;
+       size_t block = (count/M)*M;
        F::aligned_assign_mul(a,c,out,block);
        if (count > block) {
            F::unaligned_assign_mul(a+block,c, out+block,count-block);
        }
     }    
 
-    template <class F, class R, class T1, int A, int M> inline R 
maybe_aligned_inner_product(const T1* a, const T1* b, unsigned int count)
+    template <class F, class R, class T1, int A, int M> inline R 
maybe_aligned_inner_product(const T1* a, const T1* b, size_t count)
     {
        if (count < M*2) {
            return F::unaligned_inner_product(a,b,count);
        }
        R sum = 0;
        if (!is_aligned<A>(a)) {      
-           unsigned int steps = steps_to_align<A>(a);
+           size_t steps = steps_to_align<A>(a);
            sum = F::unaligned_inner_product(a,b,steps);
            count -= steps;
            a += steps;
@@ -99,21 +99,21 @@
                return sum + F::unaligned_inner_product(a,b,count);
            }
        }
-       unsigned int block = (count/M)*M;
+       size_t block = (count/M)*M;
        sum += F::aligned_inner_product(a,b,block);
        if (count > block)
            sum += F::unaligned_inner_product(a+block,b+block,count-block);
        return sum;
     }    
 
-    template <class F, class R, class T1, int A, int M> inline R 
maybe_aligned_ssd(const T1* a, const T1* b, unsigned int count)
+    template <class F, class R, class T1, int A, int M> inline R 
maybe_aligned_ssd(const T1* a, const T1* b, size_t count)
     {
        if (count < M*2) {
            return F::unaligned_ssd(a,b,count);
        }
        R sum = 0;
        if (!is_aligned<A>(a)) {      
-           unsigned int steps = steps_to_align<A>(a);
+           size_t steps = steps_to_align<A>(a);
            sum = F::unaligned_ssd(a,b,steps);
            count -= steps;
            a += steps;
@@ -122,7 +122,7 @@
                return sum + F::unaligned_ssd(a,b,count);
            }
        }
-       unsigned int block = (count/M)*M;
+       size_t block = (count/M)*M;
        sum += F::aligned_ssd(a,b,block);
        if (count > block)
            sum += F::unaligned_ssd(a+block,b+block,count-block);
@@ -135,7 +135,7 @@
        return F::unaligned_square(in,out,count);
     }
     if (!is_aligned<A>(in)) {
-       unsigned int steps = steps_to_align<A>(in);
+       size_t steps = steps_to_align<A>(in);
        F::unaligned_square(in,out,steps);
        count -= steps;
        in += steps;
@@ -156,7 +156,7 @@
        return F::unaligned_subtract_square(in,out,count);
     }
     if (!is_aligned<A>(in)) {
-       unsigned int steps = steps_to_align<A>(in);
+       size_t steps = steps_to_align<A>(in);
        F::unaligned_subtract_square(in,out,steps);
        count -= steps;
        in += steps;

Index: cvd_src/i686/convolve_gaussian.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/i686/convolve_gaussian.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cvd_src/i686/convolve_gaussian.cc   4 Jun 2008 14:06:02 -0000       1.3
+++ cvd_src/i686/convolve_gaussian.cc   12 Jun 2008 13:04:15 -0000      1.4
@@ -5,6 +5,26 @@
 
 namespace CVD {
 
+#ifdef WIN32
+inline __m128 operator+( const __m128 & a, const __m128 & b){
+    return _mm_add_ps(a,b);
+}
+
+inline __m128 operator+=( __m128 & a, const __m128 & b){
+    a = _mm_add_ps(a,b);
+    return a;
+}
+
+inline __m128 operator-( const __m128 & a, const __m128 & b){
+    return _mm_sub_ps(a,b);
+}
+
+inline __m128 operator*( const __m128 & a, const __m128 & b){
+    return _mm_mul_ps(a,b);
+}
+
+#endif
+
 inline void convolveMiddle5(const float* in, double factor, const double 
kernel[], int count, float* out)
 {
     int i;
@@ -83,7 +103,7 @@
 template <bool Aligned>
 inline void convolveVertical(const vector<float*>& row, double factor, const 
vector<double>& kernel, int count, float* out)
 {
-    const int ksize = kernel.size();
+    const int ksize = static_cast<int>(kernel.size());
     if (ksize == 2) {
        convolveVertical5<Aligned>(row, factor, &kernel[0], count, out);
        return;
@@ -240,8 +260,14 @@
     unsigned int csr_state = _mm_getcsr();
     _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
     
-    __m128 tmp[w>h?w:h] __attribute__((aligned(16)));
+    AlignedMem<__m128,16> tmpArray(w>h?w:h);
+    __m128 * tmp = tmpArray.data();
+
+#ifdef WIN32
+    __m128 M[9];
+#else
     __m128 M[9] __attribute__((aligned(16)));
+#endif
 
     {  
        double m[3][3];

Index: cvd_src/i686/gradient.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/i686/gradient.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/i686/gradient.cc    28 Feb 2008 00:27:23 -0000      1.1
+++ cvd_src/i686/gradient.cc    12 Jun 2008 13:04:15 -0000      1.2
@@ -5,8 +5,12 @@
 
 namespace CVD {
 
+#ifdef WIN32
+#define shift_left_7(thing) _mm_slli_epi16(thing,7)
+#else
     // I have to use this because gcc 3.3 has an internal bug with 
_mm_slli_epi16
 #define shift_left_7(thing) asm ( "psllw $0x7, %0  \n\t" : : "x"(thing) : "%0" 
);
+#endif
     
     void gradient(const byte* in, short (*out)[2], int w, int h)
     {

Index: cvd_src/i686/utility_byte_differences.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/i686/utility_byte_differences.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/i686/utility_byte_differences.cc    28 Feb 2008 00:27:23 -0000      
1.1
+++ cvd_src/i686/utility_byte_differences.cc    12 Jun 2008 13:04:15 -0000      
1.2
@@ -4,7 +4,7 @@
 
 namespace CVD {
 
-    void byte_to_short_differences(const __m64* a, const __m64* b, __m64* 
diff, unsigned int count)
+    void byte_to_short_differences(const __m64* a, const __m64* b, __m64* 
diff, size_t count)
     {
        __m64 z = _mm_setzero_si64();
        for (;count; --count, ++a, ++b, diff+=2) {
@@ -20,7 +20,7 @@
        _mm_empty();
     }
 
-    void short_differences(const __m64* a, const __m64* b, __m64* diff, 
unsigned int count)
+    void short_differences(const __m64* a, const __m64* b, __m64* diff, size_t 
count)
     {
        while (count--) {
            *(diff++) = _mm_sub_pi16(*(a++), *(b++));
@@ -33,14 +33,14 @@
        template <class T1, class T2> static inline void 
unaligned_differences(const T1* a, const T1* b, T2* diff, size_t count) {
            differences<T1,T2>(a,b,diff,count);
        }
-       static inline void aligned_differences(const byte* a, const byte* b, 
short* diff, unsigned int count) {
+       static inline void aligned_differences(const byte* a, const byte* b, 
short* diff, size_t count) {
            if (is_aligned<8>(b))
                byte_to_short_differences((const __m64*)a,(const __m64*)b, 
(__m64*)diff, count>>3);
            else
                unaligned_differences(a,b,diff,count);
        }
        
-       static inline void aligned_differences(const short* a, const short* b, 
short* diff, unsigned int count) {
+       static inline void aligned_differences(const short* a, const short* b, 
short* diff, size_t count) {
            if (is_aligned<8>(b))           
                short_differences((const __m64*)a, (const __m64*)b, 
(__m64*)diff, count>>2);
            else
@@ -48,11 +48,11 @@
        }
     };
 
-    void differences(const byte* a, const byte* b, short* diff, unsigned int 
count) {
+    void differences(const byte* a, const byte* b, short* diff, size_t count) {
        maybe_aligned_differences<MMX_funcs, byte, short, 8, 8>(a,b,diff,count);
     }
     
-    void differences(const short* a, const short* b, short* diff, unsigned int 
count) {
+    void differences(const short* a, const short* b, short* diff, size_t 
count) {
        maybe_aligned_differences<MMX_funcs, short, short, 8, 
4>(a,b,diff,count);
     }
 }

Index: cvd_src/i686/utility_double_int.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/i686/utility_double_int.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/i686/utility_double_int.cc  28 Feb 2008 00:27:23 -0000      1.1
+++ cvd_src/i686/utility_double_int.cc  12 Jun 2008 13:04:15 -0000      1.2
@@ -4,8 +4,10 @@
 
 namespace CVD {
 
-
+#ifndef WIN32  // this is not used at all?
     static inline __m128i zero_si128() { __m128i x; asm ( "pxor %0, %0  \n\t" 
: "=x"(x) ); return x; }
+#endif
+
     template <bool Aligned> inline __m128i load_si128(const void* addr) { 
return _mm_loadu_si128((const __m128i*)addr); }
     template <> inline __m128i load_si128<true>(const void* addr) { return 
_mm_load_si128((const __m128i*)addr); }
     template <bool Aligned> inline __m128d load_pd(const void* addr) { return 
_mm_loadu_pd((const double*)addr); }
@@ -14,21 +16,21 @@
     template <bool Aligned> inline void store_pd(__m128d m, void* addr) { 
return _mm_storeu_pd((double*)addr, m); }
     template <> inline void store_pd<true>(__m128d m, void* addr) { return 
_mm_store_pd((double*)addr, m); }
 
-    template <bool Aligned_b> void int_differences(const __m128i* a, const 
__m128i* b, __m128i* diff, unsigned int count)
+    template <bool Aligned_b> void int_differences(const __m128i* a, const 
__m128i* b, __m128i* diff, size_t count)
     {
        while (count--) {
            *(diff++) = _mm_sub_epi32(*(a++), load_si128<Aligned_b>(b++));
        }
     }
     
-    template <bool Aligned_b> void double_differences(const __m128d* a, const 
__m128d* b, __m128d* diff, unsigned int count)
+    template <bool Aligned_b> void double_differences(const __m128d* a, const 
__m128d* b, __m128d* diff, size_t count)
     {
        while (count--) {
            *(diff++) = _mm_sub_pd(*(a++), load_pd<Aligned_b>(b++));
        }
     }
 
-    template <bool Aligned_b> void double_add_multiple_of_sum(const __m128d* 
a, const __m128d* b, const double& c, __m128d* out, unsigned int count)
+    template <bool Aligned_b> void double_add_multiple_of_sum(const __m128d* 
a, const __m128d* b, const double& c, __m128d* out, size_t count)
     {
        __m128d cc = _mm_set1_pd(c);
        while (count--) {
@@ -37,16 +39,16 @@
        }
     }
 
-    template <bool Aligned_out> void double_assign_multiple(const __m128d* a, 
const double& c, __m128d* out, unsigned int count)
+    template <bool Aligned_out> void double_assign_multiple(const __m128d* a, 
const double& c, __m128d* out, size_t count)
     {
        __m128d cc = _mm_set1_pd(c);
        while (count--)
            store_pd<Aligned_out>(_mm_mul_pd(*(a++), cc), out++);
     }
-    template <bool Aligned_b> double double_inner_product(const __m128d* a, 
const __m128d* b, unsigned int count)
+    template <bool Aligned_b> double double_inner_product(const __m128d* a, 
const __m128d* b, size_t count)
     {
        double sums_store[2];
-       const unsigned int BLOCK = 1<<16;
+       const size_t BLOCK = 1<<16;
        double dot = 0;
        while (count) {
            size_t pass = std::min(count, BLOCK);
@@ -62,9 +64,9 @@
        return dot;
     }
 
-    template <bool Aligned_b> long long byte_sum_squared_differences(const 
__m128i* a, const __m128i* b, unsigned int count) {
+    template <bool Aligned_b> long long byte_sum_squared_differences(const 
__m128i* a, const __m128i* b, size_t count) {
        unsigned long sums_store[4];    
-       const unsigned int BLOCK = 1<<15;
+       const size_t BLOCK = 1<<15;
        long long ssd = 0;
        while (count) {
            size_t pass = std::min(count, BLOCK);
@@ -89,10 +91,10 @@
        return ssd;
     }
 
-    template <bool Aligned_b> inline double 
double_sum_squared_differences(const __m128d* a, const __m128d* b, unsigned int 
count) 
+    template <bool Aligned_b> inline double 
double_sum_squared_differences(const __m128d* a, const __m128d* b, size_t 
count) 
     {
        double sums_store[2];
-       const unsigned int BLOCK = 1<<10;
+       const size_t BLOCK = 1<<10;
        double ssd = 0;
        while (count) {
            size_t pass = std::min(count, BLOCK);
@@ -114,14 +116,14 @@
            differences<T1,T2>(a,b,diff,count);
        }
 
-       static inline void aligned_differences(const int32_t* a, const int32_t* 
b, int32_t* diff, unsigned int count) {
+       static inline void aligned_differences(const int32_t* a, const int32_t* 
b, int32_t* diff, size_t count) {
            if (is_aligned<16>(b))
                int_differences<true>((const __m128i*)a, (const __m128i*)b, 
(__m128i*)diff, count>>2);
            else
                int_differences<false>((const __m128i*)a, (const __m128i*)b, 
(__m128i*)diff, count>>2);
        }
 
-       static inline void aligned_differences(const double* a, const double* 
b, double* diff, unsigned int count)
+       static inline void aligned_differences(const double* a, const double* 
b, double* diff, size_t count)
        {
            if (is_aligned<16>(b))
                double_differences<true>((const __m128d*)a,(const 
__m128d*)b,(__m128d*)diff,count>>1);
@@ -133,7 +135,7 @@
            add_multiple_of_sum<T1,T2>(a,b,c,out,count);
        }
        
-       static inline void aligned_add_mul_add(const double* a, const double* 
b, const double& c, double* out, unsigned int count)
+       static inline void aligned_add_mul_add(const double* a, const double* 
b, const double& c, double* out, size_t count)
        {
            if (is_aligned<16>(b))
                double_add_multiple_of_sum<true>((const __m128d*)a, (const 
__m128d*)b, c, (__m128d*)out, count>>1);
@@ -145,7 +147,7 @@
            assign_multiple<T1,T2>(a,c,out,count);
        }
 
-       static inline void aligned_assign_mul(const double* a, const double& c, 
double* out, unsigned int count)
+       static inline void aligned_assign_mul(const double* a, const double& c, 
double* out, size_t count)
        {
            if (is_aligned<16>(out))
                double_assign_multiple<true>((const __m128d*)a, c, 
(__m128d*)out, count>>1);
@@ -157,7 +159,7 @@
            return inner_product<T1>(a,b,count);
        }
        
-       static inline double aligned_inner_product(const double* a, const 
double* b, unsigned int count)
+       static inline double aligned_inner_product(const double* a, const 
double* b, size_t count)
        {
            if (is_aligned<16>(b))
                return double_inner_product<true>((const __m128d*) a, (const 
__m128d*) b, count>>1);
@@ -190,27 +192,27 @@
        }       
     };
 
-    void differences(const int32_t* a, const int32_t* b, int32_t* diff, 
unsigned int size)
+    void differences(const int32_t* a, const int32_t* b, int32_t* diff, size_t 
size)
     {
        maybe_aligned_differences<SSE2_funcs, int32_t, int32_t, 16, 
4>(a,b,diff,size);
     }
 
-    void differences(const double* a, const double* b, double* diff, unsigned 
int size)
+    void differences(const double* a, const double* b, double* diff, size_t 
size)
     {
        maybe_aligned_differences<SSE2_funcs, double, double, 16, 
2>(a,b,diff,size);
     }
 
-    void add_multiple_of_sum(const double* a, const double* b, const double& 
c,  double* out, unsigned int count)
+    void add_multiple_of_sum(const double* a, const double* b, const double& 
c,  double* out, size_t count)
     {
        maybe_aligned_add_mul_add<SSE2_funcs, double, double, 16, 
2>(a,b,c,out,count);
     }
 
-    void assign_multiple(const double* a, const double& c,  double* out, 
unsigned int count)
+    void assign_multiple(const double* a, const double& c,  double* out, 
size_t count)
     {
        maybe_aligned_assign_mul<SSE2_funcs, double, double, 16, 
2>(a,c,out,count);
     }
 
-    double inner_product(const double* a, const double* b, unsigned int count)
+    double inner_product(const double* a, const double* b, size_t count)
     {
        return maybe_aligned_inner_product<SSE2_funcs, double, double, 16, 
2>(a,b,count);
     }

Index: cvd_src/i686/utility_float.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/i686/utility_float.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- cvd_src/i686/utility_float.cc       28 Feb 2008 00:27:23 -0000      1.1
+++ cvd_src/i686/utility_float.cc       12 Jun 2008 13:04:15 -0000      1.2
@@ -17,7 +17,7 @@
     template <bool Aligned> inline void store_ps(__m128 m, void* addr) { 
return _mm_storeu_ps((float*)addr, m); }
     template <> inline void store_ps<true>(__m128 m, void* addr) { return 
_mm_store_ps((float*)addr, m); }
 
-    template <bool Aligned_b> void float_differences(const __m128* a, const 
__m128* b, __m128* diff, unsigned int count)
+    template <bool Aligned_b> void float_differences(const __m128* a, const 
__m128* b, __m128* diff, size_t count)
     {
        while (count--) {
            _mm_stream_ps((float*)diff, _mm_sub_ps(load_ps<true>(a), 
load_ps<Aligned_b>(b)));
@@ -27,7 +27,7 @@
        }
     }
     
-    template <bool Aligned_b> void float_add_multiple_of_sum(const __m128* a, 
const __m128* b, const float& c, __m128* out, unsigned int count)
+    template <bool Aligned_b> void float_add_multiple_of_sum(const __m128* a, 
const __m128* b, const float& c, __m128* out, size_t count)
     {
        __m128 cccc = _mm_set1_ps(c);
        while (count--) {
@@ -38,7 +38,7 @@
        }
     }
 
-    template <bool Aligned_out> inline void float_assign_multiple(const 
__m128* a, const float& c, __m128* out, unsigned int count)
+    template <bool Aligned_out> inline void float_assign_multiple(const 
__m128* a, const float& c, __m128* out, size_t count)
     {
        const __m128 cccc = _mm_set1_ps(c);
        while (count--)
@@ -46,10 +46,10 @@
        
     }
     
-    template <bool Aligned_b> double float_inner_product(const __m128* a, 
const __m128* b, unsigned int count)
+    template <bool Aligned_b> double float_inner_product(const __m128* a, 
const __m128* b, size_t count)
     {
        float sums_store[4];
-       const unsigned int BLOCK = 1<<10;
+       const size_t BLOCK = 1<<10;
        double dot = 0;
        while (count) {
            size_t pass = std::min(count, BLOCK);
@@ -108,7 +108,7 @@
            differences<T1,T2>(a,b,diff,count);
        }
        
-       static inline void aligned_differences(const float* a, const float* b, 
float* diff, unsigned int count) {
+       static inline void aligned_differences(const float* a, const float* b, 
float* diff, size_t count) {
            if (is_aligned<16>(b))
                float_differences<true>((const __m128*)a, (const __m128*)b, 
(__m128*)diff, count>>2);
            else
@@ -139,7 +139,7 @@
            return inner_product<T1>(a,b,count);
        }
        
-       static inline double aligned_inner_product(const float* a, const float* 
b, unsigned int count)
+       static inline double aligned_inner_product(const float* a, const float* 
b, size_t count)
        {
            if (is_aligned<16>(b))
                return float_inner_product<true>((const __m128*) a, (const 
__m128*) b, count>>2);
@@ -151,7 +151,7 @@
            return sum_squared_differences<T1>(a,b,count);
        }
        
-       static inline double aligned_ssd(const float* a, const float* b, 
unsigned int count)
+       static inline double aligned_ssd(const float* a, const float* b, size_t 
count)
        {
            if (is_aligned<16>(b))
                return float_sum_squared_differences<true>((const __m128*) a, 
(const __m128*) b, count>>2);
@@ -181,23 +181,23 @@
        }
     };
     
-    void differences(const float* a, const float* b, float* diff, unsigned int 
size)
+    void differences(const float* a, const float* b, float* diff, size_t size)
     {
        maybe_aligned_differences<SSE_funcs, float, float, 16, 
4>(a,b,diff,size);
     }
     
-    void add_multiple_of_sum(const float* a, const float* b, const float& c,  
float* out, unsigned int count)
+    void add_multiple_of_sum(const float* a, const float* b, const float& c,  
float* out, size_t count)
     {
        maybe_aligned_add_mul_add<SSE_funcs,float,float,16,4>(a,b,c,out,count);
     }
     
-    void assign_multiple(const float* a, const float& c,  float* out, unsigned 
int count) 
+    void assign_multiple(const float* a, const float& c,  float* out, size_t 
count) 
     {
        maybe_aligned_assign_mul<SSE_funcs,float,float,16,4>(a,c,out,count);
     }
 
     
-    double inner_product(const float* a, const float* b, unsigned int count) 
+    double inner_product(const float* a, const float* b, size_t count) 
     {
        return 
maybe_aligned_inner_product<SSE_funcs,double,float,16,4>(a,b,count);
     }

Index: pnm_src/jpeg.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/pnm_src/jpeg.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- pnm_src/jpeg.cxx    25 Apr 2008 22:37:14 -0000      1.11
+++ pnm_src/jpeg.cxx    12 Jun 2008 13:04:15 -0000      1.12
@@ -249,7 +249,7 @@
                me->free_in_buffer = bufsize;
        }
 
-       static int s_empty_output_buffer(j_compress_ptr cinfo)
+       static boolean s_empty_output_buffer(j_compress_ptr cinfo)
        {
                jpeg_ostream_dest* me = (jpeg_ostream_dest*) cinfo->dest;
 

Index: pnm_src/save_postscript.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/pnm_src/save_postscript.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- pnm_src/save_postscript.cxx 25 Apr 2008 22:37:14 -0000      1.8
+++ pnm_src/save_postscript.cxx 12 Jun 2008 13:04:15 -0000      1.9
@@ -92,7 +92,7 @@
 
        for(int i=0; i < 5; i++)
        {
-               r[4-i] = num % 85 + 33;
+               r[4-i] = (char)(num % 85 + 33);
                num /= 85;
        }
 

Index: build/vc2005/config.h
===================================================================
RCS file: build/vc2005/config.h
diff -N build/vc2005/config.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ build/vc2005/config.h       12 Jun 2008 13:04:15 -0000      1.1
@@ -0,0 +1,104 @@
+#ifndef CVD_CONFIG_H
+#define CVD_CONFIG_H
+
+#define CVD_ARCH_LITTLE_ENDIAN 1
+#if 0  // not a 64 bit system, potentially enable otherwise
+#ifndef CVD_DISABLE_CPU_x86_64
+    #define CVD_HAVE_CPU_x86_64 1
+#endif
+#endif
+#if 0 // for now would like to find a solution
+#ifndef CVD_DISABLE_GLOB
+    #define CVD_HAVE_GLOB 1
+#endif
+#endif
+
+#ifndef CVD_DISABLE_JPEG
+    #define CVD_HAVE_JPEG 1
+#endif
+#ifndef CVD_DISABLE_LAPACK
+    #define CVD_HAVE_LAPACK 1
+#endif
+#ifndef CVD_DISABLE_MMX
+    #define CVD_HAVE_MMX 1
+#endif
+#ifndef CVD_DISABLE_MMXEXT
+    #define CVD_HAVE_MMXEXT 1
+#endif
+
+#if 0  // FIXME: compile libz and libpng
+#ifndef CVD_DISABLE_PNG
+    #define CVD_HAVE_PNG 1
+#endif
+#endif
+
+#ifndef CVD_DISABLE_PTHREAD
+    #define CVD_HAVE_PTHREAD 1
+#endif
+
+#if 0   // look into that pthred-win32 doesn't have that
+#ifndef CVD_DISABLE_PTHREAD_YIELD
+    #define CVD_HAVE_PTHREAD_YIELD 1
+#endif
+#endif
+
+#ifndef CVD_DISABLE_SSE
+    #define CVD_HAVE_SSE 1
+#endif
+#ifndef CVD_DISABLE_SSE2
+    #define CVD_HAVE_SSE2 1
+#endif
+#ifndef CVD_DISABLE_SSE3
+    #define CVD_HAVE_SSE3 1
+#endif
+
+#if 0   // no TIFF for now 
+#ifndef CVD_DISABLE_TIFF
+    #define CVD_HAVE_TIFF 1
+#endif
+#endif
+
+#ifndef CVD_DISABLE_TOON
+    #define CVD_HAVE_TOON 1
+#endif
+#ifndef CVD_DISABLE_HALFSAMPLE_SSE16
+    #define CVD_INTERNAL_HAVE_HALFSAMPLE_SSE16 1
+#endif
+#ifndef CVD_DISABLE_TIFF_ORIENTED
+    #define CVD_INTERNAL_HAVE_TIFF_ORIENTED 1
+#endif
+#ifndef CVD_DISABLE_YV402P_MMX
+    #define CVD_INTERNAL_HAVE_YV402P_MMX 1
+#endif
+#define CVD_INTERNAL_JPEG_BUFFER_SIZE 1
+
+/*
+#define CVD_KERNEL_MAJOR 2
+#define CVD_KERNEL_MINOR 6
+#define CVD_KERNEL_RELEASE 22
+#define CVD_MAJOR_VERSION 0
+#define CVD_MINOR_VERSION 7
+*/
+
+// make sure to have all necessary definitions included, this requires min 
Windows 2000
+#define _WIN32_WINNT 0x0500
+
+// missing C99 define (C99 not supported in VC++)
+typedef __int32 int32_t;
+
+// avoid warnings about using old unsave versions of libc functions
+#define _CRT_SECURE_NO_WARNINGS
+
+// avoid warnings about checked/unchecked iterators
+#define _SCL_SECURE_NO_WARNINGS
+
+// to get M_PI, etc.
+#define _USE_MATH_DEFINES   
+
+// don't include garbage
+#define WINDOWS_LEAN_AND_MEAN
+
+// don't define macros for min, max
+#define NOMINMAX
+
+#endif //  CVD_CONFIG_WIN_H

Index: build/vc2005/libcvd.sln
===================================================================
RCS file: build/vc2005/libcvd.sln
diff -N build/vc2005/libcvd.sln
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ build/vc2005/libcvd.sln     12 Jun 2008 13:04:15 -0000      1.1
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcvd", "libcvd.vcproj", 
"{DB1962D5-5EBB-499D-9F84-4FCF6435063C}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {DB1962D5-5EBB-499D-9F84-4FCF6435063C}.Debug|Win32.ActiveCfg = 
Debug|Win32
+               {DB1962D5-5EBB-499D-9F84-4FCF6435063C}.Debug|Win32.Build.0 = 
Debug|Win32
+               {DB1962D5-5EBB-499D-9F84-4FCF6435063C}.Release|Win32.ActiveCfg 
= Release|Win32
+               {DB1962D5-5EBB-499D-9F84-4FCF6435063C}.Release|Win32.Build.0 = 
Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal

Index: build/vc2005/libcvd.vcproj
===================================================================
RCS file: build/vc2005/libcvd.vcproj
diff -N build/vc2005/libcvd.vcproj
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ build/vc2005/libcvd.vcproj  12 Jun 2008 13:04:15 -0000      1.1
@@ -0,0 +1,869 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="libcvd"
+       ProjectGUID="{DB1962D5-5EBB-499D-9F84-4FCF6435063C}"
+       RootNamespace="libcvd"
+       Keyword="Win32Proj"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="4"
+                       CharacterSet="0"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               
AdditionalIncludeDirectories="..\..;..\..\..;..\..\..\Pre-built.2\include;..\..\..\jpeg-6b"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="..\..\lib\$(ProjectName)d.lib"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="4"
+                       CharacterSet="0"
+                       WholeProgramOptimization="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               InlineFunctionExpansion="2"
+                               FavorSizeOrSpeed="1"
+                               
AdditionalIncludeDirectories="..\..;..\..\..;..\..\..\Pre-built.2\include;..\..\..\jpeg-6b"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+                               RuntimeLibrary="0"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="true"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="..\..\lib\$(ProjectName).lib"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+                       >
+                       <File
+                               RelativePath="..\..\cvd_src\bayer.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\brezenham.cc"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\colourspace_convert.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\convolution.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\corner_10.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\corner_12.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\corner_9.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\cvd_timer.cc"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\deinterlacebuffer.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\diskbuffer2.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\draw.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\eventobject.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\exceptions.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\fast_corner.cxx"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\fast_corner_9_nonmax.cxx"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\faster_corner_10.cxx"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\faster_corner_12.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\faster_corner_9.cxx"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\faster_corner_utilities.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\half_sample.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\image_io.cc"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\nonmax_suppression.cxx"
+                               >
+                       </File>
+                       <File
+                               
RelativePath="..\..\cvd_src\slower_corner_11.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\slower_corner_7.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\slower_corner_8.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\synchronized.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\tensor_voting.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\thread.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\timeddiskbuffer.cc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\utility_helpers.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\videosource.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\yuv411_to_stuff.cxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\yuv420.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\yuv422.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd_src\yuv422.h"
+                               >
+                       </File>
+                       <Filter
+                               Name="fast"
+                               >
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_10_detect.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_10_score.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_11_detect.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_11_score.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_12_detect.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_12_score.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_7_detect.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_7_score.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_8_detect.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_8_score.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_9_detect.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\fast_9_score.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\fast\prototypes.h"
+                                       >
+                               </File>
+                       </Filter>
+                       <Filter
+                               Name="i686"
+                               >
+                               <File
+                                       
RelativePath="..\..\cvd_src\i686\convolve_gaussian.cc"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\i686\gradient.cc"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\i686\utility_byte_differences.cc"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\i686\utility_double_int.cc"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\i686\utility_float.cc"
+                                       >
+                               </File>
+                       </Filter>
+                       <Filter
+                               Name="noarch"
+                               >
+                               <File
+                                       
RelativePath="..\..\cvd_src\noarch\convert_rgb_to_y.cc"
+                                       >
+                                       <FileConfiguration
+                                               Name="Debug|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                                       <FileConfiguration
+                                               Name="Release|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\noarch\gradient.cc"
+                                       >
+                                       <FileConfiguration
+                                               Name="Debug|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                                       <FileConfiguration
+                                               Name="Release|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\noarch\median_3x3.cc"
+                                       >
+                                       <FileConfiguration
+                                               Name="Debug|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                                       <FileConfiguration
+                                               Name="Release|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\noarch\yuv422_wrapper.cc"
+                                       >
+                                       <FileConfiguration
+                                               Name="Debug|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                                       <FileConfiguration
+                                               Name="Release|Win32"
+                                               >
+                                               <Tool
+                                                       Name="VCCLCompilerTool"
+                                                       
ObjectFile="$(IntDir)\$(InputName)1.obj"
+                                                       
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+                                               />
+                                       </FileConfiguration>
+                               </File>
+                       </Filter>
+                       <Filter
+                               Name="pnm_src"
+                               >
+                               <File
+                                       RelativePath="..\..\pnm_src\bmp.cxx"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\..\pnm_src\jpeg.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\pnm_src\pnm_grok.cxx"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\pnm_src\save_postscript.cxx"
+                                       >
+                               </File>
+                       </Filter>
+                       <Filter
+                               Name="Win32"
+                               >
+                               <File
+                                       
RelativePath="..\..\cvd_src\Win32\glwindow.cpp"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\Win32\win32.cpp"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd_src\Win32\win32.h"
+                                       >
+                               </File>
+                       </Filter>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+                       >
+                       <File
+                               RelativePath="..\..\cvd\abs.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\bresenham.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\brezenham.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\byte.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\camera.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\colourspace.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\colourspace_convert.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\colourspace_frame.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\colourspacebuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\colourspaces.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\config.h"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               CommandLine="copy 
$(InputFileName) ..\..\cvd\&#x0D;&#x0A;"
+                                               
Outputs="..\..\cvd\$(InputFileName)"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               CommandLine="copy 
$(InputFileName) ..\..\cvd\&#x0D;&#x0A;"
+                                               
Outputs="..\..\cvd\$(InputFileName)"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\convolution.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\cpu_hacks.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\cvd_image.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\cvd_timer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\deinterlacebuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\deinterlaceframe.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\diskbuffer2.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\diskbuffer2_frame.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\documentation.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\draw.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\eventobject.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\exceptions.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\fast_corner.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\gl_helpers.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\glwindow.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\helpers.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\image.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\image_convert.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\image_convert_fwd.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\image_interpolate.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\image_io.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\image_ref.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\integral_image.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\localvideobuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\localvideoframe.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\message_queue.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\nonmax_suppression.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\random.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\readaheadvideobuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\rgb.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\rgb8.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\rgba.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\ringbuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\runnable.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\synchronized.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\tensor_voting.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\thread.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\timeddiskbuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\timer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\utility.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\vector_image_ref.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\videobuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\videobufferflags.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\videofilebuffer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\videofilebuffer_frame.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\videoframe.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\videosource.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\vision.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\cvd\yc.h"
+                               >
+                       </File>
+                       <Filter
+                               Name="internal"
+                               >
+                               <File
+                                       
RelativePath="..\..\cvd\internal\aligned_mem.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\assembly.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\io\bmp.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\builtin_components.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\convert_pixel_types.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\disk_image.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\gl_types.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\image_ref_implementation.hh"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\is_pod.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\io\jpeg.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\load_and_save.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\name_builtin_types.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\name_CVD_rgb_types.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\pixel_operations.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\pixel_traits.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\io\png.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\io\pnm_grok.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\rgb_components.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\io\save_postscript.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\scalar_convert.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\simple_vector.h"
+                                       >
+                               </File>
+                               <File
+                                       
RelativePath="..\..\cvd\internal\io\tiff.h"
+                                       >
+                               </File>
+                       </Filter>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+                       
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+                       >
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>

Index: cvd_src/Win32/glwindow.cpp
===================================================================
RCS file: cvd_src/Win32/glwindow.cpp
diff -N cvd_src/Win32/glwindow.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/Win32/glwindow.cpp  12 Jun 2008 13:04:16 -0000      1.1
@@ -0,0 +1,514 @@
+#include <cvd/config.h>
+#include <cvd/glwindow.h>
+#include <exception>
+
+#include <windows.h>
+#include <windowsx.h>
+#include <gl/gl.h>
+
+#include <cassert>
+#include <map>
+#include <iostream>
+using namespace std;
+
+namespace CVD {
+
+Exceptions::GLWindow::CreationError::CreationError(std::string w)
+{
+    what="GLWindow creation error: " + w;
+}
+
+Exceptions::GLWindow::RuntimeError::RuntimeError(std::string w)
+{
+    what="GLWindow error: " + w;
+}
+
+struct GLWindow::State {
+    ImageRef size;
+    ImageRef position;
+    ImageRef size_offset; // offsets dictated by windows decoration to get 
proper MoveWindows arguments
+    ImageRef position_offset;
+    std::string title;
+
+    GLWindow * parent;
+
+    HGLRC   hRC;
+    HDC     hDC;
+    HWND    hWnd;
+};
+
+static map<HWND, GLWindow::State> windowMap;
+
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+
+static GLWindow::EventHandler * currentHandler = NULL;
+
+static bool windowClassRegistered = false;
+
+void GLWindow::init(const ImageRef& size, int bpp, const std::string& title)
+{
+    GLuint             PixelFormat;                    // Holds The Results 
After Searching For A Match
+       WNDCLASS        wc;                                             // 
Windows Class Structure
+       DWORD           dwExStyle;                              // Window 
Extended Style
+       DWORD           dwStyle;                                // Window Style
+       RECT            WindowRect;                             // Grabs 
Rectangle Upper Left / Lower Right Values
+       WindowRect.left=(long)0;                        // Set Left Value To 0
+       WindowRect.right=(long)size.x;          // Set Right Value To Requested 
Width
+       WindowRect.top=(long)0;                         // Set Top Value To 0
+       WindowRect.bottom=(long)size.y;         // Set Bottom Value To 
Requested Height
+
+       //fullscreen=fullscreenflag;                    // Set The Global 
Fullscreen Flag
+       // Grab An Instance For Our Window   
+    HINSTANCE hInstance        = GetModuleHandle(NULL);
+    if(!windowClassRegistered){
+           wc.style                    = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;   
// Redraw On Size, And Own DC For Window.
+           wc.lpfnWndProc              = (WNDPROC) WndProc;                    
                // WndProc Handles Messages
+           wc.cbClsExtra               = 0;                                    
                                // No Extra Window Data
+           wc.cbWndExtra               = 0;                                    
                                // No Extra Window Data
+           wc.hInstance                = hInstance;                            
                        // Set The Instance
+           wc.hIcon                    = LoadIcon(NULL, IDI_WINLOGO);          
        // Load The Default Icon
+           wc.hCursor                  = LoadCursor(NULL, IDC_ARROW);          
        // Load The Arrow Pointer
+           wc.hbrBackground    = NULL;                                         
                        // No Background Required For GL
+           wc.lpszMenuName             = NULL;                                 
                                // We Don't Want A Menu
+           wc.lpszClassName    = "glwindow";                                   
                        // Set The Class Name
+
+           if (!RegisterClass(&wc))
+            throw Exceptions::GLWindow::CreationError("Failed to register the 
Window Class.");
+        windowClassRegistered = true;
+    }
+
+#if 0
+       if (fullscreen)                                                         
                                // Attempt Fullscreen Mode?
+       {
+               DEVMODE dmScreenSettings;                                       
                        // Device Mode
+               memset(&dmScreenSettings,0,sizeof(dmScreenSettings));   // 
Makes Sure Memory's Cleared
+               dmScreenSettings.dmSize=sizeof(dmScreenSettings);               
// Size Of The Devmode Structure
+               dmScreenSettings.dmPelsWidth    = width;                        
        // Selected Screen Width
+               dmScreenSettings.dmPelsHeight   = height;                       
        // Selected Screen Height
+               dmScreenSettings.dmBitsPerPel   = bits;                         
        // Selected Bits Per Pixel
+               
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
+
+               // Try To Set Selected Mode And Get Results.  NOTE: 
CDS_FULLSCREEN Gets Rid Of Start Bar.
+               if 
(ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
+               {
+                       // If The Mode Fails, Offer Two Options.  Quit Or Use 
Windowed Mode.
+                       if (MessageBox(NULL,"The Requested Fullscreen Mode Is 
Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe 
GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
+                       {
+                               fullscreen=FALSE;               // Windowed 
Mode Selected.  Fullscreen = FALSE
+                       }
+                       else
+                       {
+                               // Pop Up A Message Box Letting User Know The 
Program Is Closing.
+                               MessageBox(NULL,"Program Will Now 
Close.","ERROR",MB_OK|MB_ICONSTOP);
+                               return FALSE;                                   
                                // Return FALSE
+                       }
+               }
+       }
+
+       if (fullscreen)                                                         
                                // Are We Still In Fullscreen Mode?
+       {
+               dwExStyle=WS_EX_APPWINDOW;                                      
                        // Window Extended Style
+               dwStyle=WS_POPUP;                                               
                                // Windows Style
+               ShowCursor(FALSE);                                              
                                // Hide Mouse Pointer
+       }
+       else
+#endif
+       {
+               dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;                   
// Window Extended Style
+               dwStyle=WS_OVERLAPPEDWINDOW;                                    
                // Windows Style
+       }
+
+    RECT oldRect = WindowRect;
+    cout << WindowRect.left << " " << WindowRect.top << " " << 
WindowRect.right << " " << WindowRect.bottom << endl;
+
+       AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);             
// Adjust Window To True Requested Size
+
+    cout << WindowRect.left << " " << WindowRect.top << " " << 
WindowRect.right << " " << WindowRect.bottom << endl;
+
+       // Create The Window
+    HWND hWnd;
+       if (!(hWnd=CreateWindowEx(      dwExStyle,                              
                        // Extended Style For The Window
+                                                               "glwindow",     
                                                // Class Name
+                                                               NULL, 
//title.c_str(),                                                          // 
Window Title
+                                                               dwStyle |       
                                                // Defined Window Style
+                                                               WS_CLIPSIBLINGS 
|                                       // Required Window Style
+                                                               
WS_CLIPCHILDREN,                                        // Required Window Style
+                                                               0, 0,           
                                                // Window Position
+                                                               
WindowRect.right-WindowRect.left,       // Calculate Window Width
+                                                               
WindowRect.bottom-WindowRect.top,       // Calculate Window Height
+                                                               NULL,           
                                                // No Parent Window
+                                                               NULL,           
                                                // No Menu
+                                                               hInstance,      
                                                // Instance
+                                                               NULL)))         
                                                // Dont Pass Anything To 
WM_CREATE
+       {
+               throw Exceptions::GLWindow::CreationError("Window Creation 
Error.");
+       }
+
+       static  PIXELFORMATDESCRIPTOR pfd=                              // pfd 
Tells Windows How We Want Things To Be
+       {
+               sizeof(PIXELFORMATDESCRIPTOR),                          // Size 
Of This Pixel Format Descriptor
+               1,                                                              
                        // Version Number
+               PFD_DRAW_TO_WINDOW |                                            
// Format Must Support Window
+               PFD_SUPPORT_OPENGL |                                            
// Format Must Support OpenGL
+               PFD_DOUBLEBUFFER,                                               
        // Must Support Double Buffering
+               PFD_TYPE_RGBA,                                                  
        // Request An RGBA Format
+               bpp,                                                            
                // Select Our Color Depth
+               0, 0, 0, 0, 0, 0,                                               
        // Color Bits Ignored
+               0,                                                              
                        // No Alpha Buffer
+               0,                                                              
                        // Shift Bit Ignored
+               0,                                                              
                        // No Accumulation Buffer
+               0, 0, 0, 0,                                                     
                // Accumulation Bits Ignored
+               32,                                                             
                        // 16Bit Z-Buffer (Depth Buffer)  
+               0,                                                              
                        // No Stencil Buffer
+               0,                                                              
                        // No Auxiliary Buffer
+               PFD_MAIN_PLANE,                                                 
        // Main Drawing Layer
+               0,                                                              
                        // Reserved
+               0, 0, 0                                                         
                // Layer Masks Ignored
+       };
+
+    HDC hDC;
+       if (!(hDC=GetDC(hWnd)))
+        throw Exceptions::GLWindow::CreationError("Can't create a GL Device 
Context.");
+
+       if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))
+        throw Exceptions::GLWindow::CreationError("Can't find a suitable 
PixelFormat.");
+
+       if(!SetPixelFormat(hDC,PixelFormat,&pfd))
+        throw Exceptions::GLWindow::CreationError("Can't Set The 
PixelFormat.");
+
+    HGLRC hRC;
+       if (!(hRC=wglCreateContext(hDC)))
+        throw Exceptions::GLWindow::CreationError("Can't Create A GL Rendering 
Context.");
+
+       if(!wglMakeCurrent(hDC,hRC))
+        throw Exceptions::GLWindow::CreationError("Can't Activate The GL 
Rendering Context.");
+
+       ShowWindow(hWnd,SW_SHOW);                                               
// Show The Window
+       SetForegroundWindow(hWnd);                                              
// Slightly Higher Priority
+       SetFocus(hWnd);                                                         
        // Sets Keyboard Focus To The Window
+
+    glLoadIdentity();
+    glViewport(0, 0, size.x, size.y);
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    glColor3f(1.0f,1.0f,1.0f);
+    glOrtho(0, size.x, size.y, 0, -1 , 1);
+    glPixelZoom(1,-1);
+    glRasterPos2f(0, 0);
+    
+    state = &windowMap[hWnd];
+    state->parent = this;
+    state->size = size;
+    state->title = title;
+    state->hRC = hRC;
+    state->hDC = hDC;
+    state->hWnd = hWnd;
+
+    state->size_offset.x = (WindowRect.right - WindowRect.left) - 
(oldRect.right - oldRect.left);
+    state->size_offset.y = (WindowRect.bottom - WindowRect.top) - 
(oldRect.bottom - oldRect.top);
+    state->position_offset.x = WindowRect.left - oldRect.left;
+    state->position_offset.y = WindowRect.top - oldRect.top;
+
+    state->position = -state->position_offset;
+    cout << state->size_offset << state->position_offset << endl;
+}
+
+GLWindow::~GLWindow()
+{
+       if(state->hRC){
+               if (!wglMakeCurrent(NULL,NULL)) 
+                   throw Exceptions::GLWindow::RuntimeError("Release of DC and 
RC failed.");
+               if (!wglDeleteContext(state->hRC))
+                   throw Exceptions::GLWindow::RuntimeError("Release Rendering 
Context failed.");
+       }
+
+       if (state->hDC && !ReleaseDC(state->hWnd,state->hDC))
+           throw Exceptions::GLWindow::RuntimeError("Release Device Context 
failed.");
+
+       if (state->hWnd && !DestroyWindow(state->hWnd))
+               throw Exceptions::GLWindow::RuntimeError("Destroy Window 
failed.");
+
+#if 0
+       if (!UnregisterClass("glwindow",GetModuleHandle(NULL)))
+        throw Exceptions::GLWindow::RuntimeError("Could not unregister 
Class.");
+#endif
+
+    windowMap.erase(state->hWnd);
+    state = NULL;
+}
+
+ImageRef GLWindow::size() const { return state->size; }
+
+void GLWindow::set_size(const ImageRef & s_){
+    state->size = s_;
+    MoveWindow(state->hWnd, state->position.x, state->position.y, 
state->size.x, state->size.y, FALSE);
+}
+
+ImageRef GLWindow::position() const { return state->position; }
+
+void GLWindow::set_position(const ImageRef & p_){
+    state->position = p_;
+    MoveWindow(state->hWnd, state->position.x, state->position.y, 
state->size.x, state->size.y, FALSE);
+}
+
+void GLWindow::set_cursor_position(const ImageRef& where)
+{
+    // FIXME
+    //XWarpPointer(state->display, None, state->window, 0, 0, 0, 0, where.x, 
where.y);
+}
+
+ImageRef GLWindow::cursor_position() const
+{
+    ImageRef where;
+    POINT point;
+    GetCursorPos(&point);
+    where.x = point.x - state->position.x;
+    where.y = point.y - state->position.y;
+    return where;
+}
+
+void GLWindow::show_cursor(bool show)
+{
+    if (show)
+        ShowCursor(TRUE);
+    else
+        ShowCursor(FALSE);
+}
+
+std::string GLWindow::title() const
+{
+    return state->title;
+}
+
+void GLWindow::set_title(const std::string& title)
+{
+    state->title = title;
+    SetWindowText(state->hWnd, state->title.c_str());
+}
+
+void GLWindow::swap_buffers()
+{
+    SwapBuffers(state->hDC);
+}
+
+inline int convertButtonState(const WPARAM state)
+{
+  int ret = 0;
+  if (state & MK_LBUTTON) ret |= GLWindow::BUTTON_LEFT;
+  if (state & MK_MBUTTON) ret |= GLWindow::BUTTON_MIDDLE;
+  if (state & MK_RBUTTON) ret |= GLWindow::BUTTON_RIGHT;
+  if (state & MK_CONTROL) ret |= GLWindow::BUTTON_MOD_CTRL;
+  if (state & MK_SHIFT)   ret |= GLWindow::BUTTON_MOD_SHIFT;
+  return ret;
+}
+
+inline ImageRef convertPosition(LPARAM param)
+{
+    return ImageRef(GET_X_LPARAM(param), GET_Y_LPARAM(param));
+}
+
+void GLWindow::handle_events(EventHandler& handler)
+{
+       MSG     msg;
+
+    currentHandler = &handler; // for events only received in Window Procedure
+
+    while(PeekMessage(&msg, state->hWnd, 0, 0, PM_REMOVE)){
+        //TranslateMessage(&msg);  // don't care for WM_CHAR/WM_DEADCHAR 
messages
+        switch(msg.message){
+        case WM_LBUTTONDOWN:
+            handler.on_mouse_down(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam), GLWindow::BUTTON_LEFT);
+            break;
+        case WM_LBUTTONUP:
+            handler.on_mouse_up(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam), GLWindow::BUTTON_LEFT);
+            break;
+        case WM_MBUTTONDOWN:
+            handler.on_mouse_down(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam), GLWindow::BUTTON_MIDDLE);
+            break;
+        case WM_MBUTTONUP:
+            handler.on_mouse_up(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam), GLWindow::BUTTON_MIDDLE);
+            break;
+        case WM_RBUTTONDOWN:
+            handler.on_mouse_down(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam), GLWindow::BUTTON_RIGHT);
+            break;
+        case WM_RBUTTONUP:
+            handler.on_mouse_up(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam), GLWindow::BUTTON_RIGHT);
+            break;
+        case WM_MOUSEWHEEL:
+            // positive forward, negative backward, FIXME check correspondence 
to X11 implementation
+            handler.on_mouse_up(*this, convertPosition(msg.lParam), 
convertButtonState(GET_KEYSTATE_WPARAM(msg.wParam)), 
(GET_WHEEL_DELTA_WPARAM(msg.wParam) > 0) ? GLWindow::BUTTON_WHEEL_UP : 
GLWindow::BUTTON_WHEEL_DOWN);
+            break;
+        case WM_MOUSEMOVE:
+            handler.on_mouse_move(*this, convertPosition(msg.lParam), 
convertButtonState(msg.wParam));
+            break;
+        case WM_KEYDOWN:
+            {
+                unsigned char state[256];
+                GetKeyboardState(state);
+                char buffer[4];
+                int res = ToAscii((UINT)msg.wParam, (UINT)(msg.lParam & 
0xffffff) >> 16, state, (LPWORD)buffer, 0);
+                if(res == 1){
+                    handler.on_key_down(*this, buffer[0]);
+                } else {
+                    handler.on_key_down(*this, (int)msg.wParam);
+                }
+            }
+            break;
+               case WM_KEYUP:
+            {
+                unsigned char state[256];
+                GetKeyboardState(state);
+                char buffer[4];
+                int res = ToAscii((UINT)msg.wParam, (UINT)(msg.lParam & 
0xffffff) >> 16, state, (LPWORD)buffer, 0);
+                if(res == 1){
+                    handler.on_key_up(*this, buffer[0]);
+                } else {
+                    handler.on_key_up(*this, (int)msg.wParam);
+                }
+            }
+            break;
+        case WM_DESTROY:
+            handler.on_event(*this, EVENT_CLOSE);
+            break;
+        case WM_PAINT:
+            handler.on_event(*this, EVENT_EXPOSE);
+        default:
+            DispatchMessage(&msg);
+        }
+    }
+
+    currentHandler = NULL;
+}
+
+class SaveEvents : public GLWindow::EventHandler {
+private:
+    std::vector<GLWindow::Event>& events;
+public:
+    SaveEvents(std::vector<GLWindow::Event>& events_) : events(events_) {}
+    void on_key_down(GLWindow&, int key) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::KEY_DOWN;
+       e.which = key;
+       events.push_back(e);
+    }
+    void on_key_up(GLWindow&, int key) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::KEY_UP;
+       e.which = key;
+       events.push_back(e);
+    }
+
+    void on_mouse_move(GLWindow&, ImageRef where, int state) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::MOUSE_MOVE;
+       e.state = state;
+       e.where = where;
+       events.push_back(e);
+    }
+
+    void on_mouse_down(GLWindow&, ImageRef where, int state, int button) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::MOUSE_DOWN;
+       e.state = state;
+       e.which = button;
+       e.where = where;
+       events.push_back(e);
+    }
+
+    void on_mouse_up(GLWindow&, ImageRef where, int state, int button) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::MOUSE_UP;
+       e.state = state;
+       e.which = button;
+       e.where = where;
+       events.push_back(e);
+    }
+
+    void on_resize(GLWindow&, ImageRef size) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::RESIZE;
+       e.size = size;
+       events.push_back(e);
+    }
+
+    void on_event(GLWindow&, int event) {
+       GLWindow::Event e;
+       e.type = GLWindow::Event::EVENT;
+       e.which = event;
+       events.push_back(e);
+    }
+};
+
+void GLWindow::get_events(std::vector<Event>& events)
+{
+    SaveEvents saver(events);
+    handle_events(saver);
+}
+
+bool GLWindow::EventSummary::should_quit() const
+{
+    return key_down.count(VK_ESCAPE) || events.count(GLWindow::EVENT_CLOSE);
+}
+
+class MakeSummary : public GLWindow::EventHandler {
+private:
+    GLWindow::EventSummary& summary;
+public:
+    MakeSummary(GLWindow::EventSummary& summary_) : summary(summary_) {}
+
+    void on_key_down(GLWindow&, int key) {     ++summary.key_down[key]; }
+    void on_key_up(GLWindow&, int key) { ++summary.key_up[key]; }
+    void on_mouse_move(GLWindow&, ImageRef where, int) { summary.cursor = 
where; summary.cursor_moved = true; }
+    void on_mouse_down(GLWindow&, ImageRef where, int state, int button) { 
summary.mouse_down[button] = std::make_pair(where,state); }
+    void on_mouse_up(GLWindow&, ImageRef where, int state, int button) { 
summary.mouse_up[button] = std::make_pair(where,state); }
+    void on_event(GLWindow&, int event) { ++summary.events[event]; }
+};
+
+void GLWindow::get_events(EventSummary& summary)
+{
+    summary.cursor = cursor_position();
+    MakeSummary ms(summary);
+    handle_events(ms);
+}
+
+bool GLWindow::has_events() const
+{
+    MSG        msg;
+    return PeekMessage(&msg, state->hWnd, 0, 0, PM_NOREMOVE) != 0;
+}
+
+void GLWindow::activate()
+{
+    if(!wglMakeCurrent(state->hDC,state->hRC))
+        throw Exceptions::GLWindow::RuntimeError("wglMakeCurrent failed");
+}
+
+LRESULT CALLBACK WndProc(      HWND    hWnd,                   // Handle For 
This Window
+                                                       UINT    uMsg,           
        // Message For This Window
+                                                       WPARAM  wParam,         
        // Additional Message Information
+                                                       LPARAM  lParam)         
        // Additional Message Information
+{
+    switch(uMsg){
+    case WM_WINDOWPOSCHANGED:
+        if(windowMap.count(hWnd) == 1){
+            GLWindow::State & state = windowMap[hWnd];
+            WINDOWPOS * pos = (WINDOWPOS *)lParam;
+            ImageRef newSize(pos->cx, pos->cy);
+            newSize -= state.size_offset;
+            if(newSize != state.size){
+                state.size = newSize;
+                state.parent->activate();
+                glViewport(0, 0, state.size.x, state.size.y);
+                   assert(currentHandler != NULL);
+                currentHandler->on_resize(*state.parent, state.size);
+            }
+            state.position = ImageRef(pos->x, pos->y) - state.position_offset;
+            return 0;
+        }
+        break;
+    }
+       // Pass All Unhandled Messages To DefWindowProc
+       return DefWindowProc(hWnd,uMsg,wParam,lParam);
+}
+
+} // namespace CVD
\ No newline at end of file

Index: cvd_src/Win32/win32.cpp
===================================================================
RCS file: cvd_src/Win32/win32.cpp
diff -N cvd_src/Win32/win32.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/Win32/win32.cpp     12 Jun 2008 13:04:16 -0000      1.1
@@ -0,0 +1,61 @@
+#include "win32.h" 
+
+#include <time.h>
+
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+  #define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
+#else
+  #define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
+#endif
+
+// implementation from 
http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+    FILETIME ft;
+    unsigned __int64 tmpres = 0;
+    static int tzflag;
+
+    if (NULL != tv)
+    {
+        GetSystemTimeAsFileTime(&ft);
+
+        tmpres |= ft.dwHighDateTime;
+        tmpres <<= 32;
+        tmpres |= ft.dwLowDateTime;
+
+        /*converting file time to unix epoch*/
+        tmpres /= 10;  /*convert into microseconds*/
+        tmpres -= DELTA_EPOCH_IN_MICROSECS; 
+        tv->tv_sec = (long)(tmpres / 1000000UL);
+        tv->tv_usec = (long)(tmpres % 1000000UL);
+    }
+
+    if (NULL != tz)
+    {
+        if (!tzflag)
+        {
+            _tzset();
+            tzflag++;
+        }
+        tz->tz_minuteswest = _timezone / 60;
+        tz->tz_dsttime = _daylight;
+    }
+
+    return 0;
+}
+
+namespace CVD {
+
+namespace Internal {
+
+void * aligned_alloc(size_t count, size_t alignment){
+    return _aligned_malloc(count, alignment);
+}
+
+void aligned_free(void * memory){
+    _aligned_free(memory);
+}
+
+} // namespace Internal
+
+} // namespace CVD

Index: cvd_src/Win32/win32.h
===================================================================
RCS file: cvd_src/Win32/win32.h
diff -N cvd_src/Win32/win32.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/Win32/win32.h       12 Jun 2008 13:04:16 -0000      1.1
@@ -0,0 +1,17 @@
+// Win32 specific implementations of various POSIX functions not supported in 
Visual Studio
+
+#ifndef CVD_INTERNAL_WIN32_H
+#define CVD_INTERNAL_WIN32_H
+
+#include <cvd/config.h>
+#include <windows.h>
+
+struct timezone 
+{
+  int  tz_minuteswest; /* minutes W of Greenwich */
+  int  tz_dsttime;     /* type of dst correction */
+};
+ 
+int gettimeofday(struct timeval *tv, struct timezone *tz);
+
+#endif  //CVD_INTERNAL_WIN32_H

Index: cvd_src/noarch/default_memalign.cpp
===================================================================
RCS file: cvd_src/noarch/default_memalign.cpp
diff -N cvd_src/noarch/default_memalign.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/noarch/default_memalign.cpp 12 Jun 2008 13:04:16 -0000      1.1
@@ -0,0 +1,51 @@
+#include <map>
+#include <cassert>
+#include <cvd/config.h>
+
+using namespace std;
+
+#ifdef _REENTRANT
+    #ifndef CVD_HAVE_PTHREAD
+       #error "CVD is not compiled with thread support. This code is not 
thread safe."
+    #else 
+       #include <cvd/synchronized.h>
+    #endif
+#endif
+
+namespace CVD {
+
+namespace Internal {
+
+static std::map<char *, char *> buffers;
+
+#if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
+static Synchronized mutex;
+#endif
+
+void * aligned_alloc(size_t count, size_t alignment){
+    char* start = new char[count + alignment];
+       size_t val = (size_t)start;
+       char * astart = start + (alignment-(val % alignment));
+
+#if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
+    Lock lock(mutex);
+#endif
+    buffers[astart] = start;
+
+    return astart;
+}
+
+void aligned_free(void * memory){
+#if defined(CVD_HAVE_PTHREAD) && defined(_REENTRANT)
+    Lock lock(mutex);
+#endif
+
+    std::map<char *,char *>::iterator it = buffers.find((char *)memory);
+    assert(it != buffers.end());
+    delete[] it->second;
+    buffers.erase(it);
+}
+
+} // namespace Internal
+
+} // namespace CVD

Index: cvd_src/noarch/posix_memalign.cpp
===================================================================
RCS file: cvd_src/noarch/posix_memalign.cpp
diff -N cvd_src/noarch/posix_memalign.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cvd_src/noarch/posix_memalign.cpp   12 Jun 2008 13:04:16 -0000      1.1
@@ -0,0 +1,20 @@
+#include <stdlib.h>
+
+namespace CVD {
+
+namespace Internal {
+
+void * aligned_alloc(size_t count, size_t alignment){
+    void * mem = NULL;
+       const int alloc_err = posix_memalign(&mem, alignment, count);
+       assert(alloc_err == 0);
+    return mem;
+}
+
+void aligned_free(void * memory){
+    free(memory);
+}
+
+} // namespace Internal
+
+} // namespace CVD




reply via email to

[Prev in Thread] Current Thread [Next in Thread]