Skip to content
Snippets Groups Projects
Commit 14e0bfe8 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Remove size_t for texture size

parent 2220bf23
No related branches found
No related tags found
No related merge requests found
Pipeline #22759 passed
......@@ -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));
}
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment