mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -167,6 +167,15 @@ void Mat::convertTo(OutputArray dst, int type_, double alpha, double beta) const
|
||||
dst.create( dims, size, dtype, -1, allowTransposed );
|
||||
Mat dstMat = dst.getMat();
|
||||
|
||||
if( dims <= 2 )
|
||||
{
|
||||
CALL_HAL(convertScale, cv_hal_convertScale, src.data, src.step, dstMat.data, dstMat.step, src.cols * cn, src.rows, sdepth, ddepth, alpha, beta);
|
||||
}
|
||||
else if( src.isContinuous() && dstMat.isContinuous() )
|
||||
{
|
||||
CALL_HAL(convertScale, cv_hal_convertScale, src.data, 0, dstMat.data, 0, (int)src.total() * cn, 1, sdepth, ddepth, alpha, beta);
|
||||
}
|
||||
|
||||
BinaryFunc func = noScale ? getConvertFunc(sdepth, ddepth) : getConvertScaleFunc(sdepth, ddepth);
|
||||
double scale[] = {alpha, beta};
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
@@ -214,7 +214,7 @@ inline int hal_ni_absDiffScalar8u8u (const uchar* src_data, size_t src_step, uc
|
||||
Bitwise AND: _dst[i] = src1[i] & src2[i]_ @n
|
||||
Bitwise OR: _dst[i] = src1[i] | src2[i]_ @n
|
||||
Bitwise XOR: _dst[i] = src1[i] ^ src2[i]_ @n
|
||||
Bitwise NOT: _dst[i] = !src[i]_
|
||||
Bitwise NOT: _dst[i] = ~src[i]_
|
||||
@param src1_data first source image data
|
||||
@param src1_step first source image step
|
||||
@param src2_data second source image data
|
||||
@@ -313,7 +313,7 @@ For 8s input type 128 is added to LUT index
|
||||
Destination should have the same element type and number of channels as lookup table elements
|
||||
@param src_data Source image data
|
||||
@param src_step Source image step
|
||||
@param src_type Sorce image type
|
||||
@param src_type Source image type
|
||||
@param lut_data Pointer to lookup table
|
||||
@param lut_channel_size Size of each channel in bytes
|
||||
@param lut_channels Number of channels in lookup table
|
||||
@@ -357,9 +357,69 @@ Hamming distance between two vectors
|
||||
inline int hal_ni_normHammingDiff8u(const uchar* a, const uchar* b, int n, int cellSize, int* result) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
//! @}
|
||||
|
||||
/**
|
||||
@brief Generic norm of an array.
|
||||
@param src Source image
|
||||
@param src_step Source image
|
||||
@param mask Specified array region.
|
||||
@param mask_step Mask array step.
|
||||
@param width Source image dimensions
|
||||
@param height Source image dimensions
|
||||
@param type Element type of source image
|
||||
@param norm_type Type of the norm
|
||||
@param result Pointer to result output
|
||||
*/
|
||||
//! @addtogroup core_hal_interface_norm Absolute norm
|
||||
//! @{
|
||||
inline int hal_ni_norm(const uchar* src, size_t src_step, const uchar* mask, size_t mask_step, int width,
|
||||
int height, int type, int norm_type, double* result) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
//! @}
|
||||
|
||||
/**
|
||||
@brief Generic norm between two arrays.
|
||||
@param src1 First source image
|
||||
@param src1_step First source image
|
||||
@param src2 Second source image
|
||||
@param src2_step Second source image
|
||||
@param mask Specified array region.
|
||||
@param mask_step Mask array step.
|
||||
@param width Source image dimensions
|
||||
@param height Source image dimensions
|
||||
@param type Element type of source image
|
||||
@param norm_type Type of the norm
|
||||
@param result Pointer to result output
|
||||
*/
|
||||
//! @addtogroup core_hal_interface_norm Absolute norm
|
||||
//! @{
|
||||
inline int hal_ni_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, size_t src2_step, const uchar* mask,
|
||||
size_t mask_step, int width, int height, int type, int norm_type, double* result) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
//! @}
|
||||
|
||||
/**
|
||||
@brief Convert array to another with specified type.
|
||||
@param src Source image
|
||||
@param src_step Source image
|
||||
@param dst Destination image
|
||||
@param dst_step Destination image
|
||||
@param width Source image dimensions
|
||||
@param height Source image dimensions
|
||||
@param sdepth Depth of source image
|
||||
@param ddepth Depth of destination image
|
||||
@param alpha Scale value
|
||||
@param beta Shift value
|
||||
*/
|
||||
//! @addtogroup core_hal_interface_convert Array convert
|
||||
//! @{
|
||||
inline int hal_ni_convertScale(const uchar* src, size_t src_step, uchar* dst, size_t dst_step, int width, int height,
|
||||
int sdepth, int ddepth, double alpha, double beta) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
//! @}
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_normHamming8u hal_ni_normHamming8u
|
||||
#define cv_hal_normHammingDiff8u hal_ni_normHammingDiff8u
|
||||
#define cv_hal_norm hal_ni_norm
|
||||
#define cv_hal_normDiff hal_ni_normDiff
|
||||
#define cv_hal_convertScale hal_ni_convertScale
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@@ -464,7 +524,7 @@ inline int hal_ni_div16bf(const cv_hal_bf16 *src1_data, size_t src1_step, const
|
||||
//! @}
|
||||
|
||||
/**
|
||||
Computes reciprocial: _dst[i] = scale / src[i]_
|
||||
Computes reciprocal: _dst[i] = scale / src[i]_
|
||||
@param src_data source image data
|
||||
@param src_step source image step
|
||||
@param dst_data destination image data
|
||||
@@ -473,7 +533,7 @@ Computes reciprocial: _dst[i] = scale / src[i]_
|
||||
@param height height of the images
|
||||
@param scale additional multiplier
|
||||
*/
|
||||
//! @addtogroup core_hal_interface_reciprocial Element-wise reciprocial
|
||||
//! @addtogroup core_hal_interface_reciprocal Element-wise reciprocal
|
||||
//! @{
|
||||
inline int hal_ni_recip8u(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step, int width, int height, double scale) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
inline int hal_ni_recip8s(const schar *src_data, size_t src_step, schar *dst_data, size_t dst_step, int width, int height, double scale) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
@@ -864,14 +924,14 @@ inline int hal_ni_dctFree2D(cvhalDFT *context) { return CV_HAL_ERROR_NOT_IMPLEME
|
||||
Performs \f$LU\f$ decomposition of square matrix \f$A=P*L*U\f$ (where \f$P\f$ is permutation matrix) and solves matrix equation \f$A*X=B\f$.
|
||||
Function returns the \f$sign\f$ of permutation \f$P\f$ via parameter info.
|
||||
@param src1 pointer to input matrix \f$A\f$ stored in row major order. After finish of work src1 contains at least \f$U\f$ part of \f$LU\f$
|
||||
decomposition which is appropriate for determainant calculation: \f$det(A)=sign*\prod_{j=1}^{M}a_{jj}\f$.
|
||||
decomposition which is appropriate for determinant calculation: \f$det(A)=sign*\prod_{j=1}^{M}a_{jj}\f$.
|
||||
@param src1_step number of bytes between two consequent rows of matrix \f$A\f$.
|
||||
@param m size of square matrix \f$A\f$.
|
||||
@param src2 pointer to \f$M\times N\f$ matrix \f$B\f$ which is the right-hand side of system \f$A*X=B\f$. \f$B\f$ stored in row major order.
|
||||
If src2 is null pointer only \f$LU\f$ decomposition will be performed. After finish of work src2 contains solution \f$X\f$ of system \f$A*X=B\f$.
|
||||
@param src2_step number of bytes between two consequent rows of matrix \f$B\f$.
|
||||
@param n number of right-hand vectors in \f$M\times N\f$ matrix \f$B\f$.
|
||||
@param info indicates success of decomposition. If *info is equals to zero decomposition failed, othervise *info is equals to \f$sign\f$.
|
||||
@param info indicates success of decomposition. If *info is equals to zero decomposition failed, otherwise *info is equals to \f$sign\f$.
|
||||
*/
|
||||
//! @addtogroup core_hal_interface_decomp_lu LU matrix decomposition
|
||||
//! @{
|
||||
@@ -1011,8 +1071,26 @@ inline int hal_ni_gemm64fc(const double* src1, size_t src1_step, const double* s
|
||||
inline int hal_ni_minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal,
|
||||
int* minIdx, int* maxIdx, uchar* mask) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
/**
|
||||
@brief Finds the global minimum and maximum in an array.
|
||||
@param src_data Source image
|
||||
@param src_step Source image
|
||||
@param width Source image dimensions
|
||||
@param height Source image dimensions
|
||||
@param depth Depth of source image
|
||||
@param minVal Pointer to the returned global minimum and maximum in an array.
|
||||
@param maxVal Pointer to the returned global minimum and maximum in an array.
|
||||
@param minIdx Pointer to the returned minimum and maximum location.
|
||||
@param maxIdx Pointer to the returned minimum and maximum location.
|
||||
@param mask Specified array region.
|
||||
@param mask_step Mask array step.
|
||||
*/
|
||||
inline int hal_ni_minMaxIdxMaskStep(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal,
|
||||
int* minIdx, int* maxIdx, uchar* mask, size_t mask_step) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_minMaxIdx hal_ni_minMaxIdx
|
||||
#define cv_hal_minMaxIdxMaskStep hal_ni_minMaxIdxMaskStep
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@@ -1126,26 +1204,23 @@ inline int hal_ni_transpose2d(const uchar* src_data, size_t src_step, uchar* dst
|
||||
#include "custom_hal.hpp"
|
||||
|
||||
//! @cond IGNORED
|
||||
#define CALL_HAL_RET(name, fun, retval, ...) \
|
||||
|
||||
#define CALL_HAL_RET2(name, fun, retval, ...) \
|
||||
{ \
|
||||
int res = __CV_EXPAND(fun(__VA_ARGS__, &retval)); \
|
||||
int res = __CV_EXPAND(fun(__VA_ARGS__)); \
|
||||
if (res == CV_HAL_ERROR_OK) \
|
||||
return retval; \
|
||||
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
|
||||
CV_Error_(cv::Error::StsInternal, \
|
||||
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res)); \
|
||||
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res)); \
|
||||
}
|
||||
|
||||
#define CALL_HAL_RET(name, fun, retval, ...) \
|
||||
CALL_HAL_RET2(name, fun, retval, __VA_ARGS__, &retval)
|
||||
|
||||
#define CALL_HAL(name, fun, ...) \
|
||||
{ \
|
||||
int res = __CV_EXPAND(fun(__VA_ARGS__)); \
|
||||
if (res == CV_HAL_ERROR_OK) \
|
||||
return; \
|
||||
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
|
||||
CV_Error_(cv::Error::StsInternal, \
|
||||
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res)); \
|
||||
}
|
||||
CALL_HAL_RET2(name, fun, ,__VA_ARGS__)
|
||||
|
||||
//! @endcond
|
||||
|
||||
#endif
|
||||
|
||||
@@ -363,7 +363,6 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
_dst.createSameSize(_src, CV_MAKETYPE(_lut.depth(), cn));
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
|
||||
CALL_HAL(LUT, cv_hal_lut, src.data, src.step, src.type(), lut.data,
|
||||
lut.elemSize1(), lutcn, dst.data, dst.step, src.cols, src.rows);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ void cv::hconcat(InputArray _src, OutputArray dst)
|
||||
|
||||
std::vector<Mat> src;
|
||||
_src.getMatVector(src);
|
||||
hconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
|
||||
hconcat(!src.empty() ? &src[0] : nullptr, src.size(), dst);
|
||||
}
|
||||
|
||||
void cv::vconcat(const Mat* src, size_t nsrc, OutputArray _dst)
|
||||
@@ -137,7 +137,7 @@ void cv::vconcat(InputArray _src, OutputArray dst)
|
||||
|
||||
std::vector<Mat> src;
|
||||
_src.getMatVector(src);
|
||||
vconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
|
||||
vconcat(!src.empty() ? &src[0] : nullptr, src.size(), dst);
|
||||
}
|
||||
|
||||
//////////////////////////////////////// set identity ////////////////////////////////////////////
|
||||
@@ -175,7 +175,7 @@ static bool ocl_setIdentity( InputOutputArray _m, const Scalar& s )
|
||||
ocl::KernelArg::Constant(Mat(1, 1, sctype, s)));
|
||||
|
||||
size_t globalsize[2] = { (size_t)m.cols * cn / kercn, ((size_t)m.rows + rowsPerWI - 1) / rowsPerWI };
|
||||
return k.run(2, globalsize, NULL, false);
|
||||
return k.run(2, globalsize, nullptr, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -216,8 +216,9 @@ void cv::setIdentity( InputOutputArray _m, const Scalar& s )
|
||||
|
||||
for( int i = 0; i < rows; i++, data += step )
|
||||
{
|
||||
for( int j = 0; j < cols; j++ )
|
||||
data[j] = j == i ? val : 0;
|
||||
std::fill(data, data + cols, 0.0);
|
||||
if (i < cols)
|
||||
data[i] = val;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -129,13 +129,29 @@ Scalar mean(InputArray _src, InputArray _mask)
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8U || mask.type() == CV_8S || mask.type() == CV_Bool);
|
||||
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
Scalar s;
|
||||
Scalar s = Scalar::all(0.0);
|
||||
|
||||
CV_Assert( cn <= 4 );
|
||||
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_mean(src, mask, s), s)
|
||||
|
||||
if (src.isContinuous() && mask.isContinuous())
|
||||
{
|
||||
CALL_HAL_RET2(meanStdDev, cv_hal_meanStdDev, s, src.data, 0, (int)src.total(), 1, src.type(),
|
||||
&s[0], nullptr /*stddev*/, mask.data, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (src.dims <= 2)
|
||||
{
|
||||
CALL_HAL_RET2(meanStdDev, cv_hal_meanStdDev, s, src.data, src.step, src.cols, src.rows, src.type(),
|
||||
&s[0], nullptr, mask.data, mask.step);
|
||||
}
|
||||
}
|
||||
|
||||
SumFunc func = getSumFunc(depth);
|
||||
|
||||
CV_Assert( cn <= 4 && func != 0 );
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
const Mat* arrays[] = {&src, &mask, 0};
|
||||
uchar* ptrs[2] = {};
|
||||
@@ -318,7 +334,6 @@ static bool ocl_meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
static bool ipp_meanStdDev(Mat& src, OutputArray _mean, OutputArray _sdv, Mat& mask)
|
||||
{
|
||||
@@ -532,7 +547,8 @@ void meanStdDev(InputArray _src, OutputArray _mean, OutputArray _sdv, InputArray
|
||||
uchar* ptrs[2] = {};
|
||||
NAryMatIterator it(arrays, ptrs);
|
||||
int total = (int)it.size, blockSize = total, partialBlockSize = 0;
|
||||
int j, count = 0, nz0 = 0;
|
||||
int j;
|
||||
int64_t count = 0, nz0 = 0;
|
||||
double _buf[CV_CN_MAX*4];
|
||||
double *s = _buf, *sq = s + cn;
|
||||
int *sbuf = (int*)s, *sqbuf = (int*)sq;
|
||||
|
||||
@@ -314,10 +314,18 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
||||
|
||||
if (src.dims <= 2)
|
||||
{
|
||||
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
|
||||
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
|
||||
if ((size_t)src.step == (size_t)mask.step)
|
||||
{
|
||||
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
|
||||
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows,
|
||||
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
|
||||
}
|
||||
}
|
||||
else if (src.isContinuous())
|
||||
else if (src.isContinuous() && mask.isContinuous())
|
||||
{
|
||||
int res = cv_hal_minMaxIdx(src.data, 0, (int)src.total()*cn, 1, src.depth(),
|
||||
minVal, maxVal, minIdx, maxIdx, mask.data);
|
||||
|
||||
+53
-11
@@ -756,7 +756,10 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result)
|
||||
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L1_16s_C1R :
|
||||
0) :
|
||||
normType == NORM_L2 || normType == NORM_L2SQR ?
|
||||
(type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R :
|
||||
#endif
|
||||
type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R :
|
||||
type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C1R :
|
||||
0) : 0;
|
||||
@@ -800,9 +803,20 @@ double norm( InputArray _src, int normType, InputArray _mask )
|
||||
#endif
|
||||
|
||||
Mat src = _src.getMat(), mask = _mask.getMat();
|
||||
int depth = src.depth(), cn = src.channels();
|
||||
if( src.dims <= 2 )
|
||||
{
|
||||
double result;
|
||||
CALL_HAL_RET(norm, cv_hal_norm, result, src.data, src.step, mask.data, mask.step, src.cols, src.rows, src.type(), normType);
|
||||
}
|
||||
else if( src.isContinuous() && mask.isContinuous() )
|
||||
{
|
||||
double result;
|
||||
CALL_HAL_RET(norm, cv_hal_norm, result, src.data, 0, mask.data, 0, (int)src.total(), 1, src.type(), normType);
|
||||
}
|
||||
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_norm(src, normType, mask, _result), _result);
|
||||
|
||||
int depth = src.depth(), cn = src.channels();
|
||||
if( src.isContinuous() && mask.empty() )
|
||||
{
|
||||
size_t len = src.total()*cn;
|
||||
@@ -1083,18 +1097,27 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
0) : 0;
|
||||
ippiNormRelFuncNoHint ippiNormRel =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R :
|
||||
#endif
|
||||
type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R :
|
||||
type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16s_C1R :
|
||||
type == CV_32F ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_32f_C1R :
|
||||
0) :
|
||||
normType == NORM_L1 ?
|
||||
(type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_8u_C1R :
|
||||
#endif
|
||||
type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16u_C1R :
|
||||
type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16s_C1R :
|
||||
0) :
|
||||
normType == NORM_L2 || normType == NORM_L2SQR ?
|
||||
(type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_8u_C1R :
|
||||
#endif
|
||||
type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R :
|
||||
type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16s_C1R :
|
||||
0) : 0;
|
||||
@@ -1202,18 +1225,27 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra
|
||||
0) : 0;
|
||||
ippiNormDiffFuncNoHint ippiNormDiff =
|
||||
normType == NORM_INF ?
|
||||
(type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R :
|
||||
#endif
|
||||
type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C1R :
|
||||
type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R :
|
||||
type == CV_32F ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C1R :
|
||||
0) :
|
||||
normType == NORM_L1 ?
|
||||
(type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R :
|
||||
#endif
|
||||
type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R :
|
||||
type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C1R :
|
||||
0) :
|
||||
normType == NORM_L2 || normType == NORM_L2SQR ?
|
||||
(type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R :
|
||||
(
|
||||
#if !IPP_DISABLE_NORM_8U
|
||||
type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R :
|
||||
#endif
|
||||
type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C1R :
|
||||
type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C1R :
|
||||
0) : 0;
|
||||
@@ -1255,6 +1287,19 @@ double norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask
|
||||
_result)
|
||||
#endif
|
||||
|
||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
||||
int depth = src1.depth(), cn = src1.channels();
|
||||
if( src1.dims <= 2 )
|
||||
{
|
||||
double result;
|
||||
CALL_HAL_RET(normDiff, cv_hal_normDiff, result, src1.data, src1.step, src2.data, src2.step, mask.data, mask.step, src1.cols, src1.rows, src1.type(), normType);
|
||||
}
|
||||
else if( src1.isContinuous() && src2.isContinuous() && mask.isContinuous() )
|
||||
{
|
||||
double result;
|
||||
CALL_HAL_RET(normDiff, cv_hal_normDiff, result, src1.data, 0, src2.data, 0, mask.data, 0, (int)src1.total(), 1, src1.type(), normType);
|
||||
}
|
||||
|
||||
CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_norm(_src1, _src2, normType, _mask, _result), _result);
|
||||
|
||||
if( normType & NORM_RELATIVE )
|
||||
@@ -1262,9 +1307,6 @@ double norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask
|
||||
return norm(_src1, _src2, normType & ~NORM_RELATIVE, _mask)/(norm(_src2, normType, _mask) + DBL_EPSILON);
|
||||
}
|
||||
|
||||
Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat();
|
||||
int depth = src1.depth(), cn = src1.channels();
|
||||
|
||||
normType &= 7;
|
||||
CV_Assert( normType == NORM_INF || normType == NORM_L1 ||
|
||||
normType == NORM_L2 || normType == NORM_L2SQR ||
|
||||
|
||||
@@ -152,7 +152,7 @@ static void* WinGetProcAddress(const char* name)
|
||||
#define CV_CL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ const uint64_t AT_HWCAP = NT_GNU_HWCAP;
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined __ppc64__ || defined __PPC64__) && defined __unix__
|
||||
#if ((defined __ppc64__ || defined __PPC64__) && (defined HAVE_GETAUXVAL || defined HAVE_ELF_AUX_INFO))
|
||||
# include "sys/auxv.h"
|
||||
# ifndef AT_HWCAP2
|
||||
# define AT_HWCAP2 26
|
||||
@@ -738,7 +738,7 @@ struct HWFeatures
|
||||
have[CV_CPU_MSA] = true;
|
||||
#endif
|
||||
|
||||
#if (defined __ppc64__ || defined __PPC64__) && defined __linux__
|
||||
#if (defined __ppc64__ || defined __PPC64__) && defined HAVE_GETAUXVAL
|
||||
unsigned int hwcap = getauxval(AT_HWCAP);
|
||||
if (hwcap & PPC_FEATURE_HAS_VSX) {
|
||||
hwcap = getauxval(AT_HWCAP2);
|
||||
@@ -748,7 +748,7 @@ struct HWFeatures
|
||||
have[CV_CPU_VSX] = (hwcap & PPC_FEATURE2_ARCH_2_07) != 0;
|
||||
}
|
||||
}
|
||||
#elif (defined __ppc64__ || defined __PPC64__) && defined __FreeBSD__
|
||||
#elif (defined __ppc64__ || defined __PPC64__) && defined HAVE_ELF_AUX_INFO
|
||||
unsigned long hwcap = 0;
|
||||
elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
|
||||
if (hwcap & PPC_FEATURE_HAS_VSX) {
|
||||
@@ -760,7 +760,7 @@ struct HWFeatures
|
||||
}
|
||||
}
|
||||
#else
|
||||
// TODO: AIX, OpenBSD
|
||||
// TODO: AIX
|
||||
#if CV_VSX || defined _ARCH_PWR8 || defined __POWER9_VECTOR__
|
||||
have[CV_CPU_VSX] = true;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user