Skip to content

Commit c2c7333

Browse files
author
elenagvo
committed
add hal for GaussianBlur
1 parent cb9e110 commit c2c7333

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

modules/imgproc/src/hal_replacement.hpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,23 +666,41 @@ inline int hal_ni_threshold(const uchar* src_data, size_t src_step, uchar* dst_d
666666

667667
/**
668668
@brief Calculate box filter
669-
@param src_depth, dst_depth Depths of source and destination image
670-
@param src_data, src_step Source image
671-
@param dst_data, dst_step Destination image
669+
@param src_depth,dst_depth Depths of source and destination image
670+
@param src_data,src_step Source image
671+
@param dst_data,dst_step Destination image
672+
@param width,height Source image dimensions
673+
@param margins Margins for source image
672674
@param ksize Size of kernel
673675
@param anchor Anchor point
674676
@param normalize If true then result is normalized
675677
@param border_type Border type
676-
@param margins Margins for source image
677-
@param width, height Source image dimensions
678678
@param cn Number of channels
679679
*/
680-
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; }
680+
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; }
681681

682682
//! @cond IGNORED
683683
#define cv_hal_boxFilter hal_ni_boxFilter
684684
//! @endcond
685685

686+
/**
687+
@brief Blurs an image using a Gaussian filter.
688+
@param src_depth,dst_depth Depths of source and destination image
689+
@param src_data,src_step Source image
690+
@param dst_data,dst_step Destination image
691+
@param width,height Source image dimensions
692+
@param margins Margins for source image
693+
@param ksize Size of kernel
694+
@param sigmaX,sigmaY Gaussian kernel standard deviation.
695+
@param border_type Border type
696+
@param cn Number of channels
697+
*/
698+
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; }
699+
700+
//! @cond IGNORED
701+
#define cv_hal_gaussianBlur hal_ni_gaussianBlur
702+
//! @endcond
703+
686704
//! @}
687705

688706
#if defined __GNUC__

modules/imgproc/src/smooth.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,8 +1561,8 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
15611561

15621562
CvRect margin = cvRect(ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y);
15631563

1564-
CALL_HAL(boxFilter, cv_hal_boxFilter, sdepth, ddepth, src.ptr(), src.step, dst.ptr(), dst.step,
1565-
(CvSize)(ksize), (CvPoint)(anchor), normalize, borderType, margin, src.cols, src.rows, cn);
1564+
CALL_HAL(boxFilter, cv_hal_boxFilter, sdepth, ddepth, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, cn,
1565+
margin, (CvSize)(ksize), (CvPoint)(anchor), normalize, borderType);
15661566

15671567
#ifdef HAVE_TEGRA_OPTIMIZATION
15681568
if ( tegra::useTegra() && tegra::box(src, dst, ksize, anchor, normalize, borderType) )
@@ -2114,6 +2114,22 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
21142114
_src.rows() > ksize.height && _src.cols() > ksize.width);
21152115
(void)useOpenCL;
21162116

2117+
Mat src = _src.getMat();
2118+
Mat dst = _dst.getMat();
2119+
2120+
int sdepth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
2121+
2122+
Point ofs;
2123+
Size wsz(src.cols, src.rows);
2124+
if(!(borderType & BORDER_ISOLATED))
2125+
src.locateROI( wsz, ofs );
2126+
borderType = (borderType&~BORDER_ISOLATED);
2127+
2128+
CvRect margin = cvRect(ofs.x, ofs.y, wsz.width - src.cols - ofs.x, wsz.height - src.rows - ofs.y);
2129+
2130+
CALL_HAL(gaussianBlur, cv_hal_gaussianBlur, sdepth, src.ptr(), src.step, dst.ptr(), dst.step, src.cols, src.rows, cn,
2131+
margin, (CvSize)(ksize), sigma1, sigma2, borderType);
2132+
21172133
CV_IPP_RUN(!useOpenCL, ipp_GaussianBlur( _src, _dst, ksize, sigma1, sigma2, borderType));
21182134

21192135
Mat kx, ky;

0 commit comments

Comments
 (0)