From 55cb26551fa66f5562ee1f91b8097fd74dedbf2f Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Fri, 2 Aug 2013 09:05:21 +0400 Subject: [PATCH] use NPP version for Fermi --- modules/gpu/src/cuda/hist.cu | 2 +- modules/gpu/src/imgproc.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/gpu/src/cuda/hist.cu b/modules/gpu/src/cuda/hist.cu index d9ba559f9c..d0ec257c47 100644 --- a/modules/gpu/src/cuda/hist.cu +++ b/modules/gpu/src/cuda/hist.cu @@ -120,7 +120,7 @@ namespace hist } } - __global__ void histEven8u(const uchar* src, const size_t step, const int rows, const int cols, + __global__ void histEven8u(const uchar* src, const size_t step, const int rows, const int cols, int* hist, const int binCount, const int binSize, const int lowerLevel, const int upperLevel) { extern __shared__ int shist[]; diff --git a/modules/gpu/src/imgproc.cpp b/modules/gpu/src/imgproc.cpp index 23523630ba..1904b6aad6 100644 --- a/modules/gpu/src/imgproc.cpp +++ b/modules/gpu/src/imgproc.cpp @@ -896,7 +896,7 @@ namespace hist namespace { - void histEven8u(const GpuMat& src, GpuMat& hist, GpuMat&, int histSize, int lowerLevel, int upperLevel, cudaStream_t stream) + void histEven8u(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel, cudaStream_t stream) { hist.create(1, histSize, CV_32S); cudaSafeCall( cudaMemsetAsync(hist.data, 0, histSize * sizeof(int), stream) ); @@ -911,12 +911,18 @@ void cv::gpu::histEven(const GpuMat& src, GpuMat& hist, GpuMat& buf, int histSiz typedef void (*hist_t)(const GpuMat& src, GpuMat& hist, GpuMat& buf, int levels, int lowerLevel, int upperLevel, cudaStream_t stream); static const hist_t hist_callers[] = { - histEven8u, + NppHistogramEvenC1::hist, 0, NppHistogramEvenC1::hist, NppHistogramEvenC1::hist }; + if (src.depth() == CV_8U && deviceSupports(FEATURE_SET_COMPUTE_30)) + { + histEven8u(src, hist, histSize, lowerLevel, upperLevel, StreamAccessor::getStream(stream)); + return; + } + hist_callers[src.depth()](src, hist, buf, histSize, lowerLevel, upperLevel, StreamAccessor::getStream(stream)); }