]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
add check for _WIN32 in addition to WIN32 for more robust Windows identification
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Sat, 18 Jul 2009 16:23:18 +0000 (16:23 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Sat, 18 Jul 2009 16:23:18 +0000 (16:23 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@1947 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/include/opencv/highgui.h
opencv/include/opencv/ml.h
opencv/src/cv/_cv.h
opencv/src/cxcore/_cxcore.h
opencv/src/highgui/_highgui.h
opencv/src/highgui/window.cpp
opencv/tests/cxcore/src/cxcoretest.h
opencv/tests/cxts/_cxts.h
opencv/tests/cxts/cxts.cpp

index 9232d997bcce9ee90d072afdff350c10ad7609d6..4fd86b2219396d7b3fc90fadc31ad73b6ed54e04 100644 (file)
 #ifndef SKIP_INCLUDES
 
   #include "cxcore.h"
-  #if defined WIN32 || defined WIN64 || defined _WIN64
+  #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
     #include <windows.h>
   #endif
 
 #else // SKIP_INCLUDES
 
-  #if defined WIN32 || defined WIN64 || defined _WIN64
+  #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
     #define CV_CDECL __cdecl
     #define CV_STDCALL __stdcall
   #else
   #ifndef CV_INLINE
     #if defined __cplusplus
       #define CV_INLINE inline
-    #elif (defined WIN32 || defined WIN64 || defined _WIN64) && !defined __GNUC__
+    #elif (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __GNUC__
       #define CV_INLINE __inline
     #else
       #define CV_INLINE static
     #endif
   #endif /* CV_INLINE */
 
-  #if (defined WIN32 || defined WIN64 || defined _WIN64) && defined CVAPI_EXPORTS
+  #if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && defined CVAPI_EXPORTS
     #define CV_EXPORTS __declspec(dllexport)
   #else
     #define CV_EXPORTS
@@ -371,7 +371,7 @@ CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer );
 #define set_preprocess_func cvSetPreprocessFuncWin32
 #define set_postprocess_func cvSetPostprocessFuncWin32
 
-#ifdef WIN32
+#if defined WIN32 || defined _WIN32
 
 typedef int (CV_CDECL * CvWin32WindowCallback)(HWND, UINT, WPARAM, LPARAM, int*);
 CVAPI(void) cvSetPreprocessFuncWin32( CvWin32WindowCallback on_preprocess );
@@ -394,7 +394,7 @@ CV_INLINE int iplHeight( const IplImage* img )
 #endif /* obsolete functions */
 
 /* For use with Win32 */
-#ifdef WIN32
+#if defined WIN32 || defined _WIN32
 
 CV_INLINE RECT NormalizeRect( RECT r );
 CV_INLINE RECT NormalizeRect( RECT r )
@@ -479,7 +479,7 @@ public:
     virtual bool  LoadRect( const char* filename,
                             int desired_color, CvRect r );
 
-#ifdef WIN32
+#if defined WIN32 || defined _WIN32
     virtual bool  LoadRect( const char* filename,
                             int desired_color, RECT r )
     {
@@ -508,7 +508,7 @@ public:
     /* draw to highgui window */
     virtual void  Show( const char* window );
 
-#ifdef WIN32
+#if defined WIN32 || defined _WIN32
     /* draw part of image to the specified DC */
     virtual void  Show( HDC dc, int x, int y, int width, int height,
                         int from_x = 0, int from_y = 0 );
index ac70e4d2bb2a722311d70bdd8b33f07500391c15..03eaf1b5b19d257c813f2458381f89cce2e6d048 100644 (file)
   #include "cxcore.h"
   #include <limits.h>
 
-  #if defined WIN32 || defined WIN64 || defined _WIN64
+  #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
     #include <windows.h>
   #endif
 
 #else // SKIP_INCLUDES
 
-  #if defined WIN32 || defined WIN64 || defined _WIN64
+  #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
     #define CV_CDECL __cdecl
     #define CV_STDCALL __stdcall
   #else
   #ifndef CV_INLINE
     #if defined __cplusplus
       #define CV_INLINE inline
-    #elif (defined WIN32 || defined WIN64 || defined _WIN64) && !defined __GNUC__
+    #elif (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __GNUC__
       #define CV_INLINE __inline
     #else
       #define CV_INLINE static
     #endif
   #endif /* CV_INLINE */
 
-  #if (defined WIN32 || defined WIN64 || defined _WIN64) && defined CVAPI_EXPORTS
+  #if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && defined CVAPI_EXPORTS
     #define CV_EXPORTS __declspec(dllexport)
   #else
     #define CV_EXPORTS
index 65246efc34051106798e01f6191a958f1481e208..527567a8c2aa2db5b61370b87c38d447ef749dfd 100644 (file)
 #include <float.h>\r
 \r
 #ifdef __BORLANDC__\r
+#ifndef WIN32\r
     #define     WIN32\r
+#endif\r
+#ifndef _WIN32\r
+    #define     _WIN32\r
+#endif\r
     #define     CV_DLL\r
     #undef      _CV_ALWAYS_PROFILE_\r
     #define     _CV_ALWAYS_NO_PROFILE_\r
index dbfe9d13edfe22de9add4024e5747fff78384cfb..01e49f66ae5301e989dbfebd928b20e14983d267 100644 (file)
-/*M///////////////////////////////////////////////////////////////////////////////////////\r
-//\r
-//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
-//\r
-//  By downloading, copying, installing or using the software you agree to this license.\r
-//  If you do not agree to this license, do not download, install,\r
-//  copy or use the software.\r
-//\r
-//\r
-//                           License Agreement\r
-//                For Open Source Computer Vision Library\r
-//\r
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
-// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
-// Third party copyrights are property of their respective owners.\r
-//\r
-// Redistribution and use in source and binary forms, with or without modification,\r
-// are permitted provided that the following conditions are met:\r
-//\r
-//   * Redistribution's of source code must retain the above copyright notice,\r
-//     this list of conditions and the following disclaimer.\r
-//\r
-//   * Redistribution's in binary form must reproduce the above copyright notice,\r
-//     this list of conditions and the following disclaimer in the documentation\r
-//     and/or other materials provided with the distribution.\r
-//\r
-//   * The name of the copyright holders may not be used to endorse or promote products\r
-//     derived from this software without specific prior written permission.\r
-//\r
-// This software is provided by the copyright holders and contributors "as is" and\r
-// any express or implied warranties, including, but not limited to, the implied\r
-// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
-// In no event shall the Intel Corporation or contributors be liable for any direct,\r
-// indirect, incidental, special, exemplary, or consequential damages\r
-// (including, but not limited to, procurement of substitute goods or services;\r
-// loss of use, data, or profits; or business interruption) however caused\r
-// and on any theory of liability, whether in contract, strict liability,\r
-// or tort (including negligence or otherwise) arising in any way out of\r
-// the use of this software, even if advised of the possibility of such damage.\r
-//\r
-//M*/\r
-\r
-#ifndef _CXCORE_INTERNAL_H_\r
-#define _CXCORE_INTERNAL_H_\r
-\r
-#if defined _MSC_VER && _MSC_VER >= 1200\r
-    /* disable warnings related to inline functions */\r
-    #pragma warning( disable: 4711 4710 4514 )\r
-#endif\r
-\r
-typedef unsigned long ulong;\r
-\r
-#ifdef __BORLANDC__\r
-    #define     WIN32\r
-    #define     CV_DLL\r
-#endif\r
-\r
-#include "cxcore.h"\r
-#include "cxmisc.h"\r
-\r
-#include <assert.h>\r
-#include <ctype.h>\r
-#include <float.h>\r
-#include <limits.h>\r
-#include <math.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#if defined WIN32 || defined WINCE\r
-#ifndef _WIN32_WINNT         // This is needed for the declaration of TryEnterCriticalSection in winbase.h with Visual Studio 2005 (and older?)\r
-#define _WIN32_WINNT 0x0400  // http://msdn.microsoft.com/en-us/library/ms686857(VS.85).aspx\r
-#endif\r
-#include <windows.h>\r
-#undef small\r
-#undef min\r
-#undef max\r
-#else\r
-#include <pthread.h>\r
-#include <sys/mman.h>\r
-#endif\r
-\r
-#ifdef HAVE_CONFIG_H\r
-#include <cvconfig.h>\r
-#endif\r
-\r
-#ifdef HAVE_IPP\r
-#include "ipp.h"\r
-#endif\r
-\r
-namespace cv\r
-{\r
-\r
-// -128.f ... 255.f\r
-extern const float g_8x32fTab[];\r
-#define CV_8TO32F(x)  cv::g_8x32fTab[(x)+128]\r
-\r
-extern const ushort g_8x16uSqrTab[];\r
-#define CV_SQR_8U(x)  cv::g_8x16uSqrTab[(x)+255]\r
-\r
-extern const char* g_HersheyGlyphs[];\r
-\r
-extern const signed char g_DepthToType[];\r
-#define IplToCvDepth( depth ) \\r
-    cv::g_DepthToType[(((depth) & 255) >> 2) + ((depth) < 0)]\r
-\r
-extern const uchar g_Saturate8u[];\r
-#define CV_FAST_CAST_8U(t)   (assert(-256 <= (t) && (t) <= 512), cv::g_Saturate8u[(t)+256])\r
-#define CV_MIN_8U(a,b)       ((a) - CV_FAST_CAST_8U((a) - (b)))\r
-#define CV_MAX_8U(a,b)       ((a) + CV_FAST_CAST_8U((b) - (a)))\r
-\r
-typedef void (*CopyMaskFunc)(const Mat& src, Mat& dst, const Mat& mask);\r
-\r
-extern CopyMaskFunc g_copyMaskFuncTab[];\r
-\r
-static inline CopyMaskFunc getCopyMaskFunc(int esz)\r
-{\r
-    CV_Assert( (unsigned)esz <= 32U );\r
-    CopyMaskFunc func = g_copyMaskFuncTab[esz];\r
-    CV_Assert( func != 0 );\r
-    return func;\r
-}\r
-\r
-#ifdef WIN32\r
-void deleteThreadAllocData();\r
-void deleteThreadRNGData();\r
-#endif\r
-\r
-template<typename T1, typename T2=T1, typename T3=T1> struct OpAdd\r
-{\r
-    typedef T1 type1;\r
-    typedef T2 type2;\r
-    typedef T3 rtype;\r
-    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a + b); }\r
-};\r
-\r
-template<typename T1, typename T2=T1, typename T3=T1> struct OpSub\r
-{\r
-    typedef T1 type1;\r
-    typedef T2 type2;\r
-    typedef T3 rtype;\r
-    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a - b); }\r
-};\r
-\r
-template<typename T1, typename T2=T1, typename T3=T1> struct OpRSub\r
-{\r
-    typedef T1 type1;\r
-    typedef T2 type2;\r
-    typedef T3 rtype;\r
-    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(b - a); }\r
-};\r
-\r
-template<typename T1, typename T2=T1, typename T3=T1> struct OpMul\r
-{\r
-    typedef T1 type1;\r
-    typedef T2 type2;\r
-    typedef T3 rtype;\r
-    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a * b); }\r
-};\r
-\r
-template<typename T1, typename T2=T1, typename T3=T1> struct OpDiv\r
-{\r
-    typedef T1 type1;\r
-    typedef T2 type2;\r
-    typedef T3 rtype;\r
-    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a / b); }\r
-};\r
-\r
-template<typename T> struct OpMin\r
-{\r
-    typedef T type1;\r
-    typedef T type2;\r
-    typedef T rtype;\r
-    T operator ()(T a, T b) const { return std::min(a, b); }\r
-};\r
-\r
-template<typename T> struct OpMax\r
-{\r
-    typedef T type1;\r
-    typedef T type2;\r
-    typedef T rtype;\r
-    T operator ()(T a, T b) const { return std::max(a, b); }\r
-};\r
-\r
-static inline Size getContinuousSize( const Mat& m1, int widthScale=1 )\r
-{\r
-    return m1.isContinuous() ? Size(m1.cols*m1.rows*widthScale, 1) :\r
-        Size(m1.cols*widthScale, m1.rows);\r
-}\r
-\r
-static inline Size getContinuousSize( const Mat& m1, const Mat& m2, int widthScale=1 )\r
-{\r
-    return (m1.flags & m2.flags & Mat::CONTINUOUS_FLAG) != 0 ?\r
-        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);\r
-}\r
-\r
-static inline Size getContinuousSize( const Mat& m1, const Mat& m2,\r
-                                      const Mat& m3, int widthScale=1 )\r
-{\r
-    return (m1.flags & m2.flags & m3.flags & Mat::CONTINUOUS_FLAG) != 0 ?\r
-        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);\r
-}\r
-\r
-static inline Size getContinuousSize( const Mat& m1, const Mat& m2,\r
-                                      const Mat& m3, const Mat& m4,\r
-                                      int widthScale=1 )\r
-{\r
-    return (m1.flags & m2.flags & m3.flags & m4.flags & Mat::CONTINUOUS_FLAG) != 0 ?\r
-        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);\r
-}\r
-\r
-static inline Size getContinuousSize( const Mat& m1, const Mat& m2,\r
-                                      const Mat& m3, const Mat& m4,\r
-                                      const Mat& m5, int widthScale=1 )\r
-{\r
-    return (m1.flags & m2.flags & m3.flags & m4.flags & m5.flags & Mat::CONTINUOUS_FLAG) != 0 ?\r
-        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);\r
-}\r
-\r
-struct NoVec\r
-{\r
-    int operator()(const void*, const void*, void*, int) const { return 0; }\r
-};\r
-\r
-template<class Op, class VecOp> static void\r
-binaryOpC1_( const Mat& srcmat1, const Mat& srcmat2, Mat& dstmat )\r
-{\r
-    Op op; VecOp vecOp;\r
-    typedef typename Op::type1 T1;\r
-    typedef typename Op::type2 T2;\r
-    typedef typename Op::rtype DT;\r
-\r
-    const T1* src1 = (const T1*)srcmat1.data;\r
-    const T2* src2 = (const T2*)srcmat2.data;\r
-    DT* dst = (DT*)dstmat.data;\r
-    size_t step1 = srcmat1.step/sizeof(src1[0]);\r
-    size_t step2 = srcmat2.step/sizeof(src2[0]);\r
-    size_t step = dstmat.step/sizeof(dst[0]);\r
-    Size size = getContinuousSize( srcmat1, srcmat2, dstmat, dstmat.channels() );\r
-\r
-    if( size.width == 1 )\r
-    {\r
-        for( ; size.height--; src1 += step1, src2 += step2, dst += step )\r
-            dst[0] = op( src1[0], src2[0] );\r
-        return;\r
-    }\r
-\r
-    for( ; size.height--; src1 += step1, src2 += step2, dst += step )\r
-    {\r
-        int x = vecOp(src1, src2, dst, size.width);\r
-        for( ; x <= size.width - 4; x += 4 )\r
-        {\r
-            DT f0, f1;\r
-            f0 = op( src1[x], src2[x] );\r
-            f1 = op( src1[x+1], src2[x+1] );\r
-            dst[x] = f0;\r
-            dst[x+1] = f1;\r
-            f0 = op(src1[x+2], src2[x+2]);\r
-            f1 = op(src1[x+3], src2[x+3]);\r
-            dst[x+2] = f0;\r
-            dst[x+3] = f1;\r
-        }\r
-\r
-        for( ; x < size.width; x++ )\r
-            dst[x] = op( src1[x], src2[x] );\r
-    }\r
-}\r
-\r
-typedef void (*BinaryFunc)(const Mat& src1, const Mat& src2, Mat& dst);\r
-\r
-template<class Op> static void\r
-binarySOpCn_( const Mat& srcmat, Mat& dstmat, const Scalar& _scalar )\r
-{\r
-    Op op;\r
-    typedef typename Op::type1 T;\r
-    typedef typename Op::type2 WT;\r
-    typedef typename Op::rtype DT;\r
-    const T* src0 = (const T*)srcmat.data;\r
-    DT* dst0 = (DT*)dstmat.data;\r
-    size_t step1 = srcmat.step/sizeof(src0[0]);\r
-    size_t step = dstmat.step/sizeof(dst0[0]);\r
-    int cn = dstmat.channels();\r
-    Size size = getContinuousSize( srcmat, dstmat, cn );\r
-    WT scalar[12];\r
-    _scalar.convertTo(scalar, cn, 12);\r
-\r
-    for( ; size.height--; src0 += step1, dst0 += step )\r
-    {\r
-        int i, len = size.width;\r
-        const T* src = src0;\r
-        T* dst = dst0;\r
-\r
-        for( ; (len -= 12) >= 0; dst += 12, src += 12 )\r
-        {\r
-            DT t0 = op(src[0], scalar[0]);\r
-            DT t1 = op(src[1], scalar[1]);\r
-            dst[0] = t0; dst[1] = t1;\r
-\r
-            t0 = op(src[2], scalar[2]);\r
-            t1 = op(src[3], scalar[3]);\r
-            dst[2] = t0; dst[3] = t1;\r
-\r
-            t0 = op(src[4], scalar[4]);\r
-            t1 = op(src[5], scalar[5]);\r
-            dst[4] = t0; dst[5] = t1;\r
-\r
-            t0 = op(src[6], scalar[6]);\r
-            t1 = op(src[7], scalar[7]);\r
-            dst[6] = t0; dst[7] = t1;\r
-\r
-            t0 = op(src[8], scalar[8]);\r
-            t1 = op(src[9], scalar[9]);\r
-            dst[8] = t0; dst[9] = t1;\r
-\r
-            t0 = op(src[10], scalar[10]);\r
-            t1 = op(src[11], scalar[11]);\r
-            dst[10] = t0; dst[11] = t1;\r
-        }\r
-\r
-        for( (len) += 12, i = 0; i < (len); i++ )\r
-            dst[i] = op((WT)src[i], scalar[i]);\r
-    }\r
-}\r
-\r
-template<class Op> static void\r
-binarySOpC1_( const Mat& srcmat, Mat& dstmat, double _scalar )\r
-{\r
-    Op op;\r
-    typedef typename Op::type1 T;\r
-    typedef typename Op::type2 WT;\r
-    typedef typename Op::rtype DT;\r
-    WT scalar = saturate_cast<WT>(_scalar);\r
-    const T* src = (const T*)srcmat.data;\r
-    DT* dst = (DT*)dstmat.data;\r
-    size_t step1 = srcmat.step/sizeof(src[0]);\r
-    size_t step = dstmat.step/sizeof(dst[0]);\r
-    Size size = srcmat.size();\r
-    \r
-    size.width *= srcmat.channels();\r
-    if( srcmat.isContinuous() && dstmat.isContinuous() )\r
-    {\r
-        size.width *= size.height;\r
-        size.height = 1;\r
-    }\r
-\r
-    for( ; size.height--; src += step1, dst += step )\r
-    {\r
-        int x;\r
-        for( x = 0; x <= size.width - 4; x += 4 )\r
-        {\r
-            DT f0 = op( src[x], scalar );\r
-            DT f1 = op( src[x+1], scalar );\r
-            dst[x] = f0;\r
-            dst[x+1] = f1;\r
-            f0 = op( src[x+2], scalar );\r
-            f1 = op( src[x+3], scalar );\r
-            dst[x+2] = f0;\r
-            dst[x+3] = f1;\r
-        }\r
-\r
-        for( ; x < size.width; x++ )\r
-            dst[x] = op( src[x], scalar );\r
-    }\r
-}\r
-\r
-typedef void (*BinarySFuncCn)(const Mat& src1, Mat& dst, const Scalar& scalar);\r
-typedef void (*BinarySFuncC1)(const Mat& src1, Mat& dst, double scalar);\r
-\r
-}\r
-\r
-#endif /*_CXCORE_INTERNAL_H_*/\r
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
+//                           License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+//   * Redistribution's of source code must retain the above copyright notice,
+//     this list of conditions and the following disclaimer.
+//
+//   * Redistribution's in binary form must reproduce the above copyright notice,
+//     this list of conditions and the following disclaimer in the documentation
+//     and/or other materials provided with the distribution.
+//
+//   * The name of the copyright holders may not be used to endorse or promote products
+//     derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#ifndef _CXCORE_INTERNAL_H_
+#define _CXCORE_INTERNAL_H_
+
+#if defined _MSC_VER && _MSC_VER >= 1200
+    /* disable warnings related to inline functions */
+    #pragma warning( disable: 4711 4710 4514 )
+#endif
+
+typedef unsigned long ulong;
+
+#ifdef __BORLANDC__
+#ifndef WIN32
+    #define     WIN32
+#endif
+    #define     CV_DLL
+#endif
+
+#include "cxcore.h"
+#include "cxmisc.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined WIN32 || defined _WIN32
+#  ifndef WIN32
+#    define WIN32
+#  endif
+#  ifndef _WIN32
+#    define _WIN32
+#  endif
+#endif
+
+#if defined WIN32 || defined WINCE
+#ifndef _WIN32_WINNT         // This is needed for the declaration of TryEnterCriticalSection in winbase.h with Visual Studio 2005 (and older?)
+#define _WIN32_WINNT 0x0400  // http://msdn.microsoft.com/en-us/library/ms686857(VS.85).aspx
+#endif
+#include <windows.h>
+#undef small
+#undef min
+#undef max
+#else
+#include <pthread.h>
+#include <sys/mman.h>
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <cvconfig.h>
+#endif
+
+#ifdef HAVE_IPP
+#include "ipp.h"
+#endif
+
+namespace cv
+{
+
+// -128.f ... 255.f
+extern const float g_8x32fTab[];
+#define CV_8TO32F(x)  cv::g_8x32fTab[(x)+128]
+
+extern const ushort g_8x16uSqrTab[];
+#define CV_SQR_8U(x)  cv::g_8x16uSqrTab[(x)+255]
+
+extern const char* g_HersheyGlyphs[];
+
+extern const signed char g_DepthToType[];
+#define IplToCvDepth( depth ) \
+    cv::g_DepthToType[(((depth) & 255) >> 2) + ((depth) < 0)]
+
+extern const uchar g_Saturate8u[];
+#define CV_FAST_CAST_8U(t)   (assert(-256 <= (t) && (t) <= 512), cv::g_Saturate8u[(t)+256])
+#define CV_MIN_8U(a,b)       ((a) - CV_FAST_CAST_8U((a) - (b)))
+#define CV_MAX_8U(a,b)       ((a) + CV_FAST_CAST_8U((b) - (a)))
+
+typedef void (*CopyMaskFunc)(const Mat& src, Mat& dst, const Mat& mask);
+
+extern CopyMaskFunc g_copyMaskFuncTab[];
+
+static inline CopyMaskFunc getCopyMaskFunc(int esz)
+{
+    CV_Assert( (unsigned)esz <= 32U );
+    CopyMaskFunc func = g_copyMaskFuncTab[esz];
+    CV_Assert( func != 0 );
+    return func;
+}
+
+#if defined WIN32 || defined _WIN32
+void deleteThreadAllocData();
+void deleteThreadRNGData();
+#endif
+
+template<typename T1, typename T2=T1, typename T3=T1> struct OpAdd
+{
+    typedef T1 type1;
+    typedef T2 type2;
+    typedef T3 rtype;
+    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a + b); }
+};
+
+template<typename T1, typename T2=T1, typename T3=T1> struct OpSub
+{
+    typedef T1 type1;
+    typedef T2 type2;
+    typedef T3 rtype;
+    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a - b); }
+};
+
+template<typename T1, typename T2=T1, typename T3=T1> struct OpRSub
+{
+    typedef T1 type1;
+    typedef T2 type2;
+    typedef T3 rtype;
+    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(b - a); }
+};
+
+template<typename T1, typename T2=T1, typename T3=T1> struct OpMul
+{
+    typedef T1 type1;
+    typedef T2 type2;
+    typedef T3 rtype;
+    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a * b); }
+};
+
+template<typename T1, typename T2=T1, typename T3=T1> struct OpDiv
+{
+    typedef T1 type1;
+    typedef T2 type2;
+    typedef T3 rtype;
+    T3 operator ()(T1 a, T2 b) const { return saturate_cast<T3>(a / b); }
+};
+
+template<typename T> struct OpMin
+{
+    typedef T type1;
+    typedef T type2;
+    typedef T rtype;
+    T operator ()(T a, T b) const { return std::min(a, b); }
+};
+
+template<typename T> struct OpMax
+{
+    typedef T type1;
+    typedef T type2;
+    typedef T rtype;
+    T operator ()(T a, T b) const { return std::max(a, b); }
+};
+
+static inline Size getContinuousSize( const Mat& m1, int widthScale=1 )
+{
+    return m1.isContinuous() ? Size(m1.cols*m1.rows*widthScale, 1) :
+        Size(m1.cols*widthScale, m1.rows);
+}
+
+static inline Size getContinuousSize( const Mat& m1, const Mat& m2, int widthScale=1 )
+{
+    return (m1.flags & m2.flags & Mat::CONTINUOUS_FLAG) != 0 ?
+        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);
+}
+
+static inline Size getContinuousSize( const Mat& m1, const Mat& m2,
+                                      const Mat& m3, int widthScale=1 )
+{
+    return (m1.flags & m2.flags & m3.flags & Mat::CONTINUOUS_FLAG) != 0 ?
+        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);
+}
+
+static inline Size getContinuousSize( const Mat& m1, const Mat& m2,
+                                      const Mat& m3, const Mat& m4,
+                                      int widthScale=1 )
+{
+    return (m1.flags & m2.flags & m3.flags & m4.flags & Mat::CONTINUOUS_FLAG) != 0 ?
+        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);
+}
+
+static inline Size getContinuousSize( const Mat& m1, const Mat& m2,
+                                      const Mat& m3, const Mat& m4,
+                                      const Mat& m5, int widthScale=1 )
+{
+    return (m1.flags & m2.flags & m3.flags & m4.flags & m5.flags & Mat::CONTINUOUS_FLAG) != 0 ?
+        Size(m1.cols*m1.rows*widthScale, 1) : Size(m1.cols*widthScale, m1.rows);
+}
+
+struct NoVec
+{
+    int operator()(const void*, const void*, void*, int) const { return 0; }
+};
+
+template<class Op, class VecOp> static void
+binaryOpC1_( const Mat& srcmat1, const Mat& srcmat2, Mat& dstmat )
+{
+    Op op; VecOp vecOp;
+    typedef typename Op::type1 T1;
+    typedef typename Op::type2 T2;
+    typedef typename Op::rtype DT;
+
+    const T1* src1 = (const T1*)srcmat1.data;
+    const T2* src2 = (const T2*)srcmat2.data;
+    DT* dst = (DT*)dstmat.data;
+    size_t step1 = srcmat1.step/sizeof(src1[0]);
+    size_t step2 = srcmat2.step/sizeof(src2[0]);
+    size_t step = dstmat.step/sizeof(dst[0]);
+    Size size = getContinuousSize( srcmat1, srcmat2, dstmat, dstmat.channels() );
+
+    if( size.width == 1 )
+    {
+        for( ; size.height--; src1 += step1, src2 += step2, dst += step )
+            dst[0] = op( src1[0], src2[0] );
+        return;
+    }
+
+    for( ; size.height--; src1 += step1, src2 += step2, dst += step )
+    {
+        int x = vecOp(src1, src2, dst, size.width);
+        for( ; x <= size.width - 4; x += 4 )
+        {
+            DT f0, f1;
+            f0 = op( src1[x], src2[x] );
+            f1 = op( src1[x+1], src2[x+1] );
+            dst[x] = f0;
+            dst[x+1] = f1;
+            f0 = op(src1[x+2], src2[x+2]);
+            f1 = op(src1[x+3], src2[x+3]);
+            dst[x+2] = f0;
+            dst[x+3] = f1;
+        }
+
+        for( ; x < size.width; x++ )
+            dst[x] = op( src1[x], src2[x] );
+    }
+}
+
+typedef void (*BinaryFunc)(const Mat& src1, const Mat& src2, Mat& dst);
+
+template<class Op> static void
+binarySOpCn_( const Mat& srcmat, Mat& dstmat, const Scalar& _scalar )
+{
+    Op op;
+    typedef typename Op::type1 T;
+    typedef typename Op::type2 WT;
+    typedef typename Op::rtype DT;
+    const T* src0 = (const T*)srcmat.data;
+    DT* dst0 = (DT*)dstmat.data;
+    size_t step1 = srcmat.step/sizeof(src0[0]);
+    size_t step = dstmat.step/sizeof(dst0[0]);
+    int cn = dstmat.channels();
+    Size size = getContinuousSize( srcmat, dstmat, cn );
+    WT scalar[12];
+    _scalar.convertTo(scalar, cn, 12);
+
+    for( ; size.height--; src0 += step1, dst0 += step )
+    {
+        int i, len = size.width;
+        const T* src = src0;
+        T* dst = dst0;
+
+        for( ; (len -= 12) >= 0; dst += 12, src += 12 )
+        {
+            DT t0 = op(src[0], scalar[0]);
+            DT t1 = op(src[1], scalar[1]);
+            dst[0] = t0; dst[1] = t1;
+
+            t0 = op(src[2], scalar[2]);
+            t1 = op(src[3], scalar[3]);
+            dst[2] = t0; dst[3] = t1;
+
+            t0 = op(src[4], scalar[4]);
+            t1 = op(src[5], scalar[5]);
+            dst[4] = t0; dst[5] = t1;
+
+            t0 = op(src[6], scalar[6]);
+            t1 = op(src[7], scalar[7]);
+            dst[6] = t0; dst[7] = t1;
+
+            t0 = op(src[8], scalar[8]);
+            t1 = op(src[9], scalar[9]);
+            dst[8] = t0; dst[9] = t1;
+
+            t0 = op(src[10], scalar[10]);
+            t1 = op(src[11], scalar[11]);
+            dst[10] = t0; dst[11] = t1;
+        }
+
+        for( (len) += 12, i = 0; i < (len); i++ )
+            dst[i] = op((WT)src[i], scalar[i]);
+    }
+}
+
+template<class Op> static void
+binarySOpC1_( const Mat& srcmat, Mat& dstmat, double _scalar )
+{
+    Op op;
+    typedef typename Op::type1 T;
+    typedef typename Op::type2 WT;
+    typedef typename Op::rtype DT;
+    WT scalar = saturate_cast<WT>(_scalar);
+    const T* src = (const T*)srcmat.data;
+    DT* dst = (DT*)dstmat.data;
+    size_t step1 = srcmat.step/sizeof(src[0]);
+    size_t step = dstmat.step/sizeof(dst[0]);
+    Size size = srcmat.size();
+    
+    size.width *= srcmat.channels();
+    if( srcmat.isContinuous() && dstmat.isContinuous() )
+    {
+        size.width *= size.height;
+        size.height = 1;
+    }
+
+    for( ; size.height--; src += step1, dst += step )
+    {
+        int x;
+        for( x = 0; x <= size.width - 4; x += 4 )
+        {
+            DT f0 = op( src[x], scalar );
+            DT f1 = op( src[x+1], scalar );
+            dst[x] = f0;
+            dst[x+1] = f1;
+            f0 = op( src[x+2], scalar );
+            f1 = op( src[x+3], scalar );
+            dst[x+2] = f0;
+            dst[x+3] = f1;
+        }
+
+        for( ; x < size.width; x++ )
+            dst[x] = op( src[x], scalar );
+    }
+}
+
+typedef void (*BinarySFuncCn)(const Mat& src1, Mat& dst, const Scalar& scalar);
+typedef void (*BinarySFuncC1)(const Mat& src1, Mat& dst, double scalar);
+
+}
+
+#endif /*_CXCORE_INTERNAL_H_*/
index 4c8a0efdf98c6f04273b1a37a6d90d6c6a99041b..7ac96a8666d9b42b0acc81e396691148ba3c6231 100644 (file)
@@ -52,7 +52,7 @@
 #include <ctype.h>
 #include <assert.h>
 
-#ifndef WIN32
+#if !defined WIN32 && !defined _WIN32
 #include "cvconfig.h"
 #else
 void  FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin );
@@ -90,7 +90,7 @@ struct CvVideoWriter
     virtual bool writeFrame(const IplImage*) { return false; }
 };
 
-#ifdef WIN32
+#if defined WIN32 || defined _WIN32
 #define HAVE_VFW 1
 
 #if _MSC_VER >= 1400 && !defined WIN64 && !defined _WIN64
index 620d25b56b9a2b6428eeb9b8e29d6179b7a13893..67118433aae38f16e798ea369156eb2aac19ba6f 100644 (file)
@@ -72,7 +72,7 @@ int createTrackbar(const String& trackbarName, const String& winName,
 
 }
 
-#if   defined (WIN32)         // see window_w32.cpp
+#if   defined WIN32 || defined _WIN32         // see window_w32.cpp
 #elif defined (HAVE_GTK)      // see window_gtk.cpp
 #elif defined (HAVE_CARBON)   // see window_carbon.cpp
 
index b91aec1fb39ff48338e19f2dde237870cb794976..e52839640709fa3c29b93837bd33886971785875 100644 (file)
@@ -42,7 +42,7 @@
 #ifndef _CXCORE_TEST_H_
 #define _CXCORE_TEST_H_
 
-#if defined WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
 #include <windows.h>
 #undef min
 #undef max
index 325f788ede309994a596affa39cf258e8ead762a..518874f30046d8a3e121e38c5cdf8997ccac5fea 100644 (file)
@@ -42,7 +42,7 @@
 #ifndef __CXTS_INTERNAL_H__
 #define __CXTS_INTERNAL_H__
 
-#if (defined WIN32 || defined WIN64 || defined _WIN64) && (_MSC_VER >= 1200 || defined _ICL)
+#if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && (_MSC_VER >= 1200 || defined _ICL)
 #pragma warning( disable: 4514 4996 )
 #endif
 
index 284ddd408768e3406b0cce0f084411f7381fcda6..9aedc45e2d9c2787a45d9eb25e1595153cc46bf9 100644 (file)
@@ -44,7 +44,7 @@
 #include <stdarg.h>
 #include <fcntl.h>
 #include <time.h>
-#if defined WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
 #include <io.h>
 #else
 #include <unistd.h>
@@ -65,7 +65,7 @@ int CvTest::test_count = 0;
 #define CV_TS_GREEN  2
 #define CV_TS_RED    4
 
-#if defined WIN32 || defined WIN64 || defined _WIN64
+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
 #include <windows.h>
 
 #ifdef _MSC_VER
@@ -398,7 +398,7 @@ void* CvTestMemoryManager::alloc( size_t size )
         {
             if( show_msg_box )
             {
-        #ifdef WIN32
+        #if defined WIN32 || defined _WIN32
                 MessageBox( NULL, "The block that is corrupted and/or not deallocated has been just allocated\n"
                             "Press Ok to start debugging", "Memory Manager", MB_ICONERROR|MB_OK|MB_SYSTEMMODAL );
         #endif
@@ -1089,7 +1089,7 @@ void CvTS::set_handlers( bool on )
     {
         cvSetErrMode( CV_ErrModeParent );
         cvRedirectError( cvStdErrReport );
-    #ifdef WIN32
+    #if defined WIN32 || defined _WIN32
         #ifdef _MSC_VER
         _set_se_translator( cv_seh_translator );
         #endif
@@ -1102,7 +1102,7 @@ void CvTS::set_handlers( bool on )
     {
         cvSetErrMode( CV_ErrModeLeaf );
         cvRedirectError( cvGuiBoxReport );
-    #ifdef WIN32
+    #if defined WIN32 || defined _WIN32
         #ifdef _MSC_VER
         _set_se_translator( 0 );
         #endif
@@ -1453,7 +1453,7 @@ void CvTS::print_help()
 }
 
 
-#ifdef WIN32
+#if defined WIN32 || defined _WIN32
 const char* default_data_path = "../tests/cv/testdata/";
 #else
 const char* default_data_path = "../../../../tests/cv/testdata/";
@@ -1480,7 +1480,7 @@ int CvTS::read_params( CvFileStorage* fs )
     params.resource_path = cvReadStringByName( fs, node, "." );
     if( params.use_optimized < 0 )
         params.use_optimized = cvReadIntByName( fs, node, "use_optimized", -1 );
-#ifndef WIN32
+#if !defined WIN32 && !defined _WIN32
     if( !params.data_path || !params.data_path[0] )
     {
         char* srcdir = getenv("srcdir");