Remove more old definitions from internal.hpp
authorAndrey Kamaev <andrey.kamaev@itseez.com>
Mon, 1 Apr 2013 12:32:08 +0000 (16:32 +0400)
committerAndrey Kamaev <andrey.kamaev@itseez.com>
Mon, 1 Apr 2013 12:32:08 +0000 (16:32 +0400)
13 files changed:
apps/traincascade/boost.cpp
modules/core/include/opencv2/core/internal.hpp
modules/core/include/opencv2/core/types_c.h
modules/core/src/array.cpp
modules/core/src/datastructs.cpp
modules/core/src/precomp.hpp
modules/imgproc/src/color.cpp
modules/imgproc/src/demosaicing.cpp
modules/imgproc/src/distransform.cpp
modules/imgproc/src/filter.cpp
modules/legacy/src/precomp.hpp
modules/ml/src/precomp.hpp
modules/video/src/lkpyramid.cpp

index a3cf90b..4849839 100644 (file)
@@ -44,7 +44,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
 
     CV_FUNCNAME( "cvPreprocessIndexArray" );
 
-    __BEGIN__;
+    __CV_BEGIN__;
 
     int i, idx_total, idx_selected = 0, step, type, prev = INT_MIN, is_sorted = 1;
     uchar* srcb = 0;
@@ -132,7 +132,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
         }
     }
 
-    __END__;
+    __CV_END__;
 
     if( cvGetErrStatus() < 0 )
         cvReleaseMat( &idx );
index 711e426..d08bb00 100644 (file)
@@ -7,11 +7,12 @@
 //  copy or use the software.
 //
 //
-//                           License Agreement
+//                          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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
 // Third party copyrights are property of their respective owners.
 //
 // Redistribution and use in source and binary forms, with or without modification,
 //
 //M*/
 
-/* The header is for internal use and it is likely to change.
-   It contains some macro definitions that are used in cxcore, cv, cvaux
-   and, probably, other libraries. If you need some of this functionality,
-   the safe way is to copy it into your code and rename the macros.
-*/
-#ifndef __OPENCV_CORE_INTERNAL_HPP__
-#define __OPENCV_CORE_INTERNAL_HPP__
+#ifndef __OPENCV_CORE_PRIVATE_HPP__
+#define __OPENCV_CORE_PRIVATE_HPP__
 
-#define __BEGIN__ __CV_BEGIN__
-#define __END__ __CV_END__
-#define EXIT __CV_EXIT__
-
-#ifdef HAVE_IPP
-#  include "ipp.h"
-
-CV_INLINE IppiSize ippiSize(int width, int height)
-{
-    IppiSize size = { width, height };
-    return size;
-}
+#ifndef __OPENCV_BUILD
+#  error this is a private header which should not be used from outside of the OpenCV library
 #endif
 
-#ifndef IPPI_CALL
-#  define IPPI_CALL(func) CV_Assert((func) >= 0)
+#include "opencv2/core.hpp"
+#include "cvconfig.h"
+
+#ifdef HAVE_EIGEN
+#  if defined __GNUC__ && defined __APPLE__
+#    pragma GCC diagnostic ignored "-Wshadow"
+#  endif
+#  include <Eigen/Core>
+#  include "opencv2/core/eigen.hpp"
 #endif
 
 #ifdef HAVE_TBB
@@ -78,16 +71,6 @@ CV_INLINE IppiSize ippiSize(int width, int height)
 #  endif
 #endif
 
-#ifdef HAVE_EIGEN
-#  if defined __GNUC__ && defined __APPLE__
-#    pragma GCC diagnostic ignored "-Wshadow"
-#  endif
-#  include <Eigen/Core>
-#  include "opencv2/core/eigen.hpp"
-#endif
-
-#ifdef __cplusplus
-
 namespace cv
 {
 #ifdef HAVE_TBB
@@ -167,33 +150,14 @@ namespace cv
         return &classname##_info(); \
     }
 
-#endif //__cplusplus
-
-/* default image row align (in bytes) */
-#define  CV_DEFAULT_IMAGE_ROW_ALIGN  4
-
-/* the alignment of all the allocated buffers */
-#define  CV_MALLOC_ALIGN    16
-
-/* default alignment for dynamic data strucutures, resided in storages. */
-#define  CV_STRUCT_ALIGN    ((int)sizeof(double))
-
-/* default storage block size */
-#define  CV_STORAGE_BLOCK_SIZE   ((1<<16) - 128)
-
-/* default memory block for sparse array elements */
-#define  CV_SPARSE_MAT_BLOCK    (1<<12)
-
-/* initial hash table size */
-#define  CV_SPARSE_HASH_SIZE0    (1<<10)
-
-/* maximal average node_count/hash_size ratio beyond which hash table is resized */
-#define  CV_SPARSE_HASH_RATIO    3
 
 /****************************************************************************************\
 *                                  Common declarations                                   *
 \****************************************************************************************/
 
+/* the alignment of all the allocated buffers */
+#define  CV_MALLOC_ALIGN    16
+
 #ifdef __GNUC__
 #  define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
 #elif defined _MSC_VER
@@ -202,48 +166,45 @@ namespace cv
 #  define CV_DECL_ALIGNED(x)
 #endif
 
-#ifndef CV_IMPL
-#  define CV_IMPL CV_EXTERN_C
-#endif
-
-#define  CV_ORIGIN_TL  0
-#define  CV_ORIGIN_BL  1
-
 /* IEEE754 constants and macros */
 #define  CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
-#define  CV_TOGGLE_DBL(x) \
-    ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
-
-//TODO: remove after dropping sorts
-#define  CV_LT(a, b)    ((a) < (b))
+#define  CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
 
-CV_INLINE void* cvAlignPtr( const void* ptr, int align CV_DEFAULT(32) )
+static inline void* cvAlignPtr( const void* ptr, int align CV_DEFAULT(32) )
 {
-    assert( (align & (align-1)) == 0 );
+    CV_DbgAssert ( (align & (align-1)) == 0 );
     return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
 }
 
-CV_INLINE int cvAlign( int size, int align )
+static inline int cvAlign( int size, int align )
 {
-    assert( (align & (align-1)) == 0 && size < INT_MAX );
+    CV_DbgAssert( (align & (align-1)) == 0 && size < INT_MAX );
     return (size + align - 1) & -align;
 }
 
-CV_INLINE  CvSize  cvGetMatSize( const CvMat* mat )
+static inline cv::Size cvGetMatSize( const CvMat* mat )
 {
-    CvSize size;
-    size.width = mat->cols;
-    size.height = mat->rows;
-    return size;
+    return cv::Size(mat->cols, mat->rows);
 }
 
-#define  CV_DESCALE(x,n)     (((x) + (1 << ((n)-1))) >> (n))
-#define  CV_FLT_TO_FIX(x,n)  cvRound((x)*(1<<(n)))
-
 /****************************************************************************************\
 *                     Structures and macros for integration with IPP                     *
 \****************************************************************************************/
 
+#ifdef HAVE_IPP
+#  include "ipp.h"
+
+static inline IppiSize ippiSize(int width, int height)
+{
+    IppiSize size = { width, height };
+    return size;
+}
+#endif
+
+#ifndef IPPI_CALL
+#  define IPPI_CALL(func) CV_Assert((func) >= 0)
+#endif
+
 /* IPP-compatible return codes */
 typedef enum CvStatus
 {
@@ -284,4 +245,4 @@ typedef enum CvStatus
 }
 CvStatus;
 
-#endif // __OPENCV_CORE_INTERNAL_HPP__
+#endif // __OPENCV_CORE_PRIVATE_HPP__
index 114cbba..13e71f8 100644 (file)
 #  define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
 #endif
 
+#ifndef CV_IMPL
+#  define CV_IMPL CV_EXTERN_C
+#endif
+
 #ifdef __cplusplus
 #  include "opencv2/core.hpp"
 #endif
index 649fef7..60ac848 100644 (file)
 
 #include "precomp.hpp"
 
+#define  CV_ORIGIN_TL  0
+#define  CV_ORIGIN_BL  1
+
+/* default image row align (in bytes) */
+#define  CV_DEFAULT_IMAGE_ROW_ALIGN  4
+
 
 static struct
 {
index c927c9e..ae2375a 100644 (file)
 //M*/
 #include "precomp.hpp"
 
+/* default alignment for dynamic data strucutures, resided in storages. */
+#define  CV_STRUCT_ALIGN    ((int)sizeof(double))
+
+/* default storage block size */
+#define  CV_STORAGE_BLOCK_SIZE   ((1<<16) - 128)
+
 #define ICV_FREE_PTR(storage)  \
     ((schar*)(storage)->top + (storage)->block_size - (storage)->free_space)
 
index 7675871..09e8636 100644 (file)
@@ -96,11 +96,22 @@ static inline void ___cudaSafeCall(cudaError_t err, const char *file, const int
 
 #else
 #  define cudaSafeCall(expr)
-#endif
+#endif //HAVE_CUDA
 
 namespace cv
 {
 
+/* default memory block for sparse array elements */
+#define  CV_SPARSE_MAT_BLOCK     (1<<12)
+
+/* initial hash table size */
+#define  CV_SPARSE_HASH_SIZE0    (1<<10)
+
+/* maximal average node_count/hash_size ratio beyond which hash table is resized */
+#define  CV_SPARSE_HASH_RATIO    3
+
+
+
 // -128.f ... 255.f
 extern const float g_8x32fTab[];
 #define CV_8TO32F(x)  cv::g_8x32fTab[(x)+128]
@@ -207,11 +218,6 @@ extern volatile bool USE_AVX;
 
 enum { BLOCK_SIZE = 1024 };
 
-#ifdef HAVE_IPP
-static inline IppiSize ippiSize(int width, int height) { IppiSize sz = { width, height}; return sz; }
-static inline IppiSize ippiSize(Size _sz)              { IppiSize sz = { _sz.width, _sz.height}; return sz; }
-#endif
-
 #if defined HAVE_IPP && (IPP_VERSION_MAJOR >= 7)
 #define ARITHM_USE_IPP 1
 #define IF_IPP(then_call, else_call) then_call
index 4f1ce82..f569ec9 100644 (file)
@@ -92,6 +92,8 @@
 #include "precomp.hpp"
 #include <limits>
 
+#define  CV_DESCALE(x,n)     (((x) + (1 << ((n)-1))) >> (n))
+
 namespace cv
 {
 
index 059246a..9326fa1 100644 (file)
@@ -44,6 +44,8 @@
 
 #include <limits>
 
+#define  CV_DESCALE(x,n)     (((x) + (1 << ((n)-1))) >> (n))
+
 namespace cv
 {
 
index 7b037be..b8ab50c 100644 (file)
@@ -46,6 +46,7 @@ namespace cv
 
 static const int DIST_SHIFT = 16;
 static const int INIT_DIST0 = (INT_MAX >> 2);
+#define  CV_FLT_TO_FIX(x,n)  cvRound((x)*(1<<(n)))
 
 static void
 initTopBottom( Mat& temp, int border )
index bef3fe2..19c90df 100644 (file)
@@ -193,7 +193,7 @@ void FilterEngine::init( const Ptr<BaseFilter>& _filter2D,
     wholeSize = Size(-1,-1);
 }
 
-static const int VEC_ALIGN = CV_MALLOC_ALIGN;
+#define VEC_ALIGN CV_MALLOC_ALIGN
 
 int FilterEngine::start(Size _wholeSize, Rect _roi, int _maxBufRows)
 {
index 91ab6e3..e6c3d01 100644 (file)
 #include "opencv2/core/utility.hpp"
 #include "opencv2/core/internal.hpp"
 
+#define __BEGIN__ __CV_BEGIN__
+#define __END__ __CV_END__
+#define EXIT __CV_EXIT__
+
 #include "_matrix.h"
 
 CV_INLINE bool operator == (CvSize size1, CvSize size2 );
index 281ff11..ee03a94 100644 (file)
@@ -61,6 +61,9 @@
 #include <time.h>
 
 #define ML_IMPL CV_IMPL
+#define __BEGIN__ __CV_BEGIN__
+#define __END__ __CV_END__
+#define EXIT __CV_EXIT__
 
 #define CV_MAT_ELEM_FLAG( mat, type, comp, vect, tflag )    \
     (( tflag == CV_ROW_SAMPLE )                             \
index 2fef04b..019397f 100644 (file)
@@ -44,6 +44,8 @@
 #include <stdio.h>
 #include "lkpyramid.hpp"
 
+#define  CV_DESCALE(x,n)     (((x) + (1 << ((n)-1))) >> (n))
+
 namespace
 {
 static void calcSharrDeriv(const cv::Mat& src, cv::Mat& dst)