1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-21 23:01:45 +08:00

cudaarithm: fix the compile faiure of CUDA 12.4.x .

A slight API change of NPP nppiMeanStdDevGetBufferHostSize_8u_C1R
The type of bufSize is size_t instead of int in CUDA 12.4.x
This commit is contained in:
sdy623
2024-04-23 21:43:40 +09:00
parent ac994ed2b5
commit 4e766a039e

View File

@@ -151,7 +151,12 @@ void cv::cuda::meanStdDev(InputArray src, OutputArray dst, Stream& stream)
sz.width = gsrc.cols; sz.width = gsrc.cols;
sz.height = gsrc.rows; sz.height = gsrc.rows;
#if (CUDA_VERSION >= 12040)
size_t bufSize;
#else
int bufSize; int bufSize;
#endif
#if (CUDA_VERSION <= 4020) #if (CUDA_VERSION <= 4020)
nppSafeCall( nppiMeanStdDev8uC1RGetBufferHostSize(sz, &bufSize) ); nppSafeCall( nppiMeanStdDev8uC1RGetBufferHostSize(sz, &bufSize) );
#else #else
@@ -162,7 +167,8 @@ void cv::cuda::meanStdDev(InputArray src, OutputArray dst, Stream& stream)
#endif #endif
BufferPool pool(stream); BufferPool pool(stream);
GpuMat buf = pool.getBuffer(1, bufSize, gsrc.type()); CV_Assert(bufSize <= std::numeric_limits<int>::max());
GpuMat buf = pool.getBuffer(1, static_cast<int>(bufSize), gsrc.type());
// detail: https://github.com/opencv/opencv/issues/11063 // detail: https://github.com/opencv/opencv/issues/11063
//NppStreamHandler h(StreamAccessor::getStream(stream)); //NppStreamHandler h(StreamAccessor::getStream(stream));
@@ -227,7 +233,12 @@ void cv::cuda::meanStdDev(InputArray src, OutputArray dst, InputArray mask, Stre
sz.width = gsrc.cols; sz.width = gsrc.cols;
sz.height = gsrc.rows; sz.height = gsrc.rows;
#if (CUDA_VERSION >= 12040)
size_t bufSize;
#else
int bufSize; int bufSize;
#endif
#if (CUDA_VERSION <= 4020) #if (CUDA_VERSION <= 4020)
nppSafeCall( nppiMeanStdDev8uC1MRGetBufferHostSize(sz, &bufSize) ); nppSafeCall( nppiMeanStdDev8uC1MRGetBufferHostSize(sz, &bufSize) );
#else #else
@@ -238,7 +249,8 @@ void cv::cuda::meanStdDev(InputArray src, OutputArray dst, InputArray mask, Stre
#endif #endif
BufferPool pool(stream); BufferPool pool(stream);
GpuMat buf = pool.getBuffer(1, bufSize, gsrc.type()); CV_Assert(bufSize <= std::numeric_limits<int>::max());
GpuMat buf = pool.getBuffer(1, static_cast<int>(bufSize), gsrc.type());
if(gsrc.type() == CV_8UC1) if(gsrc.type() == CV_8UC1)
nppSafeCall( nppiMean_StdDev_8u_C1MR(gsrc.ptr<Npp8u>(), static_cast<int>(gsrc.step), gmask.ptr<Npp8u>(), static_cast<int>(gmask.step), nppSafeCall( nppiMean_StdDev_8u_C1MR(gsrc.ptr<Npp8u>(), static_cast<int>(gsrc.step), gmask.ptr<Npp8u>(), static_cast<int>(gmask.step),