From 3b412b51acd855a973a1fadad84793e248bb3c13 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Mon, 7 Oct 2013 18:31:33 +0400 Subject: [PATCH] moved BufferPool management functions to public --- modules/core/include/opencv2/core/cuda.hpp | 4 ++++ modules/core/include/opencv2/core/private.cuda.hpp | 3 --- modules/core/src/cuda_buffer_pool.cpp | 4 ++-- modules/cuda/perf/perf_buffer_pool.cpp | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index 1911959d6..a92cf7913 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -276,6 +276,10 @@ CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr CV_EXPORTS GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat& mat); +//! BufferPool management (must be called before Stream creation) +CV_EXPORTS void setBufferPoolUsage(bool on); +CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount); + //////////////////////////////// CudaMem //////////////////////////////// // CudaMem is limited cv::Mat with page locked memory allocation. diff --git a/modules/core/include/opencv2/core/private.cuda.hpp b/modules/core/include/opencv2/core/private.cuda.hpp index 20888849d..5edacc666 100644 --- a/modules/core/include/opencv2/core/private.cuda.hpp +++ b/modules/core/include/opencv2/core/private.cuda.hpp @@ -122,9 +122,6 @@ namespace cv { namespace cuda GpuMat::Allocator* allocator_; }; - CV_EXPORTS void setBufferAllocatorUsage(bool on); - CV_EXPORTS void allocateMemoryPool(int deviceId, size_t stackSize, int stackCount); - static inline void checkNppError(int code, const char* file, const int line, const char* func) { if (code < 0) diff --git a/modules/core/src/cuda_buffer_pool.cpp b/modules/core/src/cuda_buffer_pool.cpp index dd24f4f2d..28eaaa26f 100644 --- a/modules/core/src/cuda_buffer_pool.cpp +++ b/modules/core/src/cuda_buffer_pool.cpp @@ -378,12 +378,12 @@ void cv::cuda::StackAllocator::free(uchar* devPtr, int* refcount) fastFree(refcount); } -void cv::cuda::setBufferAllocatorUsage(bool on) +void cv::cuda::setBufferPoolUsage(bool on) { enableMemoryPool = on; } -void cv::cuda::allocateMemoryPool(int deviceId, size_t stackSize, int stackCount) +void cv::cuda::setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount) { const int currentDevice = getDevice(); diff --git a/modules/cuda/perf/perf_buffer_pool.cpp b/modules/cuda/perf/perf_buffer_pool.cpp index 7a0dca389..72bd47a07 100644 --- a/modules/cuda/perf/perf_buffer_pool.cpp +++ b/modules/cuda/perf/perf_buffer_pool.cpp @@ -95,10 +95,10 @@ PERF_TEST_P(Sz, BufferPool, CUDA_TYPICAL_MAT_SIZES) GpuMat src1(host_src), src2(host_src); GpuMat dst; - setBufferAllocatorUsage(useBufferPool); + setBufferPoolUsage(useBufferPool); if (useBufferPool && first) { - allocateMemoryPool(-1, 25 * 1024 * 1024, 2); + setBufferPoolConfig(-1, 25 * 1024 * 1024, 2); first = false; }