1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Drop outdated definitions from internal.hpp

This also fixes few clang build errors
This commit is contained in:
Andrey Kamaev
2013-03-31 13:26:21 +04:00
parent 605382562d
commit 3890a74565
34 changed files with 248 additions and 623 deletions
+3 -5
View File
@@ -184,11 +184,9 @@ enum { DFT_INVERSE = 1,
# if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 2)
# define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
# else
namespace cv {
template <bool x> struct CV_StaticAssert_failed;
template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
template<int x> struct CV_StaticAssert_test{};
}
template <bool x> struct CV_StaticAssert_failed;
template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
template<int x> struct CV_StaticAssert_test {};
# define CV_StaticAssert(condition, reason)\
typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
# endif
+7 -2
View File
@@ -47,15 +47,20 @@
#include "opencv2/core/types_c.h"
#ifdef __cplusplus
#ifdef _MSC_VER
# ifdef _MSC_VER
/* disable warning C4190: 'function' has C-linkage specified, but returns UDT 'typename'
which is incompatible with C
It is OK to disable it because we only extend few plain structures with
C++ construrtors for simpler interoperability with C++ API of the library
*/
# pragma warning(disable:4190)
# pragma warning(disable:4190)
# elif defined __clang__ && __clang_major__ >= 3
# pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
+1 -248
View File
@@ -48,40 +48,6 @@
#ifndef __OPENCV_CORE_INTERNAL_HPP__
#define __OPENCV_CORE_INTERNAL_HPP__
#include <vector>
#if defined WIN32 || defined _WIN32
# ifndef WIN32
# define WIN32
# endif
# ifndef _WIN32
# define _WIN32
# endif
#endif
#if !defined WIN32 && !defined WINCE
# include <pthread.h>
#endif
#ifdef __BORLANDC__
# ifndef WIN32
# define WIN32
# endif
# ifndef _WIN32
# define _WIN32
# endif
# define CV_DLL
# undef _CV_ALWAYS_PROFILE_
# define _CV_ALWAYS_NO_PROFILE_
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
#define __BEGIN__ __CV_BEGIN__
#define __END__ __CV_END__
#define EXIT __CV_EXIT__
@@ -100,70 +66,6 @@ CV_INLINE IppiSize ippiSize(int width, int height)
# define IPPI_CALL(func) CV_Assert((func) >= 0)
#endif
#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
# include "emmintrin.h"
# define CV_SSE 1
# define CV_SSE2 1
# if defined __SSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
# include "pmmintrin.h"
# define CV_SSE3 1
# endif
# if defined __SSSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
# include "tmmintrin.h"
# define CV_SSSE3 1
# endif
# if defined __SSE4_1__ || (defined _MSC_VER && _MSC_VER >= 1500)
# include <smmintrin.h>
# define CV_SSE4_1 1
# endif
# if defined __SSE4_2__ || (defined _MSC_VER && _MSC_VER >= 1500)
# include <nmmintrin.h>
# define CV_SSE4_2 1
# endif
# if defined __AVX__ || (defined _MSC_FULL_VER && _MSC_FULL_VER >= 160040219)
// MS Visual Studio 2010 (2012?) has no macro pre-defined to identify the use of /arch:AVX
// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32
# include <immintrin.h>
# define CV_AVX 1
# if defined(_XCR_XFEATURE_ENABLED_MASK)
# define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK)
# else
# define __xgetbv() 0
# endif
# endif
#endif
#ifdef __ARM_NEON__
# include <arm_neon.h>
# define CV_NEON 1
# define CPU_HAS_NEON_FEATURE (true)
#endif
#ifndef CV_SSE
# define CV_SSE 0
#endif
#ifndef CV_SSE2
# define CV_SSE2 0
#endif
#ifndef CV_SSE3
# define CV_SSE3 0
#endif
#ifndef CV_SSSE3
# define CV_SSSE3 0
#endif
#ifndef CV_SSE4_1
# define CV_SSE4_1 0
#endif
#ifndef CV_SSE4_2
# define CV_SSE4_2 0
#endif
#ifndef CV_AVX
# define CV_AVX 0
#endif
#ifndef CV_NEON
# define CV_NEON 0
#endif
#ifdef HAVE_TBB
# include "tbb/tbb_stddef.h"
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
@@ -198,12 +100,6 @@ namespace cv
tbb::parallel_for(range, body);
}
template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body )
{
tbb::parallel_do(first, last, body);
}
typedef tbb::split Split;
template<typename Body> static inline
@@ -213,7 +109,6 @@ namespace cv
}
typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
typedef tbb::concurrent_vector<double> ConcurrentDoubleVector;
#else
class BlockedRange
{
@@ -234,14 +129,6 @@ namespace cv
body(range);
}
typedef std::vector<Rect> ConcurrentRectVector;
typedef std::vector<double> ConcurrentDoubleVector;
template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body )
{
for( ; first != last; ++first )
body(*first);
}
class Split {};
@@ -282,26 +169,9 @@ namespace cv
#endif //__cplusplus
/* maximal size of vector to run matrix operations on it inline (i.e. w/o ipp calls) */
#define CV_MAX_INLINE_MAT_OP_SIZE 10
/* maximal linear size of matrix to allocate it on stack. */
#define CV_MAX_LOCAL_MAT_SIZE 32
/* maximal size of local memory storage */
#define CV_MAX_LOCAL_SIZE \
(CV_MAX_LOCAL_MAT_SIZE*CV_MAX_LOCAL_MAT_SIZE*(int)sizeof(double))
/* default image row align (in bytes) */
#define CV_DEFAULT_IMAGE_ROW_ALIGN 4
/* matrices are continuous by default */
#define CV_DEFAULT_MAT_ROW_ALIGN 1
/* maximum size of dynamic memory buffer.
cvAlloc reports an error if a larger block is requested. */
#define CV_MAX_ALLOC_SIZE (((size_t)1 << (sizeof(size_t)*8-2)))
/* the alignment of all the allocated buffers */
#define CV_MALLOC_ALIGN 16
@@ -320,38 +190,10 @@ namespace cv
/* maximal average node_count/hash_size ratio beyond which hash table is resized */
#define CV_SPARSE_HASH_RATIO 3
/* max length of strings */
#define CV_MAX_STRLEN 1024
#if 0 /*def CV_CHECK_FOR_NANS*/
# define CV_CHECK_NANS( arr ) cvCheckArray((arr))
#else
# define CV_CHECK_NANS( arr )
#endif
/****************************************************************************************\
* Common declarations *
\****************************************************************************************/
/* get alloca declaration */
#ifdef __GNUC__
# undef alloca
# define alloca __builtin_alloca
# define CV_HAVE_ALLOCA 1
#elif defined WIN32 || defined _WIN32 || \
defined WINCE || defined _MSC_VER || defined __BORLANDC__
# include <malloc.h>
# define CV_HAVE_ALLOCA 1
#elif defined HAVE_ALLOCA_H
# include <alloca.h>
# define CV_HAVE_ALLOCA 1
#elif defined HAVE_ALLOCA
# include <stdlib.h>
# define CV_HAVE_ALLOCA 1
#else
# undef CV_HAVE_ALLOCA
#endif
#ifdef __GNUC__
# define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
#elif defined _MSC_VER
@@ -360,77 +202,20 @@ namespace cv
# define CV_DECL_ALIGNED(x)
#endif
#if CV_HAVE_ALLOCA
/* ! DO NOT make it an inline function */
# define cvStackAlloc(size) cvAlignPtr( alloca((size) + CV_MALLOC_ALIGN), CV_MALLOC_ALIGN )
#endif
#ifndef CV_IMPL
# define CV_IMPL CV_EXTERN_C
#endif
#define CV_DBG_BREAK() { volatile int* crashMe = 0; *crashMe = 0; }
/* default step, set in case of continuous data
to work around checks for valid step in some ipp functions */
#define CV_STUB_STEP (1 << 30)
#define CV_SIZEOF_FLOAT ((int)sizeof(float))
#define CV_SIZEOF_SHORT ((int)sizeof(short))
#define CV_ORIGIN_TL 0
#define CV_ORIGIN_BL 1
/* IEEE754 constants and macros */
#define CV_POS_INF 0x7f800000
#define CV_NEG_INF 0x807fffff /* CV_TOGGLE_FLT(0xff800000) */
#define CV_1F 0x3f800000
#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))
#define CV_NOP(a) (a)
#define CV_ADD(a, b) ((a) + (b))
#define CV_SUB(a, b) ((a) - (b))
#define CV_MUL(a, b) ((a) * (b))
#define CV_AND(a, b) ((a) & (b))
#define CV_OR(a, b) ((a) | (b))
#define CV_XOR(a, b) ((a) ^ (b))
#define CV_ANDN(a, b) (~(a) & (b))
#define CV_ORN(a, b) (~(a) | (b))
#define CV_SQR(a) ((a) * (a))
//TODO: remove after dropping sorts
#define CV_LT(a, b) ((a) < (b))
#define CV_LE(a, b) ((a) <= (b))
#define CV_EQ(a, b) ((a) == (b))
#define CV_NE(a, b) ((a) != (b))
#define CV_GT(a, b) ((a) > (b))
#define CV_GE(a, b) ((a) >= (b))
#define CV_NONZERO(a) ((a) != 0)
#define CV_NONZERO_FLT(a) (((a)+(a)) != 0)
/* general-purpose saturation macros */
#define CV_CAST_8U(t) (uchar)(!((t) & ~255) ? (t) : (t) > 0 ? 255 : 0)
#define CV_CAST_8S(t) (schar)(!(((t)+128) & ~255) ? (t) : (t) > 0 ? 127 : -128)
#define CV_CAST_16U(t) (ushort)(!((t) & ~65535) ? (t) : (t) > 0 ? 65535 : 0)
#define CV_CAST_16S(t) (short)(!(((t)+32768) & ~65535) ? (t) : (t) > 0 ? 32767 : -32768)
#define CV_CAST_32S(t) (int)(t)
#define CV_CAST_64S(t) (int64)(t)
#define CV_CAST_32F(t) (float)(t)
#define CV_CAST_64F(t) (double)(t)
#define CV_PASTE2(a,b) a##b
#define CV_PASTE(a,b) CV_PASTE2(a,b)
#define CV_EMPTY
#define CV_MAKE_STR(a) #a
#define CV_ZERO_OBJ(x) memset((x), 0, sizeof(*(x)))
#define CV_DIM(static_array) ((int)(sizeof(static_array)/sizeof((static_array)[0])))
#define cvUnsupportedFormat "Unsupported format"
CV_INLINE void* cvAlignPtr( const void* ptr, int align CV_DEFAULT(32) )
{
@@ -499,36 +284,4 @@ typedef enum CvStatus
}
CvStatus;
#define CV_NOTHROW throw()
typedef struct CvFuncTable
{
void* fn_2d[CV_DEPTH_MAX];
}
CvFuncTable;
typedef struct CvBigFuncTable
{
void* fn_2d[CV_DEPTH_MAX*4];
} CvBigFuncTable;
#define CV_INIT_FUNC_TAB( tab, FUNCNAME, FLAG ) \
(tab).fn_2d[CV_8U] = (void*)FUNCNAME##_8u##FLAG; \
(tab).fn_2d[CV_8S] = 0; \
(tab).fn_2d[CV_16U] = (void*)FUNCNAME##_16u##FLAG; \
(tab).fn_2d[CV_16S] = (void*)FUNCNAME##_16s##FLAG; \
(tab).fn_2d[CV_32S] = (void*)FUNCNAME##_32s##FLAG; \
(tab).fn_2d[CV_32F] = (void*)FUNCNAME##_32f##FLAG; \
(tab).fn_2d[CV_64F] = (void*)FUNCNAME##_64f##FLAG
namespace cv { namespace ogl {
CV_EXPORTS bool checkError(const char* file, const int line, const char* func = "");
}}
#if defined(__GNUC__)
#define CV_CheckGlError() CV_DbgAssert( (cv::ogl::checkError(__FILE__, __LINE__, __func__)) )
#else
#define CV_CheckGlError() CV_DbgAssert( (cv::ogl::checkError(__FILE__, __LINE__)) )
#endif
#endif // __OPENCV_CORE_INTERNAL_HPP__
@@ -122,7 +122,7 @@ template<typename _Tp> inline
_OutputArray::_OutputArray(const std::vector<_Tp>& vec)
: _InputArray(vec)
{
flags |= FIXED_SIZE
flags |= FIXED_SIZE;
}
template<typename _Tp> inline
+1 -1
View File
@@ -956,7 +956,7 @@ Vec<double, 4> Vec<double, 4>::conj() const
template<typename _Tp, int cn> inline
Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>&) const
{
CV_StaticAssert(false, "for arbitrary-size vector there is no cross-product defined");
CV_StaticAssert(cn == 3, "for arbitrary-size vector there is no cross-product defined");
return Vec<_Tp, cn>();
}
+9 -9
View File
@@ -1464,28 +1464,28 @@ cvScalarToRawData( const CvScalar* scalar, void* data, int type, int extend_to_1
while( cn-- )
{
int t = cvRound( scalar->val[cn] );
((uchar*)data)[cn] = CV_CAST_8U(t);
((uchar*)data)[cn] = cv::saturate_cast<uchar>(t);
}
break;
case CV_8SC1:
while( cn-- )
{
int t = cvRound( scalar->val[cn] );
((char*)data)[cn] = CV_CAST_8S(t);
((char*)data)[cn] = cv::saturate_cast<schar>(t);
}
break;
case CV_16UC1:
while( cn-- )
{
int t = cvRound( scalar->val[cn] );
((ushort*)data)[cn] = CV_CAST_16U(t);
((ushort*)data)[cn] = cv::saturate_cast<ushort>(t);
}
break;
case CV_16SC1:
while( cn-- )
{
int t = cvRound( scalar->val[cn] );
((short*)data)[cn] = CV_CAST_16S(t);
((short*)data)[cn] = cv::saturate_cast<short>(t);
}
break;
case CV_32SC1:
@@ -1602,19 +1602,19 @@ static void icvSetReal( double value, const void* data, int type )
switch( type )
{
case CV_8U:
*(uchar*)data = CV_CAST_8U(ivalue);
*(uchar*)data = cv::saturate_cast<uchar>(ivalue);
break;
case CV_8S:
*(char*)data = CV_CAST_8S(ivalue);
*(schar*)data = cv::saturate_cast<schar>(ivalue);
break;
case CV_16U:
*(ushort*)data = CV_CAST_16U(ivalue);
*(ushort*)data = cv::saturate_cast<ushort>(ivalue);
break;
case CV_16S:
*(short*)data = CV_CAST_16S(ivalue);
*(short*)data = cv::saturate_cast<short>(ivalue);
break;
case CV_32S:
*(int*)data = CV_CAST_32S(ivalue);
*(int*)data = cv::saturate_cast<int>(ivalue);
break;
}
}
+2 -2
View File
@@ -2343,7 +2343,7 @@ cvColorToScalar( double packed_color, int type )
}
else
{
scalar.val[0] = CV_CAST_8U( icolor );
scalar.val[0] = cv::saturate_cast<uchar>( icolor );
scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
}
}
@@ -2359,7 +2359,7 @@ cvColorToScalar( double packed_color, int type )
}
else
{
scalar.val[0] = CV_CAST_8S( icolor );
scalar.val[0] = cv::saturate_cast<schar>( icolor );
scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
}
}
+9 -2
View File
@@ -69,9 +69,8 @@ namespace
void throw_nocuda() { CV_Error(CV_StsNotImplemented, "The called functionality is disabled for current build or platform"); }
#endif
#endif
}
bool cv::ogl::checkError(const char* file, const int line, const char* func)
bool checkError(const char* file, const int line, const char* func = 0)
{
#ifndef HAVE_OPENGL
(void) file;
@@ -116,6 +115,14 @@ bool cv::ogl::checkError(const char* file, const int line, const char* func)
#endif
}
#if defined(__GNUC__)
#define CV_CheckGlError() CV_DbgAssert( (checkError(__FILE__, __LINE__, __func__)) )
#else
#define CV_CheckGlError() CV_DbgAssert( (checkError(__FILE__, __LINE__)) )
#endif
} // namespace
#ifdef HAVE_OPENGL
namespace
{
+8 -8
View File
@@ -3246,19 +3246,19 @@ cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader,
switch( elem_type )
{
case CV_8U:
*(uchar*)data = CV_CAST_8U(ival);
*(uchar*)data = cv::saturate_cast<uchar>(ival);
data++;
break;
case CV_8S:
*(char*)data = CV_CAST_8S(ival);
*(char*)data = cv::saturate_cast<schar>(ival);
data++;
break;
case CV_16U:
*(ushort*)data = CV_CAST_16U(ival);
*(ushort*)data = cv::saturate_cast<ushort>(ival);
data += sizeof(ushort);
break;
case CV_16S:
*(short*)data = CV_CAST_16S(ival);
*(short*)data = cv::saturate_cast<short>(ival);
data += sizeof(short);
break;
case CV_32S:
@@ -3291,22 +3291,22 @@ cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader,
{
case CV_8U:
ival = cvRound(fval);
*(uchar*)data = CV_CAST_8U(ival);
*(uchar*)data = cv::saturate_cast<uchar>(ival);
data++;
break;
case CV_8S:
ival = cvRound(fval);
*(char*)data = CV_CAST_8S(ival);
*(char*)data = cv::saturate_cast<schar>(ival);
data++;
break;
case CV_16U:
ival = cvRound(fval);
*(ushort*)data = CV_CAST_16U(ival);
*(ushort*)data = cv::saturate_cast<ushort>(ival);
data += sizeof(ushort);
break;
case CV_16S:
ival = cvRound(fval);
*(short*)data = CV_CAST_16S(ival);
*(short*)data = cv::saturate_cast<short>(ival);
data += sizeof(short);
break;
case CV_32S:
-4
View File
@@ -999,7 +999,6 @@ static int normHamming(const uchar* a, int n)
{
int i = 0, result = 0;
#if CV_NEON
if (CPU_HAS_NEON_FEATURE)
{
uint32x4_t bits = vmovq_n_u32(0);
for (; i <= n - 16; i += 16) {
@@ -1013,7 +1012,6 @@ static int normHamming(const uchar* a, int n)
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
}
else
#endif
for( ; i <= n - 4; i += 4 )
result += popCountTable[a[i]] + popCountTable[a[i+1]] +
@@ -1027,7 +1025,6 @@ int normHamming(const uchar* a, const uchar* b, int n)
{
int i = 0, result = 0;
#if CV_NEON
if (CPU_HAS_NEON_FEATURE)
{
uint32x4_t bits = vmovq_n_u32(0);
for (; i <= n - 16; i += 16) {
@@ -1043,7 +1040,6 @@ int normHamming(const uchar* a, const uchar* b, int n)
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
}
else
#endif
for( ; i <= n - 4; i += 4 )
result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] +