From 9210d8e542bf344a2319a21e2d077d4a616de1c8 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 18 Dec 2014 18:02:58 +0300 Subject: [PATCH] move allocMatFromBuf function to farneback.cpp: * it is the only place, where it is used * no need to make this function public --- modules/core/include/opencv2/core/cuda.hpp | 2 -- modules/core/src/cuda_gpu_mat.cpp | 8 -------- modules/cudaoptflow/src/farneback.cpp | 10 ++++++++++ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index 15d526e802..7f18513686 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -314,8 +314,6 @@ The function does not reallocate memory if the matrix has proper attributes alre */ 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); diff --git a/modules/core/src/cuda_gpu_mat.cpp b/modules/core/src/cuda_gpu_mat.cpp index 803b21069d..1dadc0ab34 100644 --- a/modules/core/src/cuda_gpu_mat.cpp +++ b/modules/core/src/cuda_gpu_mat.cpp @@ -342,14 +342,6 @@ void cv::cuda::ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr) } } -GpuMat cv::cuda::allocMatFromBuf(int rows, int cols, int type, GpuMat& mat) -{ - if (!mat.empty() && mat.type() == type && mat.rows >= rows && mat.cols >= cols) - return mat(Rect(0, 0, cols, rows)); - - return mat = GpuMat(rows, cols, type); -} - #ifndef HAVE_CUDA GpuMat::Allocator* cv::cuda::GpuMat::defaultAllocator() diff --git a/modules/cudaoptflow/src/farneback.cpp b/modules/cudaoptflow/src/farneback.cpp index dc52035255..6b74432632 100644 --- a/modules/cudaoptflow/src/farneback.cpp +++ b/modules/cudaoptflow/src/farneback.cpp @@ -95,6 +95,16 @@ namespace cv { namespace cuda { namespace device { namespace optflow_farneback }}}} // namespace cv { namespace cuda { namespace cudev { namespace optflow_farneback +namespace +{ + GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat& mat) + { + if (!mat.empty() && mat.type() == type && mat.rows >= rows && mat.cols >= cols) + return mat(Rect(0, 0, cols, rows)); + + return mat = GpuMat(rows, cols, type); + } +} void cv::cuda::FarnebackOpticalFlow::prepareGaussian( int n, double sigma, float *g, float *xg, float *xxg,