From dfd0b297ce4c074ad53d642ae259c22a37227801 Mon Sep 17 00:00:00 2001 From: Adil Ibragimov Date: Wed, 13 Aug 2014 11:11:33 +0400 Subject: [PATCH] datastart must be non-const in CUDA. --- modules/core/include/opencv2/core/cuda.hpp | 4 ++-- modules/core/src/cuda/gpu_mat.cu | 2 +- modules/core/src/cuda_gpu_mat.cpp | 4 ++-- modules/core/src/cuda_host_mem.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index fe7c0a8..4ae4301 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -261,7 +261,7 @@ public: int* refcount; //! helper fields used in locateROI and adjustROI - const uchar* datastart; + uchar* datastart; const uchar* dataend; //! allocator @@ -349,7 +349,7 @@ public: uchar* data; int* refcount; - const uchar* datastart; + uchar* datastart; const uchar* dataend; AllocType alloc_type; diff --git a/modules/core/src/cuda/gpu_mat.cu b/modules/core/src/cuda/gpu_mat.cu index 9dc8aa5..71b1b52 100644 --- a/modules/core/src/cuda/gpu_mat.cu +++ b/modules/core/src/cuda/gpu_mat.cu @@ -160,7 +160,7 @@ void cv::cuda::GpuMat::release() if (refcount && CV_XADD(refcount, -1) == 1) allocator->free(this); - data = datastart = dataend = 0; + dataend = data = datastart = 0; step = rows = cols = 0; refcount = 0; } diff --git a/modules/core/src/cuda_gpu_mat.cpp b/modules/core/src/cuda_gpu_mat.cpp index 80a7462..803b210 100644 --- a/modules/core/src/cuda_gpu_mat.cpp +++ b/modules/core/src/cuda_gpu_mat.cpp @@ -49,7 +49,7 @@ using namespace cv::cuda; cv::cuda::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t step_) : flags(Mat::MAGIC_VAL + (type_ & Mat::TYPE_MASK)), rows(rows_), cols(cols_), step(step_), data((uchar*)data_), refcount(0), - datastart((uchar*)data_), dataend((uchar*)data_), + datastart((uchar*)data_), dataend((const uchar*)data_), allocator(defaultAllocator()) { size_t minstep = cols * elemSize(); @@ -75,7 +75,7 @@ cv::cuda::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t st cv::cuda::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) : flags(Mat::MAGIC_VAL + (type_ & Mat::TYPE_MASK)), rows(size_.height), cols(size_.width), step(step_), data((uchar*)data_), refcount(0), - datastart((uchar*)data_), dataend((uchar*)data_), + datastart((uchar*)data_), dataend((const uchar*)data_), allocator(defaultAllocator()) { size_t minstep = cols * elemSize(); diff --git a/modules/core/src/cuda_host_mem.cpp b/modules/core/src/cuda_host_mem.cpp index 15a0d9a..b27d52e 100644 --- a/modules/core/src/cuda_host_mem.cpp +++ b/modules/core/src/cuda_host_mem.cpp @@ -175,7 +175,7 @@ void cv::cuda::CudaMem::release() fastFree(refcount); } - data = datastart = dataend = 0; + dataend = data = datastart = 0; step = rows = cols = 0; refcount = 0; #endif -- 2.7.4