add hal for GaussianBlur

pull/10058/head
elenagvo 7 years ago
parent cb9e110adb
commit c2c7333107
  1. 30
      modules/imgproc/src/hal_replacement.hpp
  2. 20
      modules/imgproc/src/smooth.cpp

@ -666,23 +666,41 @@ inline int hal_ni_threshold(const uchar* src_data, size_t src_step, uchar* dst_d
/**
@brief Calculate box filter
@param src_depth, dst_depth Depths of source and destination image
@param src_data, src_step Source image
@param dst_data, dst_step Destination image
@param src_depth,dst_depth Depths of source and destination image
@param src_data,src_step Source image
@param dst_data,dst_step Destination image
@param width,height Source image dimensions
@param margins Margins for source image
@param ksize Size of kernel
@param anchor Anchor point
@param normalize If true then result is normalized
@param border_type Border type
@param margins Margins for source image
@param width, height Source image dimensions
@param cn Number of channels
*/
inline int hal_ni_boxFilter(int src_depth, int dst_depth, const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, CvSize ksize, CvPoint anchor, bool normalize, int border_type, CvRect margins, int width, int height, int cn) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inline int hal_ni_boxFilter(int src_depth, int dst_depth, const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int cn, CvRect margins, CvSize ksize, CvPoint anchor, bool normalize, int border_type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_boxFilter hal_ni_boxFilter
//! @endcond
/**
@brief Blurs an image using a Gaussian filter.
@param src_depth,dst_depth Depths of source and destination image
@param src_data,src_step Source image
@param dst_data,dst_step Destination image
@param width,height Source image dimensions
@param margins Margins for source image
@param ksize Size of kernel
@param sigmaX,sigmaY Gaussian kernel standard deviation.
@param border_type Border type
@param cn Number of channels
*/
inline int hal_ni_gaussianBlur(int depth, const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int cn, CvRect margins, CvSize ksize, double sigmaX, double sigmaY, int border_type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_gaussianBlur hal_ni_gaussianBlur
//! @endcond
//! @}
#if defined __GNUC__

@ -1561,8 +1561,8 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
CvRect margin = cvRect(ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y);
CALL_HAL(boxFilter, cv_hal_boxFilter, sdepth, ddepth, src.ptr(), src.step, dst.ptr(), dst.step,
(CvSize)(ksize), (CvPoint)(anchor), normalize, borderType, margin, src.cols, src.rows, cn);
CALL_HAL(boxFilter, cv_hal_boxFilter, sdepth, ddepth, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, cn,
margin, (CvSize)(ksize), (CvPoint)(anchor), normalize, borderType);
#ifdef HAVE_TEGRA_OPTIMIZATION
if ( tegra::useTegra() && tegra::box(src, dst, ksize, anchor, normalize, borderType) )
@ -2114,6 +2114,22 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
_src.rows() > ksize.height && _src.cols() > ksize.width);
(void)useOpenCL;
Mat src = _src.getMat();
Mat dst = _dst.getMat();
int sdepth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
Point ofs;
Size wsz(src.cols, src.rows);
if(!(borderType & BORDER_ISOLATED))
src.locateROI( wsz, ofs );
borderType = (borderType&~BORDER_ISOLATED);
CvRect margin = cvRect(ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y);
CALL_HAL(gaussianBlur, cv_hal_gaussianBlur, sdepth, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, cn,
margin, (CvSize)(ksize), sigma1, sigma2, borderType);
CV_IPP_RUN(!useOpenCL, ipp_GaussianBlur( _src, _dst, ksize, sigma1, sigma2, borderType));
Mat kx, ky;

Loading…
Cancel
Save