Refactored Tegra related macro usage

This commit is contained in:
Andrey Kamaev 2011-12-22 12:51:01 +00:00
parent 48ea65e69c
commit bdfd4c3062
2 changed files with 146 additions and 128 deletions

View File

@ -1943,6 +1943,52 @@ typedef void (*ReduceFunc)( const Mat& src, Mat& dst );
} }
#define reduceSumR8u32s reduceR_<uchar, int, OpAdd<int> >
#define reduceSumR8u32f reduceR_<uchar, float, OpAdd<int> >
#define reduceSumR8u64f reduceR_<uchar, double,OpAdd<int> >
#define reduceSumR16u32f reduceR_<ushort,float, OpAdd<float> >
#define reduceSumR16u64f reduceR_<ushort,double,OpAdd<double> >
#define reduceSumR16s32f reduceR_<short, float, OpAdd<float> >
#define reduceSumR16s64f reduceR_<short, double,OpAdd<double> >
#define reduceSumR32f32f reduceR_<float, float, OpAdd<float> >
#define reduceSumR32f64f reduceR_<float, double,OpAdd<double> >
#define reduceSumR64f64f reduceR_<double,double,OpAdd<double> >
#define reduceMaxR8u reduceR_<uchar, uchar, OpMax<uchar> >
#define reduceMaxR16u reduceR_<ushort,ushort,OpMax<ushort> >
#define reduceMaxR16s reduceR_<short, short, OpMax<short> >
#define reduceMaxR32f reduceR_<float, float, OpMax<float> >
#define reduceMaxR64f reduceR_<double,double,OpMax<double> >
#define reduceMinR8u reduceR_<uchar, uchar, OpMin<uchar> >
#define reduceMinR16u reduceR_<ushort,ushort,OpMin<ushort> >
#define reduceMinR16s reduceR_<short, short, OpMin<short> >
#define reduceMinR32f reduceR_<float, float, OpMin<float> >
#define reduceMinR64f reduceR_<double,double,OpMin<double> >
#define reduceSumC8u32s reduceC_<uchar, int, OpAdd<int> >
#define reduceSumC8u32f reduceC_<uchar, float, OpAdd<int> >
#define reduceSumC8u64f reduceC_<uchar, double,OpAdd<int> >
#define reduceSumC16u32f reduceC_<ushort,float, OpAdd<float> >
#define reduceSumC16u64f reduceC_<ushort,double,OpAdd<double> >
#define reduceSumC16s32f reduceC_<short, float, OpAdd<float> >
#define reduceSumC16s64f reduceC_<short, double,OpAdd<double> >
#define reduceSumC32f32f reduceC_<float, float, OpAdd<float> >
#define reduceSumC32f64f reduceC_<float, double,OpAdd<double> >
#define reduceSumC64f64f reduceC_<double,double,OpAdd<double> >
#define reduceMaxC8u reduceC_<uchar, uchar, OpMax<uchar> >
#define reduceMaxC16u reduceC_<ushort,ushort,OpMax<ushort> >
#define reduceMaxC16s reduceC_<short, short, OpMax<short> >
#define reduceMaxC32f reduceC_<float, float, OpMax<float> >
#define reduceMaxC64f reduceC_<double,double,OpMax<double> >
#define reduceMinC8u reduceC_<uchar, uchar, OpMin<uchar> >
#define reduceMinC16u reduceC_<ushort,ushort,OpMin<ushort> >
#define reduceMinC16s reduceC_<short, short, OpMin<short> >
#define reduceMinC32f reduceC_<float, float, OpMin<float> >
#define reduceMinC64f reduceC_<double,double,OpMin<double> >
void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
{ {
Mat src = _src.getMat(); 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; Mat dst = _dst.getMat(), temp = dst;
CV_Assert( op == CV_REDUCE_SUM || op == CV_REDUCE_MAX || 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() ); CV_Assert( src.channels() == dst.channels() );
if( op == CV_REDUCE_AVG ) 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( op == CV_REDUCE_SUM )
{ {
if(sdepth == CV_8U && ddepth == CV_32S) if(sdepth == CV_8U && ddepth == CV_32S)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceSumR8u32s);
func = tegra::getTegraOptimized_reduceR8uAdd(tegra::reduceR8uAdd);
#else
func = reduceR_<uchar,int,OpAdd<int> >;
#endif
else if(sdepth == CV_8U && ddepth == CV_32F) else if(sdepth == CV_8U && ddepth == CV_32F)
func = reduceR_<uchar,float,OpAdd<int> >; func = reduceSumR8u32f;
else if(sdepth == CV_8U && ddepth == CV_64F) else if(sdepth == CV_8U && ddepth == CV_64F)
func = reduceR_<uchar,double,OpAdd<int> >; func = reduceSumR8u64f;
else if(sdepth == CV_16U && ddepth == CV_32F) else if(sdepth == CV_16U && ddepth == CV_32F)
func = reduceR_<ushort,float,OpAdd<float> >; func = reduceSumR16u32f;
else if(sdepth == CV_16U && ddepth == CV_64F) else if(sdepth == CV_16U && ddepth == CV_64F)
func = reduceR_<ushort,double,OpAdd<double> >; func = reduceSumR16u64f;
else if(sdepth == CV_16S && ddepth == CV_32F) else if(sdepth == CV_16S && ddepth == CV_32F)
func = reduceR_<short,float,OpAdd<float> >; func = reduceSumR16s32f;
else if(sdepth == CV_16S && ddepth == CV_64F) else if(sdepth == CV_16S && ddepth == CV_64F)
func = reduceR_<short,double,OpAdd<double> >; func = reduceSumR16s64f;
else if(sdepth == CV_32F && ddepth == CV_32F) else if(sdepth == CV_32F && ddepth == CV_32F)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceSumR32f32f);
func = tegra::getTegraOptimized_reduceR32fAdd(tegra::reduceR32fAdd);
#else
func = reduceR_<float,float,OpAdd<float> >;
#endif
else if(sdepth == CV_32F && ddepth == CV_64F) else if(sdepth == CV_32F && ddepth == CV_64F)
func = reduceR_<float,double,OpAdd<double> >; func = reduceSumR32f64f;
else if(sdepth == CV_64F && ddepth == CV_64F) else if(sdepth == CV_64F && ddepth == CV_64F)
func = reduceR_<double,double,OpAdd<double> >; func = reduceSumR64f64f;
} }
else if(op == CV_REDUCE_MAX) else if(op == CV_REDUCE_MAX)
{ {
if(sdepth == CV_8U && ddepth == CV_8U) if(sdepth == CV_8U && ddepth == CV_8U)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceMaxR8u);
func = tegra::getTegraOptimized_reduceR8uMax(tegra::reduceR8uMax); else if(sdepth == CV_16U && ddepth == CV_16U)
#else func = reduceMaxR16u;
func = reduceR_<uchar, uchar, OpMax<uchar> >;
#endif
else if(sdepth == CV_16U && ddepth == CV_16U)
func = reduceR_<ushort, ushort, OpMax<ushort> >;
else if(sdepth == CV_16S && ddepth == CV_16S) else if(sdepth == CV_16S && ddepth == CV_16S)
func = reduceR_<short, short, OpMax<short> >; func = reduceMaxR16s;
else if(sdepth == CV_32F && ddepth == CV_32F) else if(sdepth == CV_32F && ddepth == CV_32F)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceMaxR32f);
func = tegra::getTegraOptimized_reduceR32fMax(tegra::reduceR32fMax); else if(sdepth == CV_64F && ddepth == CV_64F)
#else func = reduceMaxR64f;
func = reduceR_<float, float, OpMax<float> >;
#endif
else if(sdepth == CV_64F && ddepth == CV_64F)
func = reduceR_<double, double, OpMax<double> >;
} }
else if(op == CV_REDUCE_MIN) else if(op == CV_REDUCE_MIN)
{ {
if(sdepth == CV_8U && ddepth == CV_8U) if(sdepth == CV_8U && ddepth == CV_8U)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceMinR8u);
func = tegra::getTegraOptimized_reduceR8uMin(tegra::reduceR8uMin);
#else
func = reduceR_<uchar, uchar, OpMin<uchar> >;
#endif
else if(sdepth == CV_16U && ddepth == CV_16U) else if(sdepth == CV_16U && ddepth == CV_16U)
func = reduceR_<ushort, ushort, OpMin<ushort> >; func = reduceMinR16u;
else if(sdepth == CV_16S && ddepth == CV_16S) else if(sdepth == CV_16S && ddepth == CV_16S)
func = reduceR_<short, short, OpMin<short> >; func = reduceMinR16s;
else if(sdepth == CV_32F && ddepth == CV_32F) else if(sdepth == CV_32F && ddepth == CV_32F)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceMinR32f);
func = tegra::getTegraOptimized_reduceR32fMin(tegra::reduceR32fMin);
#else
func = reduceR_<float, float, OpMin<float> >;
#endif
else if(sdepth == CV_64F && ddepth == CV_64F) else if(sdepth == CV_64F && ddepth == CV_64F)
func = reduceR_<double, double, OpMin<double> >; func = reduceMinR64f;
} }
} }
else else
@ -2053,67 +2075,63 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
if(op == CV_REDUCE_SUM) if(op == CV_REDUCE_SUM)
{ {
if(sdepth == CV_8U && ddepth == CV_32S) if(sdepth == CV_8U && ddepth == CV_32S)
#ifdef HAVE_TEGRA_OPTIMIZATION func = GET_OPTIMIZED(reduceSumC8u32s);
func = tegra::getTegraOptimized_reduceC8uAdd(tegra::reduceC8uAdd);
#else
func = reduceC_<uchar,int,OpAdd<int> >;
#endif
else if(sdepth == CV_8U && ddepth == CV_32F) else if(sdepth == CV_8U && ddepth == CV_32F)
func = reduceC_<uchar,float,OpAdd<int> >; func = reduceSumC8u32f;
else if(sdepth == CV_8U && ddepth == CV_64F) else if(sdepth == CV_8U && ddepth == CV_64F)
func = reduceC_<uchar,double,OpAdd<int> >; func = reduceSumC8u64f;
else if(sdepth == CV_16U && ddepth == CV_32F) else if(sdepth == CV_16U && ddepth == CV_32F)
func = reduceC_<ushort,float,OpAdd<float> >; func = reduceSumC16u32f;
else if(sdepth == CV_16U && ddepth == CV_64F) else if(sdepth == CV_16U && ddepth == CV_64F)
func = reduceC_<ushort,double,OpAdd<double> >; func = reduceSumC16u64f;
else if(sdepth == CV_16S && ddepth == CV_32F) else if(sdepth == CV_16S && ddepth == CV_32F)
func = reduceC_<short,float,OpAdd<float> >; func = reduceSumC16s32f;
else if(sdepth == CV_16S && ddepth == CV_64F) else if(sdepth == CV_16S && ddepth == CV_64F)
func = reduceC_<short,double,OpAdd<double> >; func = reduceSumC16s64f;
else if(sdepth == CV_32F && ddepth == CV_32F) else if(sdepth == CV_32F && ddepth == CV_32F)
func = reduceC_<float,float,OpAdd<float> >; func = GET_OPTIMIZED(reduceSumC32f32f);
else if(sdepth == CV_32F && ddepth == CV_64F) else if(sdepth == CV_32F && ddepth == CV_64F)
func = reduceC_<float,double,OpAdd<double> >; func = reduceSumC32f64f;
else if(sdepth == CV_64F && ddepth == CV_64F) else if(sdepth == CV_64F && ddepth == CV_64F)
func = reduceC_<double,double,OpAdd<double> >; func = reduceSumC64f64f;
} }
else if(op == CV_REDUCE_MAX) else if(op == CV_REDUCE_MAX)
{ {
if(sdepth == CV_8U && ddepth == CV_8U) if(sdepth == CV_8U && ddepth == CV_8U)
func = reduceC_<uchar, uchar, OpMax<uchar> >; func = GET_OPTIMIZED(reduceMaxC8u);
else if(sdepth == CV_16U && ddepth == CV_16U) else if(sdepth == CV_16U && ddepth == CV_16U)
func = reduceC_<ushort, ushort, OpMax<ushort> >; func = reduceMaxC16u;
else if(sdepth == CV_16S && ddepth == CV_16S) else if(sdepth == CV_16S && ddepth == CV_16S)
func = reduceC_<short, short, OpMax<short> >; func = reduceMaxC16s;
else if(sdepth == CV_32F && ddepth == CV_32F) else if(sdepth == CV_32F && ddepth == CV_32F)
func = reduceC_<float, float, OpMax<float> >; func = GET_OPTIMIZED(reduceMaxC32f);
else if(sdepth == CV_64F && ddepth == CV_64F) else if(sdepth == CV_64F && ddepth == CV_64F)
func = reduceC_<double, double, OpMax<double> >; func = reduceMaxC64f;
} }
else if(op == CV_REDUCE_MIN) else if(op == CV_REDUCE_MIN)
{ {
if(sdepth == CV_8U && ddepth == CV_8U) if(sdepth == CV_8U && ddepth == CV_8U)
func = reduceC_<uchar, uchar, OpMin<uchar> >; func = GET_OPTIMIZED(reduceMinC8u);
else if(sdepth == CV_16U && ddepth == CV_16U) else if(sdepth == CV_16U && ddepth == CV_16U)
func = reduceC_<ushort, ushort, OpMin<ushort> >; func = reduceMinC16u;
else if(sdepth == CV_16S && ddepth == CV_16S) else if(sdepth == CV_16S && ddepth == CV_16S)
func = reduceC_<short, short, OpMin<short> >; func = reduceMinC16s;
else if(sdepth == CV_32F && ddepth == CV_32F) else if(sdepth == CV_32F && ddepth == CV_32F)
func = reduceC_<float, float, OpMin<float> >; func = GET_OPTIMIZED(reduceMinC32f);
else if(sdepth == CV_64F && ddepth == CV_64F) else if(sdepth == CV_64F && ddepth == CV_64F)
func = reduceC_<double, double, OpMin<double> >; func = reduceMinC64f;
} }
} }
if( !func ) if( !func )
CV_Error( CV_StsUnsupportedFormat, CV_Error( CV_StsUnsupportedFormat,
"Unsupported combination of input and output array formats" ); "Unsupported combination of input and output array formats" );
func( src, temp ); 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)); temp.convertTo(dst, dst.type(), 1./(dim == 0 ? src.rows : src.cols));
} }
//////////////////////////////////////// sort /////////////////////////////////////////// //////////////////////////////////////// sort ///////////////////////////////////////////

View File

@ -610,7 +610,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
Mat dst = _dst.getMat(); Mat dst = _dst.getMat();
int dcn = (int)dst.total(); int dcn = (int)dst.total();
CV_Assert( dst.type() == CV_64F && dst.isContinuous() && 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<double>(); double* dptr = dst.ptr<double>();
for( k = 0; k < cn; k++ ) for( k = 0; k < cn; k++ )
dptr[k] = sptr[k]; dptr[k] = sptr[k];
@ -786,7 +786,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
} }
void cv::minMaxLoc( InputArray _img, double* minVal, double* maxVal, 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(); Mat img = _img.getMat();
CV_Assert(img.dims <= 2); CV_Assert(img.dims <= 2);
@ -870,7 +870,7 @@ float normL1_(const float* a, const float* b, int n)
for( ; j <= n - 4; j += 4 ) for( ; j <= n - 4; j += 4 )
{ {
d += std::abs(a[j] - b[j]) + std::abs(a[j+1] - b[j+1]) + 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 ) for( ; j <= n - 4; j += 4 )
{ {
d += std::abs(a[j] - b[j]) + std::abs(a[j+1] - b[j+1]) + 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]);
} }
} }
@ -979,7 +979,7 @@ int normHamming(const uchar* a, const uchar* b, int n)
#endif #endif
for( ; i <= n - 4; i += 4 ) for( ; i <= n - 4; i += 4 )
result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] + 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++ ) for( ; i < n; i++ )
result += popCountTable[a[i] ^ b[i]]; result += popCountTable[a[i] ^ b[i]];
return result; return result;
@ -999,7 +999,7 @@ int normHamming(const uchar* a, const uchar* b, int n, int cellSize)
int i = 0, result = 0; int i = 0, result = 0;
for( ; i <= n - 4; i += 4 ) for( ; i <= n - 4; i += 4 )
result += tab[a[i] ^ b[i]] + tab[a[i+1] ^ b[i+1]] + 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++ ) for( ; i < n; i++ )
result += tab[a[i] ^ b[i]]; result += tab[a[i] ^ b[i]];
return result; return result;
@ -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) \ #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); } \ { return norm##L##_(src, mask, r, len, cn); } \
static int normDiff##L##_##suffix(const type* src1, const type* src2, \ static int normDiff##L##_##suffix(const type* src1, const type* src2, \
const uchar* mask, ntype* r, int len, int cn) \ const uchar* mask, ntype* r, int len, int cn) \
{ return normDiff##L##_(src1, src2, mask, r, (int)len, cn); } { return normDiff##L##_(src1, src2, mask, r, (int)len, cn); }
#define CV_DEF_NORM_ALL(suffix, type, inftype, l1type, l2type) \ #define CV_DEF_NORM_ALL(suffix, type, inftype, l1type, l2type) \
CV_DEF_NORM_FUNC(Inf, suffix, type, inftype) \ CV_DEF_NORM_FUNC(Inf, suffix, type, inftype) \
CV_DEF_NORM_FUNC(L1, suffix, type, l1type) \ CV_DEF_NORM_FUNC(L1, suffix, type, l1type) \
CV_DEF_NORM_FUNC(L2, suffix, type, l2type) CV_DEF_NORM_FUNC(L2, suffix, type, l2type)
CV_DEF_NORM_ALL(8u, uchar, int, int, int) CV_DEF_NORM_ALL(8u, uchar, int, int, int)
CV_DEF_NORM_ALL(8s, schar, int, int, int) CV_DEF_NORM_ALL(8s, schar, int, int, int)
@ -1221,18 +1221,18 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
if( normType == NORM_L2 ) if( normType == NORM_L2 )
{ {
double result = 0; 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); return std::sqrt(result);
} }
if( normType == NORM_L1 ) if( normType == NORM_L1 )
{ {
double result = 0; 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; return result;
} }
{ {
float result = 0; 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; return result;
} }
@ -1257,7 +1257,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
NAryMatIterator it(arrays, ptrs); NAryMatIterator it(arrays, ptrs);
int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0; int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0;
bool blockSum = (normType == NORM_L1 && depth <= CV_16S) || bool blockSum = (normType == NORM_L1 && depth <= CV_16S) ||
(normType == NORM_L2 && depth <= CV_8S); (normType == NORM_L2 && depth <= CV_8S);
int isum = 0; int isum = 0;
int *ibuf = &result.i; int *ibuf = &result.i;
size_t esz = 0; size_t esz = 0;
@ -1275,8 +1275,8 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
for( j = 0; j < total; j += blockSize ) for( j = 0; j < total; j += blockSize )
{ {
int bsz = std::min(total - j, blockSize); int bsz = std::min(total - j, blockSize);
func( ptrs[0], ptrs[1], (uchar*)ibuf, bsz, cn ); func( ptrs[0], ptrs[1], (uchar*)ibuf, bsz, cn );
count += bsz; count += bsz;
if( blockSum && (count + blockSize >= intSumBlockSize || (i+1 >= it.nplanes && j+bsz >= total)) ) if( blockSum && (count + blockSize >= intSumBlockSize || (i+1 >= it.nplanes && j+bsz >= total)) )
{ {
result.d += isum; result.d += isum;
@ -1329,18 +1329,18 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
if( normType == NORM_L2 ) if( normType == NORM_L2 )
{ {
double result = 0; 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); return std::sqrt(result);
} }
if( normType == NORM_L1 ) if( normType == NORM_L1 )
{ {
double result = 0; 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; return result;
} }
{ {
float result = 0; 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; return result;
} }
} }
@ -1365,7 +1365,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
NAryMatIterator it(arrays, ptrs); NAryMatIterator it(arrays, ptrs);
int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0; int j, total = (int)it.size, blockSize = total, intSumBlockSize = 0, count = 0;
bool blockSum = (normType == NORM_L1 && depth <= CV_16S) || bool blockSum = (normType == NORM_L1 && depth <= CV_16S) ||
(normType == NORM_L2 && depth <= CV_8S); (normType == NORM_L2 && depth <= CV_8S);
unsigned isum = 0; unsigned isum = 0;
unsigned *ibuf = &result.u; unsigned *ibuf = &result.u;
size_t esz = 0; size_t esz = 0;
@ -1496,7 +1496,7 @@ cvMinMaxLoc( const void* imgarr, double* _minVal, double* _maxVal,
cv::extractImageCOI(imgarr, img); cv::extractImageCOI(imgarr, img);
cv::minMaxLoc( img, _minVal, _maxVal, cv::minMaxLoc( img, _minVal, _maxVal,
(cv::Point*)_minLoc, (cv::Point*)_maxLoc, mask ); (cv::Point*)_minLoc, (cv::Point*)_maxLoc, mask );
} }