refactoring: made gpu bitwise operations inline

pull/13383/head
Alexey Spizhevoy 14 years ago
parent 0465b89e7e
commit 1922e50f19
  1. 8
      modules/gpu/include/opencv2/gpu/gpu.hpp
  2. 34
      modules/gpu/include/opencv2/gpu/matrix_operations.hpp
  3. 32
      modules/gpu/src/element_operations.cpp

@ -558,29 +558,21 @@ namespace cv
//! performs per-elements bit-wise inversion
CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat());
//! version without mask
CV_EXPORTS GpuMat operator ~ (const GpuMat& src);
//! async version
CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream);
//! calculates per-element bit-wise disjunction of two arrays
CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
//! version without mask
CV_EXPORTS GpuMat operator | (const GpuMat& src1, const GpuMat& src2);
//! async version
CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);
//! calculates per-element bit-wise conjunction of two arrays
CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
//! version without mask
CV_EXPORTS GpuMat operator & (const GpuMat& src1, const GpuMat& src2);
//! async version
CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);
//! calculates per-element bit-wise "exclusive or" operation
CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
//! version without mask
CV_EXPORTS GpuMat operator ^ (const GpuMat& src1, const GpuMat& src2);
//! async version
CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);

@ -432,6 +432,40 @@ inline size_t CudaMem::step1() const { return step/elemSize1(); }
inline Size CudaMem::size() const { return Size(cols, rows); }
inline bool CudaMem::empty() const { return data == 0; }
//////////////////////////////////////////////////////////////////////////////
// Arithmetical operations
inline GpuMat operator ~ (const GpuMat& src)
{
GpuMat dst;
bitwise_not(src, dst);
return dst;
}
inline GpuMat operator | (const GpuMat& src1, const GpuMat& src2)
{
GpuMat dst;
bitwise_or(src1, src2, dst);
return dst;
}
inline GpuMat operator & (const GpuMat& src1, const GpuMat& src2)
{
GpuMat dst;
bitwise_and(src1, src2, dst);
return dst;
}
inline GpuMat operator ^ (const GpuMat& src1, const GpuMat& src2)
{
GpuMat dst;
bitwise_xor(src1, src2, dst);
return dst;
}
} /* end of namespace gpu */

@ -403,14 +403,6 @@ void cv::gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, co
}
cv::gpu::GpuMat cv::gpu::operator ~ (const GpuMat& src)
{
GpuMat dst;
bitwise_not(src, dst);
return dst;
}
//////////////////////////////////////////////////////////////////////////////
// Binary bitwise logical operations
@ -582,28 +574,4 @@ void cv::gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
::bitwiseXorCaller(src1, src2, dst, mask, StreamAccessor::getStream(stream));
}
cv::gpu::GpuMat cv::gpu::operator | (const GpuMat& src1, const GpuMat& src2)
{
GpuMat dst;
bitwise_or(src1, src2, dst);
return dst;
}
cv::gpu::GpuMat cv::gpu::operator & (const GpuMat& src1, const GpuMat& src2)
{
GpuMat dst;
bitwise_and(src1, src2, dst);
return dst;
}
cv::gpu::GpuMat cv::gpu::operator ^ (const GpuMat& src1, const GpuMat& src2)
{
GpuMat dst;
bitwise_xor(src1, src2, dst);
return dst;
}
#endif
Loading…
Cancel
Save