refactoring: made gpu bitwise operations inline

This commit is contained in:
Alexey Spizhevoy 2010-12-20 09:16:17 +00:00
parent 0465b89e7e
commit 1922e50f19
3 changed files with 34 additions and 40 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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