diff --git a/components/common/cpp/include/ftl/cuda_texture.hpp b/components/common/cpp/include/ftl/cuda_texture.hpp index 6f710d9b76ed9812bcfe4597af404f34e1ad56e5..6f29a80bf1b9cb8409026c0da2cc812b5b41fc15 100644 --- a/components/common/cpp/include/ftl/cuda_texture.hpp +++ b/components/common/cpp/include/ftl/cuda_texture.hpp @@ -53,8 +53,8 @@ class TextureObjectBase { inline size_t pixelPitch() const { return pitch2_; } inline uchar *devicePtr() const { return ptr_; }; __host__ __device__ inline uchar *devicePtr(int v) const { return &ptr_[v*pitch_]; } - __host__ __device__ inline size_t width() const { return width_; } - __host__ __device__ inline size_t height() const { return height_; } + __host__ __device__ inline unsigned int width() const { return width_; } + __host__ __device__ inline unsigned int height() const { return height_; } __host__ __device__ inline cudaTextureObject_t cudaTexture() const { return texobj_; } cv::cuda::GpuMat to_gpumat() const; @@ -72,8 +72,8 @@ class TextureObjectBase { cudaTextureObject_t texobj_; size_t pitch_; size_t pitch2_; // in T units - size_t width_; - size_t height_; + unsigned int width_; + unsigned int height_; uchar *ptr_; // Device memory pointer bool needsfree_; // We manage memory, so free it bool needsdestroy_; // The texture object needs to be destroyed @@ -107,7 +107,7 @@ class TextureObject : public TextureObjectBase { operator cv::cuda::GpuMat(); void create(const cv::Size &); - void create(size_t w, size_t h); + void create(unsigned int w, unsigned int h); __host__ __device__ T *devicePtr() const { return (T*)(ptr_); }; __host__ __device__ T *devicePtr(int v) const { return &(T*)(ptr_)[v*pitch2_]; } @@ -292,7 +292,7 @@ void TextureObject<T>::create(const cv::Size &s) { } template <typename T> -void TextureObject<T>::create(size_t w, size_t h) { +void TextureObject<T>::create(unsigned int w, unsigned int h) { if (width_ != w || height_ != h) { *this = std::move(TextureObject<T>(w, h)); } diff --git a/components/operators/src/segmentation.cu b/components/operators/src/segmentation.cu index cf115136d47f2bf07e497ec75d118cb86420645a..8704cd275939f9350ead23538ef419b5da6ff0a2 100644 --- a/components/operators/src/segmentation.cu +++ b/components/operators/src/segmentation.cu @@ -27,9 +27,9 @@ __device__ inline float cross<float>(float p1, float p2) { template <typename T, bool SYM> __device__ uchar4 calculate_support_region(const TextureObject<T> &img, int x, int y, float tau, int v_max, int h_max) { int x_min = max(0, x - h_max); - int x_max = min(img.width()-1, static_cast<unsigned long>(x + h_max)); + int x_max = min(img.width()-1, static_cast<unsigned int>(x + h_max)); int y_min = max(0, y - v_max); - int y_max = min(img.height()-1, static_cast<unsigned long>(y + v_max)); + int y_max = min(img.height()-1, static_cast<unsigned int>(y + v_max)); uchar4 result = make_uchar4(0, 0, 0, 0); @@ -93,9 +93,9 @@ __device__ uchar4 calculate_support_region(const TextureObject<T> &img, int x, i __device__ uchar4 calculate_support_region(const TextureObject<uint8_t> &img, int x, int y, int v_max, int h_max) { int x_min = max(0, x - h_max); - int x_max = min(img.width()-1, static_cast<unsigned long>(x + h_max)); + int x_max = min(img.width()-1, static_cast<unsigned int>(x + h_max)); int y_min = max(0, y - v_max); - int y_max = min(img.height()-1, static_cast<unsigned long>(y + v_max)); + int y_max = min(img.height()-1, static_cast<unsigned int>(y + v_max)); uchar4 result = make_uchar4(0, 0, 0, 0);