Update to 2.0.0 tree from current Fremantle build
[opencv] / src / cv / _cv.h
1 /*M///////////////////////////////////////////////////////////////////////////////////////\r
2 //\r
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
4 //\r
5 //  By downloading, copying, installing or using the software you agree to this license.\r
6 //  If you do not agree to this license, do not download, install,\r
7 //  copy or use the software.\r
8 //\r
9 //\r
10 //                          License Agreement\r
11 //                For Open Source Computer Vision Library\r
12 //\r
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
15 // Third party copyrights are property of their respective owners.\r
16 //\r
17 // Redistribution and use in source and binary forms, with or without modification,\r
18 // are permitted provided that the following conditions are met:\r
19 //\r
20 //   * Redistribution's of source code must retain the above copyright notice,\r
21 //     this list of conditions and the following disclaimer.\r
22 //\r
23 //   * Redistribution's in binary form must reproduce the above copyright notice,\r
24 //     this list of conditions and the following disclaimer in the documentation\r
25 //     and/or other materials provided with the distribution.\r
26 //\r
27 //   * The name of the copyright holders may not be used to endorse or promote products\r
28 //     derived from this software without specific prior written permission.\r
29 //\r
30 // This software is provided by the copyright holders and contributors "as is" and\r
31 // any express or implied warranties, including, but not limited to, the implied\r
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.\r
33 // In no event shall the Intel Corporation or contributors be liable for any direct,\r
34 // indirect, incidental, special, exemplary, or consequential damages\r
35 // (including, but not limited to, procurement of substitute goods or services;\r
36 // loss of use, data, or profits; or business interruption) however caused\r
37 // and on any theory of liability, whether in contract, strict liability,\r
38 // or tort (including negligence or otherwise) arising in any way out of\r
39 // the use of this software, even if advised of the possibility of such damage.\r
40 //\r
41 //M*/\r
42 \r
43 #ifndef _CV_INTERNAL_H_\r
44 #define _CV_INTERNAL_H_\r
45 \r
46 #if defined _MSC_VER && _MSC_VER >= 1200\r
47     /* disable warnings related to inline functions */\r
48     #pragma warning( disable: 4251 4711 4710 4514 )\r
49 #endif\r
50 \r
51 #include "cv.h"\r
52 #include "cxmisc.h"\r
53 #include <math.h>\r
54 #include <assert.h>\r
55 #include <string.h>\r
56 #include <stdlib.h>\r
57 #include <stdio.h>\r
58 #include <limits.h>\r
59 #include <float.h>\r
60 \r
61 #ifdef __BORLANDC__\r
62 #ifndef WIN32\r
63     #define     WIN32\r
64 #endif\r
65 #ifndef _WIN32\r
66     #define     _WIN32\r
67 #endif\r
68     #define     CV_DLL\r
69     #undef      _CV_ALWAYS_PROFILE_\r
70     #define     _CV_ALWAYS_NO_PROFILE_\r
71 #endif\r
72 \r
73 #ifdef HAVE_IPP\r
74 #include "ipp.h"\r
75 \r
76 CV_INLINE IppiSize ippiSize(int width, int height)\r
77 {\r
78     IppiSize size = { width, height };\r
79     return size;\r
80 }\r
81 #endif\r
82 \r
83 /* helper tables */\r
84 extern const uchar icvSaturate8u_cv[];\r
85 #define CV_FAST_CAST_8U(t)  (assert(-256 <= (t) || (t) <= 512), icvSaturate8u_cv[(t)+256])\r
86 #define CV_CALC_MIN_8U(a,b) (a) -= CV_FAST_CAST_8U((a) - (b))\r
87 #define CV_CALC_MAX_8U(a,b) (a) += CV_FAST_CAST_8U((b) - (a))\r
88 \r
89 // -256.f ... 511.f\r
90 extern const float icv8x32fTab_cv[];\r
91 #define CV_8TO32F(x)  icv8x32fTab_cv[(x)+256]\r
92 \r
93 // (-128.f)^2 ... (255.f)^2\r
94 extern const float icv8x32fSqrTab[];\r
95 #define CV_8TO32F_SQR(x)  icv8x32fSqrTab[(x)+128]\r
96 \r
97 namespace cv\r
98 {\r
99 \r
100 enum { INTER_BITS=5, INTER_BITS2=INTER_BITS*2,\r
101        INTER_TAB_SIZE=(1<<INTER_BITS),\r
102        INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE };\r
103 \r
104 static inline Point normalizeAnchor( Point anchor, Size ksize )\r
105 {\r
106     if( anchor == Point(-1,-1) )\r
107         anchor = Point(ksize.width/2, ksize.height/2);\r
108     else\r
109         CV_Assert( anchor.inside(Rect(0, 0, ksize.width, ksize.height)) );\r
110     return anchor;\r
111 }\r
112 \r
113 void preprocess2DKernel( const Mat& kernel, vector<Point>& coords, vector<uchar>& coeffs );\r
114 void crossCorr( const Mat& src, const Mat& templ, Mat& dst,\r
115                 Point anchor=Point(0,0), double delta=0,\r
116                 int borderType=BORDER_REFLECT_101 );\r
117 \r
118 }\r
119 \r
120 typedef struct CvPyramid\r
121 {\r
122     uchar **ptr;\r
123     CvSize *sz;\r
124     double *rate;\r
125     int *step;\r
126     uchar *state;\r
127     int level;\r
128 }\r
129 CvPyramid;\r
130 \r
131 #ifndef IPPI_CALL\r
132 #define IPPI_CALL(func) CV_Assert((func) >= 0)\r
133 #endif\r
134 \r
135 #include "_cvmatrix.h"\r
136 #include "_cvgeom.h"\r
137 #include "_cvimgproc.h"\r
138 \r
139 #endif /*_CV_INTERNAL_H_*/\r