1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                        Intel License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 //   * Redistribution's of source code must retain the above copyright notice,
20 //     this list of conditions and the following disclaimer.
21 //
22 //   * Redistribution's in binary form must reproduce the above copyright notice,
23 //     this list of conditions and the following disclaimer in the documentation
24 //     and/or other materials provided with the distribution.
25 //
26 //   * The name of Intel Corporation may not be used to endorse or promote products
27 //     derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/
41 
42 #ifndef _CV_INTERNAL_H_
43 #define _CV_INTERNAL_H_
44 
45 #if defined _MSC_VER && _MSC_VER >= 1200
46     /* disable warnings related to inline functions */
47     #pragma warning( disable: 4711 4710 4514 )
48 #endif
49 
50 #include "cv.h"
51 #include "cxmisc.h"
52 #include <math.h>
53 #include <assert.h>
54 #include <string.h>
55 #include <stdlib.h>
56 #include <stdio.h>
57 #include <limits.h>
58 #include <float.h>
59 
60 typedef unsigned char uchar;
61 typedef unsigned short ushort;
62 
63 #ifdef __BORLANDC__
64     #define     WIN32
65     #define     CV_DLL
66     #undef      _CV_ALWAYS_PROFILE_
67     #define     _CV_ALWAYS_NO_PROFILE_
68 #endif
69 
70 /* helper tables */
71 extern const uchar icvSaturate8u_cv[];
72 #define CV_FAST_CAST_8U(t)  (assert(-256 <= (t) || (t) <= 512), icvSaturate8u_cv[(t)+256])
73 #define CV_CALC_MIN_8U(a,b) (a) -= CV_FAST_CAST_8U((a) - (b))
74 #define CV_CALC_MAX_8U(a,b) (a) += CV_FAST_CAST_8U((b) - (a))
75 
76 // -256.f ... 511.f
77 extern const float icv8x32fTab_cv[];
78 #define CV_8TO32F(x)  icv8x32fTab_cv[(x)+256]
79 
80 // (-128.f)^2 ... (255.f)^2
81 extern const float icv8x32fSqrTab[];
82 #define CV_8TO32F_SQR(x)  icv8x32fSqrTab[(x)+128]
83 
84 CV_INLINE  CvDataType icvDepthToDataType( int type );
icvDepthToDataType(int type)85 CV_INLINE  CvDataType icvDepthToDataType( int type )
86 {
87     return (CvDataType)(
88             ((((int)cv8u)|((int)cv8s << 4)|((int)cv16u << 8)|
89               ((int)cv16s << 12)|((int)cv32s << 16)|((int)cv32f << 20)|
90               ((int)cv64f << 24)) >> CV_MAT_DEPTH(type)*4) & 15);
91 }
92 
93 #define CV_HIST_DEFAULT_TYPE CV_32F
94 
95 CV_EXTERN_C_FUNCPTR( void (CV_CDECL * CvWriteNodeFunction)(void* seq,void* node) )
96 
97 #define _CvConvState CvFilterState
98 
99 typedef struct CvPyramid
100 {
101     uchar **ptr;
102     CvSize *sz;
103     double *rate;
104     int *step;
105     uchar *state;
106     int level;
107 }
108 CvPyramid;
109 
110 #include "_cvipp.h"
111 #include "_cvmatrix.h"
112 #include "_cvgeom.h"
113 #include "_cvimgproc.h"
114 
115 // default face cascade
116 //extern const char* icvDefaultFaceCascade[];
117 
118 #endif /*_CV_INTERNAL_H_*/
119