Merge pull request #5810 from mshabunin:hal_interface
commit
9aeb8c8d5a
65 changed files with 3777 additions and 3432 deletions
@ -1,6 +1,6 @@ |
||||
#ifndef _CUSTOM_HAL_INCLUDED_ |
||||
#define _CUSTOM_HAL_INCLUDED_ |
||||
|
||||
@OPENCV_HAL_HEADERS_INCLUDES@ |
||||
@_includes@ |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,302 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_CORE_FAST_MATH_HPP__ |
||||
#define __OPENCV_CORE_FAST_MATH_HPP__ |
||||
|
||||
#include "opencv2/core/cvdef.h" |
||||
|
||||
//! @addtogroup core_utils
|
||||
//! @{
|
||||
|
||||
/****************************************************************************************\
|
||||
* fast math * |
||||
\****************************************************************************************/ |
||||
|
||||
#if defined __BORLANDC__ |
||||
# include <fastmath.h> |
||||
#elif defined __cplusplus |
||||
# include <cmath> |
||||
#else |
||||
# include <math.h> |
||||
#endif |
||||
|
||||
#ifdef HAVE_TEGRA_OPTIMIZATION |
||||
# include "tegra_round.hpp" |
||||
#endif |
||||
|
||||
#if CV_VFP |
||||
// 1. general scheme
|
||||
#define ARM_ROUND(_value, _asm_string) \ |
||||
int res; \
|
||||
float temp; \
|
||||
asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
|
||||
return res |
||||
// 2. version for double
|
||||
#ifdef __clang__ |
||||
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]") |
||||
#else |
||||
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]") |
||||
#endif |
||||
// 3. version for float
|
||||
#define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]") |
||||
#endif // CV_VFP
|
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer
|
||||
|
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the |
||||
result is not defined. |
||||
*/ |
||||
CV_INLINE int |
||||
cvRound( double value ) |
||||
{ |
||||
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ |
||||
&& defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128d t = _mm_set_sd( value ); |
||||
return _mm_cvtsd_si32(t); |
||||
#elif defined _MSC_VER && defined _M_IX86 |
||||
int t; |
||||
__asm |
||||
{ |
||||
fld value; |
||||
fistp t; |
||||
} |
||||
return t; |
||||
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \ |
||||
defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION |
||||
TEGRA_ROUND_DBL(value); |
||||
#elif defined CV_ICC || defined __GNUC__ |
||||
# if CV_VFP |
||||
ARM_ROUND_DBL(value); |
||||
# else |
||||
return (int)lrint(value); |
||||
# endif |
||||
#else |
||||
/* it's ok if round does not comply with IEEE754 standard;
|
||||
the tests should allow +/-1 difference when the tested functions use round */ |
||||
return (int)(value + (value >= 0 ? 0.5 : -0.5)); |
||||
#endif |
||||
} |
||||
|
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer not larger than the original.
|
||||
|
||||
The function computes an integer i such that: |
||||
\f[i \le \texttt{value} < i+1\f] |
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the |
||||
result is not defined. |
||||
*/ |
||||
CV_INLINE int cvFloor( double value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128d t = _mm_set_sd( value ); |
||||
int i = _mm_cvtsd_si32(t); |
||||
return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i))); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i - (i > value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(value - i); |
||||
return i - (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer not smaller than the original.
|
||||
|
||||
The function computes an integer i such that: |
||||
\f[i \le \texttt{value} < i+1\f] |
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the |
||||
result is not defined. |
||||
*/ |
||||
CV_INLINE int cvCeil( double value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128d t = _mm_set_sd( value ); |
||||
int i = _mm_cvtsd_si32(t); |
||||
return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t)); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i + (i < value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(i - value); |
||||
return i + (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @brief Determines if the argument is Not A Number.
|
||||
|
||||
@param value The input floating-point value |
||||
|
||||
The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0 |
||||
otherwise. */ |
||||
CV_INLINE int cvIsNaN( double value ) |
||||
{ |
||||
Cv64suf ieee754; |
||||
ieee754.f = value; |
||||
return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) + |
||||
((unsigned)ieee754.u != 0) > 0x7ff00000; |
||||
} |
||||
|
||||
/** @brief Determines if the argument is Infinity.
|
||||
|
||||
@param value The input floating-point value |
||||
|
||||
The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard) |
||||
and 0 otherwise. */ |
||||
CV_INLINE int cvIsInf( double value ) |
||||
{ |
||||
Cv64suf ieee754; |
||||
ieee754.f = value; |
||||
return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 && |
||||
(unsigned)ieee754.u == 0; |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvRound(float value) |
||||
{ |
||||
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && \ |
||||
defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128 t = _mm_set_ss( value ); |
||||
return _mm_cvtss_si32(t); |
||||
#elif defined _MSC_VER && defined _M_IX86 |
||||
int t; |
||||
__asm |
||||
{ |
||||
fld value; |
||||
fistp t; |
||||
} |
||||
return t; |
||||
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \ |
||||
defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION |
||||
TEGRA_ROUND_FLT(value); |
||||
#elif defined CV_ICC || defined __GNUC__ |
||||
# if CV_VFP |
||||
ARM_ROUND_FLT(value); |
||||
# else |
||||
return (int)lrintf(value); |
||||
# endif |
||||
#else |
||||
/* it's ok if round does not comply with IEEE754 standard;
|
||||
the tests should allow +/-1 difference when the tested functions use round */ |
||||
return (int)(value + (value >= 0 ? 0.5f : -0.5f)); |
||||
#endif |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvRound( int value ) |
||||
{ |
||||
return value; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvFloor( float value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128 t = _mm_set_ss( value ); |
||||
int i = _mm_cvtss_si32(t); |
||||
return i - _mm_movemask_ps(_mm_cmplt_ss(t, _mm_cvtsi32_ss(t,i))); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i - (i > value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(value - i); |
||||
return i - (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvFloor( int value ) |
||||
{ |
||||
return value; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvCeil( float value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128 t = _mm_set_ss( value ); |
||||
int i = _mm_cvtss_si32(t); |
||||
return i + _mm_movemask_ps(_mm_cmplt_ss(_mm_cvtsi32_ss(t,i), t)); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i + (i < value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(i - value); |
||||
return i + (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvCeil( int value ) |
||||
{ |
||||
return value; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvIsNaN( float value ) |
||||
{ |
||||
Cv32suf ieee754; |
||||
ieee754.f = value; |
||||
return (ieee754.u & 0x7fffffff) > 0x7f800000; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvIsInf( float value ) |
||||
{ |
||||
Cv32suf ieee754; |
||||
ieee754.f = value; |
||||
return (ieee754.u & 0x7fffffff) == 0x7f800000; |
||||
} |
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
//! @} core_utils
|
||||
|
||||
#endif |
@ -0,0 +1,218 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_HAL_HPP__ |
||||
#define __OPENCV_HAL_HPP__ |
||||
|
||||
#include "opencv2/core/cvdef.h" |
||||
#include "opencv2/core/hal/interface.h" |
||||
|
||||
//! @cond IGNORED
|
||||
#define CALL_HAL(name, fun, ...) \ |
||||
int res = fun(__VA_ARGS__); \
|
||||
if (res == CV_HAL_ERROR_OK) \
|
||||
return; \
|
||||
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
|
||||
CV_Error_(cv::Error::StsInternal, \
|
||||
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res)); |
||||
//! @endcond
|
||||
|
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
//! @addtogroup core_hal_functions
|
||||
//! @{
|
||||
|
||||
CV_EXPORTS int normHamming(const uchar* a, int n); |
||||
CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n); |
||||
|
||||
CV_EXPORTS int normHamming(const uchar* a, int n, int cellSize); |
||||
CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n, int cellSize); |
||||
|
||||
CV_EXPORTS int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n); |
||||
CV_EXPORTS int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n); |
||||
CV_EXPORTS bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n); |
||||
CV_EXPORTS bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n); |
||||
|
||||
CV_EXPORTS int normL1_(const uchar* a, const uchar* b, int n); |
||||
CV_EXPORTS float normL1_(const float* a, const float* b, int n); |
||||
CV_EXPORTS float normL2Sqr_(const float* a, const float* b, int n); |
||||
|
||||
CV_EXPORTS void exp32f(const float* src, float* dst, int n); |
||||
CV_EXPORTS void exp64f(const double* src, double* dst, int n); |
||||
CV_EXPORTS void log32f(const float* src, float* dst, int n); |
||||
CV_EXPORTS void log64f(const double* src, double* dst, int n); |
||||
|
||||
CV_EXPORTS void fastAtan2(const float* y, const float* x, float* dst, int n, bool angleInDegrees); |
||||
CV_EXPORTS void magnitude32f(const float* x, const float* y, float* dst, int n); |
||||
CV_EXPORTS void magnitude64f(const double* x, const double* y, double* dst, int n); |
||||
CV_EXPORTS void sqrt32f(const float* src, float* dst, int len); |
||||
CV_EXPORTS void sqrt64f(const double* src, double* dst, int len); |
||||
CV_EXPORTS void invSqrt32f(const float* src, float* dst, int len); |
||||
CV_EXPORTS void invSqrt64f(const double* src, double* dst, int len); |
||||
|
||||
CV_EXPORTS void split8u(const uchar* src, uchar** dst, int len, int cn ); |
||||
CV_EXPORTS void split16u(const ushort* src, ushort** dst, int len, int cn ); |
||||
CV_EXPORTS void split32s(const int* src, int** dst, int len, int cn ); |
||||
CV_EXPORTS void split64s(const int64* src, int64** dst, int len, int cn ); |
||||
|
||||
CV_EXPORTS void merge8u(const uchar** src, uchar* dst, int len, int cn ); |
||||
CV_EXPORTS void merge16u(const ushort** src, ushort* dst, int len, int cn ); |
||||
CV_EXPORTS void merge32s(const int** src, int* dst, int len, int cn ); |
||||
CV_EXPORTS void merge64s(const int64** src, int64* dst, int len, int cn ); |
||||
|
||||
CV_EXPORTS void add8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void add8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void add16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void add16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void add32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void add32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void add64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
CV_EXPORTS void sub8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void sub8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void sub16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void sub16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void sub32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void sub32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void sub64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
CV_EXPORTS void max8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void max8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void max16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void max16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void max32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void max32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void max64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
CV_EXPORTS void min8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void min8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void min16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void min16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void min32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void min32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void min64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
CV_EXPORTS void absdiff8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void absdiff8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void absdiff16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void absdiff16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void absdiff32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void absdiff32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void absdiff64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
CV_EXPORTS void and8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void or8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void xor8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
CV_EXPORTS void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
|
||||
CV_EXPORTS void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
CV_EXPORTS void cmp8s(const schar* src1, size_t step1, const schar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
CV_EXPORTS void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
CV_EXPORTS void cmp16s(const short* src1, size_t step1, const short* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
CV_EXPORTS void cmp32s(const int* src1, size_t step1, const int* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
CV_EXPORTS void cmp32f(const float* src1, size_t step1, const float* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
CV_EXPORTS void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
|
||||
CV_EXPORTS void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void mul8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void mul16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void mul32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void mul32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void mul64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); |
||||
|
||||
CV_EXPORTS void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void div16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void div16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void div32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); |
||||
|
||||
CV_EXPORTS void recip8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void recip8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void recip16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void recip16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void recip32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void recip32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); |
||||
CV_EXPORTS void recip64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); |
||||
|
||||
CV_EXPORTS void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars ); |
||||
CV_EXPORTS void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars ); |
||||
CV_EXPORTS void addWeighted16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scalars ); |
||||
CV_EXPORTS void addWeighted16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scalars ); |
||||
CV_EXPORTS void addWeighted32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scalars ); |
||||
CV_EXPORTS void addWeighted32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scalars ); |
||||
CV_EXPORTS void addWeighted64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scalars ); |
||||
|
||||
//! @} core_hal
|
||||
|
||||
//=============================================================================
|
||||
// for binary compatibility with 3.0
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n); |
||||
CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n); |
||||
CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n); |
||||
CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n); |
||||
|
||||
CV_EXPORTS void exp(const float* src, float* dst, int n); |
||||
CV_EXPORTS void exp(const double* src, double* dst, int n); |
||||
CV_EXPORTS void log(const float* src, float* dst, int n); |
||||
CV_EXPORTS void log(const double* src, double* dst, int n); |
||||
|
||||
CV_EXPORTS void magnitude(const float* x, const float* y, float* dst, int n); |
||||
CV_EXPORTS void magnitude(const double* x, const double* y, double* dst, int n); |
||||
CV_EXPORTS void sqrt(const float* src, float* dst, int len); |
||||
CV_EXPORTS void sqrt(const double* src, double* dst, int len); |
||||
CV_EXPORTS void invSqrt(const float* src, float* dst, int len); |
||||
CV_EXPORTS void invSqrt(const double* src, double* dst, int len); |
||||
|
||||
//! @endcond
|
||||
|
||||
}} //cv::hal
|
||||
|
||||
#endif //__OPENCV_HAL_HPP__
|
@ -0,0 +1,150 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2014, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_CORE_SATURATE_HPP__ |
||||
#define __OPENCV_CORE_SATURATE_HPP__ |
||||
|
||||
#include "opencv2/core/cvdef.h" |
||||
#include "opencv2/core/fast_math.hpp" |
||||
|
||||
namespace cv |
||||
{ |
||||
|
||||
//! @addtogroup core_utils
|
||||
//! @{
|
||||
|
||||
/////////////// saturate_cast (used in image & signal processing) ///////////////////
|
||||
|
||||
/** @brief Template function for accurate conversion from one primitive type to another.
|
||||
|
||||
The functions saturate_cast resemble the standard C++ cast operations, such as static_cast\<T\>() |
||||
and others. They perform an efficient and accurate conversion from one primitive type to another |
||||
(see the introduction chapter). saturate in the name means that when the input value v is out of the |
||||
range of the target type, the result is not formed just by taking low bits of the input, but instead |
||||
the value is clipped. For example: |
||||
@code |
||||
uchar a = saturate_cast<uchar>(-100); // a = 0 (UCHAR_MIN)
|
||||
short b = saturate_cast<short>(33333.33333); // b = 32767 (SHRT_MAX)
|
||||
@endcode |
||||
Such clipping is done when the target type is unsigned char , signed char , unsigned short or |
||||
signed short . For 32-bit integers, no clipping is done. |
||||
|
||||
When the parameter is a floating-point value and the target type is an integer (8-, 16- or 32-bit), |
||||
the floating-point value is first rounded to the nearest integer and then clipped if needed (when |
||||
the target type is 8- or 16-bit). |
||||
|
||||
This operation is used in the simplest or most complex image processing functions in OpenCV. |
||||
|
||||
@param v Function parameter. |
||||
@sa add, subtract, multiply, divide, Mat::convertTo |
||||
*/ |
||||
template<typename _Tp> static inline _Tp saturate_cast(uchar v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(schar v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(ushort v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(short v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(unsigned v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(int v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(float v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(double v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(int64 v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(uint64 v) { return _Tp(v); } |
||||
|
||||
template<> inline uchar saturate_cast<uchar>(schar v) { return (uchar)std::max((int)v, 0); } |
||||
template<> inline uchar saturate_cast<uchar>(ushort v) { return (uchar)std::min((unsigned)v, (unsigned)UCHAR_MAX); } |
||||
template<> inline uchar saturate_cast<uchar>(int v) { return (uchar)((unsigned)v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } |
||||
template<> inline uchar saturate_cast<uchar>(short v) { return saturate_cast<uchar>((int)v); } |
||||
template<> inline uchar saturate_cast<uchar>(unsigned v) { return (uchar)std::min(v, (unsigned)UCHAR_MAX); } |
||||
template<> inline uchar saturate_cast<uchar>(float v) { int iv = cvRound(v); return saturate_cast<uchar>(iv); } |
||||
template<> inline uchar saturate_cast<uchar>(double v) { int iv = cvRound(v); return saturate_cast<uchar>(iv); } |
||||
template<> inline uchar saturate_cast<uchar>(int64 v) { return (uchar)((uint64)v <= (uint64)UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } |
||||
template<> inline uchar saturate_cast<uchar>(uint64 v) { return (uchar)std::min(v, (uint64)UCHAR_MAX); } |
||||
|
||||
template<> inline schar saturate_cast<schar>(uchar v) { return (schar)std::min((int)v, SCHAR_MAX); } |
||||
template<> inline schar saturate_cast<schar>(ushort v) { return (schar)std::min((unsigned)v, (unsigned)SCHAR_MAX); } |
||||
template<> inline schar saturate_cast<schar>(int v) { return (schar)((unsigned)(v-SCHAR_MIN) <= (unsigned)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); } |
||||
template<> inline schar saturate_cast<schar>(short v) { return saturate_cast<schar>((int)v); } |
||||
template<> inline schar saturate_cast<schar>(unsigned v) { return (schar)std::min(v, (unsigned)SCHAR_MAX); } |
||||
template<> inline schar saturate_cast<schar>(float v) { int iv = cvRound(v); return saturate_cast<schar>(iv); } |
||||
template<> inline schar saturate_cast<schar>(double v) { int iv = cvRound(v); return saturate_cast<schar>(iv); } |
||||
template<> inline schar saturate_cast<schar>(int64 v) { return (schar)((uint64)((int64)v-SCHAR_MIN) <= (uint64)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); } |
||||
template<> inline schar saturate_cast<schar>(uint64 v) { return (schar)std::min(v, (uint64)SCHAR_MAX); } |
||||
|
||||
template<> inline ushort saturate_cast<ushort>(schar v) { return (ushort)std::max((int)v, 0); } |
||||
template<> inline ushort saturate_cast<ushort>(short v) { return (ushort)std::max((int)v, 0); } |
||||
template<> inline ushort saturate_cast<ushort>(int v) { return (ushort)((unsigned)v <= (unsigned)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); } |
||||
template<> inline ushort saturate_cast<ushort>(unsigned v) { return (ushort)std::min(v, (unsigned)USHRT_MAX); } |
||||
template<> inline ushort saturate_cast<ushort>(float v) { int iv = cvRound(v); return saturate_cast<ushort>(iv); } |
||||
template<> inline ushort saturate_cast<ushort>(double v) { int iv = cvRound(v); return saturate_cast<ushort>(iv); } |
||||
template<> inline ushort saturate_cast<ushort>(int64 v) { return (ushort)((uint64)v <= (uint64)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); } |
||||
template<> inline ushort saturate_cast<ushort>(uint64 v) { return (ushort)std::min(v, (uint64)USHRT_MAX); } |
||||
|
||||
template<> inline short saturate_cast<short>(ushort v) { return (short)std::min((int)v, SHRT_MAX); } |
||||
template<> inline short saturate_cast<short>(int v) { return (short)((unsigned)(v - SHRT_MIN) <= (unsigned)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); } |
||||
template<> inline short saturate_cast<short>(unsigned v) { return (short)std::min(v, (unsigned)SHRT_MAX); } |
||||
template<> inline short saturate_cast<short>(float v) { int iv = cvRound(v); return saturate_cast<short>(iv); } |
||||
template<> inline short saturate_cast<short>(double v) { int iv = cvRound(v); return saturate_cast<short>(iv); } |
||||
template<> inline short saturate_cast<short>(int64 v) { return (short)((uint64)((int64)v - SHRT_MIN) <= (uint64)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); } |
||||
template<> inline short saturate_cast<short>(uint64 v) { return (short)std::min(v, (uint64)SHRT_MAX); } |
||||
|
||||
template<> inline int saturate_cast<int>(float v) { return cvRound(v); } |
||||
template<> inline int saturate_cast<int>(double v) { return cvRound(v); } |
||||
|
||||
// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
|
||||
template<> inline unsigned saturate_cast<unsigned>(float v) { return cvRound(v); } |
||||
template<> inline unsigned saturate_cast<unsigned>(double v) { return cvRound(v); } |
||||
|
||||
//! @}
|
||||
|
||||
} // cv
|
||||
|
||||
#endif // __OPENCV_CORE_SATURATE_HPP__
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,228 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_CORE_HAL_REPLACEMENT_HPP__ |
||||
#define __OPENCV_CORE_HAL_REPLACEMENT_HPP__ |
||||
|
||||
#include "opencv2/core/hal/interface.h" |
||||
|
||||
inline int hal_ni_add8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_add8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_add16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_add16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_add32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_add32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_add64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_sub64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_max64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_min64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_absdiff64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_and8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_or8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_xor8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_not8u(const uchar*, size_t, uchar*, size_t, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
|
||||
#define cv_hal_add8u hal_ni_add8u |
||||
#define cv_hal_add8s hal_ni_add8s |
||||
#define cv_hal_add16u hal_ni_add16u |
||||
#define cv_hal_add16s hal_ni_add16s |
||||
#define cv_hal_add32s hal_ni_add32s |
||||
#define cv_hal_add32f hal_ni_add32f |
||||
#define cv_hal_add64f hal_ni_add64f |
||||
#define cv_hal_sub8u hal_ni_sub8u |
||||
#define cv_hal_sub8s hal_ni_sub8s |
||||
#define cv_hal_sub16u hal_ni_sub16u |
||||
#define cv_hal_sub16s hal_ni_sub16s |
||||
#define cv_hal_sub32s hal_ni_sub32s |
||||
#define cv_hal_sub32f hal_ni_sub32f |
||||
#define cv_hal_sub64f hal_ni_sub64f |
||||
#define cv_hal_max8u hal_ni_max8u |
||||
#define cv_hal_max8s hal_ni_max8s |
||||
#define cv_hal_max16u hal_ni_max16u |
||||
#define cv_hal_max16s hal_ni_max16s |
||||
#define cv_hal_max32s hal_ni_max32s |
||||
#define cv_hal_max32f hal_ni_max32f |
||||
#define cv_hal_max64f hal_ni_max64f |
||||
#define cv_hal_min8u hal_ni_min8u |
||||
#define cv_hal_min8s hal_ni_min8s |
||||
#define cv_hal_min16u hal_ni_min16u |
||||
#define cv_hal_min16s hal_ni_min16s |
||||
#define cv_hal_min32s hal_ni_min32s |
||||
#define cv_hal_min32f hal_ni_min32f |
||||
#define cv_hal_min64f hal_ni_min64f |
||||
#define cv_hal_absdiff8u hal_ni_absdiff8u |
||||
#define cv_hal_absdiff8s hal_ni_absdiff8s |
||||
#define cv_hal_absdiff16u hal_ni_absdiff16u |
||||
#define cv_hal_absdiff16s hal_ni_absdiff16s |
||||
#define cv_hal_absdiff32s hal_ni_absdiff32s |
||||
#define cv_hal_absdiff32f hal_ni_absdiff32f |
||||
#define cv_hal_absdiff64f hal_ni_absdiff64f |
||||
#define cv_hal_and8u hal_ni_and8u |
||||
#define cv_hal_or8u hal_ni_or8u |
||||
#define cv_hal_xor8u hal_ni_xor8u |
||||
#define cv_hal_not8u hal_ni_not8u |
||||
|
||||
inline int hal_ni_cmp8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_cmp8s(const schar*, size_t, const schar*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_cmp16u(const ushort*, size_t, const ushort*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_cmp16s(const short*, size_t, const short*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_cmp32s(const int*, size_t, const int*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_cmp32f(const float*, size_t, const float*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_cmp64f(const double*, size_t, const double*, size_t, uchar*, size_t, int, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
|
||||
#define cv_hal_cmp8u hal_ni_cmp8u |
||||
#define cv_hal_cmp8s hal_ni_cmp8s |
||||
#define cv_hal_cmp16u hal_ni_cmp16u |
||||
#define cv_hal_cmp16s hal_ni_cmp16s |
||||
#define cv_hal_cmp32s hal_ni_cmp32s |
||||
#define cv_hal_cmp32f hal_ni_cmp32f |
||||
#define cv_hal_cmp64f hal_ni_cmp64f |
||||
|
||||
inline int hal_ni_mul8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_mul8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_mul16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_mul16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_mul32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_mul32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_mul64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_div64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_recip64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, double) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
|
||||
#define cv_hal_mul8u hal_ni_mul8u |
||||
#define cv_hal_mul8s hal_ni_mul8s |
||||
#define cv_hal_mul16u hal_ni_mul16u |
||||
#define cv_hal_mul16s hal_ni_mul16s |
||||
#define cv_hal_mul32s hal_ni_mul32s |
||||
#define cv_hal_mul32f hal_ni_mul32f |
||||
#define cv_hal_mul64f hal_ni_mul64f |
||||
#define cv_hal_div8u hal_ni_div8u |
||||
#define cv_hal_div8s hal_ni_div8s |
||||
#define cv_hal_div16u hal_ni_div16u |
||||
#define cv_hal_div16s hal_ni_div16s |
||||
#define cv_hal_div32s hal_ni_div32s |
||||
#define cv_hal_div32f hal_ni_div32f |
||||
#define cv_hal_div64f hal_ni_div64f |
||||
#define cv_hal_recip8u hal_ni_recip8u |
||||
#define cv_hal_recip8s hal_ni_recip8s |
||||
#define cv_hal_recip16u hal_ni_recip16u |
||||
#define cv_hal_recip16s hal_ni_recip16s |
||||
#define cv_hal_recip32s hal_ni_recip32s |
||||
#define cv_hal_recip32f hal_ni_recip32f |
||||
#define cv_hal_recip64f hal_ni_recip64f |
||||
|
||||
inline int hal_ni_addWeighted8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_addWeighted8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_addWeighted16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_addWeighted16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_addWeighted32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_addWeighted32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_addWeighted64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, const double*) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
|
||||
#define cv_hal_addWeighted8u hal_ni_addWeighted8u |
||||
#define cv_hal_addWeighted8s hal_ni_addWeighted8s |
||||
#define cv_hal_addWeighted16u hal_ni_addWeighted16u |
||||
#define cv_hal_addWeighted16s hal_ni_addWeighted16s |
||||
#define cv_hal_addWeighted32s hal_ni_addWeighted32s |
||||
#define cv_hal_addWeighted32f hal_ni_addWeighted32f |
||||
#define cv_hal_addWeighted64f hal_ni_addWeighted64f |
||||
|
||||
inline int hal_ni_split8u(const uchar*, uchar**, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_split16u(const ushort*, ushort**, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_split32s(const int*, int**, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_split64s(const int64*, int64**, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
|
||||
#define cv_hal_split8u hal_ni_split8u |
||||
#define cv_hal_split16u hal_ni_split16u |
||||
#define cv_hal_split32s hal_ni_split32s |
||||
#define cv_hal_split64s hal_ni_split64s |
||||
|
||||
inline int hal_ni_merge8u(const uchar**, uchar*, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_merge16u(const ushort**, ushort*, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_merge32s(const int**, int*, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
inline int hal_ni_merge64s(const int64**, int64*, int, int) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } |
||||
|
||||
#define cv_hal_merge8u hal_ni_merge8u |
||||
#define cv_hal_merge16u hal_ni_merge16u |
||||
#define cv_hal_merge32s hal_ni_merge32s |
||||
#define cv_hal_merge64s hal_ni_merge64s |
||||
|
||||
#include "custom_hal.hpp" |
||||
|
||||
#endif |
@ -1,7 +1,7 @@ |
||||
#ifndef _TEST_UTILS_HPP_ |
||||
#define _TEST_UTILS_HPP_ |
||||
|
||||
#include "opencv2/hal/intrin.hpp" |
||||
#include "opencv2/core/hal/intrin.hpp" |
||||
#include "opencv2/ts.hpp" |
||||
#include <ostream> |
||||
#include <algorithm> |
@ -1,21 +0,0 @@ |
||||
set(the_description "The Hardware Acceleration Layer (HAL) module") |
||||
|
||||
set(OPENCV_MODULE_TYPE STATIC) |
||||
|
||||
if(OPENCV_HAL_HEADERS AND OPENCV_HAL_LIBS) |
||||
set(OPENCV_HAL_HEADERS_INCLUDES "#include \"${OPENCV_HAL_HEADERS}\"") |
||||
set(DEPS "${OPENCV_HAL_LIBS}") |
||||
else() |
||||
set(OPENCV_HAL_HEADERS_INCLUDES "// using default HAL") |
||||
set(DEPS "") |
||||
endif() |
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE_BINARY_DIR}/custom_hal.hpp" @ONLY) |
||||
|
||||
if(UNIX) |
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") |
||||
endif() |
||||
endif() |
||||
|
||||
ocv_define_module(hal ${DEPS}) |
@ -1,287 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_HAL_HPP__ |
||||
#define __OPENCV_HAL_HPP__ |
||||
|
||||
#include "opencv2/hal/defs.h" |
||||
#include "opencv2/hal/interface.hpp" |
||||
|
||||
/**
|
||||
@defgroup hal Hardware Acceleration Layer |
||||
@{ |
||||
@defgroup hal_intrin Universal intrinsics |
||||
@{ |
||||
@defgroup hal_intrin_impl Private implementation helpers |
||||
@} |
||||
@defgroup hal_utils Platform-dependent utils |
||||
@} |
||||
*/ |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
//! @addtogroup hal
|
||||
//! @{
|
||||
|
||||
class Failure |
||||
{ |
||||
public: |
||||
Failure(int code_ = Error::Unknown) : code(code_) {} |
||||
public: |
||||
int code; |
||||
}; |
||||
|
||||
int normHamming(const uchar* a, int n); |
||||
int normHamming(const uchar* a, const uchar* b, int n); |
||||
|
||||
int normHamming(const uchar* a, int n, int cellSize); |
||||
int normHamming(const uchar* a, const uchar* b, int n, int cellSize); |
||||
|
||||
//////////////////////////////// low-level functions ////////////////////////////////
|
||||
|
||||
int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n); |
||||
int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n); |
||||
bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n); |
||||
bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n); |
||||
|
||||
int normL1_(const uchar* a, const uchar* b, int n); |
||||
float normL1_(const float* a, const float* b, int n); |
||||
float normL2Sqr_(const float* a, const float* b, int n); |
||||
|
||||
void exp(const float* src, float* dst, int n); |
||||
void exp(const double* src, double* dst, int n); |
||||
void log(const float* src, float* dst, int n); |
||||
void log(const double* src, double* dst, int n); |
||||
|
||||
void fastAtan2(const float* y, const float* x, float* dst, int n, bool angleInDegrees); |
||||
void magnitude(const float* x, const float* y, float* dst, int n); |
||||
void magnitude(const double* x, const double* y, double* dst, int n); |
||||
void sqrt(const float* src, float* dst, int len); |
||||
void sqrt(const double* src, double* dst, int len); |
||||
void invSqrt(const float* src, float* dst, int len); |
||||
void invSqrt(const double* src, double* dst, int len); |
||||
|
||||
void split8u(const uchar* src, uchar** dst, int len, int cn ); |
||||
void split16u(const ushort* src, ushort** dst, int len, int cn ); |
||||
void split32s(const int* src, int** dst, int len, int cn ); |
||||
void split64s(const int64* src, int64** dst, int len, int cn ); |
||||
|
||||
void merge8u(const uchar** src, uchar* dst, int len, int cn ); |
||||
void merge16u(const ushort** src, ushort* dst, int len, int cn ); |
||||
void merge32s(const int** src, int* dst, int len, int cn ); |
||||
void merge64s(const int64** src, int64* dst, int len, int cn ); |
||||
|
||||
void add8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void add8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
void add16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
void add16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
void add32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
void add32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
void add64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
void sub8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void sub8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
void sub16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
void sub16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
void sub32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
void sub32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
void sub64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
void max8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void max8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
void max16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
void max16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
void max32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
void max32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
void max64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
void min8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void min8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
void min16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
void min16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
void min32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
void min32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
void min64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
void absdiff8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void absdiff8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* ); |
||||
void absdiff16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* ); |
||||
void absdiff16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* ); |
||||
void absdiff32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* ); |
||||
void absdiff32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* ); |
||||
void absdiff64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* ); |
||||
|
||||
void and8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void or8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void xor8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* ); |
||||
|
||||
void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
void cmp8s(const schar* src1, size_t step1, const schar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
void cmp16s(const short* src1, size_t step1, const short* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
void cmp32s(const int* src1, size_t step1, const int* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
void cmp32f(const float* src1, size_t step1, const float* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop); |
||||
|
||||
void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); |
||||
void mul8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); |
||||
void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); |
||||
void mul16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); |
||||
void mul32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); |
||||
void mul32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); |
||||
void mul64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); |
||||
|
||||
void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); |
||||
void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); |
||||
void div16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); |
||||
void div16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); |
||||
void div32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); |
||||
void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); |
||||
void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); |
||||
|
||||
void recip8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); |
||||
void recip8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); |
||||
void recip16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); |
||||
void recip16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); |
||||
void recip32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); |
||||
void recip32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); |
||||
void recip64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); |
||||
|
||||
void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars ); |
||||
void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars ); |
||||
void addWeighted16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scalars ); |
||||
void addWeighted16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scalars ); |
||||
void addWeighted32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scalars ); |
||||
void addWeighted32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scalars ); |
||||
void addWeighted64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scalars ); |
||||
//! @}
|
||||
|
||||
}} //cv::hal
|
||||
|
||||
namespace cv { |
||||
|
||||
template<typename T1, typename T2=T1, typename T3=T1> struct OpAdd |
||||
{ |
||||
typedef T1 type1; |
||||
typedef T2 type2; |
||||
typedef T3 rtype; |
||||
T3 operator ()(const T1 a, const T2 b) const { return saturate_cast<T3>(a + b); } |
||||
}; |
||||
|
||||
template<typename T1, typename T2=T1, typename T3=T1> struct OpSub |
||||
{ |
||||
typedef T1 type1; |
||||
typedef T2 type2; |
||||
typedef T3 rtype; |
||||
T3 operator ()(const T1 a, const T2 b) const { return saturate_cast<T3>(a - b); } |
||||
}; |
||||
|
||||
template<typename T1, typename T2=T1, typename T3=T1> struct OpRSub |
||||
{ |
||||
typedef T1 type1; |
||||
typedef T2 type2; |
||||
typedef T3 rtype; |
||||
T3 operator ()(const T1 a, const T2 b) const { return saturate_cast<T3>(b - a); } |
||||
}; |
||||
|
||||
template<typename T> struct OpMin |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator ()(const T a, const T b) const { return std::min(a, b); } |
||||
}; |
||||
|
||||
template<typename T> struct OpMax |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator ()(const T a, const T b) const { return std::max(a, b); } |
||||
}; |
||||
|
||||
template<typename T> struct OpAbsDiff |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator()(T a, T b) const { return a > b ? a - b : b - a; } |
||||
}; |
||||
|
||||
template<typename T> struct OpAnd |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator()( T a, T b ) const { return a & b; } |
||||
}; |
||||
|
||||
template<typename T> struct OpOr |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator()( T a, T b ) const { return a | b; } |
||||
}; |
||||
|
||||
template<typename T> struct OpXor |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator()( T a, T b ) const { return a ^ b; } |
||||
}; |
||||
|
||||
template<typename T> struct OpNot |
||||
{ |
||||
typedef T type1; |
||||
typedef T type2; |
||||
typedef T rtype; |
||||
T operator()( T a, T ) const { return ~a; } |
||||
}; |
||||
|
||||
} |
||||
|
||||
#endif //__OPENCV_HAL_HPP__
|
@ -1,675 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_DEF_H__ |
||||
#define __OPENCV_DEF_H__ |
||||
|
||||
//! @addtogroup hal_utils
|
||||
//! @{
|
||||
|
||||
#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300 |
||||
# define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */ |
||||
#endif |
||||
|
||||
#include <limits.h> |
||||
#include "opencv2/hal/interface.hpp" |
||||
|
||||
#if defined __ICL |
||||
# define CV_ICC __ICL |
||||
#elif defined __ICC |
||||
# define CV_ICC __ICC |
||||
#elif defined __ECL |
||||
# define CV_ICC __ECL |
||||
#elif defined __ECC |
||||
# define CV_ICC __ECC |
||||
#elif defined __INTEL_COMPILER |
||||
# define CV_ICC __INTEL_COMPILER |
||||
#endif |
||||
|
||||
#ifndef CV_INLINE |
||||
# if defined __cplusplus |
||||
# define CV_INLINE static inline |
||||
# elif defined _MSC_VER |
||||
# define CV_INLINE __inline |
||||
# else |
||||
# define CV_INLINE static |
||||
# endif |
||||
#endif |
||||
|
||||
#if defined CV_ICC && !defined CV_ENABLE_UNROLLED |
||||
# define CV_ENABLE_UNROLLED 0 |
||||
#else |
||||
# define CV_ENABLE_UNROLLED 1 |
||||
#endif |
||||
|
||||
#ifdef __GNUC__ |
||||
# define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x))) |
||||
#elif defined _MSC_VER |
||||
# define CV_DECL_ALIGNED(x) __declspec(align(x)) |
||||
#else |
||||
# define CV_DECL_ALIGNED(x) |
||||
#endif |
||||
|
||||
/* CPU features and intrinsics support */ |
||||
#define CV_CPU_NONE 0 |
||||
#define CV_CPU_MMX 1 |
||||
#define CV_CPU_SSE 2 |
||||
#define CV_CPU_SSE2 3 |
||||
#define CV_CPU_SSE3 4 |
||||
#define CV_CPU_SSSE3 5 |
||||
#define CV_CPU_SSE4_1 6 |
||||
#define CV_CPU_SSE4_2 7 |
||||
#define CV_CPU_POPCNT 8 |
||||
|
||||
#define CV_CPU_AVX 10 |
||||
#define CV_CPU_AVX2 11 |
||||
#define CV_CPU_FMA3 12 |
||||
|
||||
#define CV_CPU_AVX_512F 13 |
||||
#define CV_CPU_AVX_512BW 14 |
||||
#define CV_CPU_AVX_512CD 15 |
||||
#define CV_CPU_AVX_512DQ 16 |
||||
#define CV_CPU_AVX_512ER 17 |
||||
#define CV_CPU_AVX_512IFMA512 18 |
||||
#define CV_CPU_AVX_512PF 19 |
||||
#define CV_CPU_AVX_512VBMI 20 |
||||
#define CV_CPU_AVX_512VL 21 |
||||
|
||||
#define CV_CPU_NEON 100 |
||||
|
||||
// when adding to this list remember to update the following enum
|
||||
#define CV_HARDWARE_MAX_FEATURE 255 |
||||
|
||||
/** @brief Available CPU features.
|
||||
*/ |
||||
enum CpuFeatures { |
||||
CPU_MMX = 1, |
||||
CPU_SSE = 2, |
||||
CPU_SSE2 = 3, |
||||
CPU_SSE3 = 4, |
||||
CPU_SSSE3 = 5, |
||||
CPU_SSE4_1 = 6, |
||||
CPU_SSE4_2 = 7, |
||||
CPU_POPCNT = 8, |
||||
|
||||
CPU_AVX = 10, |
||||
CPU_AVX2 = 11, |
||||
CPU_FMA3 = 12, |
||||
|
||||
CPU_AVX_512F = 13, |
||||
CPU_AVX_512BW = 14, |
||||
CPU_AVX_512CD = 15, |
||||
CPU_AVX_512DQ = 16, |
||||
CPU_AVX_512ER = 17, |
||||
CPU_AVX_512IFMA512 = 18, |
||||
CPU_AVX_512PF = 19, |
||||
CPU_AVX_512VBMI = 20, |
||||
CPU_AVX_512VL = 21, |
||||
|
||||
CPU_NEON = 100 |
||||
}; |
||||
|
||||
// do not include SSE/AVX/NEON headers for NVCC compiler
|
||||
#ifndef __CUDACC__ |
||||
|
||||
#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2) |
||||
# include <emmintrin.h> |
||||
# define CV_MMX 1 |
||||
# 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 __POPCNT__ || (defined _MSC_VER && _MSC_VER >= 1500) |
||||
# ifdef _MSC_VER |
||||
# include <nmmintrin.h> |
||||
# else |
||||
# include <popcntintrin.h> |
||||
# endif |
||||
# define CV_POPCNT 1 |
||||
# endif |
||||
# if defined __AVX__ || (defined _MSC_VER && _MSC_VER >= 1600 && 0) |
||||
// 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 |
||||
# if defined __AVX2__ || (defined _MSC_VER && _MSC_VER >= 1800 && 0) |
||||
# include <immintrin.h> |
||||
# define CV_AVX2 1 |
||||
# if defined __FMA__ |
||||
# define CV_FMA3 1 |
||||
# endif |
||||
# endif |
||||
#endif |
||||
|
||||
#if (defined WIN32 || defined _WIN32) && defined(_M_ARM) |
||||
# include <Intrin.h> |
||||
# include "arm_neon.h" |
||||
# define CV_NEON 1 |
||||
# define CPU_HAS_NEON_FEATURE (true) |
||||
#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__)) |
||||
# include <arm_neon.h> |
||||
# define CV_NEON 1 |
||||
#endif |
||||
|
||||
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__ |
||||
# define CV_VFP 1 |
||||
#endif |
||||
|
||||
#endif // __CUDACC__
|
||||
|
||||
#ifndef CV_POPCNT |
||||
#define CV_POPCNT 0 |
||||
#endif |
||||
#ifndef CV_MMX |
||||
# define CV_MMX 0 |
||||
#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_AVX2 |
||||
# define CV_AVX2 0 |
||||
#endif |
||||
#ifndef CV_FMA3 |
||||
# define CV_FMA3 0 |
||||
#endif |
||||
#ifndef CV_AVX_512F |
||||
# define CV_AVX_512F 0 |
||||
#endif |
||||
#ifndef CV_AVX_512BW |
||||
# define CV_AVX_512BW 0 |
||||
#endif |
||||
#ifndef CV_AVX_512CD |
||||
# define CV_AVX_512CD 0 |
||||
#endif |
||||
#ifndef CV_AVX_512DQ |
||||
# define CV_AVX_512DQ 0 |
||||
#endif |
||||
#ifndef CV_AVX_512ER |
||||
# define CV_AVX_512ER 0 |
||||
#endif |
||||
#ifndef CV_AVX_512IFMA512 |
||||
# define CV_AVX_512IFMA512 0 |
||||
#endif |
||||
#ifndef CV_AVX_512PF |
||||
# define CV_AVX_512PF 0 |
||||
#endif |
||||
#ifndef CV_AVX_512VBMI |
||||
# define CV_AVX_512VBMI 0 |
||||
#endif |
||||
#ifndef CV_AVX_512VL |
||||
# define CV_AVX_512VL 0 |
||||
#endif |
||||
|
||||
#ifndef CV_NEON |
||||
# define CV_NEON 0 |
||||
#endif |
||||
|
||||
#ifndef CV_VFP |
||||
# define CV_VFP 0 |
||||
#endif |
||||
|
||||
/* fundamental constants */ |
||||
#define CV_PI 3.1415926535897932384626433832795 |
||||
#define CV_2PI 6.283185307179586476925286766559 |
||||
#define CV_LOG2 0.69314718055994530941723212145818 |
||||
|
||||
typedef union Cv32suf |
||||
{ |
||||
int i; |
||||
unsigned u; |
||||
float f; |
||||
} |
||||
Cv32suf; |
||||
|
||||
typedef union Cv64suf |
||||
{ |
||||
int64 i; |
||||
uint64 u; |
||||
double f; |
||||
} |
||||
Cv64suf; |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
bool checkHardwareSupport(int feature); |
||||
void setUseOptimized(bool onoff); |
||||
bool useOptimized(); |
||||
|
||||
}} |
||||
|
||||
#define USE_SSE2 (cv::hal::checkHardwareSupport(CV_CPU_SSE)) |
||||
#define USE_SSE4_2 (cv::hal::checkHardwareSupport(CV_CPU_SSE4_2)) |
||||
#define USE_AVX (cv::hal::checkHardwareSupport(CV_CPU_AVX)) |
||||
#define USE_AVX2 (cv::hal::checkHardwareSupport(CV_CPU_AVX2)) |
||||
|
||||
|
||||
/****************************************************************************************\
|
||||
* fast math * |
||||
\****************************************************************************************/ |
||||
|
||||
#if defined __BORLANDC__ |
||||
# include <fastmath.h> |
||||
#elif defined __cplusplus |
||||
# include <cmath> |
||||
#else |
||||
# include <math.h> |
||||
#endif |
||||
|
||||
#ifdef HAVE_TEGRA_OPTIMIZATION |
||||
# include "tegra_round.hpp" |
||||
#endif |
||||
|
||||
#if CV_VFP |
||||
// 1. general scheme
|
||||
#define ARM_ROUND(_value, _asm_string) \ |
||||
int res; \
|
||||
float temp; \
|
||||
asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
|
||||
return res |
||||
// 2. version for double
|
||||
#ifdef __clang__ |
||||
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]") |
||||
#else |
||||
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]") |
||||
#endif |
||||
// 3. version for float
|
||||
#define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]") |
||||
#endif // CV_VFP
|
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer
|
||||
|
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the |
||||
result is not defined. |
||||
*/ |
||||
CV_INLINE int |
||||
cvRound( double value ) |
||||
{ |
||||
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ |
||||
&& defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128d t = _mm_set_sd( value ); |
||||
return _mm_cvtsd_si32(t); |
||||
#elif defined _MSC_VER && defined _M_IX86 |
||||
int t; |
||||
__asm |
||||
{ |
||||
fld value; |
||||
fistp t; |
||||
} |
||||
return t; |
||||
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \ |
||||
defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION |
||||
TEGRA_ROUND_DBL(value); |
||||
#elif defined CV_ICC || defined __GNUC__ |
||||
# if CV_VFP |
||||
ARM_ROUND_DBL(value); |
||||
# else |
||||
return (int)lrint(value); |
||||
# endif |
||||
#else |
||||
/* it's ok if round does not comply with IEEE754 standard;
|
||||
the tests should allow +/-1 difference when the tested functions use round */ |
||||
return (int)(value + (value >= 0 ? 0.5 : -0.5)); |
||||
#endif |
||||
} |
||||
|
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer not larger than the original.
|
||||
|
||||
The function computes an integer i such that: |
||||
\f[i \le \texttt{value} < i+1\f] |
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the |
||||
result is not defined. |
||||
*/ |
||||
CV_INLINE int cvFloor( double value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128d t = _mm_set_sd( value ); |
||||
int i = _mm_cvtsd_si32(t); |
||||
return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i))); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i - (i > value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(value - i); |
||||
return i - (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer not smaller than the original.
|
||||
|
||||
The function computes an integer i such that: |
||||
\f[i \le \texttt{value} < i+1\f] |
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the |
||||
result is not defined. |
||||
*/ |
||||
CV_INLINE int cvCeil( double value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128d t = _mm_set_sd( value ); |
||||
int i = _mm_cvtsd_si32(t); |
||||
return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t)); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i + (i < value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(i - value); |
||||
return i + (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @brief Determines if the argument is Not A Number.
|
||||
|
||||
@param value The input floating-point value |
||||
|
||||
The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0 |
||||
otherwise. */ |
||||
CV_INLINE int cvIsNaN( double value ) |
||||
{ |
||||
Cv64suf ieee754; |
||||
ieee754.f = value; |
||||
return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) + |
||||
((unsigned)ieee754.u != 0) > 0x7ff00000; |
||||
} |
||||
|
||||
/** @brief Determines if the argument is Infinity.
|
||||
|
||||
@param value The input floating-point value |
||||
|
||||
The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard) |
||||
and 0 otherwise. */ |
||||
CV_INLINE int cvIsInf( double value ) |
||||
{ |
||||
Cv64suf ieee754; |
||||
ieee754.f = value; |
||||
return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 && |
||||
(unsigned)ieee754.u == 0; |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvRound(float value) |
||||
{ |
||||
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && \ |
||||
defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128 t = _mm_set_ss( value ); |
||||
return _mm_cvtss_si32(t); |
||||
#elif defined _MSC_VER && defined _M_IX86 |
||||
int t; |
||||
__asm |
||||
{ |
||||
fld value; |
||||
fistp t; |
||||
} |
||||
return t; |
||||
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \ |
||||
defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION |
||||
TEGRA_ROUND_FLT(value); |
||||
#elif defined CV_ICC || defined __GNUC__ |
||||
# if CV_VFP |
||||
ARM_ROUND_FLT(value); |
||||
# else |
||||
return (int)lrintf(value); |
||||
# endif |
||||
#else |
||||
/* it's ok if round does not comply with IEEE754 standard;
|
||||
the tests should allow +/-1 difference when the tested functions use round */ |
||||
return (int)(value + (value >= 0 ? 0.5f : -0.5f)); |
||||
#endif |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvRound( int value ) |
||||
{ |
||||
return value; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvFloor( float value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128 t = _mm_set_ss( value ); |
||||
int i = _mm_cvtss_si32(t); |
||||
return i - _mm_movemask_ps(_mm_cmplt_ss(t, _mm_cvtsi32_ss(t,i))); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i - (i > value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(value - i); |
||||
return i - (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvFloor( int value ) |
||||
{ |
||||
return value; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvCeil( float value ) |
||||
{ |
||||
#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__) |
||||
__m128 t = _mm_set_ss( value ); |
||||
int i = _mm_cvtss_si32(t); |
||||
return i + _mm_movemask_ps(_mm_cmplt_ss(_mm_cvtsi32_ss(t,i), t)); |
||||
#elif defined __GNUC__ |
||||
int i = (int)value; |
||||
return i + (i < value); |
||||
#else |
||||
int i = cvRound(value); |
||||
float diff = (float)(i - value); |
||||
return i + (diff < 0); |
||||
#endif |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvCeil( int value ) |
||||
{ |
||||
return value; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvIsNaN( float value ) |
||||
{ |
||||
Cv32suf ieee754; |
||||
ieee754.f = value; |
||||
return (ieee754.u & 0x7fffffff) > 0x7f800000; |
||||
} |
||||
|
||||
/** @overload */ |
||||
CV_INLINE int cvIsInf( float value ) |
||||
{ |
||||
Cv32suf ieee754; |
||||
ieee754.f = value; |
||||
return (ieee754.u & 0x7fffffff) == 0x7f800000; |
||||
} |
||||
|
||||
//! @}
|
||||
|
||||
#include <algorithm> |
||||
|
||||
namespace cv |
||||
{ |
||||
|
||||
//! @addtogroup hal_utils
|
||||
//! @{
|
||||
|
||||
/////////////// saturate_cast (used in image & signal processing) ///////////////////
|
||||
|
||||
/** @brief Template function for accurate conversion from one primitive type to another.
|
||||
|
||||
The functions saturate_cast resemble the standard C++ cast operations, such as static_cast\<T\>() |
||||
and others. They perform an efficient and accurate conversion from one primitive type to another |
||||
(see the introduction chapter). saturate in the name means that when the input value v is out of the |
||||
range of the target type, the result is not formed just by taking low bits of the input, but instead |
||||
the value is clipped. For example: |
||||
@code |
||||
uchar a = saturate_cast<uchar>(-100); // a = 0 (UCHAR_MIN)
|
||||
short b = saturate_cast<short>(33333.33333); // b = 32767 (SHRT_MAX)
|
||||
@endcode |
||||
Such clipping is done when the target type is unsigned char , signed char , unsigned short or |
||||
signed short . For 32-bit integers, no clipping is done. |
||||
|
||||
When the parameter is a floating-point value and the target type is an integer (8-, 16- or 32-bit), |
||||
the floating-point value is first rounded to the nearest integer and then clipped if needed (when |
||||
the target type is 8- or 16-bit). |
||||
|
||||
This operation is used in the simplest or most complex image processing functions in OpenCV. |
||||
|
||||
@param v Function parameter. |
||||
@sa add, subtract, multiply, divide, Mat::convertTo |
||||
*/ |
||||
template<typename _Tp> static inline _Tp saturate_cast(uchar v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(schar v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(ushort v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(short v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(unsigned v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(int v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(float v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(double v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(int64 v) { return _Tp(v); } |
||||
/** @overload */ |
||||
template<typename _Tp> static inline _Tp saturate_cast(uint64 v) { return _Tp(v); } |
||||
|
||||
template<> inline uchar saturate_cast<uchar>(schar v) { return (uchar)std::max((int)v, 0); } |
||||
template<> inline uchar saturate_cast<uchar>(ushort v) { return (uchar)std::min((unsigned)v, (unsigned)UCHAR_MAX); } |
||||
template<> inline uchar saturate_cast<uchar>(int v) { return (uchar)((unsigned)v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } |
||||
template<> inline uchar saturate_cast<uchar>(short v) { return saturate_cast<uchar>((int)v); } |
||||
template<> inline uchar saturate_cast<uchar>(unsigned v) { return (uchar)std::min(v, (unsigned)UCHAR_MAX); } |
||||
template<> inline uchar saturate_cast<uchar>(float v) { int iv = cvRound(v); return saturate_cast<uchar>(iv); } |
||||
template<> inline uchar saturate_cast<uchar>(double v) { int iv = cvRound(v); return saturate_cast<uchar>(iv); } |
||||
template<> inline uchar saturate_cast<uchar>(int64 v) { return (uchar)((uint64)v <= (uint64)UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); } |
||||
template<> inline uchar saturate_cast<uchar>(uint64 v) { return (uchar)std::min(v, (uint64)UCHAR_MAX); } |
||||
|
||||
template<> inline schar saturate_cast<schar>(uchar v) { return (schar)std::min((int)v, SCHAR_MAX); } |
||||
template<> inline schar saturate_cast<schar>(ushort v) { return (schar)std::min((unsigned)v, (unsigned)SCHAR_MAX); } |
||||
template<> inline schar saturate_cast<schar>(int v) { return (schar)((unsigned)(v-SCHAR_MIN) <= (unsigned)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); } |
||||
template<> inline schar saturate_cast<schar>(short v) { return saturate_cast<schar>((int)v); } |
||||
template<> inline schar saturate_cast<schar>(unsigned v) { return (schar)std::min(v, (unsigned)SCHAR_MAX); } |
||||
template<> inline schar saturate_cast<schar>(float v) { int iv = cvRound(v); return saturate_cast<schar>(iv); } |
||||
template<> inline schar saturate_cast<schar>(double v) { int iv = cvRound(v); return saturate_cast<schar>(iv); } |
||||
template<> inline schar saturate_cast<schar>(int64 v) { return (schar)((uint64)((int64)v-SCHAR_MIN) <= (uint64)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); } |
||||
template<> inline schar saturate_cast<schar>(uint64 v) { return (schar)std::min(v, (uint64)SCHAR_MAX); } |
||||
|
||||
template<> inline ushort saturate_cast<ushort>(schar v) { return (ushort)std::max((int)v, 0); } |
||||
template<> inline ushort saturate_cast<ushort>(short v) { return (ushort)std::max((int)v, 0); } |
||||
template<> inline ushort saturate_cast<ushort>(int v) { return (ushort)((unsigned)v <= (unsigned)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); } |
||||
template<> inline ushort saturate_cast<ushort>(unsigned v) { return (ushort)std::min(v, (unsigned)USHRT_MAX); } |
||||
template<> inline ushort saturate_cast<ushort>(float v) { int iv = cvRound(v); return saturate_cast<ushort>(iv); } |
||||
template<> inline ushort saturate_cast<ushort>(double v) { int iv = cvRound(v); return saturate_cast<ushort>(iv); } |
||||
template<> inline ushort saturate_cast<ushort>(int64 v) { return (ushort)((uint64)v <= (uint64)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); } |
||||
template<> inline ushort saturate_cast<ushort>(uint64 v) { return (ushort)std::min(v, (uint64)USHRT_MAX); } |
||||
|
||||
template<> inline short saturate_cast<short>(ushort v) { return (short)std::min((int)v, SHRT_MAX); } |
||||
template<> inline short saturate_cast<short>(int v) { return (short)((unsigned)(v - SHRT_MIN) <= (unsigned)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); } |
||||
template<> inline short saturate_cast<short>(unsigned v) { return (short)std::min(v, (unsigned)SHRT_MAX); } |
||||
template<> inline short saturate_cast<short>(float v) { int iv = cvRound(v); return saturate_cast<short>(iv); } |
||||
template<> inline short saturate_cast<short>(double v) { int iv = cvRound(v); return saturate_cast<short>(iv); } |
||||
template<> inline short saturate_cast<short>(int64 v) { return (short)((uint64)((int64)v - SHRT_MIN) <= (uint64)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); } |
||||
template<> inline short saturate_cast<short>(uint64 v) { return (short)std::min(v, (uint64)SHRT_MAX); } |
||||
|
||||
template<> inline int saturate_cast<int>(float v) { return cvRound(v); } |
||||
template<> inline int saturate_cast<int>(double v) { return cvRound(v); } |
||||
|
||||
// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
|
||||
template<> inline unsigned saturate_cast<unsigned>(float v) { return cvRound(v); } |
||||
template<> inline unsigned saturate_cast<unsigned>(double v) { return cvRound(v); } |
||||
|
||||
//! @}
|
||||
|
||||
} |
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif //__OPENCV_HAL_H__
|
@ -1,11 +0,0 @@ |
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) |
||||
|
||||
if(UNIX) |
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") |
||||
endif() |
||||
endif() |
||||
|
||||
add_library(simple_hal simple.cpp) |
||||
set(OPENCV_HAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") |
||||
target_include_directories(simple_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_HAL_DIR}/include) |
File diff suppressed because it is too large
Load Diff
@ -1,47 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp" |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
}} |
@ -1,47 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp" |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
}} |
@ -1,221 +0,0 @@ |
||||
#include "precomp.hpp" |
||||
|
||||
#if defined WIN32 || defined _WIN32 || defined WINCE |
||||
#include <windows.h> |
||||
#if defined _MSC_VER |
||||
#if _MSC_VER >= 1400 |
||||
#include <intrin.h> |
||||
#elif defined _M_IX86 |
||||
static void __cpuid(int* cpuid_data, int) |
||||
{ |
||||
__asm |
||||
{ |
||||
push ebx |
||||
push edi |
||||
mov edi, cpuid_data |
||||
mov eax, 1 |
||||
cpuid |
||||
mov [edi], eax |
||||
mov [edi + 4], ebx |
||||
mov [edi + 8], ecx |
||||
mov [edi + 12], edx |
||||
pop edi |
||||
pop ebx |
||||
} |
||||
} |
||||
static void __cpuidex(int* cpuid_data, int, int) |
||||
{ |
||||
__asm |
||||
{ |
||||
push edi |
||||
mov edi, cpuid_data |
||||
mov eax, 7 |
||||
mov ecx, 0 |
||||
cpuid |
||||
mov [edi], eax |
||||
mov [edi + 4], ebx |
||||
mov [edi + 8], ecx |
||||
mov [edi + 12], edx |
||||
pop edi |
||||
} |
||||
} |
||||
#endif |
||||
#endif |
||||
#endif |
||||
|
||||
#if defined ANDROID || defined __linux__ |
||||
# include <unistd.h> |
||||
# include <fcntl.h> |
||||
# include <elf.h> |
||||
# include <linux/auxvec.h> |
||||
#endif |
||||
|
||||
#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ |
||||
#include <unistd.h> |
||||
#include <stdio.h> |
||||
#include <sys/types.h> |
||||
#if defined ANDROID |
||||
#include <sys/sysconf.h> |
||||
#endif |
||||
#endif |
||||
|
||||
#ifdef ANDROID |
||||
# include <android/log.h> |
||||
#endif |
||||
|
||||
struct HWFeatures |
||||
{ |
||||
enum { MAX_FEATURE = CV_HARDWARE_MAX_FEATURE }; |
||||
|
||||
HWFeatures(void) |
||||
{ |
||||
memset( have, 0, sizeof(have) ); |
||||
x86_family = 0; |
||||
} |
||||
|
||||
static HWFeatures initialize(void) |
||||
{ |
||||
HWFeatures f; |
||||
int cpuid_data[4] = { 0, 0, 0, 0 }; |
||||
|
||||
#if defined _MSC_VER && (defined _M_IX86 || defined _M_X64) |
||||
__cpuid(cpuid_data, 1); |
||||
#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) |
||||
#ifdef __x86_64__ |
||||
asm __volatile__ |
||||
( |
||||
"movl $1, %%eax\n\t" |
||||
"cpuid\n\t" |
||||
:[eax]"=a"(cpuid_data[0]),[ebx]"=b"(cpuid_data[1]),[ecx]"=c"(cpuid_data[2]),[edx]"=d"(cpuid_data[3]) |
||||
: |
||||
: "cc" |
||||
); |
||||
#else |
||||
asm volatile |
||||
( |
||||
"pushl %%ebx\n\t" |
||||
"movl $1,%%eax\n\t" |
||||
"cpuid\n\t" |
||||
"popl %%ebx\n\t" |
||||
: "=a"(cpuid_data[0]), "=c"(cpuid_data[2]), "=d"(cpuid_data[3]) |
||||
: |
||||
: "cc" |
||||
); |
||||
#endif |
||||
#endif |
||||
|
||||
f.x86_family = (cpuid_data[0] >> 8) & 15; |
||||
if( f.x86_family >= 6 ) |
||||
{ |
||||
f.have[CV_CPU_MMX] = (cpuid_data[3] & (1 << 23)) != 0; |
||||
f.have[CV_CPU_SSE] = (cpuid_data[3] & (1<<25)) != 0; |
||||
f.have[CV_CPU_SSE2] = (cpuid_data[3] & (1<<26)) != 0; |
||||
f.have[CV_CPU_SSE3] = (cpuid_data[2] & (1<<0)) != 0; |
||||
f.have[CV_CPU_SSSE3] = (cpuid_data[2] & (1<<9)) != 0; |
||||
f.have[CV_CPU_FMA3] = (cpuid_data[2] & (1<<12)) != 0; |
||||
f.have[CV_CPU_SSE4_1] = (cpuid_data[2] & (1<<19)) != 0; |
||||
f.have[CV_CPU_SSE4_2] = (cpuid_data[2] & (1<<20)) != 0; |
||||
f.have[CV_CPU_POPCNT] = (cpuid_data[2] & (1<<23)) != 0; |
||||
f.have[CV_CPU_AVX] = (((cpuid_data[2] & (1<<28)) != 0)&&((cpuid_data[2] & (1<<27)) != 0));//OS uses XSAVE_XRSTORE and CPU support AVX
|
||||
|
||||
// make the second call to the cpuid command in order to get
|
||||
// information about extended features like AVX2
|
||||
#if defined _MSC_VER && (defined _M_IX86 || defined _M_X64) |
||||
__cpuidex(cpuid_data, 7, 0); |
||||
#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) |
||||
#ifdef __x86_64__ |
||||
asm __volatile__ |
||||
( |
||||
"movl $7, %%eax\n\t" |
||||
"movl $0, %%ecx\n\t" |
||||
"cpuid\n\t" |
||||
:[eax]"=a"(cpuid_data[0]),[ebx]"=b"(cpuid_data[1]),[ecx]"=c"(cpuid_data[2]),[edx]"=d"(cpuid_data[3]) |
||||
: |
||||
: "cc" |
||||
); |
||||
#else |
||||
asm volatile |
||||
( |
||||
"pushl %%ebx\n\t" |
||||
"movl $7,%%eax\n\t" |
||||
"movl $0,%%ecx\n\t" |
||||
"cpuid\n\t" |
||||
"movl %%ebx, %0\n\t" |
||||
"popl %%ebx\n\t" |
||||
: "=r"(cpuid_data[1]), "=c"(cpuid_data[2]) |
||||
: |
||||
: "cc" |
||||
); |
||||
#endif |
||||
#endif |
||||
f.have[CV_CPU_AVX2] = (cpuid_data[1] & (1<<5)) != 0; |
||||
|
||||
f.have[CV_CPU_AVX_512F] = (cpuid_data[1] & (1<<16)) != 0; |
||||
f.have[CV_CPU_AVX_512DQ] = (cpuid_data[1] & (1<<17)) != 0; |
||||
f.have[CV_CPU_AVX_512IFMA512] = (cpuid_data[1] & (1<<21)) != 0; |
||||
f.have[CV_CPU_AVX_512PF] = (cpuid_data[1] & (1<<26)) != 0; |
||||
f.have[CV_CPU_AVX_512ER] = (cpuid_data[1] & (1<<27)) != 0; |
||||
f.have[CV_CPU_AVX_512CD] = (cpuid_data[1] & (1<<28)) != 0; |
||||
f.have[CV_CPU_AVX_512BW] = (cpuid_data[1] & (1<<30)) != 0; |
||||
f.have[CV_CPU_AVX_512VL] = (cpuid_data[1] & (1<<31)) != 0; |
||||
f.have[CV_CPU_AVX_512VBMI] = (cpuid_data[2] & (1<<1)) != 0; |
||||
} |
||||
|
||||
#if defined ANDROID || defined __linux__ |
||||
#ifdef __aarch64__ |
||||
f.have[CV_CPU_NEON] = true; |
||||
#else |
||||
int cpufile = open("/proc/self/auxv", O_RDONLY); |
||||
|
||||
if (cpufile >= 0) |
||||
{ |
||||
Elf32_auxv_t auxv; |
||||
const size_t size_auxv_t = sizeof(auxv); |
||||
|
||||
while ((size_t)read(cpufile, &auxv, size_auxv_t) == size_auxv_t) |
||||
{ |
||||
if (auxv.a_type == AT_HWCAP) |
||||
{ |
||||
f.have[CV_CPU_NEON] = (auxv.a_un.a_val & 4096) != 0; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
close(cpufile); |
||||
} |
||||
#endif |
||||
#elif (defined __clang__ || defined __APPLE__) && (defined __ARM_NEON__ || (defined __ARM_NEON && defined __aarch64__)) |
||||
f.have[CV_CPU_NEON] = true; |
||||
#endif |
||||
|
||||
return f; |
||||
} |
||||
|
||||
int x86_family; |
||||
bool have[MAX_FEATURE+1]; |
||||
}; |
||||
|
||||
static HWFeatures featuresEnabled = HWFeatures::initialize(), featuresDisabled = HWFeatures(); |
||||
static HWFeatures* currentFeatures = &featuresEnabled; |
||||
volatile bool useOptimizedFlag = true; |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
bool checkHardwareSupport(int feature) |
||||
{ |
||||
// CV_DbgAssert( 0 <= feature && feature <= CV_HARDWARE_MAX_FEATURE );
|
||||
return currentFeatures->have[feature]; |
||||
} |
||||
|
||||
void setUseOptimized( bool flag ) |
||||
{ |
||||
useOptimizedFlag = flag; |
||||
currentFeatures = flag ? &featuresEnabled : &featuresDisabled; |
||||
} |
||||
|
||||
bool useOptimized(void) |
||||
{ |
||||
return useOptimizedFlag; |
||||
} |
||||
|
||||
}} |
@ -1,60 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "opencv2/hal.hpp" |
||||
#include "opencv2/hal/intrin.hpp" |
||||
#include <algorithm> |
||||
#include <cmath> |
||||
#include <cstdlib> |
||||
#include <limits> |
||||
#include <float.h> |
||||
#include <cstring> |
||||
#include <cassert> |
||||
|
||||
#include "opencv2/hal/sse_utils.hpp" |
||||
#include "opencv2/hal/neon_utils.hpp" |
||||
|
||||
#if defined HAVE_IPP && (IPP_VERSION_X100 >= 700) |
||||
#define ARITHM_USE_IPP 1 |
||||
#else |
||||
#define ARITHM_USE_IPP 0 |
||||
#endif |
@ -1,208 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_HAL_REPLACEMENT_HPP__ |
||||
#define __OPENCV_HAL_REPLACEMENT_HPP__ |
||||
|
||||
#include "opencv2/hal.hpp" |
||||
|
||||
inline int hal_t_add8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_add8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_add16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_add16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_add32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_add32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_add64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_sub64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_max64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_min64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff16s(const short*, size_t, const short*, size_t, short*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff32s(const int*, size_t, const int*, size_t, int*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff32f(const float*, size_t, const float*, size_t, float*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_absdiff64f(const double*, size_t, const double*, size_t, double*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_and8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_or8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_xor8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_not8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int) { return cv::hal::Error::NotImplemented; } |
||||
|
||||
#define hal_add8u hal_t_add8u |
||||
#define hal_add8s hal_t_add8s |
||||
#define hal_add16u hal_t_add16u |
||||
#define hal_add16s hal_t_add16s |
||||
#define hal_add32s hal_t_add32s |
||||
#define hal_add32f hal_t_add32f |
||||
#define hal_add64f hal_t_add64f |
||||
#define hal_sub8u hal_t_sub8u |
||||
#define hal_sub8s hal_t_sub8s |
||||
#define hal_sub16u hal_t_sub16u |
||||
#define hal_sub16s hal_t_sub16s |
||||
#define hal_sub32s hal_t_sub32s |
||||
#define hal_sub32f hal_t_sub32f |
||||
#define hal_sub64f hal_t_sub64f |
||||
#define hal_max8u hal_t_max8u |
||||
#define hal_max8s hal_t_max8s |
||||
#define hal_max16u hal_t_max16u |
||||
#define hal_max16s hal_t_max16s |
||||
#define hal_max32s hal_t_max32s |
||||
#define hal_max32f hal_t_max32f |
||||
#define hal_max64f hal_t_max64f |
||||
#define hal_min8u hal_t_min8u |
||||
#define hal_min8s hal_t_min8s |
||||
#define hal_min16u hal_t_min16u |
||||
#define hal_min16s hal_t_min16s |
||||
#define hal_min32s hal_t_min32s |
||||
#define hal_min32f hal_t_min32f |
||||
#define hal_min64f hal_t_min64f |
||||
#define hal_absdiff8u hal_t_absdiff8u |
||||
#define hal_absdiff8s hal_t_absdiff8s |
||||
#define hal_absdiff16u hal_t_absdiff16u |
||||
#define hal_absdiff16s hal_t_absdiff16s |
||||
#define hal_absdiff32s hal_t_absdiff32s |
||||
#define hal_absdiff32f hal_t_absdiff32f |
||||
#define hal_absdiff64f hal_t_absdiff64f |
||||
#define hal_and8u hal_t_and8u |
||||
#define hal_or8u hal_t_or8u |
||||
#define hal_xor8u hal_t_xor8u |
||||
#define hal_not8u hal_t_not8u |
||||
|
||||
inline int hal_t_cmp8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_cmp8s(const schar*, size_t, const schar*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_cmp16u(const ushort*, size_t, const ushort*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_cmp16s(const short*, size_t, const short*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_cmp32s(const int*, size_t, const int*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_cmp32f(const float*, size_t, const float*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_cmp64f(const double*, size_t, const double*, size_t, uchar*, size_t, int, int, int) { return cv::hal::Error::NotImplemented; } |
||||
|
||||
#define hal_cmp8u hal_t_cmp8u |
||||
#define hal_cmp8s hal_t_cmp8s |
||||
#define hal_cmp16u hal_t_cmp16u |
||||
#define hal_cmp16s hal_t_cmp16s |
||||
#define hal_cmp32s hal_t_cmp32s |
||||
#define hal_cmp32f hal_t_cmp32f |
||||
#define hal_cmp64f hal_t_cmp64f |
||||
|
||||
inline int hal_t_mul8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_mul8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_mul16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_mul16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_mul32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_mul32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_mul64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_div64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_recip64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, double) { return cv::hal::Error::NotImplemented; } |
||||
|
||||
#define hal_mul8u hal_t_mul8u |
||||
#define hal_mul8s hal_t_mul8s |
||||
#define hal_mul16u hal_t_mul16u |
||||
#define hal_mul16s hal_t_mul16s |
||||
#define hal_mul32s hal_t_mul32s |
||||
#define hal_mul32f hal_t_mul32f |
||||
#define hal_mul64f hal_t_mul64f |
||||
#define hal_div8u hal_t_div8u |
||||
#define hal_div8s hal_t_div8s |
||||
#define hal_div16u hal_t_div16u |
||||
#define hal_div16s hal_t_div16s |
||||
#define hal_div32s hal_t_div32s |
||||
#define hal_div32f hal_t_div32f |
||||
#define hal_div64f hal_t_div64f |
||||
#define hal_recip8u hal_t_recip8u |
||||
#define hal_recip8s hal_t_recip8s |
||||
#define hal_recip16u hal_t_recip16u |
||||
#define hal_recip16s hal_t_recip16s |
||||
#define hal_recip32s hal_t_recip32s |
||||
#define hal_recip32f hal_t_recip32f |
||||
#define hal_recip64f hal_t_recip64f |
||||
|
||||
inline int hal_t_addWeighted8u(const uchar*, size_t, const uchar*, size_t, uchar*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_addWeighted8s(const schar*, size_t, const schar*, size_t, schar*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_addWeighted16u(const ushort*, size_t, const ushort*, size_t, ushort*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_addWeighted16s(const short*, size_t, const short*, size_t, short*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_addWeighted32s(const int*, size_t, const int*, size_t, int*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_addWeighted32f(const float*, size_t, const float*, size_t, float*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
inline int hal_t_addWeighted64f(const double*, size_t, const double*, size_t, double*, size_t, int, int, void*) { return cv::hal::Error::NotImplemented; } |
||||
|
||||
#define hal_addWeighted8u hal_t_addWeighted8u |
||||
#define hal_addWeighted8s hal_t_addWeighted8s |
||||
#define hal_addWeighted16u hal_t_addWeighted16u |
||||
#define hal_addWeighted16s hal_t_addWeighted16s |
||||
#define hal_addWeighted32s hal_t_addWeighted32s |
||||
#define hal_addWeighted32f hal_t_addWeighted32f |
||||
#define hal_addWeighted64f hal_t_addWeighted64f |
||||
|
||||
#include "custom_hal.hpp" |
||||
|
||||
#endif |
@ -1,47 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp" |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
}} |
@ -1,306 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp" |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
static const uchar popCountTable[] = |
||||
{ |
||||
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, |
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, |
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, |
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, |
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, |
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, |
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, |
||||
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 |
||||
}; |
||||
|
||||
static const uchar popCountTable2[] = |
||||
{ |
||||
0, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, |
||||
1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, |
||||
1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, |
||||
2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, |
||||
1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, |
||||
2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, |
||||
1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, |
||||
2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4 |
||||
}; |
||||
|
||||
static const uchar popCountTable4[] = |
||||
{ |
||||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
||||
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 |
||||
}; |
||||
|
||||
int normHamming(const uchar* a, int n) |
||||
{ |
||||
int i = 0; |
||||
int result = 0; |
||||
#if CV_NEON |
||||
{ |
||||
uint32x4_t bits = vmovq_n_u32(0); |
||||
for (; i <= n - 16; i += 16) { |
||||
uint8x16_t A_vec = vld1q_u8 (a + i); |
||||
uint8x16_t bitsSet = vcntq_u8 (A_vec); |
||||
uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet); |
||||
uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8); |
||||
bits = vaddq_u32(bits, bitSet4); |
||||
} |
||||
uint64x2_t bitSet2 = vpaddlq_u32 (bits); |
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0); |
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2); |
||||
} |
||||
#endif |
||||
for( ; i <= n - 4; i += 4 ) |
||||
result += popCountTable[a[i]] + popCountTable[a[i+1]] + |
||||
popCountTable[a[i+2]] + popCountTable[a[i+3]]; |
||||
for( ; i < n; i++ ) |
||||
result += popCountTable[a[i]]; |
||||
return result; |
||||
} |
||||
|
||||
int normHamming(const uchar* a, const uchar* b, int n) |
||||
{ |
||||
int i = 0; |
||||
int result = 0; |
||||
#if CV_NEON |
||||
{ |
||||
uint32x4_t bits = vmovq_n_u32(0); |
||||
for (; i <= n - 16; i += 16) { |
||||
uint8x16_t A_vec = vld1q_u8 (a + i); |
||||
uint8x16_t B_vec = vld1q_u8 (b + i); |
||||
uint8x16_t AxorB = veorq_u8 (A_vec, B_vec); |
||||
uint8x16_t bitsSet = vcntq_u8 (AxorB); |
||||
uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet); |
||||
uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8); |
||||
bits = vaddq_u32(bits, bitSet4); |
||||
} |
||||
uint64x2_t bitSet2 = vpaddlq_u32 (bits); |
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0); |
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2); |
||||
} |
||||
#endif |
||||
for( ; i <= n - 4; i += 4 ) |
||||
result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] + |
||||
popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]]; |
||||
for( ; i < n; i++ ) |
||||
result += popCountTable[a[i] ^ b[i]]; |
||||
return result; |
||||
} |
||||
|
||||
int normHamming(const uchar* a, int n, int cellSize) |
||||
{ |
||||
if( cellSize == 1 ) |
||||
return normHamming(a, n); |
||||
const uchar* tab = 0; |
||||
if( cellSize == 2 ) |
||||
tab = popCountTable2; |
||||
else if( cellSize == 4 ) |
||||
tab = popCountTable4; |
||||
else |
||||
return -1; |
||||
int i = 0; |
||||
int result = 0; |
||||
#if CV_ENABLE_UNROLLED |
||||
for( ; i <= n - 4; i += 4 ) |
||||
result += tab[a[i]] + tab[a[i+1]] + tab[a[i+2]] + tab[a[i+3]]; |
||||
#endif |
||||
for( ; i < n; i++ ) |
||||
result += tab[a[i]]; |
||||
return result; |
||||
} |
||||
|
||||
int normHamming(const uchar* a, const uchar* b, int n, int cellSize) |
||||
{ |
||||
if( cellSize == 1 ) |
||||
return normHamming(a, b, n); |
||||
const uchar* tab = 0; |
||||
if( cellSize == 2 ) |
||||
tab = popCountTable2; |
||||
else if( cellSize == 4 ) |
||||
tab = popCountTable4; |
||||
else |
||||
return -1; |
||||
int i = 0; |
||||
int result = 0; |
||||
#if CV_ENABLE_UNROLLED |
||||
for( ; i <= n - 4; i += 4 ) |
||||
result += tab[a[i] ^ b[i]] + tab[a[i+1] ^ b[i+1]] + |
||||
tab[a[i+2] ^ b[i+2]] + tab[a[i+3] ^ b[i+3]]; |
||||
#endif |
||||
for( ; i < n; i++ ) |
||||
result += tab[a[i] ^ b[i]]; |
||||
return result; |
||||
} |
||||
|
||||
float normL2Sqr_(const float* a, const float* b, int n) |
||||
{ |
||||
int j = 0; float d = 0.f; |
||||
#if CV_SSE |
||||
float CV_DECL_ALIGNED(16) buf[4]; |
||||
__m128 d0 = _mm_setzero_ps(), d1 = _mm_setzero_ps(); |
||||
|
||||
for( ; j <= n - 8; j += 8 ) |
||||
{ |
||||
__m128 t0 = _mm_sub_ps(_mm_loadu_ps(a + j), _mm_loadu_ps(b + j)); |
||||
__m128 t1 = _mm_sub_ps(_mm_loadu_ps(a + j + 4), _mm_loadu_ps(b + j + 4)); |
||||
d0 = _mm_add_ps(d0, _mm_mul_ps(t0, t0)); |
||||
d1 = _mm_add_ps(d1, _mm_mul_ps(t1, t1)); |
||||
} |
||||
_mm_store_ps(buf, _mm_add_ps(d0, d1)); |
||||
d = buf[0] + buf[1] + buf[2] + buf[3]; |
||||
#endif |
||||
{ |
||||
for( ; j <= n - 4; j += 4 ) |
||||
{ |
||||
float t0 = a[j] - b[j], t1 = a[j+1] - b[j+1], t2 = a[j+2] - b[j+2], t3 = a[j+3] - b[j+3]; |
||||
d += t0*t0 + t1*t1 + t2*t2 + t3*t3; |
||||
} |
||||
} |
||||
|
||||
for( ; j < n; j++ ) |
||||
{ |
||||
float t = a[j] - b[j]; |
||||
d += t*t; |
||||
} |
||||
return d; |
||||
} |
||||
|
||||
|
||||
float normL1_(const float* a, const float* b, int n) |
||||
{ |
||||
int j = 0; float d = 0.f; |
||||
#if CV_SSE |
||||
float CV_DECL_ALIGNED(16) buf[4]; |
||||
static const int CV_DECL_ALIGNED(16) absbuf[4] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; |
||||
__m128 d0 = _mm_setzero_ps(), d1 = _mm_setzero_ps(); |
||||
__m128 absmask = _mm_load_ps((const float*)absbuf); |
||||
|
||||
for( ; j <= n - 8; j += 8 ) |
||||
{ |
||||
__m128 t0 = _mm_sub_ps(_mm_loadu_ps(a + j), _mm_loadu_ps(b + j)); |
||||
__m128 t1 = _mm_sub_ps(_mm_loadu_ps(a + j + 4), _mm_loadu_ps(b + j + 4)); |
||||
d0 = _mm_add_ps(d0, _mm_and_ps(t0, absmask)); |
||||
d1 = _mm_add_ps(d1, _mm_and_ps(t1, absmask)); |
||||
} |
||||
_mm_store_ps(buf, _mm_add_ps(d0, d1)); |
||||
d = buf[0] + buf[1] + buf[2] + buf[3]; |
||||
#elif CV_NEON |
||||
float32x4_t v_sum = vdupq_n_f32(0.0f); |
||||
for ( ; j <= n - 4; j += 4) |
||||
v_sum = vaddq_f32(v_sum, vabdq_f32(vld1q_f32(a + j), vld1q_f32(b + j))); |
||||
|
||||
float CV_DECL_ALIGNED(16) buf[4]; |
||||
vst1q_f32(buf, v_sum); |
||||
d = buf[0] + buf[1] + buf[2] + buf[3]; |
||||
#endif |
||||
{ |
||||
for( ; j <= n - 4; j += 4 ) |
||||
{ |
||||
d += std::abs(a[j] - b[j]) + std::abs(a[j+1] - b[j+1]) + |
||||
std::abs(a[j+2] - b[j+2]) + std::abs(a[j+3] - b[j+3]); |
||||
} |
||||
} |
||||
|
||||
for( ; j < n; j++ ) |
||||
d += std::abs(a[j] - b[j]); |
||||
return d; |
||||
} |
||||
|
||||
int normL1_(const uchar* a, const uchar* b, int n) |
||||
{ |
||||
int j = 0, d = 0; |
||||
#if CV_SSE |
||||
__m128i d0 = _mm_setzero_si128(); |
||||
|
||||
for( ; j <= n - 16; j += 16 ) |
||||
{ |
||||
__m128i t0 = _mm_loadu_si128((const __m128i*)(a + j)); |
||||
__m128i t1 = _mm_loadu_si128((const __m128i*)(b + j)); |
||||
|
||||
d0 = _mm_add_epi32(d0, _mm_sad_epu8(t0, t1)); |
||||
} |
||||
|
||||
for( ; j <= n - 4; j += 4 ) |
||||
{ |
||||
__m128i t0 = _mm_cvtsi32_si128(*(const int*)(a + j)); |
||||
__m128i t1 = _mm_cvtsi32_si128(*(const int*)(b + j)); |
||||
|
||||
d0 = _mm_add_epi32(d0, _mm_sad_epu8(t0, t1)); |
||||
} |
||||
d = _mm_cvtsi128_si32(_mm_add_epi32(d0, _mm_unpackhi_epi64(d0, d0))); |
||||
#elif CV_NEON |
||||
uint32x4_t v_sum = vdupq_n_u32(0.0f); |
||||
for ( ; j <= n - 16; j += 16) |
||||
{ |
||||
uint8x16_t v_dst = vabdq_u8(vld1q_u8(a + j), vld1q_u8(b + j)); |
||||
uint16x8_t v_low = vmovl_u8(vget_low_u8(v_dst)), v_high = vmovl_u8(vget_high_u8(v_dst)); |
||||
v_sum = vaddq_u32(v_sum, vaddl_u16(vget_low_u16(v_low), vget_low_u16(v_high))); |
||||
v_sum = vaddq_u32(v_sum, vaddl_u16(vget_high_u16(v_low), vget_high_u16(v_high))); |
||||
} |
||||
|
||||
uint CV_DECL_ALIGNED(16) buf[4]; |
||||
vst1q_u32(buf, v_sum); |
||||
d = buf[0] + buf[1] + buf[2] + buf[3]; |
||||
#endif |
||||
{ |
||||
for( ; j <= n - 4; j += 4 ) |
||||
{ |
||||
d += std::abs(a[j] - b[j]) + std::abs(a[j+1] - b[j+1]) + |
||||
std::abs(a[j+2] - b[j+2]) + std::abs(a[j+3] - b[j+3]); |
||||
} |
||||
} |
||||
for( ; j < n; j++ ) |
||||
d += std::abs(a[j] - b[j]); |
||||
return d; |
||||
} |
||||
|
||||
}} //cv::hal
|
@ -1,47 +0,0 @@ |
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp" |
||||
|
||||
namespace cv { namespace hal { |
||||
|
||||
}} |
@ -1,3 +0,0 @@ |
||||
#include "opencv2/ts.hpp" |
||||
|
||||
CV_TEST_MAIN("cv") |
@ -1,11 +0,0 @@ |
||||
#ifndef __OPENCV_HAL_TEST_PRECOMP_HPP__ |
||||
#define __OPENCV_HAL_TEST_PRECOMP_HPP__ |
||||
|
||||
#include <iostream> |
||||
#include <limits> |
||||
#include "opencv2/ts.hpp" |
||||
#include "opencv2/hal.hpp" |
||||
#include "opencv2/hal/defs.h" |
||||
#include "opencv2/hal/intrin.hpp" |
||||
|
||||
#endif |
@ -0,0 +1,34 @@ |
||||
Custom HAL samples |
||||
================== |
||||
|
||||
Samples in this folder are intended to demonstrate functionality replacement mechanism in the OpenCV library. |
||||
|
||||
The __c_hal__ is the example of pure C replacement library with all functions returning error. It can be used to verify error handling in the function switching code. |
||||
|
||||
The __slow_hal__ contains naive C++ implementations of the element-wise logical array operations (and, or, xor, not) making them twice slower than the default. |
||||
|
||||
Build custom HAL replacement library |
||||
------------------------------------ |
||||
|
||||
1. Create folder for build (for example `<home-dir>/my-hal-build`) |
||||
2. Go to the created folder and run cmake: `cmake <opencv-src>/samples/hal/slow_hal` |
||||
3. Run make |
||||
|
||||
After build you will find static library in the build folder: `libslow_hal.a` |
||||
|
||||
Build OpenCV with HAL replacement |
||||
--------------------------------- |
||||
|
||||
1. Create folder for build (for example `<home-dir>/my-opencv-build`) |
||||
2. Go to the created folder and run cmake: |
||||
``` |
||||
cmake \ |
||||
-DOPENCV_HAL_HEADERS="<opencv-src>/samples/hal/slow_hal/impl.hpp" \ |
||||
-DOPENCV_HAL_LIBS="<home-dir>/my-hal-build/libslow_hal.a" \ |
||||
<opencv-src> |
||||
``` |
||||
3. Run make (or `make opencv_perf_core` to build the demonstration test executable only) |
||||
4. After build you can run the tests and verify that some functions works slower: |
||||
``` |
||||
./bin/opencv_perf_core --gtest_filter=*bitwise_and* |
||||
``` |
@ -0,0 +1,11 @@ |
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) |
||||
|
||||
if(UNIX) |
||||
if(CMAKE_COMPILER_IS_GNUC OR CV_ICC) |
||||
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") |
||||
endif() |
||||
endif() |
||||
|
||||
add_library(c_hal impl.c) |
||||
set(OPENCV_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..") |
||||
target_include_directories(c_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_SRC_DIR}/modules/core/include) |
@ -0,0 +1,371 @@ |
||||
#include "impl.h" |
||||
|
||||
int wrong_add8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_add8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_add16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_add16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_add32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_add32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_add64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_sub64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_max64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_min64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_absdiff64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_and8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_or8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_xor8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_not8u(const uchar* src1, size_t sz1, uchar* dst, size_t sz, int w, int h) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp16s(const short* src1, size_t sz1, const short* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp32s(const int* src1, size_t sz1, const int* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp32f(const float* src1, size_t sz1, const float* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_cmp64f(const double* src1, size_t sz1, const double* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_mul64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_div64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_recip64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
||||
|
||||
int wrong_addWeighted64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, const double* scales) |
||||
{ |
||||
return CV_HAL_ERROR_UNKNOWN; // to test how OpenCV handles errors from external HAL
|
||||
} |
@ -0,0 +1,245 @@ |
||||
#ifndef _wrong_H_INCLUDED_ |
||||
#define _wrong_H_INCLUDED_ |
||||
|
||||
#include "opencv2/core/hal/interface.h" |
||||
|
||||
#if defined(__cplusplus) |
||||
extern "C" |
||||
{ |
||||
#endif |
||||
|
||||
int wrong_add8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_add8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h); |
||||
int wrong_add16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h); |
||||
int wrong_add16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h); |
||||
int wrong_add32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h); |
||||
int wrong_add32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h); |
||||
int wrong_add64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h); |
||||
int wrong_sub8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_sub8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h); |
||||
int wrong_sub16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h); |
||||
int wrong_sub16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h); |
||||
int wrong_sub32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h); |
||||
int wrong_sub32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h); |
||||
int wrong_sub64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h); |
||||
int wrong_max8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_max8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h); |
||||
int wrong_max16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h); |
||||
int wrong_max16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h); |
||||
int wrong_max32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h); |
||||
int wrong_max32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h); |
||||
int wrong_max64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h); |
||||
int wrong_min8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_min8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h); |
||||
int wrong_min16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h); |
||||
int wrong_min16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h); |
||||
int wrong_min32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h); |
||||
int wrong_min32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h); |
||||
int wrong_min64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h); |
||||
int wrong_absdiff64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h); |
||||
int wrong_and8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_or8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_xor8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h); |
||||
int wrong_not8u(const uchar* src1, size_t sz1, uchar* dst, size_t sz, int w, int h); |
||||
|
||||
#undef cv_hal_add8u |
||||
#define cv_hal_add8u wrong_add8u |
||||
#undef cv_hal_add8s |
||||
#define cv_hal_add8s wrong_add8s |
||||
#undef cv_hal_add16u |
||||
#define cv_hal_add16u wrong_add16u |
||||
#undef cv_hal_add16s |
||||
#define cv_hal_add16s wrong_add16s |
||||
#undef cv_hal_add32s |
||||
#define cv_hal_add32s wrong_add32s |
||||
#undef cv_hal_add32f |
||||
#define cv_hal_add32f wrong_add32f |
||||
#undef cv_hal_add64f |
||||
#define cv_hal_add64f wrong_add64f |
||||
#undef cv_hal_sub8u |
||||
#define cv_hal_sub8u wrong_sub8u |
||||
#undef cv_hal_sub8s |
||||
#define cv_hal_sub8s wrong_sub8s |
||||
#undef cv_hal_sub16u |
||||
#define cv_hal_sub16u wrong_sub16u |
||||
#undef cv_hal_sub16s |
||||
#define cv_hal_sub16s wrong_sub16s |
||||
#undef cv_hal_sub32s |
||||
#define cv_hal_sub32s wrong_sub32s |
||||
#undef cv_hal_sub32f |
||||
#define cv_hal_sub32f wrong_sub32f |
||||
#undef cv_hal_sub64f |
||||
#define cv_hal_sub64f wrong_sub64f |
||||
#undef cv_hal_max8u |
||||
#define cv_hal_max8u wrong_max8u |
||||
#undef cv_hal_max8s |
||||
#define cv_hal_max8s wrong_max8s |
||||
#undef cv_hal_max16u |
||||
#define cv_hal_max16u wrong_max16u |
||||
#undef cv_hal_max16s |
||||
#define cv_hal_max16s wrong_max16s |
||||
#undef cv_hal_max32s |
||||
#define cv_hal_max32s wrong_max32s |
||||
#undef cv_hal_max32f |
||||
#define cv_hal_max32f wrong_max32f |
||||
#undef cv_hal_max64f |
||||
#define cv_hal_max64f wrong_max64f |
||||
#undef cv_hal_min8u |
||||
#define cv_hal_min8u wrong_min8u |
||||
#undef cv_hal_min8s |
||||
#define cv_hal_min8s wrong_min8s |
||||
#undef cv_hal_min16u |
||||
#define cv_hal_min16u wrong_min16u |
||||
#undef cv_hal_min16s |
||||
#define cv_hal_min16s wrong_min16s |
||||
#undef cv_hal_min32s |
||||
#define cv_hal_min32s wrong_min32s |
||||
#undef cv_hal_min32f |
||||
#define cv_hal_min32f wrong_min32f |
||||
#undef cv_hal_min64f |
||||
#define cv_hal_min64f wrong_min64f |
||||
#undef cv_hal_absdiff8u |
||||
#define cv_hal_absdiff8u wrong_absdiff8u |
||||
#undef cv_hal_absdiff8s |
||||
#define cv_hal_absdiff8s wrong_absdiff8s |
||||
#undef cv_hal_absdiff16u |
||||
#define cv_hal_absdiff16u wrong_absdiff16u |
||||
#undef cv_hal_absdiff16s |
||||
#define cv_hal_absdiff16s wrong_absdiff16s |
||||
#undef cv_hal_absdiff32s |
||||
#define cv_hal_absdiff32s wrong_absdiff32s |
||||
#undef cv_hal_absdiff32f |
||||
#define cv_hal_absdiff32f wrong_absdiff32f |
||||
#undef cv_hal_absdiff64f |
||||
#define cv_hal_absdiff64f wrong_absdiff64f |
||||
#undef cv_hal_and8u |
||||
#define cv_hal_and8u wrong_and8u |
||||
#undef cv_hal_or8u |
||||
#define cv_hal_or8u wrong_or8u |
||||
#undef cv_hal_xor8u |
||||
#define cv_hal_xor8u wrong_xor8u |
||||
#undef cv_hal_not8u |
||||
#define cv_hal_not8u wrong_not8u |
||||
|
||||
int wrong_cmp8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
int wrong_cmp8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
int wrong_cmp16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
int wrong_cmp16s(const short* src1, size_t sz1, const short* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
int wrong_cmp32s(const int* src1, size_t sz1, const int* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
int wrong_cmp32f(const float* src1, size_t sz1, const float* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
int wrong_cmp64f(const double* src1, size_t sz1, const double* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, int op); |
||||
|
||||
#undef cv_hal_cmp8u |
||||
#define cv_hal_cmp8u wrong_cmp8u |
||||
#undef cv_hal_cmp8s |
||||
#define cv_hal_cmp8s wrong_cmp8s |
||||
#undef cv_hal_cmp16u |
||||
#define cv_hal_cmp16u wrong_cmp16u |
||||
#undef cv_hal_cmp16s |
||||
#define cv_hal_cmp16s wrong_cmp16s |
||||
#undef cv_hal_cmp32s |
||||
#define cv_hal_cmp32s wrong_cmp32s |
||||
#undef cv_hal_cmp32f |
||||
#define cv_hal_cmp32f wrong_cmp32f |
||||
#undef cv_hal_cmp64f |
||||
#define cv_hal_cmp64f wrong_cmp64f |
||||
|
||||
int wrong_mul8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_mul8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_mul16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_mul16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_mul32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_mul32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_mul64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_div64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, double scale); |
||||
int wrong_recip64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, double scale); |
||||
|
||||
#undef cv_hal_mul8u |
||||
#define cv_hal_mul8u wrong_mul8u |
||||
#undef cv_hal_mul8s |
||||
#define cv_hal_mul8s wrong_mul8s |
||||
#undef cv_hal_mul16u |
||||
#define cv_hal_mul16u wrong_mul16u |
||||
#undef cv_hal_mul16s |
||||
#define cv_hal_mul16s wrong_mul16s |
||||
#undef cv_hal_mul32s |
||||
#define cv_hal_mul32s wrong_mul32s |
||||
#undef cv_hal_mul32f |
||||
#define cv_hal_mul32f wrong_mul32f |
||||
#undef cv_hal_mul64f |
||||
#define cv_hal_mul64f wrong_mul64f |
||||
#undef cv_hal_div8u |
||||
#define cv_hal_div8u wrong_div8u |
||||
#undef cv_hal_div8s |
||||
#define cv_hal_div8s wrong_div8s |
||||
#undef cv_hal_div16u |
||||
#define cv_hal_div16u wrong_div16u |
||||
#undef cv_hal_div16s |
||||
#define cv_hal_div16s wrong_div16s |
||||
#undef cv_hal_div32s |
||||
#define cv_hal_div32s wrong_div32s |
||||
#undef cv_hal_div32f |
||||
#define cv_hal_div32f wrong_div32f |
||||
#undef cv_hal_div64f |
||||
#define cv_hal_div64f wrong_div64f |
||||
#undef cv_hal_recip8u |
||||
#define cv_hal_recip8u wrong_recip8u |
||||
#undef cv_hal_recip8s |
||||
#define cv_hal_recip8s wrong_recip8s |
||||
#undef cv_hal_recip16u |
||||
#define cv_hal_recip16u wrong_recip16u |
||||
#undef cv_hal_recip16s |
||||
#define cv_hal_recip16s wrong_recip16s |
||||
#undef cv_hal_recip32s |
||||
#define cv_hal_recip32s wrong_recip32s |
||||
#undef cv_hal_recip32f |
||||
#define cv_hal_recip32f wrong_recip32f |
||||
#undef cv_hal_recip64f |
||||
#define cv_hal_recip64f wrong_recip64f |
||||
|
||||
int wrong_addWeighted8u(const uchar* src1, size_t sz1, const uchar* src2, size_t sz2, uchar* dst, size_t sz, int w, int h, const double* scales); |
||||
int wrong_addWeighted8s(const schar* src1, size_t sz1, const schar* src2, size_t sz2, schar* dst, size_t sz, int w, int h, const double* scales); |
||||
int wrong_addWeighted16u(const ushort* src1, size_t sz1, const ushort* src2, size_t sz2, ushort* dst, size_t sz, int w, int h, const double* scales); |
||||
int wrong_addWeighted16s(const short* src1, size_t sz1, const short* src2, size_t sz2, short* dst, size_t sz, int w, int h, const double* scales); |
||||
int wrong_addWeighted32s(const int* src1, size_t sz1, const int* src2, size_t sz2, int* dst, size_t sz, int w, int h, const double* scales); |
||||
int wrong_addWeighted32f(const float* src1, size_t sz1, const float* src2, size_t sz2, float* dst, size_t sz, int w, int h, const double* scales); |
||||
int wrong_addWeighted64f(const double* src1, size_t sz1, const double* src2, size_t sz2, double* dst, size_t sz, int w, int h, const double* scales); |
||||
|
||||
#undef cv_hal_addWeighted8u |
||||
#define cv_hal_addWeighted8u wrong_addWeighted8u |
||||
#undef cv_hal_addWeighted8s |
||||
#define cv_hal_addWeighted8s wrong_addWeighted8s |
||||
#undef cv_hal_addWeighted16u |
||||
#define cv_hal_addWeighted16u wrong_addWeighted16u |
||||
#undef cv_hal_addWeighted16s |
||||
#define cv_hal_addWeighted16s wrong_addWeighted16s |
||||
#undef cv_hal_addWeighted32s |
||||
#define cv_hal_addWeighted32s wrong_addWeighted32s |
||||
#undef cv_hal_addWeighted32f |
||||
#define cv_hal_addWeighted32f wrong_addWeighted32f |
||||
#undef cv_hal_addWeighted64f |
||||
#define cv_hal_addWeighted64f wrong_addWeighted64f |
||||
|
||||
#if defined(__cplusplus) |
||||
} |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,11 @@ |
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) |
||||
|
||||
if(UNIX) |
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) |
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") |
||||
endif() |
||||
endif() |
||||
|
||||
add_library(slow_hal impl.cpp) |
||||
set(OPENCV_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..") |
||||
target_include_directories(slow_hal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${OPENCV_SRC_DIR}/modules/core/include) |
@ -1,20 +1,20 @@ |
||||
#ifndef _SIMPLE_HPP_INCLUDED_ |
||||
#define _SIMPLE_HPP_INCLUDED_ |
||||
|
||||
#include "opencv2/hal/interface.hpp" |
||||
#include "opencv2/core/hal/interface.h" |
||||
|
||||
int slow_and8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height); |
||||
int slow_or8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height); |
||||
int slow_xor8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height); |
||||
int slow_not8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height); |
||||
int slow_not8u(const uchar* src1, size_t step1, uchar* dst, size_t step, int width, int height); |
||||
|
||||
#undef hal_and8u |
||||
#define hal_and8u slow_and8u |
||||
#undef hal_or8u |
||||
#define hal_or8u slow_or8u |
||||
#undef hal_xor8u |
||||
#define hal_xor8u slow_xor8u |
||||
#undef hal_not8u |
||||
#define hal_not8u slow_not8u |
||||
#undef cv_hal_and8u |
||||
#define cv_hal_and8u slow_and8u |
||||
#undef cv_hal_or8u |
||||
#define cv_hal_or8u slow_or8u |
||||
#undef cv_hal_xor8u |
||||
#define cv_hal_xor8u slow_xor8u |
||||
#undef cv_hal_not8u |
||||
#define cv_hal_not8u slow_not8u |
||||
|
||||
#endif |
Loading…
Reference in new issue