Commit 9060365f authored by yao's avatar yao Committed by Andrey Kamaev

use format on filtering.cpp

parent 56c1a7fa
...@@ -170,100 +170,100 @@ void cv::ocl::morphologyEx( const oclMat &, oclMat &, int, const Mat &, Point, i ...@@ -170,100 +170,100 @@ void cv::ocl::morphologyEx( const oclMat &, oclMat &, int, const Mat &, Point, i
//helper routines //helper routines
namespace cv namespace cv
{ {
namespace ocl namespace ocl
{ {
///////////////////////////OpenCL kernel strings/////////////////////////// ///////////////////////////OpenCL kernel strings///////////////////////////
extern const char *filtering_boxFilter; extern const char *filtering_boxFilter;
extern const char *filter_sep_row; extern const char *filter_sep_row;
extern const char *filter_sep_col; extern const char *filter_sep_col;
extern const char *filtering_laplacian; extern const char *filtering_laplacian;
extern const char *filtering_morph; extern const char *filtering_morph;
} }
} }
namespace namespace
{ {
inline int divUp(int total, int grain) inline int divUp(int total, int grain)
{ {
return (total + grain - 1) / grain; return (total + grain - 1) / grain;
} }
} }
namespace namespace
{ {
inline void normalizeAnchor(int &anchor, int ksize) inline void normalizeAnchor(int &anchor, int ksize)
{ {
if (anchor < 0) if (anchor < 0)
anchor = ksize >> 1; anchor = ksize >> 1;
CV_Assert(0 <= anchor && anchor < ksize); CV_Assert(0 <= anchor && anchor < ksize);
} }
inline void normalizeAnchor(Point &anchor, const Size &ksize) inline void normalizeAnchor(Point &anchor, const Size &ksize)
{ {
normalizeAnchor(anchor.x, ksize.width); normalizeAnchor(anchor.x, ksize.width);
normalizeAnchor(anchor.y, ksize.height); normalizeAnchor(anchor.y, ksize.height);
} }
inline void normalizeROI(Rect &roi, const Size &ksize, const Point &anchor, const Size &src_size) inline void normalizeROI(Rect &roi, const Size &ksize, const Point &anchor, const Size &src_size)
{ {
if (roi == Rect(0, 0, -1, -1)) if (roi == Rect(0, 0, -1, -1))
roi = Rect(0, 0, src_size.width, src_size.height); roi = Rect(0, 0, src_size.width, src_size.height);
CV_Assert(ksize.height > 0 && ksize.width > 0 && ((ksize.height & 1) == 1) && ((ksize.width & 1) == 1)); CV_Assert(ksize.height > 0 && ksize.width > 0 && ((ksize.height & 1) == 1) && ((ksize.width & 1) == 1));
CV_Assert((anchor.x == -1 && anchor.y == -1) || (anchor.x == ksize.width >> 1 && anchor.y == ksize.height >> 1)); CV_Assert((anchor.x == -1 && anchor.y == -1) || (anchor.x == ksize.width >> 1 && anchor.y == ksize.height >> 1));
CV_Assert(roi.x >= 0 && roi.y >= 0 && roi.width <= src_size.width && roi.height <= src_size.height); CV_Assert(roi.x >= 0 && roi.y >= 0 && roi.width <= src_size.width && roi.height <= src_size.height);
} }
inline void normalizeKernel(const Mat &kernel, oclMat &gpu_krnl, int type = CV_8U, int *nDivisor = 0, bool reverse = false) inline void normalizeKernel(const Mat &kernel, oclMat &gpu_krnl, int type = CV_8U, int *nDivisor = 0, bool reverse = false)
{ {
int scale = nDivisor && (kernel.depth() == CV_32F || kernel.depth() == CV_64F) ? 256 : 1; int scale = nDivisor && (kernel.depth() == CV_32F || kernel.depth() == CV_64F) ? 256 : 1;
if (nDivisor) *nDivisor = scale; if (nDivisor) *nDivisor = scale;
Mat temp(kernel.size(), type); Mat temp(kernel.size(), type);
kernel.convertTo(temp, type, scale); kernel.convertTo(temp, type, scale);
Mat cont_krnl = temp.reshape(1, 1); Mat cont_krnl = temp.reshape(1, 1);
if (reverse) if (reverse)
{
int count = cont_krnl.cols >> 1;
for (int i = 0; i < count; ++i)
{ {
int count = cont_krnl.cols >> 1; std::swap(cont_krnl.at<int>(0, i), cont_krnl.at<int>(0, cont_krnl.cols - 1 - i));
for (int i = 0; i < count; ++i)
{
std::swap(cont_krnl.at<int>(0, i), cont_krnl.at<int>(0, cont_krnl.cols - 1 - i));
}
} }
gpu_krnl.upload(cont_krnl);
} }
gpu_krnl.upload(cont_krnl);
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Filter2D // Filter2D
namespace namespace
{ {
class Filter2DEngine_GPU : public FilterEngine_GPU class Filter2DEngine_GPU : public FilterEngine_GPU
{ {
public: public:
Filter2DEngine_GPU(const Ptr<BaseFilter_GPU> &filter2D_) : filter2D(filter2D_) {} Filter2DEngine_GPU(const Ptr<BaseFilter_GPU> &filter2D_) : filter2D(filter2D_) {}
virtual void apply(const oclMat &src, oclMat &dst, Rect roi = Rect(0, 0, -1, -1)) virtual void apply(const oclMat &src, oclMat &dst, Rect roi = Rect(0, 0, -1, -1))
{ {
Size src_size = src.size(); Size src_size = src.size();
// Delete those two clause below which exist before, However, the result is alos correct // Delete those two clause below which exist before, However, the result is alos correct
// dst.create(src_size, src.type()); // dst.create(src_size, src.type());
// dst = Scalar(0.0); // dst = Scalar(0.0);
normalizeROI(roi, filter2D->ksize, filter2D->anchor, src_size); normalizeROI(roi, filter2D->ksize, filter2D->anchor, src_size);
oclMat srcROI = src(roi); oclMat srcROI = src(roi);
oclMat dstROI = dst(roi); oclMat dstROI = dst(roi);
(*filter2D)(srcROI, dstROI); (*filter2D)(srcROI, dstROI);
} }
Ptr<BaseFilter_GPU> filter2D; Ptr<BaseFilter_GPU> filter2D;
}; };
} }
Ptr<FilterEngine_GPU> cv::ocl::createFilter2D_GPU(const Ptr<BaseFilter_GPU> filter2D) Ptr<FilterEngine_GPU> cv::ocl::createFilter2D_GPU(const Ptr<BaseFilter_GPU> filter2D)
...@@ -275,22 +275,22 @@ Ptr<FilterEngine_GPU> cv::ocl::createFilter2D_GPU(const Ptr<BaseFilter_GPU> filt ...@@ -275,22 +275,22 @@ Ptr<FilterEngine_GPU> cv::ocl::createFilter2D_GPU(const Ptr<BaseFilter_GPU> filt
// Box Filter // Box Filter
namespace namespace
{ {
typedef void (*FilterBox_t)(const oclMat & , oclMat & , Size &, const Point, const int); typedef void (*FilterBox_t)(const oclMat & , oclMat & , Size &, const Point, const int);
class GPUBoxFilter : public BaseFilter_GPU class GPUBoxFilter : public BaseFilter_GPU
{ {
public: public:
GPUBoxFilter(const Size &ksize_, const Point &anchor_, const int borderType_, FilterBox_t func_) : GPUBoxFilter(const Size &ksize_, const Point &anchor_, const int borderType_, FilterBox_t func_) :
BaseFilter_GPU(ksize_, anchor_, borderType_), func(func_) {} BaseFilter_GPU(ksize_, anchor_, borderType_), func(func_) {}
virtual void operator()(const oclMat &src, oclMat &dst) virtual void operator()(const oclMat &src, oclMat &dst)
{ {
func(src, dst, ksize, anchor, borderType); func(src, dst, ksize, anchor, borderType);
} }
FilterBox_t func; FilterBox_t func;
}; };
} }
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -298,22 +298,22 @@ namespace ...@@ -298,22 +298,22 @@ namespace
namespace namespace
{ {
typedef void (*GPUMorfFilter_t)(const oclMat & , oclMat & , oclMat & , Size &, const Point); typedef void (*GPUMorfFilter_t)(const oclMat & , oclMat & , oclMat & , Size &, const Point);
class MorphFilter_GPU : public BaseFilter_GPU class MorphFilter_GPU : public BaseFilter_GPU
{ {
public: public:
MorphFilter_GPU(const Size &ksize_, const Point &anchor_, const oclMat &kernel_, GPUMorfFilter_t func_) : MorphFilter_GPU(const Size &ksize_, const Point &anchor_, const oclMat &kernel_, GPUMorfFilter_t func_) :
BaseFilter_GPU(ksize_, anchor_, BORDER_CONSTANT), kernel(kernel_), func(func_) {} BaseFilter_GPU(ksize_, anchor_, BORDER_CONSTANT), kernel(kernel_), func(func_) {}
virtual void operator()(const oclMat &src, oclMat &dst) virtual void operator()(const oclMat &src, oclMat &dst)
{ {
func(src, dst, kernel, ksize, anchor) ; func(src, dst, kernel, ksize, anchor) ;
} }
oclMat kernel; oclMat kernel;
GPUMorfFilter_t func; GPUMorfFilter_t func;
}; };
} }
/* /*
...@@ -483,47 +483,47 @@ Ptr<BaseFilter_GPU> cv::ocl::getMorphologyFilter_GPU(int op, int type, const Mat ...@@ -483,47 +483,47 @@ Ptr<BaseFilter_GPU> cv::ocl::getMorphologyFilter_GPU(int op, int type, const Mat
namespace namespace
{ {
class MorphologyFilterEngine_GPU : public Filter2DEngine_GPU class MorphologyFilterEngine_GPU : public Filter2DEngine_GPU
{ {
public: public:
MorphologyFilterEngine_GPU(const Ptr<BaseFilter_GPU> &filter2D_, int iters_) : MorphologyFilterEngine_GPU(const Ptr<BaseFilter_GPU> &filter2D_, int iters_) :
Filter2DEngine_GPU(filter2D_), iters(iters_) {} Filter2DEngine_GPU(filter2D_), iters(iters_) {}
virtual void apply(const oclMat &src, oclMat &dst) virtual void apply(const oclMat &src, oclMat &dst)
{
Filter2DEngine_GPU::apply(src, dst);
//if (iters > 1)
//{
// Size wholesize;
// Point ofs;
// dst.locateROI(wholesize,ofs);
// int rows = dst.rows, cols = dst.cols;
// dst.adjustROI(ofs.y,-ofs.y-rows+dst.wholerows,ofs.x,-ofs.x-cols+dst.wholecols);
// dst.copyTo(morfBuf);
// dst.adjustROI(-ofs.y,ofs.y+rows-dst.wholerows,-ofs.x,ofs.x+cols-dst.wholecols);
// morfBuf.adjustROI(-ofs.y,ofs.y+rows-dst.wholerows,-ofs.x,ofs.x+cols-dst.wholecols);
// //morfBuf.create(src.size(),src.type());
// //Filter2DEngine_GPU::apply(dst, morfBuf);
// //morfBuf.copyTo(dst);
//}
for(int i = 1; i < iters; ++i)
{ {
Filter2DEngine_GPU::apply(src, dst); //dst.swap(morfBuf);
//if (iters > 1) Size wholesize;
//{ Point ofs;
// Size wholesize; dst.locateROI(wholesize, ofs);
// Point ofs; int rows = dst.rows, cols = dst.cols;
// dst.locateROI(wholesize,ofs); dst.adjustROI(ofs.y, -ofs.y - rows + dst.wholerows, ofs.x, -ofs.x - cols + dst.wholecols);
// int rows = dst.rows, cols = dst.cols; dst.copyTo(morfBuf);
// dst.adjustROI(ofs.y,-ofs.y-rows+dst.wholerows,ofs.x,-ofs.x-cols+dst.wholecols); dst.adjustROI(-ofs.y, ofs.y + rows - dst.wholerows, -ofs.x, ofs.x + cols - dst.wholecols);
// dst.copyTo(morfBuf); morfBuf.adjustROI(-ofs.y, ofs.y + rows - dst.wholerows, -ofs.x, ofs.x + cols - dst.wholecols);
// dst.adjustROI(-ofs.y,ofs.y+rows-dst.wholerows,-ofs.x,ofs.x+cols-dst.wholecols); Filter2DEngine_GPU::apply(morfBuf, dst);
// morfBuf.adjustROI(-ofs.y,ofs.y+rows-dst.wholerows,-ofs.x,ofs.x+cols-dst.wholecols);
// //morfBuf.create(src.size(),src.type());
// //Filter2DEngine_GPU::apply(dst, morfBuf);
// //morfBuf.copyTo(dst);
//}
for(int i = 1; i < iters; ++i)
{
//dst.swap(morfBuf);
Size wholesize;
Point ofs;
dst.locateROI(wholesize, ofs);
int rows = dst.rows, cols = dst.cols;
dst.adjustROI(ofs.y, -ofs.y - rows + dst.wholerows, ofs.x, -ofs.x - cols + dst.wholecols);
dst.copyTo(morfBuf);
dst.adjustROI(-ofs.y, ofs.y + rows - dst.wholerows, -ofs.x, ofs.x + cols - dst.wholecols);
morfBuf.adjustROI(-ofs.y, ofs.y + rows - dst.wholerows, -ofs.x, ofs.x + cols - dst.wholecols);
Filter2DEngine_GPU::apply(morfBuf, dst);
}
} }
}
int iters; int iters;
oclMat morfBuf; oclMat morfBuf;
}; };
} }
Ptr<FilterEngine_GPU> cv::ocl::createMorphologyFilter_GPU(int op, int type, const Mat &kernel, const Point &anchor, int iterations) Ptr<FilterEngine_GPU> cv::ocl::createMorphologyFilter_GPU(int op, int type, const Mat &kernel, const Point &anchor, int iterations)
...@@ -539,45 +539,45 @@ Ptr<FilterEngine_GPU> cv::ocl::createMorphologyFilter_GPU(int op, int type, cons ...@@ -539,45 +539,45 @@ Ptr<FilterEngine_GPU> cv::ocl::createMorphologyFilter_GPU(int op, int type, cons
namespace namespace
{ {
void morphOp(int op, const oclMat &src, oclMat &dst, const Mat &_kernel, Point anchor, int iterations, int borderType, const Scalar &borderValue) void morphOp(int op, const oclMat &src, oclMat &dst, const Mat &_kernel, Point anchor, int iterations, int borderType, const Scalar &borderValue)
{
if((borderType != cv::BORDER_CONSTANT) || (borderValue != morphologyDefaultBorderValue()))
{ {
if((borderType != cv::BORDER_CONSTANT) || (borderValue != morphologyDefaultBorderValue())) CV_Error(CV_StsBadArg, "unsupported border type");
{ }
CV_Error(CV_StsBadArg, "unsupported border type"); Mat kernel;
} Size ksize = _kernel.data ? _kernel.size() : Size(3, 3);
Mat kernel;
Size ksize = _kernel.data ? _kernel.size() : Size(3, 3);
normalizeAnchor(anchor, ksize); normalizeAnchor(anchor, ksize);
if (iterations == 0 || _kernel.rows * _kernel.cols == 1) if (iterations == 0 || _kernel.rows * _kernel.cols == 1)
{ {
src.copyTo(dst); src.copyTo(dst);
return; return;
} }
dst.create(src.size(), src.type()); dst.create(src.size(), src.type());
if (!_kernel.data) if (!_kernel.data)
{ {
kernel = getStructuringElement(MORPH_RECT, Size(1 + iterations * 2, 1 + iterations * 2)); kernel = getStructuringElement(MORPH_RECT, Size(1 + iterations * 2, 1 + iterations * 2));
anchor = Point(iterations, iterations); anchor = Point(iterations, iterations);
iterations = 1; iterations = 1;
} }
else if (iterations > 1 && countNonZero(_kernel) == _kernel.rows * _kernel.cols) else if (iterations > 1 && countNonZero(_kernel) == _kernel.rows * _kernel.cols)
{ {
anchor = Point(anchor.x * iterations, anchor.y * iterations); anchor = Point(anchor.x * iterations, anchor.y * iterations);
kernel = getStructuringElement(MORPH_RECT, Size(ksize.width + iterations * (ksize.width - 1), kernel = getStructuringElement(MORPH_RECT, Size(ksize.width + iterations * (ksize.width - 1),
ksize.height + iterations * (ksize.height - 1)), anchor); ksize.height + iterations * (ksize.height - 1)), anchor);
iterations = 1; iterations = 1;
} }
else else
kernel = _kernel; kernel = _kernel;
Ptr<FilterEngine_GPU> f = createMorphologyFilter_GPU(op, src.type(), kernel, anchor, iterations); Ptr<FilterEngine_GPU> f = createMorphologyFilter_GPU(op, src.type(), kernel, anchor, iterations);
f->apply(src, dst); f->apply(src, dst);
} }
} }
void cv::ocl::erode( const oclMat &src, oclMat &dst, const Mat &kernel, Point anchor, int iterations, void cv::ocl::erode( const oclMat &src, oclMat &dst, const Mat &kernel, Point anchor, int iterations,
...@@ -645,23 +645,23 @@ void cv::ocl::morphologyEx( const oclMat &src, oclMat &dst, int op, const Mat &k ...@@ -645,23 +645,23 @@ void cv::ocl::morphologyEx( const oclMat &src, oclMat &dst, int op, const Mat &k
namespace namespace
{ {
typedef void (*GPUFilter2D_t)(const oclMat & , oclMat & , oclMat & , Size &, const Point, const int); typedef void (*GPUFilter2D_t)(const oclMat & , oclMat & , oclMat & , Size &, const Point, const int);
class LinearFilter_GPU : public BaseFilter_GPU class LinearFilter_GPU : public BaseFilter_GPU
{ {
public: public:
LinearFilter_GPU(const Size &ksize_, const Point &anchor_, const oclMat &kernel_, GPUFilter2D_t func_, LinearFilter_GPU(const Size &ksize_, const Point &anchor_, const oclMat &kernel_, GPUFilter2D_t func_,
int borderType_) : int borderType_) :
BaseFilter_GPU(ksize_, anchor_, borderType_), kernel(kernel_), func(func_) {} BaseFilter_GPU(ksize_, anchor_, borderType_), kernel(kernel_), func(func_) {}
virtual void operator()(const oclMat &src, oclMat &dst) virtual void operator()(const oclMat &src, oclMat &dst)
{ {
func(src, dst, kernel, ksize, anchor, borderType) ; func(src, dst, kernel, ksize, anchor, borderType) ;
} }
oclMat kernel; oclMat kernel;
GPUFilter2D_t func; GPUFilter2D_t func;
}; };
} }
void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel, void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
...@@ -764,50 +764,50 @@ void cv::ocl::filter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat &ke ...@@ -764,50 +764,50 @@ void cv::ocl::filter2D(const oclMat &src, oclMat &dst, int ddepth, const Mat &ke
namespace namespace
{ {
class SeparableFilterEngine_GPU : public FilterEngine_GPU class SeparableFilterEngine_GPU : public FilterEngine_GPU
{
public:
SeparableFilterEngine_GPU(const Ptr<BaseRowFilter_GPU> &rowFilter_,
const Ptr<BaseColumnFilter_GPU> &columnFilter_) :
rowFilter(rowFilter_), columnFilter(columnFilter_)
{ {
public: ksize = Size(rowFilter->ksize, columnFilter->ksize);
SeparableFilterEngine_GPU(const Ptr<BaseRowFilter_GPU> &rowFilter_, anchor = Point(rowFilter->anchor, columnFilter->anchor);
const Ptr<BaseColumnFilter_GPU> &columnFilter_) : }
rowFilter(rowFilter_), columnFilter(columnFilter_)
{
ksize = Size(rowFilter->ksize, columnFilter->ksize);
anchor = Point(rowFilter->anchor, columnFilter->anchor);
}
virtual void apply(const oclMat &src, oclMat &dst, Rect roi = Rect(0, 0, -1, -1)) virtual void apply(const oclMat &src, oclMat &dst, Rect roi = Rect(0, 0, -1, -1))
{ {
Size src_size = src.size(); Size src_size = src.size();
//int src_type = src.type(); //int src_type = src.type();
int cn = src.oclchannels(); int cn = src.oclchannels();
//dst.create(src_size, src_type); //dst.create(src_size, src_type);
dst = Scalar(0.0); dst = Scalar(0.0);
//dstBuf.create(src_size, src_type); //dstBuf.create(src_size, src_type);
dstBuf.create(src_size.height + ksize.height - 1, src_size.width, CV_MAKETYPE(CV_32F, cn)); dstBuf.create(src_size.height + ksize.height - 1, src_size.width, CV_MAKETYPE(CV_32F, cn));
dstBuf = Scalar(0.0); dstBuf = Scalar(0.0);
normalizeROI(roi, ksize, anchor, src_size); normalizeROI(roi, ksize, anchor, src_size);
srcROI = src(roi); srcROI = src(roi);
dstROI = dst(roi); dstROI = dst(roi);
//dstBufROI = dstBuf(roi); //dstBufROI = dstBuf(roi);
(*rowFilter)(srcROI, dstBuf); (*rowFilter)(srcROI, dstBuf);
//Mat rm(dstBufROI); //Mat rm(dstBufROI);
//std::cout << "rm " << rm << endl; //std::cout << "rm " << rm << endl;
(*columnFilter)(dstBuf, dstROI); (*columnFilter)(dstBuf, dstROI);
} }
Ptr<BaseRowFilter_GPU> rowFilter; Ptr<BaseRowFilter_GPU> rowFilter;
Ptr<BaseColumnFilter_GPU> columnFilter; Ptr<BaseColumnFilter_GPU> columnFilter;
Size ksize; Size ksize;
Point anchor; Point anchor;
oclMat dstBuf; oclMat dstBuf;
oclMat srcROI; oclMat srcROI;
oclMat dstROI; oclMat dstROI;
oclMat dstBufROI; oclMat dstBufROI;
}; };
} }
Ptr<FilterEngine_GPU> cv::ocl::createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU> &rowFilter, Ptr<FilterEngine_GPU> cv::ocl::createSeparableFilter_GPU(const Ptr<BaseRowFilter_GPU> &rowFilter,
...@@ -1107,22 +1107,22 @@ void cv::ocl::boxFilter(const oclMat &src, oclMat &dst, int ddepth, Size ksize, ...@@ -1107,22 +1107,22 @@ void cv::ocl::boxFilter(const oclMat &src, oclMat &dst, int ddepth, Size ksize,
namespace namespace
{ {
typedef void (*gpuFilter1D_t)(const oclMat &src, const oclMat &dst, oclMat kernel, int ksize, int anchor, int bordertype); typedef void (*gpuFilter1D_t)(const oclMat &src, const oclMat &dst, oclMat kernel, int ksize, int anchor, int bordertype);
class GpuLinearRowFilter : public BaseRowFilter_GPU class GpuLinearRowFilter : public BaseRowFilter_GPU
{ {
public: public:
GpuLinearRowFilter(int ksize_, int anchor_, const oclMat &kernel_, gpuFilter1D_t func_, int bordertype_) : GpuLinearRowFilter(int ksize_, int anchor_, const oclMat &kernel_, gpuFilter1D_t func_, int bordertype_) :
BaseRowFilter_GPU(ksize_, anchor_, bordertype_), kernel(kernel_), func(func_) {} BaseRowFilter_GPU(ksize_, anchor_, bordertype_), kernel(kernel_), func(func_) {}
virtual void operator()(const oclMat &src, oclMat &dst) virtual void operator()(const oclMat &src, oclMat &dst)
{ {
func(src, dst, kernel, ksize, anchor, bordertype); func(src, dst, kernel, ksize, anchor, bordertype);
} }
oclMat kernel; oclMat kernel;
gpuFilter1D_t func; gpuFilter1D_t func;
}; };
} }
template <typename T> struct index_and_sizeof; template <typename T> struct index_and_sizeof;
...@@ -1263,20 +1263,20 @@ Ptr<BaseRowFilter_GPU> cv::ocl::getLinearRowFilter_GPU(int srcType, int /*bufTyp ...@@ -1263,20 +1263,20 @@ Ptr<BaseRowFilter_GPU> cv::ocl::getLinearRowFilter_GPU(int srcType, int /*bufTyp
namespace namespace
{ {
class GpuLinearColumnFilter : public BaseColumnFilter_GPU class GpuLinearColumnFilter : public BaseColumnFilter_GPU
{ {
public: public:
GpuLinearColumnFilter(int ksize_, int anchor_, const oclMat &kernel_, gpuFilter1D_t func_, int bordertype_) : GpuLinearColumnFilter(int ksize_, int anchor_, const oclMat &kernel_, gpuFilter1D_t func_, int bordertype_) :
BaseColumnFilter_GPU(ksize_, anchor_, bordertype_), kernel(kernel_), func(func_) {} BaseColumnFilter_GPU(ksize_, anchor_, bordertype_), kernel(kernel_), func(func_) {}
virtual void operator()(const oclMat &src, oclMat &dst) virtual void operator()(const oclMat &src, oclMat &dst)
{ {
func(src, dst, kernel, ksize, anchor, bordertype); func(src, dst, kernel, ksize, anchor, bordertype);
} }
oclMat kernel; oclMat kernel;
gpuFilter1D_t func; gpuFilter1D_t func;
}; };
} }
template <typename T> template <typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment