init: 64 bits version of the webcam

This commit is contained in:
2026-07-13 16:31:52 +02:00
parent c0f3eeb00d
commit 07e526544d
381 changed files with 43996 additions and 9097 deletions
File diff suppressed because it is too large Load Diff
+8 -3
View File
@@ -41,8 +41,8 @@
//
//M*/
#ifndef __OPENCV_CALIB3D_C_H__
#define __OPENCV_CALIB3D_C_H__
#ifndef OPENCV_CALIB3D_C_H
#define OPENCV_CALIB3D_C_H
#include "opencv2/core/core_c.h"
@@ -243,7 +243,11 @@ CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size,
#define CV_CALIB_RATIONAL_MODEL 16384
#define CV_CALIB_THIN_PRISM_MODEL 32768
#define CV_CALIB_FIX_S1_S2_S3_S4 65536
#define CV_CALIB_TILTED_MODEL 262144
#define CV_CALIB_FIX_TAUX_TAUY 524288
#define CV_CALIB_FIX_TANGENT_DIST 2097152
#define CV_CALIB_NINTRINSIC 18
/* Finds intrinsic and extrinsic camera parameters
from a few views of known calibration pattern */
@@ -415,8 +419,9 @@ public:
int state;
int iters;
bool completeSymmFlag;
int solveMethod;
};
#endif
#endif /* __OPENCV_CALIB3D_C_H__ */
#endif /* OPENCV_CALIB3D_C_H */
+466 -292
View File
File diff suppressed because it is too large Load Diff
+195 -39
View File
@@ -41,8 +41,8 @@
//
//M*/
#ifndef __OPENCV_CORE_AFFINE3_HPP__
#define __OPENCV_CORE_AFFINE3_HPP__
#ifndef OPENCV_CORE_AFFINE3_HPP
#define OPENCV_CORE_AFFINE3_HPP
#ifdef __cplusplus
@@ -55,7 +55,72 @@ namespace cv
//! @{
/** @brief Affine transform
@todo document
*
* It represents a 4x4 homogeneous transformation matrix \f$T\f$
*
* \f[T =
* \begin{bmatrix}
* R & t\\
* 0 & 1\\
* \end{bmatrix}
* \f]
*
* where \f$R\f$ is a 3x3 rotation matrix and \f$t\f$ is a 3x1 translation vector.
*
* You can specify \f$R\f$ either by a 3x3 rotation matrix or by a 3x1 rotation vector,
* which is converted to a 3x3 rotation matrix by the Rodrigues formula.
*
* To construct a matrix \f$T\f$ representing first rotation around the axis \f$r\f$ with rotation
* angle \f$|r|\f$ in radian (right hand rule) and then translation by the vector \f$t\f$, you can use
*
* @code
* cv::Vec3f r, t;
* cv::Affine3f T(r, t);
* @endcode
*
* If you already have the rotation matrix \f$R\f$, then you can use
*
* @code
* cv::Matx33f R;
* cv::Affine3f T(R, t);
* @endcode
*
* To extract the rotation matrix \f$R\f$ from \f$T\f$, use
*
* @code
* cv::Matx33f R = T.rotation();
* @endcode
*
* To extract the translation vector \f$t\f$ from \f$T\f$, use
*
* @code
* cv::Vec3f t = T.translation();
* @endcode
*
* To extract the rotation vector \f$r\f$ from \f$T\f$, use
*
* @code
* cv::Vec3f r = T.rvec();
* @endcode
*
* Note that since the mapping from rotation vectors to rotation matrices
* is many to one. The returned rotation vector is not necessarily the one
* you used before to set the matrix.
*
* If you have two transformations \f$T = T_1 * T_2\f$, use
*
* @code
* cv::Affine3f T, T1, T2;
* T = T2.concatenate(T1);
* @endcode
*
* To get the inverse transform of \f$T\f$, use
*
* @code
* cv::Affine3f T, T_inv;
* T_inv = T.inv();
* @endcode
*
*/
template<typename T>
class Affine3
@@ -66,54 +131,136 @@ namespace cv
typedef Matx<float_type, 4, 4> Mat4;
typedef Vec<float_type, 3> Vec3;
//! Default constructor. It represents a 4x4 identity matrix.
Affine3();
//! Augmented affine matrix
Affine3(const Mat4& affine);
//! Rotation matrix
/**
* The resulting 4x4 matrix is
*
* \f[
* \begin{bmatrix}
* R & t\\
* 0 & 1\\
* \end{bmatrix}
* \f]
*
* @param R 3x3 rotation matrix.
* @param t 3x1 translation vector.
*/
Affine3(const Mat3& R, const Vec3& t = Vec3::all(0));
//! Rodrigues vector
/**
* Rodrigues vector.
*
* The last row of the current matrix is set to [0,0,0,1].
*
* @param rvec 3x1 rotation vector. Its direction indicates the rotation axis and its length
* indicates the rotation angle in radian (using right hand rule).
* @param t 3x1 translation vector.
*/
Affine3(const Vec3& rvec, const Vec3& t = Vec3::all(0));
//! Combines all contructors above. Supports 4x4, 4x3, 3x3, 1x3, 3x1 sizes of data matrix
/**
* Combines all constructors above. Supports 4x4, 3x4, 3x3, 1x3, 3x1 sizes of data matrix.
*
* The last row of the current matrix is set to [0,0,0,1] when data is not 4x4.
*
* @param data 1-channel matrix.
* when it is 4x4, it is copied to the current matrix and t is not used.
* When it is 3x4, it is copied to the upper part 3x4 of the current matrix and t is not used.
* When it is 3x3, it is copied to the upper left 3x3 part of the current matrix.
* When it is 3x1 or 1x3, it is treated as a rotation vector and the Rodrigues formula is used
* to compute a 3x3 rotation matrix.
* @param t 3x1 translation vector. It is used only when data is neither 4x4 nor 3x4.
*/
explicit Affine3(const Mat& data, const Vec3& t = Vec3::all(0));
//! From 16th element array
//! From 16-element array
explicit Affine3(const float_type* vals);
//! Create identity transform
//! Create an 4x4 identity transform
static Affine3 Identity();
//! Rotation matrix
/**
* Rotation matrix.
*
* Copy the rotation matrix to the upper left 3x3 part of the current matrix.
* The remaining elements of the current matrix are not changed.
*
* @param R 3x3 rotation matrix.
*
*/
void rotation(const Mat3& R);
//! Rodrigues vector
/**
* Rodrigues vector.
*
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
*
* @param rvec 3x1 rotation vector. The direction indicates the rotation axis and
* its length indicates the rotation angle in radian (using the right thumb convention).
*/
void rotation(const Vec3& rvec);
//! Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
/**
* Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix.
*
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
*
* @param data 1-channel matrix.
* When it is a 3x3 matrix, it sets the upper left 3x3 part of the current matrix.
* When it is a 1x3 or 3x1 matrix, it is used as a rotation vector. The Rodrigues formula
* is used to compute the rotation matrix and sets the upper left 3x3 part of the current matrix.
*/
void rotation(const Mat& data);
/**
* Copy the 3x3 matrix L to the upper left part of the current matrix
*
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
*
* @param L 3x3 matrix.
*/
void linear(const Mat3& L);
/**
* Copy t to the first three elements of the last column of the current matrix
*
* It sets the upper right 3x1 part of the matrix. The remaining part is unaffected.
*
* @param t 3x1 translation vector.
*/
void translation(const Vec3& t);
//! @return the upper left 3x3 part
Mat3 rotation() const;
//! @return the upper left 3x3 part
Mat3 linear() const;
//! @return the upper right 3x1 part
Vec3 translation() const;
//! Rodrigues vector
//! Rodrigues vector.
//! @return a vector representing the upper left 3x3 rotation matrix of the current matrix.
//! @warning Since the mapping between rotation vectors and rotation matrices is many to one,
//! this function returns only one rotation vector that represents the current rotation matrix,
//! which is not necessarily the same one set by `rotation(const Vec3& rvec)`.
Vec3 rvec() const;
//! @return the inverse of the current matrix.
Affine3 inv(int method = cv::DECOMP_SVD) const;
//! a.rotate(R) is equivalent to Affine(R, 0) * a;
Affine3 rotate(const Mat3& R) const;
//! a.rotate(R) is equivalent to Affine(rvec, 0) * a;
//! a.rotate(rvec) is equivalent to Affine(rvec, 0) * a;
Affine3 rotate(const Vec3& rvec) const;
//! a.translate(t) is equivalent to Affine(E, t) * a;
//! a.translate(t) is equivalent to Affine(E, t) * a, where E is an identity matrix
Affine3 translate(const Vec3& t) const;
//! a.concatenate(affine) is equivalent to affine * a;
@@ -136,6 +283,7 @@ namespace cv
template<typename T> static
Affine3<T> operator*(const Affine3<T>& affine1, const Affine3<T>& affine2);
//! V is a 3-element vector with member fields x, y and z
template<typename T, typename V> static
V operator*(const Affine3<T>& affine, const V& vector);
@@ -153,15 +301,24 @@ namespace cv
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 16,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Affine3<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Affine3<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 16) }; };
} // namespace
//! @} core
}
@@ -169,7 +326,7 @@ namespace cv
//! @cond IGNORED
///////////////////////////////////////////////////////////////////////////////////
// Implementaiton
// Implementation
template<typename T> inline
cv::Affine3<T>::Affine3()
@@ -202,7 +359,8 @@ cv::Affine3<T>::Affine3(const Vec3& _rvec, const Vec3& t)
template<typename T> inline
cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
{
CV_Assert(data.type() == cv::DataType<T>::type);
CV_Assert(data.type() == cv::traits::Type<T>::value);
CV_Assert(data.channels() == 1);
if (data.cols == 4 && data.rows == 4)
{
@@ -213,11 +371,13 @@ cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
{
rotation(data(Rect(0, 0, 3, 3)));
translation(data(Rect(3, 0, 1, 3)));
return;
}
else
{
rotation(data);
translation(t);
}
rotation(data);
translation(t);
matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
matrix.val[15] = 1;
}
@@ -241,40 +401,36 @@ void cv::Affine3<T>::rotation(const Mat3& R)
template<typename T> inline
void cv::Affine3<T>::rotation(const Vec3& _rvec)
{
double rx = _rvec[0], ry = _rvec[1], rz = _rvec[2];
double theta = std::sqrt(rx*rx + ry*ry + rz*rz);
double theta = norm(_rvec);
if (theta < DBL_EPSILON)
rotation(Mat3::eye());
else
{
const double I[] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
double c = std::cos(theta);
double s = std::sin(theta);
double c1 = 1. - c;
double itheta = (theta != 0) ? 1./theta : 0.;
rx *= itheta; ry *= itheta; rz *= itheta;
Point3_<T> r = _rvec*itheta;
double rrt[] = { rx*rx, rx*ry, rx*rz, rx*ry, ry*ry, ry*rz, rx*rz, ry*rz, rz*rz };
double _r_x_[] = { 0, -rz, ry, rz, 0, -rx, -ry, rx, 0 };
Mat3 R;
Mat3 rrt( r.x*r.x, r.x*r.y, r.x*r.z, r.x*r.y, r.y*r.y, r.y*r.z, r.x*r.z, r.y*r.z, r.z*r.z );
Mat3 r_x( 0, -r.z, r.y, r.z, 0, -r.x, -r.y, r.x, 0 );
// R = cos(theta)*I + (1 - cos(theta))*r*rT + sin(theta)*[r_x]
// where [r_x] is [0 -rz ry; rz 0 -rx; -ry rx 0]
for(int k = 0; k < 9; ++k)
R.val[k] = static_cast<float_type>(c*I[k] + c1*rrt[k] + s*_r_x_[k]);
Mat3 R = c*Mat3::eye() + c1*rrt + s*r_x;
rotation(R);
}
}
//Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
//Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix;
template<typename T> inline
void cv::Affine3<T>::rotation(const cv::Mat& data)
{
CV_Assert(data.type() == cv::DataType<T>::type);
CV_Assert(data.type() == cv::traits::Type<T>::value);
CV_Assert(data.channels() == 1);
if (data.cols == 3 && data.rows == 3)
{
@@ -289,7 +445,7 @@ void cv::Affine3<T>::rotation(const cv::Mat& data)
rotation(_rvec);
}
else
CV_Assert(!"Input marix can be 3x3, 1x3 or 3x1");
CV_Error(Error::StsError, "Input matrix can only be 3x3, 1x3 or 3x1");
}
template<typename T> inline
@@ -488,21 +644,21 @@ cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
template<typename T> inline
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
{
cv::Mat(4, 4, cv::DataType<T>::type, affine.matrix().data()).copyTo(matrix);
cv::Mat(4, 4, cv::traits::Type<T>::value, affine.matrix().data()).copyTo(matrix);
}
template<typename T> inline
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
{
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
cv::Mat(4, 4, cv::DataType<T>::type, a.matrix().data()).copyTo(matrix);
cv::Mat(4, 4, cv::traits::Type<T>::value, a.matrix().data()).copyTo(matrix);
}
template<typename T> inline
cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
{
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
cv::Mat hdr(4, 4, cv::DataType<T>::type, r.matrix().data());
cv::Mat hdr(4, 4, cv::traits::Type<T>::value, r.matrix().data());
cv::Mat(matrix, false).copyTo(hdr);
return r;
}
@@ -519,4 +675,4 @@ cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine>() const
#endif /* __cplusplus */
#endif /* __OPENCV_CORE_AFFINE3_HPP__ */
#endif /* OPENCV_CORE_AFFINE3_HPP */
+162 -200
View File
@@ -42,18 +42,20 @@
//
//M*/
#ifndef __OPENCV_CORE_BASE_HPP__
#define __OPENCV_CORE_BASE_HPP__
#ifndef OPENCV_CORE_BASE_HPP
#define OPENCV_CORE_BASE_HPP
#ifndef __cplusplus
# error base.hpp header must be compiled as C++
#endif
#include "opencv2/opencv_modules.hpp"
#include <climits>
#include <algorithm>
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp"
#include "opencv2/hal.hpp"
namespace cv
{
@@ -64,38 +66,38 @@ namespace cv
namespace Error {
//! error codes
enum Code {
StsOk= 0, //!< everithing is ok
StsOk= 0, //!< everything is ok
StsBackTrace= -1, //!< pseudo error for back trace
StsError= -2, //!< unknown /unspecified error
StsInternal= -3, //!< internal error (bad state)
StsNoMem= -4, //!< insufficient memory
StsBadArg= -5, //!< function arg/param is bad
StsBadFunc= -6, //!< unsupported function
StsNoConv= -7, //!< iter. didn't converge
StsNoConv= -7, //!< iteration didn't converge
StsAutoTrace= -8, //!< tracing
HeaderIsNull= -9, //!< image header is NULL
BadImageSize= -10, //!< image size is invalid
BadOffset= -11, //!< offset is invalid
BadDataPtr= -12, //!<
BadStep= -13, //!<
BadStep= -13, //!< image step is wrong, this may happen for a non-continuous matrix.
BadModelOrChSeq= -14, //!<
BadNumChannels= -15, //!<
BadNumChannels= -15, //!< bad number of channels, for example, some functions accept only single channel matrices.
BadNumChannel1U= -16, //!<
BadDepth= -17, //!<
BadDepth= -17, //!< input image depth is not supported by the function
BadAlphaChannel= -18, //!<
BadOrder= -19, //!<
BadOrigin= -20, //!<
BadAlign= -21, //!<
BadOrder= -19, //!< number of dimensions is out of range
BadOrigin= -20, //!< incorrect input origin
BadAlign= -21, //!< incorrect input align
BadCallBack= -22, //!<
BadTileSize= -23, //!<
BadCOI= -24, //!<
BadROISize= -25, //!<
BadCOI= -24, //!< input COI is not supported
BadROISize= -25, //!< incorrect input roi
MaskIsTiled= -26, //!<
StsNullPtr= -27, //!< null pointer
StsVecLengthErr= -28, //!< incorrect vector length
StsFilterStructContentErr= -29, //!< incorr. filter structure content
StsKernelStructContentErr= -30, //!< incorr. transform kernel content
StsFilterOffsetErr= -31, //!< incorrect filter ofset value
StsFilterStructContentErr= -29, //!< incorrect filter structure content
StsKernelStructContentErr= -30, //!< incorrect transform kernel content
StsFilterOffsetErr= -31, //!< incorrect filter offset value
StsBadSize= -201, //!< the input/output structure size is incorrect
StsDivByZero= -202, //!< division by zero
StsInplaceNotSupported= -203, //!< in-place operation is not supported
@@ -111,13 +113,13 @@ enum Code {
StsNotImplemented= -213, //!< the requested function/feature is not implemented
StsBadMemBlock= -214, //!< an allocated block has been corrupted
StsAssert= -215, //!< assertion failed
GpuNotSupported= -216,
GpuApiCallError= -217,
OpenGlNotSupported= -218,
OpenGlApiCallError= -219,
OpenCLApiCallError= -220,
GpuNotSupported= -216, //!< no CUDA support
GpuApiCallError= -217, //!< GPU API call error
OpenGlNotSupported= -218, //!< no OpenGL support
OpenGlApiCallError= -219, //!< OpenGL API call error
OpenCLApiCallError= -220, //!< OpenCL API call error
OpenCLDoubleNotSupported= -221,
OpenCLInitError= -222,
OpenCLInitError= -222, //!< OpenCL initialization error
OpenCLNoAMDBlasFft= -223
};
} //Error
@@ -150,28 +152,57 @@ enum DecompTypes {
};
/** norm types
- For one array:
\f[norm = \forkthree{\|\texttt{src1}\|_{L_{\infty}} = \max _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM\_INF}\) }
{ \| \texttt{src1} \| _{L_1} = \sum _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM\_L1}\) }
{ \| \texttt{src1} \| _{L_2} = \sqrt{\sum_I \texttt{src1}(I)^2} }{if \(\texttt{normType} = \texttt{NORM\_L2}\) }\f]
- Absolute norm for two arrays
\f[norm = \forkthree{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} = \max _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM\_INF}\) }
{ \| \texttt{src1} - \texttt{src2} \| _{L_1} = \sum _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM\_L1}\) }
{ \| \texttt{src1} - \texttt{src2} \| _{L_2} = \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if \(\texttt{normType} = \texttt{NORM\_L2}\) }\f]
src1 and src2 denote input arrays.
*/
- Relative norm for two arrays
\f[norm = \forkthree{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} }{\|\texttt{src2}\|_{L_{\infty}} }}{if \(\texttt{normType} = \texttt{NORM\_RELATIVE\_INF}\) }
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if \(\texttt{normType} = \texttt{NORM\_RELATIVE\_L1}\) }
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if \(\texttt{normType} = \texttt{NORM\_RELATIVE\_L2}\) }\f]
*/
enum NormTypes { NORM_INF = 1,
enum NormTypes {
/**
\f[
norm = \forkthree
{\|\texttt{src1}\|_{L_{\infty}} = \max _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) }
{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} = \max _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) }
{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} }{\|\texttt{src2}\|_{L_{\infty}} }}{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_INF}\) }
\f]
*/
NORM_INF = 1,
/**
\f[
norm = \forkthree
{\| \texttt{src1} \| _{L_1} = \sum _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\)}
{ \| \texttt{src1} - \texttt{src2} \| _{L_1} = \sum _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\) }
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L1}\) }
\f]*/
NORM_L1 = 2,
/**
\f[
norm = \forkthree
{ \| \texttt{src1} \| _{L_2} = \sqrt{\sum_I \texttt{src1}(I)^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) }
{ \| \texttt{src1} - \texttt{src2} \| _{L_2} = \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) }
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L2}\) }
\f]
*/
NORM_L2 = 4,
/**
\f[
norm = \forkthree
{ \| \texttt{src1} \| _{L_2} ^{2} = \sum_I \texttt{src1}(I)^2} {if \(\texttt{normType} = \texttt{NORM_L2SQR}\)}
{ \| \texttt{src1} - \texttt{src2} \| _{L_2} ^{2} = \sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2 }{if \(\texttt{normType} = \texttt{NORM_L2SQR}\) }
{ \left(\frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}}\right)^2 }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L2}\) }
\f]
*/
NORM_L2SQR = 5,
/**
In the case of one input array, calculates the Hamming distance of the array from zero,
In the case of two input arrays, calculates the Hamming distance between the arrays.
*/
NORM_HAMMING = 6,
/**
Similar to NORM_HAMMING, but in the calculation, each two bits of the input sequence will
be added and treated as a single bit to be used in the same calculation as NORM_HAMMING.
*/
NORM_HAMMING2 = 7,
NORM_TYPE_MASK = 7,
NORM_TYPE_MASK = 7, //!< bit-mask which can be used to separate norm type from norm flags
NORM_RELATIVE = 8, //!< flag
NORM_MINMAX = 32 //!< flag
};
@@ -219,6 +250,10 @@ enum DftFlags {
into a real array and inverse transformation is executed, the function treats the input as a
packed complex-conjugate symmetrical array, and the output will also be a real array). */
DFT_REAL_OUTPUT = 32,
/** specifies that input is complex input. If this flag is set, the input must have 2 channels.
On the other hand, for backwards compatibility reason, if input has 2 channels, input is
already considered complex. */
DFT_COMPLEX_INPUT = 64,
/** performs an inverse 1D or 2D transform instead of the default forward transform. */
DCT_INVERSE = DFT_INVERSE,
/** performs a forward or inverse transform of every individual row of the input
@@ -236,7 +271,7 @@ enum BorderTypes {
BORDER_REFLECT = 2, //!< `fedcba|abcdefgh|hgfedcb`
BORDER_WRAP = 3, //!< `cdefgh|abcdefgh|abcdefg`
BORDER_REFLECT_101 = 4, //!< `gfedcb|abcdefgh|gfedcba`
BORDER_TRANSPARENT = 5, //!< `uvwxyz|absdefgh|ijklmno`
BORDER_TRANSPARENT = 5, //!< `uvwxyz|abcdefgh|ijklmno`
BORDER_REFLECT101 = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101
BORDER_DEFAULT = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101
@@ -248,65 +283,6 @@ enum BorderTypes {
//! @addtogroup core_utils
//! @{
//! @cond IGNORED
//////////////// static assert /////////////////
#define CVAUX_CONCAT_EXP(a, b) a##b
#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b)
#if defined(__clang__)
# ifndef __has_extension
# define __has_extension __has_feature /* compatibility, for older versions of clang */
# endif
# if __has_extension(cxx_static_assert)
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
# endif
#elif defined(__GNUC__)
# if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
# endif
#elif defined(_MSC_VER)
# if _MSC_VER >= 1600 /* MSVC 10 */
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
# endif
#endif
#ifndef CV_StaticAssert
# if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC_MINOR__ > 2)
# define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
# else
template <bool x> struct CV_StaticAssert_failed;
template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
template<int x> struct CV_StaticAssert_test {};
# define CV_StaticAssert(condition, reason)\
typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
# endif
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
#define CV_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
#define CV_DO_PRAGMA(x) _Pragma (#x)
#else
#define CV_DO_PRAGMA(x)
#endif
#ifdef _MSC_VER
#define CV_SUPPRESS_DEPRECATED_START \
CV_DO_PRAGMA(warning(push)) \
CV_DO_PRAGMA(warning(disable: 4996))
#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(warning(pop))
#elif defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))))
#define CV_SUPPRESS_DEPRECATED_START \
CV_DO_PRAGMA(GCC diagnostic push) \
CV_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(GCC diagnostic pop)
#else
#define CV_SUPPRESS_DEPRECATED_START
#define CV_SUPPRESS_DEPRECATED_END
#endif
//! @endcond
/*! @brief Signals an error and raises the exception.
By default the function prints information about the error to stderr,
@@ -315,9 +291,9 @@ It is possible to alternate error processing by using redirectError().
@param _code - error code (Error::Code)
@param _err - error description
@param _func - function name. Available only when the compiler supports getting it
@param _file - source file name where the error has occured
@param _line - line number in the source file where the error has occured
@see CV_Error, CV_Error_, CV_ErrorNoReturn, CV_ErrorNoReturn_, CV_Assert, CV_DbgAssert
@param _file - source file name where the error has occurred
@param _line - line number in the source file where the error has occurred
@see CV_Error, CV_Error_, CV_Assert, CV_DbgAssert
*/
CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line);
@@ -346,13 +322,17 @@ CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const ch
# endif
#endif
#if defined __GNUC__
#define CV_Func __func__
#elif defined _MSC_VER
#define CV_Func __FUNCTION__
#else
#define CV_Func ""
#endif
#ifdef CV_STATIC_ANALYSIS
// In practice, some macro are not processed correctly (noreturn is not detected).
// We need to use simplified definition for them.
#define CV_Error(...) do { abort(); } while (0)
#define CV_Error_( code, args ) do { cv::format args; abort(); } while (0)
#define CV_Assert( expr ) do { if (!(expr)) abort(); } while (0)
#define CV_ErrorNoReturn CV_Error
#define CV_ErrorNoReturn_ CV_Error_
#else // CV_STATIC_ANALYSIS
/** @brief Call the error handler.
@@ -372,7 +352,7 @@ This macro can be used to construct an error message on-fly to include some dyna
for example:
@code
// note the extra parentheses around the formatted text message
CV_Error_( CV_StsOutOfRange,
CV_Error_(Error::StsOutOfRange,
("the value at (%d, %d)=%g is out of range", badPt.x, badPt.y, badValue));
@endcode
@param code one of Error::Code
@@ -386,18 +366,61 @@ The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression.
raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release
configurations while CV_DbgAssert is only retained in the Debug configuration.
*/
#define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
#define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
/** same as CV_Error(code,msg), but does not return */
#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
//! @cond IGNORED
#define CV__ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
#define CV__ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#ifdef __OPENCV_BUILD
#undef CV_Error
#define CV_Error CV__ErrorNoReturn
#undef CV_Error_
#define CV_Error_ CV__ErrorNoReturn_
#undef CV_Assert
#define CV_Assert( expr ) do { if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
#else
// backward compatibility
#define CV_ErrorNoReturn CV__ErrorNoReturn
#define CV_ErrorNoReturn_ CV__ErrorNoReturn_
#endif
//! @endcond
/** same as CV_Error_(code,args), but does not return */
#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#endif // CV_STATIC_ANALYSIS
/** replaced with CV_Assert(expr) in Debug configuration */
#ifdef _DEBUG
//! @cond IGNORED
#if defined OPENCV_FORCE_MULTIARG_ASSERT_CHECK && defined CV_STATIC_ANALYSIS
#warning "OPENCV_FORCE_MULTIARG_ASSERT_CHECK can't be used with CV_STATIC_ANALYSIS"
#undef OPENCV_FORCE_MULTIARG_ASSERT_CHECK
#endif
#ifdef OPENCV_FORCE_MULTIARG_ASSERT_CHECK
#define CV_Assert_1( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
#else
#define CV_Assert_1 CV_Assert
#endif
#define CV_Assert_2( expr1, expr2 ) CV_Assert_1(expr1); CV_Assert_1(expr2)
#define CV_Assert_3( expr1, expr2, expr3 ) CV_Assert_2(expr1, expr2); CV_Assert_1(expr3)
#define CV_Assert_4( expr1, expr2, expr3, expr4 ) CV_Assert_3(expr1, expr2, expr3); CV_Assert_1(expr4)
#define CV_Assert_5( expr1, expr2, expr3, expr4, expr5 ) CV_Assert_4(expr1, expr2, expr3, expr4); CV_Assert_1(expr5)
#define CV_Assert_6( expr1, expr2, expr3, expr4, expr5, expr6 ) CV_Assert_5(expr1, expr2, expr3, expr4, expr5); CV_Assert_1(expr6)
#define CV_Assert_7( expr1, expr2, expr3, expr4, expr5, expr6, expr7 ) CV_Assert_6(expr1, expr2, expr3, expr4, expr5, expr6 ); CV_Assert_1(expr7)
#define CV_Assert_8( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ) CV_Assert_7(expr1, expr2, expr3, expr4, expr5, expr6, expr7 ); CV_Assert_1(expr8)
#define CV_Assert_9( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ) CV_Assert_8(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ); CV_Assert_1(expr9)
#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10)
#define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0)
#ifdef OPENCV_FORCE_MULTIARG_ASSERT_CHECK
#undef CV_Assert
#define CV_Assert CV_Assert_N
#endif
//! @endcond
#if defined _DEBUG || defined CV_STATIC_ANALYSIS
# define CV_DbgAssert(expr) CV_Assert(expr)
#else
/** replaced with CV_Assert(expr) in Debug configuration */
# define CV_DbgAssert(expr)
#endif
@@ -644,12 +667,27 @@ namespace cudev
namespace ipp
{
CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, const char * const filename = NULL,
#if OPENCV_ABI_COMPATIBILITY > 300
CV_EXPORTS unsigned long long getIppFeatures();
#else
CV_EXPORTS int getIppFeatures();
#endif
CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, const char * const filename = NULL,
int line = 0);
CV_EXPORTS int getIppStatus();
CV_EXPORTS String getIppErrorLocation();
CV_EXPORTS bool useIPP();
CV_EXPORTS void setUseIPP(bool flag);
CV_EXPORTS int getIppStatus();
CV_EXPORTS String getIppErrorLocation();
CV_EXPORTS_W bool useIPP();
CV_EXPORTS_W void setUseIPP(bool flag);
CV_EXPORTS_W String getIppVersion();
// IPP Not-Exact mode. This function may force use of IPP then both IPP and OpenCV provide proper results
// but have internal accuracy differences which have too much direct or indirect impact on accuracy tests.
CV_EXPORTS_W bool useIPP_NotExact();
CV_EXPORTS_W void setUseIPP_NotExact(bool flag);
#if OPENCV_ABI_COMPATIBILITY < 400
CV_EXPORTS_W bool useIPP_NE();
CV_EXPORTS_W void setUseIPP_NE(bool flag);
#endif
} // ipp
@@ -657,89 +695,13 @@ CV_EXPORTS void setUseIPP(bool flag);
//! @} core_utils
//! @addtogroup core_utils_neon
//! @{
#if CV_NEON
inline int32x2_t cv_vrnd_s32_f32(float32x2_t v)
{
static int32x2_t v_sign = vdup_n_s32(1 << 31),
v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f));
int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v)));
return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition)));
}
inline int32x4_t cv_vrndq_s32_f32(float32x4_t v)
{
static int32x4_t v_sign = vdupq_n_s32(1 << 31),
v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f));
int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v)));
return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition)));
}
inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v)
{
static float32x2_t v_05 = vdup_n_f32(0.5f);
return vcvt_u32_f32(vadd_f32(v, v_05));
}
inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v)
{
static float32x4_t v_05 = vdupq_n_f32(0.5f);
return vcvtq_u32_f32(vaddq_f32(v, v_05));
}
inline float32x4_t cv_vrecpq_f32(float32x4_t val)
{
float32x4_t reciprocal = vrecpeq_f32(val);
reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
return reciprocal;
}
inline float32x2_t cv_vrecp_f32(float32x2_t val)
{
float32x2_t reciprocal = vrecpe_f32(val);
reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
return reciprocal;
}
inline float32x4_t cv_vrsqrtq_f32(float32x4_t val)
{
float32x4_t e = vrsqrteq_f32(val);
e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
return e;
}
inline float32x2_t cv_vrsqrt_f32(float32x2_t val)
{
float32x2_t e = vrsqrte_f32(val);
e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
return e;
}
inline float32x4_t cv_vsqrtq_f32(float32x4_t val)
{
return cv_vrecpq_f32(cv_vrsqrtq_f32(val));
}
inline float32x2_t cv_vsqrt_f32(float32x2_t val)
{
return cv_vrecp_f32(cv_vrsqrt_f32(val));
}
#endif
//! @} core_utils_neon
} // cv
#include "sse_utils.hpp"
#include "opencv2/core/neon_utils.hpp"
#include "opencv2/core/vsx_utils.hpp"
#include "opencv2/core/check.hpp"
#endif //__OPENCV_CORE_BASE_HPP__
#endif //OPENCV_CORE_BASE_HPP
+23
View File
@@ -0,0 +1,23 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_CORE_BINDINGS_UTILS_HPP
#define OPENCV_CORE_BINDINGS_UTILS_HPP
namespace cv { namespace utils {
//! @addtogroup core_utils
//! @{
CV_EXPORTS_W String dumpInputArray(InputArray argument);
CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument);
CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument);
CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argument);
//! @}
}} // namespace
#endif // OPENCV_CORE_BINDINGS_UTILS_HPP
+12 -3
View File
@@ -4,8 +4,13 @@
//
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
#ifndef __OPENCV_CORE_BUFFER_POOL_HPP__
#define __OPENCV_CORE_BUFFER_POOL_HPP__
#ifndef OPENCV_CORE_BUFFER_POOL_HPP
#define OPENCV_CORE_BUFFER_POOL_HPP
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4265)
#endif
namespace cv
{
@@ -28,4 +33,8 @@ public:
}
#endif // __OPENCV_CORE_BUFFER_POOL_HPP__
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // OPENCV_CORE_BUFFER_POOL_HPP
+157
View File
@@ -0,0 +1,157 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_CORE_CHECK_HPP
#define OPENCV_CORE_CHECK_HPP
#include <opencv2/core/base.hpp>
namespace cv {
/** Returns string of cv::Mat depth value: CV_8U -> "CV_8U" or "<invalid depth>" */
CV_EXPORTS const char* depthToString(int depth);
/** Returns string of cv::Mat depth value: CV_8UC3 -> "CV_8UC3" or "<invalid type>" */
CV_EXPORTS const String typeToString(int type);
//! @cond IGNORED
namespace detail {
/** Returns string of cv::Mat depth value: CV_8U -> "CV_8U" or NULL */
CV_EXPORTS const char* depthToString_(int depth);
/** Returns string of cv::Mat depth value: CV_8UC3 -> "CV_8UC3" or cv::String() */
CV_EXPORTS const cv::String typeToString_(int type);
enum TestOp {
TEST_CUSTOM = 0,
TEST_EQ = 1,
TEST_NE = 2,
TEST_LE = 3,
TEST_LT = 4,
TEST_GE = 5,
TEST_GT = 6,
CV__LAST_TEST_OP
};
struct CheckContext {
const char* func;
const char* file;
int line;
enum TestOp testOp;
const char* message;
const char* p1_str;
const char* p2_str;
};
#ifndef CV__CHECK_FILENAME
# define CV__CHECK_FILENAME __FILE__
#endif
#ifndef CV__CHECK_FUNCTION
# if defined _MSC_VER
# define CV__CHECK_FUNCTION __FUNCSIG__
# elif defined __GNUC__
# define CV__CHECK_FUNCTION __PRETTY_FUNCTION__
# else
# define CV__CHECK_FUNCTION "<unknown>"
# endif
#endif
#define CV__CHECK_LOCATION_VARNAME(id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_check_, id), __LINE__)
#define CV__DEFINE_CHECK_CONTEXT(id, message, testOp, p1_str, p2_str) \
static const cv::detail::CheckContext CV__CHECK_LOCATION_VARNAME(id) = \
{ CV__CHECK_FUNCTION, CV__CHECK_FILENAME, __LINE__, testOp, message, p1_str, p2_str }
CV_EXPORTS void CV_NORETURN check_failed_auto(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v1, const size_t v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const float v1, const float v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const double v1, const double v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatType(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatChannels(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const int v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const float v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const double v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const int v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatType(const int v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatChannels(const int v, const CheckContext& ctx);
#define CV__TEST_EQ(v1, v2) ((v1) == (v2))
#define CV__TEST_NE(v1, v2) ((v1) != (v2))
#define CV__TEST_LE(v1, v2) ((v1) <= (v2))
#define CV__TEST_LT(v1, v2) ((v1) < (v2))
#define CV__TEST_GE(v1, v2) ((v1) >= (v2))
#define CV__TEST_GT(v1, v2) ((v1) > (v2))
#define CV__CHECK(id, op, type, v1, v2, v1_str, v2_str, msg_str) do { \
if(CV__TEST_##op((v1), (v2))) ; else { \
CV__DEFINE_CHECK_CONTEXT(id, msg_str, cv::detail::TEST_ ## op, v1_str, v2_str); \
cv::detail::check_failed_ ## type((v1), (v2), CV__CHECK_LOCATION_VARNAME(id)); \
} \
} while (0)
#define CV__CHECK_CUSTOM_TEST(id, type, v, test_expr, v_str, test_expr_str, msg_str) do { \
if(!!(test_expr)) ; else { \
CV__DEFINE_CHECK_CONTEXT(id, msg_str, cv::detail::TEST_CUSTOM, v_str, test_expr_str); \
cv::detail::check_failed_ ## type((v), CV__CHECK_LOCATION_VARNAME(id)); \
} \
} while (0)
} // namespace
//! @endcond
/// Supported values of these types: int, float, double
#define CV_CheckEQ(v1, v2, msg) CV__CHECK(_, EQ, auto, v1, v2, #v1, #v2, msg)
#define CV_CheckNE(v1, v2, msg) CV__CHECK(_, NE, auto, v1, v2, #v1, #v2, msg)
#define CV_CheckLE(v1, v2, msg) CV__CHECK(_, LE, auto, v1, v2, #v1, #v2, msg)
#define CV_CheckLT(v1, v2, msg) CV__CHECK(_, LT, auto, v1, v2, #v1, #v2, msg)
#define CV_CheckGE(v1, v2, msg) CV__CHECK(_, GE, auto, v1, v2, #v1, #v2, msg)
#define CV_CheckGT(v1, v2, msg) CV__CHECK(_, GT, auto, v1, v2, #v1, #v2, msg)
/// Check with additional "decoding" of type values in error message
#define CV_CheckTypeEQ(t1, t2, msg) CV__CHECK(_, EQ, MatType, t1, t2, #t1, #t2, msg)
/// Check with additional "decoding" of depth values in error message
#define CV_CheckDepthEQ(d1, d2, msg) CV__CHECK(_, EQ, MatDepth, d1, d2, #d1, #d2, msg)
#define CV_CheckChannelsEQ(c1, c2, msg) CV__CHECK(_, EQ, MatChannels, c1, c2, #c1, #c2, msg)
/// Example: type == CV_8UC1 || type == CV_8UC3
#define CV_CheckType(t, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, MatType, t, (test_expr), #t, #test_expr, msg)
/// Example: depth == CV_32F || depth == CV_64F
#define CV_CheckDepth(t, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, MatDepth, t, (test_expr), #t, #test_expr, msg)
/// Example: v == A || v == B
#define CV_Check(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg)
/// Some complex conditions: CV_Check(src2, src2.empty() || (src2.type() == src1.type() && src2.size() == src1.size()), "src2 should have same size/type as src1")
// TODO define pretty-printers
#ifndef NDEBUG
#define CV_DbgCheck(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg)
#define CV_DbgCheckEQ(v1, v2, msg) CV__CHECK(_, EQ, auto, v1, v2, #v1, #v2, msg)
#define CV_DbgCheckNE(v1, v2, msg) CV__CHECK(_, NE, auto, v1, v2, #v1, #v2, msg)
#define CV_DbgCheckLE(v1, v2, msg) CV__CHECK(_, LE, auto, v1, v2, #v1, #v2, msg)
#define CV_DbgCheckLT(v1, v2, msg) CV__CHECK(_, LT, auto, v1, v2, #v1, #v2, msg)
#define CV_DbgCheckGE(v1, v2, msg) CV__CHECK(_, GE, auto, v1, v2, #v1, #v2, msg)
#define CV_DbgCheckGT(v1, v2, msg) CV__CHECK(_, GT, auto, v1, v2, #v1, #v2, msg)
#else
#define CV_DbgCheck(v, test_expr, msg) do { } while (0)
#define CV_DbgCheckEQ(v1, v2, msg) do { } while (0)
#define CV_DbgCheckNE(v1, v2, msg) do { } while (0)
#define CV_DbgCheckLE(v1, v2, msg) do { } while (0)
#define CV_DbgCheckLT(v1, v2, msg) do { } while (0)
#define CV_DbgCheckGE(v1, v2, msg) do { } while (0)
#define CV_DbgCheckGT(v1, v2, msg) do { } while (0)
#endif
} // namespace
#endif // OPENCV_CORE_CHECK_HPP
+38 -15
View File
@@ -42,8 +42,8 @@
//M*/
#ifndef __OPENCV_CORE_C_H__
#define __OPENCV_CORE_C_H__
#ifndef OPENCV_CORE_C_H
#define OPENCV_CORE_C_H
#include "opencv2/core/types_c.h"
@@ -359,7 +359,7 @@ CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );
/** @brief Returns array row or row span.
The functions return the header, corresponding to a specified row/row span of the input array.
The function returns the header, corresponding to a specified row/row span of the input array.
cvGetRow(arr, submat, row) is a shortcut for cvGetRows(arr, submat, row, row+1).
@param arr Input array
@param submat Pointer to the resulting sub-array header
@@ -385,7 +385,7 @@ CV_INLINE CvMat* cvGetRow( const CvArr* arr, CvMat* submat, int row )
/** @brief Returns one of more array columns.
The functions return the header, corresponding to a specified column span of the input array. That
The function returns the header, corresponding to a specified column span of the input array. That
is, no data is copied. Therefore, any modifications of the submatrix will affect the original array.
If you need to copy the columns, use cvCloneMat. cvGetCol(arr, submat, col) is a shortcut for
@@ -1788,7 +1788,7 @@ CVAPI(int) cvGraphRemoveVtx( CvGraph* graph, int index );
CVAPI(int) cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx );
/** Link two vertices specifed by indices or pointers if they
/** Link two vertices specified by indices or pointers if they
are not connected or return pointer to already existing edge
connecting the vertices.
Functions return 1 if a new edge was created, 0 otherwise */
@@ -1976,8 +1976,12 @@ CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header,
The function opens file storage for reading or writing data. In the latter case, a new file is
created or an existing file is rewritten. The type of the read or written file is determined by the
filename extension: .xml for XML and .yml or .yaml for YAML. The function returns a pointer to the
CvFileStorage structure. If the file cannot be opened then the function returns NULL.
filename extension: .xml for XML, .yml or .yaml for YAML and .json for JSON.
At the same time, it also supports adding parameters like "example.xml?base64".
The function returns a pointer to the CvFileStorage structure.
If the file cannot be opened then the function returns NULL.
@param filename Name of the file associated with the storage
@param memstorage Memory storage used for temporary data and for
: storing dynamic structures, such as CvSeq or CvGraph . If it is NULL, a temporary memory
@@ -1985,6 +1989,7 @@ CvFileStorage structure. If the file cannot be opened then the function returns
@param flags Can be one of the following:
> - **CV_STORAGE_READ** the storage is open for reading
> - **CV_STORAGE_WRITE** the storage is open for writing
(use **CV_STORAGE_WRITE | CV_STORAGE_WRITE_BASE64** to write rawdata in Base64)
@param encoding
*/
CVAPI(CvFileStorage*) cvOpenFileStorage( const char* filename, CvMemStorage* memstorage,
@@ -2022,7 +2027,8 @@ One and only one of the two above flags must be specified
@param type_name Optional parameter - the object type name. In
case of XML it is written as a type_id attribute of the structure opening tag. In the case of
YAML it is written after a colon following the structure name (see the example in
CvFileStorage description). Mainly it is used with user objects. When the storage is read, the
CvFileStorage description). In case of JSON it is written as a name/value pair.
Mainly it is used with user objects. When the storage is read, the
encoded type name is used to determine the object type (see CvTypeInfo and cvFindType ).
@param attributes This parameter is not used in the current implementation
*/
@@ -2162,7 +2168,7 @@ the file with multiple streams looks like this:
@endcode
The YAML file will look like this:
@code{.yaml}
%YAML:1.0
%YAML 1.0
# stream #1 data
...
---
@@ -2187,6 +2193,23 @@ to a sequence rather than a map.
CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src,
int len, const char* dt );
/** @brief Writes multiple numbers in Base64.
If either CV_STORAGE_WRITE_BASE64 or cv::FileStorage::WRITE_BASE64 is used,
this function will be the same as cvWriteRawData. If neither, the main
difference is that it outputs a sequence in Base64 encoding rather than
in plain text.
This function can only be used to write a sequence with a type "binary".
@param fs File storage
@param src Pointer to the written array
@param len Number of the array elements to write
@param dt Specification of each array element, see @ref format_spec "format specification"
*/
CVAPI(void) cvWriteRawDataBase64( CvFileStorage* fs, const void* src,
int len, const char* dt );
/** @brief Returns a unique pointer for a given name.
The function returns a unique pointer for each particular file node name. This pointer can be then
@@ -2468,7 +2491,7 @@ CVAPI(void) cvReadRawData( const CvFileStorage* fs, const CvFileNode* src,
/** @brief Writes a file node to another file storage.
The function writes a copy of a file node to file storage. Possible applications of the function are
merging several file storages into one and conversion between XML and YAML formats.
merging several file storages into one and conversion between XML, YAML and JSON formats.
@param fs Destination file storage
@param new_node_name New name of the file node in the destination file storage. To keep the
existing name, use cvcvGetFileNodeName
@@ -2616,13 +2639,13 @@ CVAPI(void) cvSetErrStatus( int status );
#define CV_ErrModeParent 1 /* Print error and continue */
#define CV_ErrModeSilent 2 /* Don't print and continue */
/** Retrives current error processing mode */
/** Retrieves current error processing mode */
CVAPI(int) cvGetErrMode( void );
/** Sets error processing mode, returns previously used mode */
CVAPI(int) cvSetErrMode( int mode );
/** Sets error status and performs some additonal actions (displaying message box,
/** Sets error status and performs some additional actions (displaying message box,
writing message to stderr, terminating application etc.)
depending on the current error mode */
CVAPI(void) cvError( int status, const char* func_name,
@@ -2631,7 +2654,7 @@ CVAPI(void) cvError( int status, const char* func_name,
/** Retrieves textual description of the error given its code */
CVAPI(const char*) cvErrorStr( int status );
/** Retrieves detailed information about the last error occured */
/** Retrieves detailed information about the last error occurred */
CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description,
const char** filename, int* line );
@@ -2706,7 +2729,7 @@ static char cvFuncName[] = Name
/**
CV_CALL macro calls CV (or IPL) function, checks error status and
signals a error if the function failed. Useful in "parent node"
error procesing mode
error processing mode
*/
#define CV_CALL( Func ) \
{ \
@@ -3041,7 +3064,7 @@ template<typename _Tp> inline void Seq<_Tp>::copyTo(std::vector<_Tp>& vec, const
size_t len = !seq ? 0 : range == Range::all() ? seq->total : range.end - range.start;
vec.resize(len);
if( seq && len )
cvCvtSeqToArray(seq, &vec[0], range);
cvCvtSeqToArray(seq, &vec[0], cvSlice(range));
}
template<typename _Tp> inline Seq<_Tp>::operator std::vector<_Tp>() const
+214 -10
View File
@@ -41,8 +41,8 @@
//
//M*/
#ifndef __OPENCV_CORE_CUDA_HPP__
#define __OPENCV_CORE_CUDA_HPP__
#ifndef OPENCV_CORE_CUDA_HPP
#define OPENCV_CORE_CUDA_HPP
#ifndef __cplusplus
# error cuda.hpp header must be compiled as C++
@@ -56,7 +56,7 @@
@{
@defgroup cudacore Core part
@{
@defgroup cudacore_init Initalization and Information
@defgroup cudacore_init Initialization and Information
@defgroup cudacore_struct Data Structures
@}
@}
@@ -91,6 +91,15 @@ aligned to a size depending on the hardware. Single-row GpuMat is always a conti
on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory
release function returns error if the CUDA context has been destroyed before.
Some member functions are described as a "Blocking Call" while some are described as a
"Non-Blocking Call". Blocking functions are synchronous to host. It is guaranteed that the GPU
operation is finished when the function returns. However, non-blocking functions are asynchronous to
host. Those functions may return even if the GPU operation is not finished.
Compared to their blocking counterpart, non-blocking functions accept Stream as an additional
argument. If a non-default stream is passed, the GPU operation may overlap with operations in other
streams.
@sa Mat
*/
class CV_EXPORTS GpuMat
@@ -151,16 +160,38 @@ public:
//! swaps with other smart pointer
void swap(GpuMat& mat);
//! pefroms upload data to GpuMat (Blocking call)
/** @brief Performs data upload to GpuMat (Blocking call)
This function copies data from host memory to device memory. As being a blocking call, it is
guaranteed that the copy operation is finished when this function returns.
*/
void upload(InputArray arr);
//! pefroms upload data to GpuMat (Non-Blocking call)
/** @brief Performs data upload to GpuMat (Non-Blocking call)
This function copies data from host memory to device memory. As being a non-blocking call, this
function may return even if the copy operation is not finished.
The copy operation may be overlapped with operations in other non-default streams if \p stream is
not the default stream and \p dst is HostMem allocated with HostMem::PAGE_LOCKED option.
*/
void upload(InputArray arr, Stream& stream);
//! pefroms download data from device to host memory (Blocking call)
/** @brief Performs data download from GpuMat (Blocking call)
This function copies data from device memory to host memory. As being a blocking call, it is
guaranteed that the copy operation is finished when this function returns.
*/
void download(OutputArray dst) const;
//! pefroms download data from device to host memory (Non-Blocking call)
/** @brief Performs data download from GpuMat (Non-Blocking call)
This function copies data from device memory to host memory. As being a non-blocking call, this
function may return even if the copy operation is not finished.
The copy operation may be overlapped with operations in other non-default streams if \p stream is
not the default stream and \p dst is HostMem allocated with HostMem::PAGE_LOCKED option.
*/
void download(OutputArray dst, Stream& stream) const;
//! returns deep copy of the GpuMat, i.e. the data is copied
@@ -274,6 +305,9 @@ public:
//! returns true if GpuMat data is NULL
bool empty() const;
//! internal use method: updates the continuity flag
void updateContinuityFlag();
/*! includes several bit-fields:
- the magic signature
- continuity flag
@@ -327,6 +361,143 @@ The function does not reallocate memory if the matrix has proper attributes alre
*/
CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr);
/** @brief BufferPool for use with CUDA streams
BufferPool utilizes Stream's allocator to create new buffers for GpuMat's. It is
only useful when enabled with #setBufferPoolUsage.
@code
setBufferPoolUsage(true);
@endcode
@note #setBufferPoolUsage must be called \em before any Stream declaration.
Users may specify custom allocator for Stream and may implement their own stream based
functions utilizing the same underlying GPU memory management.
If custom allocator is not specified, BufferPool utilizes StackAllocator by
default. StackAllocator allocates a chunk of GPU device memory beforehand,
and when GpuMat is declared later on, it is given the pre-allocated memory.
This kind of strategy reduces the number of calls for memory allocating APIs
such as cudaMalloc or cudaMallocPitch.
Below is an example that utilizes BufferPool with StackAllocator:
@code
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace cv::cuda
int main()
{
setBufferPoolUsage(true); // Tell OpenCV that we are going to utilize BufferPool
setBufferPoolConfig(getDevice(), 1024 * 1024 * 64, 2); // Allocate 64 MB, 2 stacks (default is 10 MB, 5 stacks)
Stream stream1, stream2; // Each stream uses 1 stack
BufferPool pool1(stream1), pool2(stream2);
GpuMat d_src1 = pool1.getBuffer(4096, 4096, CV_8UC1); // 16MB
GpuMat d_dst1 = pool1.getBuffer(4096, 4096, CV_8UC3); // 48MB, pool1 is now full
GpuMat d_src2 = pool2.getBuffer(1024, 1024, CV_8UC1); // 1MB
GpuMat d_dst2 = pool2.getBuffer(1024, 1024, CV_8UC3); // 3MB
cvtColor(d_src1, d_dst1, CV_GRAY2BGR, 0, stream1);
cvtColor(d_src2, d_dst2, CV_GRAY2BGR, 0, stream2);
}
@endcode
If we allocate another GpuMat on pool1 in the above example, it will be carried out by
the DefaultAllocator since the stack for pool1 is full.
@code
GpuMat d_add1 = pool1.getBuffer(1024, 1024, CV_8UC1); // Stack for pool1 is full, memory is allocated with DefaultAllocator
@endcode
If a third stream is declared in the above example, allocating with #getBuffer
within that stream will also be carried out by the DefaultAllocator because we've run out of
stacks.
@code
Stream stream3; // Only 2 stacks were allocated, we've run out of stacks
BufferPool pool3(stream3);
GpuMat d_src3 = pool3.getBuffer(1024, 1024, CV_8UC1); // Memory is allocated with DefaultAllocator
@endcode
@warning When utilizing StackAllocator, deallocation order is important.
Just like a stack, deallocation must be done in LIFO order. Below is an example of
erroneous usage that violates LIFO rule. If OpenCV is compiled in Debug mode, this
sample code will emit CV_Assert error.
@code
int main()
{
setBufferPoolUsage(true); // Tell OpenCV that we are going to utilize BufferPool
Stream stream; // A default size (10 MB) stack is allocated to this stream
BufferPool pool(stream);
GpuMat mat1 = pool.getBuffer(1024, 1024, CV_8UC1); // Allocate mat1 (1MB)
GpuMat mat2 = pool.getBuffer(1024, 1024, CV_8UC1); // Allocate mat2 (1MB)
mat1.release(); // erroneous usage : mat2 must be deallocated before mat1
}
@endcode
Since C++ local variables are destroyed in the reverse order of construction,
the code sample below satisfies the LIFO rule. Local GpuMat's are deallocated
and the corresponding memory is automatically returned to the pool for later usage.
@code
int main()
{
setBufferPoolUsage(true); // Tell OpenCV that we are going to utilize BufferPool
setBufferPoolConfig(getDevice(), 1024 * 1024 * 64, 2); // Allocate 64 MB, 2 stacks (default is 10 MB, 5 stacks)
Stream stream1, stream2; // Each stream uses 1 stack
BufferPool pool1(stream1), pool2(stream2);
for (int i = 0; i < 10; i++)
{
GpuMat d_src1 = pool1.getBuffer(4096, 4096, CV_8UC1); // 16MB
GpuMat d_dst1 = pool1.getBuffer(4096, 4096, CV_8UC3); // 48MB, pool1 is now full
GpuMat d_src2 = pool2.getBuffer(1024, 1024, CV_8UC1); // 1MB
GpuMat d_dst2 = pool2.getBuffer(1024, 1024, CV_8UC3); // 3MB
d_src1.setTo(Scalar(i), stream1);
d_src2.setTo(Scalar(i), stream2);
cvtColor(d_src1, d_dst1, CV_GRAY2BGR, 0, stream1);
cvtColor(d_src2, d_dst2, CV_GRAY2BGR, 0, stream2);
// The order of destruction of the local variables is:
// d_dst2 => d_src2 => d_dst1 => d_src1
// LIFO rule is satisfied, this code runs without error
}
}
@endcode
*/
class CV_EXPORTS BufferPool
{
public:
//! Gets the BufferPool for the given stream.
explicit BufferPool(Stream& stream);
//! Allocates a new GpuMat of given size and type.
GpuMat getBuffer(int rows, int cols, int type);
//! Allocates a new GpuMat of given size and type.
GpuMat getBuffer(Size size, int type) { return getBuffer(size.height, size.width, type); }
//! Returns the allocator associated with the stream.
Ptr<GpuMat::Allocator> getAllocator() const { return allocator_; }
private:
Ptr<GpuMat::Allocator> allocator_;
};
//! BufferPool management (must be called before Stream creation)
CV_EXPORTS void setBufferPoolUsage(bool on);
CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount);
@@ -447,7 +618,26 @@ CV_EXPORTS void unregisterPageLocked(Mat& m);
functions use the constant GPU memory, and next call may update the memory before the previous one
has been finished. But calling different operations asynchronously is safe because each operation
has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are
also safe. :
also safe.
@note The Stream class is not thread-safe. Please use different Stream objects for different CPU threads.
@code
void thread1()
{
cv::cuda::Stream stream1;
cv::cuda::func1(..., stream1);
}
void thread2()
{
cv::cuda::Stream stream2;
cv::cuda::func2(..., stream2);
}
@endcode
@note By default all CUDA routines are launched in Stream::Null() object, if the stream is not specified by user.
In multi-threading environment the stream objects must be passed explicitly (see previous note).
*/
class CV_EXPORTS Stream
{
@@ -460,6 +650,9 @@ public:
//! creates a new asynchronous stream
Stream();
//! creates a new asynchronous stream with custom allocator
Stream(const Ptr<GpuMat::Allocator>& allocator);
/** @brief Returns true if the current stream queue is finished. Otherwise, it returns false.
*/
bool queryIfComplete() const;
@@ -528,6 +721,7 @@ public:
private:
Ptr<Impl> impl_;
Event(const Ptr<Impl>& impl);
friend struct EventAccessor;
};
@@ -544,7 +738,8 @@ private:
/** @brief Returns the number of installed CUDA-enabled devices.
Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support,
this function returns 0.
this function returns 0. If the CUDA driver is not installed, or is incompatible, this function
returns -1.
*/
CV_EXPORTS int getCudaEnabledDeviceCount();
@@ -835,6 +1030,15 @@ private:
CV_EXPORTS void printCudaDeviceInfo(int device);
CV_EXPORTS void printShortCudaDeviceInfo(int device);
/** @brief Converts an array to half precision floating number.
@param _src input array.
@param _dst output array.
@param stream Stream for the asynchronous version.
@sa convertFp16
*/
CV_EXPORTS void convertFp16(InputArray _src, OutputArray _dst, Stream& stream = Stream::Null());
//! @} cudacore_init
}} // namespace cv { namespace cuda {
@@ -842,4 +1046,4 @@ CV_EXPORTS void printShortCudaDeviceInfo(int device);
#include "opencv2/core/cuda.inl.hpp"
#endif /* __OPENCV_CORE_CUDA_HPP__ */
#endif /* OPENCV_CORE_CUDA_HPP */
+15 -5
View File
@@ -41,8 +41,8 @@
//
//M*/
#ifndef __OPENCV_CORE_CUDAINL_HPP__
#define __OPENCV_CORE_CUDAINL_HPP__
#ifndef OPENCV_CORE_CUDAINL_HPP
#define OPENCV_CORE_CUDAINL_HPP
#include "opencv2/core/cuda.hpp"
@@ -540,6 +540,16 @@ Stream::Stream(const Ptr<Impl>& impl)
{
}
//===================================================================================
// Event
//===================================================================================
inline
Event::Event(const Ptr<Impl>& impl)
: impl_(impl)
{
}
//===================================================================================
// Initialization & Info
//===================================================================================
@@ -578,7 +588,7 @@ int DeviceInfo::deviceID() const
inline
size_t DeviceInfo::freeMemory() const
{
size_t _totalMemory, _freeMemory;
size_t _totalMemory = 0, _freeMemory = 0;
queryMemory(_totalMemory, _freeMemory);
return _freeMemory;
}
@@ -586,7 +596,7 @@ size_t DeviceInfo::freeMemory() const
inline
size_t DeviceInfo::totalMemory() const
{
size_t _totalMemory, _freeMemory;
size_t _totalMemory = 0, _freeMemory = 0;
queryMemory(_totalMemory, _freeMemory);
return _totalMemory;
}
@@ -618,4 +628,4 @@ Mat::Mat(const cuda::GpuMat& m)
//! @endcond
#endif // __OPENCV_CORE_CUDAINL_HPP__
#endif // OPENCV_CORE_CUDAINL_HPP
+5 -5
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_DEVICE_BLOCK_HPP__
#define __OPENCV_CUDA_DEVICE_BLOCK_HPP__
#ifndef OPENCV_CUDA_DEVICE_BLOCK_HPP
#define OPENCV_CUDA_DEVICE_BLOCK_HPP
/** @file
* @deprecated Use @ref cudev instead.
@@ -106,7 +106,7 @@ namespace cv { namespace cuda { namespace device
}
template<typename InIt, typename OutIt, class UnOp>
static __device__ __forceinline__ void transfrom(InIt beg, InIt end, OutIt out, UnOp op)
static __device__ __forceinline__ void transform(InIt beg, InIt end, OutIt out, UnOp op)
{
int STRIDE = stride();
InIt t = beg + flattenedThreadId();
@@ -117,7 +117,7 @@ namespace cv { namespace cuda { namespace device
}
template<typename InIt1, typename InIt2, typename OutIt, class BinOp>
static __device__ __forceinline__ void transfrom(InIt1 beg1, InIt1 end1, InIt2 beg2, OutIt out, BinOp op)
static __device__ __forceinline__ void transform(InIt1 beg1, InIt1 end1, InIt2 beg2, OutIt out, BinOp op)
{
int STRIDE = stride();
InIt1 t1 = beg1 + flattenedThreadId();
@@ -208,4 +208,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif /* __OPENCV_CUDA_DEVICE_BLOCK_HPP__ */
#endif /* OPENCV_CUDA_DEVICE_BLOCK_HPP */
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_BORDER_INTERPOLATE_HPP__
#define __OPENCV_CUDA_BORDER_INTERPOLATE_HPP__
#ifndef OPENCV_CUDA_BORDER_INTERPOLATE_HPP
#define OPENCV_CUDA_BORDER_INTERPOLATE_HPP
#include "saturate_cast.hpp"
#include "vec_traits.hpp"
@@ -632,12 +632,12 @@ namespace cv { namespace cuda { namespace device
__device__ __forceinline__ int idx_row_low(int y) const
{
return (y >= 0) * y + (y < 0) * (y - ((y - height + 1) / height) * height);
return (y >= 0) ? y : (y - ((y - height + 1) / height) * height);
}
__device__ __forceinline__ int idx_row_high(int y) const
{
return (y < height) * y + (y >= height) * (y % height);
return (y < height) ? y : (y % height);
}
__device__ __forceinline__ int idx_row(int y) const
@@ -647,12 +647,12 @@ namespace cv { namespace cuda { namespace device
__device__ __forceinline__ int idx_col_low(int x) const
{
return (x >= 0) * x + (x < 0) * (x - ((x - width + 1) / width) * width);
return (x >= 0) ? x : (x - ((x - width + 1) / width) * width);
}
__device__ __forceinline__ int idx_col_high(int x) const
{
return (x < width) * x + (x >= width) * (x % width);
return (x < width) ? x : (x % width);
}
__device__ __forceinline__ int idx_col(int x) const
@@ -719,4 +719,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_BORDER_INTERPOLATE_HPP__
#endif // OPENCV_CUDA_BORDER_INTERPOLATE_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_COLOR_HPP__
#define __OPENCV_CUDA_COLOR_HPP__
#ifndef OPENCV_CUDA_COLOR_HPP
#define OPENCV_CUDA_COLOR_HPP
#include "detail/color_detail.hpp"
@@ -306,4 +306,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_BORDER_INTERPOLATE_HPP__
#endif // OPENCV_CUDA_COLOR_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_COMMON_HPP__
#define __OPENCV_CUDA_COMMON_HPP__
#ifndef OPENCV_CUDA_COMMON_HPP
#define OPENCV_CUDA_COMMON_HPP
#include <cuda_runtime.h>
#include "opencv2/core/cuda_types.hpp"
@@ -106,4 +106,4 @@ namespace cv { namespace cuda
//! @endcond
#endif // __OPENCV_CUDA_COMMON_HPP__
#endif // OPENCV_CUDA_COMMON_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_DATAMOV_UTILS_HPP__
#define __OPENCV_CUDA_DATAMOV_UTILS_HPP__
#ifndef OPENCV_CUDA_DATAMOV_UTILS_HPP
#define OPENCV_CUDA_DATAMOV_UTILS_HPP
#include "common.hpp"
@@ -110,4 +110,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_DATAMOV_UTILS_HPP__
#endif // OPENCV_CUDA_DATAMOV_UTILS_HPP
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_COLOR_DETAIL_HPP__
#define __OPENCV_CUDA_COLOR_DETAIL_HPP__
#ifndef OPENCV_CUDA_COLOR_DETAIL_HPP
#define OPENCV_CUDA_COLOR_DETAIL_HPP
#include "../common.hpp"
#include "../vec_traits.hpp"
@@ -1977,4 +1977,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_COLOR_DETAIL_HPP__
#endif // OPENCV_CUDA_COLOR_DETAIL_HPP
+8 -8
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_REDUCE_DETAIL_HPP__
#define __OPENCV_CUDA_REDUCE_DETAIL_HPP__
#ifndef OPENCV_CUDA_REDUCE_DETAIL_HPP
#define OPENCV_CUDA_REDUCE_DETAIL_HPP
#include <thrust/tuple.h>
#include "../warp.hpp"
@@ -275,9 +275,9 @@ namespace cv { namespace cuda { namespace device
template <typename Pointer, typename Reference, class Op>
static __device__ void reduce(Pointer smem, Reference val, unsigned int tid, Op op)
{
#if __CUDA_ARCH__ >= 300
(void) smem;
(void) tid;
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
CV_UNUSED(smem);
CV_UNUSED(tid);
Unroll<N / 2, Pointer, Reference, Op>::loopShfl(val, op, N);
#else
@@ -298,7 +298,7 @@ namespace cv { namespace cuda { namespace device
{
const unsigned int laneId = Warp::laneId();
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
Unroll<16, Pointer, Reference, Op>::loopShfl(val, op, warpSize);
if (laneId == 0)
@@ -321,7 +321,7 @@ namespace cv { namespace cuda { namespace device
if (tid < 32)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
Unroll<M / 2, Pointer, Reference, Op>::loopShfl(val, op, M);
#else
Unroll<M / 2, Pointer, Reference, Op>::loop(smem, val, tid, op);
@@ -362,4 +362,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_REDUCE_DETAIL_HPP__
#endif // OPENCV_CUDA_REDUCE_DETAIL_HPP
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP__
#define __OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP__
#ifndef OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP
#define OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP
#include <thrust/tuple.h>
#include "../warp.hpp"
@@ -402,9 +402,9 @@ namespace cv { namespace cuda { namespace device
static __device__ void reduce(KP skeys, KR key, VP svals, VR val, unsigned int tid, Cmp cmp)
{
#if 0 // __CUDA_ARCH__ >= 300
(void) skeys;
(void) svals;
(void) tid;
CV_UNUSED(skeys);
CV_UNUSED(svals);
CV_UNUSED(tid);
Unroll<N / 2, KP, KR, VP, VR, Cmp>::loopShfl(key, val, cmp, N);
#else
@@ -499,4 +499,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP__
#endif // OPENCV_CUDA_PRED_VAL_REDUCE_DETAIL_HPP
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_TRANSFORM_DETAIL_HPP__
#define __OPENCV_CUDA_TRANSFORM_DETAIL_HPP__
#ifndef OPENCV_CUDA_TRANSFORM_DETAIL_HPP
#define OPENCV_CUDA_TRANSFORM_DETAIL_HPP
#include "../common.hpp"
#include "../vec_traits.hpp"
@@ -223,11 +223,7 @@ namespace cv { namespace cuda { namespace device
if (x_shifted + ft::smart_shift - 1 < src_.cols)
{
const read_type src_n_el = ((const read_type*)src)[x];
write_type dst_n_el = ((const write_type*)dst)[x];
OpUnroller<ft::smart_shift>::unroll(src_n_el, dst_n_el, mask, op, x_shifted, y);
((write_type*)dst)[x] = dst_n_el;
OpUnroller<ft::smart_shift>::unroll(src_n_el, ((write_type*)dst)[x], mask, op, x_shifted, y);
}
else
{
@@ -275,11 +271,8 @@ namespace cv { namespace cuda { namespace device
{
const read_type1 src1_n_el = ((const read_type1*)src1)[x];
const read_type2 src2_n_el = ((const read_type2*)src2)[x];
write_type dst_n_el = ((const write_type*)dst)[x];
OpUnroller<ft::smart_shift>::unroll(src1_n_el, src2_n_el, dst_n_el, mask, op, x_shifted, y);
((write_type*)dst)[x] = dst_n_el;
OpUnroller<ft::smart_shift>::unroll(src1_n_el, src2_n_el, ((write_type*)dst)[x], mask, op, x_shifted, y);
}
else
{
@@ -396,4 +389,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_TRANSFORM_DETAIL_HPP__
#endif // OPENCV_CUDA_TRANSFORM_DETAIL_HPP
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP__
#define __OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP__
#ifndef OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP
#define OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP
#include "../common.hpp"
#include "../vec_traits.hpp"
@@ -188,4 +188,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP__
#endif // OPENCV_CUDA_TYPE_TRAITS_DETAIL_HPP
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP__
#define __OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP__
#ifndef OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP
#define OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP
#include "../datamov_utils.hpp"
@@ -118,4 +118,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP__
#endif // OPENCV_CUDA_VEC_DISTANCE_DETAIL_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_DYNAMIC_SMEM_HPP__
#define __OPENCV_CUDA_DYNAMIC_SMEM_HPP__
#ifndef OPENCV_CUDA_DYNAMIC_SMEM_HPP
#define OPENCV_CUDA_DYNAMIC_SMEM_HPP
/** @file
* @deprecated Use @ref cudev instead.
@@ -85,4 +85,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_DYNAMIC_SMEM_HPP__
#endif // OPENCV_CUDA_DYNAMIC_SMEM_HPP
+10 -10
View File
@@ -177,8 +177,8 @@ namespace cv { namespace cuda { namespace device
} while (assumed != old);
return __longlong_as_double(old);
#else
(void) address;
(void) val;
CV_UNUSED(address);
CV_UNUSED(val);
return 0.0;
#endif
}
@@ -199,8 +199,8 @@ namespace cv { namespace cuda { namespace device
} while (assumed != old);
return __int_as_float(old);
#else
(void) address;
(void) val;
CV_UNUSED(address);
CV_UNUSED(val);
return 0.0f;
#endif
}
@@ -216,8 +216,8 @@ namespace cv { namespace cuda { namespace device
} while (assumed != old);
return __longlong_as_double(old);
#else
(void) address;
(void) val;
CV_UNUSED(address);
CV_UNUSED(val);
return 0.0;
#endif
}
@@ -238,8 +238,8 @@ namespace cv { namespace cuda { namespace device
} while (assumed != old);
return __int_as_float(old);
#else
(void) address;
(void) val;
CV_UNUSED(address);
CV_UNUSED(val);
return 0.0f;
#endif
}
@@ -255,8 +255,8 @@ namespace cv { namespace cuda { namespace device
} while (assumed != old);
return __longlong_as_double(old);
#else
(void) address;
(void) val;
CV_UNUSED(address);
CV_UNUSED(val);
return 0.0;
#endif
}
+9 -9
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_FILTERS_HPP__
#define __OPENCV_CUDA_FILTERS_HPP__
#ifndef OPENCV_CUDA_FILTERS_HPP
#define OPENCV_CUDA_FILTERS_HPP
#include "saturate_cast.hpp"
#include "vec_traits.hpp"
@@ -64,8 +64,8 @@ namespace cv { namespace cuda { namespace device
explicit __host__ __device__ __forceinline__ PointFilter(const Ptr2D& src_, float fx = 0.f, float fy = 0.f)
: src(src_)
{
(void)fx;
(void)fy;
CV_UNUSED(fx);
CV_UNUSED(fy);
}
__device__ __forceinline__ elem_type operator ()(float y, float x) const
@@ -84,8 +84,8 @@ namespace cv { namespace cuda { namespace device
explicit __host__ __device__ __forceinline__ LinearFilter(const Ptr2D& src_, float fx = 0.f, float fy = 0.f)
: src(src_)
{
(void)fx;
(void)fy;
CV_UNUSED(fx);
CV_UNUSED(fy);
}
__device__ __forceinline__ elem_type operator ()(float y, float x) const
{
@@ -125,8 +125,8 @@ namespace cv { namespace cuda { namespace device
explicit __host__ __device__ __forceinline__ CubicFilter(const Ptr2D& src_, float fx = 0.f, float fy = 0.f)
: src(src_)
{
(void)fx;
(void)fy;
CV_UNUSED(fx);
CV_UNUSED(fy);
}
static __device__ __forceinline__ float bicubicCoeff(float x_)
@@ -283,4 +283,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_FILTERS_HPP__
#endif // OPENCV_CUDA_FILTERS_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP_
#define __OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP_
#ifndef OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP
#define OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP
#include <cstdio>
@@ -76,4 +76,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif /* __OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP_ */
#endif /* OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP */
+20 -6
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_FUNCTIONAL_HPP__
#define __OPENCV_CUDA_FUNCTIONAL_HPP__
#ifndef OPENCV_CUDA_FUNCTIONAL_HPP
#define OPENCV_CUDA_FUNCTIONAL_HPP
#include <functional>
#include "saturate_cast.hpp"
@@ -58,8 +58,22 @@
namespace cv { namespace cuda { namespace device
{
// Function Objects
#ifdef CV_CXX11
template<typename Argument, typename Result> struct unary_function
{
typedef Argument argument_type;
typedef Result result_type;
};
template<typename Argument1, typename Argument2, typename Result> struct binary_function
{
typedef Argument1 first_argument_type;
typedef Argument2 second_argument_type;
typedef Result result_type;
};
#else
template<typename Argument, typename Result> struct unary_function : public std::unary_function<Argument, Result> {};
template<typename Argument1, typename Argument2, typename Result> struct binary_function : public std::binary_function<Argument1, Argument2, Result> {};
#endif
// Arithmetic Operations
template <typename T> struct plus : binary_function<T, T, T>
@@ -583,7 +597,7 @@ namespace cv { namespace cuda { namespace device
template <typename T> struct thresh_trunc_func : unary_function<T, T>
{
explicit __host__ __device__ __forceinline__ thresh_trunc_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {(void)maxVal_;}
explicit __host__ __device__ __forceinline__ thresh_trunc_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);}
__device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
{
@@ -599,7 +613,7 @@ namespace cv { namespace cuda { namespace device
template <typename T> struct thresh_to_zero_func : unary_function<T, T>
{
explicit __host__ __device__ __forceinline__ thresh_to_zero_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {(void)maxVal_;}
explicit __host__ __device__ __forceinline__ thresh_to_zero_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);}
__device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
{
@@ -615,7 +629,7 @@ namespace cv { namespace cuda { namespace device
template <typename T> struct thresh_to_zero_inv_func : unary_function<T, T>
{
explicit __host__ __device__ __forceinline__ thresh_to_zero_inv_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {(void)maxVal_;}
explicit __host__ __device__ __forceinline__ thresh_to_zero_inv_func(T thresh_, T maxVal_ = 0) : thresh(thresh_) {CV_UNUSED(maxVal_);}
__device__ __forceinline__ T operator()(typename TypeTraits<T>::ParameterType src) const
{
@@ -794,4 +808,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_FUNCTIONAL_HPP__
#endif // OPENCV_CUDA_FUNCTIONAL_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_LIMITS_HPP__
#define __OPENCV_CUDA_LIMITS_HPP__
#ifndef OPENCV_CUDA_LIMITS_HPP
#define OPENCV_CUDA_LIMITS_HPP
#include <limits.h>
#include <float.h>
@@ -125,4 +125,4 @@ template <> struct numeric_limits<double>
//! @endcond
#endif // __OPENCV_CUDA_LIMITS_HPP__
#endif // OPENCV_CUDA_LIMITS_HPP
+7 -3
View File
@@ -40,8 +40,12 @@
//
//M*/
#ifndef __OPENCV_CUDA_REDUCE_HPP__
#define __OPENCV_CUDA_REDUCE_HPP__
#ifndef OPENCV_CUDA_REDUCE_HPP
#define OPENCV_CUDA_REDUCE_HPP
#ifndef THRUST_DEBUG // eliminate -Wundef warning
#define THRUST_DEBUG 0
#endif
#include <thrust/tuple.h>
#include "detail/reduce.hpp"
@@ -202,4 +206,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_UTILITY_HPP__
#endif // OPENCV_CUDA_REDUCE_HPP
+7 -7
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_SATURATE_CAST_HPP__
#define __OPENCV_CUDA_SATURATE_CAST_HPP__
#ifndef OPENCV_CUDA_SATURATE_CAST_HPP
#define OPENCV_CUDA_SATURATE_CAST_HPP
#include "common.hpp"
@@ -101,7 +101,7 @@ namespace cv { namespace cuda { namespace device
}
template<> __device__ __forceinline__ uchar saturate_cast<uchar>(double v)
{
#if __CUDA_ARCH__ >= 130
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
uint res = 0;
asm("cvt.rni.sat.u8.f64 %0, %1;" : "=r"(res) : "d"(v));
return res;
@@ -149,7 +149,7 @@ namespace cv { namespace cuda { namespace device
}
template<> __device__ __forceinline__ schar saturate_cast<schar>(double v)
{
#if __CUDA_ARCH__ >= 130
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
uint res = 0;
asm("cvt.rni.sat.s8.f64 %0, %1;" : "=r"(res) : "d"(v));
return res;
@@ -191,7 +191,7 @@ namespace cv { namespace cuda { namespace device
}
template<> __device__ __forceinline__ ushort saturate_cast<ushort>(double v)
{
#if __CUDA_ARCH__ >= 130
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
ushort res = 0;
asm("cvt.rni.sat.u16.f64 %0, %1;" : "=h"(res) : "d"(v));
return res;
@@ -226,7 +226,7 @@ namespace cv { namespace cuda { namespace device
}
template<> __device__ __forceinline__ short saturate_cast<short>(double v)
{
#if __CUDA_ARCH__ >= 130
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 130
short res = 0;
asm("cvt.rni.sat.s16.f64 %0, %1;" : "=h"(res) : "d"(v));
return res;
@@ -289,4 +289,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif /* __OPENCV_CUDA_SATURATE_CAST_HPP__ */
#endif /* OPENCV_CUDA_SATURATE_CAST_HPP */
+6 -6
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_SCAN_HPP__
#define __OPENCV_CUDA_SCAN_HPP__
#ifndef OPENCV_CUDA_SCAN_HPP
#define OPENCV_CUDA_SCAN_HPP
#include "opencv2/core/cuda/common.hpp"
#include "opencv2/core/cuda/utility.hpp"
@@ -61,7 +61,7 @@ namespace cv { namespace cuda { namespace device
template <ScanKind Kind, typename T, typename F> struct WarpScan
{
__device__ __forceinline__ WarpScan() {}
__device__ __forceinline__ WarpScan(const WarpScan& other) { (void)other; }
__device__ __forceinline__ WarpScan(const WarpScan& other) { CV_UNUSED(other); }
__device__ __forceinline__ T operator()( volatile T *ptr , const unsigned int idx)
{
@@ -95,7 +95,7 @@ namespace cv { namespace cuda { namespace device
template <ScanKind Kind , typename T, typename F> struct WarpScanNoComp
{
__device__ __forceinline__ WarpScanNoComp() {}
__device__ __forceinline__ WarpScanNoComp(const WarpScanNoComp& other) { (void)other; }
__device__ __forceinline__ WarpScanNoComp(const WarpScanNoComp& other) { CV_UNUSED(other); }
__device__ __forceinline__ T operator()( volatile T *ptr , const unsigned int idx)
{
@@ -135,7 +135,7 @@ namespace cv { namespace cuda { namespace device
template <ScanKind Kind , typename T, typename Sc, typename F> struct BlockScan
{
__device__ __forceinline__ BlockScan() {}
__device__ __forceinline__ BlockScan(const BlockScan& other) { (void)other; }
__device__ __forceinline__ BlockScan(const BlockScan& other) { CV_UNUSED(other); }
__device__ __forceinline__ T operator()(volatile T *ptr)
{
@@ -255,4 +255,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_SCAN_HPP__
#endif // OPENCV_CUDA_SCAN_HPP
+3 -3
View File
@@ -70,8 +70,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __OPENCV_CUDA_SIMD_FUNCTIONS_HPP__
#define __OPENCV_CUDA_SIMD_FUNCTIONS_HPP__
#ifndef OPENCV_CUDA_SIMD_FUNCTIONS_HPP
#define OPENCV_CUDA_SIMD_FUNCTIONS_HPP
#include "common.hpp"
@@ -866,4 +866,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_SIMD_FUNCTIONS_HPP__
#endif // OPENCV_CUDA_SIMD_FUNCTIONS_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_TRANSFORM_HPP__
#define __OPENCV_CUDA_TRANSFORM_HPP__
#ifndef OPENCV_CUDA_TRANSFORM_HPP
#define OPENCV_CUDA_TRANSFORM_HPP
#include "common.hpp"
#include "utility.hpp"
@@ -72,4 +72,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_TRANSFORM_HPP__
#endif // OPENCV_CUDA_TRANSFORM_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_TYPE_TRAITS_HPP__
#define __OPENCV_CUDA_TYPE_TRAITS_HPP__
#ifndef OPENCV_CUDA_TYPE_TRAITS_HPP
#define OPENCV_CUDA_TYPE_TRAITS_HPP
#include "detail/type_traits_detail.hpp"
@@ -87,4 +87,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_TYPE_TRAITS_HPP__
#endif // OPENCV_CUDA_TYPE_TRAITS_HPP
+12 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_UTILITY_HPP__
#define __OPENCV_CUDA_UTILITY_HPP__
#ifndef OPENCV_CUDA_UTILITY_HPP
#define OPENCV_CUDA_UTILITY_HPP
#include "saturate_cast.hpp"
#include "datamov_utils.hpp"
@@ -54,6 +54,15 @@
namespace cv { namespace cuda { namespace device
{
struct CV_EXPORTS ThrustAllocator
{
typedef uchar value_type;
virtual ~ThrustAllocator();
virtual __device__ __host__ uchar* allocate(size_t numBytes) = 0;
virtual __device__ __host__ void deallocate(uchar* ptr, size_t numBytes) = 0;
static ThrustAllocator& getAllocator();
static void setAllocator(ThrustAllocator* allocator);
};
#define OPENCV_CUDA_LOG_WARP_SIZE (5)
#define OPENCV_CUDA_WARP_SIZE (1 << OPENCV_CUDA_LOG_WARP_SIZE)
#define OPENCV_CUDA_LOG_MEM_BANKS ((__CUDA_ARCH__ >= 200) ? 5 : 4) // 32 banks on fermi, 16 on tesla
@@ -218,4 +227,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_UTILITY_HPP__
#endif // OPENCV_CUDA_UTILITY_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_VEC_DISTANCE_HPP__
#define __OPENCV_CUDA_VEC_DISTANCE_HPP__
#ifndef OPENCV_CUDA_VEC_DISTANCE_HPP
#define OPENCV_CUDA_VEC_DISTANCE_HPP
#include "reduce.hpp"
#include "functional.hpp"
@@ -229,4 +229,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_VEC_DISTANCE_HPP__
#endif // OPENCV_CUDA_VEC_DISTANCE_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_VECMATH_HPP__
#define __OPENCV_CUDA_VECMATH_HPP__
#ifndef OPENCV_CUDA_VECMATH_HPP
#define OPENCV_CUDA_VECMATH_HPP
#include "vec_traits.hpp"
#include "saturate_cast.hpp"
@@ -927,4 +927,4 @@ CV_CUDEV_IMPLEMENT_SCALAR_BINARY_FUNC(atan2, ::atan2, double, double, double)
//! @endcond
#endif // __OPENCV_CUDA_VECMATH_HPP__
#endif // OPENCV_CUDA_VECMATH_HPP
+3 -3
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_VEC_TRAITS_HPP__
#define __OPENCV_CUDA_VEC_TRAITS_HPP__
#ifndef OPENCV_CUDA_VEC_TRAITS_HPP
#define OPENCV_CUDA_VEC_TRAITS_HPP
#include "common.hpp"
@@ -285,4 +285,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif // __OPENCV_CUDA_VEC_TRAITS_HPP__
#endif // OPENCV_CUDA_VEC_TRAITS_HPP
+4 -4
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_DEVICE_WARP_HPP__
#define __OPENCV_CUDA_DEVICE_WARP_HPP__
#ifndef OPENCV_CUDA_DEVICE_WARP_HPP
#define OPENCV_CUDA_DEVICE_WARP_HPP
/** @file
* @deprecated Use @ref cudev instead.
@@ -64,7 +64,7 @@ namespace cv { namespace cuda { namespace device
static __device__ __forceinline__ unsigned int laneId()
{
unsigned int ret;
asm("mov.u32 %0, %laneid;" : "=r"(ret) );
asm("mov.u32 %0, %%laneid;" : "=r"(ret) );
return ret;
}
@@ -136,4 +136,4 @@ namespace cv { namespace cuda { namespace device
//! @endcond
#endif /* __OPENCV_CUDA_DEVICE_WARP_HPP__ */
#endif /* OPENCV_CUDA_DEVICE_WARP_HPP */
+21 -12
View File
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CUDA_WARP_SHUFFLE_HPP__
#define __OPENCV_CUDA_WARP_SHUFFLE_HPP__
#ifndef OPENCV_CUDA_WARP_SHUFFLE_HPP
#define OPENCV_CUDA_WARP_SHUFFLE_HPP
/** @file
* @deprecated Use @ref cudev instead.
@@ -51,10 +51,15 @@
namespace cv { namespace cuda { namespace device
{
#if __CUDACC_VER_MAJOR__ >= 9
# define __shfl(x, y, z) __shfl_sync(0xFFFFFFFFU, x, y, z)
# define __shfl_up(x, y, z) __shfl_up_sync(0xFFFFFFFFU, x, y, z)
# define __shfl_down(x, y, z) __shfl_down_sync(0xFFFFFFFFU, x, y, z)
#endif
template <typename T>
__device__ __forceinline__ T shfl(T val, int srcLane, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
return __shfl(val, srcLane, width);
#else
return T();
@@ -62,7 +67,7 @@ namespace cv { namespace cuda { namespace device
}
__device__ __forceinline__ unsigned int shfl(unsigned int val, int srcLane, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
return (unsigned int) __shfl((int) val, srcLane, width);
#else
return 0;
@@ -70,7 +75,7 @@ namespace cv { namespace cuda { namespace device
}
__device__ __forceinline__ double shfl(double val, int srcLane, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
int lo = __double2loint(val);
int hi = __double2hiint(val);
@@ -86,7 +91,7 @@ namespace cv { namespace cuda { namespace device
template <typename T>
__device__ __forceinline__ T shfl_down(T val, unsigned int delta, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
return __shfl_down(val, delta, width);
#else
return T();
@@ -94,7 +99,7 @@ namespace cv { namespace cuda { namespace device
}
__device__ __forceinline__ unsigned int shfl_down(unsigned int val, unsigned int delta, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
return (unsigned int) __shfl_down((int) val, delta, width);
#else
return 0;
@@ -102,7 +107,7 @@ namespace cv { namespace cuda { namespace device
}
__device__ __forceinline__ double shfl_down(double val, unsigned int delta, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
int lo = __double2loint(val);
int hi = __double2hiint(val);
@@ -118,7 +123,7 @@ namespace cv { namespace cuda { namespace device
template <typename T>
__device__ __forceinline__ T shfl_up(T val, unsigned int delta, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
return __shfl_up(val, delta, width);
#else
return T();
@@ -126,7 +131,7 @@ namespace cv { namespace cuda { namespace device
}
__device__ __forceinline__ unsigned int shfl_up(unsigned int val, unsigned int delta, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
return (unsigned int) __shfl_up((int) val, delta, width);
#else
return 0;
@@ -134,7 +139,7 @@ namespace cv { namespace cuda { namespace device
}
__device__ __forceinline__ double shfl_up(double val, unsigned int delta, int width = warpSize)
{
#if __CUDA_ARCH__ >= 300
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 300
int lo = __double2loint(val);
int hi = __double2hiint(val);
@@ -148,6 +153,10 @@ namespace cv { namespace cuda { namespace device
}
}}}
# undef __shfl
# undef __shfl_up
# undef __shfl_down
//! @endcond
#endif // __OPENCV_CUDA_WARP_SHUFFLE_HPP__
#endif // OPENCV_CUDA_WARP_SHUFFLE_HPP
@@ -40,8 +40,8 @@
//
//M*/
#ifndef __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__
#define __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__
#ifndef OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP
#define OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP
#ifndef __cplusplus
# error cuda_stream_accessor.hpp header must be compiled as C++
@@ -52,7 +52,7 @@
*/
#include <cuda_runtime.h>
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cuda.hpp"
namespace cv
{
@@ -62,14 +62,12 @@ namespace cv
//! @addtogroup cudacore_struct
//! @{
class Stream;
class Event;
/** @brief Class that enables getting cudaStream_t from cuda::Stream
*/
struct StreamAccessor
{
CV_EXPORTS static cudaStream_t getStream(const Stream& stream);
CV_EXPORTS static Stream wrapStream(cudaStream_t stream);
};
/** @brief Class that enables getting cudaEvent_t from cuda::Event
@@ -77,6 +75,7 @@ namespace cv
struct EventAccessor
{
CV_EXPORTS static cudaEvent_t getEvent(const Event& event);
CV_EXPORTS static Event wrapEvent(cudaEvent_t event);
};
//! @}
@@ -84,4 +83,4 @@ namespace cv
}
}
#endif /* __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__ */
#endif /* OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP */
+10 -3
View File
@@ -40,13 +40,20 @@
//
//M*/
#ifndef __OPENCV_CORE_CUDA_TYPES_HPP__
#define __OPENCV_CORE_CUDA_TYPES_HPP__
#ifndef OPENCV_CORE_CUDA_TYPES_HPP
#define OPENCV_CORE_CUDA_TYPES_HPP
#ifndef __cplusplus
# error cuda_types.hpp header must be compiled as C++
#endif
#if defined(__OPENCV_BUILD) && defined(__clang__)
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
#endif
#if defined(__OPENCV_BUILD) && defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
/** @file
* @deprecated Use @ref cudev instead.
*/
@@ -132,4 +139,4 @@ namespace cv
//! @endcond
#endif /* __OPENCV_CORE_CUDA_TYPES_HPP__ */
#endif /* OPENCV_CORE_CUDA_TYPES_HPP */
+247
View File
@@ -0,0 +1,247 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#if defined __OPENCV_BUILD \
#include "cv_cpu_config.h"
#include "cv_cpu_helper.h"
#ifdef CV_CPU_DISPATCH_MODE
#define CV_CPU_OPTIMIZATION_NAMESPACE __CV_CAT(opt_, CV_CPU_DISPATCH_MODE)
#define CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN namespace __CV_CAT(opt_, CV_CPU_DISPATCH_MODE) {
#define CV_CPU_OPTIMIZATION_NAMESPACE_END }
#else
#define CV_CPU_OPTIMIZATION_NAMESPACE cpu_baseline
#define CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN namespace cpu_baseline {
#define CV_CPU_OPTIMIZATION_NAMESPACE_END }
#endif
#define __CV_CPU_DISPATCH_CHAIN_END(fn, args, mode, ...) /* done */
#define __CV_CPU_DISPATCH(fn, args, mode, ...) __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#define __CV_CPU_DISPATCH_EXPAND(fn, args, ...) __CV_EXPAND(__CV_CPU_DISPATCH(fn, args, __VA_ARGS__))
#define CV_CPU_DISPATCH(fn, args, ...) __CV_CPU_DISPATCH_EXPAND(fn, args, __VA_ARGS__, END) // expand macros
#if defined CV_ENABLE_INTRINSICS \
&& !defined CV_DISABLE_OPTIMIZATION \
&& !defined __CUDACC__ /* do not include SSE/AVX/NEON headers for NVCC compiler */ \
#ifdef CV_CPU_COMPILE_SSE2
# include <emmintrin.h>
# define CV_MMX 1
# define CV_SSE 1
# define CV_SSE2 1
#endif
#ifdef CV_CPU_COMPILE_SSE3
# include <pmmintrin.h>
# define CV_SSE3 1
#endif
#ifdef CV_CPU_COMPILE_SSSE3
# include <tmmintrin.h>
# define CV_SSSE3 1
#endif
#ifdef CV_CPU_COMPILE_SSE4_1
# include <smmintrin.h>
# define CV_SSE4_1 1
#endif
#ifdef CV_CPU_COMPILE_SSE4_2
# include <nmmintrin.h>
# define CV_SSE4_2 1
#endif
#ifdef CV_CPU_COMPILE_POPCNT
# ifdef _MSC_VER
# include <nmmintrin.h>
# if defined(_M_X64)
# define CV_POPCNT_U64 _mm_popcnt_u64
# endif
# define CV_POPCNT_U32 _mm_popcnt_u32
# else
# include <popcntintrin.h>
# if defined(__x86_64__)
# define CV_POPCNT_U64 __builtin_popcountll
# endif
# define CV_POPCNT_U32 __builtin_popcount
# endif
# define CV_POPCNT 1
#endif
#ifdef CV_CPU_COMPILE_AVX
# include <immintrin.h>
# define CV_AVX 1
#endif
#ifdef CV_CPU_COMPILE_FP16
# if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM)
# include <arm_neon.h>
# else
# include <immintrin.h>
# endif
# define CV_FP16 1
#endif
#ifdef CV_CPU_COMPILE_AVX2
# include <immintrin.h>
# define CV_AVX2 1
#endif
#ifdef CV_CPU_COMPILE_AVX_512F
# include <immintrin.h>
# define CV_AVX_512F 1
#endif
#ifdef CV_CPU_COMPILE_AVX512_SKX
# include <immintrin.h>
# define CV_AVX512_SKX 1
#endif
#ifdef CV_CPU_COMPILE_FMA3
# define CV_FMA3 1
#endif
#if defined _WIN32 && defined(_M_ARM)
# include <Intrin.h>
# include <arm_neon.h>
# define CV_NEON 1
#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
# include <arm_neon.h>
# define CV_NEON 1
#endif
#if defined(__ARM_NEON__) || defined(__aarch64__)
# include <arm_neon.h>
#endif
#ifdef CV_CPU_COMPILE_VSX
# include <altivec.h>
# undef vector
# undef pixel
# undef bool
# define CV_VSX 1
#endif
#ifdef CV_CPU_COMPILE_VSX3
# define CV_VSX3 1
#endif
#endif // CV_ENABLE_INTRINSICS && !CV_DISABLE_OPTIMIZATION && !__CUDACC__
#if defined CV_CPU_COMPILE_AVX && !defined CV_CPU_BASELINE_COMPILE_AVX
struct VZeroUpperGuard {
#ifdef __GNUC__
__attribute__((always_inline))
#endif
inline ~VZeroUpperGuard() { _mm256_zeroupper(); }
};
#define __CV_AVX_GUARD VZeroUpperGuard __vzeroupper_guard; CV_UNUSED(__vzeroupper_guard);
#endif
#ifdef __CV_AVX_GUARD
#define CV_AVX_GUARD __CV_AVX_GUARD
#else
#define CV_AVX_GUARD
#endif
#endif // __OPENCV_BUILD
#if !defined __OPENCV_BUILD /* Compatibility code */ \
&& !defined __CUDACC__ /* do not include SSE/AVX/NEON headers for NVCC compiler */
#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
#elif defined _WIN32 && defined(_M_ARM)
# include <Intrin.h>
# include <arm_neon.h>
# define CV_NEON 1
#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
# include <arm_neon.h>
# define CV_NEON 1
#elif defined(__VSX__) && defined(__PPC64__) && defined(__LITTLE_ENDIAN__)
# include <altivec.h>
# undef vector
# undef pixel
# undef bool
# define CV_VSX 1
#endif
#endif // !__OPENCV_BUILD && !__CUDACC (Compatibility code)
#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_POPCNT
# define CV_POPCNT 0
#endif
#ifndef CV_AVX
# define CV_AVX 0
#endif
#ifndef CV_FP16
# define CV_FP16 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_AVX512_SKX
# define CV_AVX512_SKX 0
#endif
#ifndef CV_NEON
# define CV_NEON 0
#endif
#ifndef CV_VSX
# define CV_VSX 0
#endif
#ifndef CV_VSX3
# define CV_VSX3 0
#endif
+340
View File
@@ -0,0 +1,340 @@
// AUTOGENERATED, DO NOT EDIT
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE
# define CV_TRY_SSE 1
# define CV_CPU_FORCE_SSE 1
# define CV_CPU_HAS_SUPPORT_SSE 1
# define CV_CPU_CALL_SSE(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_SSE_(fn, args) return (opt_SSE::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE
# define CV_TRY_SSE 1
# define CV_CPU_FORCE_SSE 0
# define CV_CPU_HAS_SUPPORT_SSE (cv::checkHardwareSupport(CV_CPU_SSE))
# define CV_CPU_CALL_SSE(fn, args) if (CV_CPU_HAS_SUPPORT_SSE) return (opt_SSE::fn args)
# define CV_CPU_CALL_SSE_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE) return (opt_SSE::fn args)
#else
# define CV_TRY_SSE 0
# define CV_CPU_FORCE_SSE 0
# define CV_CPU_HAS_SUPPORT_SSE 0
# define CV_CPU_CALL_SSE(fn, args)
# define CV_CPU_CALL_SSE_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_SSE(fn, args, mode, ...) CV_CPU_CALL_SSE(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE2
# define CV_TRY_SSE2 1
# define CV_CPU_FORCE_SSE2 1
# define CV_CPU_HAS_SUPPORT_SSE2 1
# define CV_CPU_CALL_SSE2(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_SSE2_(fn, args) return (opt_SSE2::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE2
# define CV_TRY_SSE2 1
# define CV_CPU_FORCE_SSE2 0
# define CV_CPU_HAS_SUPPORT_SSE2 (cv::checkHardwareSupport(CV_CPU_SSE2))
# define CV_CPU_CALL_SSE2(fn, args) if (CV_CPU_HAS_SUPPORT_SSE2) return (opt_SSE2::fn args)
# define CV_CPU_CALL_SSE2_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE2) return (opt_SSE2::fn args)
#else
# define CV_TRY_SSE2 0
# define CV_CPU_FORCE_SSE2 0
# define CV_CPU_HAS_SUPPORT_SSE2 0
# define CV_CPU_CALL_SSE2(fn, args)
# define CV_CPU_CALL_SSE2_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_SSE2(fn, args, mode, ...) CV_CPU_CALL_SSE2(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE3
# define CV_TRY_SSE3 1
# define CV_CPU_FORCE_SSE3 1
# define CV_CPU_HAS_SUPPORT_SSE3 1
# define CV_CPU_CALL_SSE3(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_SSE3_(fn, args) return (opt_SSE3::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE3
# define CV_TRY_SSE3 1
# define CV_CPU_FORCE_SSE3 0
# define CV_CPU_HAS_SUPPORT_SSE3 (cv::checkHardwareSupport(CV_CPU_SSE3))
# define CV_CPU_CALL_SSE3(fn, args) if (CV_CPU_HAS_SUPPORT_SSE3) return (opt_SSE3::fn args)
# define CV_CPU_CALL_SSE3_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE3) return (opt_SSE3::fn args)
#else
# define CV_TRY_SSE3 0
# define CV_CPU_FORCE_SSE3 0
# define CV_CPU_HAS_SUPPORT_SSE3 0
# define CV_CPU_CALL_SSE3(fn, args)
# define CV_CPU_CALL_SSE3_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_SSE3(fn, args, mode, ...) CV_CPU_CALL_SSE3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSSE3
# define CV_TRY_SSSE3 1
# define CV_CPU_FORCE_SSSE3 1
# define CV_CPU_HAS_SUPPORT_SSSE3 1
# define CV_CPU_CALL_SSSE3(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_SSSE3_(fn, args) return (opt_SSSE3::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSSE3
# define CV_TRY_SSSE3 1
# define CV_CPU_FORCE_SSSE3 0
# define CV_CPU_HAS_SUPPORT_SSSE3 (cv::checkHardwareSupport(CV_CPU_SSSE3))
# define CV_CPU_CALL_SSSE3(fn, args) if (CV_CPU_HAS_SUPPORT_SSSE3) return (opt_SSSE3::fn args)
# define CV_CPU_CALL_SSSE3_(fn, args) if (CV_CPU_HAS_SUPPORT_SSSE3) return (opt_SSSE3::fn args)
#else
# define CV_TRY_SSSE3 0
# define CV_CPU_FORCE_SSSE3 0
# define CV_CPU_HAS_SUPPORT_SSSE3 0
# define CV_CPU_CALL_SSSE3(fn, args)
# define CV_CPU_CALL_SSSE3_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_SSSE3(fn, args, mode, ...) CV_CPU_CALL_SSSE3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE4_1
# define CV_TRY_SSE4_1 1
# define CV_CPU_FORCE_SSE4_1 1
# define CV_CPU_HAS_SUPPORT_SSE4_1 1
# define CV_CPU_CALL_SSE4_1(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_SSE4_1_(fn, args) return (opt_SSE4_1::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE4_1
# define CV_TRY_SSE4_1 1
# define CV_CPU_FORCE_SSE4_1 0
# define CV_CPU_HAS_SUPPORT_SSE4_1 (cv::checkHardwareSupport(CV_CPU_SSE4_1))
# define CV_CPU_CALL_SSE4_1(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_1) return (opt_SSE4_1::fn args)
# define CV_CPU_CALL_SSE4_1_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_1) return (opt_SSE4_1::fn args)
#else
# define CV_TRY_SSE4_1 0
# define CV_CPU_FORCE_SSE4_1 0
# define CV_CPU_HAS_SUPPORT_SSE4_1 0
# define CV_CPU_CALL_SSE4_1(fn, args)
# define CV_CPU_CALL_SSE4_1_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_SSE4_1(fn, args, mode, ...) CV_CPU_CALL_SSE4_1(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_SSE4_2
# define CV_TRY_SSE4_2 1
# define CV_CPU_FORCE_SSE4_2 1
# define CV_CPU_HAS_SUPPORT_SSE4_2 1
# define CV_CPU_CALL_SSE4_2(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_SSE4_2_(fn, args) return (opt_SSE4_2::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_SSE4_2
# define CV_TRY_SSE4_2 1
# define CV_CPU_FORCE_SSE4_2 0
# define CV_CPU_HAS_SUPPORT_SSE4_2 (cv::checkHardwareSupport(CV_CPU_SSE4_2))
# define CV_CPU_CALL_SSE4_2(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_2) return (opt_SSE4_2::fn args)
# define CV_CPU_CALL_SSE4_2_(fn, args) if (CV_CPU_HAS_SUPPORT_SSE4_2) return (opt_SSE4_2::fn args)
#else
# define CV_TRY_SSE4_2 0
# define CV_CPU_FORCE_SSE4_2 0
# define CV_CPU_HAS_SUPPORT_SSE4_2 0
# define CV_CPU_CALL_SSE4_2(fn, args)
# define CV_CPU_CALL_SSE4_2_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_SSE4_2(fn, args, mode, ...) CV_CPU_CALL_SSE4_2(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_POPCNT
# define CV_TRY_POPCNT 1
# define CV_CPU_FORCE_POPCNT 1
# define CV_CPU_HAS_SUPPORT_POPCNT 1
# define CV_CPU_CALL_POPCNT(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_POPCNT_(fn, args) return (opt_POPCNT::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_POPCNT
# define CV_TRY_POPCNT 1
# define CV_CPU_FORCE_POPCNT 0
# define CV_CPU_HAS_SUPPORT_POPCNT (cv::checkHardwareSupport(CV_CPU_POPCNT))
# define CV_CPU_CALL_POPCNT(fn, args) if (CV_CPU_HAS_SUPPORT_POPCNT) return (opt_POPCNT::fn args)
# define CV_CPU_CALL_POPCNT_(fn, args) if (CV_CPU_HAS_SUPPORT_POPCNT) return (opt_POPCNT::fn args)
#else
# define CV_TRY_POPCNT 0
# define CV_CPU_FORCE_POPCNT 0
# define CV_CPU_HAS_SUPPORT_POPCNT 0
# define CV_CPU_CALL_POPCNT(fn, args)
# define CV_CPU_CALL_POPCNT_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_POPCNT(fn, args, mode, ...) CV_CPU_CALL_POPCNT(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX
# define CV_TRY_AVX 1
# define CV_CPU_FORCE_AVX 1
# define CV_CPU_HAS_SUPPORT_AVX 1
# define CV_CPU_CALL_AVX(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_AVX_(fn, args) return (opt_AVX::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX
# define CV_TRY_AVX 1
# define CV_CPU_FORCE_AVX 0
# define CV_CPU_HAS_SUPPORT_AVX (cv::checkHardwareSupport(CV_CPU_AVX))
# define CV_CPU_CALL_AVX(fn, args) if (CV_CPU_HAS_SUPPORT_AVX) return (opt_AVX::fn args)
# define CV_CPU_CALL_AVX_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX) return (opt_AVX::fn args)
#else
# define CV_TRY_AVX 0
# define CV_CPU_FORCE_AVX 0
# define CV_CPU_HAS_SUPPORT_AVX 0
# define CV_CPU_CALL_AVX(fn, args)
# define CV_CPU_CALL_AVX_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_AVX(fn, args, mode, ...) CV_CPU_CALL_AVX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_FP16
# define CV_TRY_FP16 1
# define CV_CPU_FORCE_FP16 1
# define CV_CPU_HAS_SUPPORT_FP16 1
# define CV_CPU_CALL_FP16(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_FP16_(fn, args) return (opt_FP16::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_FP16
# define CV_TRY_FP16 1
# define CV_CPU_FORCE_FP16 0
# define CV_CPU_HAS_SUPPORT_FP16 (cv::checkHardwareSupport(CV_CPU_FP16))
# define CV_CPU_CALL_FP16(fn, args) if (CV_CPU_HAS_SUPPORT_FP16) return (opt_FP16::fn args)
# define CV_CPU_CALL_FP16_(fn, args) if (CV_CPU_HAS_SUPPORT_FP16) return (opt_FP16::fn args)
#else
# define CV_TRY_FP16 0
# define CV_CPU_FORCE_FP16 0
# define CV_CPU_HAS_SUPPORT_FP16 0
# define CV_CPU_CALL_FP16(fn, args)
# define CV_CPU_CALL_FP16_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_FP16(fn, args, mode, ...) CV_CPU_CALL_FP16(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX2
# define CV_TRY_AVX2 1
# define CV_CPU_FORCE_AVX2 1
# define CV_CPU_HAS_SUPPORT_AVX2 1
# define CV_CPU_CALL_AVX2(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_AVX2_(fn, args) return (opt_AVX2::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX2
# define CV_TRY_AVX2 1
# define CV_CPU_FORCE_AVX2 0
# define CV_CPU_HAS_SUPPORT_AVX2 (cv::checkHardwareSupport(CV_CPU_AVX2))
# define CV_CPU_CALL_AVX2(fn, args) if (CV_CPU_HAS_SUPPORT_AVX2) return (opt_AVX2::fn args)
# define CV_CPU_CALL_AVX2_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX2) return (opt_AVX2::fn args)
#else
# define CV_TRY_AVX2 0
# define CV_CPU_FORCE_AVX2 0
# define CV_CPU_HAS_SUPPORT_AVX2 0
# define CV_CPU_CALL_AVX2(fn, args)
# define CV_CPU_CALL_AVX2_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_AVX2(fn, args, mode, ...) CV_CPU_CALL_AVX2(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_FMA3
# define CV_TRY_FMA3 1
# define CV_CPU_FORCE_FMA3 1
# define CV_CPU_HAS_SUPPORT_FMA3 1
# define CV_CPU_CALL_FMA3(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_FMA3_(fn, args) return (opt_FMA3::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_FMA3
# define CV_TRY_FMA3 1
# define CV_CPU_FORCE_FMA3 0
# define CV_CPU_HAS_SUPPORT_FMA3 (cv::checkHardwareSupport(CV_CPU_FMA3))
# define CV_CPU_CALL_FMA3(fn, args) if (CV_CPU_HAS_SUPPORT_FMA3) return (opt_FMA3::fn args)
# define CV_CPU_CALL_FMA3_(fn, args) if (CV_CPU_HAS_SUPPORT_FMA3) return (opt_FMA3::fn args)
#else
# define CV_TRY_FMA3 0
# define CV_CPU_FORCE_FMA3 0
# define CV_CPU_HAS_SUPPORT_FMA3 0
# define CV_CPU_CALL_FMA3(fn, args)
# define CV_CPU_CALL_FMA3_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_FMA3(fn, args, mode, ...) CV_CPU_CALL_FMA3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX_512F
# define CV_TRY_AVX_512F 1
# define CV_CPU_FORCE_AVX_512F 1
# define CV_CPU_HAS_SUPPORT_AVX_512F 1
# define CV_CPU_CALL_AVX_512F(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_AVX_512F_(fn, args) return (opt_AVX_512F::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX_512F
# define CV_TRY_AVX_512F 1
# define CV_CPU_FORCE_AVX_512F 0
# define CV_CPU_HAS_SUPPORT_AVX_512F (cv::checkHardwareSupport(CV_CPU_AVX_512F))
# define CV_CPU_CALL_AVX_512F(fn, args) if (CV_CPU_HAS_SUPPORT_AVX_512F) return (opt_AVX_512F::fn args)
# define CV_CPU_CALL_AVX_512F_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX_512F) return (opt_AVX_512F::fn args)
#else
# define CV_TRY_AVX_512F 0
# define CV_CPU_FORCE_AVX_512F 0
# define CV_CPU_HAS_SUPPORT_AVX_512F 0
# define CV_CPU_CALL_AVX_512F(fn, args)
# define CV_CPU_CALL_AVX_512F_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_AVX_512F(fn, args, mode, ...) CV_CPU_CALL_AVX_512F(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_AVX512_SKX
# define CV_TRY_AVX512_SKX 1
# define CV_CPU_FORCE_AVX512_SKX 1
# define CV_CPU_HAS_SUPPORT_AVX512_SKX 1
# define CV_CPU_CALL_AVX512_SKX(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_AVX512_SKX_(fn, args) return (opt_AVX512_SKX::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_AVX512_SKX
# define CV_TRY_AVX512_SKX 1
# define CV_CPU_FORCE_AVX512_SKX 0
# define CV_CPU_HAS_SUPPORT_AVX512_SKX (cv::checkHardwareSupport(CV_CPU_AVX512_SKX))
# define CV_CPU_CALL_AVX512_SKX(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_SKX) return (opt_AVX512_SKX::fn args)
# define CV_CPU_CALL_AVX512_SKX_(fn, args) if (CV_CPU_HAS_SUPPORT_AVX512_SKX) return (opt_AVX512_SKX::fn args)
#else
# define CV_TRY_AVX512_SKX 0
# define CV_CPU_FORCE_AVX512_SKX 0
# define CV_CPU_HAS_SUPPORT_AVX512_SKX 0
# define CV_CPU_CALL_AVX512_SKX(fn, args)
# define CV_CPU_CALL_AVX512_SKX_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_AVX512_SKX(fn, args, mode, ...) CV_CPU_CALL_AVX512_SKX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_NEON
# define CV_TRY_NEON 1
# define CV_CPU_FORCE_NEON 1
# define CV_CPU_HAS_SUPPORT_NEON 1
# define CV_CPU_CALL_NEON(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_NEON_(fn, args) return (opt_NEON::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_NEON
# define CV_TRY_NEON 1
# define CV_CPU_FORCE_NEON 0
# define CV_CPU_HAS_SUPPORT_NEON (cv::checkHardwareSupport(CV_CPU_NEON))
# define CV_CPU_CALL_NEON(fn, args) if (CV_CPU_HAS_SUPPORT_NEON) return (opt_NEON::fn args)
# define CV_CPU_CALL_NEON_(fn, args) if (CV_CPU_HAS_SUPPORT_NEON) return (opt_NEON::fn args)
#else
# define CV_TRY_NEON 0
# define CV_CPU_FORCE_NEON 0
# define CV_CPU_HAS_SUPPORT_NEON 0
# define CV_CPU_CALL_NEON(fn, args)
# define CV_CPU_CALL_NEON_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_NEON(fn, args, mode, ...) CV_CPU_CALL_NEON(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_VSX
# define CV_TRY_VSX 1
# define CV_CPU_FORCE_VSX 1
# define CV_CPU_HAS_SUPPORT_VSX 1
# define CV_CPU_CALL_VSX(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_VSX_(fn, args) return (opt_VSX::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_VSX
# define CV_TRY_VSX 1
# define CV_CPU_FORCE_VSX 0
# define CV_CPU_HAS_SUPPORT_VSX (cv::checkHardwareSupport(CV_CPU_VSX))
# define CV_CPU_CALL_VSX(fn, args) if (CV_CPU_HAS_SUPPORT_VSX) return (opt_VSX::fn args)
# define CV_CPU_CALL_VSX_(fn, args) if (CV_CPU_HAS_SUPPORT_VSX) return (opt_VSX::fn args)
#else
# define CV_TRY_VSX 0
# define CV_CPU_FORCE_VSX 0
# define CV_CPU_HAS_SUPPORT_VSX 0
# define CV_CPU_CALL_VSX(fn, args)
# define CV_CPU_CALL_VSX_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_VSX(fn, args, mode, ...) CV_CPU_CALL_VSX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_VSX3
# define CV_TRY_VSX3 1
# define CV_CPU_FORCE_VSX3 1
# define CV_CPU_HAS_SUPPORT_VSX3 1
# define CV_CPU_CALL_VSX3(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_VSX3_(fn, args) return (opt_VSX3::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_VSX3
# define CV_TRY_VSX3 1
# define CV_CPU_FORCE_VSX3 0
# define CV_CPU_HAS_SUPPORT_VSX3 (cv::checkHardwareSupport(CV_CPU_VSX3))
# define CV_CPU_CALL_VSX3(fn, args) if (CV_CPU_HAS_SUPPORT_VSX3) return (opt_VSX3::fn args)
# define CV_CPU_CALL_VSX3_(fn, args) if (CV_CPU_HAS_SUPPORT_VSX3) return (opt_VSX3::fn args)
#else
# define CV_TRY_VSX3 0
# define CV_CPU_FORCE_VSX3 0
# define CV_CPU_HAS_SUPPORT_VSX3 0
# define CV_CPU_CALL_VSX3(fn, args)
# define CV_CPU_CALL_VSX3_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_VSX3(fn, args, mode, ...) CV_CPU_CALL_VSX3(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#define CV_CPU_CALL_BASELINE(fn, args) return (cpu_baseline::fn args)
#define __CV_CPU_DISPATCH_CHAIN_BASELINE(fn, args, mode, ...) CV_CPU_CALL_BASELINE(fn, args) /* last in sequence */
+602 -80
View File
@@ -42,12 +42,131 @@
//
//M*/
#ifndef __OPENCV_CORE_CVDEF_H__
#define __OPENCV_CORE_CVDEF_H__
#ifndef OPENCV_CORE_CVDEF_H
#define OPENCV_CORE_CVDEF_H
#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
# define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
//! @addtogroup core_utils
//! @{
#if !defined CV_DOXYGEN && !defined CV_IGNORE_DEBUG_BUILD_GUARD
#if (defined(_MSC_VER) && (defined(DEBUG) || defined(_DEBUG))) || \
(defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_DEBUG_PEDANTIC))
// Guard to prevent using of binary incompatible binaries / runtimes
// https://github.com/opencv/opencv/pull/9161
#define CV__DEBUG_NS_BEGIN namespace debug_build_guard {
#define CV__DEBUG_NS_END }
namespace cv { namespace debug_build_guard { } using namespace debug_build_guard; }
#endif
#endif
#ifndef CV__DEBUG_NS_BEGIN
#define CV__DEBUG_NS_BEGIN
#define CV__DEBUG_NS_END
#endif
#ifdef __OPENCV_BUILD
#include "cvconfig.h"
#endif
#ifndef __CV_EXPAND
#define __CV_EXPAND(x) x
#endif
#ifndef __CV_CAT
#define __CV_CAT__(x, y) x ## y
#define __CV_CAT_(x, y) __CV_CAT__(x, y)
#define __CV_CAT(x, y) __CV_CAT_(x, y)
#endif
#define __CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
#define __CV_VA_NUM_ARGS(...) __CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#if defined __GNUC__
#define CV_Func __func__
#elif defined _MSC_VER
#define CV_Func __FUNCTION__
#else
#define CV_Func ""
#endif
//! @cond IGNORED
//////////////// static assert /////////////////
#define CVAUX_CONCAT_EXP(a, b) a##b
#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b)
#if defined(__clang__)
# ifndef __has_extension
# define __has_extension __has_feature /* compatibility, for older versions of clang */
# endif
# if __has_extension(cxx_static_assert)
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
# elif __has_extension(c_static_assert)
# define CV_StaticAssert(condition, reason) _Static_assert((condition), reason " " #condition)
# endif
#elif defined(__GNUC__)
# if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
# endif
#elif defined(_MSC_VER)
# if _MSC_VER >= 1600 /* MSVC 10 */
# define CV_StaticAssert(condition, reason) static_assert((condition), reason " " #condition)
# endif
#endif
#ifndef CV_StaticAssert
# if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302)
# define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
# else
template <bool x> struct CV_StaticAssert_failed;
template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
template<int x> struct CV_StaticAssert_test {};
# define CV_StaticAssert(condition, reason)\
typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
# endif
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
#define CV_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
#define CV_DO_PRAGMA(x) _Pragma (#x)
#else
#define CV_DO_PRAGMA(x)
#endif
#ifdef _MSC_VER
#define CV_SUPPRESS_DEPRECATED_START \
CV_DO_PRAGMA(warning(push)) \
CV_DO_PRAGMA(warning(disable: 4996))
#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(warning(pop))
#elif defined (__clang__) || ((__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 405))
#define CV_SUPPRESS_DEPRECATED_START \
CV_DO_PRAGMA(GCC diagnostic push) \
CV_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(GCC diagnostic pop)
#else
#define CV_SUPPRESS_DEPRECATED_START
#define CV_SUPPRESS_DEPRECATED_END
#endif
#define CV_UNUSED(name) (void)name
#if defined __GNUC__ && !defined __EXCEPTIONS
#define CV_TRY
#define CV_CATCH(A, B) for (A B; false; )
#define CV_CATCH_ALL if (false)
#define CV_THROW(A) abort()
#define CV_RETHROW() abort()
#else
#define CV_TRY try
#define CV_CATCH(A, B) catch(const A & B)
#define CV_CATCH_ALL catch(...)
#define CV_THROW(A) throw A
#define CV_RETHROW() throw
#endif
//! @endcond
// undef problematic defines sometimes defined by system headers (windows.h in particular)
#undef small
@@ -56,20 +175,205 @@
#undef abs
#undef Complex
#include "opencv2/hal/defs.h"
#include <limits.h>
#include "opencv2/core/hal/interface.h"
#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_DISABLE_OPTIMIZATION || (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_FP16 9
#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 // deprecated
#define CV_CPU_AVX_512IFMA 18
#define CV_CPU_AVX_512PF 19
#define CV_CPU_AVX_512VBMI 20
#define CV_CPU_AVX_512VL 21
#define CV_CPU_NEON 100
#define CV_CPU_VSX 200
#define CV_CPU_VSX3 201
// CPU features groups
#define CV_CPU_AVX512_SKX 256
// when adding to this list remember to update the following enum
#define CV_HARDWARE_MAX_FEATURE 512
/** @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_FP16 = 9,
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, // deprecated
CPU_AVX_512IFMA = 18,
CPU_AVX_512PF = 19,
CPU_AVX_512VBMI = 20,
CPU_AVX_512VL = 21,
CPU_NEON = 100,
CPU_VSX = 200,
CPU_VSX3 = 201,
CPU_AVX512_SKX = 256, //!< Skylake-X with AVX-512F/CD/BW/DQ/VL
CPU_MAX_FEATURE = 512 // see CV_HARDWARE_MAX_FEATURE
};
#include "cv_cpu_dispatch.h"
/* fundamental constants */
#define CV_PI 3.1415926535897932384626433832795
#define CV_2PI 6.283185307179586476925286766559
#define CV_LOG2 0.69314718055994530941723212145818
#if defined __ARM_FP16_FORMAT_IEEE \
&& !defined __CUDACC__
# define CV_FP16_TYPE 1
#else
# define CV_FP16_TYPE 0
#endif
typedef union Cv16suf
{
short i;
ushort u;
#if CV_FP16_TYPE
__fp16 h;
#endif
}
Cv16suf;
typedef union Cv32suf
{
int i;
unsigned u;
float f;
}
Cv32suf;
typedef union Cv64suf
{
int64 i;
uint64 u;
double f;
}
Cv64suf;
#define OPENCV_ABI_COMPATIBILITY 300
#ifdef __OPENCV_BUILD
# define DISABLE_OPENCV_24_COMPATIBILITY
# define OPENCV_DISABLE_DEPRECATED_COMPATIBILITY
#endif
#if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
# define CV_EXPORTS __declspec(dllexport)
#elif defined __GNUC__ && __GNUC__ >= 4
# define CV_EXPORTS __attribute__ ((visibility ("default")))
#else
# define CV_EXPORTS
#ifdef CVAPI_EXPORTS
# if (defined _WIN32 || defined WINCE || defined __CYGWIN__)
# define CV_EXPORTS __declspec(dllexport)
# elif defined __GNUC__ && __GNUC__ >= 4
# define CV_EXPORTS __attribute__ ((visibility ("default")))
# endif
#endif
#ifndef CV_EXPORTS
# define CV_EXPORTS
#endif
#ifdef _MSC_VER
# define CV_EXPORTS_TEMPLATE
#else
# define CV_EXPORTS_TEMPLATE CV_EXPORTS
#endif
#ifndef CV_DEPRECATED
# if defined(__GNUC__)
# define CV_DEPRECATED __attribute__ ((deprecated))
# elif defined(_MSC_VER)
# define CV_DEPRECATED __declspec(deprecated)
# else
# define CV_DEPRECATED
# endif
#endif
#ifndef CV_DEPRECATED_EXTERNAL
# if defined(__OPENCV_BUILD)
# define CV_DEPRECATED_EXTERNAL /* nothing */
# else
# define CV_DEPRECATED_EXTERNAL CV_DEPRECATED
# endif
#endif
#ifndef CV_EXTERN_C
# ifdef __cplusplus
# define CV_EXTERN_C extern "C"
@@ -94,67 +398,6 @@
* Matrix type (Mat) *
\****************************************************************************************/
#define CV_CN_MAX 512
#define CV_CN_SHIFT 3
#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
#define CV_8U 0
#define CV_8S 1
#define CV_16U 2
#define CV_16S 3
#define CV_32S 4
#define CV_32F 5
#define CV_64F 6
#define CV_USRTYPE1 7
#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
@@ -167,12 +410,12 @@
#define CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
#define CV_IS_SUBMAT(flags) ((flags) & CV_MAT_SUBMAT_FLAG)
/* Size of each channel item,
0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
/** Size of each channel item,
0x8442211 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
#define CV_ELEM_SIZE1(type) \
((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
/* 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
/** 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
#define CV_ELEM_SIZE(type) \
(CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
@@ -184,14 +427,42 @@
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
/****************************************************************************************\
* static analysys *
\****************************************************************************************/
// In practice, some macro are not processed correctly (noreturn is not detected).
// We need to use simplified definition for them.
#ifndef CV_STATIC_ANALYSIS
# if defined(__KLOCWORK__) || defined(__clang_analyzer__) || defined(__COVERITY__)
# define CV_STATIC_ANALYSIS 1
# endif
#else
# if defined(CV_STATIC_ANALYSIS) && !(__CV_CAT(1, CV_STATIC_ANALYSIS) == 1) // defined and not empty
# if 0 == CV_STATIC_ANALYSIS
# undef CV_STATIC_ANALYSIS
# endif
# endif
#endif
/****************************************************************************************\
* Thread sanitizer *
\****************************************************************************************/
#ifndef CV_THREAD_SANITIZER
# if defined(__has_feature)
# if __has_feature(thread_sanitizer)
# define CV_THREAD_SANITIZER
# endif
# endif
#endif
/****************************************************************************************\
* exchange-add operation for atomic operations on reference counters *
\****************************************************************************************/
#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32)
// atomic increment on the linux version of the Intel(tm) compiler
# define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(addr)), delta)
#elif defined __GNUC__
#ifdef CV_XADD
// allow to use user-defined macro
#elif defined __GNUC__ || defined __clang__
# if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__)
# ifdef __ATOMIC_ACQ_REL
# define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
@@ -228,4 +499,255 @@
# endif
#endif
#endif // __OPENCV_CORE_CVDEF_H__
/****************************************************************************************\
* CV_NODISCARD attribute *
* encourages the compiler to issue a warning if the return value is discarded (C++17) *
\****************************************************************************************/
#ifndef CV_NODISCARD
# if defined(__GNUC__)
# define CV_NODISCARD __attribute__((__warn_unused_result__)) // at least available with GCC 3.4
# elif defined(__clang__) && defined(__has_attribute)
# if __has_attribute(__warn_unused_result__)
# define CV_NODISCARD __attribute__((__warn_unused_result__))
# endif
# endif
#endif
#ifndef CV_NODISCARD
# define CV_NODISCARD /* nothing by default */
#endif
/****************************************************************************************\
* C++ 11 *
\****************************************************************************************/
#ifndef CV_CXX11
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
# define CV_CXX11 1
# endif
#else
# if CV_CXX11 == 0
# undef CV_CXX11
# endif
#endif
/****************************************************************************************\
* C++ Move semantics *
\****************************************************************************************/
#ifndef CV_CXX_MOVE_SEMANTICS
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
# define CV_CXX_MOVE_SEMANTICS 1
# elif defined(__clang)
# if __has_feature(cxx_rvalue_references)
# define CV_CXX_MOVE_SEMANTICS 1
# endif
# endif
#else
# if CV_CXX_MOVE_SEMANTICS == 0
# undef CV_CXX_MOVE_SEMANTICS
# endif
#endif
/****************************************************************************************\
* C++11 std::array *
\****************************************************************************************/
#ifndef CV_CXX_STD_ARRAY
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
# define CV_CXX_STD_ARRAY 1
# include <array>
# endif
#else
# if CV_CXX_STD_ARRAY == 0
# undef CV_CXX_STD_ARRAY
# endif
#endif
/****************************************************************************************\
* C++11 override / final *
\****************************************************************************************/
#ifndef CV_OVERRIDE
# ifdef CV_CXX11
# define CV_OVERRIDE override
# endif
#endif
#ifndef CV_OVERRIDE
# define CV_OVERRIDE
#endif
#ifndef CV_FINAL
# ifdef CV_CXX11
# define CV_FINAL final
# endif
#endif
#ifndef CV_FINAL
# define CV_FINAL
#endif
// Integer types portatibility
#ifdef OPENCV_STDINT_HEADER
#include OPENCV_STDINT_HEADER
#elif defined(__cplusplus)
#if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */
namespace cv {
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
}
#elif defined(_MSC_VER) || __cplusplus >= 201103L
#include <cstdint>
namespace cv {
using std::int8_t;
using std::uint8_t;
using std::int16_t;
using std::uint16_t;
using std::int32_t;
using std::uint32_t;
using std::int64_t;
using std::uint64_t;
}
#else
#include <stdint.h>
namespace cv {
typedef ::int8_t int8_t;
typedef ::uint8_t uint8_t;
typedef ::int16_t int16_t;
typedef ::uint16_t uint16_t;
typedef ::int32_t int32_t;
typedef ::uint32_t uint32_t;
typedef ::int64_t int64_t;
typedef ::uint64_t uint64_t;
}
#endif
#else // pure C
#include <stdint.h>
#endif
#ifdef __cplusplus
namespace cv
{
class float16_t
{
public:
#if CV_FP16_TYPE
float16_t() {}
explicit float16_t(float x) { h = (__fp16)x; }
operator float() const { return (float)h; }
static float16_t fromBits(ushort w)
{
Cv16suf u;
u.u = w;
float16_t result;
result.h = u.h;
return result;
}
static float16_t zero()
{
float16_t result;
result.h = (__fp16)0;
return result;
}
ushort bits() const
{
Cv16suf u;
u.h = h;
return u.u;
}
protected:
__fp16 h;
#else
float16_t() {}
explicit float16_t(float x)
{
#if CV_AVX2
__m128 v = _mm_load_ss(&x);
w = (ushort)_mm_cvtsi128_si32(_mm_cvtps_ph(v, 0));
#else
Cv32suf in;
in.f = x;
unsigned sign = in.u & 0x80000000;
in.u ^= sign;
if( in.u >= 0x47800000 )
w = (ushort)(in.u > 0x7f800000 ? 0x7e00 : 0x7c00);
else
{
if (in.u < 0x38800000)
{
in.f += 0.5f;
w = (ushort)(in.u - 0x3f000000);
}
else
{
unsigned t = in.u + 0xc8000fff;
w = (ushort)((t + ((in.u >> 13) & 1)) >> 13);
}
}
w = (ushort)(w | (sign >> 16));
#endif
}
operator float() const
{
#if CV_AVX2
float f;
_mm_store_ss(&f, _mm_cvtph_ps(_mm_cvtsi32_si128(w)));
return f;
#else
Cv32suf out;
unsigned t = ((w & 0x7fff) << 13) + 0x38000000;
unsigned sign = (w & 0x8000) << 16;
unsigned e = w & 0x7c00;
out.u = t + (1 << 23);
out.u = (e >= 0x7c00 ? t + 0x38000000 :
e == 0 ? (out.f -= 6.103515625e-05f, out.u) : t) | sign;
return out.f;
#endif
}
static float16_t fromBits(ushort b)
{
float16_t result;
result.w = b;
return result;
}
static float16_t zero()
{
float16_t result;
result.w = (ushort)0;
return result;
}
ushort bits() const { return w; }
protected:
ushort w;
#endif
};
}
#endif
//! @}
#ifndef __cplusplus
#include "opencv2/core/fast_math.hpp" // define cvRound(double)
#endif
#endif // OPENCV_CORE_CVDEF_H
+37 -56
View File
@@ -41,25 +41,21 @@
//
//M*/
#ifndef __OPENCV_CORE_CVSTD_HPP__
#define __OPENCV_CORE_CVSTD_HPP__
#ifndef OPENCV_CORE_CVSTD_HPP
#define OPENCV_CORE_CVSTD_HPP
#ifndef __cplusplus
# error cvstd.hpp header must be compiled as C++
#endif
#include "opencv2/core/cvdef.h"
#include <cstddef>
#include <cstring>
#include <cctype>
#ifndef OPENCV_NOSTL
# include <string>
#endif
#include <string>
// import useful primitives from stl
#ifndef OPENCV_NOSTL_TRANSITIONAL
# include <algorithm>
# include <utility>
# include <cstdlib> //for abs(int)
@@ -67,6 +63,11 @@
namespace cv
{
static inline uchar abs(uchar a) { return a; }
static inline ushort abs(ushort a) { return a; }
static inline unsigned abs(unsigned a) { return a; }
static inline uint64 abs(uint64 a) { return a; }
using std::min;
using std::max;
using std::abs;
@@ -77,29 +78,6 @@ namespace cv
using std::log;
}
namespace std
{
static inline uchar abs(uchar a) { return a; }
static inline ushort abs(ushort a) { return a; }
static inline unsigned abs(unsigned a) { return a; }
static inline uint64 abs(uint64 a) { return a; }
}
#else
namespace cv
{
template<typename T> static inline T min(T a, T b) { return a < b ? a : b; }
template<typename T> static inline T max(T a, T b) { return a > b ? a : b; }
template<typename T> static inline T abs(T a) { return a < 0 ? -a : a; }
template<typename T> static inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
template<> inline uchar abs(uchar a) { return a; }
template<> inline ushort abs(ushort a) { return a; }
template<> inline unsigned abs(unsigned a) { return a; }
template<> inline uint64 abs(uint64 a) { return a; }
}
#endif
namespace cv {
//! @addtogroup core_utils
@@ -411,6 +389,11 @@ struct Ptr
template<typename Y>
Ptr<Y> dynamicCast() const;
#ifdef CV_CXX_MOVE_SEMANTICS
Ptr(Ptr&& o);
Ptr& operator = (Ptr&& o);
#endif
private:
detail::PtrOwner* owner;
T* stored;
@@ -487,7 +470,7 @@ public:
static const size_t npos = size_t(-1);
explicit String();
String();
String(const String& str);
String(const String& str, size_t pos, size_t len = npos);
String(const char* s);
@@ -554,7 +537,6 @@ public:
String toLowerCase() const;
#ifndef OPENCV_NOSTL
String(const std::string& str);
String(const std::string& str, size_t pos, size_t len = npos);
String& operator=(const std::string& str);
@@ -563,7 +545,6 @@ public:
friend String operator+ (const String& lhs, const std::string& rhs);
friend String operator+ (const std::string& lhs, const String& rhs);
#endif
private:
char* cstr_;
@@ -571,6 +552,8 @@ private:
char* allocate(size_t len); // len without trailing 0
void deallocate();
String(int); // disabled and invalid. Catch invalid usages like, commandLineParser.has(0) problem
};
//! @} core_basic
@@ -615,6 +598,7 @@ String::String(const char* s)
{
if (!s) return;
size_t len = strlen(s);
if (!len) return;
memcpy(allocate(len), s, len);
}
@@ -623,6 +607,7 @@ String::String(const char* s, size_t n)
: cstr_(0), len_(0)
{
if (!n) return;
if (!s) return;
memcpy(allocate(n), s, n);
}
@@ -630,6 +615,7 @@ inline
String::String(size_t n, char c)
: cstr_(0), len_(0)
{
if (!n) return;
memset(allocate(n), c, n);
}
@@ -638,6 +624,7 @@ String::String(const char* first, const char* last)
: cstr_(0), len_(0)
{
size_t len = (size_t)(last - first);
if (!len) return;
memcpy(allocate(len), first, len);
}
@@ -646,6 +633,7 @@ String::String(Iterator first, Iterator last)
: cstr_(0), len_(0)
{
size_t len = (size_t)(last - first);
if (!len) return;
char* str = allocate(len);
while (first != last)
{
@@ -678,7 +666,7 @@ String& String::operator=(const char* s)
deallocate();
if (!s) return *this;
size_t len = strlen(s);
memcpy(allocate(len), s, len);
if (len) memcpy(allocate(len), s, len);
return *this;
}
@@ -744,7 +732,7 @@ const char* String::begin() const
inline
const char* String::end() const
{
return len_ ? cstr_ + 1 : 0;
return len_ ? cstr_ + len_ : NULL;
}
inline
@@ -896,6 +884,7 @@ size_t String::find_first_of(const String& str, size_t pos) const
inline
size_t String::find_first_of(const char* s, size_t pos) const
{
if (len_ == 0) return npos;
if (pos >= len_ || !s[0]) return npos;
const char* lmax = cstr_ + len_;
for (const char* i = cstr_ + pos; i < lmax; ++i)
@@ -910,6 +899,7 @@ size_t String::find_first_of(const char* s, size_t pos) const
inline
size_t String::find_last_of(const char* s, size_t pos, size_t n) const
{
if (len_ == 0) return npos;
if (pos >= len_) pos = len_ - 1;
for (const char* i = cstr_ + pos; i >= cstr_; --i)
{
@@ -935,6 +925,7 @@ size_t String::find_last_of(const String& str, size_t pos) const
inline
size_t String::find_last_of(const char* s, size_t pos) const
{
if (len_ == 0) return npos;
if (pos >= len_) pos = len_ - 1;
for (const char* i = cstr_ + pos; i >= cstr_; --i)
{
@@ -948,8 +939,9 @@ size_t String::find_last_of(const char* s, size_t pos) const
inline
String String::toLowerCase() const
{
if (!cstr_)
return String();
String res(cstr_, len_);
for (size_t i = 0; i < len_; ++i)
res.cstr_[i] = (char) ::tolower(cstr_[i]);
@@ -968,8 +960,8 @@ String operator + (const String& lhs, const String& rhs)
{
String s;
s.allocate(lhs.len_ + rhs.len_);
memcpy(s.cstr_, lhs.cstr_, lhs.len_);
memcpy(s.cstr_ + lhs.len_, rhs.cstr_, rhs.len_);
if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_);
if (rhs.len_) memcpy(s.cstr_ + lhs.len_, rhs.cstr_, rhs.len_);
return s;
}
@@ -979,8 +971,8 @@ String operator + (const String& lhs, const char* rhs)
String s;
size_t rhslen = strlen(rhs);
s.allocate(lhs.len_ + rhslen);
memcpy(s.cstr_, lhs.cstr_, lhs.len_);
memcpy(s.cstr_ + lhs.len_, rhs, rhslen);
if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_);
if (rhslen) memcpy(s.cstr_ + lhs.len_, rhs, rhslen);
return s;
}
@@ -990,8 +982,8 @@ String operator + (const char* lhs, const String& rhs)
String s;
size_t lhslen = strlen(lhs);
s.allocate(lhslen + rhs.len_);
memcpy(s.cstr_, lhs, lhslen);
memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
if (lhslen) memcpy(s.cstr_, lhs, lhslen);
if (rhs.len_) memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
return s;
}
@@ -1000,7 +992,7 @@ String operator + (const String& lhs, char rhs)
{
String s;
s.allocate(lhs.len_ + 1);
memcpy(s.cstr_, lhs.cstr_, lhs.len_);
if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_);
s.cstr_[lhs.len_] = rhs;
return s;
}
@@ -1011,7 +1003,7 @@ String operator + (char lhs, const String& rhs)
String s;
s.allocate(rhs.len_ + 1);
s.cstr_[0] = lhs;
memcpy(s.cstr_ + 1, rhs.cstr_, rhs.len_);
if (rhs.len_) memcpy(s.cstr_ + 1, rhs.cstr_, rhs.len_);
return s;
}
@@ -1038,22 +1030,11 @@ static inline bool operator>= (const String& lhs, const char* rhs) { return lh
} // cv
#ifndef OPENCV_NOSTL_TRANSITIONAL
namespace std
{
static inline void swap(cv::String& a, cv::String& b) { a.swap(b); }
}
#else
namespace cv
{
template<> inline
void swap<cv::String>(cv::String& a, cv::String& b)
{
a.swap(b);
}
}
#endif
#include "opencv2/core/ptr.inl.hpp"
#endif //__OPENCV_CORE_CVSTD_HPP__
#endif //OPENCV_CORE_CVSTD_HPP
+53 -35
View File
@@ -41,19 +41,21 @@
//
//M*/
#ifndef __OPENCV_CORE_CVSTDINL_HPP__
#define __OPENCV_CORE_CVSTDINL_HPP__
#ifndef OPENCV_CORE_CVSTDINL_HPP
#define OPENCV_CORE_CVSTDINL_HPP
#ifndef OPENCV_NOSTL
# include <complex>
# include <ostream>
#endif
#include <complex>
#include <ostream>
//! @cond IGNORED
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4127 )
#endif
namespace cv
{
#ifndef OPENCV_NOSTL
template<typename _Tp> class DataType< std::complex<_Tp> >
{
@@ -75,11 +77,8 @@ inline
String::String(const std::string& str)
: cstr_(0), len_(0)
{
if (!str.empty())
{
size_t len = str.size();
memcpy(allocate(len), str.c_str(), len);
}
size_t len = str.size();
if (len) memcpy(allocate(len), str.c_str(), len);
}
inline
@@ -87,7 +86,7 @@ String::String(const std::string& str, size_t pos, size_t len)
: cstr_(0), len_(0)
{
size_t strlen = str.size();
pos = max(pos, strlen);
pos = min(pos, strlen);
len = min(strlen - pos, len);
if (!len) return;
memcpy(allocate(len), str.c_str() + pos, len);
@@ -97,11 +96,8 @@ inline
String& String::operator = (const std::string& str)
{
deallocate();
if (!str.empty())
{
size_t len = str.size();
memcpy(allocate(len), str.c_str(), len);
}
size_t len = str.size();
if (len) memcpy(allocate(len), str.c_str(), len);
return *this;
}
@@ -124,8 +120,8 @@ String operator + (const String& lhs, const std::string& rhs)
String s;
size_t rhslen = rhs.size();
s.allocate(lhs.len_ + rhslen);
memcpy(s.cstr_, lhs.cstr_, lhs.len_);
memcpy(s.cstr_ + lhs.len_, rhs.c_str(), rhslen);
if (lhs.len_) memcpy(s.cstr_, lhs.cstr_, lhs.len_);
if (rhslen) memcpy(s.cstr_ + lhs.len_, rhs.c_str(), rhslen);
return s;
}
@@ -135,8 +131,8 @@ String operator + (const std::string& lhs, const String& rhs)
String s;
size_t lhslen = lhs.size();
s.allocate(lhslen + rhs.len_);
memcpy(s.cstr_, lhs.c_str(), lhslen);
memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
if (lhslen) memcpy(s.cstr_, lhs.c_str(), lhslen);
if (rhs.len_) memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
return s;
}
@@ -151,9 +147,7 @@ FileNode::operator std::string() const
template<> inline
void operator >> (const FileNode& n, std::string& value)
{
String val;
read(n, val, val);
value = val;
read(n, value, std::string());
}
template<> inline
@@ -183,6 +177,18 @@ std::ostream& operator << (std::ostream& out, const Mat& mtx)
return out << Formatter::get()->format(mtx);
}
static inline
std::ostream& operator << (std::ostream& out, const UMat& m)
{
return out << m.getMat(ACCESS_READ);
}
template<typename _Tp> static inline
std::ostream& operator << (std::ostream& out, const Complex<_Tp>& c)
{
return out << "(" << c.re << "," << c.im << ")";
}
template<typename _Tp> static inline
std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
{
@@ -221,14 +227,7 @@ template<typename _Tp, int n> static inline
std::ostream& operator << (std::ostream& out, const Vec<_Tp, n>& vec)
{
out << "[";
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4127 )
#endif
if(Vec<_Tp, n>::depth < CV_32F)
#ifdef _MSC_VER
#pragma warning( pop )
#endif
if (cv::traits::Depth<_Tp>::value <= CV_32S)
{
for (int i = 0; i < n - 1; ++i) {
out << (int)vec[i] << ", ";
@@ -258,10 +257,29 @@ std::ostream& operator << (std::ostream& out, const Rect_<_Tp>& rect)
return out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]";
}
static inline std::ostream& operator << (std::ostream& out, const MatSize& msize)
{
int i, dims = msize.dims();
for( i = 0; i < dims; i++ )
{
out << msize[i];
if( i < dims-1 )
out << " x ";
}
return out;
}
static inline std::ostream &operator<< (std::ostream &s, cv::Range &r)
{
return s << "[" << r.start << " : " << r.end << ")";
}
#endif // OPENCV_NOSTL
} // cv
#ifdef _MSC_VER
#pragma warning( pop )
#endif
//! @endcond
#endif // __OPENCV_CORE_CVSTDINL_HPP__
#endif // OPENCV_CORE_CVSTDINL_HPP
+84 -5
View File
@@ -39,8 +39,8 @@
//
//M*/
#ifndef __OPENCV_CORE_DIRECTX_HPP__
#define __OPENCV_CORE_DIRECTX_HPP__
#ifndef OPENCV_CORE_DIRECTX_HPP
#define OPENCV_CORE_DIRECTX_HPP
#include "mat.hpp"
#include "ocl.hpp"
@@ -68,12 +68,38 @@ namespace ocl {
using namespace cv::ocl;
//! @addtogroup core_directx
// This section describes OpenCL and DirectX interoperability.
//
// To enable DirectX support, configure OpenCV using CMake with WITH_DIRECTX=ON . Note, DirectX is
// supported only on Windows.
//
// To use OpenCL functionality you should first initialize OpenCL context from DirectX resource.
//
//! @{
// TODO static functions in the Context class
//! @brief Creates OpenCL context from D3D11 device
//
//! @param pD3D11Device - pointer to D3D11 device
//! @return Returns reference to OpenCL Context
CV_EXPORTS Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device);
//! @brief Creates OpenCL context from D3D10 device
//
//! @param pD3D10Device - pointer to D3D10 device
//! @return Returns reference to OpenCL Context
CV_EXPORTS Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device);
//! @brief Creates OpenCL context from Direct3DDevice9Ex device
//
//! @param pDirect3DDevice9Ex - pointer to Direct3DDevice9Ex device
//! @return Returns reference to OpenCL Context
CV_EXPORTS Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDevice9Ex);
//! @brief Creates OpenCL context from Direct3DDevice9 device
//
//! @param pDirect3DDevice9 - pointer to Direct3Device9 device
//! @return Returns reference to OpenCL Context
CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9);
//! @}
@@ -83,23 +109,76 @@ CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDire
//! @addtogroup core_directx
//! @{
//! @brief Converts InputArray to ID3D11Texture2D. If destination texture format is DXGI_FORMAT_NV12 then
//! input UMat expected to be in BGR format and data will be downsampled and color-converted to NV12.
//
//! @note Note: Destination texture must be allocated by application. Function does memory copy from src to
//! pD3D11Texture2D
//
//! @param src - source InputArray
//! @param pD3D11Texture2D - destination D3D11 texture
CV_EXPORTS void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D);
//! @brief Converts ID3D11Texture2D to OutputArray. If input texture format is DXGI_FORMAT_NV12 then
//! data will be upsampled and color-converted to BGR format.
//
//! @note Note: Destination matrix will be re-allocated if it has not enough memory to match texture size.
//! function does memory copy from pD3D11Texture2D to dst
//
//! @param pD3D11Texture2D - source D3D11 texture
//! @param dst - destination OutputArray
CV_EXPORTS void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst);
//! @brief Converts InputArray to ID3D10Texture2D
//
//! @note Note: function does memory copy from src to
//! pD3D10Texture2D
//
//! @param src - source InputArray
//! @param pD3D10Texture2D - destination D3D10 texture
CV_EXPORTS void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D);
//! @brief Converts ID3D10Texture2D to OutputArray
//
//! @note Note: function does memory copy from pD3D10Texture2D
//! to dst
//
//! @param pD3D10Texture2D - source D3D10 texture
//! @param dst - destination OutputArray
CV_EXPORTS void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst);
//! @brief Converts InputArray to IDirect3DSurface9
//
//! @note Note: function does memory copy from src to
//! pDirect3DSurface9
//
//! @param src - source InputArray
//! @param pDirect3DSurface9 - destination D3D10 texture
//! @param surfaceSharedHandle - shared handle
CV_EXPORTS void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurface9, void* surfaceSharedHandle = NULL);
//! @brief Converts IDirect3DSurface9 to OutputArray
//
//! @note Note: function does memory copy from pDirect3DSurface9
//! to dst
//
//! @param pDirect3DSurface9 - source D3D10 texture
//! @param dst - destination OutputArray
//! @param surfaceSharedHandle - shared handle
CV_EXPORTS void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArray dst, void* surfaceSharedHandle = NULL);
// Get OpenCV type from DirectX type, return -1 if there is no equivalent
//! @brief Get OpenCV type from DirectX type
//! @param iDXGI_FORMAT - enum DXGI_FORMAT for D3D10/D3D11
//! @return OpenCV type or -1 if there is no equivalent
CV_EXPORTS int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT); // enum DXGI_FORMAT for D3D10/D3D11
// Get OpenCV type from DirectX type, return -1 if there is no equivalent
//! @brief Get OpenCV type from DirectX type
//! @param iD3DFORMAT - enum D3DTYPE for D3D9
//! @return OpenCV type or -1 if there is no equivalent
CV_EXPORTS int getTypeFromD3DFORMAT(const int iD3DFORMAT); // enum D3DTYPE for D3D9
//! @}
} } // namespace cv::directx
#endif // __OPENCV_CORE_DIRECTX_HPP__
#endif // OPENCV_CORE_DIRECTX_HPP
+39 -39
View File
@@ -42,8 +42,8 @@
//M*/
#ifndef __OPENCV_CORE_EIGEN_HPP__
#define __OPENCV_CORE_EIGEN_HPP__
#ifndef OPENCV_CORE_EIGEN_HPP
#define OPENCV_CORE_EIGEN_HPP
#include "opencv2/core.hpp"
@@ -60,18 +60,18 @@ namespace cv
//! @{
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, OutputArray dst )
{
if( !(src.Flags & Eigen::RowMajorBit) )
{
Mat _src(src.cols(), src.rows(), DataType<_Tp>::type,
(void*)src.data(), src.stride()*sizeof(_Tp));
Mat _src(src.cols(), src.rows(), traits::Type<_Tp>::value,
(void*)src.data(), src.outerStride()*sizeof(_Tp));
transpose(_src, dst);
}
else
{
Mat _src(src.rows(), src.cols(), DataType<_Tp>::type,
(void*)src.data(), src.stride()*sizeof(_Tp));
Mat _src(src.rows(), src.cols(), traits::Type<_Tp>::value,
(void*)src.data(), src.outerStride()*sizeof(_Tp));
_src.copyTo(dst);
}
}
@@ -98,8 +98,8 @@ void cv2eigen( const Mat& src,
CV_DbgAssert(src.rows == _rows && src.cols == _cols);
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else if( src.cols == src.rows )
@@ -112,8 +112,8 @@ void cv2eigen( const Mat& src,
}
else
{
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
@@ -125,14 +125,14 @@ void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
{
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(_cols, _rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(_cols, _rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(_rows, _cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(_rows, _cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
Mat(src).copyTo(_dst);
}
}
@@ -144,8 +144,8 @@ void cv2eigen( const Mat& src,
dst.resize(src.rows, src.cols);
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else if( src.cols == src.rows )
@@ -158,8 +158,8 @@ void cv2eigen( const Mat& src,
}
else
{
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
@@ -172,14 +172,14 @@ void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
dst.resize(_rows, _cols);
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(_cols, _rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(_cols, _rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(_rows, _cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(_rows, _cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
Mat(src).copyTo(_dst);
}
}
@@ -193,8 +193,8 @@ void cv2eigen( const Mat& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else
@@ -202,8 +202,8 @@ void cv2eigen( const Mat& src,
}
else
{
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
@@ -217,14 +217,14 @@ void cv2eigen( const Matx<_Tp, _rows, 1>& src,
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(1, _rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(1, _rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(_rows, 1, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(_rows, 1, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.copyTo(_dst);
}
}
@@ -238,8 +238,8 @@ void cv2eigen( const Mat& src,
dst.resize(src.cols);
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
if( src.type() == _dst.type() )
transpose(src, _dst);
else
@@ -247,8 +247,8 @@ void cv2eigen( const Mat& src,
}
else
{
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
src.convertTo(_dst, _dst.type());
}
}
@@ -261,14 +261,14 @@ void cv2eigen( const Matx<_Tp, 1, _cols>& src,
dst.resize(_cols);
if( !(dst.Flags & Eigen::RowMajorBit) )
{
const Mat _dst(_cols, 1, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(_cols, 1, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
transpose(src, _dst);
}
else
{
const Mat _dst(1, _cols, DataType<_Tp>::type,
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
const Mat _dst(1, _cols, traits::Type<_Tp>::value,
dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp)));
Mat(src).copyTo(_dst);
}
}
+271
View File
@@ -0,0 +1,271 @@
/*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"
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \
&& defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
#include <emmintrin.h>
#endif
//! @addtogroup core_utils
//! @{
/****************************************************************************************\
* fast math *
\****************************************************************************************/
#ifdef __cplusplus
# include <cmath>
#else
# ifdef __BORLANDC__
# include <fastmath.h>
# else
# include <math.h>
# endif
#endif
#ifdef HAVE_TEGRA_OPTIMIZATION
# include "tegra_round.hpp"
#endif
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__ && !defined(__CUDACC__)
// 1. general scheme
#define ARM_ROUND(_value, _asm_string) \
int res; \
float temp; \
CV_UNUSED(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
/** @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__) || CV_SSE2) && !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 defined ARM_ROUND_DBL
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 )
{
int i = (int)value;
return i - (i > value);
}
/** @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 )
{
int i = (int)value;
return i + (i < value);
}
/** @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__) || CV_SSE2) && !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 defined ARM_ROUND_FLT
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 )
{
int i = (int)value;
return i - (i > value);
}
/** @overload */
CV_INLINE int cvFloor( int value )
{
return value;
}
/** @overload */
CV_INLINE int cvCeil( float value )
{
int i = (int)value;
return i + (i < value);
}
/** @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
+250
View File
@@ -0,0 +1,250 @@
/*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/cvstd.hpp"
#include "opencv2/core/hal/interface.h"
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 void SVD32f(float* At, size_t astep, float* W, float* U, size_t ustep, float* Vt, size_t vstep, int m, int n, int flags);
CV_EXPORTS void SVD64f(double* At, size_t astep, double* W, double* U, size_t ustep, double* Vt, size_t vstep, int m, int n, int flags);
CV_EXPORTS int QR32f(float* A, size_t astep, int m, int n, int k, float* b, size_t bstep, float* hFactors);
CV_EXPORTS int QR64f(double* A, size_t astep, int m, int n, int k, double* b, size_t bstep, double* hFactors);
CV_EXPORTS void gemm32f(const float* src1, size_t src1_step, const float* src2, size_t src2_step,
float alpha, const float* src3, size_t src3_step, float beta, float* dst, size_t dst_step,
int m_a, int n_a, int n_d, int flags);
CV_EXPORTS void gemm64f(const double* src1, size_t src1_step, const double* src2, size_t src2_step,
double alpha, const double* src3, size_t src3_step, double beta, double* dst, size_t dst_step,
int m_a, int n_a, int n_d, int flags);
CV_EXPORTS void gemm32fc(const float* src1, size_t src1_step, const float* src2, size_t src2_step,
float alpha, const float* src3, size_t src3_step, float beta, float* dst, size_t dst_step,
int m_a, int n_a, int n_d, int flags);
CV_EXPORTS void gemm64fc(const double* src1, size_t src1_step, const double* src2, size_t src2_step,
double alpha, const double* src3, size_t src3_step, double beta, double* dst, size_t dst_step,
int m_a, int n_a, int n_d, int flags);
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 fastAtan32f(const float* y, const float* x, float* dst, int n, bool angleInDegrees);
CV_EXPORTS void fastAtan64f(const double* y, const double* x, double* 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 *, size_t, const uchar * src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip8s( const schar *, size_t, const schar * src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip16u( const ushort *, size_t, const ushort * src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip16s( const short *, size_t, const short * src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip32s( const int *, size_t, const int * src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip32f( const float *, size_t, const float * src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip64f( const double *, size_t, 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 );
struct CV_EXPORTS DFT1D
{
static Ptr<DFT1D> create(int len, int count, int depth, int flags, bool * useBuffer = 0);
virtual void apply(const uchar *src, uchar *dst) = 0;
virtual ~DFT1D() {}
};
struct CV_EXPORTS DFT2D
{
static Ptr<DFT2D> create(int width, int height, int depth,
int src_channels, int dst_channels,
int flags, int nonzero_rows = 0);
virtual void apply(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step) = 0;
virtual ~DFT2D() {}
};
struct CV_EXPORTS DCT2D
{
static Ptr<DCT2D> create(int width, int height, int depth, int flags);
virtual void apply(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step) = 0;
virtual ~DCT2D() {}
};
//! @} 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 fastAtan2(const float* y, const float* x, float* dst, int n, bool angleInDegrees);
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
+182
View File
@@ -0,0 +1,182 @@
#ifndef OPENCV_CORE_HAL_INTERFACE_H
#define OPENCV_CORE_HAL_INTERFACE_H
//! @addtogroup core_hal_interface
//! @{
//! @name Return codes
//! @{
#define CV_HAL_ERROR_OK 0
#define CV_HAL_ERROR_NOT_IMPLEMENTED 1
#define CV_HAL_ERROR_UNKNOWN -1
//! @}
#ifdef __cplusplus
#include <cstddef>
#else
#include <stddef.h>
#include <stdbool.h>
#endif
//! @name Data types
//! primitive types
//! - schar - signed 1 byte integer
//! - uchar - unsigned 1 byte integer
//! - short - signed 2 byte integer
//! - ushort - unsigned 2 byte integer
//! - int - signed 4 byte integer
//! - uint - unsigned 4 byte integer
//! - int64 - signed 8 byte integer
//! - uint64 - unsigned 8 byte integer
//! @{
#if !defined _MSC_VER && !defined __BORLANDC__
# if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__
# include <cstdint>
# ifdef __NEWLIB__
typedef unsigned int uint;
# else
typedef std::uint32_t uint;
# endif
# else
# include <stdint.h>
typedef uint32_t uint;
# endif
#else
typedef unsigned uint;
#endif
typedef signed char schar;
#ifndef __IPL_H__
typedef unsigned char uchar;
typedef unsigned short ushort;
#endif
#if defined _MSC_VER || defined __BORLANDC__
typedef __int64 int64;
typedef unsigned __int64 uint64;
# define CV_BIG_INT(n) n##I64
# define CV_BIG_UINT(n) n##UI64
#else
typedef int64_t int64;
typedef uint64_t uint64;
# define CV_BIG_INT(n) n##LL
# define CV_BIG_UINT(n) n##ULL
#endif
#define CV_CN_MAX 512
#define CV_CN_SHIFT 3
#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
#define CV_8U 0
#define CV_8S 1
#define CV_16U 2
#define CV_16S 3
#define CV_32S 4
#define CV_32F 5
#define CV_64F 6
#define CV_USRTYPE1 7
#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
//! @}
//! @name Comparison operation
//! @sa cv::CmpTypes
//! @{
#define CV_HAL_CMP_EQ 0
#define CV_HAL_CMP_GT 1
#define CV_HAL_CMP_GE 2
#define CV_HAL_CMP_LT 3
#define CV_HAL_CMP_LE 4
#define CV_HAL_CMP_NE 5
//! @}
//! @name Border processing modes
//! @sa cv::BorderTypes
//! @{
#define CV_HAL_BORDER_CONSTANT 0
#define CV_HAL_BORDER_REPLICATE 1
#define CV_HAL_BORDER_REFLECT 2
#define CV_HAL_BORDER_WRAP 3
#define CV_HAL_BORDER_REFLECT_101 4
#define CV_HAL_BORDER_TRANSPARENT 5
#define CV_HAL_BORDER_ISOLATED 16
//! @}
//! @name DFT flags
//! @{
#define CV_HAL_DFT_INVERSE 1
#define CV_HAL_DFT_SCALE 2
#define CV_HAL_DFT_ROWS 4
#define CV_HAL_DFT_COMPLEX_OUTPUT 16
#define CV_HAL_DFT_REAL_OUTPUT 32
#define CV_HAL_DFT_TWO_STAGE 64
#define CV_HAL_DFT_STAGE_COLS 128
#define CV_HAL_DFT_IS_CONTINUOUS 512
#define CV_HAL_DFT_IS_INPLACE 1024
//! @}
//! @name SVD flags
//! @{
#define CV_HAL_SVD_NO_UV 1
#define CV_HAL_SVD_SHORT_UV 2
#define CV_HAL_SVD_MODIFY_A 4
#define CV_HAL_SVD_FULL_UV 8
//! @}
//! @name Gemm flags
//! @{
#define CV_HAL_GEMM_1_T 1
#define CV_HAL_GEMM_2_T 2
#define CV_HAL_GEMM_3_T 4
//! @}
//! @}
#endif
+420
View File
@@ -0,0 +1,420 @@
/*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_INTRIN_HPP
#define OPENCV_HAL_INTRIN_HPP
#include <cmath>
#include <float.h>
#include <stdlib.h>
#include "opencv2/core/cvdef.h"
#define OPENCV_HAL_ADD(a, b) ((a) + (b))
#define OPENCV_HAL_AND(a, b) ((a) & (b))
#define OPENCV_HAL_NOP(a) (a)
#define OPENCV_HAL_1ST(a, b) (a)
// unlike HAL API, which is in cv::hal,
// we put intrinsics into cv namespace to make its
// access from within opencv code more accessible
namespace cv {
namespace hal {
enum StoreMode
{
STORE_UNALIGNED = 0,
STORE_ALIGNED = 1,
STORE_ALIGNED_NOCACHE = 2
};
}
template<typename _Tp> struct V_TypeTraits
{
};
#define CV_INTRIN_DEF_TYPE_TRAITS(type, int_type_, uint_type_, abs_type_, w_type_, q_type_, sum_type_, nlanes128_) \
template<> struct V_TypeTraits<type> \
{ \
typedef type value_type; \
typedef int_type_ int_type; \
typedef abs_type_ abs_type; \
typedef uint_type_ uint_type; \
typedef w_type_ w_type; \
typedef q_type_ q_type; \
typedef sum_type_ sum_type; \
enum { nlanes128 = nlanes128_ }; \
\
static inline int_type reinterpret_int(type x) \
{ \
union { type l; int_type i; } v; \
v.l = x; \
return v.i; \
} \
\
static inline type reinterpret_from_int(int_type x) \
{ \
union { type l; int_type i; } v; \
v.i = x; \
return v.l; \
} \
}
CV_INTRIN_DEF_TYPE_TRAITS(uchar, schar, uchar, uchar, ushort, unsigned, unsigned, 16);
CV_INTRIN_DEF_TYPE_TRAITS(schar, schar, uchar, uchar, short, int, int, 16);
CV_INTRIN_DEF_TYPE_TRAITS(ushort, short, ushort, ushort, unsigned, uint64, unsigned, 8);
CV_INTRIN_DEF_TYPE_TRAITS(short, short, ushort, ushort, int, int64, int, 8);
CV_INTRIN_DEF_TYPE_TRAITS(unsigned, int, unsigned, unsigned, uint64, void, unsigned, 4);
CV_INTRIN_DEF_TYPE_TRAITS(int, int, unsigned, unsigned, int64, void, int, 4);
CV_INTRIN_DEF_TYPE_TRAITS(float, int, unsigned, float, double, void, float, 4);
CV_INTRIN_DEF_TYPE_TRAITS(uint64, int64, uint64, uint64, void, void, uint64, 2);
CV_INTRIN_DEF_TYPE_TRAITS(int64, int64, uint64, uint64, void, void, int64, 2);
CV_INTRIN_DEF_TYPE_TRAITS(double, int64, uint64, double, void, void, double, 2);
#ifndef CV_DOXYGEN
#ifdef CV_CPU_DISPATCH_MODE
#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE __CV_CAT(hal_, CV_CPU_DISPATCH_MODE)
#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN namespace __CV_CAT(hal_, CV_CPU_DISPATCH_MODE) {
#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END }
#else
#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE hal_baseline
#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN namespace hal_baseline {
#define CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END }
#endif
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END
using namespace CV_CPU_OPTIMIZATION_HAL_NAMESPACE;
#endif
}
#ifdef CV_DOXYGEN
# undef CV_AVX2
# undef CV_SSE2
# undef CV_NEON
# undef CV_VSX
# undef CV_FP16
#endif
#if CV_SSE2 || CV_NEON || CV_VSX
#define CV__SIMD_FORWARD 128
#include "opencv2/core/hal/intrin_forward.hpp"
#endif
#if CV_SSE2
#include "opencv2/core/hal/intrin_sse_em.hpp"
#include "opencv2/core/hal/intrin_sse.hpp"
#elif CV_NEON
#include "opencv2/core/hal/intrin_neon.hpp"
#elif CV_VSX
#include "opencv2/core/hal/intrin_vsx.hpp"
#else
#define CV_SIMD128_CPP 1
#include "opencv2/core/hal/intrin_cpp.hpp"
#endif
// AVX2 can be used together with SSE2, so
// we define those two sets of intrinsics at once.
// Most of the intrinsics do not conflict (the proper overloaded variant is
// resolved by the argument types, e.g. v_float32x4 ~ SSE2, v_float32x8 ~ AVX2),
// but some of AVX2 intrinsics get v256_ prefix instead of v_, e.g. v256_load() vs v_load().
// Correspondingly, the wide intrinsics (which are mapped to the "widest"
// available instruction set) will get vx_ prefix
// (and will be mapped to v256_ counterparts) (e.g. vx_load() => v256_load())
#if CV_AVX2
#define CV__SIMD_FORWARD 256
#include "opencv2/core/hal/intrin_forward.hpp"
#include "opencv2/core/hal/intrin_avx.hpp"
#endif
//! @cond IGNORED
namespace cv {
#ifndef CV_DOXYGEN
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN
#endif
#ifndef CV_SIMD128
#define CV_SIMD128 0
#endif
#ifndef CV_SIMD128_64F
#define CV_SIMD128_64F 0
#endif
#ifndef CV_SIMD256
#define CV_SIMD256 0
#endif
#ifndef CV_SIMD256_64F
#define CV_SIMD256_64F 0
#endif
#ifndef CV_SIMD512
#define CV_SIMD512 0
#endif
#ifndef CV_SIMD512_64F
#define CV_SIMD512_64F 0
#endif
#ifndef CV_SIMD128_FP16
#define CV_SIMD128_FP16 0
#endif
#ifndef CV_SIMD256_FP16
#define CV_SIMD256_FP16 0
#endif
#ifndef CV_SIMD512_FP16
#define CV_SIMD512_FP16 0
#endif
//==================================================================================================
#define CV_INTRIN_DEFINE_WIDE_INTRIN(typ, vtyp, short_typ, prefix, loadsfx) \
inline vtyp vx_setall_##short_typ(typ v) { return prefix##_setall_##short_typ(v); } \
inline vtyp vx_setzero_##short_typ() { return prefix##_setzero_##short_typ(); } \
inline vtyp vx_##loadsfx(const typ* ptr) { return prefix##_##loadsfx(ptr); } \
inline vtyp vx_##loadsfx##_aligned(const typ* ptr) { return prefix##_##loadsfx##_aligned(ptr); } \
inline vtyp vx_##loadsfx##_low(const typ* ptr) { return prefix##_##loadsfx##_low(ptr); } \
inline vtyp vx_##loadsfx##_halves(const typ* ptr0, const typ* ptr1) { return prefix##_##loadsfx##_halves(ptr0, ptr1); } \
inline void vx_store(typ* ptr, const vtyp& v) { return v_store(ptr, v); } \
inline void vx_store_aligned(typ* ptr, const vtyp& v) { return v_store_aligned(ptr, v); }
#define CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(typ, wtyp, prefix) \
inline wtyp vx_load_expand(const typ* ptr) { return prefix##_load_expand(ptr); }
#define CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND_Q(typ, qtyp, prefix) \
inline qtyp vx_load_expand_q(const typ* ptr) { return prefix##_load_expand_q(ptr); }
#define CV_INTRIN_DEFINE_WIDE_INTRIN_WITH_EXPAND(typ, vtyp, short_typ, wtyp, qtyp, prefix, loadsfx) \
CV_INTRIN_DEFINE_WIDE_INTRIN(typ, vtyp, short_typ, prefix, loadsfx) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(typ, wtyp, prefix) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND_Q(typ, qtyp, prefix)
#define CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(prefix) \
CV_INTRIN_DEFINE_WIDE_INTRIN_WITH_EXPAND(uchar, v_uint8, u8, v_uint16, v_uint32, prefix, load) \
CV_INTRIN_DEFINE_WIDE_INTRIN_WITH_EXPAND(schar, v_int8, s8, v_int16, v_int32, prefix, load) \
CV_INTRIN_DEFINE_WIDE_INTRIN(ushort, v_uint16, u16, prefix, load) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(ushort, v_uint32, prefix) \
CV_INTRIN_DEFINE_WIDE_INTRIN(short, v_int16, s16, prefix, load) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(short, v_int32, prefix) \
CV_INTRIN_DEFINE_WIDE_INTRIN(int, v_int32, s32, prefix, load) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(int, v_int64, prefix) \
CV_INTRIN_DEFINE_WIDE_INTRIN(unsigned, v_uint32, u32, prefix, load) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(unsigned, v_uint64, prefix) \
CV_INTRIN_DEFINE_WIDE_INTRIN(float, v_float32, f32, prefix, load) \
CV_INTRIN_DEFINE_WIDE_INTRIN(int64, v_int64, s64, prefix, load) \
CV_INTRIN_DEFINE_WIDE_INTRIN(uint64, v_uint64, u64, prefix, load) \
CV_INTRIN_DEFINE_WIDE_LOAD_EXPAND(float16_t, v_float32, prefix)
template<typename _Tp> struct V_RegTraits
{
};
#define CV_DEF_REG_TRAITS(prefix, _reg, lane_type, suffix, _u_reg, _w_reg, _q_reg, _int_reg, _round_reg) \
template<> struct V_RegTraits<_reg> \
{ \
typedef _reg reg; \
typedef _u_reg u_reg; \
typedef _w_reg w_reg; \
typedef _q_reg q_reg; \
typedef _int_reg int_reg; \
typedef _round_reg round_reg; \
}
#if CV_SIMD128 || CV_SIMD128_CPP
CV_DEF_REG_TRAITS(v, v_uint8x16, uchar, u8, v_uint8x16, v_uint16x8, v_uint32x4, v_int8x16, void);
CV_DEF_REG_TRAITS(v, v_int8x16, schar, s8, v_uint8x16, v_int16x8, v_int32x4, v_int8x16, void);
CV_DEF_REG_TRAITS(v, v_uint16x8, ushort, u16, v_uint16x8, v_uint32x4, v_uint64x2, v_int16x8, void);
CV_DEF_REG_TRAITS(v, v_int16x8, short, s16, v_uint16x8, v_int32x4, v_int64x2, v_int16x8, void);
CV_DEF_REG_TRAITS(v, v_uint32x4, unsigned, u32, v_uint32x4, v_uint64x2, void, v_int32x4, void);
CV_DEF_REG_TRAITS(v, v_int32x4, int, s32, v_uint32x4, v_int64x2, void, v_int32x4, void);
#if CV_SIMD128_64F
CV_DEF_REG_TRAITS(v, v_float32x4, float, f32, v_float32x4, v_float64x2, void, v_int32x4, v_int32x4);
#else
CV_DEF_REG_TRAITS(v, v_float32x4, float, f32, v_float32x4, void, void, v_int32x4, v_int32x4);
#endif
CV_DEF_REG_TRAITS(v, v_uint64x2, uint64, u64, v_uint64x2, void, void, v_int64x2, void);
CV_DEF_REG_TRAITS(v, v_int64x2, int64, s64, v_uint64x2, void, void, v_int64x2, void);
#if CV_SIMD128_64F
CV_DEF_REG_TRAITS(v, v_float64x2, double, f64, v_float64x2, void, void, v_int64x2, v_int32x4);
#endif
#endif
#if CV_SIMD256
CV_DEF_REG_TRAITS(v256, v_uint8x32, uchar, u8, v_uint8x32, v_uint16x16, v_uint32x8, v_int8x32, void);
CV_DEF_REG_TRAITS(v256, v_int8x32, schar, s8, v_uint8x32, v_int16x16, v_int32x8, v_int8x32, void);
CV_DEF_REG_TRAITS(v256, v_uint16x16, ushort, u16, v_uint16x16, v_uint32x8, v_uint64x4, v_int16x16, void);
CV_DEF_REG_TRAITS(v256, v_int16x16, short, s16, v_uint16x16, v_int32x8, v_int64x4, v_int16x16, void);
CV_DEF_REG_TRAITS(v256, v_uint32x8, unsigned, u32, v_uint32x8, v_uint64x4, void, v_int32x8, void);
CV_DEF_REG_TRAITS(v256, v_int32x8, int, s32, v_uint32x8, v_int64x4, void, v_int32x8, void);
CV_DEF_REG_TRAITS(v256, v_float32x8, float, f32, v_float32x8, v_float64x4, void, v_int32x8, v_int32x8);
CV_DEF_REG_TRAITS(v256, v_uint64x4, uint64, u64, v_uint64x4, void, void, v_int64x4, void);
CV_DEF_REG_TRAITS(v256, v_int64x4, int64, s64, v_uint64x4, void, void, v_int64x4, void);
CV_DEF_REG_TRAITS(v256, v_float64x4, double, f64, v_float64x4, void, void, v_int64x4, v_int32x8);
#endif
#if CV_SIMD512 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 512)
#define CV__SIMD_NAMESPACE simd512
namespace CV__SIMD_NAMESPACE {
#define CV_SIMD 1
#define CV_SIMD_64F CV_SIMD512_64F
#define CV_SIMD_WIDTH 64
// TODO typedef v_uint8 / v_int32 / etc types here
} // namespace
using namespace CV__SIMD_NAMESPACE;
#elif CV_SIMD256 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 256)
#define CV__SIMD_NAMESPACE simd256
namespace CV__SIMD_NAMESPACE {
#define CV_SIMD 1
#define CV_SIMD_64F CV_SIMD256_64F
#define CV_SIMD_FP16 CV_SIMD256_FP16
#define CV_SIMD_WIDTH 32
typedef v_uint8x32 v_uint8;
typedef v_int8x32 v_int8;
typedef v_uint16x16 v_uint16;
typedef v_int16x16 v_int16;
typedef v_uint32x8 v_uint32;
typedef v_int32x8 v_int32;
typedef v_uint64x4 v_uint64;
typedef v_int64x4 v_int64;
typedef v_float32x8 v_float32;
#if CV_SIMD256_64F
typedef v_float64x4 v_float64;
#endif
CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(v256)
CV_INTRIN_DEFINE_WIDE_INTRIN(double, v_float64, f64, v256, load)
inline void vx_cleanup() { v256_cleanup(); }
} // namespace
using namespace CV__SIMD_NAMESPACE;
#elif (CV_SIMD128 || CV_SIMD128_CPP) && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 128)
#define CV__SIMD_NAMESPACE simd128
namespace CV__SIMD_NAMESPACE {
#define CV_SIMD CV_SIMD128
#define CV_SIMD_64F CV_SIMD128_64F
#define CV_SIMD_WIDTH 16
typedef v_uint8x16 v_uint8;
typedef v_int8x16 v_int8;
typedef v_uint16x8 v_uint16;
typedef v_int16x8 v_int16;
typedef v_uint32x4 v_uint32;
typedef v_int32x4 v_int32;
typedef v_uint64x2 v_uint64;
typedef v_int64x2 v_int64;
typedef v_float32x4 v_float32;
#if CV_SIMD128_64F
typedef v_float64x2 v_float64;
#endif
CV_INTRIN_DEFINE_WIDE_INTRIN_ALL_TYPES(v)
#if CV_SIMD128_64F
CV_INTRIN_DEFINE_WIDE_INTRIN(double, v_float64, f64, v, load)
#endif
inline void vx_cleanup() { v_cleanup(); }
} // namespace
using namespace CV__SIMD_NAMESPACE;
#endif
inline unsigned int trailingZeros32(unsigned int value) {
#if defined(_MSC_VER)
#if (_MSC_VER < 1700) || defined(_M_ARM)
unsigned long index = 0;
_BitScanForward(&index, value);
return (unsigned int)index;
#elif defined(__clang__)
// clang-cl doesn't export _tzcnt_u32 for non BMI systems
return value ? __builtin_ctz(value) : 32;
#else
return _tzcnt_u32(value);
#endif
#elif defined(__GNUC__) || defined(__GNUG__)
return __builtin_ctz(value);
#elif defined(__ICC) || defined(__INTEL_COMPILER)
return _bit_scan_forward(value);
#elif defined(__clang__)
return llvm.cttz.i32(value, true);
#else
static const int MultiplyDeBruijnBitPosition[32] = {
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
return MultiplyDeBruijnBitPosition[((uint32_t)((value & -value) * 0x077CB531U)) >> 27];
#endif
}
#ifndef CV_DOXYGEN
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END
#endif
#ifndef CV_SIMD_64F
#define CV_SIMD_64F 0
#endif
#ifndef CV_SIMD_FP16
#define CV_SIMD_FP16 0 //!< Defined to 1 on native support of operations with float16x8_t / float16x16_t (SIMD256) types
#endif
#ifndef CV_SIMD
#define CV_SIMD 0
#endif
} // cv::
//! @endcond
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+158
View File
@@ -0,0 +1,158 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#ifndef CV__SIMD_FORWARD
#error "Need to pre-define forward width"
#endif
namespace cv
{
//! @cond IGNORED
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN
/** Types **/
#if CV__SIMD_FORWARD == 512
// [todo] 512
#error "AVX512 Not implemented yet"
#elif CV__SIMD_FORWARD == 256
// 256
#define __CV_VX(fun) v256_##fun
#define __CV_V_UINT8 v_uint8x32
#define __CV_V_INT8 v_int8x32
#define __CV_V_UINT16 v_uint16x16
#define __CV_V_INT16 v_int16x16
#define __CV_V_UINT32 v_uint32x8
#define __CV_V_INT32 v_int32x8
#define __CV_V_UINT64 v_uint64x4
#define __CV_V_INT64 v_int64x4
#define __CV_V_FLOAT32 v_float32x8
#define __CV_V_FLOAT64 v_float64x4
struct v_uint8x32;
struct v_int8x32;
struct v_uint16x16;
struct v_int16x16;
struct v_uint32x8;
struct v_int32x8;
struct v_uint64x4;
struct v_int64x4;
struct v_float32x8;
struct v_float64x4;
#else
// 128
#define __CV_VX(fun) v_##fun
#define __CV_V_UINT8 v_uint8x16
#define __CV_V_INT8 v_int8x16
#define __CV_V_UINT16 v_uint16x8
#define __CV_V_INT16 v_int16x8
#define __CV_V_UINT32 v_uint32x4
#define __CV_V_INT32 v_int32x4
#define __CV_V_UINT64 v_uint64x2
#define __CV_V_INT64 v_int64x2
#define __CV_V_FLOAT32 v_float32x4
#define __CV_V_FLOAT64 v_float64x2
struct v_uint8x16;
struct v_int8x16;
struct v_uint16x8;
struct v_int16x8;
struct v_uint32x4;
struct v_int32x4;
struct v_uint64x2;
struct v_int64x2;
struct v_float32x4;
struct v_float64x2;
#endif
/** Value reordering **/
// Expansion
void v_expand(const __CV_V_UINT8&, __CV_V_UINT16&, __CV_V_UINT16&);
void v_expand(const __CV_V_INT8&, __CV_V_INT16&, __CV_V_INT16&);
void v_expand(const __CV_V_UINT16&, __CV_V_UINT32&, __CV_V_UINT32&);
void v_expand(const __CV_V_INT16&, __CV_V_INT32&, __CV_V_INT32&);
void v_expand(const __CV_V_UINT32&, __CV_V_UINT64&, __CV_V_UINT64&);
void v_expand(const __CV_V_INT32&, __CV_V_INT64&, __CV_V_INT64&);
// Low Expansion
__CV_V_UINT16 v_expand_low(const __CV_V_UINT8&);
__CV_V_INT16 v_expand_low(const __CV_V_INT8&);
__CV_V_UINT32 v_expand_low(const __CV_V_UINT16&);
__CV_V_INT32 v_expand_low(const __CV_V_INT16&);
__CV_V_UINT64 v_expand_low(const __CV_V_UINT32&);
__CV_V_INT64 v_expand_low(const __CV_V_INT32&);
// High Expansion
__CV_V_UINT16 v_expand_high(const __CV_V_UINT8&);
__CV_V_INT16 v_expand_high(const __CV_V_INT8&);
__CV_V_UINT32 v_expand_high(const __CV_V_UINT16&);
__CV_V_INT32 v_expand_high(const __CV_V_INT16&);
__CV_V_UINT64 v_expand_high(const __CV_V_UINT32&);
__CV_V_INT64 v_expand_high(const __CV_V_INT32&);
// Load & Low Expansion
__CV_V_UINT16 __CV_VX(load_expand)(const uchar*);
__CV_V_INT16 __CV_VX(load_expand)(const schar*);
__CV_V_UINT32 __CV_VX(load_expand)(const ushort*);
__CV_V_INT32 __CV_VX(load_expand)(const short*);
__CV_V_UINT64 __CV_VX(load_expand)(const uint*);
__CV_V_INT64 __CV_VX(load_expand)(const int*);
// Load lower 8-bit and expand into 32-bit
__CV_V_UINT32 __CV_VX(load_expand_q)(const uchar*);
__CV_V_INT32 __CV_VX(load_expand_q)(const schar*);
// Saturating Pack
__CV_V_UINT8 v_pack(const __CV_V_UINT16&, const __CV_V_UINT16&);
__CV_V_INT8 v_pack(const __CV_V_INT16&, const __CV_V_INT16&);
__CV_V_UINT16 v_pack(const __CV_V_UINT32&, const __CV_V_UINT32&);
__CV_V_INT16 v_pack(const __CV_V_INT32&, const __CV_V_INT32&);
// Non-saturating Pack
__CV_V_UINT32 v_pack(const __CV_V_UINT64&, const __CV_V_UINT64&);
__CV_V_INT32 v_pack(const __CV_V_INT64&, const __CV_V_INT64&);
// Pack signed integers with unsigned saturation
__CV_V_UINT8 v_pack_u(const __CV_V_INT16&, const __CV_V_INT16&);
__CV_V_UINT16 v_pack_u(const __CV_V_INT32&, const __CV_V_INT32&);
/** Arithmetic, bitwise and comparison operations **/
// Non-saturating multiply
#if CV_VSX
template<typename Tvec>
Tvec v_mul_wrap(const Tvec& a, const Tvec& b);
#else
__CV_V_UINT8 v_mul_wrap(const __CV_V_UINT8&, const __CV_V_UINT8&);
__CV_V_INT8 v_mul_wrap(const __CV_V_INT8&, const __CV_V_INT8&);
__CV_V_UINT16 v_mul_wrap(const __CV_V_UINT16&, const __CV_V_UINT16&);
__CV_V_INT16 v_mul_wrap(const __CV_V_INT16&, const __CV_V_INT16&);
#endif
// Multiply and expand
#if CV_VSX
template<typename Tvec, typename Twvec>
void v_mul_expand(const Tvec& a, const Tvec& b, Twvec& c, Twvec& d);
#else
void v_mul_expand(const __CV_V_UINT8&, const __CV_V_UINT8&, __CV_V_UINT16&, __CV_V_UINT16&);
void v_mul_expand(const __CV_V_INT8&, const __CV_V_INT8&, __CV_V_INT16&, __CV_V_INT16&);
void v_mul_expand(const __CV_V_UINT16&, const __CV_V_UINT16&, __CV_V_UINT32&, __CV_V_UINT32&);
void v_mul_expand(const __CV_V_INT16&, const __CV_V_INT16&, __CV_V_INT32&, __CV_V_INT32&);
void v_mul_expand(const __CV_V_UINT32&, const __CV_V_UINT32&, __CV_V_UINT64&, __CV_V_UINT64&);
void v_mul_expand(const __CV_V_INT32&, const __CV_V_INT32&, __CV_V_INT64&, __CV_V_INT64&);
#endif
/** Cleanup **/
#undef CV__SIMD_FORWARD
#undef __CV_VX
#undef __CV_V_UINT8
#undef __CV_V_INT8
#undef __CV_V_UINT16
#undef __CV_V_INT16
#undef __CV_V_UINT32
#undef __CV_V_INT32
#undef __CV_V_UINT64
#undef __CV_V_INT64
#undef __CV_V_FLOAT32
#undef __CV_V_FLOAT64
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END
//! @endcond
} // cv::
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+167
View File
@@ -0,0 +1,167 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#ifndef OPENCV_HAL_INTRIN_SSE_EM_HPP
#define OPENCV_HAL_INTRIN_SSE_EM_HPP
namespace cv
{
//! @cond IGNORED
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_BEGIN
#define OPENCV_HAL_SSE_WRAP_1(fun, tp) \
inline tp _v128_##fun(const tp& a) \
{ return _mm_##fun(a); }
#define OPENCV_HAL_SSE_WRAP_2(fun, tp) \
inline tp _v128_##fun(const tp& a, const tp& b) \
{ return _mm_##fun(a, b); }
#define OPENCV_HAL_SSE_WRAP_3(fun, tp) \
inline tp _v128_##fun(const tp& a, const tp& b, const tp& c) \
{ return _mm_##fun(a, b, c); }
///////////////////////////// XOP /////////////////////////////
// [todo] define CV_XOP
#if 1 // CV_XOP
inline __m128i _v128_comgt_epu32(const __m128i& a, const __m128i& b)
{
const __m128i delta = _mm_set1_epi32((int)0x80000000);
return _mm_cmpgt_epi32(_mm_xor_si128(a, delta), _mm_xor_si128(b, delta));
}
// wrapping XOP
#else
OPENCV_HAL_SSE_WRAP_2(_v128_comgt_epu32, __m128i)
#endif // !CV_XOP
///////////////////////////// SSE4.1 /////////////////////////////
#if !CV_SSE4_1
/** Swizzle **/
inline __m128i _v128_blendv_epi8(const __m128i& a, const __m128i& b, const __m128i& mask)
{ return _mm_xor_si128(a, _mm_and_si128(_mm_xor_si128(b, a), mask)); }
/** Convert **/
// 8 >> 16
inline __m128i _v128_cvtepu8_epi16(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpacklo_epi8(a, z);
}
inline __m128i _v128_cvtepi8_epi16(const __m128i& a)
{ return _mm_srai_epi16(_mm_unpacklo_epi8(a, a), 8); }
// 8 >> 32
inline __m128i _v128_cvtepu8_epi32(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpacklo_epi16(_mm_unpacklo_epi8(a, z), z);
}
inline __m128i _v128_cvtepi8_epi32(const __m128i& a)
{
__m128i r = _mm_unpacklo_epi8(a, a);
r = _mm_unpacklo_epi8(r, r);
return _mm_srai_epi32(r, 24);
}
// 16 >> 32
inline __m128i _v128_cvtepu16_epi32(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpacklo_epi16(a, z);
}
inline __m128i _v128_cvtepi16_epi32(const __m128i& a)
{ return _mm_srai_epi32(_mm_unpacklo_epi16(a, a), 16); }
// 32 >> 64
inline __m128i _v128_cvtepu32_epi64(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpacklo_epi32(a, z);
}
inline __m128i _v128_cvtepi32_epi64(const __m128i& a)
{ return _mm_unpacklo_epi32(a, _mm_srai_epi32(a, 31)); }
/** Arithmetic **/
inline __m128i _v128_mullo_epi32(const __m128i& a, const __m128i& b)
{
__m128i c0 = _mm_mul_epu32(a, b);
__m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a, 32), _mm_srli_epi64(b, 32));
__m128i d0 = _mm_unpacklo_epi32(c0, c1);
__m128i d1 = _mm_unpackhi_epi32(c0, c1);
return _mm_unpacklo_epi64(d0, d1);
}
/** Math **/
inline __m128i _v128_min_epu32(const __m128i& a, const __m128i& b)
{ return _v128_blendv_epi8(a, b, _v128_comgt_epu32(a, b)); }
// wrapping SSE4.1
#else
OPENCV_HAL_SSE_WRAP_1(cvtepu8_epi16, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepi8_epi16, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepu8_epi32, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepi8_epi32, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepu16_epi32, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepi16_epi32, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepu32_epi64, __m128i)
OPENCV_HAL_SSE_WRAP_1(cvtepi32_epi64, __m128i)
OPENCV_HAL_SSE_WRAP_2(min_epu32, __m128i)
OPENCV_HAL_SSE_WRAP_2(mullo_epi32, __m128i)
OPENCV_HAL_SSE_WRAP_3(blendv_epi8, __m128i)
#endif // !CV_SSE4_1
///////////////////////////// Revolutionary /////////////////////////////
/** Convert **/
// 16 << 8
inline __m128i _v128_cvtepu8_epi16_high(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpackhi_epi8(a, z);
}
inline __m128i _v128_cvtepi8_epi16_high(const __m128i& a)
{ return _mm_srai_epi16(_mm_unpackhi_epi8(a, a), 8); }
// 32 << 16
inline __m128i _v128_cvtepu16_epi32_high(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpackhi_epi16(a, z);
}
inline __m128i _v128_cvtepi16_epi32_high(const __m128i& a)
{ return _mm_srai_epi32(_mm_unpackhi_epi16(a, a), 16); }
// 64 << 32
inline __m128i _v128_cvtepu32_epi64_high(const __m128i& a)
{
const __m128i z = _mm_setzero_si128();
return _mm_unpackhi_epi32(a, z);
}
inline __m128i _v128_cvtepi32_epi64_high(const __m128i& a)
{ return _mm_unpackhi_epi32(a, _mm_srai_epi32(a, 31)); }
/** Miscellaneous **/
inline __m128i _v128_packs_epu32(const __m128i& a, const __m128i& b)
{
const __m128i m = _mm_set1_epi32(65535);
__m128i am = _v128_min_epu32(a, m);
__m128i bm = _v128_min_epu32(b, m);
#if CV_SSE4_1
return _mm_packus_epi32(am, bm);
#else
const __m128i d = _mm_set1_epi32(32768), nd = _mm_set1_epi16(-32768);
am = _mm_sub_epi32(am, d);
bm = _mm_sub_epi32(bm, d);
am = _mm_packs_epi32(am, bm);
return _mm_sub_epi16(am, nd);
#endif
}
CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END
//! @endcond
} // cv::
#endif // OPENCV_HAL_INTRIN_SSE_EM_HPP
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -42,10 +42,10 @@
//
//M*/
#ifndef __OPENCV_CORE_IPPASYNC_HPP__
#define __OPENCV_CORE_IPPASYNC_HPP__
#ifndef OPENCV_CORE_IPPASYNC_HPP
#define OPENCV_CORE_IPPASYNC_HPP
#ifdef HAVE_IPP_A
#ifdef HAVE_IPP_A // this file will be removed in OpenCV 4.0
#include "opencv2/core.hpp"
#include <ipp_async_op.h>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+144 -43
View File
@@ -41,8 +41,8 @@
//
//M*/
#ifndef __OPENCV_CORE_MATX_HPP__
#define __OPENCV_CORE_MATX_HPP__
#ifndef OPENCV_CORE_MATX_HPP
#define OPENCV_CORE_MATX_HPP
#ifndef __cplusplus
# error matx.hpp header must be compiled as C++
@@ -51,6 +51,11 @@
#include "opencv2/core/cvdef.h"
#include "opencv2/core/base.hpp"
#include "opencv2/core/traits.hpp"
#include "opencv2/core/saturate.hpp"
#ifdef CV_CXX11
#include <initializer_list>
#endif
namespace cv
{
@@ -61,13 +66,14 @@ namespace cv
////////////////////////////// Small Matrix ///////////////////////////
//! @cond IGNORED
struct CV_EXPORTS Matx_AddOp {};
struct CV_EXPORTS Matx_SubOp {};
struct CV_EXPORTS Matx_ScaleOp {};
struct CV_EXPORTS Matx_MulOp {};
struct CV_EXPORTS Matx_DivOp {};
struct CV_EXPORTS Matx_MatMulOp {};
struct CV_EXPORTS Matx_TOp {};
// FIXIT Remove this (especially CV_EXPORTS modifier)
struct CV_EXPORTS Matx_AddOp { Matx_AddOp() {} Matx_AddOp(const Matx_AddOp&) {} };
struct CV_EXPORTS Matx_SubOp { Matx_SubOp() {} Matx_SubOp(const Matx_SubOp&) {} };
struct CV_EXPORTS Matx_ScaleOp { Matx_ScaleOp() {} Matx_ScaleOp(const Matx_ScaleOp&) {} };
struct CV_EXPORTS Matx_MulOp { Matx_MulOp() {} Matx_MulOp(const Matx_MulOp&) {} };
struct CV_EXPORTS Matx_DivOp { Matx_DivOp() {} Matx_DivOp(const Matx_DivOp&) {} };
struct CV_EXPORTS Matx_MatMulOp { Matx_MatMulOp() {} Matx_MatMulOp(const Matx_MatMulOp&) {} };
struct CV_EXPORTS Matx_TOp { Matx_TOp() {} Matx_TOp(const Matx_TOp&) {} };
//! @endcond
/** @brief Template class for small matrices whose type and size are known at compilation time
@@ -76,21 +82,33 @@ If you need a more flexible type, use Mat . The elements of the matrix M are acc
M(i,j) notation. Most of the common matrix operations (see also @ref MatrixExpressions ) are
available. To do an operation on Matx that is not implemented, you can easily convert the matrix to
Mat and backwards:
@code
@code{.cpp}
Matx33f m(1, 2, 3,
4, 5, 6,
7, 8, 9);
cout << sum(Mat(m*m.t())) << endl;
@endcode
@endcode
Except of the plain constructor which takes a list of elements, Matx can be initialized from a C-array:
@code{.cpp}
float values[] = { 1, 2, 3};
Matx31f m(values);
@endcode
In case if C++11 features are available, std::initializer_list can be also used to initialize Matx:
@code{.cpp}
Matx31f m = { 1, 2, 3};
@endcode
*/
template<typename _Tp, int m, int n> class Matx
{
public:
enum { depth = DataType<_Tp>::depth,
enum {
rows = m,
cols = n,
channels = rows*cols,
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
depth = traits::Type<_Tp>::value,
type = CV_MAKETYPE(depth, channels),
#endif
shortdim = (m < n ? m : n)
};
@@ -101,7 +119,7 @@ public:
//! default constructor
Matx();
Matx(_Tp v0); //!< 1x1 matrix
explicit Matx(_Tp v0); //!< 1x1 matrix
Matx(_Tp v0, _Tp v1); //!< 1x2 or 2x1 matrix
Matx(_Tp v0, _Tp v1, _Tp v2); //!< 1x3 or 3x1 matrix
Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 1x4, 2x2 or 4x1 matrix
@@ -114,12 +132,20 @@ public:
Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
_Tp v4, _Tp v5, _Tp v6, _Tp v7,
_Tp v8, _Tp v9, _Tp v10, _Tp v11); //!< 1x12, 2x6, 3x4, 4x3, 6x2 or 12x1 matrix
Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
_Tp v4, _Tp v5, _Tp v6, _Tp v7,
_Tp v8, _Tp v9, _Tp v10, _Tp v11,
_Tp v12, _Tp v13); //!< 1x14, 2x7, 7x2 or 14x1 matrix
Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
_Tp v4, _Tp v5, _Tp v6, _Tp v7,
_Tp v8, _Tp v9, _Tp v10, _Tp v11,
_Tp v12, _Tp v13, _Tp v14, _Tp v15); //!< 1x16, 4x4 or 16x1 matrix
explicit Matx(const _Tp* vals); //!< initialize from a plain array
#ifdef CV_CXX11
Matx(std::initializer_list<_Tp>); //!< initialize from an initializer list
#endif
static Matx all(_Tp alpha);
static Matx zeros();
static Matx ones();
@@ -237,13 +263,23 @@ public:
typedef value_type vec_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = m * n,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
};
namespace traits {
template<typename _Tp, int m, int n>
struct Depth< Matx<_Tp, m, n> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp, int m, int n>
struct Type< Matx<_Tp, m, n> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, n*m) }; };
} // namespace
/** @brief Comma-separated Matrix Initializer
*/
template<typename _Tp, int m, int n> class MatxCommaInitializer
@@ -301,9 +337,13 @@ template<typename _Tp, int cn> class Vec : public Matx<_Tp, cn, 1>
{
public:
typedef _Tp value_type;
enum { depth = Matx<_Tp, cn, 1>::depth,
enum {
channels = cn,
type = CV_MAKETYPE(depth, channels)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
depth = Matx<_Tp, cn, 1>::depth,
type = CV_MAKETYPE(depth, channels),
#endif
_dummy_enum_finalizer = 0
};
//! default constructor
@@ -319,8 +359,13 @@ public:
Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 8-element vector constructor
Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 9-element vector constructor
Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 10-element vector constructor
Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13); //!< 14-element vector constructor
explicit Vec(const _Tp* values);
#ifdef CV_CXX11
Vec(std::initializer_list<_Tp>);
#endif
Vec(const Vec<_Tp, cn>& v);
static Vec all(_Tp alpha);
@@ -395,13 +440,24 @@ public:
typedef value_type vec_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = cn,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
depth = DataType<channel_type>::depth,
type = CV_MAKETYPE(depth, channels),
#endif
_dummy_enum_finalizer = 0
};
};
namespace traits {
template<typename _Tp, int cn>
struct Depth< Vec<_Tp, cn> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp, int cn>
struct Type< Vec<_Tp, cn> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, cn) }; };
} // namespace
/** @brief Comma-separated Vec Initializer
*/
template<typename _Tp, int m> class VecCommaInitializer : public MatxCommaInitializer<_Tp, m, 1>
@@ -432,7 +488,7 @@ template<typename _Tp, int m> struct Matx_DetOp
return p;
for( int i = 0; i < m; i++ )
p *= temp(i, i);
return 1./p;
return p;
}
};
@@ -494,7 +550,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1)
{
CV_StaticAssert(channels >= 2, "Matx should have at least 2 elaments.");
CV_StaticAssert(channels >= 2, "Matx should have at least 2 elements.");
val[0] = v0; val[1] = v1;
for(int i = 2; i < channels; i++) val[i] = _Tp(0);
}
@@ -502,7 +558,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2)
{
CV_StaticAssert(channels >= 3, "Matx should have at least 3 elaments.");
CV_StaticAssert(channels >= 3, "Matx should have at least 3 elements.");
val[0] = v0; val[1] = v1; val[2] = v2;
for(int i = 3; i < channels; i++) val[i] = _Tp(0);
}
@@ -510,7 +566,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
{
CV_StaticAssert(channels >= 4, "Matx should have at least 4 elaments.");
CV_StaticAssert(channels >= 4, "Matx should have at least 4 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
for(int i = 4; i < channels; i++) val[i] = _Tp(0);
}
@@ -518,7 +574,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
{
CV_StaticAssert(channels >= 5, "Matx should have at least 5 elaments.");
CV_StaticAssert(channels >= 5, "Matx should have at least 5 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; val[4] = v4;
for(int i = 5; i < channels; i++) val[i] = _Tp(0);
}
@@ -526,7 +582,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
{
CV_StaticAssert(channels >= 6, "Matx should have at least 6 elaments.");
CV_StaticAssert(channels >= 6, "Matx should have at least 6 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5;
for(int i = 6; i < channels; i++) val[i] = _Tp(0);
@@ -535,7 +591,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
{
CV_StaticAssert(channels >= 7, "Matx should have at least 7 elaments.");
CV_StaticAssert(channels >= 7, "Matx should have at least 7 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6;
for(int i = 7; i < channels; i++) val[i] = _Tp(0);
@@ -544,7 +600,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7)
{
CV_StaticAssert(channels >= 8, "Matx should have at least 8 elaments.");
CV_StaticAssert(channels >= 8, "Matx should have at least 8 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
for(int i = 8; i < channels; i++) val[i] = _Tp(0);
@@ -553,7 +609,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _T
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8)
{
CV_StaticAssert(channels >= 9, "Matx should have at least 9 elaments.");
CV_StaticAssert(channels >= 9, "Matx should have at least 9 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8;
@@ -563,7 +619,7 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _T
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
{
CV_StaticAssert(channels >= 10, "Matx should have at least 10 elaments.");
CV_StaticAssert(channels >= 10, "Matx should have at least 10 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8; val[9] = v9;
@@ -574,20 +630,34 @@ Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _T
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11)
{
CV_StaticAssert(channels == 12, "Matx should have at least 12 elaments.");
CV_StaticAssert(channels >= 12, "Matx should have at least 12 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
for(int i = 12; i < channels; i++) val[i] = _Tp(0);
}
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13)
{
CV_StaticAssert(channels >= 14, "Matx should have at least 14 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
val[12] = v12; val[13] = v13;
for (int i = 14; i < channels; i++) val[i] = _Tp(0);
}
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13, _Tp v14, _Tp v15)
{
CV_StaticAssert(channels == 16, "Matx should have at least 16 elaments.");
CV_StaticAssert(channels >= 16, "Matx should have at least 16 elements.");
val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
val[12] = v12; val[13] = v13; val[14] = v14; val[15] = v15;
for(int i = 16; i < channels; i++) val[i] = _Tp(0);
}
template<typename _Tp, int m, int n> inline
@@ -596,6 +666,19 @@ Matx<_Tp, m, n>::Matx(const _Tp* values)
for( int i = 0; i < channels; i++ ) val[i] = values[i];
}
#ifdef CV_CXX11
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(std::initializer_list<_Tp> list)
{
CV_DbgAssert(list.size() == channels);
int i = 0;
for(const auto& elem : list)
{
val[i++] = elem;
}
}
#endif
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n> Matx<_Tp, m, n>::all(_Tp alpha)
{
@@ -838,9 +921,17 @@ double norm(const Matx<_Tp, m, n>& M)
template<typename _Tp, int m, int n> static inline
double norm(const Matx<_Tp, m, n>& M, int normType)
{
return normType == NORM_INF ? (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n) :
normType == NORM_L1 ? (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n) :
std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n));
switch(normType) {
case NORM_INF:
return (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
case NORM_L1:
return (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
case NORM_L2SQR:
return (double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
default:
case NORM_L2:
return std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n));
}
}
@@ -921,10 +1012,20 @@ template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
: Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {}
template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13)
: Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) {}
template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(const _Tp* values)
: Matx<_Tp, cn, 1>(values) {}
#ifdef CV_CXX11
template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(std::initializer_list<_Tp> list)
: Matx<_Tp, cn, 1>(list) {}
#endif
template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(const Vec<_Tp, cn>& m)
: Matx<_Tp, cn, 1>(m.val) {}
@@ -991,17 +1092,17 @@ Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>&) const
template<> inline
Vec<float, 3> Vec<float, 3>::cross(const Vec<float, 3>& v) const
{
return Vec<float,3>(val[1]*v.val[2] - val[2]*v.val[1],
val[2]*v.val[0] - val[0]*v.val[2],
val[0]*v.val[1] - val[1]*v.val[0]);
return Vec<float,3>(this->val[1]*v.val[2] - this->val[2]*v.val[1],
this->val[2]*v.val[0] - this->val[0]*v.val[2],
this->val[0]*v.val[1] - this->val[1]*v.val[0]);
}
template<> inline
Vec<double, 3> Vec<double, 3>::cross(const Vec<double, 3>& v) const
{
return Vec<double,3>(val[1]*v.val[2] - val[2]*v.val[1],
val[2]*v.val[0] - val[0]*v.val[2],
val[0]*v.val[1] - val[1]*v.val[0]);
return Vec<double,3>(this->val[1]*v.val[2] - this->val[2]*v.val[1],
this->val[2]*v.val[0] - this->val[0]*v.val[2],
this->val[0]*v.val[1] - this->val[1]*v.val[0]);
}
template<typename _Tp, int cn> template<typename T2> inline
@@ -1049,7 +1150,7 @@ Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v)
//////////////////////////////// matx comma initializer //////////////////////////////////
//////////////////////////////// vec comma initializer //////////////////////////////////
template<typename _Tp, typename _T2, int cn> static inline
@@ -1373,4 +1474,4 @@ template<typename _Tp> inline Vec<_Tp, 4>& operator *= (Vec<_Tp, 4>& v1, const V
} // cv
#endif // __OPENCV_CORE_MATX_HPP__
#endif // OPENCV_CORE_MATX_HPP
+128
View File
@@ -0,0 +1,128 @@
/*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) 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_NEON_UTILS_HPP
#define OPENCV_HAL_NEON_UTILS_HPP
#include "opencv2/core/cvdef.h"
//! @addtogroup core_utils_neon
//! @{
#if CV_NEON
inline int32x2_t cv_vrnd_s32_f32(float32x2_t v)
{
static int32x2_t v_sign = vdup_n_s32(1 << 31),
v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f));
int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v)));
return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition)));
}
inline int32x4_t cv_vrndq_s32_f32(float32x4_t v)
{
static int32x4_t v_sign = vdupq_n_s32(1 << 31),
v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f));
int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v)));
return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition)));
}
inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v)
{
static float32x2_t v_05 = vdup_n_f32(0.5f);
return vcvt_u32_f32(vadd_f32(v, v_05));
}
inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v)
{
static float32x4_t v_05 = vdupq_n_f32(0.5f);
return vcvtq_u32_f32(vaddq_f32(v, v_05));
}
inline float32x4_t cv_vrecpq_f32(float32x4_t val)
{
float32x4_t reciprocal = vrecpeq_f32(val);
reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
return reciprocal;
}
inline float32x2_t cv_vrecp_f32(float32x2_t val)
{
float32x2_t reciprocal = vrecpe_f32(val);
reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
return reciprocal;
}
inline float32x4_t cv_vrsqrtq_f32(float32x4_t val)
{
float32x4_t e = vrsqrteq_f32(val);
e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
return e;
}
inline float32x2_t cv_vrsqrt_f32(float32x2_t val)
{
float32x2_t e = vrsqrte_f32(val);
e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
return e;
}
inline float32x4_t cv_vsqrtq_f32(float32x4_t val)
{
return cv_vrecpq_f32(cv_vrsqrtq_f32(val));
}
inline float32x2_t cv_vsqrt_f32(float32x2_t val)
{
return cv_vrecp_f32(cv_vrsqrt_f32(val));
}
#endif
//! @}
#endif // OPENCV_HAL_NEON_UTILS_HPP
+251 -99
View File
@@ -39,8 +39,8 @@
//
//M*/
#ifndef __OPENCV_OPENCL_HPP__
#define __OPENCV_OPENCL_HPP__
#ifndef OPENCV_OPENCL_HPP
#define OPENCV_OPENCL_HPP
#include "opencv2/core.hpp"
@@ -59,7 +59,7 @@ CV_EXPORTS_W void finish();
CV_EXPORTS bool haveSVM();
class CV_EXPORTS Context;
class CV_EXPORTS Device;
class CV_EXPORTS_W_SIMPLE Device;
class CV_EXPORTS Kernel;
class CV_EXPORTS Program;
class CV_EXPORTS ProgramSource;
@@ -67,14 +67,14 @@ class CV_EXPORTS Queue;
class CV_EXPORTS PlatformInfo;
class CV_EXPORTS Image2D;
class CV_EXPORTS Device
class CV_EXPORTS_W_SIMPLE Device
{
public:
Device();
CV_WRAP Device();
explicit Device(void* d);
Device(const Device& d);
Device& operator = (const Device& d);
~Device();
CV_WRAP ~Device();
void set(void* d);
@@ -89,23 +89,24 @@ public:
TYPE_ALL = 0xFFFFFFFF
};
String name() const;
String extensions() const;
String version() const;
String vendorName() const;
String OpenCL_C_Version() const;
String OpenCLVersion() const;
int deviceVersionMajor() const;
int deviceVersionMinor() const;
String driverVersion() const;
CV_WRAP String name() const;
CV_WRAP String extensions() const;
CV_WRAP bool isExtensionSupported(const String& extensionName) const;
CV_WRAP String version() const;
CV_WRAP String vendorName() const;
CV_WRAP String OpenCL_C_Version() const;
CV_WRAP String OpenCLVersion() const;
CV_WRAP int deviceVersionMajor() const;
CV_WRAP int deviceVersionMinor() const;
CV_WRAP String driverVersion() const;
void* ptr() const;
int type() const;
CV_WRAP int type() const;
int addressBits() const;
bool available() const;
bool compilerAvailable() const;
bool linkerAvailable() const;
CV_WRAP int addressBits() const;
CV_WRAP bool available() const;
CV_WRAP bool compilerAvailable() const;
CV_WRAP bool linkerAvailable() const;
enum
{
@@ -118,21 +119,21 @@ public:
FP_SOFT_FLOAT=(1 << 6),
FP_CORRECTLY_ROUNDED_DIVIDE_SQRT=(1 << 7)
};
int doubleFPConfig() const;
int singleFPConfig() const;
int halfFPConfig() const;
CV_WRAP int doubleFPConfig() const;
CV_WRAP int singleFPConfig() const;
CV_WRAP int halfFPConfig() const;
bool endianLittle() const;
bool errorCorrectionSupport() const;
CV_WRAP bool endianLittle() const;
CV_WRAP bool errorCorrectionSupport() const;
enum
{
EXEC_KERNEL=(1 << 0),
EXEC_NATIVE_KERNEL=(1 << 1)
};
int executionCapabilities() const;
CV_WRAP int executionCapabilities() const;
size_t globalMemCacheSize() const;
CV_WRAP size_t globalMemCacheSize() const;
enum
{
@@ -140,35 +141,38 @@ public:
READ_ONLY_CACHE=1,
READ_WRITE_CACHE=2
};
int globalMemCacheType() const;
int globalMemCacheLineSize() const;
size_t globalMemSize() const;
CV_WRAP int globalMemCacheType() const;
CV_WRAP int globalMemCacheLineSize() const;
CV_WRAP size_t globalMemSize() const;
size_t localMemSize() const;
CV_WRAP size_t localMemSize() const;
enum
{
NO_LOCAL_MEM=0,
LOCAL_IS_LOCAL=1,
LOCAL_IS_GLOBAL=2
};
int localMemType() const;
bool hostUnifiedMemory() const;
CV_WRAP int localMemType() const;
CV_WRAP bool hostUnifiedMemory() const;
bool imageSupport() const;
CV_WRAP bool imageSupport() const;
bool imageFromBufferSupport() const;
CV_WRAP bool imageFromBufferSupport() const;
uint imagePitchAlignment() const;
uint imageBaseAddressAlignment() const;
size_t image2DMaxWidth() const;
size_t image2DMaxHeight() const;
/// deprecated, use isExtensionSupported() method (probably with "cl_khr_subgroups" value)
CV_WRAP bool intelSubgroupsSupport() const;
size_t image3DMaxWidth() const;
size_t image3DMaxHeight() const;
size_t image3DMaxDepth() const;
CV_WRAP size_t image2DMaxWidth() const;
CV_WRAP size_t image2DMaxHeight() const;
size_t imageMaxBufferSize() const;
size_t imageMaxArraySize() const;
CV_WRAP size_t image3DMaxWidth() const;
CV_WRAP size_t image3DMaxHeight() const;
CV_WRAP size_t image3DMaxDepth() const;
CV_WRAP size_t imageMaxBufferSize() const;
CV_WRAP size_t imageMaxArraySize() const;
enum
{
@@ -177,53 +181,53 @@ public:
VENDOR_INTEL=2,
VENDOR_NVIDIA=3
};
int vendorID() const;
CV_WRAP int vendorID() const;
// FIXIT
// dev.isAMD() doesn't work for OpenCL CPU devices from AMD OpenCL platform.
// This method should use platform name instead of vendor name.
// After fix restore code in arithm.cpp: ocl_compare()
inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
CV_WRAP inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
CV_WRAP inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
CV_WRAP inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
int maxClockFrequency() const;
int maxComputeUnits() const;
int maxConstantArgs() const;
size_t maxConstantBufferSize() const;
CV_WRAP int maxClockFrequency() const;
CV_WRAP int maxComputeUnits() const;
CV_WRAP int maxConstantArgs() const;
CV_WRAP size_t maxConstantBufferSize() const;
size_t maxMemAllocSize() const;
size_t maxParameterSize() const;
CV_WRAP size_t maxMemAllocSize() const;
CV_WRAP size_t maxParameterSize() const;
int maxReadImageArgs() const;
int maxWriteImageArgs() const;
int maxSamplers() const;
CV_WRAP int maxReadImageArgs() const;
CV_WRAP int maxWriteImageArgs() const;
CV_WRAP int maxSamplers() const;
size_t maxWorkGroupSize() const;
int maxWorkItemDims() const;
CV_WRAP size_t maxWorkGroupSize() const;
CV_WRAP int maxWorkItemDims() const;
void maxWorkItemSizes(size_t*) const;
int memBaseAddrAlign() const;
CV_WRAP int memBaseAddrAlign() const;
int nativeVectorWidthChar() const;
int nativeVectorWidthShort() const;
int nativeVectorWidthInt() const;
int nativeVectorWidthLong() const;
int nativeVectorWidthFloat() const;
int nativeVectorWidthDouble() const;
int nativeVectorWidthHalf() const;
CV_WRAP int nativeVectorWidthChar() const;
CV_WRAP int nativeVectorWidthShort() const;
CV_WRAP int nativeVectorWidthInt() const;
CV_WRAP int nativeVectorWidthLong() const;
CV_WRAP int nativeVectorWidthFloat() const;
CV_WRAP int nativeVectorWidthDouble() const;
CV_WRAP int nativeVectorWidthHalf() const;
int preferredVectorWidthChar() const;
int preferredVectorWidthShort() const;
int preferredVectorWidthInt() const;
int preferredVectorWidthLong() const;
int preferredVectorWidthFloat() const;
int preferredVectorWidthDouble() const;
int preferredVectorWidthHalf() const;
CV_WRAP int preferredVectorWidthChar() const;
CV_WRAP int preferredVectorWidthShort() const;
CV_WRAP int preferredVectorWidthInt() const;
CV_WRAP int preferredVectorWidthLong() const;
CV_WRAP int preferredVectorWidthFloat() const;
CV_WRAP int preferredVectorWidthDouble() const;
CV_WRAP int preferredVectorWidthHalf() const;
size_t printfBufferSize() const;
size_t profilingTimerResolution() const;
CV_WRAP size_t printfBufferSize() const;
CV_WRAP size_t profilingTimerResolution() const;
static const Device& getDefault();
CV_WRAP static const Device& getDefault();
protected:
struct Impl;
@@ -246,6 +250,7 @@ public:
const Device& device(size_t idx) const;
Program getProg(const ProgramSource& prog,
const String& buildopt, String& errmsg);
void unloadProg(Program& prog);
static Context& getDefault(bool initialize = true);
void* ptr() const;
@@ -256,6 +261,8 @@ public:
void setUseSVM(bool enabled);
struct Impl;
inline Impl* getImpl() const { return (Impl*)p; }
//protected:
Impl* p;
};
@@ -276,6 +283,41 @@ protected:
Impl* p;
};
/** @brief Attaches OpenCL context to OpenCV
@note
OpenCV will check if available OpenCL platform has platformName name, then assign context to
OpenCV and call `clRetainContext` function. The deviceID device will be used as target device and
new command queue will be created.
@param platformName name of OpenCL platform to attach, this string is used to check if platform is available to OpenCV at runtime
@param platformID ID of platform attached context was created for
@param context OpenCL context to be attached to OpenCV
@param deviceID ID of device, must be created from attached context
*/
CV_EXPORTS void attachContext(const String& platformName, void* platformID, void* context, void* deviceID);
/** @brief Convert OpenCL buffer to UMat
@note
OpenCL buffer (cl_mem_buffer) should contain 2D image data, compatible with OpenCV. Memory
content is not copied from `clBuffer` to UMat. Instead, buffer handle assigned to UMat and
`clRetainMemObject` is called.
@param cl_mem_buffer source clBuffer handle
@param step num of bytes in single row
@param rows number of rows
@param cols number of cols
@param type OpenCV type of image
@param dst destination UMat
*/
CV_EXPORTS void convertFromBuffer(void* cl_mem_buffer, size_t step, int rows, int cols, int type, UMat& dst);
/** @brief Convert OpenCL image2d_t to UMat
@note
OpenCL `image2d_t` (cl_mem_image), should be compatible with OpenCV UMat formats. Memory content
is copied from image to UMat with `clEnqueueCopyImageToBuffer` function.
@param cl_mem_image source image2d_t handle
@param dst destination UMat
*/
CV_EXPORTS void convertFromImage(void* cl_mem_image, UMat& dst);
// TODO Move to internal header
void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
@@ -293,8 +335,12 @@ public:
void* ptr() const;
static Queue& getDefault();
/// @brief Returns OpenCL command queue with enable profiling mode support
const Queue& getProfilingQueue() const;
struct Impl; friend struct Impl;
inline Impl* getImpl() const { return p; }
protected:
struct Impl;
Impl* p;
};
@@ -306,7 +352,8 @@ public:
KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0);
KernelArg();
static KernelArg Local() { return KernelArg(LOCAL, 0); }
static KernelArg Local(size_t localMemSize)
{ return KernelArg(LOCAL, 0, 1, 1, 0, localMemSize); }
static KernelArg PtrWriteOnly(const UMat& m)
{ return KernelArg(PTR_ONLY+WRITE_ONLY, (UMat*)&m); }
static KernelArg PtrReadOnly(const UMat& m)
@@ -515,11 +562,26 @@ public:
i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
i = set(i, a12); i = set(i, a13); i = set(i, a14); set(i, a15); return *this;
}
/** @brief Run the OpenCL kernel.
@param dims the work problem dimensions. It is the length of globalsize and localsize. It can be either 1, 2 or 3.
@param globalsize work items for each dimension. It is not the final globalsize passed to
OpenCL. Each dimension will be adjusted to the nearest integer divisible by the corresponding
value in localsize. If localsize is NULL, it will still be adjusted depending on dims. The
adjusted values are greater than or equal to the original values.
@param localsize work-group size for each dimension.
@param sync specify whether to wait for OpenCL computation to finish before return.
@param q command queue
*/
bool run(int dims, size_t globalsize[],
size_t localsize[], bool sync, const Queue& q=Queue());
bool runTask(bool sync, const Queue& q=Queue());
/** @brief Similar to synchronized run() call with returning of kernel execution time
* Separate OpenCL command queue may be used (with CL_QUEUE_PROFILING_ENABLE)
* @return Execution time in nanoseconds or negative number on error
*/
int64 runProfiling(int dims, size_t globalsize[], size_t localsize[], const Queue& q=Queue());
size_t workGroupSize() const;
size_t preferedWorkGroupSizeMultiple() const;
bool compileWorkGroupSize(size_t wsz[]) const;
@@ -538,7 +600,6 @@ public:
Program();
Program(const ProgramSource& src,
const String& buildflags, String& errmsg);
explicit Program(const String& buf);
Program(const Program& prog);
Program& operator = (const Program& prog);
@@ -546,38 +607,104 @@ public:
bool create(const ProgramSource& src,
const String& buildflags, String& errmsg);
bool read(const String& buf, const String& buildflags);
bool write(String& buf) const;
const ProgramSource& source() const;
void* ptr() const;
String getPrefix() const;
static String getPrefix(const String& buildflags);
/**
* @brief Query device-specific program binary.
*
* Returns RAW OpenCL executable binary without additional attachments.
*
* @sa ProgramSource::fromBinary
*
* @param[out] binary output buffer
*/
void getBinary(std::vector<char>& binary) const;
struct Impl; friend struct Impl;
inline Impl* getImpl() const { return (Impl*)p; }
protected:
struct Impl;
Impl* p;
public:
#ifndef OPENCV_REMOVE_DEPRECATED_API
// TODO Remove this
CV_DEPRECATED bool read(const String& buf, const String& buildflags); // removed, use ProgramSource instead
CV_DEPRECATED bool write(String& buf) const; // removed, use getBinary() method instead (RAW OpenCL binary)
CV_DEPRECATED const ProgramSource& source() const; // implementation removed
CV_DEPRECATED String getPrefix() const; // deprecated, implementation replaced
CV_DEPRECATED static String getPrefix(const String& buildflags); // deprecated, implementation replaced
#endif
};
class CV_EXPORTS ProgramSource
{
public:
typedef uint64 hash_t;
typedef uint64 hash_t; // deprecated
ProgramSource();
explicit ProgramSource(const String& prog);
explicit ProgramSource(const char* prog);
explicit ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash);
explicit ProgramSource(const String& prog); // deprecated
explicit ProgramSource(const char* prog); // deprecated
~ProgramSource();
ProgramSource(const ProgramSource& prog);
ProgramSource& operator = (const ProgramSource& prog);
const String& source() const;
hash_t hash() const;
const String& source() const; // deprecated
hash_t hash() const; // deprecated
/** @brief Describe OpenCL program binary.
* Do not call clCreateProgramWithBinary() and/or clBuildProgram().
*
* Caller should guarantee binary buffer lifetime greater than ProgramSource object (and any of its copies).
*
* This kind of binary is not portable between platforms in general - it is specific to OpenCL vendor / device / driver version.
*
* @param module name of program owner module
* @param name unique name of program (module+name is used as key for OpenCL program caching)
* @param binary buffer address. See buffer lifetime requirement in description.
* @param size buffer size
* @param buildOptions additional program-related build options passed to clBuildProgram()
* @return created ProgramSource object
*/
static ProgramSource fromBinary(const String& module, const String& name,
const unsigned char* binary, const size_t size,
const cv::String& buildOptions = cv::String());
/** @brief Describe OpenCL program in SPIR format.
* Do not call clCreateProgramWithBinary() and/or clBuildProgram().
*
* Supports SPIR 1.2 by default (pass '-spir-std=X.Y' in buildOptions to override this behavior)
*
* Caller should guarantee binary buffer lifetime greater than ProgramSource object (and any of its copies).
*
* Programs in this format are portable between OpenCL implementations with 'khr_spir' extension:
* https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/cl_khr_spir.html
* (but they are not portable between different platforms: 32-bit / 64-bit)
*
* Note: these programs can't support vendor specific extensions, like 'cl_intel_subgroups'.
*
* @param module name of program owner module
* @param name unique name of program (module+name is used as key for OpenCL program caching)
* @param binary buffer address. See buffer lifetime requirement in description.
* @param size buffer size
* @param buildOptions additional program-related build options passed to clBuildProgram()
* (these options are added automatically: '-x spir' and '-spir-std=1.2')
* @return created ProgramSource object.
*/
static ProgramSource fromSPIR(const String& module, const String& name,
const unsigned char* binary, const size_t size,
const cv::String& buildOptions = cv::String());
//OpenCL 2.1+ only
//static Program fromSPIRV(const String& module, const String& name,
// const unsigned char* binary, const size_t size,
// const cv::String& buildOptions = cv::String());
struct Impl; friend struct Impl;
inline Impl* getImpl() const { return (Impl*)p; }
protected:
struct Impl;
Impl* p;
};
@@ -606,6 +733,7 @@ CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf)
CV_EXPORTS const char* typeToStr(int t);
CV_EXPORTS const char* memopTypeToStr(int t);
CV_EXPORTS const char* vecopTypeToStr(int t);
CV_EXPORTS const char* getOpenCLErrorString(int errorCode);
CV_EXPORTS String kernelToStr(InputArray _kernel, int ddepth = -1, const char * name = NULL);
CV_EXPORTS void getPlatfomsInfo(std::vector<PlatformInfo>& platform_info);
@@ -645,22 +773,25 @@ class CV_EXPORTS Image2D
public:
Image2D();
// src: The UMat from which to get image properties and data
// norm: Flag to enable the use of normalized channel data types
// alias: Flag indicating that the image should alias the src UMat.
// If true, changes to the image or src will be reflected in
// both objects.
/**
@param src UMat object from which to get image properties and data
@param norm flag to enable the use of normalized channel data types
@param alias flag indicating that the image should alias the src UMat. If true, changes to the
image or src will be reflected in both objects.
*/
explicit Image2D(const UMat &src, bool norm = false, bool alias = false);
Image2D(const Image2D & i);
~Image2D();
Image2D & operator = (const Image2D & i);
// Indicates if creating an aliased image should succeed. Depends on the
// underlying platform and the dimensions of the UMat.
/** Indicates if creating an aliased image should succeed.
Depends on the underlying platform and the dimensions of the UMat.
*/
static bool canCreateAlias(const UMat &u);
// Indicates if the image format is supported.
/** Indicates if the image format is supported.
*/
static bool isFormatSupported(int depth, int cn, bool norm);
void* ptr() const;
@@ -669,6 +800,24 @@ protected:
Impl* p;
};
class CV_EXPORTS Timer
{
public:
Timer(const Queue& q);
~Timer();
void start();
void stop();
uint64 durationNS() const; //< duration in nanoseconds
protected:
struct Impl;
Impl* const p;
private:
Timer(const Timer&); // disabled
Timer& operator=(const Timer&); // disabled
};
CV_EXPORTS MatAllocator* getOpenCLAllocator();
@@ -676,6 +825,9 @@ CV_EXPORTS MatAllocator* getOpenCLAllocator();
#ifdef __OPENCV_BUILD
namespace internal {
CV_EXPORTS bool isOpenCLForced();
#define OCL_FORCE_CHECK(condition) (cv::ocl::internal::isOpenCLForced() || (condition))
CV_EXPORTS bool isPerformanceCheckBypassed();
#define OCL_PERFORMANCE_CHECK(condition) (cv::ocl::internal::isPerformanceCheckBypassed() || (condition))
+17 -12
View File
@@ -39,26 +39,31 @@
//
//M*/
#ifndef __OPENCV_OPENCL_GENBASE_HPP__
#define __OPENCV_OPENCL_GENBASE_HPP__
namespace cv
{
namespace ocl
{
#ifndef OPENCV_OPENCL_GENBASE_HPP
#define OPENCV_OPENCL_GENBASE_HPP
//! @cond IGNORED
struct ProgramEntry
namespace cv {
namespace ocl {
class ProgramSource;
namespace internal {
struct CV_EXPORTS ProgramEntry
{
const char* module;
const char* name;
const char* programStr;
const char* programCode;
const char* programHash;
ProgramSource* pProgramSource;
operator ProgramSource& () const;
};
} } } // namespace
//! @endcond
}
}
#endif
+75
View File
@@ -0,0 +1,75 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
#ifndef OPENCV_CORE_OPENCL_DEFS_HPP
#define OPENCV_CORE_OPENCL_DEFS_HPP
#include "opencv2/core/utility.hpp"
#include "cvconfig.h"
namespace cv { namespace ocl {
#ifdef HAVE_OPENCL
/// Call is similar to useOpenCL() but doesn't try to load OpenCL runtime or create OpenCL context
CV_EXPORTS bool isOpenCLActivated();
#else
static inline bool isOpenCLActivated() { return false; }
#endif
}} // namespace
//#define CV_OPENCL_RUN_ASSERT
#ifdef HAVE_OPENCL
#ifdef CV_OPENCL_RUN_VERBOSE
#define CV_OCL_RUN_(condition, func, ...) \
{ \
if (cv::ocl::isOpenCLActivated() && (condition) && func) \
{ \
printf("%s: OpenCL implementation is running\n", CV_Func); \
fflush(stdout); \
CV_IMPL_ADD(CV_IMPL_OCL); \
return __VA_ARGS__; \
} \
else \
{ \
printf("%s: Plain implementation is running\n", CV_Func); \
fflush(stdout); \
} \
}
#elif defined CV_OPENCL_RUN_ASSERT
#define CV_OCL_RUN_(condition, func, ...) \
{ \
if (cv::ocl::isOpenCLActivated() && (condition)) \
{ \
if(func) \
{ \
CV_IMPL_ADD(CV_IMPL_OCL); \
} \
else \
{ \
CV_Error(cv::Error::StsAssert, #func); \
} \
return __VA_ARGS__; \
} \
}
#else
#define CV_OCL_RUN_(condition, func, ...) \
if (cv::ocl::isOpenCLActivated() && (condition) && func) \
{ \
CV_IMPL_ADD(CV_IMPL_OCL); \
return __VA_ARGS__; \
}
#endif
#else
#define CV_OCL_RUN_(condition, func, ...)
#endif
#define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func)
#endif // OPENCV_CORE_OPENCL_DEFS_HPP
+198
View File
@@ -0,0 +1,198 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/core/ocl.hpp>
#ifndef DUMP_CONFIG_PROPERTY
#define DUMP_CONFIG_PROPERTY(...)
#endif
#ifndef DUMP_MESSAGE_STDOUT
#define DUMP_MESSAGE_STDOUT(...) do { std::cout << __VA_ARGS__ << std::endl; } while (false)
#endif
namespace cv {
namespace {
static std::string bytesToStringRepr(size_t value)
{
size_t b = value % 1024;
value /= 1024;
size_t kb = value % 1024;
value /= 1024;
size_t mb = value % 1024;
value /= 1024;
size_t gb = value;
std::ostringstream stream;
if (gb > 0)
stream << gb << " GB ";
if (mb > 0)
stream << mb << " MB ";
if (kb > 0)
stream << kb << " KB ";
if (b > 0)
stream << b << " B";
std::string s = stream.str();
if (s[s.size() - 1] == ' ')
s = s.substr(0, s.size() - 1);
return s;
}
} // namespace
static void dumpOpenCLInformation()
{
using namespace cv::ocl;
try
{
if (!haveOpenCL() || !useOpenCL())
{
DUMP_MESSAGE_STDOUT("OpenCL is disabled");
DUMP_CONFIG_PROPERTY("cv_ocl", "disabled");
return;
}
std::vector<PlatformInfo> platforms;
cv::ocl::getPlatfomsInfo(platforms);
if (platforms.size() > 0)
{
DUMP_MESSAGE_STDOUT("OpenCL Platforms: ");
for (size_t i = 0; i < platforms.size(); i++)
{
const PlatformInfo* platform = &platforms[i];
DUMP_MESSAGE_STDOUT(" " << platform->name().c_str());
Device current_device;
for (int j = 0; j < platform->deviceNumber(); j++)
{
platform->getDevice(current_device, j);
const char* deviceTypeStr = current_device.type() == Device::TYPE_CPU
? ("CPU") : (current_device.type() == Device::TYPE_GPU ? current_device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown");
DUMP_MESSAGE_STDOUT( " " << deviceTypeStr << ": " << current_device.name().c_str() << " (" << current_device.version().c_str() << ")");
DUMP_CONFIG_PROPERTY( cv::format("cv_ocl_platform_%d_device_%d", (int)i, (int)j ),
cv::format("(Platform=%s)(Type=%s)(Name=%s)(Version=%s)",
platform->name().c_str(), deviceTypeStr, current_device.name().c_str(), current_device.version().c_str()) );
}
}
}
else
{
DUMP_MESSAGE_STDOUT("OpenCL is not available");
DUMP_CONFIG_PROPERTY("cv_ocl", "not available");
return;
}
const Device& device = Device::getDefault();
if (!device.available())
CV_Error(Error::OpenCLInitError, "OpenCL device is not available");
DUMP_MESSAGE_STDOUT("Current OpenCL device: ");
#if 0
DUMP_MESSAGE_STDOUT(" Platform = " << device.getPlatform().name());
DUMP_CONFIG_PROPERTY("cv_ocl_current_platformName", device.getPlatform().name());
#endif
const char* deviceTypeStr = device.type() == Device::TYPE_CPU
? ("CPU") : (device.type() == Device::TYPE_GPU ? device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown");
DUMP_MESSAGE_STDOUT(" Type = " << deviceTypeStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceType", deviceTypeStr);
DUMP_MESSAGE_STDOUT(" Name = " << device.name());
DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceName", device.name());
DUMP_MESSAGE_STDOUT(" Version = " << device.version());
DUMP_CONFIG_PROPERTY("cv_ocl_current_deviceVersion", device.version());
DUMP_MESSAGE_STDOUT(" Driver version = " << device.driverVersion());
DUMP_CONFIG_PROPERTY("cv_ocl_current_driverVersion", device.driverVersion());
DUMP_MESSAGE_STDOUT(" Address bits = " << device.addressBits());
DUMP_CONFIG_PROPERTY("cv_ocl_current_addressBits", device.addressBits());
DUMP_MESSAGE_STDOUT(" Compute units = " << device.maxComputeUnits());
DUMP_CONFIG_PROPERTY("cv_ocl_current_maxComputeUnits", device.maxComputeUnits());
DUMP_MESSAGE_STDOUT(" Max work group size = " << device.maxWorkGroupSize());
DUMP_CONFIG_PROPERTY("cv_ocl_current_maxWorkGroupSize", device.maxWorkGroupSize());
std::string localMemorySizeStr = bytesToStringRepr(device.localMemSize());
DUMP_MESSAGE_STDOUT(" Local memory size = " << localMemorySizeStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_localMemSize", device.localMemSize());
std::string maxMemAllocSizeStr = bytesToStringRepr(device.maxMemAllocSize());
DUMP_MESSAGE_STDOUT(" Max memory allocation size = " << maxMemAllocSizeStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_maxMemAllocSize", device.maxMemAllocSize());
const char* doubleSupportStr = device.doubleFPConfig() > 0 ? "Yes" : "No";
DUMP_MESSAGE_STDOUT(" Double support = " << doubleSupportStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_haveDoubleSupport", device.doubleFPConfig() > 0);
const char* isUnifiedMemoryStr = device.hostUnifiedMemory() ? "Yes" : "No";
DUMP_MESSAGE_STDOUT(" Host unified memory = " << isUnifiedMemoryStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_hostUnifiedMemory", device.hostUnifiedMemory());
DUMP_MESSAGE_STDOUT(" Device extensions:");
String extensionsStr = device.extensions();
size_t pos = 0;
while (pos < extensionsStr.size())
{
size_t pos2 = extensionsStr.find(' ', pos);
if (pos2 == String::npos)
pos2 = extensionsStr.size();
if (pos2 > pos)
{
String extensionName = extensionsStr.substr(pos, pos2 - pos);
DUMP_MESSAGE_STDOUT(" " << extensionName);
}
pos = pos2 + 1;
}
DUMP_CONFIG_PROPERTY("cv_ocl_current_extensions", extensionsStr.c_str());
const char* haveAmdBlasStr = haveAmdBlas() ? "Yes" : "No";
DUMP_MESSAGE_STDOUT(" Has AMD Blas = " << haveAmdBlasStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_AmdBlas", haveAmdBlas());
const char* haveAmdFftStr = haveAmdFft() ? "Yes" : "No";
DUMP_MESSAGE_STDOUT(" Has AMD Fft = " << haveAmdFftStr);
DUMP_CONFIG_PROPERTY("cv_ocl_current_AmdFft", haveAmdFft());
DUMP_MESSAGE_STDOUT(" Preferred vector width char = " << device.preferredVectorWidthChar());
DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthChar", device.preferredVectorWidthChar());
DUMP_MESSAGE_STDOUT(" Preferred vector width short = " << device.preferredVectorWidthShort());
DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthShort", device.preferredVectorWidthShort());
DUMP_MESSAGE_STDOUT(" Preferred vector width int = " << device.preferredVectorWidthInt());
DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthInt", device.preferredVectorWidthInt());
DUMP_MESSAGE_STDOUT(" Preferred vector width long = " << device.preferredVectorWidthLong());
DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthLong", device.preferredVectorWidthLong());
DUMP_MESSAGE_STDOUT(" Preferred vector width float = " << device.preferredVectorWidthFloat());
DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthFloat", device.preferredVectorWidthFloat());
DUMP_MESSAGE_STDOUT(" Preferred vector width double = " << device.preferredVectorWidthDouble());
DUMP_CONFIG_PROPERTY("cv_ocl_current_preferredVectorWidthDouble", device.preferredVectorWidthDouble());
}
catch (...)
{
DUMP_MESSAGE_STDOUT("Exception. Can't dump OpenCL info");
DUMP_MESSAGE_STDOUT("OpenCL device not available");
DUMP_CONFIG_PROPERTY("cv_ocl", "not available");
}
}
#undef DUMP_MESSAGE_STDOUT
#undef DUMP_CONFIG_PROPERTY
} // namespace
@@ -0,0 +1,81 @@
/* See LICENSE file in the root OpenCV directory */
#ifndef OPENCV_CORE_OPENCL_SVM_HPP
#define OPENCV_CORE_OPENCL_SVM_HPP
//
// Internal usage only (binary compatibility is not guaranteed)
//
#ifndef __OPENCV_BUILD
#error Internal header file
#endif
#if defined(HAVE_OPENCL) && defined(HAVE_OPENCL_SVM)
#include "runtime/opencl_core.hpp"
#include "runtime/opencl_svm_20.hpp"
#include "runtime/opencl_svm_hsa_extension.hpp"
namespace cv { namespace ocl { namespace svm {
struct SVMCapabilities
{
enum Value
{
SVM_COARSE_GRAIN_BUFFER = (1 << 0),
SVM_FINE_GRAIN_BUFFER = (1 << 1),
SVM_FINE_GRAIN_SYSTEM = (1 << 2),
SVM_ATOMICS = (1 << 3),
};
int value_;
SVMCapabilities(int capabilities = 0) : value_(capabilities) { }
operator int() const { return value_; }
inline bool isNoSVMSupport() const { return value_ == 0; }
inline bool isSupportCoarseGrainBuffer() const { return (value_ & SVM_COARSE_GRAIN_BUFFER) != 0; }
inline bool isSupportFineGrainBuffer() const { return (value_ & SVM_FINE_GRAIN_BUFFER) != 0; }
inline bool isSupportFineGrainSystem() const { return (value_ & SVM_FINE_GRAIN_SYSTEM) != 0; }
inline bool isSupportAtomics() const { return (value_ & SVM_ATOMICS) != 0; }
};
CV_EXPORTS const SVMCapabilities getSVMCapabilitites(const ocl::Context& context);
struct SVMFunctions
{
clSVMAllocAMD_fn fn_clSVMAlloc;
clSVMFreeAMD_fn fn_clSVMFree;
clSetKernelArgSVMPointerAMD_fn fn_clSetKernelArgSVMPointer;
//clSetKernelExecInfoAMD_fn fn_clSetKernelExecInfo;
//clEnqueueSVMFreeAMD_fn fn_clEnqueueSVMFree;
clEnqueueSVMMemcpyAMD_fn fn_clEnqueueSVMMemcpy;
clEnqueueSVMMemFillAMD_fn fn_clEnqueueSVMMemFill;
clEnqueueSVMMapAMD_fn fn_clEnqueueSVMMap;
clEnqueueSVMUnmapAMD_fn fn_clEnqueueSVMUnmap;
inline SVMFunctions()
: fn_clSVMAlloc(NULL), fn_clSVMFree(NULL),
fn_clSetKernelArgSVMPointer(NULL), /*fn_clSetKernelExecInfo(NULL),*/
/*fn_clEnqueueSVMFree(NULL),*/ fn_clEnqueueSVMMemcpy(NULL), fn_clEnqueueSVMMemFill(NULL),
fn_clEnqueueSVMMap(NULL), fn_clEnqueueSVMUnmap(NULL)
{
// nothing
}
inline bool isValid() const
{
return fn_clSVMAlloc != NULL && fn_clSVMFree && fn_clSetKernelArgSVMPointer &&
/*fn_clSetKernelExecInfo && fn_clEnqueueSVMFree &&*/ fn_clEnqueueSVMMemcpy &&
fn_clEnqueueSVMMemFill && fn_clEnqueueSVMMap && fn_clEnqueueSVMUnmap;
}
};
// We should guarantee that SVMFunctions lifetime is not less than context's lifetime
CV_EXPORTS const SVMFunctions* getSVMFunctions(const ocl::Context& context);
CV_EXPORTS bool useSVM(UMatUsageFlags usageFlags);
}}} //namespace cv::ocl::svm
#endif
#endif // OPENCV_CORE_OPENCL_SVM_HPP
/* End of file. */
@@ -0,0 +1,714 @@
//
// AUTOGENERATED, DO NOT EDIT
//
#ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP
#error "Invalid usage"
#endif
// generated by parser_clamdblas.py
#define clAmdBlasAddScratchImage clAmdBlasAddScratchImage_
#define clAmdBlasCaxpy clAmdBlasCaxpy_
#define clAmdBlasCcopy clAmdBlasCcopy_
#define clAmdBlasCdotc clAmdBlasCdotc_
#define clAmdBlasCdotu clAmdBlasCdotu_
#define clAmdBlasCgbmv clAmdBlasCgbmv_
#define clAmdBlasCgemm clAmdBlasCgemm_
#define clAmdBlasCgemmEx clAmdBlasCgemmEx_
#define clAmdBlasCgemv clAmdBlasCgemv_
#define clAmdBlasCgemvEx clAmdBlasCgemvEx_
#define clAmdBlasCgerc clAmdBlasCgerc_
#define clAmdBlasCgeru clAmdBlasCgeru_
#define clAmdBlasChbmv clAmdBlasChbmv_
#define clAmdBlasChemm clAmdBlasChemm_
#define clAmdBlasChemv clAmdBlasChemv_
#define clAmdBlasCher clAmdBlasCher_
#define clAmdBlasCher2 clAmdBlasCher2_
#define clAmdBlasCher2k clAmdBlasCher2k_
#define clAmdBlasCherk clAmdBlasCherk_
#define clAmdBlasChpmv clAmdBlasChpmv_
#define clAmdBlasChpr clAmdBlasChpr_
#define clAmdBlasChpr2 clAmdBlasChpr2_
#define clAmdBlasCrotg clAmdBlasCrotg_
#define clAmdBlasCscal clAmdBlasCscal_
#define clAmdBlasCsrot clAmdBlasCsrot_
#define clAmdBlasCsscal clAmdBlasCsscal_
#define clAmdBlasCswap clAmdBlasCswap_
#define clAmdBlasCsymm clAmdBlasCsymm_
#define clAmdBlasCsyr2k clAmdBlasCsyr2k_
#define clAmdBlasCsyr2kEx clAmdBlasCsyr2kEx_
#define clAmdBlasCsyrk clAmdBlasCsyrk_
#define clAmdBlasCsyrkEx clAmdBlasCsyrkEx_
#define clAmdBlasCtbmv clAmdBlasCtbmv_
#define clAmdBlasCtbsv clAmdBlasCtbsv_
#define clAmdBlasCtpmv clAmdBlasCtpmv_
#define clAmdBlasCtpsv clAmdBlasCtpsv_
#define clAmdBlasCtrmm clAmdBlasCtrmm_
#define clAmdBlasCtrmmEx clAmdBlasCtrmmEx_
#define clAmdBlasCtrmv clAmdBlasCtrmv_
#define clAmdBlasCtrsm clAmdBlasCtrsm_
#define clAmdBlasCtrsmEx clAmdBlasCtrsmEx_
#define clAmdBlasCtrsv clAmdBlasCtrsv_
#define clAmdBlasDasum clAmdBlasDasum_
#define clAmdBlasDaxpy clAmdBlasDaxpy_
#define clAmdBlasDcopy clAmdBlasDcopy_
#define clAmdBlasDdot clAmdBlasDdot_
#define clAmdBlasDgbmv clAmdBlasDgbmv_
#define clAmdBlasDgemm clAmdBlasDgemm_
#define clAmdBlasDgemmEx clAmdBlasDgemmEx_
#define clAmdBlasDgemv clAmdBlasDgemv_
#define clAmdBlasDgemvEx clAmdBlasDgemvEx_
#define clAmdBlasDger clAmdBlasDger_
#define clAmdBlasDnrm2 clAmdBlasDnrm2_
#define clAmdBlasDrot clAmdBlasDrot_
#define clAmdBlasDrotg clAmdBlasDrotg_
#define clAmdBlasDrotm clAmdBlasDrotm_
#define clAmdBlasDrotmg clAmdBlasDrotmg_
#define clAmdBlasDsbmv clAmdBlasDsbmv_
#define clAmdBlasDscal clAmdBlasDscal_
#define clAmdBlasDspmv clAmdBlasDspmv_
#define clAmdBlasDspr clAmdBlasDspr_
#define clAmdBlasDspr2 clAmdBlasDspr2_
#define clAmdBlasDswap clAmdBlasDswap_
#define clAmdBlasDsymm clAmdBlasDsymm_
#define clAmdBlasDsymv clAmdBlasDsymv_
#define clAmdBlasDsymvEx clAmdBlasDsymvEx_
#define clAmdBlasDsyr clAmdBlasDsyr_
#define clAmdBlasDsyr2 clAmdBlasDsyr2_
#define clAmdBlasDsyr2k clAmdBlasDsyr2k_
#define clAmdBlasDsyr2kEx clAmdBlasDsyr2kEx_
#define clAmdBlasDsyrk clAmdBlasDsyrk_
#define clAmdBlasDsyrkEx clAmdBlasDsyrkEx_
#define clAmdBlasDtbmv clAmdBlasDtbmv_
#define clAmdBlasDtbsv clAmdBlasDtbsv_
#define clAmdBlasDtpmv clAmdBlasDtpmv_
#define clAmdBlasDtpsv clAmdBlasDtpsv_
#define clAmdBlasDtrmm clAmdBlasDtrmm_
#define clAmdBlasDtrmmEx clAmdBlasDtrmmEx_
#define clAmdBlasDtrmv clAmdBlasDtrmv_
#define clAmdBlasDtrsm clAmdBlasDtrsm_
#define clAmdBlasDtrsmEx clAmdBlasDtrsmEx_
#define clAmdBlasDtrsv clAmdBlasDtrsv_
#define clAmdBlasDzasum clAmdBlasDzasum_
#define clAmdBlasDznrm2 clAmdBlasDznrm2_
#define clAmdBlasGetVersion clAmdBlasGetVersion_
#define clAmdBlasRemoveScratchImage clAmdBlasRemoveScratchImage_
#define clAmdBlasSasum clAmdBlasSasum_
#define clAmdBlasSaxpy clAmdBlasSaxpy_
#define clAmdBlasScasum clAmdBlasScasum_
#define clAmdBlasScnrm2 clAmdBlasScnrm2_
#define clAmdBlasScopy clAmdBlasScopy_
#define clAmdBlasSdot clAmdBlasSdot_
#define clAmdBlasSetup clAmdBlasSetup_
#define clAmdBlasSgbmv clAmdBlasSgbmv_
#define clAmdBlasSgemm clAmdBlasSgemm_
#define clAmdBlasSgemmEx clAmdBlasSgemmEx_
#define clAmdBlasSgemv clAmdBlasSgemv_
#define clAmdBlasSgemvEx clAmdBlasSgemvEx_
#define clAmdBlasSger clAmdBlasSger_
#define clAmdBlasSnrm2 clAmdBlasSnrm2_
#define clAmdBlasSrot clAmdBlasSrot_
#define clAmdBlasSrotg clAmdBlasSrotg_
#define clAmdBlasSrotm clAmdBlasSrotm_
#define clAmdBlasSrotmg clAmdBlasSrotmg_
#define clAmdBlasSsbmv clAmdBlasSsbmv_
#define clAmdBlasSscal clAmdBlasSscal_
#define clAmdBlasSspmv clAmdBlasSspmv_
#define clAmdBlasSspr clAmdBlasSspr_
#define clAmdBlasSspr2 clAmdBlasSspr2_
#define clAmdBlasSswap clAmdBlasSswap_
#define clAmdBlasSsymm clAmdBlasSsymm_
#define clAmdBlasSsymv clAmdBlasSsymv_
#define clAmdBlasSsymvEx clAmdBlasSsymvEx_
#define clAmdBlasSsyr clAmdBlasSsyr_
#define clAmdBlasSsyr2 clAmdBlasSsyr2_
#define clAmdBlasSsyr2k clAmdBlasSsyr2k_
#define clAmdBlasSsyr2kEx clAmdBlasSsyr2kEx_
#define clAmdBlasSsyrk clAmdBlasSsyrk_
#define clAmdBlasSsyrkEx clAmdBlasSsyrkEx_
#define clAmdBlasStbmv clAmdBlasStbmv_
#define clAmdBlasStbsv clAmdBlasStbsv_
#define clAmdBlasStpmv clAmdBlasStpmv_
#define clAmdBlasStpsv clAmdBlasStpsv_
#define clAmdBlasStrmm clAmdBlasStrmm_
#define clAmdBlasStrmmEx clAmdBlasStrmmEx_
#define clAmdBlasStrmv clAmdBlasStrmv_
#define clAmdBlasStrsm clAmdBlasStrsm_
#define clAmdBlasStrsmEx clAmdBlasStrsmEx_
#define clAmdBlasStrsv clAmdBlasStrsv_
#define clAmdBlasTeardown clAmdBlasTeardown_
#define clAmdBlasZaxpy clAmdBlasZaxpy_
#define clAmdBlasZcopy clAmdBlasZcopy_
#define clAmdBlasZdotc clAmdBlasZdotc_
#define clAmdBlasZdotu clAmdBlasZdotu_
#define clAmdBlasZdrot clAmdBlasZdrot_
#define clAmdBlasZdscal clAmdBlasZdscal_
#define clAmdBlasZgbmv clAmdBlasZgbmv_
#define clAmdBlasZgemm clAmdBlasZgemm_
#define clAmdBlasZgemmEx clAmdBlasZgemmEx_
#define clAmdBlasZgemv clAmdBlasZgemv_
#define clAmdBlasZgemvEx clAmdBlasZgemvEx_
#define clAmdBlasZgerc clAmdBlasZgerc_
#define clAmdBlasZgeru clAmdBlasZgeru_
#define clAmdBlasZhbmv clAmdBlasZhbmv_
#define clAmdBlasZhemm clAmdBlasZhemm_
#define clAmdBlasZhemv clAmdBlasZhemv_
#define clAmdBlasZher clAmdBlasZher_
#define clAmdBlasZher2 clAmdBlasZher2_
#define clAmdBlasZher2k clAmdBlasZher2k_
#define clAmdBlasZherk clAmdBlasZherk_
#define clAmdBlasZhpmv clAmdBlasZhpmv_
#define clAmdBlasZhpr clAmdBlasZhpr_
#define clAmdBlasZhpr2 clAmdBlasZhpr2_
#define clAmdBlasZrotg clAmdBlasZrotg_
#define clAmdBlasZscal clAmdBlasZscal_
#define clAmdBlasZswap clAmdBlasZswap_
#define clAmdBlasZsymm clAmdBlasZsymm_
#define clAmdBlasZsyr2k clAmdBlasZsyr2k_
#define clAmdBlasZsyr2kEx clAmdBlasZsyr2kEx_
#define clAmdBlasZsyrk clAmdBlasZsyrk_
#define clAmdBlasZsyrkEx clAmdBlasZsyrkEx_
#define clAmdBlasZtbmv clAmdBlasZtbmv_
#define clAmdBlasZtbsv clAmdBlasZtbsv_
#define clAmdBlasZtpmv clAmdBlasZtpmv_
#define clAmdBlasZtpsv clAmdBlasZtpsv_
#define clAmdBlasZtrmm clAmdBlasZtrmm_
#define clAmdBlasZtrmmEx clAmdBlasZtrmmEx_
#define clAmdBlasZtrmv clAmdBlasZtrmv_
#define clAmdBlasZtrsm clAmdBlasZtrsm_
#define clAmdBlasZtrsmEx clAmdBlasZtrsmEx_
#define clAmdBlasZtrsv clAmdBlasZtrsv_
#define clAmdBlasiCamax clAmdBlasiCamax_
#define clAmdBlasiDamax clAmdBlasiDamax_
#define clAmdBlasiSamax clAmdBlasiSamax_
#define clAmdBlasiZamax clAmdBlasiZamax_
#include <clAmdBlas.h>
// generated by parser_clamdblas.py
#undef clAmdBlasAddScratchImage
//#define clAmdBlasAddScratchImage clAmdBlasAddScratchImage_pfn
#undef clAmdBlasCaxpy
//#define clAmdBlasCaxpy clAmdBlasCaxpy_pfn
#undef clAmdBlasCcopy
//#define clAmdBlasCcopy clAmdBlasCcopy_pfn
#undef clAmdBlasCdotc
//#define clAmdBlasCdotc clAmdBlasCdotc_pfn
#undef clAmdBlasCdotu
//#define clAmdBlasCdotu clAmdBlasCdotu_pfn
#undef clAmdBlasCgbmv
//#define clAmdBlasCgbmv clAmdBlasCgbmv_pfn
#undef clAmdBlasCgemm
//#define clAmdBlasCgemm clAmdBlasCgemm_pfn
#undef clAmdBlasCgemmEx
#define clAmdBlasCgemmEx clAmdBlasCgemmEx_pfn
#undef clAmdBlasCgemv
//#define clAmdBlasCgemv clAmdBlasCgemv_pfn
#undef clAmdBlasCgemvEx
//#define clAmdBlasCgemvEx clAmdBlasCgemvEx_pfn
#undef clAmdBlasCgerc
//#define clAmdBlasCgerc clAmdBlasCgerc_pfn
#undef clAmdBlasCgeru
//#define clAmdBlasCgeru clAmdBlasCgeru_pfn
#undef clAmdBlasChbmv
//#define clAmdBlasChbmv clAmdBlasChbmv_pfn
#undef clAmdBlasChemm
//#define clAmdBlasChemm clAmdBlasChemm_pfn
#undef clAmdBlasChemv
//#define clAmdBlasChemv clAmdBlasChemv_pfn
#undef clAmdBlasCher
//#define clAmdBlasCher clAmdBlasCher_pfn
#undef clAmdBlasCher2
//#define clAmdBlasCher2 clAmdBlasCher2_pfn
#undef clAmdBlasCher2k
//#define clAmdBlasCher2k clAmdBlasCher2k_pfn
#undef clAmdBlasCherk
//#define clAmdBlasCherk clAmdBlasCherk_pfn
#undef clAmdBlasChpmv
//#define clAmdBlasChpmv clAmdBlasChpmv_pfn
#undef clAmdBlasChpr
//#define clAmdBlasChpr clAmdBlasChpr_pfn
#undef clAmdBlasChpr2
//#define clAmdBlasChpr2 clAmdBlasChpr2_pfn
#undef clAmdBlasCrotg
//#define clAmdBlasCrotg clAmdBlasCrotg_pfn
#undef clAmdBlasCscal
//#define clAmdBlasCscal clAmdBlasCscal_pfn
#undef clAmdBlasCsrot
//#define clAmdBlasCsrot clAmdBlasCsrot_pfn
#undef clAmdBlasCsscal
//#define clAmdBlasCsscal clAmdBlasCsscal_pfn
#undef clAmdBlasCswap
//#define clAmdBlasCswap clAmdBlasCswap_pfn
#undef clAmdBlasCsymm
//#define clAmdBlasCsymm clAmdBlasCsymm_pfn
#undef clAmdBlasCsyr2k
//#define clAmdBlasCsyr2k clAmdBlasCsyr2k_pfn
#undef clAmdBlasCsyr2kEx
//#define clAmdBlasCsyr2kEx clAmdBlasCsyr2kEx_pfn
#undef clAmdBlasCsyrk
//#define clAmdBlasCsyrk clAmdBlasCsyrk_pfn
#undef clAmdBlasCsyrkEx
//#define clAmdBlasCsyrkEx clAmdBlasCsyrkEx_pfn
#undef clAmdBlasCtbmv
//#define clAmdBlasCtbmv clAmdBlasCtbmv_pfn
#undef clAmdBlasCtbsv
//#define clAmdBlasCtbsv clAmdBlasCtbsv_pfn
#undef clAmdBlasCtpmv
//#define clAmdBlasCtpmv clAmdBlasCtpmv_pfn
#undef clAmdBlasCtpsv
//#define clAmdBlasCtpsv clAmdBlasCtpsv_pfn
#undef clAmdBlasCtrmm
//#define clAmdBlasCtrmm clAmdBlasCtrmm_pfn
#undef clAmdBlasCtrmmEx
//#define clAmdBlasCtrmmEx clAmdBlasCtrmmEx_pfn
#undef clAmdBlasCtrmv
//#define clAmdBlasCtrmv clAmdBlasCtrmv_pfn
#undef clAmdBlasCtrsm
//#define clAmdBlasCtrsm clAmdBlasCtrsm_pfn
#undef clAmdBlasCtrsmEx
//#define clAmdBlasCtrsmEx clAmdBlasCtrsmEx_pfn
#undef clAmdBlasCtrsv
//#define clAmdBlasCtrsv clAmdBlasCtrsv_pfn
#undef clAmdBlasDasum
//#define clAmdBlasDasum clAmdBlasDasum_pfn
#undef clAmdBlasDaxpy
//#define clAmdBlasDaxpy clAmdBlasDaxpy_pfn
#undef clAmdBlasDcopy
//#define clAmdBlasDcopy clAmdBlasDcopy_pfn
#undef clAmdBlasDdot
//#define clAmdBlasDdot clAmdBlasDdot_pfn
#undef clAmdBlasDgbmv
//#define clAmdBlasDgbmv clAmdBlasDgbmv_pfn
#undef clAmdBlasDgemm
//#define clAmdBlasDgemm clAmdBlasDgemm_pfn
#undef clAmdBlasDgemmEx
#define clAmdBlasDgemmEx clAmdBlasDgemmEx_pfn
#undef clAmdBlasDgemv
//#define clAmdBlasDgemv clAmdBlasDgemv_pfn
#undef clAmdBlasDgemvEx
//#define clAmdBlasDgemvEx clAmdBlasDgemvEx_pfn
#undef clAmdBlasDger
//#define clAmdBlasDger clAmdBlasDger_pfn
#undef clAmdBlasDnrm2
//#define clAmdBlasDnrm2 clAmdBlasDnrm2_pfn
#undef clAmdBlasDrot
//#define clAmdBlasDrot clAmdBlasDrot_pfn
#undef clAmdBlasDrotg
//#define clAmdBlasDrotg clAmdBlasDrotg_pfn
#undef clAmdBlasDrotm
//#define clAmdBlasDrotm clAmdBlasDrotm_pfn
#undef clAmdBlasDrotmg
//#define clAmdBlasDrotmg clAmdBlasDrotmg_pfn
#undef clAmdBlasDsbmv
//#define clAmdBlasDsbmv clAmdBlasDsbmv_pfn
#undef clAmdBlasDscal
//#define clAmdBlasDscal clAmdBlasDscal_pfn
#undef clAmdBlasDspmv
//#define clAmdBlasDspmv clAmdBlasDspmv_pfn
#undef clAmdBlasDspr
//#define clAmdBlasDspr clAmdBlasDspr_pfn
#undef clAmdBlasDspr2
//#define clAmdBlasDspr2 clAmdBlasDspr2_pfn
#undef clAmdBlasDswap
//#define clAmdBlasDswap clAmdBlasDswap_pfn
#undef clAmdBlasDsymm
//#define clAmdBlasDsymm clAmdBlasDsymm_pfn
#undef clAmdBlasDsymv
//#define clAmdBlasDsymv clAmdBlasDsymv_pfn
#undef clAmdBlasDsymvEx
//#define clAmdBlasDsymvEx clAmdBlasDsymvEx_pfn
#undef clAmdBlasDsyr
//#define clAmdBlasDsyr clAmdBlasDsyr_pfn
#undef clAmdBlasDsyr2
//#define clAmdBlasDsyr2 clAmdBlasDsyr2_pfn
#undef clAmdBlasDsyr2k
//#define clAmdBlasDsyr2k clAmdBlasDsyr2k_pfn
#undef clAmdBlasDsyr2kEx
//#define clAmdBlasDsyr2kEx clAmdBlasDsyr2kEx_pfn
#undef clAmdBlasDsyrk
//#define clAmdBlasDsyrk clAmdBlasDsyrk_pfn
#undef clAmdBlasDsyrkEx
//#define clAmdBlasDsyrkEx clAmdBlasDsyrkEx_pfn
#undef clAmdBlasDtbmv
//#define clAmdBlasDtbmv clAmdBlasDtbmv_pfn
#undef clAmdBlasDtbsv
//#define clAmdBlasDtbsv clAmdBlasDtbsv_pfn
#undef clAmdBlasDtpmv
//#define clAmdBlasDtpmv clAmdBlasDtpmv_pfn
#undef clAmdBlasDtpsv
//#define clAmdBlasDtpsv clAmdBlasDtpsv_pfn
#undef clAmdBlasDtrmm
//#define clAmdBlasDtrmm clAmdBlasDtrmm_pfn
#undef clAmdBlasDtrmmEx
//#define clAmdBlasDtrmmEx clAmdBlasDtrmmEx_pfn
#undef clAmdBlasDtrmv
//#define clAmdBlasDtrmv clAmdBlasDtrmv_pfn
#undef clAmdBlasDtrsm
//#define clAmdBlasDtrsm clAmdBlasDtrsm_pfn
#undef clAmdBlasDtrsmEx
//#define clAmdBlasDtrsmEx clAmdBlasDtrsmEx_pfn
#undef clAmdBlasDtrsv
//#define clAmdBlasDtrsv clAmdBlasDtrsv_pfn
#undef clAmdBlasDzasum
//#define clAmdBlasDzasum clAmdBlasDzasum_pfn
#undef clAmdBlasDznrm2
//#define clAmdBlasDznrm2 clAmdBlasDznrm2_pfn
#undef clAmdBlasGetVersion
//#define clAmdBlasGetVersion clAmdBlasGetVersion_pfn
#undef clAmdBlasRemoveScratchImage
//#define clAmdBlasRemoveScratchImage clAmdBlasRemoveScratchImage_pfn
#undef clAmdBlasSasum
//#define clAmdBlasSasum clAmdBlasSasum_pfn
#undef clAmdBlasSaxpy
//#define clAmdBlasSaxpy clAmdBlasSaxpy_pfn
#undef clAmdBlasScasum
//#define clAmdBlasScasum clAmdBlasScasum_pfn
#undef clAmdBlasScnrm2
//#define clAmdBlasScnrm2 clAmdBlasScnrm2_pfn
#undef clAmdBlasScopy
//#define clAmdBlasScopy clAmdBlasScopy_pfn
#undef clAmdBlasSdot
//#define clAmdBlasSdot clAmdBlasSdot_pfn
#undef clAmdBlasSetup
#define clAmdBlasSetup clAmdBlasSetup_pfn
#undef clAmdBlasSgbmv
//#define clAmdBlasSgbmv clAmdBlasSgbmv_pfn
#undef clAmdBlasSgemm
//#define clAmdBlasSgemm clAmdBlasSgemm_pfn
#undef clAmdBlasSgemmEx
#define clAmdBlasSgemmEx clAmdBlasSgemmEx_pfn
#undef clAmdBlasSgemv
//#define clAmdBlasSgemv clAmdBlasSgemv_pfn
#undef clAmdBlasSgemvEx
//#define clAmdBlasSgemvEx clAmdBlasSgemvEx_pfn
#undef clAmdBlasSger
//#define clAmdBlasSger clAmdBlasSger_pfn
#undef clAmdBlasSnrm2
//#define clAmdBlasSnrm2 clAmdBlasSnrm2_pfn
#undef clAmdBlasSrot
//#define clAmdBlasSrot clAmdBlasSrot_pfn
#undef clAmdBlasSrotg
//#define clAmdBlasSrotg clAmdBlasSrotg_pfn
#undef clAmdBlasSrotm
//#define clAmdBlasSrotm clAmdBlasSrotm_pfn
#undef clAmdBlasSrotmg
//#define clAmdBlasSrotmg clAmdBlasSrotmg_pfn
#undef clAmdBlasSsbmv
//#define clAmdBlasSsbmv clAmdBlasSsbmv_pfn
#undef clAmdBlasSscal
//#define clAmdBlasSscal clAmdBlasSscal_pfn
#undef clAmdBlasSspmv
//#define clAmdBlasSspmv clAmdBlasSspmv_pfn
#undef clAmdBlasSspr
//#define clAmdBlasSspr clAmdBlasSspr_pfn
#undef clAmdBlasSspr2
//#define clAmdBlasSspr2 clAmdBlasSspr2_pfn
#undef clAmdBlasSswap
//#define clAmdBlasSswap clAmdBlasSswap_pfn
#undef clAmdBlasSsymm
//#define clAmdBlasSsymm clAmdBlasSsymm_pfn
#undef clAmdBlasSsymv
//#define clAmdBlasSsymv clAmdBlasSsymv_pfn
#undef clAmdBlasSsymvEx
//#define clAmdBlasSsymvEx clAmdBlasSsymvEx_pfn
#undef clAmdBlasSsyr
//#define clAmdBlasSsyr clAmdBlasSsyr_pfn
#undef clAmdBlasSsyr2
//#define clAmdBlasSsyr2 clAmdBlasSsyr2_pfn
#undef clAmdBlasSsyr2k
//#define clAmdBlasSsyr2k clAmdBlasSsyr2k_pfn
#undef clAmdBlasSsyr2kEx
//#define clAmdBlasSsyr2kEx clAmdBlasSsyr2kEx_pfn
#undef clAmdBlasSsyrk
//#define clAmdBlasSsyrk clAmdBlasSsyrk_pfn
#undef clAmdBlasSsyrkEx
//#define clAmdBlasSsyrkEx clAmdBlasSsyrkEx_pfn
#undef clAmdBlasStbmv
//#define clAmdBlasStbmv clAmdBlasStbmv_pfn
#undef clAmdBlasStbsv
//#define clAmdBlasStbsv clAmdBlasStbsv_pfn
#undef clAmdBlasStpmv
//#define clAmdBlasStpmv clAmdBlasStpmv_pfn
#undef clAmdBlasStpsv
//#define clAmdBlasStpsv clAmdBlasStpsv_pfn
#undef clAmdBlasStrmm
//#define clAmdBlasStrmm clAmdBlasStrmm_pfn
#undef clAmdBlasStrmmEx
//#define clAmdBlasStrmmEx clAmdBlasStrmmEx_pfn
#undef clAmdBlasStrmv
//#define clAmdBlasStrmv clAmdBlasStrmv_pfn
#undef clAmdBlasStrsm
//#define clAmdBlasStrsm clAmdBlasStrsm_pfn
#undef clAmdBlasStrsmEx
//#define clAmdBlasStrsmEx clAmdBlasStrsmEx_pfn
#undef clAmdBlasStrsv
//#define clAmdBlasStrsv clAmdBlasStrsv_pfn
#undef clAmdBlasTeardown
#define clAmdBlasTeardown clAmdBlasTeardown_pfn
#undef clAmdBlasZaxpy
//#define clAmdBlasZaxpy clAmdBlasZaxpy_pfn
#undef clAmdBlasZcopy
//#define clAmdBlasZcopy clAmdBlasZcopy_pfn
#undef clAmdBlasZdotc
//#define clAmdBlasZdotc clAmdBlasZdotc_pfn
#undef clAmdBlasZdotu
//#define clAmdBlasZdotu clAmdBlasZdotu_pfn
#undef clAmdBlasZdrot
//#define clAmdBlasZdrot clAmdBlasZdrot_pfn
#undef clAmdBlasZdscal
//#define clAmdBlasZdscal clAmdBlasZdscal_pfn
#undef clAmdBlasZgbmv
//#define clAmdBlasZgbmv clAmdBlasZgbmv_pfn
#undef clAmdBlasZgemm
//#define clAmdBlasZgemm clAmdBlasZgemm_pfn
#undef clAmdBlasZgemmEx
#define clAmdBlasZgemmEx clAmdBlasZgemmEx_pfn
#undef clAmdBlasZgemv
//#define clAmdBlasZgemv clAmdBlasZgemv_pfn
#undef clAmdBlasZgemvEx
//#define clAmdBlasZgemvEx clAmdBlasZgemvEx_pfn
#undef clAmdBlasZgerc
//#define clAmdBlasZgerc clAmdBlasZgerc_pfn
#undef clAmdBlasZgeru
//#define clAmdBlasZgeru clAmdBlasZgeru_pfn
#undef clAmdBlasZhbmv
//#define clAmdBlasZhbmv clAmdBlasZhbmv_pfn
#undef clAmdBlasZhemm
//#define clAmdBlasZhemm clAmdBlasZhemm_pfn
#undef clAmdBlasZhemv
//#define clAmdBlasZhemv clAmdBlasZhemv_pfn
#undef clAmdBlasZher
//#define clAmdBlasZher clAmdBlasZher_pfn
#undef clAmdBlasZher2
//#define clAmdBlasZher2 clAmdBlasZher2_pfn
#undef clAmdBlasZher2k
//#define clAmdBlasZher2k clAmdBlasZher2k_pfn
#undef clAmdBlasZherk
//#define clAmdBlasZherk clAmdBlasZherk_pfn
#undef clAmdBlasZhpmv
//#define clAmdBlasZhpmv clAmdBlasZhpmv_pfn
#undef clAmdBlasZhpr
//#define clAmdBlasZhpr clAmdBlasZhpr_pfn
#undef clAmdBlasZhpr2
//#define clAmdBlasZhpr2 clAmdBlasZhpr2_pfn
#undef clAmdBlasZrotg
//#define clAmdBlasZrotg clAmdBlasZrotg_pfn
#undef clAmdBlasZscal
//#define clAmdBlasZscal clAmdBlasZscal_pfn
#undef clAmdBlasZswap
//#define clAmdBlasZswap clAmdBlasZswap_pfn
#undef clAmdBlasZsymm
//#define clAmdBlasZsymm clAmdBlasZsymm_pfn
#undef clAmdBlasZsyr2k
//#define clAmdBlasZsyr2k clAmdBlasZsyr2k_pfn
#undef clAmdBlasZsyr2kEx
//#define clAmdBlasZsyr2kEx clAmdBlasZsyr2kEx_pfn
#undef clAmdBlasZsyrk
//#define clAmdBlasZsyrk clAmdBlasZsyrk_pfn
#undef clAmdBlasZsyrkEx
//#define clAmdBlasZsyrkEx clAmdBlasZsyrkEx_pfn
#undef clAmdBlasZtbmv
//#define clAmdBlasZtbmv clAmdBlasZtbmv_pfn
#undef clAmdBlasZtbsv
//#define clAmdBlasZtbsv clAmdBlasZtbsv_pfn
#undef clAmdBlasZtpmv
//#define clAmdBlasZtpmv clAmdBlasZtpmv_pfn
#undef clAmdBlasZtpsv
//#define clAmdBlasZtpsv clAmdBlasZtpsv_pfn
#undef clAmdBlasZtrmm
//#define clAmdBlasZtrmm clAmdBlasZtrmm_pfn
#undef clAmdBlasZtrmmEx
//#define clAmdBlasZtrmmEx clAmdBlasZtrmmEx_pfn
#undef clAmdBlasZtrmv
//#define clAmdBlasZtrmv clAmdBlasZtrmv_pfn
#undef clAmdBlasZtrsm
//#define clAmdBlasZtrsm clAmdBlasZtrsm_pfn
#undef clAmdBlasZtrsmEx
//#define clAmdBlasZtrsmEx clAmdBlasZtrsmEx_pfn
#undef clAmdBlasZtrsv
//#define clAmdBlasZtrsv clAmdBlasZtrsv_pfn
#undef clAmdBlasiCamax
//#define clAmdBlasiCamax clAmdBlasiCamax_pfn
#undef clAmdBlasiDamax
//#define clAmdBlasiDamax clAmdBlasiDamax_pfn
#undef clAmdBlasiSamax
//#define clAmdBlasiSamax clAmdBlasiSamax_pfn
#undef clAmdBlasiZamax
//#define clAmdBlasiZamax clAmdBlasiZamax_pfn
// generated by parser_clamdblas.py
//extern CL_RUNTIME_EXPORT cl_ulong (*clAmdBlasAddScratchImage)(cl_context context, size_t width, size_t height, clAmdBlasStatus* status);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCaxpy)(size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCcopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCdotc)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCdotu)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, FloatComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, FloatComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, FloatComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, FloatComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgerc)(clAmdBlasOrder order, size_t M, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCgeru)(clAmdBlasOrder order, size_t M, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChemm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChemv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, FloatComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, FloatComplex beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCher)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCher2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCher2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCherk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, float alpha, const cl_mem A, size_t offa, size_t lda, float beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float2 alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_float2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChpr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasChpr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCrotg)(cl_mem CA, size_t offCA, cl_mem CB, size_t offCB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCscal)(size_t N, cl_float2 alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_float C, cl_float S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsscal)(size_t N, cl_float alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_float2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, FloatComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, FloatComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t lda, FloatComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, FloatComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, FloatComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasCtrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDaxpy)(size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDcopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDdot)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_double alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_double beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_double beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDger)(clAmdBlasOrder order, size_t M, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDnrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_double C, cl_double S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrotg)(cl_mem DA, size_t offDA, cl_mem DB, size_t offDB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrotm)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, const cl_mem DPARAM, size_t offDparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDrotmg)(cl_mem DD1, size_t offDD1, cl_mem DD2, size_t offDD2, cl_mem DX1, size_t offDX1, const cl_mem DY1, size_t offDY1, cl_mem DPARAM, size_t offDparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDscal)(size_t N, cl_double alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDspmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_double beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDspr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDspr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsymv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsymvEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_double beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_double beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_double beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t lda, cl_double beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_double alpha, const cl_mem A, size_t offA, size_t lda, cl_double beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_double alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDtrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDzasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasDznrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasGetVersion)(cl_uint* major, cl_uint* minor, cl_uint* patch);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasRemoveScratchImage)(cl_ulong imageID);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSaxpy)(size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasScasum)(size_t N, cl_mem asum, size_t offAsum, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasScnrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasScopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSdot)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSetup)();
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_float alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_float beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_float beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSger)(clAmdBlasOrder order, size_t M, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSnrm2)(size_t N, cl_mem NRM2, size_t offNRM2, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_float C, cl_float S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrotg)(cl_mem SA, size_t offSA, cl_mem SB, size_t offSB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrotm)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, const cl_mem SPARAM, size_t offSparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSrotmg)(cl_mem SD1, size_t offSD1, cl_mem SD2, size_t offSD2, cl_mem SX1, size_t offSX1, const cl_mem SY1, size_t offSY1, cl_mem SPARAM, size_t offSparam, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_float beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSscal)(size_t N, cl_float alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSspmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_float beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSspr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSspr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_float beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsymv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsymvEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, cl_float beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_float alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, cl_float beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, cl_float beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t lda, cl_float beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasSsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, cl_float alpha, const cl_mem A, size_t offA, size_t lda, cl_float beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, cl_float alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasStrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
extern CL_RUNTIME_EXPORT void (*clAmdBlasTeardown)();
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZaxpy)(size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZcopy)(size_t N, const cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdotc)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdotu)(size_t N, cl_mem dotProduct, size_t offDP, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdrot)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_double C, cl_double S, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZdscal)(size_t N, cl_double alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgbmv)(clAmdBlasOrder order, clAmdBlasTranspose trans, size_t M, size_t N, size_t KL, size_t KU, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemm)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, DoubleComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemmEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, clAmdBlasTranspose transB, size_t M, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, DoubleComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemv)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t lda, const cl_mem x, size_t offx, int incx, DoubleComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgemvEx)(clAmdBlasOrder order, clAmdBlasTranspose transA, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem x, size_t offx, int incx, DoubleComplex beta, cl_mem y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgerc)(clAmdBlasOrder order, size_t M, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZgeru)(clAmdBlasOrder order, size_t M, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, size_t K, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, cl_double2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhemm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhemv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, DoubleComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem X, size_t offx, int incx, DoubleComplex beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZher)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZher2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem A, size_t offa, size_t lda, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZher2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZherk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, double alpha, const cl_mem A, size_t offa, size_t lda, double beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double2 alpha, const cl_mem AP, size_t offa, const cl_mem X, size_t offx, int incx, cl_double2 beta, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhpr)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double alpha, const cl_mem X, size_t offx, int incx, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZhpr2)(clAmdBlasOrder order, clAmdBlasUplo uplo, size_t N, cl_double2 alpha, const cl_mem X, size_t offx, int incx, const cl_mem Y, size_t offy, int incy, cl_mem AP, size_t offa, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZrotg)(cl_mem CA, size_t offCA, cl_mem CB, size_t offCB, cl_mem C, size_t offC, cl_mem S, size_t offS, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZscal)(size_t N, cl_double2 alpha, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZswap)(size_t N, cl_mem X, size_t offx, int incx, cl_mem Y, size_t offy, int incy, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsymm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, size_t M, size_t N, cl_double2 alpha, const cl_mem A, size_t offa, size_t lda, const cl_mem B, size_t offb, size_t ldb, cl_double2 beta, cl_mem C, size_t offc, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyr2k)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t lda, const cl_mem B, size_t ldb, DoubleComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyr2kEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transAB, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, const cl_mem B, size_t offB, size_t ldb, DoubleComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyrk)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t lda, DoubleComplex beta, cl_mem C, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZsyrkEx)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose transA, size_t N, size_t K, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, DoubleComplex beta, cl_mem C, size_t offC, size_t ldc, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtbmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtbsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, size_t K, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtpmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem AP, size_t offa, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtpsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrmm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrmmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrmv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrsm)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t lda, cl_mem B, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrsmEx)(clAmdBlasOrder order, clAmdBlasSide side, clAmdBlasUplo uplo, clAmdBlasTranspose transA, clAmdBlasDiag diag, size_t M, size_t N, DoubleComplex alpha, const cl_mem A, size_t offA, size_t lda, cl_mem B, size_t offB, size_t ldb, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasZtrsv)(clAmdBlasOrder order, clAmdBlasUplo uplo, clAmdBlasTranspose trans, clAmdBlasDiag diag, size_t N, const cl_mem A, size_t offa, size_t lda, cl_mem X, size_t offx, int incx, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiCamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiDamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiSamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
//extern CL_RUNTIME_EXPORT clAmdBlasStatus (*clAmdBlasiZamax)(size_t N, cl_mem iMax, size_t offiMax, const cl_mem X, size_t offx, int incx, cl_mem scratchBuff, cl_uint numCommandQueues, cl_command_queue* commandQueues, cl_uint numEventsInWaitList, const cl_event* eventWaitList, cl_event* events);
@@ -0,0 +1,142 @@
//
// AUTOGENERATED, DO NOT EDIT
//
#ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP
#error "Invalid usage"
#endif
// generated by parser_clamdfft.py
#define clAmdFftBakePlan clAmdFftBakePlan_
#define clAmdFftCopyPlan clAmdFftCopyPlan_
#define clAmdFftCreateDefaultPlan clAmdFftCreateDefaultPlan_
#define clAmdFftDestroyPlan clAmdFftDestroyPlan_
#define clAmdFftEnqueueTransform clAmdFftEnqueueTransform_
#define clAmdFftGetLayout clAmdFftGetLayout_
#define clAmdFftGetPlanBatchSize clAmdFftGetPlanBatchSize_
#define clAmdFftGetPlanContext clAmdFftGetPlanContext_
#define clAmdFftGetPlanDim clAmdFftGetPlanDim_
#define clAmdFftGetPlanDistance clAmdFftGetPlanDistance_
#define clAmdFftGetPlanInStride clAmdFftGetPlanInStride_
#define clAmdFftGetPlanLength clAmdFftGetPlanLength_
#define clAmdFftGetPlanOutStride clAmdFftGetPlanOutStride_
#define clAmdFftGetPlanPrecision clAmdFftGetPlanPrecision_
#define clAmdFftGetPlanScale clAmdFftGetPlanScale_
#define clAmdFftGetPlanTransposeResult clAmdFftGetPlanTransposeResult_
#define clAmdFftGetResultLocation clAmdFftGetResultLocation_
#define clAmdFftGetTmpBufSize clAmdFftGetTmpBufSize_
#define clAmdFftGetVersion clAmdFftGetVersion_
#define clAmdFftSetLayout clAmdFftSetLayout_
#define clAmdFftSetPlanBatchSize clAmdFftSetPlanBatchSize_
#define clAmdFftSetPlanDim clAmdFftSetPlanDim_
#define clAmdFftSetPlanDistance clAmdFftSetPlanDistance_
#define clAmdFftSetPlanInStride clAmdFftSetPlanInStride_
#define clAmdFftSetPlanLength clAmdFftSetPlanLength_
#define clAmdFftSetPlanOutStride clAmdFftSetPlanOutStride_
#define clAmdFftSetPlanPrecision clAmdFftSetPlanPrecision_
#define clAmdFftSetPlanScale clAmdFftSetPlanScale_
#define clAmdFftSetPlanTransposeResult clAmdFftSetPlanTransposeResult_
#define clAmdFftSetResultLocation clAmdFftSetResultLocation_
#define clAmdFftSetup clAmdFftSetup_
#define clAmdFftTeardown clAmdFftTeardown_
#include <clAmdFft.h>
// generated by parser_clamdfft.py
#undef clAmdFftBakePlan
#define clAmdFftBakePlan clAmdFftBakePlan_pfn
#undef clAmdFftCopyPlan
//#define clAmdFftCopyPlan clAmdFftCopyPlan_pfn
#undef clAmdFftCreateDefaultPlan
#define clAmdFftCreateDefaultPlan clAmdFftCreateDefaultPlan_pfn
#undef clAmdFftDestroyPlan
#define clAmdFftDestroyPlan clAmdFftDestroyPlan_pfn
#undef clAmdFftEnqueueTransform
#define clAmdFftEnqueueTransform clAmdFftEnqueueTransform_pfn
#undef clAmdFftGetLayout
//#define clAmdFftGetLayout clAmdFftGetLayout_pfn
#undef clAmdFftGetPlanBatchSize
//#define clAmdFftGetPlanBatchSize clAmdFftGetPlanBatchSize_pfn
#undef clAmdFftGetPlanContext
//#define clAmdFftGetPlanContext clAmdFftGetPlanContext_pfn
#undef clAmdFftGetPlanDim
//#define clAmdFftGetPlanDim clAmdFftGetPlanDim_pfn
#undef clAmdFftGetPlanDistance
//#define clAmdFftGetPlanDistance clAmdFftGetPlanDistance_pfn
#undef clAmdFftGetPlanInStride
//#define clAmdFftGetPlanInStride clAmdFftGetPlanInStride_pfn
#undef clAmdFftGetPlanLength
//#define clAmdFftGetPlanLength clAmdFftGetPlanLength_pfn
#undef clAmdFftGetPlanOutStride
//#define clAmdFftGetPlanOutStride clAmdFftGetPlanOutStride_pfn
#undef clAmdFftGetPlanPrecision
//#define clAmdFftGetPlanPrecision clAmdFftGetPlanPrecision_pfn
#undef clAmdFftGetPlanScale
//#define clAmdFftGetPlanScale clAmdFftGetPlanScale_pfn
#undef clAmdFftGetPlanTransposeResult
//#define clAmdFftGetPlanTransposeResult clAmdFftGetPlanTransposeResult_pfn
#undef clAmdFftGetResultLocation
//#define clAmdFftGetResultLocation clAmdFftGetResultLocation_pfn
#undef clAmdFftGetTmpBufSize
#define clAmdFftGetTmpBufSize clAmdFftGetTmpBufSize_pfn
#undef clAmdFftGetVersion
#define clAmdFftGetVersion clAmdFftGetVersion_pfn
#undef clAmdFftSetLayout
#define clAmdFftSetLayout clAmdFftSetLayout_pfn
#undef clAmdFftSetPlanBatchSize
#define clAmdFftSetPlanBatchSize clAmdFftSetPlanBatchSize_pfn
#undef clAmdFftSetPlanDim
//#define clAmdFftSetPlanDim clAmdFftSetPlanDim_pfn
#undef clAmdFftSetPlanDistance
#define clAmdFftSetPlanDistance clAmdFftSetPlanDistance_pfn
#undef clAmdFftSetPlanInStride
#define clAmdFftSetPlanInStride clAmdFftSetPlanInStride_pfn
#undef clAmdFftSetPlanLength
//#define clAmdFftSetPlanLength clAmdFftSetPlanLength_pfn
#undef clAmdFftSetPlanOutStride
#define clAmdFftSetPlanOutStride clAmdFftSetPlanOutStride_pfn
#undef clAmdFftSetPlanPrecision
#define clAmdFftSetPlanPrecision clAmdFftSetPlanPrecision_pfn
#undef clAmdFftSetPlanScale
#define clAmdFftSetPlanScale clAmdFftSetPlanScale_pfn
#undef clAmdFftSetPlanTransposeResult
//#define clAmdFftSetPlanTransposeResult clAmdFftSetPlanTransposeResult_pfn
#undef clAmdFftSetResultLocation
#define clAmdFftSetResultLocation clAmdFftSetResultLocation_pfn
#undef clAmdFftSetup
#define clAmdFftSetup clAmdFftSetup_pfn
#undef clAmdFftTeardown
#define clAmdFftTeardown clAmdFftTeardown_pfn
// generated by parser_clamdfft.py
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftBakePlan)(clAmdFftPlanHandle plHandle, cl_uint numQueues, cl_command_queue* commQueueFFT, void (CL_CALLBACK* pfn_notify) (clAmdFftPlanHandle plHandle, void* user_data), void* user_data);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftCopyPlan)(clAmdFftPlanHandle* out_plHandle, cl_context new_context, clAmdFftPlanHandle in_plHandle);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftCreateDefaultPlan)(clAmdFftPlanHandle* plHandle, cl_context context, const clAmdFftDim dim, const size_t* clLengths);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftDestroyPlan)(clAmdFftPlanHandle* plHandle);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftEnqueueTransform)(clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_uint numQueuesAndEvents, cl_command_queue* commQueues, cl_uint numWaitEvents, const cl_event* waitEvents, cl_event* outEvents, cl_mem* inputBuffers, cl_mem* outputBuffers, cl_mem tmpBuffer);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetLayout)(const clAmdFftPlanHandle plHandle, clAmdFftLayout* iLayout, clAmdFftLayout* oLayout);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanBatchSize)(const clAmdFftPlanHandle plHandle, size_t* batchSize);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanContext)(const clAmdFftPlanHandle plHandle, cl_context* context);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanDim)(const clAmdFftPlanHandle plHandle, clAmdFftDim* dim, cl_uint* size);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanDistance)(const clAmdFftPlanHandle plHandle, size_t* iDist, size_t* oDist);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanInStride)(const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanLength)(const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clLengths);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanOutStride)(const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanPrecision)(const clAmdFftPlanHandle plHandle, clAmdFftPrecision* precision);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanScale)(const clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_float* scale);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetPlanTransposeResult)(const clAmdFftPlanHandle plHandle, clAmdFftResultTransposed* transposed);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetResultLocation)(const clAmdFftPlanHandle plHandle, clAmdFftResultLocation* placeness);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetTmpBufSize)(const clAmdFftPlanHandle plHandle, size_t* buffersize);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftGetVersion)(cl_uint* major, cl_uint* minor, cl_uint* patch);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetLayout)(clAmdFftPlanHandle plHandle, clAmdFftLayout iLayout, clAmdFftLayout oLayout);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanBatchSize)(clAmdFftPlanHandle plHandle, size_t batchSize);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanDim)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanDistance)(clAmdFftPlanHandle plHandle, size_t iDist, size_t oDist);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanInStride)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanLength)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim, const size_t* clLengths);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanOutStride)(clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanPrecision)(clAmdFftPlanHandle plHandle, clAmdFftPrecision precision);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanScale)(clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_float scale);
//extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetPlanTransposeResult)(clAmdFftPlanHandle plHandle, clAmdFftResultTransposed transposed);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetResultLocation)(clAmdFftPlanHandle plHandle, clAmdFftResultLocation placeness);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftSetup)(const clAmdFftSetupData* setupData);
extern CL_RUNTIME_EXPORT clAmdFftStatus (*clAmdFftTeardown)();
@@ -0,0 +1,370 @@
//
// AUTOGENERATED, DO NOT EDIT
//
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP
#error "Invalid usage"
#endif
// generated by parser_cl.py
#define clBuildProgram clBuildProgram_
#define clCompileProgram clCompileProgram_
#define clCreateBuffer clCreateBuffer_
#define clCreateCommandQueue clCreateCommandQueue_
#define clCreateContext clCreateContext_
#define clCreateContextFromType clCreateContextFromType_
#define clCreateImage clCreateImage_
#define clCreateImage2D clCreateImage2D_
#define clCreateImage3D clCreateImage3D_
#define clCreateKernel clCreateKernel_
#define clCreateKernelsInProgram clCreateKernelsInProgram_
#define clCreateProgramWithBinary clCreateProgramWithBinary_
#define clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels_
#define clCreateProgramWithSource clCreateProgramWithSource_
#define clCreateSampler clCreateSampler_
#define clCreateSubBuffer clCreateSubBuffer_
#define clCreateSubDevices clCreateSubDevices_
#define clCreateUserEvent clCreateUserEvent_
#define clEnqueueBarrier clEnqueueBarrier_
#define clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList_
#define clEnqueueCopyBuffer clEnqueueCopyBuffer_
#define clEnqueueCopyBufferRect clEnqueueCopyBufferRect_
#define clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage_
#define clEnqueueCopyImage clEnqueueCopyImage_
#define clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer_
#define clEnqueueFillBuffer clEnqueueFillBuffer_
#define clEnqueueFillImage clEnqueueFillImage_
#define clEnqueueMapBuffer clEnqueueMapBuffer_
#define clEnqueueMapImage clEnqueueMapImage_
#define clEnqueueMarker clEnqueueMarker_
#define clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList_
#define clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects_
#define clEnqueueNDRangeKernel clEnqueueNDRangeKernel_
#define clEnqueueNativeKernel clEnqueueNativeKernel_
#define clEnqueueReadBuffer clEnqueueReadBuffer_
#define clEnqueueReadBufferRect clEnqueueReadBufferRect_
#define clEnqueueReadImage clEnqueueReadImage_
#define clEnqueueTask clEnqueueTask_
#define clEnqueueUnmapMemObject clEnqueueUnmapMemObject_
#define clEnqueueWaitForEvents clEnqueueWaitForEvents_
#define clEnqueueWriteBuffer clEnqueueWriteBuffer_
#define clEnqueueWriteBufferRect clEnqueueWriteBufferRect_
#define clEnqueueWriteImage clEnqueueWriteImage_
#define clFinish clFinish_
#define clFlush clFlush_
#define clGetCommandQueueInfo clGetCommandQueueInfo_
#define clGetContextInfo clGetContextInfo_
#define clGetDeviceIDs clGetDeviceIDs_
#define clGetDeviceInfo clGetDeviceInfo_
#define clGetEventInfo clGetEventInfo_
#define clGetEventProfilingInfo clGetEventProfilingInfo_
#define clGetExtensionFunctionAddress clGetExtensionFunctionAddress_
#define clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform_
#define clGetImageInfo clGetImageInfo_
#define clGetKernelArgInfo clGetKernelArgInfo_
#define clGetKernelInfo clGetKernelInfo_
#define clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo_
#define clGetMemObjectInfo clGetMemObjectInfo_
#define clGetPlatformIDs clGetPlatformIDs_
#define clGetPlatformInfo clGetPlatformInfo_
#define clGetProgramBuildInfo clGetProgramBuildInfo_
#define clGetProgramInfo clGetProgramInfo_
#define clGetSamplerInfo clGetSamplerInfo_
#define clGetSupportedImageFormats clGetSupportedImageFormats_
#define clLinkProgram clLinkProgram_
#define clReleaseCommandQueue clReleaseCommandQueue_
#define clReleaseContext clReleaseContext_
#define clReleaseDevice clReleaseDevice_
#define clReleaseEvent clReleaseEvent_
#define clReleaseKernel clReleaseKernel_
#define clReleaseMemObject clReleaseMemObject_
#define clReleaseProgram clReleaseProgram_
#define clReleaseSampler clReleaseSampler_
#define clRetainCommandQueue clRetainCommandQueue_
#define clRetainContext clRetainContext_
#define clRetainDevice clRetainDevice_
#define clRetainEvent clRetainEvent_
#define clRetainKernel clRetainKernel_
#define clRetainMemObject clRetainMemObject_
#define clRetainProgram clRetainProgram_
#define clRetainSampler clRetainSampler_
#define clSetEventCallback clSetEventCallback_
#define clSetKernelArg clSetKernelArg_
#define clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback_
#define clSetUserEventStatus clSetUserEventStatus_
#define clUnloadCompiler clUnloadCompiler_
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_
#define clWaitForEvents clWaitForEvents_
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
// generated by parser_cl.py
#undef clBuildProgram
#define clBuildProgram clBuildProgram_pfn
#undef clCompileProgram
#define clCompileProgram clCompileProgram_pfn
#undef clCreateBuffer
#define clCreateBuffer clCreateBuffer_pfn
#undef clCreateCommandQueue
#define clCreateCommandQueue clCreateCommandQueue_pfn
#undef clCreateContext
#define clCreateContext clCreateContext_pfn
#undef clCreateContextFromType
#define clCreateContextFromType clCreateContextFromType_pfn
#undef clCreateImage
#define clCreateImage clCreateImage_pfn
#undef clCreateImage2D
#define clCreateImage2D clCreateImage2D_pfn
#undef clCreateImage3D
#define clCreateImage3D clCreateImage3D_pfn
#undef clCreateKernel
#define clCreateKernel clCreateKernel_pfn
#undef clCreateKernelsInProgram
#define clCreateKernelsInProgram clCreateKernelsInProgram_pfn
#undef clCreateProgramWithBinary
#define clCreateProgramWithBinary clCreateProgramWithBinary_pfn
#undef clCreateProgramWithBuiltInKernels
#define clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels_pfn
#undef clCreateProgramWithSource
#define clCreateProgramWithSource clCreateProgramWithSource_pfn
#undef clCreateSampler
#define clCreateSampler clCreateSampler_pfn
#undef clCreateSubBuffer
#define clCreateSubBuffer clCreateSubBuffer_pfn
#undef clCreateSubDevices
#define clCreateSubDevices clCreateSubDevices_pfn
#undef clCreateUserEvent
#define clCreateUserEvent clCreateUserEvent_pfn
#undef clEnqueueBarrier
#define clEnqueueBarrier clEnqueueBarrier_pfn
#undef clEnqueueBarrierWithWaitList
#define clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList_pfn
#undef clEnqueueCopyBuffer
#define clEnqueueCopyBuffer clEnqueueCopyBuffer_pfn
#undef clEnqueueCopyBufferRect
#define clEnqueueCopyBufferRect clEnqueueCopyBufferRect_pfn
#undef clEnqueueCopyBufferToImage
#define clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage_pfn
#undef clEnqueueCopyImage
#define clEnqueueCopyImage clEnqueueCopyImage_pfn
#undef clEnqueueCopyImageToBuffer
#define clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer_pfn
#undef clEnqueueFillBuffer
#define clEnqueueFillBuffer clEnqueueFillBuffer_pfn
#undef clEnqueueFillImage
#define clEnqueueFillImage clEnqueueFillImage_pfn
#undef clEnqueueMapBuffer
#define clEnqueueMapBuffer clEnqueueMapBuffer_pfn
#undef clEnqueueMapImage
#define clEnqueueMapImage clEnqueueMapImage_pfn
#undef clEnqueueMarker
#define clEnqueueMarker clEnqueueMarker_pfn
#undef clEnqueueMarkerWithWaitList
#define clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList_pfn
#undef clEnqueueMigrateMemObjects
#define clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects_pfn
#undef clEnqueueNDRangeKernel
#define clEnqueueNDRangeKernel clEnqueueNDRangeKernel_pfn
#undef clEnqueueNativeKernel
#define clEnqueueNativeKernel clEnqueueNativeKernel_pfn
#undef clEnqueueReadBuffer
#define clEnqueueReadBuffer clEnqueueReadBuffer_pfn
#undef clEnqueueReadBufferRect
#define clEnqueueReadBufferRect clEnqueueReadBufferRect_pfn
#undef clEnqueueReadImage
#define clEnqueueReadImage clEnqueueReadImage_pfn
#undef clEnqueueTask
#define clEnqueueTask clEnqueueTask_pfn
#undef clEnqueueUnmapMemObject
#define clEnqueueUnmapMemObject clEnqueueUnmapMemObject_pfn
#undef clEnqueueWaitForEvents
#define clEnqueueWaitForEvents clEnqueueWaitForEvents_pfn
#undef clEnqueueWriteBuffer
#define clEnqueueWriteBuffer clEnqueueWriteBuffer_pfn
#undef clEnqueueWriteBufferRect
#define clEnqueueWriteBufferRect clEnqueueWriteBufferRect_pfn
#undef clEnqueueWriteImage
#define clEnqueueWriteImage clEnqueueWriteImage_pfn
#undef clFinish
#define clFinish clFinish_pfn
#undef clFlush
#define clFlush clFlush_pfn
#undef clGetCommandQueueInfo
#define clGetCommandQueueInfo clGetCommandQueueInfo_pfn
#undef clGetContextInfo
#define clGetContextInfo clGetContextInfo_pfn
#undef clGetDeviceIDs
#define clGetDeviceIDs clGetDeviceIDs_pfn
#undef clGetDeviceInfo
#define clGetDeviceInfo clGetDeviceInfo_pfn
#undef clGetEventInfo
#define clGetEventInfo clGetEventInfo_pfn
#undef clGetEventProfilingInfo
#define clGetEventProfilingInfo clGetEventProfilingInfo_pfn
#undef clGetExtensionFunctionAddress
#define clGetExtensionFunctionAddress clGetExtensionFunctionAddress_pfn
#undef clGetExtensionFunctionAddressForPlatform
#define clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform_pfn
#undef clGetImageInfo
#define clGetImageInfo clGetImageInfo_pfn
#undef clGetKernelArgInfo
#define clGetKernelArgInfo clGetKernelArgInfo_pfn
#undef clGetKernelInfo
#define clGetKernelInfo clGetKernelInfo_pfn
#undef clGetKernelWorkGroupInfo
#define clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo_pfn
#undef clGetMemObjectInfo
#define clGetMemObjectInfo clGetMemObjectInfo_pfn
#undef clGetPlatformIDs
#define clGetPlatformIDs clGetPlatformIDs_pfn
#undef clGetPlatformInfo
#define clGetPlatformInfo clGetPlatformInfo_pfn
#undef clGetProgramBuildInfo
#define clGetProgramBuildInfo clGetProgramBuildInfo_pfn
#undef clGetProgramInfo
#define clGetProgramInfo clGetProgramInfo_pfn
#undef clGetSamplerInfo
#define clGetSamplerInfo clGetSamplerInfo_pfn
#undef clGetSupportedImageFormats
#define clGetSupportedImageFormats clGetSupportedImageFormats_pfn
#undef clLinkProgram
#define clLinkProgram clLinkProgram_pfn
#undef clReleaseCommandQueue
#define clReleaseCommandQueue clReleaseCommandQueue_pfn
#undef clReleaseContext
#define clReleaseContext clReleaseContext_pfn
#undef clReleaseDevice
#define clReleaseDevice clReleaseDevice_pfn
#undef clReleaseEvent
#define clReleaseEvent clReleaseEvent_pfn
#undef clReleaseKernel
#define clReleaseKernel clReleaseKernel_pfn
#undef clReleaseMemObject
#define clReleaseMemObject clReleaseMemObject_pfn
#undef clReleaseProgram
#define clReleaseProgram clReleaseProgram_pfn
#undef clReleaseSampler
#define clReleaseSampler clReleaseSampler_pfn
#undef clRetainCommandQueue
#define clRetainCommandQueue clRetainCommandQueue_pfn
#undef clRetainContext
#define clRetainContext clRetainContext_pfn
#undef clRetainDevice
#define clRetainDevice clRetainDevice_pfn
#undef clRetainEvent
#define clRetainEvent clRetainEvent_pfn
#undef clRetainKernel
#define clRetainKernel clRetainKernel_pfn
#undef clRetainMemObject
#define clRetainMemObject clRetainMemObject_pfn
#undef clRetainProgram
#define clRetainProgram clRetainProgram_pfn
#undef clRetainSampler
#define clRetainSampler clRetainSampler_pfn
#undef clSetEventCallback
#define clSetEventCallback clSetEventCallback_pfn
#undef clSetKernelArg
#define clSetKernelArg clSetKernelArg_pfn
#undef clSetMemObjectDestructorCallback
#define clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback_pfn
#undef clSetUserEventStatus
#define clSetUserEventStatus clSetUserEventStatus_pfn
#undef clUnloadCompiler
#define clUnloadCompiler clUnloadCompiler_pfn
#undef clUnloadPlatformCompiler
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_pfn
#undef clWaitForEvents
#define clWaitForEvents clWaitForEvents_pfn
// generated by parser_cl.py
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clBuildProgram)(cl_program, cl_uint, const cl_device_id*, const char*, void (CL_CALLBACK*) (cl_program, void*), void*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCompileProgram)(cl_program, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, const char**, void (CL_CALLBACK*) (cl_program, void*), void*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateBuffer)(cl_context, cl_mem_flags, size_t, void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_command_queue (CL_API_CALL*clCreateCommandQueue)(cl_context, cl_device_id, cl_command_queue_properties, cl_int*);
extern CL_RUNTIME_EXPORT cl_context (CL_API_CALL*clCreateContext)(const cl_context_properties*, cl_uint, const cl_device_id*, void (CL_CALLBACK*) (const char*, const void*, size_t, void*), void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_context (CL_API_CALL*clCreateContextFromType)(const cl_context_properties*, cl_device_type, void (CL_CALLBACK*) (const char*, const void*, size_t, void*), void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage)(cl_context, cl_mem_flags, const cl_image_format*, const cl_image_desc*, void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage2D)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage3D)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, size_t, size_t, void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_kernel (CL_API_CALL*clCreateKernel)(cl_program, const char*, cl_int*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateKernelsInProgram)(cl_program, cl_uint, cl_kernel*, cl_uint*);
extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBinary)(cl_context, cl_uint, const cl_device_id*, const size_t*, const unsigned char**, cl_int*, cl_int*);
extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBuiltInKernels)(cl_context, cl_uint, const cl_device_id*, const char*, cl_int*);
extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithSource)(cl_context, cl_uint, const char**, const size_t*, cl_int*);
extern CL_RUNTIME_EXPORT cl_sampler (CL_API_CALL*clCreateSampler)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateSubBuffer)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateSubDevices)(cl_device_id, const cl_device_partition_property*, cl_uint, cl_device_id*, cl_uint*);
extern CL_RUNTIME_EXPORT cl_event (CL_API_CALL*clCreateUserEvent)(cl_context, cl_int*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrier)(cl_command_queue);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrierWithWaitList)(cl_command_queue, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBuffer)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBufferRect)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBufferToImage)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyImage)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyImageToBuffer)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, size_t, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueFillBuffer)(cl_command_queue, cl_mem, const void*, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueFillImage)(cl_command_queue, cl_mem, const void*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clEnqueueMapBuffer)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event*, cl_event*, cl_int*);
extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clEnqueueMapImage)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t*, const size_t*, size_t*, size_t*, cl_uint, const cl_event*, cl_event*, cl_int*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarker)(cl_command_queue, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarkerWithWaitList)(cl_command_queue, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMigrateMemObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_mem_migration_flags, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueNDRangeKernel)(cl_command_queue, cl_kernel, cl_uint, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueNativeKernel)(cl_command_queue, void (CL_CALLBACK*) (void*), void*, size_t, cl_uint, const cl_mem*, const void**, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadBuffer)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadBufferRect)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadImage)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueTask)(cl_command_queue, cl_kernel, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueUnmapMemObject)(cl_command_queue, cl_mem, void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWaitForEvents)(cl_command_queue, cl_uint, const cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteBuffer)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteBufferRect)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteImage)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFinish)(cl_command_queue);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFlush)(cl_command_queue);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetCommandQueueInfo)(cl_command_queue, cl_command_queue_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetContextInfo)(cl_context, cl_context_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceIDs)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceInfo)(cl_device_id, cl_device_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventInfo)(cl_event, cl_event_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventProfilingInfo)(cl_event, cl_profiling_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddress)(const char*);
extern CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddressForPlatform)(cl_platform_id, const char*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetImageInfo)(cl_mem, cl_image_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelArgInfo)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelInfo)(cl_kernel, cl_kernel_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelWorkGroupInfo)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetMemObjectInfo)(cl_mem, cl_mem_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformIDs)(cl_uint, cl_platform_id*, cl_uint*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformInfo)(cl_platform_id, cl_platform_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramBuildInfo)(cl_program, cl_device_id, cl_program_build_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramInfo)(cl_program, cl_program_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSamplerInfo)(cl_sampler, cl_sampler_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSupportedImageFormats)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format*, cl_uint*);
extern CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clLinkProgram)(cl_context, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, void (CL_CALLBACK*) (cl_program, void*), void*, cl_int*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseCommandQueue)(cl_command_queue);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseContext)(cl_context);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseDevice)(cl_device_id);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseEvent)(cl_event);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseKernel)(cl_kernel);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseMemObject)(cl_mem);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseProgram)(cl_program);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseSampler)(cl_sampler);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainCommandQueue)(cl_command_queue);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainContext)(cl_context);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainDevice)(cl_device_id);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainEvent)(cl_event);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainKernel)(cl_kernel);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainMemObject)(cl_mem);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainProgram)(cl_program);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainSampler)(cl_sampler);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetEventCallback)(cl_event, cl_int, void (CL_CALLBACK*) (cl_event, cl_int, void*), void*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetKernelArg)(cl_kernel, cl_uint, size_t, const void*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetMemObjectDestructorCallback)(cl_mem, void (CL_CALLBACK*) (cl_mem, void*), void*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetUserEventStatus)(cl_event, cl_int);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadCompiler)();
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadPlatformCompiler)(cl_platform_id);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clWaitForEvents)(cl_uint, const cl_event*);
@@ -0,0 +1,272 @@
//
// AUTOGENERATED, DO NOT EDIT
//
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP
#error "Invalid usage"
#endif
// generated by parser_cl.py
#undef clBuildProgram
#define clBuildProgram clBuildProgram_fn
inline cl_int clBuildProgram(cl_program p0, cl_uint p1, const cl_device_id* p2, const char* p3, void (CL_CALLBACK*p4) (cl_program, void*), void* p5) { return clBuildProgram_pfn(p0, p1, p2, p3, p4, p5); }
#undef clCompileProgram
#define clCompileProgram clCompileProgram_fn
inline cl_int clCompileProgram(cl_program p0, cl_uint p1, const cl_device_id* p2, const char* p3, cl_uint p4, const cl_program* p5, const char** p6, void (CL_CALLBACK*p7) (cl_program, void*), void* p8) { return clCompileProgram_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clCreateBuffer
#define clCreateBuffer clCreateBuffer_fn
inline cl_mem clCreateBuffer(cl_context p0, cl_mem_flags p1, size_t p2, void* p3, cl_int* p4) { return clCreateBuffer_pfn(p0, p1, p2, p3, p4); }
#undef clCreateCommandQueue
#define clCreateCommandQueue clCreateCommandQueue_fn
inline cl_command_queue clCreateCommandQueue(cl_context p0, cl_device_id p1, cl_command_queue_properties p2, cl_int* p3) { return clCreateCommandQueue_pfn(p0, p1, p2, p3); }
#undef clCreateContext
#define clCreateContext clCreateContext_fn
inline cl_context clCreateContext(const cl_context_properties* p0, cl_uint p1, const cl_device_id* p2, void (CL_CALLBACK*p3) (const char*, const void*, size_t, void*), void* p4, cl_int* p5) { return clCreateContext_pfn(p0, p1, p2, p3, p4, p5); }
#undef clCreateContextFromType
#define clCreateContextFromType clCreateContextFromType_fn
inline cl_context clCreateContextFromType(const cl_context_properties* p0, cl_device_type p1, void (CL_CALLBACK*p2) (const char*, const void*, size_t, void*), void* p3, cl_int* p4) { return clCreateContextFromType_pfn(p0, p1, p2, p3, p4); }
#undef clCreateImage
#define clCreateImage clCreateImage_fn
inline cl_mem clCreateImage(cl_context p0, cl_mem_flags p1, const cl_image_format* p2, const cl_image_desc* p3, void* p4, cl_int* p5) { return clCreateImage_pfn(p0, p1, p2, p3, p4, p5); }
#undef clCreateImage2D
#define clCreateImage2D clCreateImage2D_fn
inline cl_mem clCreateImage2D(cl_context p0, cl_mem_flags p1, const cl_image_format* p2, size_t p3, size_t p4, size_t p5, void* p6, cl_int* p7) { return clCreateImage2D_pfn(p0, p1, p2, p3, p4, p5, p6, p7); }
#undef clCreateImage3D
#define clCreateImage3D clCreateImage3D_fn
inline cl_mem clCreateImage3D(cl_context p0, cl_mem_flags p1, const cl_image_format* p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7, void* p8, cl_int* p9) { return clCreateImage3D_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
#undef clCreateKernel
#define clCreateKernel clCreateKernel_fn
inline cl_kernel clCreateKernel(cl_program p0, const char* p1, cl_int* p2) { return clCreateKernel_pfn(p0, p1, p2); }
#undef clCreateKernelsInProgram
#define clCreateKernelsInProgram clCreateKernelsInProgram_fn
inline cl_int clCreateKernelsInProgram(cl_program p0, cl_uint p1, cl_kernel* p2, cl_uint* p3) { return clCreateKernelsInProgram_pfn(p0, p1, p2, p3); }
#undef clCreateProgramWithBinary
#define clCreateProgramWithBinary clCreateProgramWithBinary_fn
inline cl_program clCreateProgramWithBinary(cl_context p0, cl_uint p1, const cl_device_id* p2, const size_t* p3, const unsigned char** p4, cl_int* p5, cl_int* p6) { return clCreateProgramWithBinary_pfn(p0, p1, p2, p3, p4, p5, p6); }
#undef clCreateProgramWithBuiltInKernels
#define clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels_fn
inline cl_program clCreateProgramWithBuiltInKernels(cl_context p0, cl_uint p1, const cl_device_id* p2, const char* p3, cl_int* p4) { return clCreateProgramWithBuiltInKernels_pfn(p0, p1, p2, p3, p4); }
#undef clCreateProgramWithSource
#define clCreateProgramWithSource clCreateProgramWithSource_fn
inline cl_program clCreateProgramWithSource(cl_context p0, cl_uint p1, const char** p2, const size_t* p3, cl_int* p4) { return clCreateProgramWithSource_pfn(p0, p1, p2, p3, p4); }
#undef clCreateSampler
#define clCreateSampler clCreateSampler_fn
inline cl_sampler clCreateSampler(cl_context p0, cl_bool p1, cl_addressing_mode p2, cl_filter_mode p3, cl_int* p4) { return clCreateSampler_pfn(p0, p1, p2, p3, p4); }
#undef clCreateSubBuffer
#define clCreateSubBuffer clCreateSubBuffer_fn
inline cl_mem clCreateSubBuffer(cl_mem p0, cl_mem_flags p1, cl_buffer_create_type p2, const void* p3, cl_int* p4) { return clCreateSubBuffer_pfn(p0, p1, p2, p3, p4); }
#undef clCreateSubDevices
#define clCreateSubDevices clCreateSubDevices_fn
inline cl_int clCreateSubDevices(cl_device_id p0, const cl_device_partition_property* p1, cl_uint p2, cl_device_id* p3, cl_uint* p4) { return clCreateSubDevices_pfn(p0, p1, p2, p3, p4); }
#undef clCreateUserEvent
#define clCreateUserEvent clCreateUserEvent_fn
inline cl_event clCreateUserEvent(cl_context p0, cl_int* p1) { return clCreateUserEvent_pfn(p0, p1); }
#undef clEnqueueBarrier
#define clEnqueueBarrier clEnqueueBarrier_fn
inline cl_int clEnqueueBarrier(cl_command_queue p0) { return clEnqueueBarrier_pfn(p0); }
#undef clEnqueueBarrierWithWaitList
#define clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList_fn
inline cl_int clEnqueueBarrierWithWaitList(cl_command_queue p0, cl_uint p1, const cl_event* p2, cl_event* p3) { return clEnqueueBarrierWithWaitList_pfn(p0, p1, p2, p3); }
#undef clEnqueueCopyBuffer
#define clEnqueueCopyBuffer clEnqueueCopyBuffer_fn
inline cl_int clEnqueueCopyBuffer(cl_command_queue p0, cl_mem p1, cl_mem p2, size_t p3, size_t p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueCopyBufferRect
#define clEnqueueCopyBufferRect clEnqueueCopyBufferRect_fn
inline cl_int clEnqueueCopyBufferRect(cl_command_queue p0, cl_mem p1, cl_mem p2, const size_t* p3, const size_t* p4, const size_t* p5, size_t p6, size_t p7, size_t p8, size_t p9, cl_uint p10, const cl_event* p11, cl_event* p12) { return clEnqueueCopyBufferRect_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
#undef clEnqueueCopyBufferToImage
#define clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage_fn
inline cl_int clEnqueueCopyBufferToImage(cl_command_queue p0, cl_mem p1, cl_mem p2, size_t p3, const size_t* p4, const size_t* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyBufferToImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueCopyImage
#define clEnqueueCopyImage clEnqueueCopyImage_fn
inline cl_int clEnqueueCopyImage(cl_command_queue p0, cl_mem p1, cl_mem p2, const size_t* p3, const size_t* p4, const size_t* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueCopyImageToBuffer
#define clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer_fn
inline cl_int clEnqueueCopyImageToBuffer(cl_command_queue p0, cl_mem p1, cl_mem p2, const size_t* p3, const size_t* p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueCopyImageToBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueFillBuffer
#define clEnqueueFillBuffer clEnqueueFillBuffer_fn
inline cl_int clEnqueueFillBuffer(cl_command_queue p0, cl_mem p1, const void* p2, size_t p3, size_t p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueFillBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueFillImage
#define clEnqueueFillImage clEnqueueFillImage_fn
inline cl_int clEnqueueFillImage(cl_command_queue p0, cl_mem p1, const void* p2, const size_t* p3, const size_t* p4, cl_uint p5, const cl_event* p6, cl_event* p7) { return clEnqueueFillImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7); }
#undef clEnqueueMapBuffer
#define clEnqueueMapBuffer clEnqueueMapBuffer_fn
inline void* clEnqueueMapBuffer(cl_command_queue p0, cl_mem p1, cl_bool p2, cl_map_flags p3, size_t p4, size_t p5, cl_uint p6, const cl_event* p7, cl_event* p8, cl_int* p9) { return clEnqueueMapBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
#undef clEnqueueMapImage
#define clEnqueueMapImage clEnqueueMapImage_fn
inline void* clEnqueueMapImage(cl_command_queue p0, cl_mem p1, cl_bool p2, cl_map_flags p3, const size_t* p4, const size_t* p5, size_t* p6, size_t* p7, cl_uint p8, const cl_event* p9, cl_event* p10, cl_int* p11) { return clEnqueueMapImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
#undef clEnqueueMarker
#define clEnqueueMarker clEnqueueMarker_fn
inline cl_int clEnqueueMarker(cl_command_queue p0, cl_event* p1) { return clEnqueueMarker_pfn(p0, p1); }
#undef clEnqueueMarkerWithWaitList
#define clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList_fn
inline cl_int clEnqueueMarkerWithWaitList(cl_command_queue p0, cl_uint p1, const cl_event* p2, cl_event* p3) { return clEnqueueMarkerWithWaitList_pfn(p0, p1, p2, p3); }
#undef clEnqueueMigrateMemObjects
#define clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects_fn
inline cl_int clEnqueueMigrateMemObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_mem_migration_flags p3, cl_uint p4, const cl_event* p5, cl_event* p6) { return clEnqueueMigrateMemObjects_pfn(p0, p1, p2, p3, p4, p5, p6); }
#undef clEnqueueNDRangeKernel
#define clEnqueueNDRangeKernel clEnqueueNDRangeKernel_fn
inline cl_int clEnqueueNDRangeKernel(cl_command_queue p0, cl_kernel p1, cl_uint p2, const size_t* p3, const size_t* p4, const size_t* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueNDRangeKernel_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueNativeKernel
#define clEnqueueNativeKernel clEnqueueNativeKernel_fn
inline cl_int clEnqueueNativeKernel(cl_command_queue p0, void (CL_CALLBACK*p1) (void*), void* p2, size_t p3, cl_uint p4, const cl_mem* p5, const void** p6, cl_uint p7, const cl_event* p8, cl_event* p9) { return clEnqueueNativeKernel_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
#undef clEnqueueReadBuffer
#define clEnqueueReadBuffer clEnqueueReadBuffer_fn
inline cl_int clEnqueueReadBuffer(cl_command_queue p0, cl_mem p1, cl_bool p2, size_t p3, size_t p4, void* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueReadBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueReadBufferRect
#define clEnqueueReadBufferRect clEnqueueReadBufferRect_fn
inline cl_int clEnqueueReadBufferRect(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, const size_t* p5, size_t p6, size_t p7, size_t p8, size_t p9, void* p10, cl_uint p11, const cl_event* p12, cl_event* p13) { return clEnqueueReadBufferRect_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
#undef clEnqueueReadImage
#define clEnqueueReadImage clEnqueueReadImage_fn
inline cl_int clEnqueueReadImage(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, size_t p5, size_t p6, void* p7, cl_uint p8, const cl_event* p9, cl_event* p10) { return clEnqueueReadImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
#undef clEnqueueTask
#define clEnqueueTask clEnqueueTask_fn
inline cl_int clEnqueueTask(cl_command_queue p0, cl_kernel p1, cl_uint p2, const cl_event* p3, cl_event* p4) { return clEnqueueTask_pfn(p0, p1, p2, p3, p4); }
#undef clEnqueueUnmapMemObject
#define clEnqueueUnmapMemObject clEnqueueUnmapMemObject_fn
inline cl_int clEnqueueUnmapMemObject(cl_command_queue p0, cl_mem p1, void* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueUnmapMemObject_pfn(p0, p1, p2, p3, p4, p5); }
#undef clEnqueueWaitForEvents
#define clEnqueueWaitForEvents clEnqueueWaitForEvents_fn
inline cl_int clEnqueueWaitForEvents(cl_command_queue p0, cl_uint p1, const cl_event* p2) { return clEnqueueWaitForEvents_pfn(p0, p1, p2); }
#undef clEnqueueWriteBuffer
#define clEnqueueWriteBuffer clEnqueueWriteBuffer_fn
inline cl_int clEnqueueWriteBuffer(cl_command_queue p0, cl_mem p1, cl_bool p2, size_t p3, size_t p4, const void* p5, cl_uint p6, const cl_event* p7, cl_event* p8) { return clEnqueueWriteBuffer_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clEnqueueWriteBufferRect
#define clEnqueueWriteBufferRect clEnqueueWriteBufferRect_fn
inline cl_int clEnqueueWriteBufferRect(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, const size_t* p5, size_t p6, size_t p7, size_t p8, size_t p9, const void* p10, cl_uint p11, const cl_event* p12, cl_event* p13) { return clEnqueueWriteBufferRect_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
#undef clEnqueueWriteImage
#define clEnqueueWriteImage clEnqueueWriteImage_fn
inline cl_int clEnqueueWriteImage(cl_command_queue p0, cl_mem p1, cl_bool p2, const size_t* p3, const size_t* p4, size_t p5, size_t p6, const void* p7, cl_uint p8, const cl_event* p9, cl_event* p10) { return clEnqueueWriteImage_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
#undef clFinish
#define clFinish clFinish_fn
inline cl_int clFinish(cl_command_queue p0) { return clFinish_pfn(p0); }
#undef clFlush
#define clFlush clFlush_fn
inline cl_int clFlush(cl_command_queue p0) { return clFlush_pfn(p0); }
#undef clGetCommandQueueInfo
#define clGetCommandQueueInfo clGetCommandQueueInfo_fn
inline cl_int clGetCommandQueueInfo(cl_command_queue p0, cl_command_queue_info p1, size_t p2, void* p3, size_t* p4) { return clGetCommandQueueInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetContextInfo
#define clGetContextInfo clGetContextInfo_fn
inline cl_int clGetContextInfo(cl_context p0, cl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetContextInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetDeviceIDs
#define clGetDeviceIDs clGetDeviceIDs_fn
inline cl_int clGetDeviceIDs(cl_platform_id p0, cl_device_type p1, cl_uint p2, cl_device_id* p3, cl_uint* p4) { return clGetDeviceIDs_pfn(p0, p1, p2, p3, p4); }
#undef clGetDeviceInfo
#define clGetDeviceInfo clGetDeviceInfo_fn
inline cl_int clGetDeviceInfo(cl_device_id p0, cl_device_info p1, size_t p2, void* p3, size_t* p4) { return clGetDeviceInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetEventInfo
#define clGetEventInfo clGetEventInfo_fn
inline cl_int clGetEventInfo(cl_event p0, cl_event_info p1, size_t p2, void* p3, size_t* p4) { return clGetEventInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetEventProfilingInfo
#define clGetEventProfilingInfo clGetEventProfilingInfo_fn
inline cl_int clGetEventProfilingInfo(cl_event p0, cl_profiling_info p1, size_t p2, void* p3, size_t* p4) { return clGetEventProfilingInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetExtensionFunctionAddress
#define clGetExtensionFunctionAddress clGetExtensionFunctionAddress_fn
inline void* clGetExtensionFunctionAddress(const char* p0) { return clGetExtensionFunctionAddress_pfn(p0); }
#undef clGetExtensionFunctionAddressForPlatform
#define clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform_fn
inline void* clGetExtensionFunctionAddressForPlatform(cl_platform_id p0, const char* p1) { return clGetExtensionFunctionAddressForPlatform_pfn(p0, p1); }
#undef clGetImageInfo
#define clGetImageInfo clGetImageInfo_fn
inline cl_int clGetImageInfo(cl_mem p0, cl_image_info p1, size_t p2, void* p3, size_t* p4) { return clGetImageInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetKernelArgInfo
#define clGetKernelArgInfo clGetKernelArgInfo_fn
inline cl_int clGetKernelArgInfo(cl_kernel p0, cl_uint p1, cl_kernel_arg_info p2, size_t p3, void* p4, size_t* p5) { return clGetKernelArgInfo_pfn(p0, p1, p2, p3, p4, p5); }
#undef clGetKernelInfo
#define clGetKernelInfo clGetKernelInfo_fn
inline cl_int clGetKernelInfo(cl_kernel p0, cl_kernel_info p1, size_t p2, void* p3, size_t* p4) { return clGetKernelInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetKernelWorkGroupInfo
#define clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo_fn
inline cl_int clGetKernelWorkGroupInfo(cl_kernel p0, cl_device_id p1, cl_kernel_work_group_info p2, size_t p3, void* p4, size_t* p5) { return clGetKernelWorkGroupInfo_pfn(p0, p1, p2, p3, p4, p5); }
#undef clGetMemObjectInfo
#define clGetMemObjectInfo clGetMemObjectInfo_fn
inline cl_int clGetMemObjectInfo(cl_mem p0, cl_mem_info p1, size_t p2, void* p3, size_t* p4) { return clGetMemObjectInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetPlatformIDs
#define clGetPlatformIDs clGetPlatformIDs_fn
inline cl_int clGetPlatformIDs(cl_uint p0, cl_platform_id* p1, cl_uint* p2) { return clGetPlatformIDs_pfn(p0, p1, p2); }
#undef clGetPlatformInfo
#define clGetPlatformInfo clGetPlatformInfo_fn
inline cl_int clGetPlatformInfo(cl_platform_id p0, cl_platform_info p1, size_t p2, void* p3, size_t* p4) { return clGetPlatformInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetProgramBuildInfo
#define clGetProgramBuildInfo clGetProgramBuildInfo_fn
inline cl_int clGetProgramBuildInfo(cl_program p0, cl_device_id p1, cl_program_build_info p2, size_t p3, void* p4, size_t* p5) { return clGetProgramBuildInfo_pfn(p0, p1, p2, p3, p4, p5); }
#undef clGetProgramInfo
#define clGetProgramInfo clGetProgramInfo_fn
inline cl_int clGetProgramInfo(cl_program p0, cl_program_info p1, size_t p2, void* p3, size_t* p4) { return clGetProgramInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetSamplerInfo
#define clGetSamplerInfo clGetSamplerInfo_fn
inline cl_int clGetSamplerInfo(cl_sampler p0, cl_sampler_info p1, size_t p2, void* p3, size_t* p4) { return clGetSamplerInfo_pfn(p0, p1, p2, p3, p4); }
#undef clGetSupportedImageFormats
#define clGetSupportedImageFormats clGetSupportedImageFormats_fn
inline cl_int clGetSupportedImageFormats(cl_context p0, cl_mem_flags p1, cl_mem_object_type p2, cl_uint p3, cl_image_format* p4, cl_uint* p5) { return clGetSupportedImageFormats_pfn(p0, p1, p2, p3, p4, p5); }
#undef clLinkProgram
#define clLinkProgram clLinkProgram_fn
inline cl_program clLinkProgram(cl_context p0, cl_uint p1, const cl_device_id* p2, const char* p3, cl_uint p4, const cl_program* p5, void (CL_CALLBACK*p6) (cl_program, void*), void* p7, cl_int* p8) { return clLinkProgram_pfn(p0, p1, p2, p3, p4, p5, p6, p7, p8); }
#undef clReleaseCommandQueue
#define clReleaseCommandQueue clReleaseCommandQueue_fn
inline cl_int clReleaseCommandQueue(cl_command_queue p0) { return clReleaseCommandQueue_pfn(p0); }
#undef clReleaseContext
#define clReleaseContext clReleaseContext_fn
inline cl_int clReleaseContext(cl_context p0) { return clReleaseContext_pfn(p0); }
#undef clReleaseDevice
#define clReleaseDevice clReleaseDevice_fn
inline cl_int clReleaseDevice(cl_device_id p0) { return clReleaseDevice_pfn(p0); }
#undef clReleaseEvent
#define clReleaseEvent clReleaseEvent_fn
inline cl_int clReleaseEvent(cl_event p0) { return clReleaseEvent_pfn(p0); }
#undef clReleaseKernel
#define clReleaseKernel clReleaseKernel_fn
inline cl_int clReleaseKernel(cl_kernel p0) { return clReleaseKernel_pfn(p0); }
#undef clReleaseMemObject
#define clReleaseMemObject clReleaseMemObject_fn
inline cl_int clReleaseMemObject(cl_mem p0) { return clReleaseMemObject_pfn(p0); }
#undef clReleaseProgram
#define clReleaseProgram clReleaseProgram_fn
inline cl_int clReleaseProgram(cl_program p0) { return clReleaseProgram_pfn(p0); }
#undef clReleaseSampler
#define clReleaseSampler clReleaseSampler_fn
inline cl_int clReleaseSampler(cl_sampler p0) { return clReleaseSampler_pfn(p0); }
#undef clRetainCommandQueue
#define clRetainCommandQueue clRetainCommandQueue_fn
inline cl_int clRetainCommandQueue(cl_command_queue p0) { return clRetainCommandQueue_pfn(p0); }
#undef clRetainContext
#define clRetainContext clRetainContext_fn
inline cl_int clRetainContext(cl_context p0) { return clRetainContext_pfn(p0); }
#undef clRetainDevice
#define clRetainDevice clRetainDevice_fn
inline cl_int clRetainDevice(cl_device_id p0) { return clRetainDevice_pfn(p0); }
#undef clRetainEvent
#define clRetainEvent clRetainEvent_fn
inline cl_int clRetainEvent(cl_event p0) { return clRetainEvent_pfn(p0); }
#undef clRetainKernel
#define clRetainKernel clRetainKernel_fn
inline cl_int clRetainKernel(cl_kernel p0) { return clRetainKernel_pfn(p0); }
#undef clRetainMemObject
#define clRetainMemObject clRetainMemObject_fn
inline cl_int clRetainMemObject(cl_mem p0) { return clRetainMemObject_pfn(p0); }
#undef clRetainProgram
#define clRetainProgram clRetainProgram_fn
inline cl_int clRetainProgram(cl_program p0) { return clRetainProgram_pfn(p0); }
#undef clRetainSampler
#define clRetainSampler clRetainSampler_fn
inline cl_int clRetainSampler(cl_sampler p0) { return clRetainSampler_pfn(p0); }
#undef clSetEventCallback
#define clSetEventCallback clSetEventCallback_fn
inline cl_int clSetEventCallback(cl_event p0, cl_int p1, void (CL_CALLBACK*p2) (cl_event, cl_int, void*), void* p3) { return clSetEventCallback_pfn(p0, p1, p2, p3); }
#undef clSetKernelArg
#define clSetKernelArg clSetKernelArg_fn
inline cl_int clSetKernelArg(cl_kernel p0, cl_uint p1, size_t p2, const void* p3) { return clSetKernelArg_pfn(p0, p1, p2, p3); }
#undef clSetMemObjectDestructorCallback
#define clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback_fn
inline cl_int clSetMemObjectDestructorCallback(cl_mem p0, void (CL_CALLBACK*p1) (cl_mem, void*), void* p2) { return clSetMemObjectDestructorCallback_pfn(p0, p1, p2); }
#undef clSetUserEventStatus
#define clSetUserEventStatus clSetUserEventStatus_fn
inline cl_int clSetUserEventStatus(cl_event p0, cl_int p1) { return clSetUserEventStatus_pfn(p0, p1); }
#undef clUnloadCompiler
#define clUnloadCompiler clUnloadCompiler_fn
inline cl_int clUnloadCompiler() { return clUnloadCompiler_pfn(); }
#undef clUnloadPlatformCompiler
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_fn
inline cl_int clUnloadPlatformCompiler(cl_platform_id p0) { return clUnloadPlatformCompiler_pfn(p0); }
#undef clWaitForEvents
#define clWaitForEvents clWaitForEvents_fn
inline cl_int clWaitForEvents(cl_uint p0, const cl_event* p1) { return clWaitForEvents_pfn(p0, p1); }
@@ -0,0 +1,62 @@
//
// AUTOGENERATED, DO NOT EDIT
//
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP
#error "Invalid usage"
#endif
// generated by parser_cl.py
#define clCreateFromGLBuffer clCreateFromGLBuffer_
#define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_
#define clCreateFromGLTexture clCreateFromGLTexture_
#define clCreateFromGLTexture2D clCreateFromGLTexture2D_
#define clCreateFromGLTexture3D clCreateFromGLTexture3D_
#define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_
#define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_
#define clGetGLContextInfoKHR clGetGLContextInfoKHR_
#define clGetGLObjectInfo clGetGLObjectInfo_
#define clGetGLTextureInfo clGetGLTextureInfo_
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
// generated by parser_cl.py
#undef clCreateFromGLBuffer
#define clCreateFromGLBuffer clCreateFromGLBuffer_pfn
#undef clCreateFromGLRenderbuffer
#define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_pfn
#undef clCreateFromGLTexture
#define clCreateFromGLTexture clCreateFromGLTexture_pfn
#undef clCreateFromGLTexture2D
#define clCreateFromGLTexture2D clCreateFromGLTexture2D_pfn
#undef clCreateFromGLTexture3D
#define clCreateFromGLTexture3D clCreateFromGLTexture3D_pfn
#undef clEnqueueAcquireGLObjects
#define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_pfn
#undef clEnqueueReleaseGLObjects
#define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_pfn
#undef clGetGLContextInfoKHR
#define clGetGLContextInfoKHR clGetGLContextInfoKHR_pfn
#undef clGetGLObjectInfo
#define clGetGLObjectInfo clGetGLObjectInfo_pfn
#undef clGetGLTextureInfo
#define clGetGLTextureInfo clGetGLTextureInfo_pfn
#ifdef cl_khr_gl_sharing
// generated by parser_cl.py
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer)(cl_context, cl_mem_flags, cl_GLuint, int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer)(cl_context, cl_mem_flags, cl_GLuint, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*);
extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueAcquireGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo)(cl_mem, cl_gl_object_type*, cl_GLuint*);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*);
#endif // cl_khr_gl_sharing
@@ -0,0 +1,42 @@
//
// AUTOGENERATED, DO NOT EDIT
//
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP
#error "Invalid usage"
#endif
#ifdef cl_khr_gl_sharing
// generated by parser_cl.py
#undef clCreateFromGLBuffer
#define clCreateFromGLBuffer clCreateFromGLBuffer_fn
inline cl_mem clCreateFromGLBuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, int* p3) { return clCreateFromGLBuffer_pfn(p0, p1, p2, p3); }
#undef clCreateFromGLRenderbuffer
#define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_fn
inline cl_mem clCreateFromGLRenderbuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, cl_int* p3) { return clCreateFromGLRenderbuffer_pfn(p0, p1, p2, p3); }
#undef clCreateFromGLTexture
#define clCreateFromGLTexture clCreateFromGLTexture_fn
inline cl_mem clCreateFromGLTexture(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture_pfn(p0, p1, p2, p3, p4, p5); }
#undef clCreateFromGLTexture2D
#define clCreateFromGLTexture2D clCreateFromGLTexture2D_fn
inline cl_mem clCreateFromGLTexture2D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture2D_pfn(p0, p1, p2, p3, p4, p5); }
#undef clCreateFromGLTexture3D
#define clCreateFromGLTexture3D clCreateFromGLTexture3D_fn
inline cl_mem clCreateFromGLTexture3D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture3D_pfn(p0, p1, p2, p3, p4, p5); }
#undef clEnqueueAcquireGLObjects
#define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_fn
inline cl_int clEnqueueAcquireGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueAcquireGLObjects_pfn(p0, p1, p2, p3, p4, p5); }
#undef clEnqueueReleaseGLObjects
#define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_fn
inline cl_int clEnqueueReleaseGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueReleaseGLObjects_pfn(p0, p1, p2, p3, p4, p5); }
#undef clGetGLContextInfoKHR
#define clGetGLContextInfoKHR clGetGLContextInfoKHR_fn
inline cl_int clGetGLContextInfoKHR(const cl_context_properties* p0, cl_gl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLContextInfoKHR_pfn(p0, p1, p2, p3, p4); }
#undef clGetGLObjectInfo
#define clGetGLObjectInfo clGetGLObjectInfo_fn
inline cl_int clGetGLObjectInfo(cl_mem p0, cl_gl_object_type* p1, cl_GLuint* p2) { return clGetGLObjectInfo_pfn(p0, p1, p2); }
#undef clGetGLTextureInfo
#define clGetGLTextureInfo clGetGLTextureInfo_fn
inline cl_int clGetGLTextureInfo(cl_mem p0, cl_gl_texture_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLTextureInfo_pfn(p0, p1, p2, p3, p4); }
#endif // cl_khr_gl_sharing
@@ -0,0 +1,53 @@
/*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) 2010-2013, Advanced Micro Devices, 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 OpenCV Foundation 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_OCL_RUNTIME_CLAMDBLAS_HPP
#define OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP
#ifdef HAVE_CLAMDBLAS
#include "opencl_core.hpp"
#include "autogenerated/opencl_clamdblas.hpp"
#endif // HAVE_CLAMDBLAS
#endif // OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP
@@ -0,0 +1,53 @@
/*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) 2010-2013, Advanced Micro Devices, 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 OpenCV Foundation 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_OCL_RUNTIME_CLAMDFFT_HPP
#define OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP
#ifdef HAVE_CLAMDFFT
#include "opencl_core.hpp"
#include "autogenerated/opencl_clamdfft.hpp"
#endif // HAVE_CLAMDFFT
#endif // OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP
@@ -0,0 +1,84 @@
/*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) 2010-2013, Advanced Micro Devices, 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 OpenCV Foundation 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_OCL_RUNTIME_OPENCL_CORE_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP
#ifdef HAVE_OPENCL
#ifndef CL_RUNTIME_EXPORT
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE) && \
!(defined(__OPENCV_BUILD) && defined(OPENCV_MODULE_IS_PART_OF_WORLD))
#define CL_RUNTIME_EXPORT __declspec(dllimport)
#else
#define CL_RUNTIME_EXPORT
#endif
#endif
#ifdef HAVE_OPENCL_SVM
#define clSVMAlloc clSVMAlloc_
#define clSVMFree clSVMFree_
#define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_
#define clSetKernelExecInfo clSetKernelExecInfo_
#define clEnqueueSVMFree clEnqueueSVMFree_
#define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_
#define clEnqueueSVMMemFill clEnqueueSVMMemFill_
#define clEnqueueSVMMap clEnqueueSVMMap_
#define clEnqueueSVMUnmap clEnqueueSVMUnmap_
#endif
#include "autogenerated/opencl_core.hpp"
#ifndef CL_DEVICE_DOUBLE_FP_CONFIG
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
#endif
#ifndef CL_DEVICE_HALF_FP_CONFIG
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
#endif
#ifndef CL_VERSION_1_2
#define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2")
#endif
#endif // HAVE_OPENCL
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP
@@ -0,0 +1,47 @@
/*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) 2010-2013, Advanced Micro Devices, 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 OpenCV Foundation 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_OCL_RUNTIME_OPENCL_WRAPPERS_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP
#include "autogenerated/opencl_core_wrappers.hpp"
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP
@@ -0,0 +1,53 @@
/*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) 2010-2013, Advanced Micro Devices, 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 OpenCV Foundation 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_OCL_RUNTIME_OPENCL_GL_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP
#if defined HAVE_OPENCL && defined HAVE_OPENGL
#include "opencl_core.hpp"
#include "autogenerated/opencl_gl.hpp"
#endif // defined HAVE_OPENCL && defined HAVE_OPENGL
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP
@@ -0,0 +1,47 @@
/*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) 2010-2013, Advanced Micro Devices, 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 OpenCV Foundation 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_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP
#include "autogenerated/opencl_gl_wrappers.hpp"
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP
@@ -0,0 +1,48 @@
/* See LICENSE file in the root OpenCV directory */
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP
#if defined(HAVE_OPENCL_SVM)
#include "opencl_core.hpp"
#include "opencl_svm_definitions.hpp"
#undef clSVMAlloc
#define clSVMAlloc clSVMAlloc_pfn
#undef clSVMFree
#define clSVMFree clSVMFree_pfn
#undef clSetKernelArgSVMPointer
#define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_pfn
#undef clSetKernelExecInfo
//#define clSetKernelExecInfo clSetKernelExecInfo_pfn
#undef clEnqueueSVMFree
//#define clEnqueueSVMFree clEnqueueSVMFree_pfn
#undef clEnqueueSVMMemcpy
#define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_pfn
#undef clEnqueueSVMMemFill
#define clEnqueueSVMMemFill clEnqueueSVMMemFill_pfn
#undef clEnqueueSVMMap
#define clEnqueueSVMMap clEnqueueSVMMap_pfn
#undef clEnqueueSVMUnmap
#define clEnqueueSVMUnmap clEnqueueSVMUnmap_pfn
extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSVMAlloc)(cl_context context, cl_svm_mem_flags flags, size_t size, unsigned int alignment);
extern CL_RUNTIME_EXPORT void (CL_API_CALL *clSVMFree)(cl_context context, void* svm_pointer);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clSetKernelArgSVMPointer)(cl_kernel kernel, cl_uint arg_index, const void* arg_value);
//extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSetKernelExecInfo)(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value);
//extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMFree)(cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[],
// void (CL_CALLBACK *pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data,
// cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemcpy)(cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size,
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemFill)(cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size,
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags map_flags, void* svm_ptr, size_t size,
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr,
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
#endif // HAVE_OPENCL_SVM
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP
@@ -0,0 +1,42 @@
/* See LICENSE file in the root OpenCV directory */
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP
#if defined(HAVE_OPENCL_SVM)
#if defined(CL_VERSION_2_0)
// OpenCL 2.0 contains SVM definitions
#else
typedef cl_bitfield cl_device_svm_capabilities;
typedef cl_bitfield cl_svm_mem_flags;
typedef cl_uint cl_kernel_exec_info;
//
// TODO Add real values after OpenCL 2.0 release
//
#ifndef CL_DEVICE_SVM_CAPABILITIES
#define CL_DEVICE_SVM_CAPABILITIES 0x1053
#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0)
#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1)
#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2)
#define CL_DEVICE_SVM_ATOMICS (1 << 3)
#endif
#ifndef CL_MEM_SVM_FINE_GRAIN_BUFFER
#define CL_MEM_SVM_FINE_GRAIN_BUFFER (1 << 10)
#endif
#ifndef CL_MEM_SVM_ATOMICS
#define CL_MEM_SVM_ATOMICS (1 << 11)
#endif
#endif // CL_VERSION_2_0
#endif // HAVE_OPENCL_SVM
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP
@@ -0,0 +1,166 @@
/* See LICENSE file in the root OpenCV directory */
#ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_HSA_EXTENSION_HPP
#define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_HSA_EXTENSION_HPP
#if defined(HAVE_OPENCL_SVM)
#include "opencl_core.hpp"
#ifndef CL_DEVICE_SVM_CAPABILITIES_AMD
//
// Part of the file is an extract from the cl_ext.h file from AMD APP SDK package.
// Below is the original copyright.
//
/*******************************************************************************
* Copyright (c) 2008-2013 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
******************************************************************************/
/*******************************************
* Shared Virtual Memory (SVM) extension
*******************************************/
typedef cl_bitfield cl_device_svm_capabilities_amd;
typedef cl_bitfield cl_svm_mem_flags_amd;
typedef cl_uint cl_kernel_exec_info_amd;
/* cl_device_info */
#define CL_DEVICE_SVM_CAPABILITIES_AMD 0x1053
#define CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT_AMD 0x1054
/* cl_device_svm_capabilities_amd */
#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_AMD (1 << 0)
#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_AMD (1 << 1)
#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_AMD (1 << 2)
#define CL_DEVICE_SVM_ATOMICS_AMD (1 << 3)
/* cl_svm_mem_flags_amd */
#define CL_MEM_SVM_FINE_GRAIN_BUFFER_AMD (1 << 10)
#define CL_MEM_SVM_ATOMICS_AMD (1 << 11)
/* cl_mem_info */
#define CL_MEM_USES_SVM_POINTER_AMD 0x1109
/* cl_kernel_exec_info_amd */
#define CL_KERNEL_EXEC_INFO_SVM_PTRS_AMD 0x11B6
#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_AMD 0x11B7
/* cl_command_type */
#define CL_COMMAND_SVM_FREE_AMD 0x1209
#define CL_COMMAND_SVM_MEMCPY_AMD 0x120A
#define CL_COMMAND_SVM_MEMFILL_AMD 0x120B
#define CL_COMMAND_SVM_MAP_AMD 0x120C
#define CL_COMMAND_SVM_UNMAP_AMD 0x120D
typedef CL_API_ENTRY void*
(CL_API_CALL * clSVMAllocAMD_fn)(
cl_context /* context */,
cl_svm_mem_flags_amd /* flags */,
size_t /* size */,
unsigned int /* alignment */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY void
(CL_API_CALL * clSVMFreeAMD_fn)(
cl_context /* context */,
void* /* svm_pointer */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clEnqueueSVMFreeAMD_fn)(
cl_command_queue /* command_queue */,
cl_uint /* num_svm_pointers */,
void** /* svm_pointers */,
void (CL_CALLBACK *)( /*pfn_free_func*/
cl_command_queue /* queue */,
cl_uint /* num_svm_pointers */,
void** /* svm_pointers */,
void* /* user_data */),
void* /* user_data */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clEnqueueSVMMemcpyAMD_fn)(
cl_command_queue /* command_queue */,
cl_bool /* blocking_copy */,
void* /* dst_ptr */,
const void* /* src_ptr */,
size_t /* size */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clEnqueueSVMMemFillAMD_fn)(
cl_command_queue /* command_queue */,
void* /* svm_ptr */,
const void* /* pattern */,
size_t /* pattern_size */,
size_t /* size */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clEnqueueSVMMapAMD_fn)(
cl_command_queue /* command_queue */,
cl_bool /* blocking_map */,
cl_map_flags /* map_flags */,
void* /* svm_ptr */,
size_t /* size */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clEnqueueSVMUnmapAMD_fn)(
cl_command_queue /* command_queue */,
void* /* svm_ptr */,
cl_uint /* num_events_in_wait_list */,
const cl_event* /* event_wait_list */,
cl_event* /* event */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clSetKernelArgSVMPointerAMD_fn)(
cl_kernel /* kernel */,
cl_uint /* arg_index */,
const void * /* arg_value */
) CL_EXT_SUFFIX__VERSION_1_2;
typedef CL_API_ENTRY cl_int
(CL_API_CALL * clSetKernelExecInfoAMD_fn)(
cl_kernel /* kernel */,
cl_kernel_exec_info_amd /* param_name */,
size_t /* param_value_size */,
const void * /* param_value */
) CL_EXT_SUFFIX__VERSION_1_2;
#endif
#endif // HAVE_OPENCL_SVM
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_HSA_EXTENSION_HPP
+51 -10
View File
@@ -40,14 +40,15 @@
//
//M*/
#ifndef __OPENCV_CORE_OPENGL_HPP__
#define __OPENCV_CORE_OPENGL_HPP__
#ifndef OPENCV_CORE_OPENGL_HPP
#define OPENCV_CORE_OPENGL_HPP
#ifndef __cplusplus
# error opengl.hpp header must be compiled as C++
#endif
#include "opencv2/core.hpp"
#include "ocl.hpp"
namespace cv { namespace ogl {
@@ -244,7 +245,7 @@ public:
/** @brief Maps OpenGL buffer to CUDA device memory.
This operatation doesn't copy data. Several buffer objects can be mapped to CUDA memory at a time.
This operation doesn't copy data. Several buffer objects can be mapped to CUDA memory at a time.
A mapped data store must be unmapped with ogl::Buffer::unmapDevice before its buffer object is used.
*/
@@ -511,15 +512,57 @@ CV_EXPORTS void render(const Arrays& arr, int mode = POINTS, Scalar color = Scal
*/
CV_EXPORTS void render(const Arrays& arr, InputArray indices, int mode = POINTS, Scalar color = Scalar::all(255));
//! @} core_opengl
/////////////////// CL-GL Interoperability Functions ///////////////////
namespace ocl {
using namespace cv::ocl;
// TODO static functions in the Context class
/** @brief Creates OpenCL context from GL.
@return Returns reference to OpenCL Context
*/
CV_EXPORTS Context& initializeContextFromGL();
} // namespace cv::ogl::ocl
/** @brief Converts InputArray to Texture2D object.
@param src - source InputArray.
@param texture - destination Texture2D object.
*/
CV_EXPORTS void convertToGLTexture2D(InputArray src, Texture2D& texture);
/** @brief Converts Texture2D object to OutputArray.
@param texture - source Texture2D object.
@param dst - destination OutputArray.
*/
CV_EXPORTS void convertFromGLTexture2D(const Texture2D& texture, OutputArray dst);
/** @brief Maps Buffer object to process on CL side (convert to UMat).
Function creates CL buffer from GL one, and then constructs UMat that can be used
to process buffer data with OpenCV functions. Note that in current implementation
UMat constructed this way doesn't own corresponding GL buffer object, so it is
the user responsibility to close down CL/GL buffers relationships by explicitly
calling unmapGLBuffer() function.
@param buffer - source Buffer object.
@param accessFlags - data access flags (ACCESS_READ|ACCESS_WRITE).
@return Returns UMat object
*/
CV_EXPORTS UMat mapGLBuffer(const Buffer& buffer, int accessFlags = ACCESS_READ|ACCESS_WRITE);
/** @brief Unmaps Buffer object (releases UMat, previously mapped from Buffer).
Function must be called explicitly by the user for each UMat previously constructed
by the call to mapGLBuffer() function.
@param u - source UMat, created by mapGLBuffer().
*/
CV_EXPORTS void unmapGLBuffer(UMat& u);
//! @}
}} // namespace cv::ogl
namespace cv { namespace cuda {
//! @addtogroup cuda
//! @{
/** @brief Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
This function should be explicitly called after OpenGL context creation and before any CUDA calls.
@@ -528,8 +571,6 @@ This function should be explicitly called after OpenGL context creation and befo
*/
CV_EXPORTS void setGlDevice(int device = 0);
//! @}
}}
//! @cond IGNORED
@@ -681,4 +722,4 @@ bool cv::ogl::Arrays::empty() const
//! @endcond
#endif /* __OPENCV_CORE_OPENGL_HPP__ */
#endif /* OPENCV_CORE_OPENGL_HPP */
+74 -50
View File
@@ -42,8 +42,8 @@
//
//M*/
#ifndef __OPENCV_CORE_OPERATIONS_HPP__
#define __OPENCV_CORE_OPERATIONS_HPP__
#ifndef OPENCV_CORE_OPERATIONS_HPP
#define OPENCV_CORE_OPERATIONS_HPP
#ifndef __cplusplus
# error operations.hpp header must be compiled as C++
@@ -61,29 +61,44 @@ namespace cv
namespace internal
{
template<typename _Tp, int m> struct Matx_FastInvOp
template<typename _Tp, int m, int n> struct Matx_FastInvOp
{
bool operator()(const Matx<_Tp, m, m>& a, Matx<_Tp, m, m>& b, int method) const
bool operator()(const Matx<_Tp, m, n>& a, Matx<_Tp, n, m>& b, int method) const
{
Matx<_Tp, m, m> temp = a;
// assume that b is all 0's on input => make it a unity matrix
for( int i = 0; i < m; i++ )
b(i, i) = (_Tp)1;
if( method == DECOMP_CHOLESKY )
return Cholesky(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m);
return LU(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m) != 0;
return invert(a, b, method) != 0;
}
};
template<typename _Tp> struct Matx_FastInvOp<_Tp, 2>
template<typename _Tp, int m> struct Matx_FastInvOp<_Tp, m, m>
{
bool operator()(const Matx<_Tp, 2, 2>& a, Matx<_Tp, 2, 2>& b, int) const
bool operator()(const Matx<_Tp, m, m>& a, Matx<_Tp, m, m>& b, int method) const
{
_Tp d = determinant(a);
if( d == 0 )
if (method == DECOMP_LU || method == DECOMP_CHOLESKY)
{
Matx<_Tp, m, m> temp = a;
// assume that b is all 0's on input => make it a unity matrix
for (int i = 0; i < m; i++)
b(i, i) = (_Tp)1;
if (method == DECOMP_CHOLESKY)
return Cholesky(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m);
return LU(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m) != 0;
}
else
{
return invert(a, b, method) != 0;
}
}
};
template<typename _Tp> struct Matx_FastInvOp<_Tp, 2, 2>
{
bool operator()(const Matx<_Tp, 2, 2>& a, Matx<_Tp, 2, 2>& b, int /*method*/) const
{
_Tp d = (_Tp)determinant(a);
if (d == 0)
return false;
d = 1/d;
b(1,1) = a(0,0)*d;
@@ -94,12 +109,12 @@ template<typename _Tp> struct Matx_FastInvOp<_Tp, 2>
}
};
template<typename _Tp> struct Matx_FastInvOp<_Tp, 3>
template<typename _Tp> struct Matx_FastInvOp<_Tp, 3, 3>
{
bool operator()(const Matx<_Tp, 3, 3>& a, Matx<_Tp, 3, 3>& b, int) const
bool operator()(const Matx<_Tp, 3, 3>& a, Matx<_Tp, 3, 3>& b, int /*method*/) const
{
_Tp d = (_Tp)determinant(a);
if( d == 0 )
if (d == 0)
return false;
d = 1/d;
b(0,0) = (a(1,1) * a(2,2) - a(1,2) * a(2,1)) * d;
@@ -118,27 +133,43 @@ template<typename _Tp> struct Matx_FastInvOp<_Tp, 3>
};
template<typename _Tp, int m, int n> struct Matx_FastSolveOp
template<typename _Tp, int m, int l, int n> struct Matx_FastSolveOp
{
bool operator()(const Matx<_Tp, m, l>& a, const Matx<_Tp, m, n>& b,
Matx<_Tp, l, n>& x, int method) const
{
return cv::solve(a, b, x, method);
}
};
template<typename _Tp, int m, int n> struct Matx_FastSolveOp<_Tp, m, m, n>
{
bool operator()(const Matx<_Tp, m, m>& a, const Matx<_Tp, m, n>& b,
Matx<_Tp, m, n>& x, int method) const
{
Matx<_Tp, m, m> temp = a;
x = b;
if( method == DECOMP_CHOLESKY )
return Cholesky(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n);
if (method == DECOMP_LU || method == DECOMP_CHOLESKY)
{
Matx<_Tp, m, m> temp = a;
x = b;
if( method == DECOMP_CHOLESKY )
return Cholesky(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n);
return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0;
return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0;
}
else
{
return cv::solve(a, b, x, method);
}
}
};
template<typename _Tp> struct Matx_FastSolveOp<_Tp, 2, 1>
template<typename _Tp> struct Matx_FastSolveOp<_Tp, 2, 2, 1>
{
bool operator()(const Matx<_Tp, 2, 2>& a, const Matx<_Tp, 2, 1>& b,
Matx<_Tp, 2, 1>& x, int) const
{
_Tp d = determinant(a);
if( d == 0 )
_Tp d = (_Tp)determinant(a);
if (d == 0)
return false;
d = 1/d;
x(0) = (b(0)*a(1,1) - b(1)*a(0,1))*d;
@@ -147,13 +178,13 @@ template<typename _Tp> struct Matx_FastSolveOp<_Tp, 2, 1>
}
};
template<typename _Tp> struct Matx_FastSolveOp<_Tp, 3, 1>
template<typename _Tp> struct Matx_FastSolveOp<_Tp, 3, 3, 1>
{
bool operator()(const Matx<_Tp, 3, 3>& a, const Matx<_Tp, 3, 1>& b,
Matx<_Tp, 3, 1>& x, int) const
{
_Tp d = (_Tp)determinant(a);
if( d == 0 )
if (d == 0)
return false;
d = 1/d;
x(0) = d*(b(0)*(a(1,1)*a(2,2) - a(1,2)*a(2,1)) -
@@ -193,15 +224,8 @@ template<typename _Tp, int m, int n> inline
Matx<_Tp, n, m> Matx<_Tp, m, n>::inv(int method, bool *p_is_ok /*= NULL*/) const
{
Matx<_Tp, n, m> b;
bool ok;
if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
ok = cv::internal::Matx_FastInvOp<_Tp, m>()(*this, b, method);
else
{
Mat A(*this, false), B(b, false);
ok = (invert(A, B, method) != 0);
}
if( NULL != p_is_ok ) { *p_is_ok = ok; }
bool ok = cv::internal::Matx_FastInvOp<_Tp, m, n>()(*this, b, method);
if (p_is_ok) *p_is_ok = ok;
return ok ? b : Matx<_Tp, n, m>::zeros();
}
@@ -209,15 +233,7 @@ template<typename _Tp, int m, int n> template<int l> inline
Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) const
{
Matx<_Tp, n, l> x;
bool ok;
if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
ok = cv::internal::Matx_FastSolveOp<_Tp, m, l>()(*this, rhs, x, method);
else
{
Mat A(*this, false), B(rhs, false), X(x, false);
ok = cv::solve(A, B, X, method);
}
bool ok = cv::internal::Matx_FastSolveOp<_Tp, m, n, l>()(*this, rhs, x, method);
return ok ? x : Matx<_Tp, n, l>::zeros();
}
@@ -349,6 +365,8 @@ inline int RNG::uniform(int a, int b) { return a == b ? a : (int)(next(
inline float RNG::uniform(float a, float b) { return ((float)*this)*(b - a) + a; }
inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; }
inline bool RNG::operator ==(const RNG& other) const { return state == other.state; }
inline unsigned RNG::next()
{
state = (uint64)(unsigned)state* /*CV_RNG_COEFF*/ 4164903690U + (unsigned)(state >> 32);
@@ -363,6 +381,12 @@ template<typename _Tp> static inline _Tp randu()
///////////////////////////////// Formatted string generation /////////////////////////////////
/** @brief Returns a text string formatted using the printf-like expression.
The function acts like sprintf but forms and returns an STL string. It can be used to form an error
message in the Exception constructor.
@param fmt printf-compatible formatting specifiers.
*/
CV_EXPORTS String format( const char* fmt, ... );
///////////////////////////////// Formatted output of cv::Mat /////////////////////////////////
+5 -5
View File
@@ -39,8 +39,8 @@
//
//M*/
#ifndef __OPENCV_OPTIM_HPP__
#define __OPENCV_OPTIM_HPP__
#ifndef OPENCV_OPTIM_HPP
#define OPENCV_OPTIM_HPP
#include "opencv2/core.hpp"
@@ -73,7 +73,7 @@ public:
/** @brief Getter for the optimized function.
The optimized function is represented by Function interface, which requires derivatives to
implement the sole method calc(double*) to evaluate the function.
implement the calc(double*) and getDim() methods to evaluate the function.
@return Smart-pointer to an object that implements Function interface - it represents the
function that is being optimized. It can be empty, if no function was given so far.
@@ -115,7 +115,7 @@ public:
always sensible) will be used.
@param x The initial point, that will become a centroid of an initial simplex. After the algorithm
will terminate, it will be setted to the point where the algorithm stops, the point of possible
will terminate, it will be set to the point where the algorithm stops, the point of possible
minimum.
@return The value of a function at the point found.
*/
@@ -288,7 +288,7 @@ Bland's rule <http://en.wikipedia.org/wiki/Bland%27s_rule> is used to prevent cy
contain 32- or 64-bit floating point numbers. As a convenience, column-vector may be also submitted,
in the latter case it is understood to correspond to \f$c^T\f$.
@param Constr `m`-by-`n+1` matrix, whose rightmost column corresponds to \f$b\f$ in formulation above
and the remaining to \f$A\f$. It should containt 32- or 64-bit floating point numbers.
and the remaining to \f$A\f$. It should contain 32- or 64-bit floating point numbers.
@param z The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the
formulation above. It will contain 64-bit floating point numbers.
@return One of cv::SolveLPResult
+28
View File
@@ -0,0 +1,28 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
// Copyright (C) 2016, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
// OpenVX related definitions and declarations
#pragma once
#ifndef OPENCV_OVX_HPP
#define OPENCV_OVX_HPP
#include "cvdef.h"
namespace cv
{
/// Check if use of OpenVX is possible
CV_EXPORTS_W bool haveOpenVX();
/// Check if use of OpenVX is enabled
CV_EXPORTS_W bool useOpenVX();
/// Enable/disable use of OpenVX
CV_EXPORTS_W void setUseOpenVX(bool flag);
} // namespace cv
#endif // OPENCV_OVX_HPP
+222 -51
View File
@@ -41,8 +41,13 @@
//
//M*/
#ifndef __OPENCV_CORE_PERSISTENCE_HPP__
#define __OPENCV_CORE_PERSISTENCE_HPP__
#ifndef OPENCV_CORE_PERSISTENCE_HPP
#define OPENCV_CORE_PERSISTENCE_HPP
#ifndef CV_DOXYGEN
/// Define to support persistence legacy formats
#define CV__LEGACY_PERSISTENCE
#endif
#ifndef __cplusplus
# error persistence.hpp header must be compiled as C++
@@ -57,8 +62,9 @@ Several functions that are described below take CvFileStorage\* as inputs and al
save or to load hierarchical collections that consist of scalar values, standard CXCore objects
(such as matrices, sequences, graphs), and user-defined objects.
OpenCV can read and write data in XML (<http://www.w3c.org/XML>) or YAML (<http://www.yaml.org>)
formats. Below is an example of 3x3 floating-point identity matrix A, stored in XML and YAML files
OpenCV can read and write data in XML (<http://www.w3c.org/XML>), YAML (<http://www.yaml.org>) or
JSON (<http://www.json.org/>) formats. Below is an example of 3x3 floating-point identity matrix A,
stored in XML and YAML files
using CXCore functions:
XML:
@code{.xml}
@@ -85,10 +91,13 @@ As it can be seen from the examples, XML uses nested tags to represent hierarchy
indentation for that purpose (similar to the Python programming language).
The same functions can read and write data in both formats; the particular format is determined by
the extension of the opened file, ".xml" for XML files and ".yml" or ".yaml" for YAML.
the extension of the opened file, ".xml" for XML files, ".yml" or ".yaml" for YAML and ".json" for
JSON.
*/
typedef struct CvFileStorage CvFileStorage;
typedef struct CvFileNode CvFileNode;
typedef struct CvMat CvMat;
typedef struct CvMatND CvMatND;
//! @} core_c
@@ -99,20 +108,20 @@ namespace cv {
/** @addtogroup core_xml
XML/YAML file storages. {#xml_storage}
XML/YAML/JSON file storages. {#xml_storage}
=======================
Writing to a file storage.
--------------------------
You can store and then restore various OpenCV data structures to/from XML (<http://www.w3c.org/XML>)
or YAML (<http://www.yaml.org>) formats. Also, it is possible store and load arbitrarily complex
data structures, which include OpenCV data structures, as well as primitive data types (integer and
floating-point numbers and text strings) as their elements.
You can store and then restore various OpenCV data structures to/from XML (<http://www.w3c.org/XML>),
YAML (<http://www.yaml.org>) or JSON (<http://www.json.org/>) formats. Also, it is possible to store
and load arbitrarily complex data structures, which include OpenCV data structures, as well as
primitive data types (integer and floating-point numbers and text strings) as their elements.
Use the following procedure to write something to XML or YAML:
Use the following procedure to write something to XML, YAML or JSON:
-# Create new FileStorage and open it for writing. It can be done with a single call to
FileStorage::FileStorage constructor that takes a filename, or you can use the default constructor
and then call FileStorage::open. Format of the file (XML or YAML) is determined from the filename
extension (".xml" and ".yml"/".yaml", respectively)
and then call FileStorage::open. Format of the file (XML, YAML or JSON) is determined from the filename
extension (".xml", ".yml"/".yaml" and ".json", respectively)
-# Write all the data you want using the streaming operator `<<`, just like in the case of STL
streams.
-# Close the file using FileStorage::release. FileStorage destructor also closes the file.
@@ -151,7 +160,7 @@ Here is an example:
return 0;
}
@endcode
The sample above stores to XML and integer, text string (calibration date), 2 matrices, and a custom
The sample above stores to YML an integer, a text string (calibration date), 2 matrices, and a custom
structure "feature", which includes feature coordinates and LBP (local binary pattern) value. Here
is output of the sample:
@code{.yaml}
@@ -175,19 +184,19 @@ features:
- { x:344, y:158, lbp:[ 1, 1, 0, 0, 0, 0, 1, 0 ] }
@endcode
As an exercise, you can replace ".yml" with ".xml" in the sample above and see, how the
As an exercise, you can replace ".yml" with ".xml" or ".json" in the sample above and see, how the
corresponding XML file will look like.
Several things can be noted by looking at the sample code and the output:
- The produced YAML (and XML) consists of heterogeneous collections that can be nested. There are 2
types of collections: named collections (mappings) and unnamed collections (sequences). In mappings
- The produced YAML (and XML/JSON) consists of heterogeneous collections that can be nested. There are
2 types of collections: named collections (mappings) and unnamed collections (sequences). In mappings
each element has a name and is accessed by name. This is similar to structures and std::map in
C/C++ and dictionaries in Python. In sequences elements do not have names, they are accessed by
indices. This is similar to arrays and std::vector in C/C++ and lists, tuples in Python.
"Heterogeneous" means that elements of each single collection can have different types.
Top-level collection in YAML/XML is a mapping. Each matrix is stored as a mapping, and the matrix
Top-level collection in YAML/XML/JSON is a mapping. Each matrix is stored as a mapping, and the matrix
elements are stored as a sequence. Then, there is a sequence of features, where each feature is
represented a mapping, and lbp value in a nested sequence.
@@ -203,7 +212,7 @@ Several things can be noted by looking at the sample code and the output:
- To write a sequence, you first write the special string `[`, then write the elements, then
write the closing `]`.
- In YAML (but not XML), mappings and sequences can be written in a compact Python-like inline
- In YAML/JSON (but not XML), mappings and sequences can be written in a compact Python-like inline
form. In the sample above matrix elements, as well as each feature, including its lbp value, is
stored in such inline form. To store a mapping/sequence in a compact form, put `:` after the
opening character, e.g. use `{:` instead of `{` and `[:` instead of `[`. When the
@@ -211,7 +220,7 @@ Several things can be noted by looking at the sample code and the output:
Reading data from a file storage.
---------------------------------
To read the previously written XML or YAML file, do the following:
To read the previously written XML, YAML or JSON file, do the following:
-# Open the file storage using FileStorage::FileStorage constructor or FileStorage::open method.
In the current implementation the whole file is parsed and the whole representation of file
storage is built in memory as a hierarchy of file nodes (see FileNode)
@@ -278,12 +287,12 @@ element is a structure of 2 integers, followed by a single-precision floating-po
equivalent notations of the above specification are `iif`, `2i1f` and so forth. Other examples: `u`
means that the array consists of bytes, and `2d` means the array consists of pairs of doubles.
@see @ref filestorage.cpp
@see @ref samples/cpp/filestorage.cpp
*/
//! @{
/** @example filestorage.cpp
/** @example samples/cpp/filestorage.cpp
A complete example using the FileStorage interface
*/
@@ -292,8 +301,8 @@ A complete example using the FileStorage interface
class CV_EXPORTS FileNode;
class CV_EXPORTS FileNodeIterator;
/** @brief XML/YAML file storage class that encapsulates all the information necessary for writing or reading
data to/from a file.
/** @brief XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or
reading data to/from a file.
*/
class CV_EXPORTS_W FileStorage
{
@@ -309,7 +318,11 @@ public:
FORMAT_MASK = (7<<3), //!< mask for format flags
FORMAT_AUTO = 0, //!< flag, auto format
FORMAT_XML = (1<<3), //!< flag, XML format
FORMAT_YAML = (2<<3) //!< flag, YAML format
FORMAT_YAML = (2<<3), //!< flag, YAML format
FORMAT_JSON = (3<<3), //!< flag, JSON format
BASE64 = 64, //!< flag, write rawdata in Base64 by default. (consider using WRITE_BASE64)
WRITE_BASE64 = BASE64 | WRITE, //!< flag, enable both WRITE and BASE64
};
enum
{
@@ -327,16 +340,9 @@ public:
CV_WRAP FileStorage();
/** @overload
@param source Name of the file to open or the text string to read the data from. Extension of the
file (.xml or .yml/.yaml) determines its format (XML or YAML respectively). Also you can append .gz
to work with compressed files, for example myHugeMatrix.xml.gz. If both FileStorage::WRITE and
FileStorage::MEMORY flags are specified, source is used just to specify the output file format (e.g.
mydata.xml, .yml etc.).
@param flags Mode of operation. See FileStorage::Mode
@param encoding Encoding of the file. Note that UTF-16 XML encoding is not supported currently and
you should use 8-bit encoding instead of it.
@copydoc open()
*/
CV_WRAP FileStorage(const String& source, int flags, const String& encoding=String());
CV_WRAP FileStorage(const String& filename, int flags, const String& encoding=String());
/** @overload */
FileStorage(CvFileStorage* fs, bool owning=true);
@@ -349,10 +355,12 @@ public:
See description of parameters in FileStorage::FileStorage. The method calls FileStorage::release
before opening the file.
@param filename Name of the file to open or the text string to read the data from.
Extension of the file (.xml or .yml/.yaml) determines its format (XML or YAML respectively).
Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. If both
Extension of the file (.xml, .yml/.yaml or .json) determines its format (XML, YAML or JSON
respectively). Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. If both
FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify
the output file format (e.g. mydata.xml, .yml etc.).
the output file format (e.g. mydata.xml, .yml etc.). A file name can also contain parameters.
You can use this format, "*?base64" (e.g. "file.json?base64" (case sensitive)), as an alternative to
FileStorage::BASE64 flag.
@param flags Mode of operation. One of FileStorage::Mode
@param encoding Encoding of the file. Note that UTF-16 XML encoding is not supported currently and
you should use 8-bit encoding instead of it.
@@ -398,7 +406,7 @@ public:
FileNode operator[](const String& nodename) const;
/** @overload */
CV_WRAP FileNode operator[](const char* nodename) const;
CV_WRAP_AS(getNode) FileNode operator[](const char* nodename) const;
/** @brief Returns the obsolete C FileStorage structure.
@returns Pointer to the underlying C FileStorage structure
@@ -425,12 +433,40 @@ public:
*/
void writeObj( const String& name, const void* obj );
/**
* @brief Simplified writing API to use with bindings.
* @param name Name of the written object
* @param val Value of the written object
*/
CV_WRAP void write(const String& name, int val);
/// @overload
CV_WRAP void write(const String& name, double val);
/// @overload
CV_WRAP void write(const String& name, const String& val);
/// @overload
CV_WRAP void write(const String& name, InputArray val);
/** @brief Writes a comment.
The function writes a comment into file storage. The comments are skipped when the storage is read.
@param comment The written comment, single-line or multi-line
@param append If true, the function tries to put the comment at the end of current line.
Else if the comment is multi-line, or if it does not fit at the end of the current
line, the comment starts a new line.
*/
CV_WRAP void writeComment(const String& comment, bool append = false);
/** @brief Returns the normalized object name for the specified name of a file.
@param filename Name of a file
@returns The normalized object name.
*/
static String getDefaultObjectName(const String& filename);
/** @brief Returns the current format.
* @returns The current format, see FileStorage::Mode
*/
CV_WRAP int getFormat() const;
Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure
String elname; //!< the currently written element
std::vector<char> structs; //!< the stack of written structures
@@ -443,7 +479,7 @@ template<> CV_EXPORTS void DefaultDeleter<CvFileStorage>::operator ()(CvFileStor
The node is used to store each and every element of the file storage opened for reading. When
XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of
nodes. Each node can be a leaf that is contain a single number or a string, or be a collection of
nodes. Each node can be a "leaf" that is contain a single number or a string, or be a collection of
other nodes. There can be named collections (mappings) where each element has a name and it is
accessed by a name, and ordered collections (sequences) where elements do not have names but rather
accessed by index. Type of the file node can be determined using FileNode::type method.
@@ -499,12 +535,17 @@ public:
/** @overload
@param nodename Name of an element in the mapping node.
*/
CV_WRAP FileNode operator[](const char* nodename) const;
CV_WRAP_AS(getNode) FileNode operator[](const char* nodename) const;
/** @overload
@param i Index of an element in the sequence node.
*/
CV_WRAP FileNode operator[](int i) const;
CV_WRAP_AS(at) FileNode operator[](int i) const;
/** @brief Returns keys of a mapping node.
@returns Keys of a mapping node.
*/
CV_WRAP std::vector<String> keys() const;
/** @brief Returns type of the node.
@returns Type of the node. See FileNode::Type
@@ -539,9 +580,7 @@ public:
operator double() const;
//! returns the node content as text string
operator String() const;
#ifndef OPENCV_NOSTL
operator std::string() const;
#endif
//! returns pointer to the underlying file node
CvFileNode* operator *();
@@ -566,6 +605,13 @@ public:
//! reads the registered object and returns pointer to it
void* readObj() const;
//! Simplified reading API to use with bindings.
CV_WRAP double real() const;
//! Simplified reading API to use with bindings.
CV_WRAP String string() const;
//! Simplified reading API to use with bindings.
CV_WRAP Mat mat() const;
// do not use wrapper pointer classes for better efficiency
const CvFileStorage* fs;
const CvFileNode* node;
@@ -659,8 +705,10 @@ CV_EXPORTS void write( FileStorage& fs, const String& name, double value );
CV_EXPORTS void write( FileStorage& fs, const String& name, const String& value );
CV_EXPORTS void write( FileStorage& fs, const String& name, const Mat& value );
CV_EXPORTS void write( FileStorage& fs, const String& name, const SparseMat& value );
#ifdef CV__LEGACY_PERSISTENCE
CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector<KeyPoint>& value);
CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector<DMatch>& value);
#endif
CV_EXPORTS void writeScalar( FileStorage& fs, int value );
CV_EXPORTS void writeScalar( FileStorage& fs, float value );
@@ -676,10 +724,15 @@ CV_EXPORTS void read(const FileNode& node, int& value, int default_value);
CV_EXPORTS void read(const FileNode& node, float& value, float default_value);
CV_EXPORTS void read(const FileNode& node, double& value, double default_value);
CV_EXPORTS void read(const FileNode& node, String& value, const String& default_value);
CV_EXPORTS void read(const FileNode& node, std::string& value, const std::string& default_value);
CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat = Mat() );
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat = SparseMat() );
#ifdef CV__LEGACY_PERSISTENCE
CV_EXPORTS void read(const FileNode& node, std::vector<KeyPoint>& keypoints);
CV_EXPORTS void read(const FileNode& node, std::vector<DMatch>& matches);
#endif
CV_EXPORTS void read(const FileNode& node, KeyPoint& value, const KeyPoint& default_value);
CV_EXPORTS void read(const FileNode& node, DMatch& value, const DMatch& default_value);
template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
{
@@ -773,7 +826,7 @@ namespace internal
VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
void operator()(const std::vector<_Tp>& vec) const
{
int _fmt = DataType<_Tp>::fmt;
int _fmt = traits::SafeFmt<_Tp>::fmt;
char fmt[] = { (char)((_fmt >> 8) + '1'), (char)_fmt, '\0' };
fs->writeRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, vec.size() * sizeof(_Tp));
}
@@ -804,8 +857,10 @@ namespace internal
{
size_t remaining = it->remaining;
size_t cn = DataType<_Tp>::channels;
int _fmt = DataType<_Tp>::fmt;
int _fmt = traits::SafeFmt<_Tp>::fmt;
CV_Assert((_fmt >> 8) < 9);
char fmt[] = { (char)((_fmt >> 8)+'1'), (char)_fmt, '\0' };
CV_Assert((remaining % cn) == 0);
size_t remaining1 = remaining / cn;
count = count < remaining1 ? count : remaining1;
vec.resize(count);
@@ -916,11 +971,10 @@ void write(FileStorage& fs, const Range& r )
template<typename _Tp> static inline
void write( FileStorage& fs, const std::vector<_Tp>& vec )
{
cv::internal::VecWriterProxy<_Tp, DataType<_Tp>::fmt != 0> w(&fs);
cv::internal::VecWriterProxy<_Tp, traits::SafeFmt<_Tp>::fmt != 0> w(&fs);
w(vec);
}
template<typename _Tp> static inline
void write(FileStorage& fs, const String& name, const Point_<_Tp>& pt )
{
@@ -977,13 +1031,65 @@ void write(FileStorage& fs, const String& name, const Range& r )
write(fs, r);
}
static inline
void write(FileStorage& fs, const String& name, const KeyPoint& kpt)
{
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, kpt.pt.x);
write(fs, kpt.pt.y);
write(fs, kpt.size);
write(fs, kpt.angle);
write(fs, kpt.response);
write(fs, kpt.octave);
write(fs, kpt.class_id);
}
static inline
void write(FileStorage& fs, const String& name, const DMatch& m)
{
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
write(fs, m.queryIdx);
write(fs, m.trainIdx);
write(fs, m.imgIdx);
write(fs, m.distance);
}
template<typename _Tp> static inline
void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec )
{
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+(traits::SafeFmt<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
write(fs, vec);
}
template<typename _Tp> static inline
void write( FileStorage& fs, const String& name, const std::vector< std::vector<_Tp> >& vec )
{
cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ);
for(size_t i = 0; i < vec.size(); i++)
{
cv::internal::WriteStructContext ws_(fs, name, FileNode::SEQ+(traits::SafeFmt<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
write(fs, vec[i]);
}
}
#ifdef CV__LEGACY_PERSISTENCE
// This code is not needed anymore, but it is preserved here to keep source compatibility
// Implementation is similar to templates instantiations
static inline void write(FileStorage& fs, const KeyPoint& kpt) { write(fs, String(), kpt); }
static inline void write(FileStorage& fs, const DMatch& m) { write(fs, String(), m); }
static inline void write(FileStorage& fs, const std::vector<KeyPoint>& vec)
{
cv::internal::VecWriterProxy<KeyPoint, 0> w(&fs);
w(vec);
}
static inline void write(FileStorage& fs, const std::vector<DMatch>& vec)
{
cv::internal::VecWriterProxy<DMatch, 0> w(&fs);
w(vec);
}
#endif
//! @} FileStorage
//! @relates cv::FileNode
@@ -1032,7 +1138,7 @@ void read(const FileNode& node, short& value, short default_value)
template<typename _Tp> static inline
void read( FileNodeIterator& it, std::vector<_Tp>& vec, size_t maxCount = (size_t)INT_MAX )
{
cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
cv::internal::VecReaderProxy<_Tp, traits::SafeFmt<_Tp>::fmt != 0> r(&it);
r(vec, maxCount);
}
@@ -1048,6 +1154,24 @@ void read( const FileNode& node, std::vector<_Tp>& vec, const std::vector<_Tp>&
}
}
static inline
void read( const FileNode& node, std::vector<KeyPoint>& vec, const std::vector<KeyPoint>& default_value )
{
if(!node.node)
vec = default_value;
else
read(node, vec);
}
static inline
void read( const FileNode& node, std::vector<DMatch>& vec, const std::vector<DMatch>& default_value )
{
if(!node.node)
vec = default_value;
else
read(node, vec);
}
//! @} FileNode
//! @relates cv::FileStorage
@@ -1103,7 +1227,7 @@ FileNodeIterator& operator >> (FileNodeIterator& it, _Tp& value)
template<typename _Tp> static inline
FileNodeIterator& operator >> (FileNodeIterator& it, std::vector<_Tp>& vec)
{
cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
cv::internal::VecReaderProxy<_Tp, traits::SafeFmt<_Tp>::fmt != 0> r(&it);
r(vec, (size_t)INT_MAX);
return it;
}
@@ -1130,6 +1254,39 @@ void operator >> (const FileNode& n, std::vector<_Tp>& vec)
it >> vec;
}
/** @brief Reads KeyPoint from a file storage.
*/
//It needs special handling because it contains two types of fields, int & float.
static inline
void operator >> (const FileNode& n, KeyPoint& kpt)
{
FileNodeIterator it = n.begin();
it >> kpt.pt.x >> kpt.pt.y >> kpt.size >> kpt.angle >> kpt.response >> kpt.octave >> kpt.class_id;
}
#ifdef CV__LEGACY_PERSISTENCE
static inline
void operator >> (const FileNode& n, std::vector<KeyPoint>& vec)
{
read(n, vec);
}
static inline
void operator >> (const FileNode& n, std::vector<DMatch>& vec)
{
read(n, vec);
}
#endif
/** @brief Reads DMatch from a file storage.
*/
//It needs special handling because it contains two types of fields, int & float.
static inline
void operator >> (const FileNode& n, DMatch& m)
{
FileNodeIterator it = n.begin();
it >> m.queryIdx >> m.trainIdx >> m.imgIdx >> m.distance;
}
//! @} FileNode
//! @relates cv::FileNodeIterator
@@ -1181,6 +1338,9 @@ inline FileNode::operator int() const { int value; read(*this, value, 0);
inline FileNode::operator float() const { float value; read(*this, value, 0.f); return value; }
inline FileNode::operator double() const { double value; read(*this, value, 0.); return value; }
inline FileNode::operator String() const { String value; read(*this, value, value); return value; }
inline double FileNode::real() const { return double(*this); }
inline String FileNode::string() const { return String(*this); }
inline Mat FileNode::mat() const { Mat value; read(*this, value, value); return value; }
inline FileNodeIterator FileNode::begin() const { return FileNodeIterator(fs, node); }
inline FileNodeIterator FileNode::end() const { return FileNodeIterator(fs, node, size()); }
inline void FileNode::readRaw( const String& fmt, uchar* vec, size_t len ) const { begin().readRaw( fmt, vec, len ); }
@@ -1190,6 +1350,17 @@ inline String::String(const FileNode& fn): cstr_(0), len_(0) { read(fn, *this, *
//! @endcond
CV_EXPORTS void cvStartWriteRawData_Base64(::CvFileStorage * fs, const char* name, int len, const char* dt);
CV_EXPORTS void cvWriteRawData_Base64(::CvFileStorage * fs, const void* _data, int len);
CV_EXPORTS void cvEndWriteRawData_Base64(::CvFileStorage * fs);
CV_EXPORTS void cvWriteMat_Base64(::CvFileStorage* fs, const char* name, const ::CvMat* mat);
CV_EXPORTS void cvWriteMatND_Base64(::CvFileStorage* fs, const char* name, const ::CvMatND* mat);
} // cv
#endif // __OPENCV_CORE_PERSISTENCE_HPP__
#endif // OPENCV_CORE_PERSISTENCE_HPP
-172
View File
@@ -1,172 +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.
// 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_PRIVATE_CUDA_HPP__
#define __OPENCV_CORE_PRIVATE_CUDA_HPP__
#ifndef __OPENCV_BUILD
# error this is a private header which should not be used from outside of the OpenCV library
#endif
#include "cvconfig.h"
#include "opencv2/core/cvdef.h"
#include "opencv2/core/base.hpp"
#include "opencv2/core/cuda.hpp"
#ifdef HAVE_CUDA
# include <cuda.h>
# include <cuda_runtime.h>
# include <npp.h>
# include "opencv2/core/cuda_stream_accessor.hpp"
# include "opencv2/core/cuda/common.hpp"
# define NPP_VERSION (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD)
# define CUDART_MINIMUM_REQUIRED_VERSION 4020
# if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
# error "Insufficient Cuda Runtime library version, please update it."
# endif
# if defined(CUDA_ARCH_BIN_OR_PTX_10)
# error "OpenCV CUDA module doesn't support NVIDIA compute capability 1.0"
# endif
#endif
//! @cond IGNORED
namespace cv { namespace cuda {
CV_EXPORTS cv::String getNppErrorMessage(int code);
CV_EXPORTS cv::String getCudaDriverApiErrorMessage(int code);
CV_EXPORTS GpuMat getInputMat(InputArray _src, Stream& stream);
CV_EXPORTS GpuMat getOutputMat(OutputArray _dst, int rows, int cols, int type, Stream& stream);
static inline GpuMat getOutputMat(OutputArray _dst, Size size, int type, Stream& stream)
{
return getOutputMat(_dst, size.height, size.width, type, stream);
}
CV_EXPORTS void syncOutput(const GpuMat& dst, OutputArray _dst, Stream& stream);
}}
#ifndef HAVE_CUDA
static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); }
#else // HAVE_CUDA
static inline void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); }
namespace cv { namespace cuda
{
class CV_EXPORTS BufferPool
{
public:
explicit BufferPool(Stream& stream);
GpuMat getBuffer(int rows, int cols, int type);
GpuMat getBuffer(Size size, int type) { return getBuffer(size.height, size.width, type); }
GpuMat::Allocator* getAllocator() const { return allocator_; }
private:
GpuMat::Allocator* allocator_;
};
static inline void checkNppError(int code, const char* file, const int line, const char* func)
{
if (code < 0)
cv::error(cv::Error::GpuApiCallError, getNppErrorMessage(code), func, file, line);
}
static inline void checkCudaDriverApiError(int code, const char* file, const int line, const char* func)
{
if (code != CUDA_SUCCESS)
cv::error(cv::Error::GpuApiCallError, getCudaDriverApiErrorMessage(code), func, file, line);
}
template<int n> struct NPPTypeTraits;
template<> struct NPPTypeTraits<CV_8U> { typedef Npp8u npp_type; };
template<> struct NPPTypeTraits<CV_8S> { typedef Npp8s npp_type; };
template<> struct NPPTypeTraits<CV_16U> { typedef Npp16u npp_type; };
template<> struct NPPTypeTraits<CV_16S> { typedef Npp16s npp_type; };
template<> struct NPPTypeTraits<CV_32S> { typedef Npp32s npp_type; };
template<> struct NPPTypeTraits<CV_32F> { typedef Npp32f npp_type; };
template<> struct NPPTypeTraits<CV_64F> { typedef Npp64f npp_type; };
class NppStreamHandler
{
public:
inline explicit NppStreamHandler(Stream& newStream)
{
oldStream = nppGetStream();
nppSetStream(StreamAccessor::getStream(newStream));
}
inline explicit NppStreamHandler(cudaStream_t newStream)
{
oldStream = nppGetStream();
nppSetStream(newStream);
}
inline ~NppStreamHandler()
{
nppSetStream(oldStream);
}
private:
cudaStream_t oldStream;
};
}}
#define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
#define cuSafeCall(expr) cv::cuda::checkCudaDriverApiError(expr, __FILE__, __LINE__, CV_Func)
#endif // HAVE_CUDA
//! @endcond
#endif // __OPENCV_CORE_CUDA_PRIVATE_HPP__
-296
View File
@@ -1,296 +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.
// 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_PRIVATE_HPP__
#define __OPENCV_CORE_PRIVATE_HPP__
#ifndef __OPENCV_BUILD
# error this is a private header which should not be used from outside of the OpenCV library
#endif
#include "opencv2/core.hpp"
#include "cvconfig.h"
#ifdef HAVE_EIGEN
# if defined __GNUC__ && defined __APPLE__
# pragma GCC diagnostic ignored "-Wshadow"
# endif
# include <Eigen/Core>
# include "opencv2/core/eigen.hpp"
#endif
#ifdef HAVE_TBB
# include "tbb/tbb_stddef.h"
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
# include "tbb/tbb.h"
# include "tbb/task.h"
# undef min
# undef max
# else
# undef HAVE_TBB
# endif
#endif
//! @cond IGNORED
namespace cv
{
#ifdef HAVE_TBB
typedef tbb::blocked_range<int> BlockedRange;
template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body )
{
tbb::parallel_for(range, body);
}
typedef tbb::split Split;
template<typename Body> static inline
void parallel_reduce( const BlockedRange& range, Body& body )
{
tbb::parallel_reduce(range, body);
}
typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
#else
class BlockedRange
{
public:
BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
int begin() const { return _begin; }
int end() const { return _end; }
int grainsize() const { return _grainsize; }
protected:
int _begin, _end, _grainsize;
};
template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body )
{
body(range);
}
typedef std::vector<Rect> ConcurrentRectVector;
class Split {};
template<typename Body> static inline
void parallel_reduce( const BlockedRange& range, Body& body )
{
body(range);
}
#endif
// Returns a static string if there is a parallel framework,
// NULL otherwise.
CV_EXPORTS const char* currentParallelFramework();
} //namespace cv
/****************************************************************************************\
* Common declarations *
\****************************************************************************************/
/* the alignment of all the allocated buffers */
#define CV_MALLOC_ALIGN 16
/* IEEE754 constants and macros */
#define CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
#define CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
static inline void* cvAlignPtr( const void* ptr, int align = 32 )
{
CV_DbgAssert ( (align & (align-1)) == 0 );
return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
}
static inline int cvAlign( int size, int align )
{
CV_DbgAssert( (align & (align-1)) == 0 && size < INT_MAX );
return (size + align - 1) & -align;
}
#ifdef IPL_DEPTH_8U
static inline cv::Size cvGetMatSize( const CvMat* mat )
{
return cv::Size(mat->cols, mat->rows);
}
#endif
namespace cv
{
CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int unroll_to = 0);
}
// property implementation macros
#define CV_IMPL_PROPERTY_RO(type, name, member) \
inline type get##name() const { return member; }
#define CV_HELP_IMPL_PROPERTY(r_type, w_type, name, member) \
CV_IMPL_PROPERTY_RO(r_type, name, member) \
inline void set##name(w_type val) { member = val; }
#define CV_HELP_WRAP_PROPERTY(r_type, w_type, name, internal_name, internal_obj) \
r_type get##name() const { return internal_obj.get##internal_name(); } \
void set##name(w_type val) { internal_obj.set##internal_name(val); }
#define CV_IMPL_PROPERTY(type, name, member) CV_HELP_IMPL_PROPERTY(type, type, name, member)
#define CV_IMPL_PROPERTY_S(type, name, member) CV_HELP_IMPL_PROPERTY(type, const type &, name, member)
#define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, type, name, internal_name, internal_obj)
#define CV_WRAP_PROPERTY_S(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, const type &, name, internal_name, internal_obj)
#define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
#define CV_WRAP_SAME_PROPERTY_S(type, name, internal_obj) CV_WRAP_PROPERTY_S(type, name, name, internal_obj)
/****************************************************************************************\
* Structures and macros for integration with IPP *
\****************************************************************************************/
#ifdef HAVE_IPP
# include "ipp.h"
# define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR)
#define IPP_ALIGN 32 // required for AVX optimization
#define setIppErrorStatus() cv::ipp::setIppStatus(-1, CV_Func, __FILE__, __LINE__)
static inline IppiSize ippiSize(int width, int height)
{
IppiSize size = { width, height };
return size;
}
static inline IppiSize ippiSize(const cv::Size & _size)
{
IppiSize size = { _size.width, _size.height };
return size;
}
static inline IppiBorderType ippiGetBorderType(int borderTypeNI)
{
return borderTypeNI == cv::BORDER_CONSTANT ? ippBorderConst :
borderTypeNI == cv::BORDER_WRAP ? ippBorderWrap :
borderTypeNI == cv::BORDER_REPLICATE ? ippBorderRepl :
borderTypeNI == cv::BORDER_REFLECT_101 ? ippBorderMirror :
borderTypeNI == cv::BORDER_REFLECT ? ippBorderMirrorR : (IppiBorderType)-1;
}
static inline IppDataType ippiGetDataType(int depth)
{
return depth == CV_8U ? ipp8u :
depth == CV_8S ? ipp8s :
depth == CV_16U ? ipp16u :
depth == CV_16S ? ipp16s :
depth == CV_32S ? ipp32s :
depth == CV_32F ? ipp32f :
depth == CV_64F ? ipp64f : (IppDataType)-1;
}
#else
# define IPP_VERSION_X100 0
#endif
#define CV_IPP_CHECK_COND (cv::ipp::useIPP())
#define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
#ifndef IPPI_CALL
# define IPPI_CALL(func) CV_Assert((func) >= 0)
#endif
/* IPP-compatible return codes */
typedef enum CvStatus
{
CV_BADMEMBLOCK_ERR = -113,
CV_INPLACE_NOT_SUPPORTED_ERR= -112,
CV_UNMATCHED_ROI_ERR = -111,
CV_NOTFOUND_ERR = -110,
CV_BADCONVERGENCE_ERR = -109,
CV_BADDEPTH_ERR = -107,
CV_BADROI_ERR = -106,
CV_BADHEADER_ERR = -105,
CV_UNMATCHED_FORMATS_ERR = -104,
CV_UNSUPPORTED_COI_ERR = -103,
CV_UNSUPPORTED_CHANNELS_ERR = -102,
CV_UNSUPPORTED_DEPTH_ERR = -101,
CV_UNSUPPORTED_FORMAT_ERR = -100,
CV_BADARG_ERR = -49, //ipp comp
CV_NOTDEFINED_ERR = -48, //ipp comp
CV_BADCHANNELS_ERR = -47, //ipp comp
CV_BADRANGE_ERR = -44, //ipp comp
CV_BADSTEP_ERR = -29, //ipp comp
CV_BADFLAG_ERR = -12,
CV_DIV_BY_ZERO_ERR = -11, //ipp comp
CV_BADCOEF_ERR = -10,
CV_BADFACTOR_ERR = -7,
CV_BADPOINT_ERR = -6,
CV_BADSCALE_ERR = -4,
CV_OUTOFMEM_ERR = -3,
CV_NULLPTR_ERR = -2,
CV_BADSIZE_ERR = -1,
CV_NO_ERR = 0,
CV_OK = CV_NO_ERR
}
CvStatus;
#ifdef HAVE_TEGRA_OPTIMIZATION
namespace tegra {
CV_EXPORTS bool useTegra();
CV_EXPORTS void setUseTegra(bool flag);
}
#endif
//! @endcond
#endif // __OPENCV_CORE_PRIVATE_HPP__
+42 -5
View File
@@ -39,8 +39,8 @@
//
//M*/
#ifndef __OPENCV_CORE_PTR_INL_HPP__
#define __OPENCV_CORE_PTR_INL_HPP__
#ifndef OPENCV_CORE_PTR_INL_HPP
#define OPENCV_CORE_PTR_INL_HPP
#include <algorithm>
@@ -89,12 +89,12 @@ private:
};
template<typename Y, typename D>
struct PtrOwnerImpl : PtrOwner
struct PtrOwnerImpl CV_FINAL : PtrOwner
{
PtrOwnerImpl(Y* p, D d) : owned(p), deleter(d)
{}
void deleteSelf()
void deleteSelf() CV_OVERRIDE
{
deleter(owned);
delete this;
@@ -252,6 +252,32 @@ Ptr<Y> Ptr<T>::dynamicCast() const
return Ptr<Y>(*this, dynamic_cast<Y*>(stored));
}
#ifdef CV_CXX_MOVE_SEMANTICS
template<typename T>
Ptr<T>::Ptr(Ptr&& o) : owner(o.owner), stored(o.stored)
{
o.owner = NULL;
o.stored = NULL;
}
template<typename T>
Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o)
{
if (this == &o)
return *this;
release();
owner = o.owner;
stored = o.stored;
o.owner = NULL;
o.stored = NULL;
return *this;
}
#endif
template<typename T>
void swap(Ptr<T>& ptr1, Ptr<T>& ptr2){
ptr1.swap(ptr2);
@@ -335,8 +361,19 @@ Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5&
return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
}
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10, const A11& a11)
{
return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11));
}
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10, const A11& a11, const A12& a12)
{
return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12));
}
} // namespace cv
//! @endcond
#endif // __OPENCV_CORE_PTR_INL_HPP__
#endif // OPENCV_CORE_PTR_INL_HPP
+165
View File
@@ -0,0 +1,165 @@
/*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 function saturate_cast resembles the standard C++ cast operations, such as static_cast\<T\>()
and others. It 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>(unsigned v) { return (int)std::min(v, (unsigned)INT_MAX); }
template<> inline int saturate_cast<int>(int64 v) { return (int)((uint64)(v - INT_MIN) <= (uint64)UINT_MAX ? v : v > 0 ? INT_MAX : INT_MIN); }
template<> inline int saturate_cast<int>(uint64 v) { return (int)std::min(v, (uint64)INT_MAX); }
template<> inline int saturate_cast<int>(float v) { return cvRound(v); }
template<> inline int saturate_cast<int>(double v) { return cvRound(v); }
template<> inline unsigned saturate_cast<unsigned>(schar v) { return (unsigned)std::max(v, (schar)0); }
template<> inline unsigned saturate_cast<unsigned>(short v) { return (unsigned)std::max(v, (short)0); }
template<> inline unsigned saturate_cast<unsigned>(int v) { return (unsigned)std::max(v, (int)0); }
template<> inline unsigned saturate_cast<unsigned>(int64 v) { return (unsigned)((uint64)v <= (uint64)UINT_MAX ? v : v > 0 ? UINT_MAX : 0); }
template<> inline unsigned saturate_cast<unsigned>(uint64 v) { return (unsigned)std::min(v, (uint64)UINT_MAX); }
// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
template<> inline unsigned saturate_cast<unsigned>(float v) { return static_cast<unsigned>(cvRound(v)); }
template<> inline unsigned saturate_cast<unsigned>(double v) { return static_cast<unsigned>(cvRound(v)); }
template<> inline uint64 saturate_cast<uint64>(schar v) { return (uint64)std::max(v, (schar)0); }
template<> inline uint64 saturate_cast<uint64>(short v) { return (uint64)std::max(v, (short)0); }
template<> inline uint64 saturate_cast<uint64>(int v) { return (uint64)std::max(v, (int)0); }
template<> inline uint64 saturate_cast<uint64>(int64 v) { return (uint64)std::max(v, (int64)0); }
template<> inline int64 saturate_cast<int64>(uint64 v) { return (int64)std::min(v, (uint64)LLONG_MAX); }
//! @}
} // cv
#endif // OPENCV_CORE_SATURATE_HPP
+514
View File
@@ -0,0 +1,514 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
// This file is based on files from package issued with the following license:
/*============================================================================
This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
Package, Release 3c, by John R. Hauser.
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the
University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions, and the following disclaimer.
2. Redistributions 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.
3. Neither the name of the University nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
=============================================================================*/
#pragma once
#ifndef softfloat_h
#define softfloat_h 1
#include "cvdef.h"
namespace cv
{
/** @addtogroup core_utils_softfloat
[SoftFloat](http://www.jhauser.us/arithmetic/SoftFloat.html) is a software implementation
of floating-point calculations according to IEEE 754 standard.
All calculations are done in integers, that's why they are machine-independent and bit-exact.
This library can be useful in accuracy-critical parts like look-up tables generation, tests, etc.
OpenCV contains a subset of SoftFloat partially rewritten to C++.
### Types
There are two basic types: @ref softfloat and @ref softdouble.
These types are binary compatible with float and double types respectively
and support conversions to/from them.
Other types from original SoftFloat library like fp16 or fp128 were thrown away
as well as quiet/signaling NaN support, on-the-fly rounding mode switch
and exception flags (though exceptions can be implemented in the future).
### Operations
Both types support the following:
- Construction from signed and unsigned 32-bit and 64 integers,
float/double or raw binary representation
- Conversions between each other, to float or double and to int
using @ref cvRound, @ref cvTrunc, @ref cvFloor, @ref cvCeil or a bunch of
saturate_cast functions
- Add, subtract, multiply, divide, remainder, square root, FMA with absolute precision
- Comparison operations
- Explicit sign, exponent and significand manipulation through get/set methods,
number state indicators (isInf, isNan, isSubnormal)
- Type-specific constants like eps, minimum/maximum value, best pi approximation, etc.
- min(), max(), abs(), exp(), log() and pow() functions
*/
//! @{
struct softfloat;
struct softdouble;
struct CV_EXPORTS softfloat
{
public:
/** @brief Default constructor */
softfloat() { v = 0; }
/** @brief Copy constructor */
softfloat( const softfloat& c) { v = c.v; }
/** @brief Assign constructor */
softfloat& operator=( const softfloat& c )
{
if(&c != this) v = c.v;
return *this;
}
/** @brief Construct from raw
Builds new value from raw binary representation
*/
static const softfloat fromRaw( const uint32_t a ) { softfloat x; x.v = a; return x; }
/** @brief Construct from integer */
explicit softfloat( const uint32_t );
explicit softfloat( const uint64_t );
explicit softfloat( const int32_t );
explicit softfloat( const int64_t );
#ifdef CV_INT32_T_IS_LONG_INT
// for platforms with int32_t = long int
explicit softfloat( const int a ) { *this = softfloat(static_cast<int32_t>(a)); }
#endif
/** @brief Construct from float */
explicit softfloat( const float a ) { Cv32suf s; s.f = a; v = s.u; }
/** @brief Type casts */
operator softdouble() const;
operator float() const { Cv32suf s; s.u = v; return s.f; }
/** @brief Basic arithmetics */
softfloat operator + (const softfloat&) const;
softfloat operator - (const softfloat&) const;
softfloat operator * (const softfloat&) const;
softfloat operator / (const softfloat&) const;
softfloat operator - () const { softfloat x; x.v = v ^ (1U << 31); return x; }
/** @brief Remainder operator
A quote from original SoftFloat manual:
> The IEEE Standard remainder operation computes the value
> a - n * b, where n is the integer closest to a / b.
> If a / b is exactly halfway between two integers, n is the even integer
> closest to a / b. The IEEE Standards remainder operation is always exact and so requires no rounding.
> Depending on the relative magnitudes of the operands, the remainder functions
> can take considerably longer to execute than the other SoftFloat functions.
> This is an inherent characteristic of the remainder operation itself and is not a flaw
> in the SoftFloat implementation.
*/
softfloat operator % (const softfloat&) const;
softfloat& operator += (const softfloat& a) { *this = *this + a; return *this; }
softfloat& operator -= (const softfloat& a) { *this = *this - a; return *this; }
softfloat& operator *= (const softfloat& a) { *this = *this * a; return *this; }
softfloat& operator /= (const softfloat& a) { *this = *this / a; return *this; }
softfloat& operator %= (const softfloat& a) { *this = *this % a; return *this; }
/** @brief Comparison operations
- Any operation with NaN produces false
+ The only exception is when x is NaN: x != y for any y.
- Positive and negative zeros are equal
*/
bool operator == ( const softfloat& ) const;
bool operator != ( const softfloat& ) const;
bool operator > ( const softfloat& ) const;
bool operator >= ( const softfloat& ) const;
bool operator < ( const softfloat& ) const;
bool operator <= ( const softfloat& ) const;
/** @brief NaN state indicator */
inline bool isNaN() const { return (v & 0x7fffffff) > 0x7f800000; }
/** @brief Inf state indicator */
inline bool isInf() const { return (v & 0x7fffffff) == 0x7f800000; }
/** @brief Subnormal number indicator */
inline bool isSubnormal() const { return ((v >> 23) & 0xFF) == 0; }
/** @brief Get sign bit */
inline bool getSign() const { return (v >> 31) != 0; }
/** @brief Construct a copy with new sign bit */
inline softfloat setSign(bool sign) const { softfloat x; x.v = (v & ((1U << 31) - 1)) | ((uint32_t)sign << 31); return x; }
/** @brief Get 0-based exponent */
inline int getExp() const { return ((v >> 23) & 0xFF) - 127; }
/** @brief Construct a copy with new 0-based exponent */
inline softfloat setExp(int e) const { softfloat x; x.v = (v & 0x807fffff) | (((e + 127) & 0xFF) << 23 ); return x; }
/** @brief Get a fraction part
Returns a number 1 <= x < 2 with the same significand
*/
inline softfloat getFrac() const
{
uint_fast32_t vv = (v & 0x007fffff) | (127 << 23);
return softfloat::fromRaw(vv);
}
/** @brief Construct a copy with provided significand
Constructs a copy of a number with significand taken from parameter
*/
inline softfloat setFrac(const softfloat& s) const
{
softfloat x;
x.v = (v & 0xff800000) | (s.v & 0x007fffff);
return x;
}
/** @brief Zero constant */
static softfloat zero() { return softfloat::fromRaw( 0 ); }
/** @brief Positive infinity constant */
static softfloat inf() { return softfloat::fromRaw( 0xFF << 23 ); }
/** @brief Default NaN constant */
static softfloat nan() { return softfloat::fromRaw( 0x7fffffff ); }
/** @brief One constant */
static softfloat one() { return softfloat::fromRaw( 127 << 23 ); }
/** @brief Smallest normalized value */
static softfloat min() { return softfloat::fromRaw( 0x01 << 23 ); }
/** @brief Difference between 1 and next representable value */
static softfloat eps() { return softfloat::fromRaw( (127 - 23) << 23 ); }
/** @brief Biggest finite value */
static softfloat max() { return softfloat::fromRaw( (0xFF << 23) - 1 ); }
/** @brief Correct pi approximation */
static softfloat pi() { return softfloat::fromRaw( 0x40490fdb ); }
uint32_t v;
};
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
struct CV_EXPORTS softdouble
{
public:
/** @brief Default constructor */
softdouble() : v(0) { }
/** @brief Copy constructor */
softdouble( const softdouble& c) { v = c.v; }
/** @brief Assign constructor */
softdouble& operator=( const softdouble& c )
{
if(&c != this) v = c.v;
return *this;
}
/** @brief Construct from raw
Builds new value from raw binary representation
*/
static softdouble fromRaw( const uint64_t a ) { softdouble x; x.v = a; return x; }
/** @brief Construct from integer */
explicit softdouble( const uint32_t );
explicit softdouble( const uint64_t );
explicit softdouble( const int32_t );
explicit softdouble( const int64_t );
#ifdef CV_INT32_T_IS_LONG_INT
// for platforms with int32_t = long int
explicit softdouble( const int a ) { *this = softdouble(static_cast<int32_t>(a)); }
#endif
/** @brief Construct from double */
explicit softdouble( const double a ) { Cv64suf s; s.f = a; v = s.u; }
/** @brief Type casts */
operator softfloat() const;
operator double() const { Cv64suf s; s.u = v; return s.f; }
/** @brief Basic arithmetics */
softdouble operator + (const softdouble&) const;
softdouble operator - (const softdouble&) const;
softdouble operator * (const softdouble&) const;
softdouble operator / (const softdouble&) const;
softdouble operator - () const { softdouble x; x.v = v ^ (1ULL << 63); return x; }
/** @brief Remainder operator
A quote from original SoftFloat manual:
> The IEEE Standard remainder operation computes the value
> a - n * b, where n is the integer closest to a / b.
> If a / b is exactly halfway between two integers, n is the even integer
> closest to a / b. The IEEE Standards remainder operation is always exact and so requires no rounding.
> Depending on the relative magnitudes of the operands, the remainder functions
> can take considerably longer to execute than the other SoftFloat functions.
> This is an inherent characteristic of the remainder operation itself and is not a flaw
> in the SoftFloat implementation.
*/
softdouble operator % (const softdouble&) const;
softdouble& operator += (const softdouble& a) { *this = *this + a; return *this; }
softdouble& operator -= (const softdouble& a) { *this = *this - a; return *this; }
softdouble& operator *= (const softdouble& a) { *this = *this * a; return *this; }
softdouble& operator /= (const softdouble& a) { *this = *this / a; return *this; }
softdouble& operator %= (const softdouble& a) { *this = *this % a; return *this; }
/** @brief Comparison operations
- Any operation with NaN produces false
+ The only exception is when x is NaN: x != y for any y.
- Positive and negative zeros are equal
*/
bool operator == ( const softdouble& ) const;
bool operator != ( const softdouble& ) const;
bool operator > ( const softdouble& ) const;
bool operator >= ( const softdouble& ) const;
bool operator < ( const softdouble& ) const;
bool operator <= ( const softdouble& ) const;
/** @brief NaN state indicator */
inline bool isNaN() const { return (v & 0x7fffffffffffffff) > 0x7ff0000000000000; }
/** @brief Inf state indicator */
inline bool isInf() const { return (v & 0x7fffffffffffffff) == 0x7ff0000000000000; }
/** @brief Subnormal number indicator */
inline bool isSubnormal() const { return ((v >> 52) & 0x7FF) == 0; }
/** @brief Get sign bit */
inline bool getSign() const { return (v >> 63) != 0; }
/** @brief Construct a copy with new sign bit */
softdouble setSign(bool sign) const { softdouble x; x.v = (v & ((1ULL << 63) - 1)) | ((uint_fast64_t)(sign) << 63); return x; }
/** @brief Get 0-based exponent */
inline int getExp() const { return ((v >> 52) & 0x7FF) - 1023; }
/** @brief Construct a copy with new 0-based exponent */
inline softdouble setExp(int e) const
{
softdouble x;
x.v = (v & 0x800FFFFFFFFFFFFF) | ((uint_fast64_t)((e + 1023) & 0x7FF) << 52);
return x;
}
/** @brief Get a fraction part
Returns a number 1 <= x < 2 with the same significand
*/
inline softdouble getFrac() const
{
uint_fast64_t vv = (v & 0x000FFFFFFFFFFFFF) | ((uint_fast64_t)(1023) << 52);
return softdouble::fromRaw(vv);
}
/** @brief Construct a copy with provided significand
Constructs a copy of a number with significand taken from parameter
*/
inline softdouble setFrac(const softdouble& s) const
{
softdouble x;
x.v = (v & 0xFFF0000000000000) | (s.v & 0x000FFFFFFFFFFFFF);
return x;
}
/** @brief Zero constant */
static softdouble zero() { return softdouble::fromRaw( 0 ); }
/** @brief Positive infinity constant */
static softdouble inf() { return softdouble::fromRaw( (uint_fast64_t)(0x7FF) << 52 ); }
/** @brief Default NaN constant */
static softdouble nan() { return softdouble::fromRaw( CV_BIG_INT(0x7FFFFFFFFFFFFFFF) ); }
/** @brief One constant */
static softdouble one() { return softdouble::fromRaw( (uint_fast64_t)( 1023) << 52 ); }
/** @brief Smallest normalized value */
static softdouble min() { return softdouble::fromRaw( (uint_fast64_t)( 0x01) << 52 ); }
/** @brief Difference between 1 and next representable value */
static softdouble eps() { return softdouble::fromRaw( (uint_fast64_t)( 1023 - 52 ) << 52 ); }
/** @brief Biggest finite value */
static softdouble max() { return softdouble::fromRaw( ((uint_fast64_t)(0x7FF) << 52) - 1 ); }
/** @brief Correct pi approximation */
static softdouble pi() { return softdouble::fromRaw( CV_BIG_INT(0x400921FB54442D18) ); }
uint64_t v;
};
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
/** @brief Fused Multiplication and Addition
Computes (a*b)+c with single rounding
*/
CV_EXPORTS softfloat mulAdd( const softfloat& a, const softfloat& b, const softfloat & c);
CV_EXPORTS softdouble mulAdd( const softdouble& a, const softdouble& b, const softdouble& c);
/** @brief Square root */
CV_EXPORTS softfloat sqrt( const softfloat& a );
CV_EXPORTS softdouble sqrt( const softdouble& a );
}
/*----------------------------------------------------------------------------
| Ported from OpenCV and added for usability
*----------------------------------------------------------------------------*/
/** @brief Truncates number to integer with minimum magnitude */
CV_EXPORTS int cvTrunc(const cv::softfloat& a);
CV_EXPORTS int cvTrunc(const cv::softdouble& a);
/** @brief Rounds a number to nearest even integer */
CV_EXPORTS int cvRound(const cv::softfloat& a);
CV_EXPORTS int cvRound(const cv::softdouble& a);
/** @brief Rounds a number to nearest even long long integer */
CV_EXPORTS int64_t cvRound64(const cv::softdouble& a);
/** @brief Rounds a number down to integer */
CV_EXPORTS int cvFloor(const cv::softfloat& a);
CV_EXPORTS int cvFloor(const cv::softdouble& a);
/** @brief Rounds number up to integer */
CV_EXPORTS int cvCeil(const cv::softfloat& a);
CV_EXPORTS int cvCeil(const cv::softdouble& a);
namespace cv
{
/** @brief Saturate casts */
template<typename _Tp> static inline _Tp saturate_cast(softfloat a) { return _Tp(a); }
template<typename _Tp> static inline _Tp saturate_cast(softdouble a) { return _Tp(a); }
template<> inline uchar saturate_cast<uchar>(softfloat a) { return (uchar)std::max(std::min(cvRound(a), (int)UCHAR_MAX), 0); }
template<> inline uchar saturate_cast<uchar>(softdouble a) { return (uchar)std::max(std::min(cvRound(a), (int)UCHAR_MAX), 0); }
template<> inline schar saturate_cast<schar>(softfloat a) { return (schar)std::min(std::max(cvRound(a), (int)SCHAR_MIN), (int)SCHAR_MAX); }
template<> inline schar saturate_cast<schar>(softdouble a) { return (schar)std::min(std::max(cvRound(a), (int)SCHAR_MIN), (int)SCHAR_MAX); }
template<> inline ushort saturate_cast<ushort>(softfloat a) { return (ushort)std::max(std::min(cvRound(a), (int)USHRT_MAX), 0); }
template<> inline ushort saturate_cast<ushort>(softdouble a) { return (ushort)std::max(std::min(cvRound(a), (int)USHRT_MAX), 0); }
template<> inline short saturate_cast<short>(softfloat a) { return (short)std::min(std::max(cvRound(a), (int)SHRT_MIN), (int)SHRT_MAX); }
template<> inline short saturate_cast<short>(softdouble a) { return (short)std::min(std::max(cvRound(a), (int)SHRT_MIN), (int)SHRT_MAX); }
template<> inline int saturate_cast<int>(softfloat a) { return cvRound(a); }
template<> inline int saturate_cast<int>(softdouble a) { return cvRound(a); }
template<> inline int64_t saturate_cast<int64_t>(softfloat a) { return cvRound(a); }
template<> inline int64_t saturate_cast<int64_t>(softdouble a) { return cvRound64(a); }
/** @brief Saturate cast to unsigned integer and unsigned long long integer
We intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
*/
template<> inline unsigned saturate_cast<unsigned>(softfloat a) { return cvRound(a); }
template<> inline unsigned saturate_cast<unsigned>(softdouble a) { return cvRound(a); }
template<> inline uint64_t saturate_cast<uint64_t>(softfloat a) { return cvRound(a); }
template<> inline uint64_t saturate_cast<uint64_t>(softdouble a) { return cvRound64(a); }
/** @brief Min and Max functions */
inline softfloat min(const softfloat& a, const softfloat& b) { return (a > b) ? b : a; }
inline softdouble min(const softdouble& a, const softdouble& b) { return (a > b) ? b : a; }
inline softfloat max(const softfloat& a, const softfloat& b) { return (a > b) ? a : b; }
inline softdouble max(const softdouble& a, const softdouble& b) { return (a > b) ? a : b; }
/** @brief Absolute value */
inline softfloat abs( softfloat a) { softfloat x; x.v = a.v & ((1U << 31) - 1); return x; }
inline softdouble abs( softdouble a) { softdouble x; x.v = a.v & ((1ULL << 63) - 1); return x; }
/** @brief Exponent
Special cases:
- exp(NaN) is NaN
- exp(-Inf) == 0
- exp(+Inf) == +Inf
*/
CV_EXPORTS softfloat exp( const softfloat& a);
CV_EXPORTS softdouble exp( const softdouble& a);
/** @brief Natural logarithm
Special cases:
- log(NaN), log(x < 0) are NaN
- log(0) == -Inf
*/
CV_EXPORTS softfloat log( const softfloat& a );
CV_EXPORTS softdouble log( const softdouble& a );
/** @brief Raising to the power
Special cases:
- x**NaN is NaN for any x
- ( |x| == 1 )**Inf is NaN
- ( |x| > 1 )**+Inf or ( |x| < 1 )**-Inf is +Inf
- ( |x| > 1 )**-Inf or ( |x| < 1 )**+Inf is 0
- x ** 0 == 1 for any x
- x ** 1 == 1 for any x
- NaN ** y is NaN for any other y
- Inf**(y < 0) == 0
- Inf ** y is +Inf for any other y
- (x < 0)**y is NaN for any other y if x can't be correctly rounded to integer
- 0 ** 0 == 1
- 0 ** (y < 0) is +Inf
- 0 ** (y > 0) is 0
*/
CV_EXPORTS softfloat pow( const softfloat& a, const softfloat& b);
CV_EXPORTS softdouble pow( const softdouble& a, const softdouble& b);
/** @brief Cube root
Special cases:
- cbrt(NaN) is NaN
- cbrt(+/-Inf) is +/-Inf
*/
CV_EXPORTS softfloat cbrt( const softfloat& a );
/** @brief Sine
Special cases:
- sin(Inf) or sin(NaN) is NaN
- sin(x) == x when sin(x) is close to zero
*/
CV_EXPORTS softdouble sin( const softdouble& a );
/** @brief Cosine
*
Special cases:
- cos(Inf) or cos(NaN) is NaN
- cos(x) == +/- 1 when cos(x) is close to +/- 1
*/
CV_EXPORTS softdouble cos( const softdouble& a );
}
//! @}
#endif
+13 -6
View File
@@ -39,13 +39,18 @@
//
//M*/
#ifndef __OPENCV_CORE_SSE_UTILS_HPP__
#define __OPENCV_CORE_SSE_UTILS_HPP__
#ifndef OPENCV_CORE_SSE_UTILS_HPP
#define OPENCV_CORE_SSE_UTILS_HPP
#ifndef __cplusplus
# error sse_utils.hpp header must be compiled as C++
#endif
#include "opencv2/core/cvdef.h"
//! @addtogroup core_utils_sse
//! @{
#if CV_SSE2
inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
@@ -562,7 +567,7 @@ inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m
inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1)
{
const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
enum { mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1) };
__m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
__m128 layer2_chunk2 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
@@ -583,7 +588,7 @@ inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m12
inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0,
__m128 & v_g1, __m128 & v_b0, __m128 & v_b1)
{
const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
enum { mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1) };
__m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
__m128 layer2_chunk3 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
@@ -610,7 +615,7 @@ inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0,
inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1,
__m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1)
{
const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
enum { mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1) };
__m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
__m128 layer2_chunk4 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
@@ -642,4 +647,6 @@ inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m12
#endif // CV_SSE2
#endif //__OPENCV_CORE_SSE_UTILS_HPP__
//! @}
#endif //OPENCV_CORE_SSE_UTILS_HPP
+74 -3
View File
@@ -41,19 +41,23 @@
//
//M*/
#ifndef __OPENCV_CORE_TRAITS_HPP__
#define __OPENCV_CORE_TRAITS_HPP__
#ifndef OPENCV_CORE_TRAITS_HPP
#define OPENCV_CORE_TRAITS_HPP
#include "opencv2/core/cvdef.h"
namespace cv
{
//#define OPENCV_TRAITS_ENABLE_DEPRECATED
//! @addtogroup core_basic
//! @{
/** @brief Template "trait" class for OpenCV primitive data types.
@note Deprecated. This is replaced by "single purpose" traits: traits::Type and traits::Depth
A primitive OpenCV data type is one of unsigned char, bool, signed char, unsigned short, signed
short, int, float, double, or a tuple of values of one of these types, where all the values in the
tuple have the same type. Any primitive type from the list can be defined by an identifier in the
@@ -102,10 +106,13 @@ So, such traits are used to tell OpenCV which data type you are working with, ev
not native to OpenCV. For example, the matrix B initialization above is compiled because OpenCV
defines the proper specialized template class DataType\<complex\<_Tp\> \> . This mechanism is also
useful (and used in OpenCV this way) for generic algorithms implementations.
@note Default values were dropped to stop confusing developers about using of unsupported types (see #7599)
*/
template<typename _Tp> class DataType
{
public:
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
typedef _Tp value_type;
typedef value_type work_type;
typedef value_type channel_type;
@@ -116,6 +123,7 @@ public:
fmt = 0,
type = CV_MAKETYPE(depth, channels)
};
#endif
};
template<> class DataType<bool>
@@ -270,11 +278,14 @@ public:
};
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
template<int _depth> class TypeDepth
{
#ifdef OPENCV_TRAITS_ENABLE_LEGACY_DEFAULTS
enum { depth = CV_USRTYPE1 };
typedef void value_type;
#endif
};
template<> class TypeDepth<CV_8U>
@@ -319,8 +330,68 @@ template<> class TypeDepth<CV_64F>
typedef double value_type;
};
#endif
//! @}
namespace traits {
namespace internal {
#define CV_CREATE_MEMBER_CHECK(X) \
template<typename T> class CheckMember_##X { \
struct Fallback { int X; }; \
struct Derived : T, Fallback { }; \
template<typename U, U> struct Check; \
typedef char CV_NO[1]; \
typedef char CV_YES[2]; \
template<typename U> static CV_NO & func(Check<int Fallback::*, &U::X> *); \
template<typename U> static CV_YES & func(...); \
public: \
typedef CheckMember_##X type; \
enum { value = sizeof(func<Derived>(0)) == sizeof(CV_YES) }; \
};
CV_CREATE_MEMBER_CHECK(fmt)
CV_CREATE_MEMBER_CHECK(type)
} // namespace internal
template<typename T>
struct Depth
{ enum { value = DataType<T>::depth }; };
template<typename T>
struct Type
{ enum { value = DataType<T>::type }; };
/** Similar to traits::Type<T> but has value = -1 in case of unknown type (instead of compiler error) */
template<typename T, bool available = internal::CheckMember_type< DataType<T> >::value >
struct SafeType {};
template<typename T>
struct SafeType<T, false>
{ enum { value = -1 }; };
template<typename T>
struct SafeType<T, true>
{ enum { value = Type<T>::value }; };
template<typename T, bool available = internal::CheckMember_fmt< DataType<T> >::value >
struct SafeFmt {};
template<typename T>
struct SafeFmt<T, false>
{ enum { fmt = 0 }; };
template<typename T>
struct SafeFmt<T, true>
{ enum { fmt = DataType<T>::fmt }; };
} // namespace
} // cv
#endif // __OPENCV_CORE_TRAITS_HPP__
#endif // OPENCV_CORE_TRAITS_HPP
+256 -93
View File
@@ -41,8 +41,8 @@
//
//M*/
#ifndef __OPENCV_CORE_TYPES_HPP__
#define __OPENCV_CORE_TYPES_HPP__
#ifndef OPENCV_CORE_TYPES_HPP
#define OPENCV_CORE_TYPES_HPP
#ifndef __cplusplus
# error types.hpp header must be compiled as C++
@@ -51,6 +51,7 @@
#include <climits>
#include <cfloat>
#include <vector>
#include <limits>
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp"
@@ -74,7 +75,7 @@ template<typename _Tp> class Complex
{
public:
//! constructors
//! default constructor
Complex();
Complex( _Tp _re, _Tp _im = 0 );
@@ -97,14 +98,23 @@ public:
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 2,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels) };
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Complex<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Complex<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; };
} // namespace
//////////////////////////////// Point_ ////////////////////////////////
@@ -149,7 +159,7 @@ template<typename _Tp> class Point_
public:
typedef _Tp value_type;
// various constructors
//! default constructor
Point_();
Point_(_Tp _x, _Tp _y);
Point_(const Point_& pt);
@@ -171,11 +181,12 @@ public:
double cross(const Point_& pt) const;
//! checks whether the point is inside the specified rectangle
bool inside(const Rect_<_Tp>& r) const;
_Tp x, y; //< the point coordinates
_Tp x; //!< x coordinate of the point
_Tp y; //!< y coordinate of the point
};
typedef Point_<int> Point2i;
typedef Point_<int64> Point2l;
typedef Point_<float> Point2f;
typedef Point_<double> Point2d;
typedef Point2i Point;
@@ -188,15 +199,23 @@ public:
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 2,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Point_<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Point_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; };
} // namespace
//////////////////////////////// Point3_ ////////////////////////////////
@@ -220,7 +239,7 @@ template<typename _Tp> class Point3_
public:
typedef _Tp value_type;
// various constructors
//! default constructor
Point3_();
Point3_(_Tp _x, _Tp _y, _Tp _z);
Point3_(const Point3_& pt);
@@ -231,7 +250,11 @@ public:
//! conversion to another data type
template<typename _Tp2> operator Point3_<_Tp2>() const;
//! conversion to cv::Vec<>
#if OPENCV_ABI_COMPATIBILITY > 300
template<typename _Tp2> operator Vec<_Tp2, 3>() const;
#else
operator Vec<_Tp, 3>() const;
#endif
//! dot product
_Tp dot(const Point3_& pt) const;
@@ -239,8 +262,9 @@ public:
double ddot(const Point3_& pt) const;
//! cross product of the 2 3D points
Point3_ cross(const Point3_& pt) const;
_Tp x, y, z; //< the point coordinates
_Tp x; //!< x coordinate of the 3D point
_Tp y; //!< y coordinate of the 3D point
_Tp z; //!< z coordinate of the 3D point
};
typedef Point3_<int> Point3i;
@@ -255,16 +279,23 @@ public:
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 3,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Point3_<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Point3_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 3) }; };
} // namespace
//////////////////////////////// Size_ ////////////////////////////////
@@ -286,7 +317,7 @@ template<typename _Tp> class Size_
public:
typedef _Tp value_type;
//! various constructors
//! default constructor
Size_();
Size_(_Tp _width, _Tp _height);
Size_(const Size_& sz);
@@ -295,14 +326,18 @@ public:
Size_& operator = (const Size_& sz);
//! the area (width*height)
_Tp area() const;
//! true if empty
bool empty() const;
//! conversion of another data type.
template<typename _Tp2> operator Size_<_Tp2>() const;
_Tp width, height; // the width and the height
_Tp width; //!< the width
_Tp height; //!< the height
};
typedef Size_<int> Size2i;
typedef Size_<int64> Size2l;
typedef Size_<float> Size2f;
typedef Size_<double> Size2d;
typedef Size2i Size;
@@ -315,16 +350,23 @@ public:
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 2,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Size_<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Size_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; };
} // namespace
//////////////////////////////// Rect_ ////////////////////////////////
@@ -376,7 +418,7 @@ template<typename _Tp> class Rect_
public:
typedef _Tp value_type;
//! various constructors
//! default constructor
Rect_();
Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height);
Rect_(const Rect_& r);
@@ -393,6 +435,8 @@ public:
Size_<_Tp> size() const;
//! area (width*height) of the rectangle
_Tp area() const;
//! true if empty
bool empty() const;
//! conversion to another data type
template<typename _Tp2> operator Rect_<_Tp2>() const;
@@ -400,7 +444,10 @@ public:
//! checks whether the rectangle contains the point
bool contains(const Point_<_Tp>& pt) const;
_Tp x, y, width, height; //< the top-left corner, as well as width and height of the rectangle
_Tp x; //!< x coordinate of the top-left corner
_Tp y; //!< y coordinate of the top-left corner
_Tp width; //!< width of the rectangle
_Tp height; //!< height of the rectangle
};
typedef Rect_<int> Rect2i;
@@ -416,40 +463,33 @@ public:
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 4,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Rect_<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Rect_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 4) }; };
} // namespace
///////////////////////////// RotatedRect /////////////////////////////
/** @brief The class represents rotated (i.e. not up-right) rectangles on a plane.
Each rectangle is specified by the center point (mass center), length of each side (represented by
cv::Size2f structure) and the rotation angle in degrees.
#Size2f structure) and the rotation angle in degrees.
The sample below demonstrates how to use RotatedRect:
@code
Mat image(200, 200, CV_8UC3, Scalar(0));
RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);
Point2f vertices[4];
rRect.points(vertices);
for (int i = 0; i < 4; i++)
line(image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0));
Rect brect = rRect.boundingRect();
rectangle(image, brect, Scalar(255,0,0));
imshow("rectangles", image);
waitKey(0);
@endcode
@snippet snippets/core_various.cpp RotatedRect_demo
![image](pics/rotatedrect.png)
@sa CamShift, fitEllipse, minAreaRect, CvBox2D
@@ -457,9 +497,9 @@ The sample below demonstrates how to use RotatedRect:
class CV_EXPORTS RotatedRect
{
public:
//! various constructors
//! default constructor
RotatedRect();
/**
/** full constructor
@param center The rectangle mass center.
@param size Width and height of the rectangle.
@param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc.,
@@ -473,15 +513,19 @@ public:
RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
/** returns 4 vertices of the rectangle
@param pts The points array for storing rectangle vertices.
@param pts The points array for storing rectangle vertices. The order is bottomLeft, topLeft, topRight, bottomRight.
*/
void points(Point2f pts[]) const;
//! returns the minimal up-right rectangle containing the rotated rectangle
//! returns the minimal up-right integer rectangle containing the rotated rectangle
Rect boundingRect() const;
Point2f center; //< the rectangle mass center
Size2f size; //< width and height of the rectangle
float angle; //< the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
//! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images
Rect_<float> boundingRect2f() const;
//! returns the rectangle mass center
Point2f center;
//! returns width and height of the rectangle
Size2f size;
//! returns the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
float angle;
};
template<> class DataType< RotatedRect >
@@ -492,15 +536,23 @@ public:
typedef float channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = (int)sizeof(value_type)/sizeof(channel_type), // 5
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<>
struct Depth< RotatedRect > { enum { value = Depth<float>::value }; };
template<>
struct Type< RotatedRect > { enum { value = CV_MAKETYPE(Depth<float>::value, (int)sizeof(RotatedRect)/sizeof(float)) }; };
} // namespace
//////////////////////////////// Range /////////////////////////////////
@@ -548,29 +600,37 @@ public:
typedef int channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 2,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<>
struct Depth< Range > { enum { value = Depth<int>::value }; };
template<>
struct Type< Range > { enum { value = CV_MAKETYPE(Depth<int>::value, 2) }; };
} // namespace
//////////////////////////////// Scalar_ ///////////////////////////////
/** @brief Template class for a 4-element vector derived from Vec.
Being derived from Vec\<_Tp, 4\> , Scalar_ and Scalar can be used just as typical 4-element
Being derived from Vec\<_Tp, 4\> , Scalar\_ and Scalar can be used just as typical 4-element
vectors. In addition, they can be converted to/from CvScalar . The type Scalar is widely used in
OpenCV to pass pixel values.
*/
template<typename _Tp> class Scalar_ : public Vec<_Tp, 4>
{
public:
//! various constructors
//! default constructor
Scalar_();
Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
Scalar_(_Tp v0);
@@ -587,10 +647,10 @@ public:
//! per-element product
Scalar_<_Tp> mul(const Scalar_<_Tp>& a, double scale=1 ) const;
// returns (v0, -v1, -v2, -v3)
//! returns (v0, -v1, -v2, -v3)
Scalar_<_Tp> conj() const;
// returns true iff v1 == v2 == v3 == 0
//! returns true iff v1 == v2 == v3 == 0
bool isReal() const;
};
@@ -604,15 +664,23 @@ public:
typedef _Tp channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = 4,
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<typename _Tp>
struct Depth< Scalar_<_Tp> > { enum { value = Depth<_Tp>::value }; };
template<typename _Tp>
struct Type< Scalar_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 4) }; };
} // namespace
/////////////////////////////// KeyPoint ////////////////////////////////
@@ -620,14 +688,13 @@ public:
/** @brief Data structure for salient point detectors.
The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint
detectors, such as Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT,
cv::LDetector etc.
detectors, such as Harris corner detector, #FAST, %StarDetector, %SURF, %SIFT etc.
The keypoint is characterized by the 2D position, scale (proportional to the diameter of the
neighborhood that needs to be taken into account), orientation and some other parameters. The
keypoint neighborhood is then analyzed by another algorithm that builds a descriptor (usually
represented as a feature vector). The keypoints representing the same object in different images
can then be matched using cv::KDTree or another method.
can then be matched using %KDTree or another method.
*/
class CV_EXPORTS_W_SIMPLE KeyPoint
{
@@ -699,6 +766,7 @@ public:
CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
};
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
template<> class DataType<KeyPoint>
{
public:
@@ -715,7 +783,7 @@ public:
typedef Vec<channel_type, channels> vec_type;
};
#endif
//////////////////////////////// DMatch /////////////////////////////////
@@ -732,9 +800,9 @@ public:
CV_WRAP DMatch(int _queryIdx, int _trainIdx, float _distance);
CV_WRAP DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance);
CV_PROP_RW int queryIdx; // query descriptor index
CV_PROP_RW int trainIdx; // train descriptor index
CV_PROP_RW int imgIdx; // train image index
CV_PROP_RW int queryIdx; //!< query descriptor index
CV_PROP_RW int trainIdx; //!< train descriptor index
CV_PROP_RW int imgIdx; //!< train image index
CV_PROP_RW float distance;
@@ -742,6 +810,7 @@ public:
bool operator<(const DMatch &m) const;
};
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
template<> class DataType<DMatch>
{
public:
@@ -758,7 +827,7 @@ public:
typedef Vec<channel_type, channels> vec_type;
};
#endif
///////////////////////////// TermCriteria //////////////////////////////
@@ -790,9 +859,16 @@ public:
*/
TermCriteria(int type, int maxCount, double epsilon);
inline bool isValid() const
{
const bool isCount = (type & COUNT) && maxCount > 0;
const bool isEps = (type & EPS) && !cvIsNaN(epsilon);
return isCount || isEps;
}
int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS
int maxCount; // the maximum number of iterations/elements
double epsilon; // the desired accuracy
int maxCount; //!< the maximum number of iterations/elements
double epsilon; //!< the desired accuracy
};
@@ -872,15 +948,24 @@ public:
typedef double channel_type;
enum { generic_type = 0,
depth = DataType<channel_type>::depth,
channels = (int)(sizeof(value_type)/sizeof(channel_type)), // 24
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
type = CV_MAKETYPE(depth, channels)
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8)
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
,depth = DataType<channel_type>::depth
,type = CV_MAKETYPE(depth, channels)
#endif
};
typedef Vec<channel_type, channels> vec_type;
};
namespace traits {
template<>
struct Depth< Moments > { enum { value = Depth<double>::value }; };
template<>
struct Type< Moments > { enum { value = CV_MAKETYPE(Depth<double>::value, (int)(sizeof(Moments)/sizeof(double))) }; };
} // namespace
//! @} imgproc_shape
//! @cond IGNORED
@@ -1031,7 +1116,8 @@ Complex<_Tp> operator / (const Complex<_Tp>& a, const Complex<_Tp>& b)
template<typename _Tp> static inline
Complex<_Tp>& operator /= (Complex<_Tp>& a, const Complex<_Tp>& b)
{
return (a = a / b);
a = a / b;
return a;
}
template<typename _Tp> static inline
@@ -1297,6 +1383,20 @@ Point_<_Tp> operator / (const Point_<_Tp>& a, double b)
}
template<typename _AccTp> static inline _AccTp normL2Sqr(const Point_<int>& pt);
template<typename _AccTp> static inline _AccTp normL2Sqr(const Point_<int64>& pt);
template<typename _AccTp> static inline _AccTp normL2Sqr(const Point_<float>& pt);
template<typename _AccTp> static inline _AccTp normL2Sqr(const Point_<double>& pt);
template<> inline int normL2Sqr<int>(const Point_<int>& pt) { return pt.dot(pt); }
template<> inline int64 normL2Sqr<int64>(const Point_<int64>& pt) { return pt.dot(pt); }
template<> inline float normL2Sqr<float>(const Point_<float>& pt) { return pt.dot(pt); }
template<> inline double normL2Sqr<double>(const Point_<int>& pt) { return pt.dot(pt); }
template<> inline double normL2Sqr<double>(const Point_<float>& pt) { return pt.ddot(pt); }
template<> inline double normL2Sqr<double>(const Point_<double>& pt) { return pt.ddot(pt); }
//////////////////////////////// 3D Point ///////////////////////////////
@@ -1326,11 +1426,19 @@ Point3_<_Tp>::operator Point3_<_Tp2>() const
return Point3_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(z));
}
#if OPENCV_ABI_COMPATIBILITY > 300
template<typename _Tp> template<typename _Tp2> inline
Point3_<_Tp>::operator Vec<_Tp2, 3>() const
{
return Vec<_Tp2, 3>(x, y, z);
}
#else
template<typename _Tp> inline
Point3_<_Tp>::operator Vec<_Tp, 3>() const
{
return Vec<_Tp, 3>(x, y, z);
}
#endif
template<typename _Tp> inline
Point3_<_Tp>& Point3_<_Tp>::operator = (const Point3_& pt)
@@ -1575,9 +1683,19 @@ Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz)
template<typename _Tp> inline
_Tp Size_<_Tp>::area() const
{
return width * height;
const _Tp result = width * height;
CV_DbgAssert(!std::numeric_limits<_Tp>::is_integer
|| width == 0 || result / width == height); // make sure the result fits in the return value
return result;
}
template<typename _Tp> inline
bool Size_<_Tp>::empty() const
{
return width <= 0 || height <= 0;
}
template<typename _Tp> static inline
Size_<_Tp>& operator *= (Size_<_Tp>& a, _Tp b)
{
@@ -1714,7 +1832,16 @@ Size_<_Tp> Rect_<_Tp>::size() const
template<typename _Tp> inline
_Tp Rect_<_Tp>::area() const
{
return width * height;
const _Tp result = width * height;
CV_DbgAssert(!std::numeric_limits<_Tp>::is_integer
|| width == 0 || result / width == height); // make sure the result fits in the return value
return result;
}
template<typename _Tp> inline
bool Rect_<_Tp>::empty() const
{
return width <= 0 || height <= 0;
}
template<typename _Tp> template<typename _Tp2> inline
@@ -1757,8 +1884,11 @@ Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Size_<_Tp>& b )
template<typename _Tp> static inline
Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Size_<_Tp>& b )
{
a.width -= b.width;
a.height -= b.height;
const _Tp width = a.width - b.width;
const _Tp height = a.height - b.height;
CV_DbgAssert(width >= 0 && height >= 0);
a.width = width;
a.height = height;
return a;
}
@@ -1779,12 +1909,17 @@ Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
template<typename _Tp> static inline
Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
{
_Tp x1 = std::min(a.x, b.x);
_Tp y1 = std::min(a.y, b.y);
a.width = std::max(a.x + a.width, b.x + b.width) - x1;
a.height = std::max(a.y + a.height, b.y + b.height) - y1;
a.x = x1;
a.y = y1;
if (a.empty()) {
a = b;
}
else if (!b.empty()) {
_Tp x1 = std::min(a.x, b.x);
_Tp y1 = std::min(a.y, b.y);
a.width = std::max(a.x + a.width, b.x + b.width) - x1;
a.height = std::max(a.y + a.height, b.y + b.height) - y1;
a.x = x1;
a.y = y1;
}
return a;
}
@@ -1818,6 +1953,15 @@ Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Size_<_Tp>& b)
return Rect_<_Tp>( a.x, a.y, a.width + b.width, a.height + b.height );
}
template<typename _Tp> static inline
Rect_<_Tp> operator - (const Rect_<_Tp>& a, const Size_<_Tp>& b)
{
const _Tp width = a.width - b.width;
const _Tp height = a.height - b.height;
CV_DbgAssert(width >= 0 && height >= 0);
return Rect_<_Tp>( a.x, a.y, width, height );
}
template<typename _Tp> static inline
Rect_<_Tp> operator & (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
{
@@ -1832,7 +1976,26 @@ Rect_<_Tp> operator | (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
return c |= b;
}
/**
* @brief measure dissimilarity between two sample sets
*
* computes the complement of the Jaccard Index as described in <https://en.wikipedia.org/wiki/Jaccard_index>.
* For rectangles this reduces to computing the intersection over the union.
*/
template<typename _Tp> static inline
double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
_Tp Aa = a.area();
_Tp Ab = b.area();
if ((Aa + Ab) <= std::numeric_limits<_Tp>::epsilon()) {
// jaccard_index = 1 -> distance = 0
return 0.0;
}
double Aab = (a & b).area();
// distance = 1 - jaccard_index
return 1.0 - Aab / (Aa + Ab - Aab);
}
////////////////////////////// RotatedRect //////////////////////////////
@@ -2225,4 +2388,4 @@ TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon)
} // cv
#endif //__OPENCV_CORE_TYPES_HPP__
#endif //OPENCV_CORE_TYPES_HPP
+431 -126
View File
@@ -41,12 +41,35 @@
//
//M*/
#ifndef __OPENCV_CORE_TYPES_H__
#define __OPENCV_CORE_TYPES_H__
#ifndef OPENCV_CORE_TYPES_H
#define OPENCV_CORE_TYPES_H
#if !defined(__OPENCV_BUILD) && !defined(CV__DISABLE_C_API_CTORS)
#define CV__ENABLE_C_API_CTORS // enable C API ctors (must be removed)
#endif
//#define CV__VALIDATE_UNUNITIALIZED_VARS 1 // C++11 & GCC only
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#define CV_STRUCT_INITIALIZER {0,}
#else
#if defined(__GNUC__) && __GNUC__ == 4 // GCC 4.x warns on "= {}" initialization, fixed in GCC 5.0
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#define CV_STRUCT_INITIALIZER {}
#endif
#else
#define CV_STRUCT_INITIALIZER {0}
#endif
#ifdef HAVE_IPL
# ifndef __IPL_H__
# if defined WIN32 || defined _WIN32
# if defined _WIN32
# include <ipl.h>
# else
# include <ipl/ipl.h>
@@ -65,7 +88,7 @@
#include <float.h>
#endif // SKIP_INCLUDES
#if defined WIN32 || defined _WIN32
#if defined _WIN32
# define CV_CDECL __cdecl
# define CV_STDCALL __stdcall
#else
@@ -130,24 +153,24 @@ enum {
CV_BadImageSize= -10, /**< image size is invalid */
CV_BadOffset= -11, /**< offset is invalid */
CV_BadDataPtr= -12, /**/
CV_BadStep= -13, /**/
CV_BadStep= -13, /**< image step is wrong, this may happen for a non-continuous matrix */
CV_BadModelOrChSeq= -14, /**/
CV_BadNumChannels= -15, /**/
CV_BadNumChannels= -15, /**< bad number of channels, for example, some functions accept only single channel matrices */
CV_BadNumChannel1U= -16, /**/
CV_BadDepth= -17, /**/
CV_BadDepth= -17, /**< input image depth is not supported by the function */
CV_BadAlphaChannel= -18, /**/
CV_BadOrder= -19, /**/
CV_BadOrigin= -20, /**/
CV_BadAlign= -21, /**/
CV_BadOrder= -19, /**< number of dimensions is out of range */
CV_BadOrigin= -20, /**< incorrect input origin */
CV_BadAlign= -21, /**< incorrect input align */
CV_BadCallBack= -22, /**/
CV_BadTileSize= -23, /**/
CV_BadCOI= -24, /**/
CV_BadROISize= -25, /**/
CV_BadCOI= -24, /**< input COI is not supported */
CV_BadROISize= -25, /**< incorrect input roi */
CV_MaskIsTiled= -26, /**/
CV_StsNullPtr= -27, /**< null pointer */
CV_StsVecLengthErr= -28, /**< incorrect vector length */
CV_StsFilterStructContentErr= -29, /**< incorr. filter structure content */
CV_StsKernelStructContentErr= -30, /**< incorr. transform kernel content */
CV_StsFilterStructContentErr= -29, /**< incorrect filter structure content */
CV_StsKernelStructContentErr= -30, /**< incorrect transform kernel content */
CV_StsFilterOffsetErr= -31, /**< incorrect filter offset value */
CV_StsBadSize= -201, /**< the input/output structure size is incorrect */
CV_StsDivByZero= -202, /**< division by zero */
@@ -163,14 +186,14 @@ enum {
CV_StsParseError= -212, /**< invalid syntax/structure of the parsed file */
CV_StsNotImplemented= -213, /**< the requested function/feature is not implemented */
CV_StsBadMemBlock= -214, /**< an allocated block has been corrupted */
CV_StsAssert= -215, /**< assertion failed */
CV_GpuNotSupported= -216,
CV_GpuApiCallError= -217,
CV_OpenGlNotSupported= -218,
CV_OpenGlApiCallError= -219,
CV_OpenCLApiCallError= -220,
CV_StsAssert= -215, /**< assertion failed */
CV_GpuNotSupported= -216, /**< no CUDA support */
CV_GpuApiCallError= -217, /**< GPU API call error */
CV_OpenGlNotSupported= -218, /**< no OpenGL support */
CV_OpenGlApiCallError= -219, /**< OpenGL API call error */
CV_OpenCLApiCallError= -220, /**< OpenCL API call error */
CV_OpenCLDoubleNotSupported= -221,
CV_OpenCLInitError= -222,
CV_OpenCLInitError= -222, /**< OpenCL initialization error */
CV_OpenCLNoAMDBlasFft= -223
};
@@ -285,6 +308,11 @@ CV_INLINE double cvRandReal( CvRNG* rng )
#define IPL_BORDER_REFLECT 2
#define IPL_BORDER_WRAP 3
#ifdef __cplusplus
typedef struct _IplImage IplImage;
CV_EXPORTS _IplImage cvIplImage(const cv::Mat& m);
#endif
/** The IplImage is taken from the Intel Image Processing Library, in which the format is native. OpenCV
only supports a subset of possible IplImage formats, as outlined in the parameter list above.
@@ -294,9 +322,6 @@ hand, the Intel Image Processing Library processes the area of intersection betw
destination images (or ROIs), allowing them to vary independently.
*/
typedef struct
#ifdef __cplusplus
CV_EXPORTS
#endif
_IplImage
{
int nSize; /**< sizeof(IplImage) */
@@ -330,13 +355,22 @@ _IplImage
(not necessarily aligned) -
needed for correct deallocation */
#ifdef __cplusplus
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
_IplImage() {}
_IplImage(const cv::Mat& m);
_IplImage(const cv::Mat& m) { *this = cvIplImage(m); }
#endif
}
IplImage;
CV_INLINE IplImage cvIplImage()
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
IplImage self = CV_STRUCT_INITIALIZER; self.nSize = sizeof(IplImage); return self;
#else
return _IplImage();
#endif
}
typedef struct _IplTileInfo IplTileInfo;
typedef struct _IplROI
@@ -409,6 +443,11 @@ IplConvKernelFP;
#define CV_MAT_MAGIC_VAL 0x42420000
#define CV_TYPE_NAME_MAT "opencv-matrix"
#ifdef __cplusplus
typedef struct CvMat CvMat;
CV_INLINE CvMat cvMat(const cv::Mat& m);
#endif
/** Matrix elements are stored row by row. Element (i, j) (i - 0-based row index, j - 0-based column
index) of a matrix can be retrieved or modified using CV_MAT_ELEM macro:
@@ -455,13 +494,10 @@ typedef struct CvMat
int cols;
#endif
#ifdef __cplusplus
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvMat() {}
CvMat(const CvMat& m) { memcpy(this, &m, sizeof(CvMat));}
CvMat(const cv::Mat& m);
CvMat(const cv::Mat& m) { *this = cvMat(m); }
#endif
}
CvMat;
@@ -524,14 +560,34 @@ CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)
}
#ifdef __cplusplus
inline CvMat::CvMat(const cv::Mat& m)
CV_INLINE CvMat cvMat(const cv::Mat& m)
{
CvMat self;
CV_DbgAssert(m.dims <= 2);
*this = cvMat(m.rows, m.dims == 1 ? 1 : m.cols, m.type(), m.data);
step = (int)m.step[0];
type = (type & ~cv::Mat::CONTINUOUS_FLAG) | (m.flags & cv::Mat::CONTINUOUS_FLAG);
self = cvMat(m.rows, m.dims == 1 ? 1 : m.cols, m.type(), m.data);
self.step = (int)m.step[0];
self.type = (self.type & ~cv::Mat::CONTINUOUS_FLAG) | (m.flags & cv::Mat::CONTINUOUS_FLAG);
return self;
}
CV_INLINE CvMat cvMat()
{
#if !defined(CV__ENABLE_C_API_CTORS)
CvMat self = CV_STRUCT_INITIALIZER; return self;
#else
return CvMat();
#endif
}
CV_INLINE CvMat cvMat(const CvMat& m)
{
#if !defined(CV__ENABLE_C_API_CTORS)
CvMat self = CV_STRUCT_INITIALIZER; memcpy(&self, &m, sizeof(self)); return self;
#else
return CvMat(m);
#endif
}
#endif // __cplusplus
#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
@@ -614,15 +670,16 @@ CV_INLINE int cvIplDepth( int type )
#define CV_TYPE_NAME_MATND "opencv-nd-matrix"
#define CV_MAX_DIM 32
#define CV_MAX_DIM_HEAP 1024
#ifdef __cplusplus
typedef struct CvMatND CvMatND;
CV_EXPORTS CvMatND cvMatND(const cv::Mat& m);
#endif
/**
@deprecated consider using cv::Mat instead
*/
typedef struct
#ifdef __cplusplus
CV_EXPORTS
#endif
CvMatND
{
int type;
@@ -647,13 +704,23 @@ CvMatND
}
dim[CV_MAX_DIM];
#ifdef __cplusplus
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvMatND() {}
CvMatND(const cv::Mat& m);
CvMatND(const cv::Mat& m) { *this = cvMatND(m); }
#endif
}
CvMatND;
CV_INLINE CvMatND cvMatND()
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvMatND self = CV_STRUCT_INITIALIZER; return self;
#else
return CvMatND();
#endif
}
#define CV_IS_MATND_HDR(mat) \
((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
@@ -670,11 +737,7 @@ CvMatND;
struct CvSet;
typedef struct
#ifdef __cplusplus
CV_EXPORTS
#endif
CvSparseMat
typedef struct CvSparseMat
{
int type;
int dims;
@@ -689,13 +752,13 @@ CvSparseMat
int size[CV_MAX_DIM];
#ifdef __cplusplus
void copyToSparseMat(cv::SparseMat& m) const;
CV_EXPORTS void copyToSparseMat(cv::SparseMat& m) const;
#endif
}
CvSparseMat;
#ifdef __cplusplus
CV_EXPORTS CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
CV_EXPORTS CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
#endif
#define CV_IS_SPARSE_MAT_HDR(mat) \
@@ -782,10 +845,23 @@ typedef struct CvRect
int width;
int height;
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvRect() __attribute__(( warning("Non-initialized variable") )) {};
template<typename _Tp> CvRect(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 4);
x = y = width = height = 0;
if (list.size() == 4)
{
x = list.begin()[0]; y = list.begin()[1]; width = list.begin()[2]; height = list.begin()[3];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvRect(int _x = 0, int _y = 0, int w = 0, int h = 0): x(_x), y(_y), width(w), height(h) {}
template<typename _Tp>
CvRect(const cv::Rect_<_Tp>& r): x(cv::saturate_cast<int>(r.x)), y(cv::saturate_cast<int>(r.y)), width(cv::saturate_cast<int>(r.width)), height(cv::saturate_cast<int>(r.height)) {}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Rect_<_Tp>() const { return cv::Rect_<_Tp>((_Tp)x, (_Tp)y, (_Tp)width, (_Tp)height); }
#endif
@@ -795,16 +871,16 @@ CvRect;
/** constructs CvRect structure. */
CV_INLINE CvRect cvRect( int x, int y, int width, int height )
{
CvRect r;
r.x = x;
r.y = y;
r.width = width;
r.height = height;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvRect r = {x, y, width, height};
#else
CvRect r(x, y , width, height);
#endif
return r;
}
#ifdef __cplusplus
CV_INLINE CvRect cvRect(const cv::Rect& rc) { return cvRect(rc.x, rc.y, rc.width, rc.height); }
#endif
CV_INLINE IplROI cvRectToROI( CvRect rect, int coi )
{
@@ -839,26 +915,28 @@ typedef struct CvTermCriteria
CV_TERMCRIT_EPS */
int max_iter;
double epsilon;
#ifdef __cplusplus
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvTermCriteria(int _type = 0, int _iter = 0, double _eps = 0) : type(_type), max_iter(_iter), epsilon(_eps) {}
CvTermCriteria(const cv::TermCriteria& t) : type(t.type), max_iter(t.maxCount), epsilon(t.epsilon) {}
#endif
#ifdef __cplusplus
operator cv::TermCriteria() const { return cv::TermCriteria(type, max_iter, epsilon); }
#endif
}
CvTermCriteria;
CV_INLINE CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon )
{
CvTermCriteria t;
t.type = type;
t.max_iter = max_iter;
t.epsilon = (float)epsilon;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvTermCriteria t = { type, max_iter, (float)epsilon};
#else
CvTermCriteria t(type, max_iter, epsilon);
#endif
return t;
}
#ifdef __cplusplus
CV_INLINE CvTermCriteria cvTermCriteria(const cv::TermCriteria& t) { return cvTermCriteria(t.type, t.maxCount, t.epsilon); }
#endif
/******************************* CvPoint and variants ***********************************/
@@ -868,10 +946,23 @@ typedef struct CvPoint
int x;
int y;
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvPoint() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvPoint(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 2);
x = y = 0;
if (list.size() == 2)
{
x = list.begin()[0]; y = list.begin()[1];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvPoint(int _x = 0, int _y = 0): x(_x), y(_y) {}
template<typename _Tp>
CvPoint(const cv::Point_<_Tp>& pt): x((int)pt.x), y((int)pt.y) {}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); }
#endif
@@ -881,24 +972,39 @@ CvPoint;
/** constructs CvPoint structure. */
CV_INLINE CvPoint cvPoint( int x, int y )
{
CvPoint p;
p.x = x;
p.y = y;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvPoint p = {x, y};
#else
CvPoint p(x, y);
#endif
return p;
}
#ifdef __cplusplus
CV_INLINE CvPoint cvPoint(const cv::Point& pt) { return cvPoint(pt.x, pt.y); }
#endif
typedef struct CvPoint2D32f
{
float x;
float y;
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvPoint2D32f() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvPoint2D32f(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 2);
x = y = 0;
if (list.size() == 2)
{
x = list.begin()[0]; y = list.begin()[1];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvPoint2D32f(float _x = 0, float _y = 0): x(_x), y(_y) {}
template<typename _Tp>
CvPoint2D32f(const cv::Point_<_Tp>& pt): x((float)pt.x), y((float)pt.y) {}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); }
#endif
@@ -908,14 +1014,27 @@ CvPoint2D32f;
/** constructs CvPoint2D32f structure. */
CV_INLINE CvPoint2D32f cvPoint2D32f( double x, double y )
{
CvPoint2D32f p;
p.x = (float)x;
p.y = (float)y;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvPoint2D32f p = { (float)x, (float)y };
#else
CvPoint2D32f p((float)x, (float)y);
#endif
return p;
}
#ifdef __cplusplus
template<typename _Tp>
CvPoint2D32f cvPoint2D32f(const cv::Point_<_Tp>& pt)
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvPoint2D32f p = { (float)pt.x, (float)pt.y };
#else
CvPoint2D32f p((float)pt.x, (float)pt.y);
#endif
return p;
}
#endif
/** converts CvPoint to CvPoint2D32f. */
CV_INLINE CvPoint2D32f cvPointTo32f( CvPoint point )
{
@@ -925,10 +1044,11 @@ CV_INLINE CvPoint2D32f cvPointTo32f( CvPoint point )
/** converts CvPoint2D32f to CvPoint. */
CV_INLINE CvPoint cvPointFrom32f( CvPoint2D32f point )
{
CvPoint ipt;
ipt.x = cvRound(point.x);
ipt.y = cvRound(point.y);
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvPoint ipt = { cvRound(point.x), cvRound(point.y) };
#else
CvPoint ipt(cvRound(point.x), cvRound(point.y));
#endif
return ipt;
}
@@ -939,10 +1059,23 @@ typedef struct CvPoint3D32f
float y;
float z;
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvPoint3D32f() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvPoint3D32f(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 3);
x = y = z = 0;
if (list.size() == 3)
{
x = list.begin()[0]; y = list.begin()[1]; z = list.begin()[2];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvPoint3D32f(float _x = 0, float _y = 0, float _z = 0): x(_x), y(_y), z(_z) {}
template<typename _Tp>
CvPoint3D32f(const cv::Point3_<_Tp>& pt): x((float)pt.x), y((float)pt.y), z((float)pt.z) {}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Point3_<_Tp>() const { return cv::Point3_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y), cv::saturate_cast<_Tp>(z)); }
#endif
@@ -952,31 +1085,51 @@ CvPoint3D32f;
/** constructs CvPoint3D32f structure. */
CV_INLINE CvPoint3D32f cvPoint3D32f( double x, double y, double z )
{
CvPoint3D32f p;
p.x = (float)x;
p.y = (float)y;
p.z = (float)z;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvPoint3D32f p = { (float)x, (float)y, (float)z };
#else
CvPoint3D32f p((float)x, (float)y, (float)z);
#endif
return p;
}
#ifdef __cplusplus
template<typename _Tp>
CvPoint3D32f cvPoint3D32f(const cv::Point3_<_Tp>& pt)
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvPoint3D32f p = { (float)pt.x, (float)pt.y, (float)pt.z };
#else
CvPoint3D32f p((float)pt.x, (float)pt.y, (float)pt.z);
#endif
return p;
}
#endif
typedef struct CvPoint2D64f
{
double x;
double y;
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvPoint2D64f() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvPoint2D64f(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 2);
x = y = 0;
if (list.size() == 2)
{
x = list.begin()[0]; y = list.begin()[1];
}
};
#endif
}
CvPoint2D64f;
/** constructs CvPoint2D64f structure.*/
CV_INLINE CvPoint2D64f cvPoint2D64f( double x, double y )
{
CvPoint2D64f p;
p.x = x;
p.y = y;
CvPoint2D64f p = { x, y };
return p;
}
@@ -986,18 +1139,25 @@ typedef struct CvPoint3D64f
double x;
double y;
double z;
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvPoint3D64f() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvPoint3D64f(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 3);
x = y = z = 0;
if (list.size() == 3)
{
x = list.begin()[0]; y = list.begin()[1]; z = list.begin()[2];
}
};
#endif
}
CvPoint3D64f;
/** constructs CvPoint3D64f structure. */
CV_INLINE CvPoint3D64f cvPoint3D64f( double x, double y, double z )
{
CvPoint3D64f p;
p.x = x;
p.y = y;
p.z = z;
CvPoint3D64f p = { x, y, z };
return p;
}
@@ -1009,10 +1169,23 @@ typedef struct CvSize
int width;
int height;
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvSize() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvSize(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 2);
width = 0; height = 0;
if (list.size() == 2)
{
width = list.begin()[0]; height = list.begin()[1];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvSize(int w = 0, int h = 0): width(w), height(h) {}
template<typename _Tp>
CvSize(const cv::Size_<_Tp>& sz): width(cv::saturate_cast<int>(sz.width)), height(cv::saturate_cast<int>(sz.height)) {}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); }
#endif
@@ -1022,23 +1195,48 @@ CvSize;
/** constructs CvSize structure. */
CV_INLINE CvSize cvSize( int width, int height )
{
CvSize s;
s.width = width;
s.height = height;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvSize s = { width, height };
#else
CvSize s(width, height);
#endif
return s;
}
#ifdef __cplusplus
CV_INLINE CvSize cvSize(const cv::Size& sz)
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvSize s = { sz.width, sz.height };
#else
CvSize s(sz.width, sz.height);
#endif
return s;
}
#endif
typedef struct CvSize2D32f
{
float width;
float height;
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvSize2D32f() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvSize2D32f(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 2);
width = 0; height = 0;
if (list.size() == 2)
{
width = list.begin()[0]; height = list.begin()[1];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvSize2D32f(float w = 0, float h = 0): width(w), height(h) {}
template<typename _Tp>
CvSize2D32f(const cv::Size_<_Tp>& sz): width(cv::saturate_cast<float>(sz.width)), height(cv::saturate_cast<float>(sz.height)) {}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); }
#endif
@@ -1048,13 +1246,25 @@ CvSize2D32f;
/** constructs CvSize2D32f structure. */
CV_INLINE CvSize2D32f cvSize2D32f( double width, double height )
{
CvSize2D32f s;
s.width = (float)width;
s.height = (float)height;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvSize2D32f s = { (float)width, (float)height };
#else
CvSize2D32f s((float)width, (float)height);
#endif
return s;
}
#ifdef __cplusplus
template<typename _Tp>
CvSize2D32f cvSize2D32f(const cv::Size_<_Tp>& sz)
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvSize2D32f s = { (float)sz.width, (float)sz.height };
#else
CvSize2D32f s((float)sz.width, (float)sz.height);
#endif
return s;
}
#endif
/** @sa RotatedRect
*/
@@ -1065,15 +1275,37 @@ typedef struct CvBox2D
float angle; /**< Angle between the horizontal axis */
/**< and the first side (i.e. length) in degrees */
#ifdef __cplusplus
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0) : center(c), size(s), angle(a) {}
CvBox2D(const cv::RotatedRect& rr) : center(rr.center), size(rr.size), angle(rr.angle) {}
#endif
#ifdef __cplusplus
operator cv::RotatedRect() const { return cv::RotatedRect(center, size, angle); }
#endif
}
CvBox2D;
#ifdef __cplusplus
CV_INLINE CvBox2D cvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0)
{
CvBox2D self;
self.center = c;
self.size = s;
self.angle = a;
return self;
}
CV_INLINE CvBox2D cvBox2D(const cv::RotatedRect& rr)
{
CvBox2D self;
self.center = cvPoint2D32f(rr.center);
self.size = cvSize2D32f(rr.size);
self.angle = rr.angle;
return self;
}
#endif
/** Line iterator state: */
typedef struct CvLineIterator
{
@@ -1099,7 +1331,19 @@ typedef struct CvSlice
{
int start_index, end_index;
#if defined(__cplusplus) && !defined(__CUDACC__)
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvSlice() __attribute__(( warning("Non-initialized variable") )) {}
template<typename _Tp> CvSlice(const std::initializer_list<_Tp> list)
{
CV_Assert(list.size() == 0 || list.size() == 2);
start_index = end_index = 0;
if (list.size() == 2)
{
start_index = list.begin()[0]; end_index = list.begin()[1];
}
};
#endif
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) && !defined(__CUDACC__)
CvSlice(int start = 0, int end = 0) : start_index(start), end_index(end) {}
CvSlice(const cv::Range& r) { *this = (r.start != INT_MIN && r.end != INT_MAX) ? CvSlice(r.start, r.end) : CvSlice(0, CV_WHOLE_SEQ_END_INDEX); }
operator cv::Range() const { return (start_index == 0 && end_index == CV_WHOLE_SEQ_END_INDEX ) ? cv::Range::all() : cv::Range(start_index, end_index); }
@@ -1109,13 +1353,21 @@ CvSlice;
CV_INLINE CvSlice cvSlice( int start, int end )
{
CvSlice slice;
slice.start_index = start;
slice.end_index = end;
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus) && !defined(__CUDACC__))
CvSlice slice = { start, end };
#else
CvSlice slice(start, end);
#endif
return slice;
}
#if defined(__cplusplus)
CV_INLINE CvSlice cvSlice(const cv::Range& r)
{
CvSlice slice = (r.start != INT_MIN && r.end != INT_MAX) ? cvSlice(r.start, r.end) : cvSlice(0, CV_WHOLE_SEQ_END_INDEX);
return slice;
}
#endif
/************************************* CvScalar *****************************************/
@@ -1125,13 +1377,22 @@ typedef struct CvScalar
{
double val[4];
#ifdef __cplusplus
#ifdef CV__VALIDATE_UNUNITIALIZED_VARS
CvScalar() __attribute__(( warning("Non-initialized variable") )) {}
CvScalar(const std::initializer_list<double> list)
{
CV_Assert(list.size() == 0 || list.size() == 4);
val[0] = val[1] = val[2] = val[3] = 0;
if (list.size() == 4)
{
val[0] = list.begin()[0]; val[1] = list.begin()[1]; val[2] = list.begin()[2]; val[3] = list.begin()[3];
}
};
#elif defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvScalar() {}
CvScalar(double d0, double d1 = 0, double d2 = 0, double d3 = 0) { val[0] = d0; val[1] = d1; val[2] = d2; val[3] = d3; }
template<typename _Tp>
CvScalar(const cv::Scalar_<_Tp>& s) { val[0] = s.val[0]; val[1] = s.val[1]; val[2] = s.val[2]; val[3] = s.val[3]; }
template<typename _Tp>
operator cv::Scalar_<_Tp>() const { return cv::Scalar_<_Tp>(cv::saturate_cast<_Tp>(val[0]), cv::saturate_cast<_Tp>(val[1]), cv::saturate_cast<_Tp>(val[2]), cv::saturate_cast<_Tp>(val[3])); }
template<typename _Tp, int cn>
CvScalar(const cv::Vec<_Tp, cn>& v)
{
@@ -1140,22 +1401,59 @@ typedef struct CvScalar
for( ; i < 4; i++ ) val[i] = 0;
}
#endif
#ifdef __cplusplus
template<typename _Tp>
operator cv::Scalar_<_Tp>() const { return cv::Scalar_<_Tp>(cv::saturate_cast<_Tp>(val[0]), cv::saturate_cast<_Tp>(val[1]), cv::saturate_cast<_Tp>(val[2]), cv::saturate_cast<_Tp>(val[3])); }
#endif
}
CvScalar;
CV_INLINE CvScalar cvScalar( double val0, double val1 CV_DEFAULT(0),
double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvScalar scalar = CV_STRUCT_INITIALIZER;
#else
CvScalar scalar;
#endif
scalar.val[0] = val0; scalar.val[1] = val1;
scalar.val[2] = val2; scalar.val[3] = val3;
return scalar;
}
#ifdef __cplusplus
CV_INLINE CvScalar cvScalar()
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvScalar scalar = CV_STRUCT_INITIALIZER;
#else
CvScalar scalar;
#endif
scalar.val[0] = scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
return scalar;
}
CV_INLINE CvScalar cvScalar(const cv::Scalar& s)
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvScalar scalar = CV_STRUCT_INITIALIZER;
#else
CvScalar scalar;
#endif
scalar.val[0] = s.val[0];
scalar.val[1] = s.val[1];
scalar.val[2] = s.val[2];
scalar.val[3] = s.val[3];
return scalar;
}
#endif
CV_INLINE CvScalar cvRealScalar( double val0 )
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvScalar scalar = CV_STRUCT_INITIALIZER;
#else
CvScalar scalar;
#endif
scalar.val[0] = val0;
scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
return scalar;
@@ -1163,7 +1461,11 @@ CV_INLINE CvScalar cvRealScalar( double val0 )
CV_INLINE CvScalar cvScalarAll( double val0123 )
{
#if !(defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus))
CvScalar scalar = CV_STRUCT_INITIALIZER;
#else
CvScalar scalar;
#endif
scalar.val[0] = val0123;
scalar.val[1] = val0123;
scalar.val[2] = val0123;
@@ -1216,7 +1518,7 @@ typedef struct CvSeqBlock
{
struct CvSeqBlock* prev; /**< Previous sequence block. */
struct CvSeqBlock* next; /**< Next sequence block. */
int start_index; /**< Index of the first element in the block + */
int start_index; /**< Index of the first element in the block + */
/**< sequence->first->start_index. */
int count; /**< Number of elements in the block. */
schar* data; /**< Pointer to the first element of the block. */
@@ -1361,7 +1663,7 @@ CvGraph;
/** @} */
/*********************************** Chain/Countour *************************************/
/*********************************** Chain/Contour *************************************/
typedef struct CvChain
{
@@ -1669,6 +1971,9 @@ typedef struct CvFileStorage CvFileStorage;
#define CV_STORAGE_FORMAT_AUTO 0
#define CV_STORAGE_FORMAT_XML 8
#define CV_STORAGE_FORMAT_YAML 16
#define CV_STORAGE_FORMAT_JSON 24
#define CV_STORAGE_BASE64 64
#define CV_STORAGE_WRITE_BASE64 (CV_STORAGE_BASE64 | CV_STORAGE_WRITE)
/** @brief List of attributes. :
@@ -1738,7 +2043,7 @@ typedef struct CvString
}
CvString;
/** All the keys (names) of elements in the readed file storage
/** All the keys (names) of elements in the read file storage
are stored in the hash to speed up the lookup operations: */
typedef struct CvStringHashNode
{
@@ -1829,6 +2134,6 @@ CvModuleInfo;
/** @} */
#endif /*__OPENCV_CORE_TYPES_H__*/
#endif /*OPENCV_CORE_TYPES_H*/
/* End of file. */
+584 -115
View File
@@ -42,14 +42,23 @@
//
//M*/
#ifndef __OPENCV_CORE_UTILITY_H__
#define __OPENCV_CORE_UTILITY_H__
#ifndef OPENCV_CORE_UTILITY_H
#define OPENCV_CORE_UTILITY_H
#ifndef __cplusplus
# error utility.hpp header must be compiled as C++
#endif
#if defined(check)
# warning Detected Apple 'check' macro definition, it can cause build conflicts. Please, include this header before any Apple headers.
#endif
#include "opencv2/core.hpp"
#include <ostream>
#ifdef CV_CXX11
#include <functional>
#endif
namespace cv
{
@@ -57,8 +66,8 @@ namespace cv
#ifdef CV_COLLECT_IMPL_DATA
CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays
CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays
// Get stored implementation flags and fucntions names arrays
// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which fucntion
// Get stored implementation flags and functions names arrays
// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which function
CV_EXPORTS int getImpl(std::vector<int> &impl, std::vector<String> &funName);
CV_EXPORTS bool useCollection(); // return implementation collection state
@@ -98,7 +107,7 @@ CV_EXPORTS void setUseCollection(bool flag); // set implementation collection st
\code
void my_func(const cv::Mat& m)
{
cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
cv::AutoBuffer<float> buf(1000); // create automatic buffer containing 1000 floats
buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
// otherwise the buffer of "m.rows" floats will be allocated
@@ -115,7 +124,7 @@ public:
//! the default constructor
AutoBuffer();
//! constructor taking the real buffer size
AutoBuffer(size_t _size);
explicit AutoBuffer(size_t _size);
//! the copy constructor
AutoBuffer(const AutoBuffer<_Tp, fixed_size>& buf);
@@ -133,17 +142,29 @@ public:
void resize(size_t _size);
//! returns the current buffer size
size_t size() const;
//! returns pointer to the real buffer, stack-allocated or head-allocated
operator _Tp* ();
//! returns read-only pointer to the real buffer, stack-allocated or head-allocated
operator const _Tp* () const;
//! returns pointer to the real buffer, stack-allocated or heap-allocated
inline _Tp* data() { return ptr; }
//! returns read-only pointer to the real buffer, stack-allocated or heap-allocated
inline const _Tp* data() const { return ptr; }
#if !defined(OPENCV_DISABLE_DEPRECATED_COMPATIBILITY) // use to .data() calls instead
//! returns pointer to the real buffer, stack-allocated or heap-allocated
operator _Tp* () { return ptr; }
//! returns read-only pointer to the real buffer, stack-allocated or heap-allocated
operator const _Tp* () const { return ptr; }
#else
//! returns a reference to the element at specified location. No bounds checking is performed in Release builds.
inline _Tp& operator[] (size_t i) { CV_DbgCheckLT(i, sz, "out of range"); return ptr[i]; }
//! returns a reference to the element at specified location. No bounds checking is performed in Release builds.
inline const _Tp& operator[] (size_t i) const { CV_DbgCheckLT(i, sz, "out of range"); return ptr[i]; }
#endif
protected:
//! pointer to the real buffer, can point to buf if the buffer is small enough
_Tp* ptr;
//! size of the real buffer
size_t sz;
//! pre-allocated buffer. At least 1 element to confirm C++ standard reqirements
//! pre-allocated buffer. At least 1 element to confirm C++ standard requirements
_Tp buf[(fixed_size > 0) ? fixed_size : 1];
};
@@ -173,13 +194,6 @@ extern "C" typedef int (*ErrorCallback)( int status, const char* func_name,
*/
CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0);
/** @brief Returns a text string formatted using the printf-like expression.
The function acts like sprintf but forms and returns an STL string. It can be used to form an error
message in the Exception constructor.
@param fmt printf-compatible formatting specifiers.
*/
CV_EXPORTS String format( const char* fmt, ... );
CV_EXPORTS String tempfile( const char* suffix = 0);
CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
@@ -189,51 +203,53 @@ If threads == 0, OpenCV will disable threading optimizations and run all it's fu
sequentially. Passing threads \< 0 will reset threads number to system default. This function must
be called outside of parallel region.
OpenCV will try to run it's functions with specified threads number, but some behaviour differs from
OpenCV will try to run its functions with specified threads number, but some behaviour differs from
framework:
- `TBB` User-defined parallel constructions will run with the same threads number, if
another does not specified. If late on user creates own scheduler, OpenCV will be use it.
- `OpenMP` No special defined behaviour.
- `Concurrency` If threads == 1, OpenCV will disable threading optimizations and run it's
- `TBB` - User-defined parallel constructions will run with the same threads number, if
another is not specified. If later on user creates his own scheduler, OpenCV will use it.
- `OpenMP` - No special defined behaviour.
- `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run its
functions sequentially.
- `GCD` Supports only values \<= 0.
- `C=` No special defined behaviour.
- `GCD` - Supports only values \<= 0.
- `C=` - No special defined behaviour.
@param nthreads Number of threads used by OpenCV.
@sa getNumThreads, getThreadNum
*/
CV_EXPORTS void setNumThreads(int nthreads);
CV_EXPORTS_W void setNumThreads(int nthreads);
/** @brief Returns the number of threads used by OpenCV for parallel regions.
Always returns 1 if OpenCV is built without threading support.
The exact meaning of return value depends on the threading framework used by OpenCV library:
- `TBB` The number of threads, that OpenCV will try to use for parallel regions. If there is
- `TBB` - The number of threads, that OpenCV will try to use for parallel regions. If there is
any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns
default number of threads used by TBB library.
- `OpenMP` An upper bound on the number of threads that could be used to form a new team.
- `Concurrency` The number of threads, that OpenCV will try to use for parallel regions.
- `GCD` Unsupported; returns the GCD thread pool limit (512) for compatibility.
- `C=` The number of threads, that OpenCV will try to use for parallel regions, if before
- `OpenMP` - An upper bound on the number of threads that could be used to form a new team.
- `Concurrency` - The number of threads, that OpenCV will try to use for parallel regions.
- `GCD` - Unsupported; returns the GCD thread pool limit (512) for compatibility.
- `C=` - The number of threads, that OpenCV will try to use for parallel regions, if before
called setNumThreads with threads \> 0, otherwise returns the number of logical CPUs,
available for the process.
@sa setNumThreads, getThreadNum
*/
CV_EXPORTS int getNumThreads();
CV_EXPORTS_W int getNumThreads();
/** @brief Returns the index of the currently executed thread within the current parallel region. Always
returns 0 if called outside of parallel region.
The exact meaning of return value depends on the threading framework used by OpenCV library:
- `TBB` Unsupported with current 4.1 TBB release. May be will be supported in future.
- `OpenMP` The thread number, within the current team, of the calling thread.
- `Concurrency` An ID for the virtual processor that the current context is executing on (0
@deprecated Current implementation doesn't corresponding to this documentation.
The exact meaning of the return value depends on the threading framework used by OpenCV library:
- `TBB` - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
- `OpenMP` - The thread number, within the current team, of the calling thread.
- `Concurrency` - An ID for the virtual processor that the current context is executing on (0
for master thread and unique number for others, but not necessary 1,2,3,...).
- `GCD` System calling thread's ID. Never returns 0 inside parallel region.
- `C=` The index of the current parallel task.
- `GCD` - System calling thread's ID. Never returns 0 inside parallel region.
- `C=` - The index of the current parallel task.
@sa setNumThreads, getNumThreads
*/
CV_EXPORTS int getThreadNum();
CV_EXPORTS_W int getThreadNum();
/** @brief Returns full configuration time cmake output.
@@ -243,11 +259,29 @@ architecture.
*/
CV_EXPORTS_W const String& getBuildInformation();
/** @brief Returns library version string
For example "3.4.1-dev".
@sa getMajorVersion, getMinorVersion, getRevisionVersion
*/
CV_EXPORTS_W String getVersionString();
/** @brief Returns major library version */
CV_EXPORTS_W int getVersionMajor();
/** @brief Returns minor library version */
CV_EXPORTS_W int getVersionMinor();
/** @brief Returns revision field of the library version */
CV_EXPORTS_W int getVersionRevision();
/** @brief Returns the number of ticks.
The function returns the number of ticks after the certain event (for example, when the machine was
turned on). It can be used to initialize RNG or to measure a function execution time by reading the
tick count before and after the function call. See also the tick frequency.
tick count before and after the function call.
@sa getTickFrequency, TickMeter
*/
CV_EXPORTS_W int64 getTickCount();
@@ -260,9 +294,139 @@ execution time in seconds:
// do something ...
t = ((double)getTickCount() - t)/getTickFrequency();
@endcode
@sa getTickCount, TickMeter
*/
CV_EXPORTS_W double getTickFrequency();
/** @brief a Class to measure passing time.
The class computes passing time by counting the number of ticks per second. That is, the following code computes the
execution time in seconds:
@code
TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm.getTimeSec();
@endcode
It is also possible to compute the average time over multiple runs:
@code
TickMeter tm;
for (int i = 0; i < 100; i++)
{
tm.start();
// do something ...
tm.stop();
}
double average_time = tm.getTimeSec() / tm.getCounter();
std::cout << "Average time in second per iteration is: " << average_time << std::endl;
@endcode
@sa getTickCount, getTickFrequency
*/
class CV_EXPORTS_W TickMeter
{
public:
//! the default constructor
CV_WRAP TickMeter()
{
reset();
}
/**
starts counting ticks.
*/
CV_WRAP void start()
{
startTime = cv::getTickCount();
}
/**
stops counting ticks.
*/
CV_WRAP void stop()
{
int64 time = cv::getTickCount();
if (startTime == 0)
return;
++counter;
sumTime += (time - startTime);
startTime = 0;
}
/**
returns counted ticks.
*/
CV_WRAP int64 getTimeTicks() const
{
return sumTime;
}
/**
returns passed time in microseconds.
*/
CV_WRAP double getTimeMicro() const
{
return getTimeMilli()*1e3;
}
/**
returns passed time in milliseconds.
*/
CV_WRAP double getTimeMilli() const
{
return getTimeSec()*1e3;
}
/**
returns passed time in seconds.
*/
CV_WRAP double getTimeSec() const
{
return (double)getTimeTicks() / getTickFrequency();
}
/**
returns internal counter value.
*/
CV_WRAP int64 getCounter() const
{
return counter;
}
/**
resets internal values.
*/
CV_WRAP void reset()
{
startTime = 0;
sumTime = 0;
counter = 0;
}
private:
int64 counter;
int64 sumTime;
int64 startTime;
};
/** @brief output operator
@code
TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm;
@endcode
*/
static inline
std::ostream& operator << (std::ostream& out, const TickMeter& tm)
{
return out << tm.getTimeSec() << "sec";
}
/** @brief Returns the number of CPU ticks.
The function returns the current number of CPU ticks on some architectures (such as x86, x64,
@@ -277,37 +441,6 @@ execution time.
*/
CV_EXPORTS_W int64 getCPUTickCount();
/** @brief Available CPU features.
remember to keep this list identical to the one in cvdef.h
*/
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
};
/** @brief Returns true if the specified feature is supported by the host hardware.
The function returns true if the host hardware supports the specified feature. When user calls
@@ -318,6 +451,24 @@ in OpenCV.
*/
CV_EXPORTS_W bool checkHardwareSupport(int feature);
/** @brief Returns feature name by ID
Returns empty string if feature is not defined
*/
CV_EXPORTS_W String getHardwareFeatureName(int feature);
/** @brief Returns list of CPU features enabled during compilation.
Returned value is a string containing space separated list of CPU features with following markers:
- no markers - baseline features
- prefix `*` - features enabled in dispatcher
- suffix `?` - features enabled but not available in HW
Example: `SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?`
*/
CV_EXPORTS std::string getCPUFeaturesLine();
/** @brief Returns the number of logical CPUs available for the process.
*/
CV_EXPORTS_W int getNumberOfCPUs();
@@ -326,19 +477,20 @@ CV_EXPORTS_W int getNumberOfCPUs();
/** @brief Aligns a pointer to the specified number of bytes.
The function returns the aligned pointer of the same type as the input pointer:
\f[\texttt{(\_Tp*)(((size\_t)ptr + n-1) \& -n)}\f]
\f[\texttt{(_Tp*)(((size_t)ptr + n-1) & -n)}\f]
@param ptr Aligned pointer.
@param n Alignment size that must be a power of two.
*/
template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp))
{
CV_DbgAssert((n & (n - 1)) == 0); // n is a power of 2
return (_Tp*)(((size_t)ptr + n-1) & -n);
}
/** @brief Aligns a buffer size to the specified number of bytes.
The function returns the minimum number that is greater or equal to sz and is divisible by n :
\f[\texttt{(sz + n-1) \& -n}\f]
The function returns the minimum number that is greater than or equal to sz and is divisible by n :
\f[\texttt{(sz + n-1) & -n}\f]
@param sz Buffer size to align.
@param n Alignment size that must be a power of two.
*/
@@ -348,9 +500,43 @@ static inline size_t alignSize(size_t sz, int n)
return (sz + n-1) & -n;
}
/** @brief Integer division with result round up.
Use this function instead of `ceil((float)a / b)` expressions.
@sa alignSize
*/
static inline int divUp(int a, unsigned int b)
{
CV_DbgAssert(a >= 0);
return (a + b - 1) / b;
}
/** @overload */
static inline size_t divUp(size_t a, unsigned int b)
{
return (a + b - 1) / b;
}
/** @brief Round first value up to the nearest multiple of second value.
Use this function instead of `ceil((float)a / b) * b` expressions.
@sa divUp
*/
static inline int roundUp(int a, unsigned int b)
{
CV_DbgAssert(a >= 0);
return a + b - 1 - (a + b -1) % b;
}
/** @overload */
static inline size_t roundUp(size_t a, unsigned int b)
{
return a + b - 1 - (a + b - 1) % b;
}
/** @brief Enables or disables the optimized code.
The function can be used to dynamically turn on and off optimized code (code that uses SSE2, AVX,
The function can be used to dynamically turn on and off optimized dispatched code (code that uses SSE4.2, AVX/AVX2,
and other instructions on the platforms that support it). It sets a global flag that is further
checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only
safe to call the function on the very top level in your application where you can be sure that no
@@ -369,7 +555,7 @@ The function returns true if the optimized code is enabled. Otherwise, it return
*/
CV_EXPORTS_W bool useOptimized();
static inline size_t getElemSize(int type) { return CV_ELEM_SIZE(type); }
static inline size_t getElemSize(int type) { return (size_t)CV_ELEM_SIZE(type); }
/////////////////////////////// Parallel Primitives //////////////////////////////////
@@ -386,15 +572,37 @@ public:
*/
CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.);
#ifdef CV_CXX11
class ParallelLoopBodyLambdaWrapper : public ParallelLoopBody
{
private:
std::function<void(const Range&)> m_functor;
public:
ParallelLoopBodyLambdaWrapper(std::function<void(const Range&)> functor) :
m_functor(functor)
{ }
virtual void operator() (const cv::Range& range) const CV_OVERRIDE
{
m_functor(range);
}
};
inline void parallel_for_(const Range& range, std::function<void(const Range&)> functor, double nstripes=-1.)
{
parallel_for_(range, ParallelLoopBodyLambdaWrapper(functor), nstripes);
}
#endif
/////////////////////////////// forEach method of cv::Mat ////////////////////////////
template<typename _Tp, typename Functor> inline
void Mat::forEach_impl(const Functor& operation) {
if (false) {
operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
// If your compiler fail in this line.
operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(0));
// If your compiler fails in this line.
// Please check that your functor signature is
// (_Tp&, const int*) <- multidimential
// or (_Tp&, void*) <- in case of you don't need current idx.
// (_Tp&, const int*) <- multi-dimensional
// or (_Tp&, void*) <- in case you don't need current idx.
}
CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX);
@@ -404,11 +612,12 @@ void Mat::forEach_impl(const Functor& operation) {
{
public:
PixelOperationWrapper(Mat_<_Tp>* const frame, const Functor& _operation)
: mat(frame), op(_operation) {};
virtual ~PixelOperationWrapper(){};
: mat(frame), op(_operation) {}
virtual ~PixelOperationWrapper(){}
// ! Overloaded virtual operator
// convert range call to row call.
virtual void operator()(const Range &range) const {
virtual void operator()(const Range &range) const CV_OVERRIDE
{
const int DIMS = mat->dims;
const int COLS = mat->size[DIMS - 1];
if (DIMS <= 2) {
@@ -416,7 +625,7 @@ void Mat::forEach_impl(const Functor& operation) {
this->rowCall2(row, COLS);
}
} else {
std::vector<int> idx(COLS); /// idx is modified in this->rowCall
std::vector<int> idx(DIMS); /// idx is modified in this->rowCall
idx[DIMS - 2] = range.start - 1;
for (int line_num = range.start; line_num < range.end; ++line_num) {
@@ -434,7 +643,7 @@ void Mat::forEach_impl(const Functor& operation) {
this->rowCall(&idx[0], COLS, DIMS);
}
}
};
}
private:
Mat_<_Tp>* const mat;
const Functor op;
@@ -471,12 +680,12 @@ void Mat::forEach_impl(const Functor& operation) {
op(*pixel++, static_cast<const int*>(idx));
idx[1]++;
}
};
}
PixelOperationWrapper& operator=(const PixelOperationWrapper &) {
CV_Assert(false);
// We can not remove this implementation because Visual Studio warning C4822.
return *this;
};
}
};
parallel_for_(cv::Range(0, LINES), PixelOperationWrapper(reinterpret_cast<Mat_<_Tp>*>(this), operation));
@@ -513,30 +722,60 @@ private:
AutoLock& operator = (const AutoLock&);
};
// TLS interface
class CV_EXPORTS TLSDataContainer
{
private:
int key_;
protected:
TLSDataContainer();
virtual ~TLSDataContainer();
public:
virtual void* createDataInstance() const = 0;
virtual void deleteDataInstance(void* data) const = 0;
void gatherData(std::vector<void*> &data) const;
#if OPENCV_ABI_COMPATIBILITY > 300
void* getData() const;
void release();
private:
#else
void release();
public:
void* getData() const;
#endif
virtual void* createDataInstance() const = 0;
virtual void deleteDataInstance(void* pData) const = 0;
int key_;
public:
void cleanup(); //! Release created TLS data container objects. It is similar to release() call, but it keeps TLS container valid.
};
// Main TLS data class
template <typename T>
class TLSData : protected TLSDataContainer
{
public:
inline TLSData() {}
inline ~TLSData() {}
inline T* get() const { return (T*)getData(); }
inline TLSData() {}
inline ~TLSData() { release(); } // Release key and delete associated data
inline T* get() const { return (T*)getData(); } // Get data associated with key
inline T& getRef() const { T* ptr = (T*)getData(); CV_Assert(ptr); return *ptr; } // Get data associated with key
// Get data from all threads
inline void gather(std::vector<T*> &data) const
{
std::vector<void*> &dataVoid = reinterpret_cast<std::vector<void*>&>(data);
gatherData(dataVoid);
}
inline void cleanup() { TLSDataContainer::cleanup(); }
private:
virtual void* createDataInstance() const { return new T; }
virtual void deleteDataInstance(void* data) const { delete (T*)data; }
virtual void* createDataInstance() const CV_OVERRIDE {return new T;} // Wrapper to allocate data by template
virtual void deleteDataInstance(void* pData) const CV_OVERRIDE {delete (T*)pData;} // Wrapper to release data by template
// Disable TLS copy operations
TLSData(TLSData &) {}
TLSData& operator =(const TLSData &) {return *this;}
};
/** @brief Designed for command line parsing
@@ -572,7 +811,7 @@ The sample below demonstrates how to use CommandLineParser:
### Keys syntax
The keys parameter is a string containing several blocks, each one is enclosed in curley braces and
The keys parameter is a string containing several blocks, each one is enclosed in curly braces and
describes one argument. Each argument contains three parts separated by the `|` symbol:
-# argument names is a space-separated list of option synonyms (to mark argument as positional, prefix it with the `@` symbol)
@@ -585,7 +824,7 @@ For example:
const String keys =
"{help h usage ? | | print this message }"
"{@image1 | | image1 for compare }"
"{@image2 | | image2 for compare }"
"{@image2 |<none>| image2 for compare }"
"{@repeat |1 | number }"
"{path |. | path to file }"
"{fps | -1.0 | fps for output video }"
@@ -595,6 +834,13 @@ For example:
}
@endcode
Note that there are no default values for `help` and `timestamp` so we can check their presence using the `has()` method.
Arguments with default values are considered to be always present. Use the `get()` method in these cases to check their
actual value instead.
String keys like `get<String>("@image1")` return the empty string `""` by default - even with an empty default value.
Use the special `<none>` default value to enforce that the returned string must not be empty. (like in `get<String>("@image2")`)
### Usage
For the described keys:
@@ -606,7 +852,7 @@ For the described keys:
# Bad call
$ ./app -fps=aaa
ERRORS:
Exception: can not convert: [aaa] to [double]
Parameter 'fps': can not convert: [aaa] to [double]
@endcode
*/
class CV_EXPORTS CommandLineParser
@@ -636,7 +882,7 @@ public:
This method returns the path to the executable from the command line (`argv[0]`).
For example, if the application has been started with such command:
For example, if the application has been started with such a command:
@code{.sh}
$ ./bin/my-executable
@endcode
@@ -723,7 +969,7 @@ public:
/** @brief Check for parsing errors
Returns true if error occured while accessing the parameters (bad conversion, missing arguments,
Returns false if error occurred while accessing the parameters (bad conversion, missing arguments,
etc.). Call @ref printErrors to print error messages list.
*/
bool check() const;
@@ -742,7 +988,7 @@ public:
*/
void printMessage() const;
/** @brief Print list of errors occured
/** @brief Print list of errors occurred
@sa check
*/
@@ -813,10 +1059,10 @@ AutoBuffer<_Tp, fixed_size>::allocate(size_t _size)
return;
}
deallocate();
sz = _size;
if(_size > fixed_size)
{
ptr = new _Tp[_size];
sz = _size;
}
}
@@ -859,15 +1105,6 @@ template<typename _Tp, size_t fixed_size> inline size_t
AutoBuffer<_Tp, fixed_size>::size() const
{ return sz; }
template<typename _Tp, size_t fixed_size> inline
AutoBuffer<_Tp, fixed_size>::operator _Tp* ()
{ return ptr; }
template<typename _Tp, size_t fixed_size> inline
AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
{ return ptr; }
#ifndef OPENCV_NOSTL
template<> inline std::string CommandLineParser::get<std::string>(int index, bool space_delete) const
{
return get<String>(index, space_delete);
@@ -876,14 +1113,246 @@ template<> inline std::string CommandLineParser::get<std::string>(const String&
{
return get<String>(name, space_delete);
}
#endif // OPENCV_NOSTL
//! @endcond
// Basic Node class for tree building
template<class OBJECT>
class CV_EXPORTS Node
{
public:
Node()
{
m_pParent = 0;
}
Node(OBJECT& payload) : m_payload(payload)
{
m_pParent = 0;
}
~Node()
{
removeChilds();
if (m_pParent)
{
int idx = m_pParent->findChild(this);
if (idx >= 0)
m_pParent->m_childs.erase(m_pParent->m_childs.begin() + idx);
}
}
Node<OBJECT>* findChild(OBJECT& payload) const
{
for(size_t i = 0; i < this->m_childs.size(); i++)
{
if(this->m_childs[i]->m_payload == payload)
return this->m_childs[i];
}
return NULL;
}
int findChild(Node<OBJECT> *pNode) const
{
for (size_t i = 0; i < this->m_childs.size(); i++)
{
if(this->m_childs[i] == pNode)
return (int)i;
}
return -1;
}
void addChild(Node<OBJECT> *pNode)
{
if(!pNode)
return;
CV_Assert(pNode->m_pParent == 0);
pNode->m_pParent = this;
this->m_childs.push_back(pNode);
}
void removeChilds()
{
for(size_t i = 0; i < m_childs.size(); i++)
{
m_childs[i]->m_pParent = 0; // avoid excessive parent vector trimming
delete m_childs[i];
}
m_childs.clear();
}
int getDepth()
{
int count = 0;
Node *pParent = m_pParent;
while(pParent) count++, pParent = pParent->m_pParent;
return count;
}
public:
OBJECT m_payload;
Node<OBJECT>* m_pParent;
std::vector<Node<OBJECT>*> m_childs;
};
// Instrumentation external interface
namespace instr
{
#if !defined OPENCV_ABI_CHECK
enum TYPE
{
TYPE_GENERAL = 0, // OpenCV API function, e.g. exported function
TYPE_MARKER, // Information marker
TYPE_WRAPPER, // Wrapper function for implementation
TYPE_FUN, // Simple function call
};
enum IMPL
{
IMPL_PLAIN = 0,
IMPL_IPP,
IMPL_OPENCL,
};
struct NodeDataTls
{
NodeDataTls()
{
m_ticksTotal = 0;
}
uint64 m_ticksTotal;
};
class CV_EXPORTS NodeData
{
public:
NodeData(const char* funName = 0, const char* fileName = NULL, int lineNum = 0, void* retAddress = NULL, bool alwaysExpand = false, cv::instr::TYPE instrType = TYPE_GENERAL, cv::instr::IMPL implType = IMPL_PLAIN);
NodeData(NodeData &ref);
~NodeData();
NodeData& operator=(const NodeData&);
cv::String m_funName;
cv::instr::TYPE m_instrType;
cv::instr::IMPL m_implType;
const char* m_fileName;
int m_lineNum;
void* m_retAddress;
bool m_alwaysExpand;
bool m_funError;
volatile int m_counter;
volatile uint64 m_ticksTotal;
TLSData<NodeDataTls> m_tls;
int m_threads;
// No synchronization
double getTotalMs() const { return ((double)m_ticksTotal / cv::getTickFrequency()) * 1000; }
double getMeanMs() const { return (((double)m_ticksTotal/m_counter) / cv::getTickFrequency()) * 1000; }
};
bool operator==(const NodeData& lhs, const NodeData& rhs);
typedef Node<NodeData> InstrNode;
CV_EXPORTS InstrNode* getTrace();
#endif // !defined OPENCV_ABI_CHECK
CV_EXPORTS bool useInstrumentation();
CV_EXPORTS void setUseInstrumentation(bool flag);
CV_EXPORTS void resetTrace();
enum FLAGS
{
FLAGS_NONE = 0,
FLAGS_MAPPING = 0x01,
FLAGS_EXPAND_SAME_NAMES = 0x02,
};
CV_EXPORTS void setFlags(FLAGS modeFlags);
static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); }
CV_EXPORTS FLAGS getFlags();
} // namespace instr
namespace samples {
//! @addtogroup core_utils_samples
// This section describes utility functions for OpenCV samples.
//
// @note Implementation of these utilities is not thread-safe.
//
//! @{
/** @brief Try to find requested data file
Search directories:
1. Directories passed via `addSamplesDataSearchPath()`
2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
3. OPENCV_SAMPLES_DATA_PATH environment variable
If parameter value is not empty and nothing is found then stop searching.
4. Detects build/install path based on:
a. current working directory (CWD)
b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
5. Scan `<source>/{,data,samples/data}` directories if build directory is detected or the current directory is in source tree.
6. Scan `<install>/share/OpenCV` directory if install directory is detected.
@see cv::utils::findDataFile
@param relative_path Relative path to data file
@param required Specify "file not found" handling.
If true, function prints information message and raises cv::Exception.
If false, function returns empty result
@param silentMode Disables messages
@return Returns path (absolute or relative to the current directory) or empty string if file is not found
*/
CV_EXPORTS_W cv::String findFile(const cv::String& relative_path, bool required = true, bool silentMode = false);
CV_EXPORTS_W cv::String findFileOrKeep(const cv::String& relative_path, bool silentMode = false);
inline cv::String findFileOrKeep(const cv::String& relative_path, bool silentMode)
{
cv::String res = findFile(relative_path, false, silentMode);
if (res.empty())
return relative_path;
return res;
}
/** @brief Override search data path by adding new search location
Use this only to override default behavior
Passed paths are used in LIFO order.
@param path Path to used samples data
*/
CV_EXPORTS_W void addSamplesDataSearchPath(const cv::String& path);
/** @brief Append samples search data sub directory
General usage is to add OpenCV modules name (`<opencv_contrib>/modules/<name>/samples/data` -> `<name>/samples/data` + `modules/<name>/samples/data`).
Passed subdirectories are used in LIFO order.
@param subdir samples data sub directory
*/
CV_EXPORTS_W void addSamplesDataSearchSubDirectory(const cv::String& subdir);
//! @}
} // namespace samples
namespace utils {
CV_EXPORTS int getThreadID();
} // namespace
} //namespace cv
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/core/core_c.h"
#endif
#endif //__OPENCV_CORE_UTILITY_H__
#endif //OPENCV_CORE_UTILITY_H

Some files were not shown because too many files have changed in this diff Show More