Skip to content

Commit bf62dca

Browse files
committed
Extended restrictions for OpenVX HAL calls on small images
1 parent bf5b784 commit bf62dca

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

3rdparty/openvx/hal/openvx_hal.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ inline bool dimTooBig(int size)
8282
}
8383

8484
//OpenVX calls have essential overhead so it make sense to skip them for small images
85-
template <int kernel_id> inline bool skipSmallImages(int w, int h) { return w*h < 3840 * 2160; }
85+
template <int kernel_id> inline bool skipSmallImages(int w, int h) { return w*h < 7680 * 4320; }
8686
template <> inline bool skipSmallImages<VX_KERNEL_MULTIPLY>(int w, int h) { return w*h < 640 * 480; }
8787
template <> inline bool skipSmallImages<VX_KERNEL_COLOR_CONVERT>(int w, int h) { return w*h < 2048 * 1536; }
8888

@@ -175,7 +175,9 @@ OVX_BINARY_OP(xor, { ivx::IVX_CHECK_STATUS(vxuXor(ctx, ia, ib, ic)); }, VX_KERNE
175175
template <typename T>
176176
int ovx_hal_mul(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h, double scale)
177177
{
178-
if(skipSmallImages<VX_KERNEL_MULTIPLY>(w, h))
178+
if(scale == 1.0 || sizeof(T) > 1 ?
179+
skipSmallImages<VX_KERNEL_ADD>(w, h) : /*actually it could be any kernel with generic minimum size*/
180+
skipSmallImages<VX_KERNEL_MULTIPLY>(w, h) )
179181
return CV_HAL_ERROR_NOT_IMPLEMENTED;
180182
if (dimTooBig(w) || dimTooBig(h))
181183
return CV_HAL_ERROR_NOT_IMPLEMENTED;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ 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 < 1280*720; }
29+
template <> inline bool skipSmallImages<VX_KERNEL_MINMAXLOC>(int w, int h) { return w*h < 3840 * 2160; }
3030
template <> inline bool skipSmallImages<VX_KERNEL_MEDIAN_3x3>(int w, int h) { return w*h < 1280 * 720; }
3131
template <> inline bool skipSmallImages<VX_KERNEL_GAUSSIAN_3x3>(int w, int h) { return w*h < 1280 * 720; }
32-
template <> inline bool skipSmallImages<VX_KERNEL_BOX_3x3>(int w, int h) { return w*h < 1280 * 720; }
32+
template <> inline bool skipSmallImages<VX_KERNEL_BOX_3x3>(int w, int h) { return w*h < 1920 * 1080; }
3333
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 < 640 * 480; }
34+
template <> inline bool skipSmallImages<VX_KERNEL_SOBEL_3x3>(int w, int h) { return w*h < 1280 * 720; }
3535
template <> inline bool skipSmallImages<VX_KERNEL_CUSTOM_CONVOLUTION>(int w, int h) { return w*h < 1280 * 720; }
3636

3737
}}

0 commit comments

Comments
 (0)