Skip to content

Commit

Permalink
Remove more old definitions from internal.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Kamaev committed Apr 1, 2013
1 parent e972d6b commit d62bc8c
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 88 deletions.
4 changes: 2 additions & 2 deletions apps/traincascade/boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -132,7 +132,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
}
}

__END__;
__CV_END__;

if( cvGetErrStatus() < 0 )
cvReleaseMat( &idx );
Expand Down
119 changes: 40 additions & 79 deletions modules/core/include/opencv2/core/internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -40,30 +41,22 @@
//
//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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
{
Expand Down Expand Up @@ -284,4 +245,4 @@ typedef enum CvStatus
}
CvStatus;

#endif // __OPENCV_CORE_INTERNAL_HPP__
#endif // __OPENCV_CORE_PRIVATE_HPP__
4 changes: 4 additions & 0 deletions modules/core/include/opencv2/core/types_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
# 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
Expand Down
6 changes: 6 additions & 0 deletions modules/core/src/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@

#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
{
Expand Down
6 changes: 6 additions & 0 deletions modules/core/src/datastructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
//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)

Expand Down
18 changes: 12 additions & 6 deletions modules/core/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions modules/imgproc/src/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
#include "precomp.hpp"
#include <limits>

#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))

namespace cv
{

Expand Down
2 changes: 2 additions & 0 deletions modules/imgproc/src/demosaicing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

#include <limits>

#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))

namespace cv
{

Expand Down
1 change: 1 addition & 0 deletions modules/imgproc/src/distransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion modules/imgproc/src/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 4 additions & 0 deletions modules/legacy/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
#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 );
Expand Down
3 changes: 3 additions & 0 deletions modules/ml/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) \
Expand Down
2 changes: 2 additions & 0 deletions modules/video/src/lkpyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d62bc8c

Please sign in to comment.