From bdfd4c3062a3a3564ae4632664a8278419d1b8b6 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 22 Dec 2011 12:51:01 +0000 Subject: [PATCH] Refactored Tegra related macro usage --- modules/core/src/matrix.cpp | 174 ++++++++++++++++++++++++-------------------- modules/core/src/stat.cpp | 100 ++++++++++++------------- 2 files changed, 146 insertions(+), 128 deletions(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index deb0638..907cf06 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -1942,7 +1942,53 @@ reduceC_( const Mat& srcmat, Mat& dstmat ) typedef void (*ReduceFunc)( const Mat& src, Mat& dst ); } - + +#define reduceSumR8u32s reduceR_ > +#define reduceSumR8u32f reduceR_ > +#define reduceSumR8u64f reduceR_ > +#define reduceSumR16u32f reduceR_ > +#define reduceSumR16u64f reduceR_ > +#define reduceSumR16s32f reduceR_ > +#define reduceSumR16s64f reduceR_ > +#define reduceSumR32f32f reduceR_ > +#define reduceSumR32f64f reduceR_ > +#define reduceSumR64f64f reduceR_ > + +#define reduceMaxR8u reduceR_ > +#define reduceMaxR16u reduceR_ > +#define reduceMaxR16s reduceR_ > +#define reduceMaxR32f reduceR_ > +#define reduceMaxR64f reduceR_ > + +#define reduceMinR8u reduceR_ > +#define reduceMinR16u reduceR_ > +#define reduceMinR16s reduceR_ > +#define reduceMinR32f reduceR_ > +#define reduceMinR64f reduceR_ > + +#define reduceSumC8u32s reduceC_ > +#define reduceSumC8u32f reduceC_ > +#define reduceSumC8u64f reduceC_ > +#define reduceSumC16u32f reduceC_ > +#define reduceSumC16u64f reduceC_ > +#define reduceSumC16s32f reduceC_ > +#define reduceSumC16s64f reduceC_ > +#define reduceSumC32f32f reduceC_ > +#define reduceSumC32f64f reduceC_ > +#define reduceSumC64f64f reduceC_ > + +#define reduceMaxC8u reduceC_ > +#define reduceMaxC16u reduceC_ > +#define reduceMaxC16s reduceC_ > +#define reduceMaxC32f reduceC_ > +#define reduceMaxC64f reduceC_ > + +#define reduceMinC8u reduceC_ > +#define reduceMinC16u reduceC_ > +#define reduceMinC16s reduceC_ > +#define reduceMinC32f reduceC_ > +#define reduceMinC64f reduceC_ > + void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) { Mat src = _src.getMat(); @@ -1958,7 +2004,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) Mat dst = _dst.getMat(), temp = dst; CV_Assert( op == CV_REDUCE_SUM || op == CV_REDUCE_MAX || - op == CV_REDUCE_MIN || op == CV_REDUCE_AVG ); + op == CV_REDUCE_MIN || op == CV_REDUCE_AVG ); CV_Assert( src.channels() == dst.channels() ); if( op == CV_REDUCE_AVG ) @@ -1977,75 +2023,51 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) if( op == CV_REDUCE_SUM ) { if(sdepth == CV_8U && ddepth == CV_32S) -#ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceR8uAdd(tegra::reduceR8uAdd); -#else - func = reduceR_ >; -#endif + func = GET_OPTIMIZED(reduceSumR8u32s); else if(sdepth == CV_8U && ddepth == CV_32F) - func = reduceR_ >; + func = reduceSumR8u32f; else if(sdepth == CV_8U && ddepth == CV_64F) - func = reduceR_ >; + func = reduceSumR8u64f; else if(sdepth == CV_16U && ddepth == CV_32F) - func = reduceR_ >; + func = reduceSumR16u32f; else if(sdepth == CV_16U && ddepth == CV_64F) - func = reduceR_ >; + func = reduceSumR16u64f; else if(sdepth == CV_16S && ddepth == CV_32F) - func = reduceR_ >; + func = reduceSumR16s32f; else if(sdepth == CV_16S && ddepth == CV_64F) - func = reduceR_ >; - else if(sdepth == CV_32F && ddepth == CV_32F) - #ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceR32fAdd(tegra::reduceR32fAdd); -#else - func = reduceR_ >; -#endif + func = reduceSumR16s64f; + else if(sdepth == CV_32F && ddepth == CV_32F) + func = GET_OPTIMIZED(reduceSumR32f32f); else if(sdepth == CV_32F && ddepth == CV_64F) - func = reduceR_ >; + func = reduceSumR32f64f; else if(sdepth == CV_64F && ddepth == CV_64F) - func = reduceR_ >; + func = reduceSumR64f64f; } else if(op == CV_REDUCE_MAX) { if(sdepth == CV_8U && ddepth == CV_8U) -#ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceR8uMax(tegra::reduceR8uMax); -#else - func = reduceR_ >; -#endif - else if(sdepth == CV_16U && ddepth == CV_16U) - func = reduceR_ >; + func = GET_OPTIMIZED(reduceMaxR8u); + else if(sdepth == CV_16U && ddepth == CV_16U) + func = reduceMaxR16u; else if(sdepth == CV_16S && ddepth == CV_16S) - func = reduceR_ >; + func = reduceMaxR16s; else if(sdepth == CV_32F && ddepth == CV_32F) -#ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceR32fMax(tegra::reduceR32fMax); -#else - func = reduceR_ >; -#endif - else if(sdepth == CV_64F && ddepth == CV_64F) - func = reduceR_ >; + func = GET_OPTIMIZED(reduceMaxR32f); + else if(sdepth == CV_64F && ddepth == CV_64F) + func = reduceMaxR64f; } else if(op == CV_REDUCE_MIN) { if(sdepth == CV_8U && ddepth == CV_8U) -#ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceR8uMin(tegra::reduceR8uMin); -#else - func = reduceR_ >; -#endif + func = GET_OPTIMIZED(reduceMinR8u); else if(sdepth == CV_16U && ddepth == CV_16U) - func = reduceR_ >; + func = reduceMinR16u; else if(sdepth == CV_16S && ddepth == CV_16S) - func = reduceR_ >; + func = reduceMinR16s; else if(sdepth == CV_32F && ddepth == CV_32F) -#ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceR32fMin(tegra::reduceR32fMin); -#else - func = reduceR_ >; -#endif + func = GET_OPTIMIZED(reduceMinR32f); else if(sdepth == CV_64F && ddepth == CV_64F) - func = reduceR_ >; + func = reduceMinR64f; } } else @@ -2053,67 +2075,63 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) if(op == CV_REDUCE_SUM) { if(sdepth == CV_8U && ddepth == CV_32S) -#ifdef HAVE_TEGRA_OPTIMIZATION - func = tegra::getTegraOptimized_reduceC8uAdd(tegra::reduceC8uAdd); -#else - func = reduceC_ >; -#endif + func = GET_OPTIMIZED(reduceSumC8u32s); else if(sdepth == CV_8U && ddepth == CV_32F) - func = reduceC_ >; + func = reduceSumC8u32f; else if(sdepth == CV_8U && ddepth == CV_64F) - func = reduceC_ >; + func = reduceSumC8u64f; else if(sdepth == CV_16U && ddepth == CV_32F) - func = reduceC_ >; + func = reduceSumC16u32f; else if(sdepth == CV_16U && ddepth == CV_64F) - func = reduceC_ >; + func = reduceSumC16u64f; else if(sdepth == CV_16S && ddepth == CV_32F) - func = reduceC_ >; + func = reduceSumC16s32f; else if(sdepth == CV_16S && ddepth == CV_64F) - func = reduceC_ >; - else if(sdepth == CV_32F && ddepth == CV_32F) - func = reduceC_ >; + func = reduceSumC16s64f; + else if(sdepth == CV_32F && ddepth == CV_32F) + func = GET_OPTIMIZED(reduceSumC32f32f); else if(sdepth == CV_32F && ddepth == CV_64F) - func = reduceC_ >; + func = reduceSumC32f64f; else if(sdepth == CV_64F && ddepth == CV_64F) - func = reduceC_ >; + func = reduceSumC64f64f; } else if(op == CV_REDUCE_MAX) { if(sdepth == CV_8U && ddepth == CV_8U) - func = reduceC_ >; - else if(sdepth == CV_16U && ddepth == CV_16U) - func = reduceC_ >; + func = GET_OPTIMIZED(reduceMaxC8u); + else if(sdepth == CV_16U && ddepth == CV_16U) + func = reduceMaxC16u; else if(sdepth == CV_16S && ddepth == CV_16S) - func = reduceC_ >; + func = reduceMaxC16s; else if(sdepth == CV_32F && ddepth == CV_32F) - func = reduceC_ >; + func = GET_OPTIMIZED(reduceMaxC32f); else if(sdepth == CV_64F && ddepth == CV_64F) - func = reduceC_ >; + func = reduceMaxC64f; } else if(op == CV_REDUCE_MIN) { if(sdepth == CV_8U && ddepth == CV_8U) - func = reduceC_ >; + func = GET_OPTIMIZED(reduceMinC8u); else if(sdepth == CV_16U && ddepth == CV_16U) - func = reduceC_ >; + func = reduceMinC16u; else if(sdepth == CV_16S && ddepth == CV_16S) - func = reduceC_ >; + func = reduceMinC16s; else if(sdepth == CV_32F && ddepth == CV_32F) - func = reduceC_ >; + func = GET_OPTIMIZED(reduceMinC32f); else if(sdepth == CV_64F && ddepth == CV_64F) - func = reduceC_ >; + func = reduceMinC64f; } } if( !func ) CV_Error( CV_StsUnsupportedFormat, - "Unsupported combination of input and output array formats" ); + "Unsupported combination of input and output array formats" ); func( src, temp ); - if( op0 == CV_REDUCE_AVG ) + if( op0 == CV_REDUCE_AVG ) temp.convertTo(dst, dst.type(), 1./(dim == 0 ? src.rows : src.cols)); - } +} //////////////////////////////////////// sort /////////////////////////////////////////// diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index b0bf4da..5806b22 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -169,7 +169,7 @@ static int sum_(const T* src0, const uchar* mask, ST* dst, int len, int cn ) return nzm; } - + static int sum8u( const uchar* src, const uchar* mask, int* dst, int len, int cn ) { return sum_(src, mask, dst, len, cn); } @@ -201,7 +201,7 @@ static SumFunc sumTab[] = (SumFunc)GET_OPTIMIZED(sum32f), (SumFunc)sum64f, 0 }; - + template static int countNonZero_(const T* src, int len ) { @@ -229,7 +229,7 @@ static int countNonZero64f( const double* src, int len ) { return countNonZero_(src, len); } typedef int (*CountNonZeroFunc)(const uchar*, int); - + static CountNonZeroFunc countNonZeroTab[] = { (CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u), (CountNonZeroFunc)(countNonZero8u), @@ -238,7 +238,7 @@ static CountNonZeroFunc countNonZeroTab[] = (CountNonZeroFunc)countNonZero64f, 0 }; - + template static int sumsqr_(const T* src0, const uchar* mask, ST* sum, SQT* sqsum, int len, int cn ) { @@ -393,7 +393,7 @@ static SumSqrFunc sumSqrTab[] = }; } - + cv::Scalar cv::sum( InputArray _src ) { Mat src = _src.getMat(); @@ -419,12 +419,12 @@ cv::Scalar cv::sum( InputArray _src ) blockSize = std::min(blockSize, intSumBlockSize); _buf.allocate(cn); buf = _buf; - + for( k = 0; k < cn; k++ ) buf[k] = 0; esz = src.elemSize(); } - + for( size_t i = 0; i < it.nplanes; i++, ++it ) { for( j = 0; j < total; j += blockSize ) @@ -464,7 +464,7 @@ int cv::countNonZero( InputArray _src ) return nz; } - + cv::Scalar cv::mean( InputArray _src, InputArray _mask ) { Mat src = _src.getMat(), mask = _mask.getMat(); @@ -523,7 +523,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) return s*(nz0 ? 1./nz0 : 0); } - + void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, InputArray _mask ) { Mat src = _src.getMat(), mask = _mask.getMat(); @@ -610,7 +610,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input Mat dst = _dst.getMat(); int dcn = (int)dst.total(); CV_Assert( dst.type() == CV_64F && dst.isContinuous() && - (dst.cols == 1 || dst.rows == 1) && dcn >= cn ); + (dst.cols == 1 || dst.rows == 1) && dcn >= cn ); double* dptr = dst.ptr(); for( k = 0; k < cn; k++ ) dptr[k] = sptr[k]; @@ -701,7 +701,7 @@ static void minMaxIdx_32f(const float* src, const uchar* mask, float* minval, fl static void minMaxIdx_64f(const double* src, const uchar* mask, double* minval, double* maxval, size_t* minidx, size_t* maxidx, int len, size_t startidx ) { minMaxIdx_(src, mask, minval, maxval, minidx, maxidx, len, startidx ); } - + typedef void (*MinMaxIdxFunc)(const uchar*, const uchar*, int*, int*, size_t*, size_t*, int, size_t); static MinMaxIdxFunc minmaxTab[] = @@ -712,7 +712,7 @@ static MinMaxIdxFunc minmaxTab[] = (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32f), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_64f), 0 }; - + static void ofs2idx(const Mat& a, size_t ofs, int* idx) { int i, d = a.dims; @@ -732,7 +732,7 @@ static void ofs2idx(const Mat& a, size_t ofs, int* idx) idx[i] = -1; } } - + } void cv::minMaxIdx(InputArray _src, double* minVal, @@ -784,9 +784,9 @@ void cv::minMaxIdx(InputArray _src, double* minVal, if( maxIdx ) ofs2idx(src, maxidx, maxIdx); } - + void cv::minMaxLoc( InputArray _img, double* minVal, double* maxVal, - Point* minLoc, Point* maxLoc, InputArray mask ) + Point* minLoc, Point* maxLoc, InputArray mask ) { Mat img = _img.getMat(); CV_Assert(img.dims <= 2); @@ -797,7 +797,7 @@ void cv::minMaxLoc( InputArray _img, double* minVal, double* maxVal, if( maxLoc ) std::swap(maxLoc->x, maxLoc->y); } - + /****************************************************************************************\ * norm * \****************************************************************************************/ @@ -842,7 +842,7 @@ float normL2Sqr_(const float* a, const float* b, int n) return d; } - + float normL1_(const float* a, const float* b, int n) { int j = 0; float d = 0.f; @@ -870,7 +870,7 @@ float normL1_(const float* a, const float* b, int n) for( ; j <= n - 4; j += 4 ) { d += std::abs(a[j] - b[j]) + std::abs(a[j+1] - b[j+1]) + - std::abs(a[j+2] - b[j+2]) + std::abs(a[j+3] - b[j+3]); + std::abs(a[j+2] - b[j+2]) + std::abs(a[j+3] - b[j+3]); } } @@ -910,7 +910,7 @@ int normL1_(const uchar* a, const uchar* b, int n) for( ; j <= n - 4; j += 4 ) { d += std::abs(a[j] - b[j]) + std::abs(a[j+1] - b[j+1]) + - std::abs(a[j+2] - b[j+2]) + std::abs(a[j+3] - b[j+3]); + std::abs(a[j+2] - b[j+2]) + std::abs(a[j+3] - b[j+3]); } } @@ -930,7 +930,7 @@ static const uchar popCountTable[] = 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; - + static const uchar popCountTable2[] = { 0, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, @@ -942,7 +942,7 @@ static const uchar popCountTable2[] = 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 2, 3, 3, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4 }; - + static const uchar popCountTable4[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -954,7 +954,7 @@ static const uchar popCountTable4[] = 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; - + int normHamming(const uchar* a, const uchar* b, int n) { int i = 0, result = 0; @@ -979,12 +979,12 @@ int normHamming(const uchar* a, const uchar* b, int n) #endif for( ; i <= n - 4; i += 4 ) result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] + - popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]]; + popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]]; for( ; i < n; i++ ) result += popCountTable[a[i] ^ b[i]]; return result; } - + int normHamming(const uchar* a, const uchar* b, int n, int cellSize) { if( cellSize == 1 ) @@ -999,13 +999,13 @@ int normHamming(const uchar* a, const uchar* b, int n, int cellSize) int i = 0, result = 0; for( ; i <= n - 4; i += 4 ) result += tab[a[i] ^ b[i]] + tab[a[i+1] ^ b[i+1]] + - tab[a[i+2] ^ b[i+2]] + tab[a[i+3] ^ b[i+3]]; + tab[a[i+2] ^ b[i+2]] + tab[a[i+3] ^ b[i+3]]; for( ; i < n; i++ ) result += tab[a[i] ^ b[i]]; return result; } - - + + template int normInf_(const T* src, const uchar* mask, ST* _result, int len, int cn) { @@ -1026,7 +1026,7 @@ normInf_(const T* src, const uchar* mask, ST* _result, int len, int cn) *_result = result; return 0; } - + template int normL1_(const T* src, const uchar* mask, ST* _result, int len, int cn) { @@ -1071,7 +1071,7 @@ normL2_(const T* src, const uchar* mask, ST* _result, int len, int cn) *_result = result; return 0; } - + template int normDiffInf_(const T* src1, const T* src2, const uchar* mask, ST* _result, int len, int cn) { @@ -1140,16 +1140,16 @@ normDiffL2_(const T* src1, const T* src2, const uchar* mask, ST* _result, int le #define CV_DEF_NORM_FUNC(L, suffix, type, ntype) \ -static int norm##L##_##suffix(const type* src, const uchar* mask, ntype* r, int len, int cn) \ + static int norm##L##_##suffix(const type* src, const uchar* mask, ntype* r, int len, int cn) \ { return norm##L##_(src, mask, r, len, cn); } \ -static int normDiff##L##_##suffix(const type* src1, const type* src2, \ - const uchar* mask, ntype* r, int len, int cn) \ + static int normDiff##L##_##suffix(const type* src1, const type* src2, \ + const uchar* mask, ntype* r, int len, int cn) \ { return normDiff##L##_(src1, src2, mask, r, (int)len, cn); } - + #define CV_DEF_NORM_ALL(suffix, type, inftype, l1type, l2type) \ -CV_DEF_NORM_FUNC(Inf, suffix, type, inftype) \ -CV_DEF_NORM_FUNC(L1, suffix, type, l1type) \ -CV_DEF_NORM_FUNC(L2, suffix, type, l2type) + CV_DEF_NORM_FUNC(Inf, suffix, type, inftype) \ + CV_DEF_NORM_FUNC(L1, suffix, type, l1type) \ + CV_DEF_NORM_FUNC(L2, suffix, type, l2type) CV_DEF_NORM_ALL(8u, uchar, int, int, int) CV_DEF_NORM_ALL(8s, schar, int, int, int) @@ -1159,7 +1159,7 @@ CV_DEF_NORM_ALL(32s, int, int, double, double) CV_DEF_NORM_ALL(32f, float, float, double, double) CV_DEF_NORM_ALL(64f, double, double, double, double) - + typedef int (*NormFunc)(const uchar*, const uchar*, uchar*, int, int); typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, uchar*, int, int); @@ -1202,7 +1202,7 @@ static NormDiffFunc normDiffTab[3][8] = }; } - + double cv::norm( InputArray _src, int normType, InputArray _mask ) { Mat src = _src.getMat(), mask = _mask.getMat(); @@ -1221,18 +1221,18 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) if( normType == NORM_L2 ) { double result = 0; - GET_OPTIMIZED(normL2_32f)(data, 0, &result, (int)len, 1); + GET_OPTIMIZED(normL2_32f)(data, 0, &result, (int)len, 1); return std::sqrt(result); } if( normType == NORM_L1 ) { double result = 0; - GET_OPTIMIZED(normL1_32f)(data, 0, &result, (int)len, 1); + GET_OPTIMIZED(normL1_32f)(data, 0, &result, (int)len, 1); return result; } { float result = 0; - GET_OPTIMIZED(normInf_32f)(data, 0, &result, (int)len, 1); + GET_OPTIMIZED(normInf_32f)(data, 0, &result, (int)len, 1); return result; } @@ -1257,7 +1257,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) NAryMatIterator it(arrays, ptrs); int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0; bool blockSum = (normType == NORM_L1 && depth <= CV_16S) || - (normType == NORM_L2 && depth <= CV_8S); + (normType == NORM_L2 && depth <= CV_8S); int isum = 0; int *ibuf = &result.i; size_t esz = 0; @@ -1275,8 +1275,8 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) for( j = 0; j < total; j += blockSize ) { int bsz = std::min(total - j, blockSize); - func( ptrs[0], ptrs[1], (uchar*)ibuf, bsz, cn ); - count += bsz; + func( ptrs[0], ptrs[1], (uchar*)ibuf, bsz, cn ); + count += bsz; if( blockSum && (count + blockSize >= intSumBlockSize || (i+1 >= it.nplanes && j+bsz >= total)) ) { result.d += isum; @@ -1304,7 +1304,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) return result.d; } - + double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask ) { if( normType & CV_RELATIVE ) @@ -1329,18 +1329,18 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m if( normType == NORM_L2 ) { double result = 0; - GET_OPTIMIZED(normDiffL2_32f)(data1, data2, 0, &result, (int)len, 1); + GET_OPTIMIZED(normDiffL2_32f)(data1, data2, 0, &result, (int)len, 1); return std::sqrt(result); } if( normType == NORM_L1 ) { double result = 0; - GET_OPTIMIZED(normDiffL1_32f)(data1, data2, 0, &result, (int)len, 1); + GET_OPTIMIZED(normDiffL1_32f)(data1, data2, 0, &result, (int)len, 1); return result; } { float result = 0; - GET_OPTIMIZED(normDiffInf_32f)(data1, data2, 0, &result, (int)len, 1); + GET_OPTIMIZED(normDiffInf_32f)(data1, data2, 0, &result, (int)len, 1); return result; } } @@ -1365,7 +1365,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m NAryMatIterator it(arrays, ptrs); int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0; bool blockSum = (normType == NORM_L1 && depth <= CV_16S) || - (normType == NORM_L2 && depth <= CV_8S); + (normType == NORM_L2 && depth <= CV_8S); unsigned isum = 0; unsigned *ibuf = &result.u; size_t esz = 0; @@ -1496,7 +1496,7 @@ cvMinMaxLoc( const void* imgarr, double* _minVal, double* _maxVal, cv::extractImageCOI(imgarr, img); cv::minMaxLoc( img, _minVal, _maxVal, - (cv::Point*)_minLoc, (cv::Point*)_maxLoc, mask ); + (cv::Point*)_minLoc, (cv::Point*)_maxLoc, mask ); } -- 2.7.4