diff --git a/modules/gpu/src/arithm.cpp b/modules/gpu/src/arithm.cpp index 176eeb3025..67da283eb6 100644 --- a/modules/gpu/src/arithm.cpp +++ b/modules/gpu/src/arithm.cpp @@ -82,7 +82,8 @@ void cv::gpu::transpose(const GpuMat& src, GpuMat& dst, Stream& s) sz.width = src.cols; sz.height = src.rows; - nppSafeCall( nppiTranspose_8u_C1R(src.ptr(), src.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiTranspose_8u_C1R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz) ); } else if (src.elemSize() == 4) { @@ -92,8 +93,8 @@ void cv::gpu::transpose(const GpuMat& src, GpuMat& dst, Stream& s) sz.width = src.cols; sz.height = src.rows; - nppSafeCall( nppiStTranspose_32u_C1R(const_cast(src.ptr()), src.step, - dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiStTranspose_32u_C1R(const_cast(src.ptr()), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz) ); } else // if (src.elemSize() == 8) { @@ -103,8 +104,8 @@ void cv::gpu::transpose(const GpuMat& src, GpuMat& dst, Stream& s) sz.width = src.cols; sz.height = src.rows; - nppSafeCall( nppiStTranspose_64u_C1R(const_cast(src.ptr()), src.step, - dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiStTranspose_64u_C1R(const_cast(src.ptr()), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz) ); } if (stream == 0) @@ -130,14 +131,14 @@ void cv::gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode, Stream& s) if (src.type() == CV_8UC1) { - nppSafeCall( nppiMirror_8u_C1R(src.ptr(), src.step, - dst.ptr(), dst.step, sz, + nppSafeCall( nppiMirror_8u_C1R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, (flipCode == 0 ? NPP_HORIZONTAL_AXIS : (flipCode > 0 ? NPP_VERTICAL_AXIS : NPP_BOTH_AXIS))) ); } else { - nppSafeCall( nppiMirror_8u_C4R(src.ptr(), src.step, - dst.ptr(), dst.step, sz, + nppSafeCall( nppiMirror_8u_C4R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, (flipCode == 0 ? NPP_HORIZONTAL_AXIS : (flipCode > 0 ? NPP_VERTICAL_AXIS : NPP_BOTH_AXIS))) ); } @@ -187,7 +188,8 @@ void cv::gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& s) if (src.type() == CV_8UC1) { - nppSafeCall( nppiLUT_Linear_8u_C1R(src.ptr(), src.step, dst.ptr(), dst.step, sz, nppLut.ptr(), lvls.pLevels, 256) ); + nppSafeCall( nppiLUT_Linear_8u_C1R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, nppLut.ptr(), lvls.pLevels, 256) ); } else { @@ -202,7 +204,8 @@ void cv::gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& s) pValues3[1] = nppLut3[1].ptr(); pValues3[2] = nppLut3[2].ptr(); } - nppSafeCall( nppiLUT_Linear_8u_C3R(src.ptr(), src.step, dst.ptr(), dst.step, sz, pValues3, lvls.pLevels3, lvls.nValues3) ); + nppSafeCall( nppiLUT_Linear_8u_C3R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, pValues3, lvls.pLevels3, lvls.nValues3) ); } if (stream == 0) @@ -226,7 +229,7 @@ void cv::gpu::exp(const GpuMat& src, GpuMat& dst, Stream& s) NppStreamHandler h(stream); - nppSafeCall( nppiExp_32f_C1R(src.ptr(), src.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiExp_32f_C1R(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -249,7 +252,7 @@ void cv::gpu::log(const GpuMat& src, GpuMat& dst, Stream& s) NppStreamHandler h(stream); - nppSafeCall( nppiLn_32f_C1R(src.ptr(), src.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiLn_32f_C1R(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -274,7 +277,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); diff --git a/modules/gpu/src/brute_force_matcher.cpp b/modules/gpu/src/brute_force_matcher.cpp index d8805a7f54..2fb2d9dd33 100644 --- a/modules/gpu/src/brute_force_matcher.cpp +++ b/modules/gpu/src/brute_force_matcher.cpp @@ -265,7 +265,7 @@ void cv::gpu::BruteForceMatcher_GPU_base::makeGpuCollection(GpuMat& trainCollect if (masks.empty()) { - Mat trainCollectionCPU(1, trainDescCollection.size(), CV_8UC(sizeof(DevMem2D))); + Mat trainCollectionCPU(1, static_cast(trainDescCollection.size()), CV_8UC(sizeof(DevMem2D))); for (size_t i = 0; i < trainDescCollection.size(); ++i) { @@ -280,8 +280,8 @@ void cv::gpu::BruteForceMatcher_GPU_base::makeGpuCollection(GpuMat& trainCollect { CV_Assert(masks.size() == trainDescCollection.size()); - Mat trainCollectionCPU(1, trainDescCollection.size(), CV_8UC(sizeof(DevMem2D))); - Mat maskCollectionCPU(1, trainDescCollection.size(), CV_8UC(sizeof(PtrStep))); + Mat trainCollectionCPU(1, static_cast(trainDescCollection.size()), CV_8UC(sizeof(DevMem2D))); + Mat maskCollectionCPU(1, static_cast(trainDescCollection.size()), CV_8UC(sizeof(PtrStep))); for (size_t i = 0; i < trainDescCollection.size(); ++i) { diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index 0ffd10c715..984b33f820 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -87,7 +87,7 @@ struct cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl src_seg.begin = src_beg; src_seg.size = src.step * src.rows; - NCVMatrixReuse d_src(src_seg, devProp.textureAlignment, src.cols, src.rows, src.step, true); + NCVMatrixReuse d_src(src_seg, static_cast(devProp.textureAlignment), src.cols, src.rows, static_cast(src.step), true); ncvAssertReturn(d_src.isMemReused(), NCV_ALLOCATOR_BAD_REUSE); CV_Assert(objects.rows == 1); @@ -141,8 +141,8 @@ private: ncvAssertCUDAReturn(cudaGetDeviceProperties(&devProp, devId), NCV_CUDA_ERROR); // Load the classifier from file (assuming its size is about 1 mb) using a simple allocator - gpuCascadeAllocator = new NCVMemNativeAllocator(NCVMemoryTypeDevice, devProp.textureAlignment); - cpuCascadeAllocator = new NCVMemNativeAllocator(NCVMemoryTypeHostPinned, devProp.textureAlignment); + gpuCascadeAllocator = new NCVMemNativeAllocator(NCVMemoryTypeDevice, static_cast(devProp.textureAlignment)); + cpuCascadeAllocator = new NCVMemNativeAllocator(NCVMemoryTypeHostPinned, static_cast(devProp.textureAlignment)); ncvAssertPrintReturn(gpuCascadeAllocator->isInitialized(), "Error creating cascade GPU allocator", NCV_CUDA_ERROR); ncvAssertPrintReturn(cpuCascadeAllocator->isInitialized(), "Error creating cascade CPU allocator", NCV_CUDA_ERROR); @@ -189,8 +189,8 @@ private: } // Calculate memory requirements and create real allocators - NCVMemStackAllocator gpuCounter(devProp.textureAlignment); - NCVMemStackAllocator cpuCounter(devProp.textureAlignment); + NCVMemStackAllocator gpuCounter(static_cast(devProp.textureAlignment)); + NCVMemStackAllocator cpuCounter(static_cast(devProp.textureAlignment)); ncvAssertPrintReturn(gpuCounter.isInitialized(), "Error creating GPU memory counter", NCV_CUDA_ERROR); ncvAssertPrintReturn(cpuCounter.isInitialized(), "Error creating CPU memory counter", NCV_CUDA_ERROR); @@ -214,8 +214,8 @@ private: ncvAssertReturnNcvStat(ncvStat); ncvAssertCUDAReturn(cudaStreamSynchronize(0), NCV_CUDA_ERROR); - gpuAllocator = new NCVMemStackAllocator(NCVMemoryTypeDevice, gpuCounter.maxSize(), devProp.textureAlignment); - cpuAllocator = new NCVMemStackAllocator(NCVMemoryTypeHostPinned, cpuCounter.maxSize(), devProp.textureAlignment); + gpuAllocator = new NCVMemStackAllocator(NCVMemoryTypeDevice, gpuCounter.maxSize(), static_cast(devProp.textureAlignment)); + cpuAllocator = new NCVMemStackAllocator(NCVMemoryTypeHostPinned, cpuCounter.maxSize(), static_cast(devProp.textureAlignment)); ncvAssertPrintReturn(gpuAllocator->isInitialized(), "Error creating GPU memory allocator", NCV_CUDA_ERROR); ncvAssertPrintReturn(cpuAllocator->isInitialized(), "Error creating CPU memory allocator", NCV_CUDA_ERROR); @@ -372,7 +372,7 @@ NCVStatus loadFromXML(const std::string &filename, for(int s = 0; s < stagesCound; ++s) // by stages { HaarStage64 curStage; - curStage.setStartClassifierRootNodeOffset(haarClassifierNodes.size()); + curStage.setStartClassifierRootNodeOffset(static_cast(haarClassifierNodes.size())); curStage.setStageThreshold(oldCascade->stage_classifier[s].threshold); @@ -452,7 +452,7 @@ NCVStatus loadFromXML(const std::string &filename, HaarFeatureDescriptor32 tmpFeatureDesc; ncvStat = tmpFeatureDesc.create(haar.bNeedsTiltedII, bIsLeftNodeLeaf, bIsRightNodeLeaf, - featureId, haarFeatures.size() - featureId); + featureId, static_cast(haarFeatures.size()) - featureId); ncvAssertReturn(NCV_SUCCESS == ncvStat, ncvStat); curNode.setFeatureDesc(tmpFeatureDesc); @@ -478,13 +478,13 @@ NCVStatus loadFromXML(const std::string &filename, } //fill in cascade stats - haar.NumStages = haarStages.size(); - haar.NumClassifierRootNodes = haarClassifierNodes.size(); - haar.NumClassifierTotalNodes = haar.NumClassifierRootNodes + h_TmpClassifierNotRootNodes.size(); - haar.NumFeatures = haarFeatures.size(); + haar.NumStages = static_cast(haarStages.size()); + haar.NumClassifierRootNodes = static_cast(haarClassifierNodes.size()); + haar.NumClassifierTotalNodes = static_cast(haar.NumClassifierRootNodes + h_TmpClassifierNotRootNodes.size()); + haar.NumFeatures = static_cast(haarFeatures.size()); //merge root and leaf nodes in one classifiers array - Ncv32u offsetRoot = haarClassifierNodes.size(); + Ncv32u offsetRoot = static_cast(haarClassifierNodes.size()); for (Ncv32u i=0; i(rows, cols * elem_size1 * cn, src, dst, stream); + bitwiseUnOp(rows, static_cast(cols * elem_size1 * cn), src, dst, stream); } @@ -296,10 +296,10 @@ namespace cv { namespace gpu { namespace mathfunc } - void bitwiseOrCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src1, + void bitwiseOrCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream) { - bitwiseBinOp(rows, cols * elem_size1 * cn, src1, src2, dst, stream); + bitwiseBinOp(rows, static_cast(cols * elem_size1 * cn), src1, src2, dst, stream); } @@ -315,10 +315,10 @@ namespace cv { namespace gpu { namespace mathfunc template void bitwiseMaskOrCaller(int, int, int, const PtrStep, const PtrStep, const PtrStep, PtrStep, cudaStream_t); - void bitwiseAndCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src1, + void bitwiseAndCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream) { - bitwiseBinOp(rows, cols * elem_size1 * cn, src1, src2, dst, stream); + bitwiseBinOp(rows, static_cast(cols * elem_size1 * cn), src1, src2, dst, stream); } @@ -334,10 +334,10 @@ namespace cv { namespace gpu { namespace mathfunc template void bitwiseMaskAndCaller(int, int, int, const PtrStep, const PtrStep, const PtrStep, PtrStep, cudaStream_t); - void bitwiseXorCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src1, + void bitwiseXorCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream) { - bitwiseBinOp(rows, cols * elem_size1 * cn, src1, src2, dst, stream); + bitwiseBinOp(rows, static_cast(cols * elem_size1 * cn), src1, src2, dst, stream); } diff --git a/modules/gpu/src/cuda/hist.cu b/modules/gpu/src/cuda/hist.cu index cfa6427f0a..23f8733fb1 100644 --- a/modules/gpu/src/cuda/hist.cu +++ b/modules/gpu/src/cuda/hist.cu @@ -176,7 +176,7 @@ namespace cv { namespace gpu { namespace histograms histogram256<<>>( DevMem2D_(src), buf, - src.rows * src.step / sizeof(uint), + static_cast(src.rows * src.step / sizeof(uint)), src.cols); cudaSafeCall( cudaGetLastError() ); diff --git a/modules/gpu/src/cuda/imgproc.cu b/modules/gpu/src/cuda/imgproc.cu index def579702c..1f760d7d33 100644 --- a/modules/gpu/src/cuda/imgproc.cu +++ b/modules/gpu/src/cuda/imgproc.cu @@ -161,7 +161,7 @@ namespace cv { namespace gpu { namespace imgproc texture tex_meanshift; __device__ short2 do_mean_shift(int x0, int y0, unsigned char* out, - int out_step, int cols, int rows, + size_t out_step, int cols, int rows, int sp, int sr, int maxIter, float eps) { int isr2 = sr*sr; @@ -225,7 +225,7 @@ namespace cv { namespace gpu { namespace imgproc return make_short2((short)x0, (short)y0); } - extern "C" __global__ void meanshift_kernel( unsigned char* out, int out_step, int cols, int rows, + extern "C" __global__ void meanshift_kernel( unsigned char* out, size_t out_step, int cols, int rows, int sp, int sr, int maxIter, float eps ) { int x0 = blockIdx.x * blockDim.x + threadIdx.x; @@ -235,8 +235,8 @@ namespace cv { namespace gpu { namespace imgproc do_mean_shift(x0, y0, out, out_step, cols, rows, sp, sr, maxIter, eps); } - extern "C" __global__ void meanshiftproc_kernel( unsigned char* outr, int outrstep, - unsigned char* outsp, int outspstep, + extern "C" __global__ void meanshiftproc_kernel( unsigned char* outr, size_t outrstep, + unsigned char* outsp, size_t outspstep, int cols, int rows, int sp, int sr, int maxIter, float eps ) { diff --git a/modules/gpu/src/cuda/matrix_operations.cu b/modules/gpu/src/cuda/matrix_operations.cu index 40f15886c6..2602c05749 100644 --- a/modules/gpu/src/cuda/matrix_operations.cu +++ b/modules/gpu/src/cuda/matrix_operations.cu @@ -62,7 +62,7 @@ namespace cv { namespace gpu { namespace matrix_operations { /////////////////////////////////////////////////////////////////////////// template - __global__ void copy_to_with_mask(T * mat_src, T * mat_dst, const unsigned char * mask, int cols, int rows, int step_mat, int step_mask, int channels) + __global__ void copy_to_with_mask(T * mat_src, T * mat_dst, const unsigned char * mask, int cols, int rows, size_t step_mat, size_t step_mask, int channels) { size_t x = blockIdx.x * blockDim.x + threadIdx.x; size_t y = blockIdx.y * blockDim.y + threadIdx.y; @@ -162,7 +162,7 @@ namespace cv { namespace gpu { namespace matrix_operations { } template - __global__ void set_to_without_mask(T * mat, int cols, int rows, int step, int channels) + __global__ void set_to_without_mask(T * mat, int cols, int rows, size_t step, int channels) { size_t x = blockIdx.x * blockDim.x + threadIdx.x; size_t y = blockIdx.y * blockDim.y + threadIdx.y; @@ -175,7 +175,7 @@ namespace cv { namespace gpu { namespace matrix_operations { } template - __global__ void set_to_with_mask(T * mat, const unsigned char * mask, int cols, int rows, int step, int channels, int step_mask) + __global__ void set_to_with_mask(T * mat, const unsigned char * mask, int cols, int rows, size_t step, int channels, size_t step_mask) { size_t x = blockIdx.x * blockDim.x + threadIdx.x; size_t y = blockIdx.y * blockDim.y + threadIdx.y; diff --git a/modules/gpu/src/cuda/split_merge.cu b/modules/gpu/src/cuda/split_merge.cu index 361a617b99..e618ff8f13 100644 --- a/modules/gpu/src/cuda/split_merge.cu +++ b/modules/gpu/src/cuda/split_merge.cu @@ -276,7 +276,7 @@ namespace cv { namespace gpu { namespace split_merge { extern "C" void merge_caller(const DevMem2D* src, DevMem2D& dst, - int total_channels, int elem_size, + int total_channels, size_t elem_size, const cudaStream_t& stream) { static MergeFunction merge_func_tbl[] = @@ -286,7 +286,7 @@ namespace cv { namespace gpu { namespace split_merge { mergeC4_, mergeC4_, mergeC4_, 0, mergeC4_, }; - int merge_func_id = (total_channels - 2) * 5 + (elem_size >> 1); + size_t merge_func_id = (total_channels - 2) * 5 + (elem_size >> 1); MergeFunction merge_func = merge_func_tbl[merge_func_id]; if (merge_func == 0) @@ -485,7 +485,7 @@ namespace cv { namespace gpu { namespace split_merge { extern "C" void split_caller(const DevMem2D& src, DevMem2D* dst, - int num_channels, int elem_size1, + int num_channels, size_t elem_size1, const cudaStream_t& stream) { static SplitFunction split_func_tbl[] = @@ -495,7 +495,7 @@ namespace cv { namespace gpu { namespace split_merge { splitC4_, splitC4_, splitC4_, 0, splitC4_, }; - int split_func_id = (num_channels - 2) * 5 + (elem_size1 >> 1); + size_t split_func_id = (num_channels - 2) * 5 + (elem_size1 >> 1); SplitFunction split_func = split_func_tbl[split_func_id]; if (split_func == 0) diff --git a/modules/gpu/src/element_operations.cpp b/modules/gpu/src/element_operations.cpp index 4feb819599..640bae71df 100644 --- a/modules/gpu/src/element_operations.cpp +++ b/modules/gpu/src/element_operations.cpp @@ -98,16 +98,20 @@ namespace switch (src1.type()) { case CV_8UC1: - nppSafeCall( npp_func_8uc1(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz, 0) ); + nppSafeCall( npp_func_8uc1(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz, 0) ); break; case CV_8UC4: - nppSafeCall( npp_func_8uc4(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz, 0) ); + nppSafeCall( npp_func_8uc4(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz, 0) ); break; case CV_32SC1: - nppSafeCall( npp_func_32sc1(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( npp_func_32sc1(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz) ); break; case CV_32FC1: - nppSafeCall( npp_func_32fc1(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( npp_func_32fc1(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz) ); break; default: CV_Assert(!"Unsupported source type"); @@ -141,7 +145,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, (Npp32f)sc[0], dst.ptr(), dst.step, sz) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), (Npp32f)sc[0], dst.ptr(), static_cast(dst.step), sz) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -163,7 +167,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, nValue, dst.ptr(), dst.step, sz) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), nValue, dst.ptr(), static_cast(dst.step), sz) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -238,7 +242,7 @@ void cv::gpu::multiply(const GpuMat& src, const Scalar& sc, GpuMat& dst, Stream& NppStreamHandler h(cudaStream); - nppSafeCall( nppiMulC_32f_C1R(src.ptr(), src.step, (Npp32f)sc[0], dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiMulC_32f_C1R(src.ptr(), static_cast(src.step), (Npp32f)sc[0], dst.ptr(), static_cast(dst.step), sz) ); if (cudaStream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -258,7 +262,7 @@ void cv::gpu::divide(const GpuMat& src, const Scalar& sc, GpuMat& dst, Stream& s NppStreamHandler h(cudaStream); - nppSafeCall( nppiDivC_32f_C1R(src.ptr(), src.step, (Npp32f)sc[0], dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiDivC_32f_C1R(src.ptr(), static_cast(src.step), (Npp32f)sc[0], dst.ptr(), static_cast(dst.step), sz) ); if (cudaStream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -287,16 +291,20 @@ void cv::gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Strea switch (src1.type()) { case CV_8UC1: - nppSafeCall( nppiAbsDiff_8u_C1R(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiAbsDiff_8u_C1R(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz) ); break; case CV_8UC4: - nppSafeCall( nppiAbsDiff_8u_C4R(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiAbsDiff_8u_C4R(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz) ); break; case CV_32SC1: - nppSafeCall( nppiAbsDiff_32s_C1R(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiAbsDiff_32s_C1R(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz) ); break; case CV_32FC1: - nppSafeCall( nppiAbsDiff_32f_C1R(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( nppiAbsDiff_32f_C1R(src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz) ); break; default: CV_Assert(!"Unsupported source type"); @@ -320,7 +328,7 @@ void cv::gpu::absdiff(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Strea NppStreamHandler h(stream); - nppSafeCall( nppiAbsDiffC_32f_C1R(src1.ptr(), src1.step, dst.ptr(), dst.step, sz, (Npp32f)src2[0]) ); + nppSafeCall( nppiAbsDiffC_32f_C1R(src1.ptr(), static_cast(src1.step), dst.ptr(), static_cast(dst.step), sz, (Npp32f)src2[0]) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -358,9 +366,9 @@ void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int c { NppStreamHandler h(stream); - nppSafeCall( nppiCompare_8u_C4R(src1.ptr(), src1.step, - src2.ptr(), src2.step, - dst.ptr(), dst.step, sz, nppCmpOp[cmpop]) ); + nppSafeCall( nppiCompare_8u_C4R(src1.ptr(), static_cast(src1.step), + src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz, nppCmpOp[cmpop]) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -376,9 +384,9 @@ void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int c { NppStreamHandler h(stream); - nppSafeCall( nppiCompare_32f_C1R(src1.ptr(), src1.step, - src2.ptr(), src2.step, - dst.ptr(), dst.step, sz, nppCmpOp[cmpop]) ); + nppSafeCall( nppiCompare_32f_C1R(src1.ptr(), static_cast(src1.step), + src2.ptr(), static_cast(src2.step), + dst.ptr(), static_cast(dst.step), sz, nppCmpOp[cmpop]) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -396,7 +404,7 @@ void cv::gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int c namespace cv { namespace gpu { namespace mathfunc { - void bitwiseNotCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src, PtrStep dst, cudaStream_t stream); + void bitwiseNotCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src, PtrStep dst, cudaStream_t stream); template void bitwiseMaskNotCaller(int rows, int cols, int cn, const PtrStep src, const PtrStep mask, PtrStep dst, cudaStream_t stream); @@ -450,17 +458,17 @@ void cv::gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, St namespace cv { namespace gpu { namespace mathfunc { - void bitwiseOrCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream); + void bitwiseOrCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream); template void bitwiseMaskOrCaller(int rows, int cols, int cn, const PtrStep src1, const PtrStep src2, const PtrStep mask, PtrStep dst, cudaStream_t stream); - void bitwiseAndCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream); + void bitwiseAndCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream); template void bitwiseMaskAndCaller(int rows, int cols, int cn, const PtrStep src1, const PtrStep src2, const PtrStep mask, PtrStep dst, cudaStream_t stream); - void bitwiseXorCaller(int rows, int cols, int elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream); + void bitwiseXorCaller(int rows, int cols, size_t elem_size1, int cn, const PtrStep src1, const PtrStep src2, PtrStep dst, cudaStream_t stream); template void bitwiseMaskXorCaller(int rows, int cols, int cn, const PtrStep src1, const PtrStep src2, const PtrStep mask, PtrStep dst, cudaStream_t stream); @@ -732,8 +740,8 @@ double cv::gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double sz.width = src.cols; sz.height = src.rows; - nppSafeCall( nppiThreshold_32f_C1R(src.ptr(), src.step, - dst.ptr(), dst.step, sz, static_cast(thresh), NPP_CMP_GREATER) ); + nppSafeCall( nppiThreshold_32f_C1R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, static_cast(thresh), NPP_CMP_GREATER) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); diff --git a/modules/gpu/src/error.cpp b/modules/gpu/src/error.cpp index 0ca918d521..1f38f6174c 100644 --- a/modules/gpu/src/error.cpp +++ b/modules/gpu/src/error.cpp @@ -110,7 +110,7 @@ namespace error_entry( NPP_ODD_ROI_WARNING ) }; - int error_num = sizeof(npp_errors)/sizeof(npp_errors[0]); + const size_t error_num = sizeof(npp_errors) / sizeof(npp_errors[0]); struct Searcher { @@ -161,7 +161,7 @@ namespace cv { const string getNppErrorString( int err ) { - int idx = std::find_if(npp_errors, npp_errors + error_num, Searcher(err)) - npp_errors; + size_t idx = std::find_if(npp_errors, npp_errors + error_num, Searcher(err)) - npp_errors; const string& msg = (idx != error_num) ? npp_errors[idx].str : string("Unknown error code"); std::stringstream interpreter; diff --git a/modules/gpu/src/filtering.cpp b/modules/gpu/src/filtering.cpp index 97a4d063db..0ea4fc561c 100644 --- a/modules/gpu/src/filtering.cpp +++ b/modules/gpu/src/filtering.cpp @@ -253,7 +253,8 @@ namespace NppStreamHandler h(stream); - nppSafeCall( nppiSumWindowRow_8u32f_C1R(src.ptr(), src.step, dst.ptr(), dst.step, sz, ksize, anchor) ); + nppSafeCall( nppiSumWindowRow_8u32f_C1R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, ksize, anchor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -287,7 +288,8 @@ namespace NppStreamHandler h(stream); - nppSafeCall( nppiSumWindowColumn_8u32f_C1R(src.ptr(), src.step, dst.ptr(), dst.step, sz, ksize, anchor) ); + nppSafeCall( nppiSumWindowColumn_8u32f_C1R(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, ksize, anchor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -333,7 +335,8 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, oKernelSize, oAnchor) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, oKernelSize, oAnchor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -401,7 +404,8 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, kernel.ptr(), oKernelSize, oAnchor) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), + dst.ptr(), static_cast(dst.step), sz, kernel.ptr(), oKernelSize, oAnchor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -584,7 +588,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz, kernel.ptr(), oKernelSize, oAnchor, nDivisor) ); if (stream == 0) @@ -666,7 +670,8 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, kernel.ptr(), ksize, anchor, nDivisor) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz, + kernel.ptr(), ksize, anchor, nDivisor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -780,7 +785,8 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, kernel.ptr(), ksize, anchor, nDivisor) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz, + kernel.ptr(), ksize, anchor, nDivisor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -1040,7 +1046,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, oKernelSize, oAnchor) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz, oKernelSize, oAnchor) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); diff --git a/modules/gpu/src/graphcuts.cpp b/modules/gpu/src/graphcuts.cpp index 00f734b717..f3c4a06e2d 100644 --- a/modules/gpu/src/graphcuts.cpp +++ b/modules/gpu/src/graphcuts.cpp @@ -78,7 +78,7 @@ void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTrans NppStreamHandler h(stream); nppSafeCall( nppiGraphcut_32s8u(terminals.ptr(), leftTransp.ptr(), rightTransp.ptr(), top.ptr(), bottom.ptr(), - terminals.step, leftTransp.step, sznpp, labels.ptr(), labels.step, buf.ptr()) ); + static_cast(terminals.step), static_cast(leftTransp.step), sznpp, labels.ptr(), static_cast(labels.step), buf.ptr()) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); diff --git a/modules/gpu/src/hog.cpp b/modules/gpu/src/hog.cpp index 5aec63031e..09797f7dfd 100644 --- a/modules/gpu/src/hog.cpp +++ b/modules/gpu/src/hog.cpp @@ -218,7 +218,7 @@ void cv::gpu::HOGDescriptor::computeBlockHistograms(const GpuMat& img) Size blocks_per_img = numPartsWithin(img.size(), block_size, block_stride); // block_hists.create(1, block_hist_size * blocks_per_img.area(), CV_32F); - block_hists = getBuffer(1, block_hist_size * blocks_per_img.area(), CV_32F, block_hists_buf); + block_hists = getBuffer(1, static_cast(block_hist_size * blocks_per_img.area()), CV_32F, block_hists_buf); hog::compute_hists(nbins, block_stride.width, block_stride.height, img.rows, img.cols, grad, qangle, (float)getWinSigma(), block_hists.ptr()); @@ -234,11 +234,11 @@ void cv::gpu::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride, computeBlockHistograms(img); - const int block_hist_size = getBlockHistogramSize(); + const size_t block_hist_size = getBlockHistogramSize(); Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride); Size wins_per_img = numPartsWithin(img.size(), win_size, win_stride); - descriptors.create(wins_per_img.area(), blocks_per_win.area() * block_hist_size, CV_32F); + descriptors.create(wins_per_img.area(), static_cast(blocks_per_win.area() * block_hist_size), CV_32F); switch (descr_format) { diff --git a/modules/gpu/src/imgproc_gpu.cpp b/modules/gpu/src/imgproc_gpu.cpp index 479ad8e80a..83185131c1 100644 --- a/modules/gpu/src/imgproc_gpu.cpp +++ b/modules/gpu/src/imgproc_gpu.cpp @@ -287,13 +287,13 @@ void cv::gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx, doub if (src.type() == CV_8UC1) { - nppSafeCall( nppiResize_8u_C1R(src.ptr(), srcsz, src.step, srcrect, - dst.ptr(), dst.step, dstsz, fx, fy, npp_inter[interpolation]) ); + nppSafeCall( nppiResize_8u_C1R(src.ptr(), srcsz, static_cast(src.step), srcrect, + dst.ptr(), static_cast(dst.step), dstsz, fx, fy, npp_inter[interpolation]) ); } else { - nppSafeCall( nppiResize_8u_C4R(src.ptr(), srcsz, src.step, srcrect, - dst.ptr(), dst.step, dstsz, fx, fy, npp_inter[interpolation]) ); + nppSafeCall( nppiResize_8u_C4R(src.ptr(), srcsz, static_cast(src.step), srcrect, + dst.ptr(), static_cast(dst.step), dstsz, fx, fy, npp_inter[interpolation]) ); } if (stream == 0) @@ -325,30 +325,30 @@ void cv::gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom case CV_8UC1: { Npp8u nVal = static_cast(value[0]); - nppSafeCall( nppiCopyConstBorder_8u_C1R(src.ptr(), src.step, srcsz, - dst.ptr(), dst.step, dstsz, top, left, nVal) ); + nppSafeCall( nppiCopyConstBorder_8u_C1R(src.ptr(), static_cast(src.step), srcsz, + dst.ptr(), static_cast(dst.step), dstsz, top, left, nVal) ); break; } case CV_8UC4: { Npp8u nVal[] = {static_cast(value[0]), static_cast(value[1]), static_cast(value[2]), static_cast(value[3])}; - nppSafeCall( nppiCopyConstBorder_8u_C4R(src.ptr(), src.step, srcsz, - dst.ptr(), dst.step, dstsz, top, left, nVal) ); + nppSafeCall( nppiCopyConstBorder_8u_C4R(src.ptr(), static_cast(src.step), srcsz, + dst.ptr(), static_cast(dst.step), dstsz, top, left, nVal) ); break; } case CV_32SC1: { Npp32s nVal = static_cast(value[0]); - nppSafeCall( nppiCopyConstBorder_32s_C1R(src.ptr(), src.step, srcsz, - dst.ptr(), dst.step, dstsz, top, left, nVal) ); + nppSafeCall( nppiCopyConstBorder_32s_C1R(src.ptr(), static_cast(src.step), srcsz, + dst.ptr(), static_cast(dst.step), dstsz, top, left, nVal) ); break; } case CV_32FC1: { Npp32f val = static_cast(value[0]); Npp32s nVal = *(reinterpret_cast(&val)); - nppSafeCall( nppiCopyConstBorder_32s_C1R(src.ptr(), src.step, srcsz, - dst.ptr(), dst.step, dstsz, top, left, nVal) ); + nppSafeCall( nppiCopyConstBorder_32s_C1R(src.ptr(), static_cast(src.step), srcsz, + dst.ptr(), static_cast(dst.step), dstsz, top, left, nVal) ); break; } default: @@ -409,20 +409,20 @@ namespace switch (src.depth()) { case CV_8U: - nppSafeCall( npp_warp_8u[src.channels()][warpInd](src.ptr(), srcsz, src.step, srcroi, - dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]) ); + nppSafeCall( npp_warp_8u[src.channels()][warpInd](src.ptr(), srcsz, static_cast(src.step), srcroi, + dst.ptr(), static_cast(dst.step), dstroi, coeffs, npp_inter[interpolation]) ); break; case CV_16U: - nppSafeCall( npp_warp_16u[src.channels()][warpInd](src.ptr(), srcsz, src.step, srcroi, - dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]) ); + nppSafeCall( npp_warp_16u[src.channels()][warpInd](src.ptr(), srcsz, static_cast(src.step), srcroi, + dst.ptr(), static_cast(dst.step), dstroi, coeffs, npp_inter[interpolation]) ); break; case CV_32S: - nppSafeCall( npp_warp_32s[src.channels()][warpInd](src.ptr(), srcsz, src.step, srcroi, - dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]) ); + nppSafeCall( npp_warp_32s[src.channels()][warpInd](src.ptr(), srcsz, static_cast(src.step), srcroi, + dst.ptr(), static_cast(dst.step), dstroi, coeffs, npp_inter[interpolation]) ); break; case CV_32F: - nppSafeCall( npp_warp_32f[src.channels()][warpInd](src.ptr(), srcsz, src.step, srcroi, - dst.ptr(), dst.step, dstroi, coeffs, npp_inter[interpolation]) ); + nppSafeCall( npp_warp_32f[src.channels()][warpInd](src.ptr(), srcsz, static_cast(src.step), srcroi, + dst.ptr(), static_cast(dst.step), dstroi, coeffs, npp_inter[interpolation]) ); break; default: CV_Assert(!"Unsupported source type"); @@ -541,7 +541,8 @@ void cv::gpu::buildWarpPlaneMaps(Size src_size, Rect dst_roi, const Mat& R, doub map_x.create(dst_roi.size(), CV_32F); map_y.create(dst_roi.size(), CV_32F); imgproc::buildWarpPlaneMaps(dst_roi.tl().x, dst_roi.tl().y, map_x, map_y, R.ptr(), Rinv.ptr(), - f, s, dist, 0.5f*src_size.width, 0.5f*src_size.height, StreamAccessor::getStream(stream)); + static_cast(f), static_cast(s), static_cast(dist), + 0.5f*src_size.width, 0.5f*src_size.height, StreamAccessor::getStream(stream)); } ////////////////////////////////////////////////////////////////////////////// @@ -564,7 +565,8 @@ void cv::gpu::buildWarpCylindricalMaps(Size src_size, Rect dst_roi, const Mat& R map_x.create(dst_roi.size(), CV_32F); map_y.create(dst_roi.size(), CV_32F); imgproc::buildWarpCylindricalMaps(dst_roi.tl().x, dst_roi.tl().y, map_x, map_y, R.ptr(), Rinv.ptr(), - f, s, 0.5f*src_size.width, 0.5f*src_size.height, StreamAccessor::getStream(stream)); + static_cast(f), static_cast(s), 0.5f*src_size.width, 0.5f*src_size.height, + StreamAccessor::getStream(stream)); } @@ -588,7 +590,8 @@ void cv::gpu::buildWarpSphericalMaps(Size src_size, Rect dst_roi, const Mat& R, map_x.create(dst_roi.size(), CV_32F); map_y.create(dst_roi.size(), CV_32F); imgproc::buildWarpSphericalMaps(dst_roi.tl().x, dst_roi.tl().y, map_x, map_y, R.ptr(), Rinv.ptr(), - f, s, 0.5f*src_size.width, 0.5f*src_size.height, StreamAccessor::getStream(stream)); + static_cast(f), static_cast(s), 0.5f*src_size.width, 0.5f*src_size.height, + StreamAccessor::getStream(stream)); } //////////////////////////////////////////////////////////////////////// @@ -621,13 +624,13 @@ void cv::gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, d if (src.type() == CV_8UC1) { - nppSafeCall( nppiRotate_8u_C1R(src.ptr(), srcsz, src.step, srcroi, - dst.ptr(), dst.step, dstroi, angle, xShift, yShift, npp_inter[interpolation]) ); + nppSafeCall( nppiRotate_8u_C1R(src.ptr(), srcsz, static_cast(src.step), srcroi, + dst.ptr(), static_cast(dst.step), dstroi, angle, xShift, yShift, npp_inter[interpolation]) ); } else { - nppSafeCall( nppiRotate_8u_C4R(src.ptr(), srcsz, src.step, srcroi, - dst.ptr(), dst.step, dstroi, angle, xShift, yShift, npp_inter[interpolation]) ); + nppSafeCall( nppiRotate_8u_C4R(src.ptr(), srcsz, static_cast(src.step), srcroi, + dst.ptr(), static_cast(dst.step), dstroi, angle, xShift, yShift, npp_inter[interpolation]) ); } if (stream == 0) @@ -664,8 +667,8 @@ void cv::gpu::integralBuffered(const GpuMat& src, GpuMat& sum, GpuMat& buffer, S NppStStreamHandler h(stream); - nppSafeCall( nppiStIntegral_8u32u_C1R(const_cast(src.ptr()), src.step, - sum.ptr(), sum.step, roiSize, buffer.ptr(), bufSize, prop) ); + nppSafeCall( nppiStIntegral_8u32u_C1R(const_cast(src.ptr()), static_cast(src.step), + sum.ptr(), static_cast(sum.step), roiSize, buffer.ptr(), bufSize, prop) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -688,8 +691,8 @@ void cv::gpu::integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum, Stream& s) NppStreamHandler h(stream); - nppSafeCall( nppiSqrIntegral_8u32s32f_C1R(const_cast(src.ptr()), src.step, sum.ptr(), - sum.step, sqsum.ptr(), sqsum.step, sz, 0, 0.0f, height) ); + nppSafeCall( nppiSqrIntegral_8u32s32f_C1R(const_cast(src.ptr()), static_cast(src.step), + sum.ptr(), static_cast(sum.step), sqsum.ptr(), static_cast(sqsum.step), sz, 0, 0.0f, height) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -718,8 +721,8 @@ void cv::gpu::sqrIntegral(const GpuMat& src, GpuMat& sqsum, Stream& s) NppStStreamHandler h(stream); sqsum.create(src.rows + 1, src.cols + 1, CV_64F); - nppSafeCall(nppiStSqrIntegral_8u64u_C1R(const_cast(src.ptr(0)), src.step, - sqsum.ptr(0), sqsum.step, roiSize, buf.ptr(0), bufSize, prop)); + nppSafeCall(nppiStSqrIntegral_8u64u_C1R(const_cast(src.ptr(0)), static_cast(src.step), + sqsum.ptr(0), static_cast(sqsum.step), roiSize, buf.ptr(0), bufSize, prop)); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -761,8 +764,8 @@ void cv::gpu::rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, cons NppStreamHandler h(stream); - nppSafeCall( nppiRectStdDev_32s32f_C1R(src.ptr(), src.step, sqr.ptr(), sqr.step, - dst.ptr(), dst.step, sz, nppRect) ); + nppSafeCall( nppiRectStdDev_32s32f_C1R(src.ptr(), static_cast(src.step), sqr.ptr(), static_cast(sqr.step), + dst.ptr(), static_cast(dst.step), sz, nppRect) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -820,7 +823,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, sz, hist.ptr(), levels, + nppSafeCall( func(src.ptr(), static_cast(src.step), sz, hist.ptr(), levels, lowerLevel, upperLevel, buffer.ptr()) ); if (stream == 0) @@ -854,7 +857,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, sz, pHist, levels, lowerLevel, upperLevel, buffer.ptr()) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), sz, pHist, levels, lowerLevel, upperLevel, buffer.ptr()) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -923,7 +926,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, sz, hist.ptr(), levels.ptr(), levels.cols, buffer.ptr()) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), sz, hist.ptr(), levels.ptr(), levels.cols, buffer.ptr()) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -964,7 +967,7 @@ namespace NppStreamHandler h(stream); - nppSafeCall( func(src.ptr(), src.step, sz, pHist, pLevels, nLevels, buffer.ptr()) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), sz, pHist, pLevels, nLevels, buffer.ptr()) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -1103,7 +1106,7 @@ void cv::gpu::equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, GpuMat& int intBufSize; nppSafeCall( nppsIntegralGetBufferSize_32s(256, &intBufSize) ); - int bufSize = std::max(256 * 240 * sizeof(int), intBufSize + 256 * sizeof(int)); + int bufSize = static_cast(std::max(256 * 240 * sizeof(int), intBufSize + 256 * sizeof(int))); ensureSizeIsEnough(1, bufSize, CV_8UC1, buf); diff --git a/modules/gpu/src/matrix_operations.cpp b/modules/gpu/src/matrix_operations.cpp index cc2537d9f1..4536587187 100644 --- a/modules/gpu/src/matrix_operations.cpp +++ b/modules/gpu/src/matrix_operations.cpp @@ -177,7 +177,7 @@ namespace NppiSize sz; sz.width = src.cols; sz.height = src.rows; - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz) ); cudaSafeCall( cudaDeviceSynchronize() ); } @@ -191,7 +191,7 @@ namespace NppiSize sz; sz.width = src.cols; sz.height = src.rows; - nppSafeCall( func(src.ptr(), src.step, dst.ptr(), dst.step, sz, NPP_RND_NEAR) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), dst.ptr(), static_cast(dst.step), sz, NPP_RND_NEAR) ); cudaSafeCall( cudaDeviceSynchronize() ); } @@ -347,7 +347,7 @@ namespace sz.width = src.cols; sz.height = src.rows; Scalar_ nppS = s; - nppSafeCall( func(nppS.val, src.ptr(), src.step, sz) ); + nppSafeCall( func(nppS.val, src.ptr(), static_cast(src.step), sz) ); cudaSafeCall( cudaDeviceSynchronize() ); } @@ -362,7 +362,7 @@ namespace sz.width = src.cols; sz.height = src.rows; Scalar_ nppS = s; - nppSafeCall( func(nppS[0], src.ptr(), src.step, sz) ); + nppSafeCall( func(nppS[0], src.ptr(), static_cast(src.step), sz) ); cudaSafeCall( cudaDeviceSynchronize() ); } @@ -398,7 +398,7 @@ namespace sz.width = src.cols; sz.height = src.rows; Scalar_ nppS = s; - nppSafeCall( func(nppS.val, src.ptr(), src.step, sz, mask.ptr(), mask.step) ); + nppSafeCall( func(nppS.val, src.ptr(), static_cast(src.step), sz, mask.ptr(), static_cast(mask.step)) ); cudaSafeCall( cudaDeviceSynchronize() ); } @@ -413,7 +413,7 @@ namespace sz.width = src.cols; sz.height = src.rows; Scalar_ nppS = s; - nppSafeCall( func(nppS[0], src.ptr(), src.step, sz, mask.ptr(), mask.step) ); + nppSafeCall( func(nppS[0], src.ptr(), static_cast(src.step), sz, mask.ptr(), static_cast(mask.step)) ); cudaSafeCall( cudaDeviceSynchronize() ); } diff --git a/modules/gpu/src/matrix_reductions.cpp b/modules/gpu/src/matrix_reductions.cpp index a2b4836924..04ed2c1d7c 100644 --- a/modules/gpu/src/matrix_reductions.cpp +++ b/modules/gpu/src/matrix_reductions.cpp @@ -116,7 +116,7 @@ void cv::gpu::meanStdDev(const GpuMat& src, Scalar& mean, Scalar& stddev) DeviceBuffer dbuf(2); - nppSafeCall( nppiMean_StdDev_8u_C1R(src.ptr(), src.step, sz, dbuf, (double*)dbuf + 1) ); + nppSafeCall( nppiMean_StdDev_8u_C1R(src.ptr(), static_cast(src.step), sz, dbuf, (double*)dbuf + 1) ); cudaSafeCall( cudaDeviceSynchronize() ); @@ -177,7 +177,7 @@ double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType) DeviceBuffer dbuf; - nppSafeCall( npp_norm_diff_func[funcIdx](src1.ptr(), src1.step, src2.ptr(), src2.step, sz, dbuf) ); + nppSafeCall( npp_norm_diff_func[funcIdx](src1.ptr(), static_cast(src1.step), src2.ptr(), static_cast(src2.step), sz, dbuf) ); cudaSafeCall( cudaDeviceSynchronize() ); @@ -409,7 +409,7 @@ void cv::gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const Gp double maxVal_; if (!maxVal) maxVal = &maxVal_; Size buf_size; - getBufSizeRequired(src.cols, src.rows, src.elemSize(), buf_size.width, buf_size.height); + getBufSizeRequired(src.cols, src.rows, static_cast(src.elemSize()), buf_size.width, buf_size.height); ensureSizeIsEnough(buf_size, CV_8U, buf); if (mask.empty()) @@ -510,7 +510,7 @@ void cv::gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point int maxLoc_[2]; Size valbuf_size, locbuf_size; - getBufSizeRequired(src.cols, src.rows, src.elemSize(), valbuf_size.width, + getBufSizeRequired(src.cols, src.rows, static_cast(src.elemSize()), valbuf_size.width, valbuf_size.height, locbuf_size.width, locbuf_size.height); ensureSizeIsEnough(valbuf_size, CV_8U, valBuf); ensureSizeIsEnough(locbuf_size, CV_8U, locBuf); diff --git a/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu b/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu index 03ecb57ec0..e0c766a3b6 100644 --- a/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu +++ b/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu @@ -1096,7 +1096,7 @@ NCVStatus ncvApplyHaarClassifierCascade_device(NCVMatrix &d_integralImag NCVVectorReuse d_vecPixelMask(d_pixelMask.getSegment(), anchorsRoi.height * d_pixelMask.stride()); ncvAssertReturn(d_vecPixelMask.isMemReused(), NCV_ALLOCATOR_BAD_REUSE); - NCVVectorAlloc d_vecPixelMaskTmp(gpuAllocator, d_vecPixelMask.length()); + NCVVectorAlloc d_vecPixelMaskTmp(gpuAllocator, static_cast(d_vecPixelMask.length())); ncvAssertReturn(d_vecPixelMaskTmp.isMemAllocated(), NCV_ALLOCATOR_BAD_ALLOC); NCVVectorAlloc hp_pool32u(cpuAllocator, 2); @@ -1120,7 +1120,7 @@ NCVStatus ncvApplyHaarClassifierCascade_device(NCVMatrix &d_integralImag NCVVector *d_ptrNowTmp = &d_vecPixelMaskTmp; Ncv32u szNppCompactTmpBuf; - nppsStCompactGetSize_32u(d_vecPixelMask.length(), &szNppCompactTmpBuf, devProp); + nppsStCompactGetSize_32u(static_cast(d_vecPixelMask.length()), &szNppCompactTmpBuf, devProp); if (bDoAtomicCompaction) { szNppCompactTmpBuf = 0; @@ -1206,7 +1206,7 @@ NCVStatus ncvApplyHaarClassifierCascade_device(NCVMatrix &d_integralImag gridInit, blockInit, cuStream, d_ptrNowData->ptr(), d_ptrNowTmp->ptr(), - d_vecPixelMask.length(), d_pixelMask.stride(), + static_cast(d_vecPixelMask.length()), d_pixelMask.stride(), anchorsRoi, pixelStep); ncvAssertCUDAReturn(cudaGetLastError(), NCV_CUDA_ERROR); @@ -1221,7 +1221,7 @@ NCVStatus ncvApplyHaarClassifierCascade_device(NCVMatrix &d_integralImag else { NCVStatus nppSt; - nppSt = nppsStCompact_32u(d_ptrNowTmp->ptr(), d_vecPixelMask.length(), + nppSt = nppsStCompact_32u(d_ptrNowTmp->ptr(), static_cast(d_vecPixelMask.length()), d_ptrNowData->ptr(), hp_numDet, OBJDET_MASK_ELEMENT_INVALID_32U, d_tmpBufCompact.ptr(), szNppCompactTmpBuf, devProp); ncvAssertReturn(nppSt == NPPST_SUCCESS, NCV_NPP_ERROR); @@ -1276,7 +1276,7 @@ NCVStatus ncvApplyHaarClassifierCascade_device(NCVMatrix &d_integralImag else { NCVStatus nppSt; - nppSt = nppsStCompact_32u(d_ptrNowData->ptr(), d_vecPixelMask.length(), + nppSt = nppsStCompact_32u(d_ptrNowData->ptr(), static_cast(d_vecPixelMask.length()), d_ptrNowTmp->ptr(), hp_numDet, OBJDET_MASK_ELEMENT_INVALID_32U, d_tmpBufCompact.ptr(), szNppCompactTmpBuf, devProp); ncvAssertReturnNcvStat(nppSt); @@ -1783,7 +1783,7 @@ NCVStatus ncvDetectObjectsMultiScale_device(NCVMatrix &d_srcImg, detectionsOnThisScale, d_hypothesesIntermediate, dstNumRects, - d_hypothesesIntermediate.length(), + static_cast(d_hypothesesIntermediate.length()), haar.ClassifierSize.width, haar.ClassifierSize.height, (Ncv32f)scale, @@ -1880,7 +1880,7 @@ NCVStatus ncvDetectObjectsMultiScale_device(NCVMatrix &d_srcImg, if (dstNumRects > d_dstRects.length()) { ncvRetCode = NCV_WARNING_HAAR_DETECTIONS_VECTOR_OVERFLOW; - dstNumRects = d_dstRects.length(); + dstNumRects = static_cast(d_dstRects.length()); } if (dstNumRects != 0) diff --git a/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu b/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu index f7cdfc6887..b0772d6359 100644 --- a/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu +++ b/modules/gpu/src/nvidia/NPP_staging/NPP_staging.cu @@ -457,7 +457,7 @@ NCVStatus nppiStIntegralGetSize_8u32u(NcvSize32u roiSize, Ncv32u *pBufsize, cuda ncvAssertReturn(pBufsize != NULL, NPPST_NULL_POINTER_ERROR); ncvAssertReturn(roiSize.width > 0 && roiSize.height > 0, NPPST_INVALID_ROI); - NCVMemStackAllocator gpuCounter(devProp.textureAlignment); + NCVMemStackAllocator gpuCounter(static_cast(devProp.textureAlignment)); ncvAssertReturn(gpuCounter.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = ncvIntegralImage_device((Ncv8u*)NULL, roiSize.width, @@ -475,7 +475,7 @@ NCVStatus nppiStIntegralGetSize_32f32f(NcvSize32u roiSize, Ncv32u *pBufsize, cud ncvAssertReturn(pBufsize != NULL, NPPST_NULL_POINTER_ERROR); ncvAssertReturn(roiSize.width > 0 && roiSize.height > 0, NPPST_INVALID_ROI); - NCVMemStackAllocator gpuCounter(devProp.textureAlignment); + NCVMemStackAllocator gpuCounter(static_cast(devProp.textureAlignment)); ncvAssertReturn(gpuCounter.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = ncvIntegralImage_device((Ncv32f*)NULL, roiSize.width * sizeof(Ncv32f), @@ -493,7 +493,7 @@ NCVStatus nppiStSqrIntegralGetSize_8u64u(NcvSize32u roiSize, Ncv32u *pBufsize, c ncvAssertReturn(pBufsize != NULL, NPPST_NULL_POINTER_ERROR); ncvAssertReturn(roiSize.width > 0 && roiSize.height > 0, NPPST_INVALID_ROI); - NCVMemStackAllocator gpuCounter(devProp.textureAlignment); + NCVMemStackAllocator gpuCounter(static_cast(devProp.textureAlignment)); ncvAssertReturn(gpuCounter.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = ncvSquaredIntegralImage_device(NULL, roiSize.width, @@ -511,7 +511,7 @@ NCVStatus nppiStIntegral_8u32u_C1R(Ncv8u *d_src, Ncv32u srcStep, NcvSize32u roiSize, Ncv8u *pBuffer, Ncv32u bufSize, cudaDeviceProp &devProp) { - NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, devProp.textureAlignment, pBuffer); + NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast(devProp.textureAlignment), pBuffer); ncvAssertReturn(gpuAllocator.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = ncvIntegralImage_device(d_src, srcStep, d_dst, dstStep, roiSize, gpuAllocator); @@ -526,7 +526,7 @@ NCVStatus nppiStIntegral_32f32f_C1R(Ncv32f *d_src, Ncv32u srcStep, NcvSize32u roiSize, Ncv8u *pBuffer, Ncv32u bufSize, cudaDeviceProp &devProp) { - NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, devProp.textureAlignment, pBuffer); + NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast(devProp.textureAlignment), pBuffer); ncvAssertReturn(gpuAllocator.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = ncvIntegralImage_device(d_src, srcStep, d_dst, dstStep, roiSize, gpuAllocator); @@ -541,7 +541,7 @@ NCVStatus nppiStSqrIntegral_8u64u_C1R(Ncv8u *d_src, Ncv32u srcStep, NcvSize32u roiSize, Ncv8u *pBuffer, Ncv32u bufSize, cudaDeviceProp &devProp) { - NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, devProp.textureAlignment, pBuffer); + NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast(devProp.textureAlignment), pBuffer); ncvAssertReturn(gpuAllocator.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = ncvSquaredIntegralImage_device(d_src, srcStep, d_dst, dstStep, roiSize, gpuAllocator); @@ -1506,7 +1506,7 @@ NCVStatus nppsStCompactGetSize_32u(Ncv32u srcLen, Ncv32u *pBufsize, cudaDevicePr return NPPST_SUCCESS; } - NCVMemStackAllocator gpuCounter(devProp.textureAlignment); + NCVMemStackAllocator gpuCounter(static_cast(devProp.textureAlignment)); ncvAssertReturn(gpuCounter.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = compactVector_32u_device(NULL, srcLen, NULL, NULL, 0xC001C0DE, @@ -1535,7 +1535,7 @@ NCVStatus nppsStCompact_32u(Ncv32u *d_src, Ncv32u srcLen, Ncv32u elemRemove, Ncv8u *pBuffer, Ncv32u bufSize, cudaDeviceProp &devProp) { - NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, devProp.textureAlignment, pBuffer); + NCVMemStackAllocator gpuAllocator(NCVMemoryTypeDevice, bufSize, static_cast(devProp.textureAlignment), pBuffer); ncvAssertReturn(gpuAllocator.isInitialized(), NPPST_MEM_INTERNAL_ERROR); NCVStatus ncvStat = compactVector_32u_device(d_src, srcLen, d_dst, p_dstLen, elemRemove, diff --git a/modules/gpu/src/nvidia/core/NCV.cu b/modules/gpu/src/nvidia/core/NCV.cu index 3078219c2e..6b55740aba 100644 --- a/modules/gpu/src/nvidia/core/NCV.cu +++ b/modules/gpu/src/nvidia/core/NCV.cu @@ -355,7 +355,7 @@ NCVStatus NCVMemStackAllocator::alloc(NCVMemSegment &seg, size_t size) seg.clear(); ncvAssertReturn(isInitialized(), NCV_ALLOCATOR_BAD_ALLOC); - size = alignUp(size, this->_alignment); + size = alignUp(static_cast(size), this->_alignment); this->currentSize += size; this->_maxSize = std::max(this->_maxSize, this->currentSize); @@ -464,7 +464,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size) break; } - this->currentSize += alignUp(size, this->_alignment); + this->currentSize += alignUp(static_cast(size), this->_alignment); this->_maxSize = std::max(this->_maxSize, this->currentSize); seg.begin.memtype = this->_memType; @@ -480,8 +480,8 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg) ncvAssertReturn(seg.begin.memtype == this->_memType, NCV_ALLOCATOR_BAD_DEALLOC); ncvAssertReturn(seg.begin.ptr != NULL, NCV_ALLOCATOR_BAD_DEALLOC); - ncvAssertReturn(currentSize >= alignUp(seg.size, this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC); - currentSize -= alignUp(seg.size, this->_alignment); + ncvAssertReturn(currentSize >= alignUp(static_cast(seg.size), this->_alignment), NCV_ALLOCATOR_BAD_DEALLOC); + currentSize -= alignUp(static_cast(seg.size), this->_alignment); switch (this->_memType) { diff --git a/modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp b/modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp index 7539e8bfb2..45185deb49 100644 --- a/modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp +++ b/modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp @@ -92,7 +92,7 @@ namespace cv { namespace gpu { namespace device template struct BrdColReflect101 : BrdReflect101 { - BrdColReflect101(int len, int step): BrdReflect101(len), step(step) {} + BrdColReflect101(int len, size_t step): BrdReflect101(len), step(step) {} template __device__ __forceinline__ D at_low(int i, const T* data) const { @@ -104,7 +104,7 @@ namespace cv { namespace gpu { namespace device return saturate_cast(*(const D*)((const char*)data + idx_high(i)*step)); } - int step; + size_t step; }; struct BrdReplicate @@ -152,7 +152,7 @@ namespace cv { namespace gpu { namespace device template struct BrdColReplicate : BrdReplicate { - BrdColReplicate(int len, int step): BrdReplicate(len), step(step) {} + BrdColReplicate(int len, size_t step): BrdReplicate(len), step(step) {} template __device__ __forceinline__ D at_low(int i, const T* data) const { @@ -164,7 +164,7 @@ namespace cv { namespace gpu { namespace device return saturate_cast(*(const D*)((const char*)data + idx_high(i)*step)); } - int step; + size_t step; }; template struct BrdRowConstant @@ -192,7 +192,7 @@ namespace cv { namespace gpu { namespace device template struct BrdColConstant { - BrdColConstant(int len_, int step_, const D& val_ = VecTraits::all(0)): len(len_), step(step_), val(val_) {} + BrdColConstant(int len_, size_t step_, const D& val_ = VecTraits::all(0)): len(len_), step(step_), val(val_) {} template __device__ __forceinline__ D at_low(int i, const T* data) const { @@ -210,7 +210,7 @@ namespace cv { namespace gpu { namespace device } int len; - int step; + size_t step; D val; }; diff --git a/modules/gpu/src/split_merge.cpp b/modules/gpu/src/split_merge.cpp index 3b3a3120b0..a8785d43ca 100644 --- a/modules/gpu/src/split_merge.cpp +++ b/modules/gpu/src/split_merge.cpp @@ -56,11 +56,11 @@ void cv::gpu::split(const GpuMat& /*src*/, vector& /*dst*/, Stream& /*st namespace cv { namespace gpu { namespace split_merge { extern "C" void merge_caller(const DevMem2D* src, DevMem2D& dst, - int total_channels, int elem_size, + int total_channels, size_t elem_size, const cudaStream_t& stream); extern "C" void split_caller(const DevMem2D& src, DevMem2D* dst, - int num_channels, int elem_size1, + int num_channels, size_t elem_size1, const cudaStream_t& stream); void merge(const GpuMat* src, size_t n, GpuMat& dst, const cudaStream_t& stream) diff --git a/modules/gpu/src/stereocsbp.cpp b/modules/gpu/src/stereocsbp.cpp index cf02993028..d026ebb47d 100644 --- a/modules/gpu/src/stereocsbp.cpp +++ b/modules/gpu/src/stereocsbp.cpp @@ -167,7 +167,7 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat u[2], GpuMat d[2] nr_plane_pyr[0] = rthis.nr_plane; const int n = 64; - step_pyr[0] = alignSize(cols * sizeof(T), n) / sizeof(T); + step_pyr[0] = static_cast(alignSize(cols * sizeof(T), n) / sizeof(T)); for (int i = 1; i < levels; i++) { cols_pyr[i] = (cols_pyr[i-1] + 1) / 2; @@ -175,7 +175,7 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat u[2], GpuMat d[2] nr_plane_pyr[i] = nr_plane_pyr[i-1] * 2; - step_pyr[i] = alignSize(cols_pyr[i] * sizeof(T), n) / sizeof(T); + step_pyr[i] = static_cast(alignSize(cols_pyr[i] * sizeof(T), n) / sizeof(T)); } Size msg_size(step_pyr[0], rows * nr_plane_pyr[0]); @@ -197,7 +197,7 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat u[2], GpuMat d[2] data_cost.create(data_cost_size, DataType::type); data_cost_selected.create(msg_size, DataType::type); - step_pyr[0] = data_cost.step / sizeof(T); + step_pyr[0] = static_cast(data_cost.step / sizeof(T)); Size temp_size = data_cost_size; if (data_cost_size.width * data_cost_size.height < step_pyr[levels - 1] * rows_pyr[levels - 1] * rthis.ndisp) diff --git a/modules/gpu/src/surf.cpp b/modules/gpu/src/surf.cpp index 5ebe73919a..f4c641a98c 100644 --- a/modules/gpu/src/surf.cpp +++ b/modules/gpu/src/surf.cpp @@ -260,7 +260,7 @@ void cv::gpu::SURF_GPU::uploadKeypoints(const vector& keypoints, GpuMa keypointsGPU.release(); else { - Mat keypointsCPU(SURF_GPU::SF_FEATURE_STRIDE, keypoints.size(), CV_32FC1); + Mat keypointsCPU(SURF_GPU::SF_FEATURE_STRIDE, static_cast(keypoints.size()), CV_32FC1); float* kp_x = keypointsCPU.ptr(SURF_GPU::SF_X); float* kp_y = keypointsCPU.ptr(SURF_GPU::SF_Y);