From 14e0bfe897b7a88aa11c9e4fcea24d93026f25d5 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 9 Mar 2020 11:02:55 +0200 Subject: [PATCH] Remove size_t for texture size --- components/common/cpp/include/ftl/cuda_texture.hpp | 12 ++++++------ components/operators/src/segmentation.cu | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/common/cpp/include/ftl/cuda_texture.hpp b/components/common/cpp/include/ftl/cuda_texture.hpp index 6f710d9b7..6f29a80bf 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 cf115136d..8704cd275 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); -- GitLab