43 #ifndef __OPENCV_GPU_COMMON_HPP__
44 #define __OPENCV_GPU_COMMON_HPP__
46 #include <cuda_runtime.h>
50 #define CV_PI 3.1415926535897932384626433832795
55 #define CV_PI_F 3.14159265f
57 #define CV_PI_F ((float)CV_PI)
62 #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__, __func__)
64 #define cudaSafeCall(expr) ___cudaSafeCall(expr, __FILE__, __LINE__)
67 namespace cv {
namespace gpu
69 void error(
const char *error_string,
const char *file,
const int line,
const char *
func);
71 template <
typename T>
static inline bool isAligned(
const T*
ptr,
size_t size)
73 return reinterpret_cast<size_t>(
ptr) % size == 0;
76 static inline bool isAligned(
size_t step,
size_t size)
78 return step % size == 0;
82 static inline void ___cudaSafeCall(cudaError_t err,
const char *file,
const int line,
const char *
func =
"")
84 if (cudaSuccess != err)
88 namespace cv {
namespace gpu
90 __host__ __device__ __forceinline__
int divUp(
int total,
int grain)
92 return (total + grain - 1) / grain;
103 #if defined (_WIN32) || defined (__APPLE__)
109 cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
110 cudaSafeCall( cudaBindTexture2D(0, tex, img.
ptr(), &desc, img.
cols, img.
rows, img.
step) );
118 #endif // __OPENCV_GPU_COMMON_HPP__
int int void int total
Definition: core_c.h:1048
CvCmpFunc func
Definition: core_c.h:1072
int cols
Definition: cuda_devptrs.hpp:113
const CvMat const CvMat const CvMat CvMat CvMat CvMat CvMat CvSize CvMat CvMat * T
Definition: calib3d.hpp:270
__host__ __device__ __forceinline__ int divUp(int total, int grain)
Definition: common.hpp:90
void int step
Definition: core_c.h:403
Definition: cuda_devptrs.hpp:104
GLint GLvoid * img
Definition: legacy.hpp:1150
signed char schar
Definition: common.hpp:102
unsigned char uchar
Definition: common.hpp:100
CV_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func="")
unsigned int uint
Definition: common.hpp:104
size_t step
stride between two consecutive rows in bytes. Step is stored always and everywhere in bytes!!! ...
Definition: cuda_devptrs.hpp:95
unsigned short ushort
Definition: common.hpp:101
__CV_GPU_HOST_DEVICE__ T * ptr(int y=0)
Definition: cuda_devptrs.hpp:97
const char const char const char int line
Definition: core_c.h:1743
const char * ptr
Definition: core_c.h:942
int rows
Definition: cuda_devptrs.hpp:114
void bindTexture(const textureReference *tex, const PtrStepSz< T > &img)
Definition: common.hpp:107
GLsizeiptr size
Definition: core_c.h:939
CV_EXPORTS_W void line(CV_IN_OUT Mat &img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=8, int shift=0)
draws the line segment (pt1, pt2) in the image