47
47
48
48
#include " opencv2/core/openvx/ovx_defs.hpp"
49
49
50
+ #include " filter.hpp"
51
+
50
52
/*
51
53
* This file includes the code, contributed by Simon Perreault
52
54
* (the function icvMedianBlur_8u_O1)
@@ -1536,9 +1538,6 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
1536
1538
1537
1539
CV_OCL_RUN (_dst.isUMat (), ocl_boxFilter (_src, _dst, ddepth, ksize, anchor, borderType, normalize))
1538
1540
1539
- CV_OVX_RUN (true ,
1540
- openvx_boxfilter (_src, _dst, ddepth, ksize, anchor, normalize, borderType))
1541
-
1542
1541
Mat src = _src.getMat ();
1543
1542
int stype = src.type (), sdepth = CV_MAT_DEPTH (stype), cn = CV_MAT_CN (stype);
1544
1543
if ( ddepth < 0 )
@@ -1557,19 +1556,18 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth,
1557
1556
Size wsz (src.cols , src.rows );
1558
1557
if (!(borderType&BORDER_ISOLATED))
1559
1558
src.locateROI ( wsz, ofs );
1560
- borderType = (borderType&~BORDER_ISOLATED);
1561
1559
1562
1560
CALL_HAL (boxFilter, cv_hal_boxFilter, sdepth, ddepth, src.ptr (), src.step , dst.ptr (), dst.step , src.cols , src.rows , cn,
1563
1561
ofs.x , ofs.y , wsz.width - src.cols - ofs.x , wsz.height - src.rows - ofs.y , ksize.width , ksize.height ,
1564
- anchor.x , anchor.y , normalize, borderType);
1562
+ anchor.x , anchor.y , normalize, borderType&~BORDER_ISOLATED );
1565
1563
1566
- #ifdef HAVE_TEGRA_OPTIMIZATION
1567
- if ( tegra::useTegra () && tegra::box (src, dst, ksize, anchor, normalize, borderType) )
1568
- return ;
1569
- #endif
1564
+ CV_OVX_RUN (true ,
1565
+ openvx_boxfilter (_src, _dst, ddepth, ksize, anchor, normalize, borderType))
1570
1566
1571
1567
CV_IPP_RUN_FAST (ipp_boxfilter (src, dst, ksize, anchor, normalize, borderType));
1572
1568
1569
+ borderType = (borderType&~BORDER_ISOLATED);
1570
+
1573
1571
Ptr<FilterEngine> f = createBoxFilter ( src.type (), dst.type (),
1574
1572
ksize, anchor, normalize, borderType );
1575
1573
@@ -2098,16 +2096,6 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
2098
2096
return ;
2099
2097
}
2100
2098
2101
- CV_OVX_RUN (true ,
2102
- openvx_gaussianBlur (_src, _dst, ksize, sigma1, sigma2, borderType))
2103
-
2104
- Mat src = _src.getMat ();
2105
- Mat dst = _dst.getMat ();
2106
-
2107
- #ifdef HAVE_TEGRA_OPTIMIZATION
2108
- if (sigma1 == 0 && sigma2 == 0 && tegra::useTegra () && tegra::gaussian (src, dst, ksize, borderType))
2109
- return ;
2110
- #endif
2111
2099
bool useOpenCL = (ocl::isOpenCLActivated () && _dst.isUMat () && _src.dims () <= 2 &&
2112
2100
((ksize.width == 3 && ksize.height == 3 ) ||
2113
2101
(ksize.width == 5 && ksize.height == 5 )) &&
@@ -2116,27 +2104,35 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
2116
2104
2117
2105
int sdepth = CV_MAT_DEPTH (type), cn = CV_MAT_CN (type);
2118
2106
2107
+ Mat kx, ky;
2108
+ createGaussianKernels (kx, ky, type, ksize, sigma1, sigma2);
2109
+
2110
+ CV_OCL_RUN (useOpenCL, ocl_GaussianBlur_8UC1 (_src, _dst, ksize, CV_MAT_DEPTH (type), kx, ky, borderType));
2111
+
2112
+ CV_OCL_RUN (_dst.isUMat () && _src.dims () <= 2 && (size_t )_src.rows () > kx.total () && (size_t )_src.cols () > kx.total (),
2113
+ ocl_sepFilter2D (_src, _dst, sdepth, kx, ky, Point (-1 , -1 ), 0 , borderType))
2114
+
2115
+ Mat src = _src.getMat ();
2116
+ Mat dst = _dst.getMat ();
2117
+
2119
2118
Point ofs;
2120
2119
Size wsz (src.cols , src.rows );
2121
2120
if (!(borderType & BORDER_ISOLATED))
2122
2121
src.locateROI ( wsz, ofs );
2123
- borderType = (borderType&~BORDER_ISOLATED);
2124
2122
2125
2123
CALL_HAL (gaussianBlur, cv_hal_gaussianBlur, sdepth, src.ptr (), src.step , dst.ptr (), dst.step , src.cols , src.rows , cn,
2126
2124
ofs.x , ofs.y , wsz.width - src.cols - ofs.x , wsz.height - src.rows - ofs.y , ksize.width , ksize.height ,
2127
- sigma1, sigma2, borderType);
2125
+ sigma1, sigma2, borderType&~BORDER_ISOLATED );
2128
2126
2129
2127
src.release ();
2130
2128
dst.release ();
2131
2129
2132
- CV_IPP_RUN (!useOpenCL, ipp_GaussianBlur ( _src, _dst, ksize, sigma1, sigma2, borderType));
2133
-
2134
- Mat kx, ky;
2135
- createGaussianKernels (kx, ky, type, ksize, sigma1, sigma2);
2130
+ CV_OVX_RUN (true ,
2131
+ openvx_gaussianBlur (_src, _dst, ksize, sigma1, sigma2, borderType))
2136
2132
2137
- CV_OCL_RUN (useOpenCL, ocl_GaussianBlur_8UC1 (_src, _dst, ksize, CV_MAT_DEPTH (type), kx, ky , borderType));
2133
+ CV_IPP_RUN_FAST ( ipp_GaussianBlur (_src, _dst, ksize, sigma1, sigma2 , borderType));
2138
2134
2139
- sepFilter2D (_src, _dst, CV_MAT_DEPTH (type) , kx, ky, Point (-1 ,-1 ), 0 , borderType );
2135
+ sepFilter2D (_src, _dst, sdepth , kx, ky, Point (-1 , -1 ), 0 , borderType);
2140
2136
}
2141
2137
2142
2138
/* ***************************************************************************************\
0 commit comments