43#ifndef OPENCV_CUDA_COMMON_HPP 
   44#define OPENCV_CUDA_COMMON_HPP 
   46#include <cuda_runtime.h> 
   47#include "opencv2/core/cuda_types.hpp" 
   48#include "opencv2/core/cvdef.h" 
   49#include "opencv2/core/base.hpp" 
   59        #define CV_PI_F 3.14159265f 
   61        #define CV_PI_F ((float)CV_PI) 
   65namespace cv { 
namespace cuda {
 
   66    static inline void checkCudaError(cudaError_t err, 
const char* file, 
const int line, 
const char* 
func)
 
   68        if (cudaSuccess != err) {
 
   76    #define cudaSafeCall(expr)  cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func) 
   79namespace cv { 
namespace cuda
 
   81    template <
typename T> 
static inline bool isAligned(
const T* ptr, 
size_t size)
 
   83        return reinterpret_cast<size_t>(ptr) % 
size == 0;
 
   92namespace cv { 
namespace cuda
 
   96        __host__ __device__ __forceinline__ 
int divUp(
int total, 
int grain)
 
   98            return (
total + grain - 1) / grain;
 
  101#if (CUDART_VERSION >= 12000) 
  102        template<
class T> 
inline void createTextureObjectPitch2D(cudaTextureObject_t*, PtrStepSz<T>&, 
const cudaTextureDesc&) {
 
  106        template<
class T> 
inline void bindTexture(
const textureReference* tex, 
const PtrStepSz<T>& img)
 
  108            cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
 
  109            cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
 
  112        template<
class T> 
inline void createTextureObjectPitch2D(cudaTextureObject_t* tex, PtrStepSz<T>& img, 
const cudaTextureDesc& texDesc)
 
  114            cudaResourceDesc resDesc;
 
  115            memset(&resDesc, 0, 
sizeof(resDesc));
 
  116            resDesc.resType = cudaResourceTypePitch2D;
 
  117            resDesc.res.pitch2D.devPtr = 
static_cast<void*
>(img.ptr());
 
  118            resDesc.res.pitch2D.height = img.rows;
 
  119            resDesc.res.pitch2D.width = img.cols;
 
  120            resDesc.res.pitch2D.pitchInBytes = img.step;
 
  121            resDesc.res.pitch2D.desc = cudaCreateChannelDesc<T>();
 
  123            cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) );
 
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition calib3d.hpp:1867
CvCmpFunc func
Definition core_c.h:1712
int int void int total
Definition core_c.h:1689
const char const char const char int line
Definition core_c.h:2623
CvSize size
Definition core_c.h:112
void int step
Definition core_c.h:905
#define CV_Error(code, msg)
Call the error handler.
Definition base.hpp:320
CV_EXPORTS CV_NORETURN void error(const Exception &exc)
Signals an error and raises the exception.
static bool isAligned(const T &data)
Alignment check of passed values.
Definition utility.hpp:517
@ GpuApiCallError
GPU API call error.
Definition base.hpp:117
@ GpuNotSupported
no CUDA support
Definition base.hpp:116
"black box" representation of the file storage associated with a file on disk.
Definition calib3d.hpp:441