Skip to content

Commit 1d62a02

Browse files
committed
Moved size restrictions for OpenVX processed images to corresponding cpp files
1 parent 9dc36a1 commit 1d62a02

File tree

8 files changed

+27
-9
lines changed

8 files changed

+27
-9
lines changed

modules/core/include/opencv2/core/openvx/ovx_defs.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ namespace ovx{
2626
CV_EXPORTS_W ivx::Context& getOpenVXContext();
2727

2828
template <int kernel_id> inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; }
29-
template <> inline bool skipSmallImages<VX_KERNEL_MINMAXLOC>(int w, int h) { return w*h < 3840 * 2160; }
30-
template <> inline bool skipSmallImages<VX_KERNEL_MEDIAN_3x3>(int w, int h) { return w*h < 1280 * 720; }
31-
template <> inline bool skipSmallImages<VX_KERNEL_GAUSSIAN_3x3>(int w, int h) { return w*h < 320 * 240; }
32-
template <> inline bool skipSmallImages<VX_KERNEL_BOX_3x3>(int w, int h) { return w*h < 640 * 480; }
33-
template <> inline bool skipSmallImages<VX_KERNEL_HISTOGRAM>(int w, int h) { return w*h < 2048 * 1536; }
34-
template <> inline bool skipSmallImages<VX_KERNEL_SOBEL_3x3>(int w, int h) { return w*h < 320 * 240; }
35-
template <> inline bool skipSmallImages<VX_KERNEL_CANNY_EDGE_DETECTOR>(int w, int h) { return w*h < 640 * 480; }
36-
template <> inline bool skipSmallImages<VX_KERNEL_ACCUMULATE>(int w, int h) { return w*h < 120 * 60; }
37-
template <> inline bool skipSmallImages<VX_KERNEL_FAST_CORNERS>(int w, int h) { return w*h < 800 * 600; }
3829
}}
3930

4031
#define CV_OVX_RUN(condition, func, ...) \

modules/core/src/stat.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,9 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
23002300
#endif
23012301

23022302
#ifdef HAVE_OPENVX
2303+
namespace ovx {
2304+
template <> inline bool skipSmallImages<VX_KERNEL_MINMAXLOC>(int w, int h) { return w*h < 3840 * 2160; }
2305+
}
23032306
static bool openvx_minMaxIdx(Mat &src, double* minVal, double* maxVal, int* minIdx, int* maxIdx, Mat &mask)
23042307
{
23052308
int stype = src.type();

modules/features2d/src/fast.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
338338

339339

340340
#ifdef HAVE_OPENVX
341+
namespace ovx {
342+
template <> inline bool skipSmallImages<VX_KERNEL_FAST_CORNERS>(int w, int h) { return w*h < 800 * 600; }
343+
}
341344
static bool openvx_FAST(InputArray _img, std::vector<KeyPoint>& keypoints,
342345
int _threshold, bool nonmaxSuppression, int type)
343346
{

modules/imgproc/src/accum.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,9 @@ enum
19421942
VX_ACCUMULATE_WEIGHTED_OP = 2
19431943
};
19441944

1945+
namespace ovx {
1946+
template <> inline bool skipSmallImages<VX_KERNEL_ACCUMULATE>(int w, int h) { return w*h < 120 * 60; }
1947+
}
19451948
static bool openvx_accumulate(InputArray _src, InputOutputArray _dst, InputArray _mask, double _weight, int opType)
19461949
{
19471950
Mat srcMat = _src.getMat(), dstMat = _dst.getMat();

modules/imgproc/src/canny.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,9 @@ class finalPass : public ParallelLoopBody
778778
};
779779

780780
#ifdef HAVE_OPENVX
781+
namespace ovx {
782+
template <> inline bool skipSmallImages<VX_KERNEL_CANNY_EDGE_DETECTOR>(int w, int h) { return w*h < 640 * 480; }
783+
}
781784
static bool openvx_canny(const Mat& src, Mat& dst, int loVal, int hiVal, int kSize, bool useL2)
782785
{
783786
using namespace ivx;

modules/imgproc/src/deriv.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ cv::Ptr<cv::FilterEngine> cv::createDerivFilter(int srcType, int dstType,
184184
#ifdef HAVE_OPENVX
185185
namespace cv
186186
{
187+
namespace ovx {
188+
template <> inline bool skipSmallImages<VX_KERNEL_SOBEL_3x3>(int w, int h) { return w*h < 320 * 240; }
189+
}
187190
static bool openvx_sobel(InputArray _src, OutputArray _dst,
188191
int dx, int dy, int ksize,
189192
double scale, double delta, int borderType)

modules/imgproc/src/histogram.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,9 @@ class IPPCalcHistInvoker :
12671267
#ifdef HAVE_OPENVX
12681268
namespace cv
12691269
{
1270+
namespace ovx {
1271+
template <> inline bool skipSmallImages<VX_KERNEL_HISTOGRAM>(int w, int h) { return w*h < 2048 * 1536; }
1272+
}
12701273
static bool openvx_calchist(const Mat& image, OutputArray _hist, const int histSize,
12711274
const float* _range)
12721275
{

modules/imgproc/src/smooth.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,9 @@ cv::Ptr<cv::FilterEngine> cv::createBoxFilter( int srcType, int dstType, Size ks
16391639
#ifdef HAVE_OPENVX
16401640
namespace cv
16411641
{
1642+
namespace ovx {
1643+
template <> inline bool skipSmallImages<VX_KERNEL_BOX_3x3>(int w, int h) { return w*h < 640 * 480; }
1644+
}
16421645
static bool openvx_boxfilter(InputArray _src, OutputArray _dst, int ddepth,
16431646
Size ksize, Point anchor,
16441647
bool normalize, int borderType)
@@ -2172,6 +2175,9 @@ static bool ocl_GaussianBlur_8UC1(InputArray _src, OutputArray _dst, Size ksize,
21722175

21732176
#ifdef HAVE_OPENVX
21742177

2178+
namespace ovx {
2179+
template <> inline bool skipSmallImages<VX_KERNEL_GAUSSIAN_3x3>(int w, int h) { return w*h < 320 * 240; }
2180+
}
21752181
static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
21762182
double sigma1, double sigma2, int borderType)
21772183
{
@@ -3302,6 +3308,9 @@ static bool ocl_medianFilter(InputArray _src, OutputArray _dst, int m)
33023308
#ifdef HAVE_OPENVX
33033309
namespace cv
33043310
{
3311+
namespace ovx {
3312+
template <> inline bool skipSmallImages<VX_KERNEL_MEDIAN_3x3>(int w, int h) { return w*h < 1280 * 720; }
3313+
}
33053314
static bool openvx_medianFilter(InputArray _src, OutputArray _dst, int ksize)
33063315
{
33073316
if (_src.type() != CV_8UC1 || _dst.type() != CV_8U

0 commit comments

Comments
 (0)