From: https://gitlab.archlinux.org/archlinux/packaging/packages/opencv/-/blob/main/fix-nppi-bufsize-type.patch?ref_type=heads --- a/modules/cudaarithm/src/reductions.cpp 2023-12-26 22:24:58.000000000 +0100 +++ b/modules/cudaarithm/src/reductions.cpp 2024-03-18 16:51:32.108049155 +0100 @@ -151,7 +151,7 @@ sz.width = gsrc.cols; sz.height = gsrc.rows; - int bufSize; + size_t bufSize; #if (CUDA_VERSION <= 4020) nppSafeCall( nppiMeanStdDev8uC1RGetBufferHostSize(sz, &bufSize) ); #else @@ -227,7 +227,7 @@ sz.width = gsrc.cols; sz.height = gsrc.rows; - int bufSize; + size_t bufSize; #if (CUDA_VERSION <= 4020) nppSafeCall( nppiMeanStdDev8uC1MRGetBufferHostSize(sz, &bufSize) ); #else --- a/modules/cudaimgproc/src/histogram.cpp 2023-12-26 22:24:58.000000000 +0100 +++ b/modules/cudaimgproc/src/histogram.cpp 2024-03-18 17:51:37.005208948 +0100 @@ -281,8 +281,8 @@ namespace { - typedef NppStatus (*get_buf_size_c1_t)(NppiSize oSizeROI, int nLevels, int* hpBufferSize); - typedef NppStatus (*get_buf_size_c4_t)(NppiSize oSizeROI, int nLevels[], int* hpBufferSize); + typedef NppStatus (*get_buf_size_c1_t)(NppiSize oSizeROI, int nLevels, size_t* hpBufferSize); + typedef NppStatus (*get_buf_size_c4_t)(NppiSize oSizeROI, int nLevels[], size_t* hpBufferSize); template struct NppHistogramEvenFuncC1 { @@ -315,7 +315,7 @@ sz.width = src.cols; sz.height = src.rows; - int buf_size; + size_t buf_size; get_buf_size(sz, levels, &buf_size); BufferPool pool(stream); @@ -349,7 +349,7 @@ Npp32s* pHist[] = {hist[0].ptr(), hist[1].ptr(), hist[2].ptr(), hist[3].ptr()}; - int buf_size; + size_t buf_size; get_buf_size(sz, levels, &buf_size); BufferPool pool(stream); @@ -419,7 +419,7 @@ sz.width = src.cols; sz.height = src.rows; - int buf_size; + size_t buf_size; get_buf_size(sz, levels.cols, &buf_size); BufferPool pool(stream); @@ -460,7 +460,7 @@ sz.width = src.cols; sz.height = src.rows; - int buf_size; + size_t buf_size; get_buf_size(sz, nLevels, &buf_size); BufferPool pool(stream);