cast to reference

pull/1540/head
Vladislav Vinogradov 11 years ago
parent bbd519be42
commit 3fb9c52272
  1. 9
      modules/cudaarithm/src/cuda/minmax.cu
  2. 21
      modules/cudaarithm/src/cuda/sum.cu

@ -64,8 +64,8 @@ namespace
typename SelectIf<TypesEquals<T, float>::value, float, int>::type
>::type work_type;
GpuMat_<T> src(_src);
GpuMat_<work_type> buf(_buf);
const GpuMat_<T>& src = (const GpuMat_<T>&) _src;
GpuMat_<work_type>& buf = (GpuMat_<work_type>&) _buf;
if (mask.empty())
gridFindMinMaxVal(src, buf);
@ -103,11 +103,6 @@ void cv::cuda::minMax(InputArray _src, double* minVal, double* maxVal, InputArra
CV_Assert( src.channels() == 1 );
CV_DbgAssert( mask.empty() || (mask.size() == src.size() && mask.type() == CV_8U) );
const int depth = src.depth();
const int work_type = depth == CV_64F ? CV_64F : depth == CV_32F ? CV_32F : CV_32S;
ensureSizeIsEnough(1, 2, work_type, buf);
const func_t func = funcs[src.depth()];
func(src, mask, buf, minVal, maxVal);

@ -61,8 +61,8 @@ namespace
typedef typename MakeVec<T, cn>::type src_type;
typedef typename MakeVec<R, cn>::type res_type;
GpuMat_<src_type> src(_src);
GpuMat_<res_type> buf(_buf);
const GpuMat_<src_type>& src = (const GpuMat_<src_type>&) _src;
GpuMat_<res_type>& buf = (GpuMat_<res_type>&) _buf;
if (mask.empty())
gridCalcSum(src, buf);
@ -82,8 +82,8 @@ namespace
typedef typename MakeVec<T, cn>::type src_type;
typedef typename MakeVec<R, cn>::type res_type;
GpuMat_<src_type> src(_src);
GpuMat_<res_type> buf(_buf);
const GpuMat_<src_type>& src = (const GpuMat_<src_type>&) _src;
GpuMat_<res_type>& buf = (GpuMat_<res_type>&) _buf;
if (mask.empty())
gridCalcSum(abs_(cvt_<res_type>(src)), buf);
@ -103,8 +103,8 @@ namespace
typedef typename MakeVec<T, cn>::type src_type;
typedef typename MakeVec<R, cn>::type res_type;
GpuMat_<src_type> src(_src);
GpuMat_<res_type> buf(_buf);
const GpuMat_<src_type>& src = (const GpuMat_<src_type>&) _src;
GpuMat_<res_type>& buf = (GpuMat_<res_type>&) _buf;
if (mask.empty())
gridCalcSum(sqr_(cvt_<res_type>(src)), buf);
@ -138,9 +138,6 @@ cv::Scalar cv::cuda::sum(InputArray _src, InputArray _mask, GpuMat& buf)
CV_DbgAssert( mask.empty() || (mask.type() == CV_8UC1 && mask.size() == src.size()) );
const int res_depth = std::max(src.depth(), CV_32F);
cv::cuda::ensureSizeIsEnough(1, 1, CV_MAKE_TYPE(res_depth, src.channels()), buf);
const func_t func = funcs[src.depth()][src.channels() - 1];
return func(src, mask, buf);
@ -165,9 +162,6 @@ cv::Scalar cv::cuda::absSum(InputArray _src, InputArray _mask, GpuMat& buf)
CV_DbgAssert( mask.empty() || (mask.type() == CV_8UC1 && mask.size() == src.size()) );
const int res_depth = std::max(src.depth(), CV_32F);
cv::cuda::ensureSizeIsEnough(1, 1, CV_MAKE_TYPE(res_depth, src.channels()), buf);
const func_t func = funcs[src.depth()][src.channels() - 1];
return func(src, mask, buf);
@ -192,9 +186,6 @@ cv::Scalar cv::cuda::sqrSum(InputArray _src, InputArray _mask, GpuMat& buf)
CV_DbgAssert( mask.empty() || (mask.type() == CV_8UC1 && mask.size() == src.size()) );
const int res_depth = CV_64F;
cv::cuda::ensureSizeIsEnough(1, 1, CV_MAKE_TYPE(res_depth, src.channels()), buf);
const func_t func = funcs[src.depth()][src.channels() - 1];
return func(src, mask, buf);

Loading…
Cancel
Save