From ca1ce5fa5cb5a7bcd23a039bee816ed47e1b64d6 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Wed, 9 Nov 2016 22:32:57 +0300 Subject: [PATCH 1/6] Fix for large image handling in OpenVX based implementation of HAL API --- 3rdparty/openvx/include/openvx_hal.hpp | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/3rdparty/openvx/include/openvx_hal.hpp b/3rdparty/openvx/include/openvx_hal.hpp index c5941e7b83..8c1bc3c3ab 100644 --- a/3rdparty/openvx/include/openvx_hal.hpp +++ b/3rdparty/openvx/include/openvx_hal.hpp @@ -349,6 +349,8 @@ inline void setConstantBorder(vx_border_t &border, vx_uint8 val) template \ inline int ovx_hal_##hal_func(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h) \ { \ + if(w >= 4194304 || h >= 4194304) \ + return CV_HAL_ERROR_NOT_IMPLEMENTED; \ try \ { \ vxContext * ctx = vxContext::getContext(); \ @@ -377,6 +379,8 @@ OVX_BINARY_OP(xor, {vxErr::check(vxuXor(ctx->ctx, ia.img, ib.img, ic.img));}) template inline 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) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; #ifdef _MSC_VER const float MAGIC_SCALE = 0x0.01010102; #else @@ -414,6 +418,8 @@ inline int ovx_hal_mul(const T *a, size_t astep, const T *b, size_t bstep, T *c, inline int ovx_hal_not(const uchar *a, size_t astep, uchar *c, size_t cstep, int w, int h) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; try { vxContext * ctx = vxContext::getContext(); @@ -431,6 +437,8 @@ inline int ovx_hal_not(const uchar *a, size_t astep, uchar *c, size_t cstep, int inline int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int cn) { + if (len >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; if (cn != 3 && cn != 4) return CV_HAL_ERROR_NOT_IMPLEMENTED; try @@ -454,6 +462,8 @@ inline int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, double inv_scale_x, double inv_scale_y, int interpolation) { + if (aw >= 4194304 || ah >= 4194304 || bw >= 4194304 || bh >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; try { vxContext * ctx = vxContext::getContext(); @@ -489,6 +499,8 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[6], int interpolation, int borderType, const double borderValue[4]) { + if (aw >= 4194304 || ah >= 4194304 || bw >= 4194304 || bh >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; try { vxContext * ctx = vxContext::getContext(); @@ -546,6 +558,8 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]) { + if (aw >= 4194304 || ah >= 4194304 || bw >= 4194304 || bh >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; try { vxContext * ctx = vxContext::getContext(); @@ -689,6 +703,8 @@ inline int ovx_hal_filterFree(cvhalFilter2D *filter_context) inline int ovx_hal_filter(cvhalFilter2D *filter_context, uchar *a, size_t astep, uchar *b, size_t bstep, int w, int h, int , int , int , int ) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; try { FilterCtx* cnv = (FilterCtx*)filter_context; @@ -909,6 +925,8 @@ inline int ovx_hal_morphFree(cvhalFilter2D *filter_context) inline int ovx_hal_morph(cvhalFilter2D *filter_context, uchar *a, size_t astep, uchar *b, size_t bstep, int w, int h, int , int , int , int , int , int , int , int ) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; try { MorphCtx* mat = (MorphCtx*)filter_context; @@ -939,6 +957,8 @@ inline int ovx_hal_morph(cvhalFilter2D *filter_context, uchar *a, size_t astep, inline int ovx_hal_cvtBGRtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int depth, int acn, int bcn, bool swapBlue) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; if (depth != CV_8U || swapBlue || acn == bcn || (acn != 3 && acn != 4) || (bcn != 3 && bcn != 4)) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -962,6 +982,8 @@ inline int ovx_hal_cvtBGRtoBGR(const uchar * a, size_t astep, uchar * b, size_t inline int ovx_hal_cvtTwoPlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (bcn != 3 && bcn != 4)) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -989,6 +1011,8 @@ inline int ovx_hal_cvtTwoPlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, inline int ovx_hal_cvtThreePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (bcn != 3 && bcn != 4) || uIdx || (size_t)w / 2 != astep - (size_t)w / 2) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -1016,6 +1040,8 @@ inline int ovx_hal_cvtThreePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * inline int ovx_hal_cvtBGRtoThreePlaneYUV(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int acn, bool swapBlue, int uIdx) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (acn != 3 && acn != 4) || uIdx || (size_t)w / 2 != bstep - (size_t)w / 2) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -1039,6 +1065,8 @@ inline int ovx_hal_cvtBGRtoThreePlaneYUV(const uchar * a, size_t astep, uchar * inline int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx, int ycn) { + if (w >= 4194304 || h >= 4194304) + return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (bcn != 3 && bcn != 4) || uIdx) return CV_HAL_ERROR_NOT_IMPLEMENTED; From cd1b324e5e58ce2e3edb3bde79a7e4bd36053100 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Mon, 7 Nov 2016 17:04:00 +0300 Subject: [PATCH 2/6] Fix for OpenVX based implementation of wrapAffine HAL API --- 3rdparty/openvx/include/openvx_hal.hpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/3rdparty/openvx/include/openvx_hal.hpp b/3rdparty/openvx/include/openvx_hal.hpp index 8c1bc3c3ab..78e04082a6 100644 --- a/3rdparty/openvx/include/openvx_hal.hpp +++ b/3rdparty/openvx/include/openvx_hal.hpp @@ -517,8 +517,7 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i setConstantBorder(border, (vx_uint8)borderValue[0]); break; case CV_HAL_BORDER_REPLICATE: - border.mode = VX_BORDER_REPLICATE; - break; + // Neither 1.0 nor 1.1 OpenVX support BORDER_REPLICATE for warpings default: return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -526,8 +525,9 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i int mode; if (interpolation == CV_HAL_INTER_LINEAR) mode = VX_INTERPOLATION_BILINEAR; - else if (interpolation == CV_HAL_INTER_AREA) - mode = VX_INTERPOLATION_AREA; + //AREA interpolation is unsupported + //else if (interpolation == CV_HAL_INTER_AREA) + // mode = VX_INTERPOLATION_AREA; else if (interpolation == CV_HAL_INTER_NEAREST) mode = VX_INTERPOLATION_NEAREST_NEIGHBOR; else @@ -576,8 +576,7 @@ inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int a setConstantBorder(border, (vx_uint8)borderValue[0]); break; case CV_HAL_BORDER_REPLICATE: - border.mode = VX_BORDER_REPLICATE; - break; + // Neither 1.0 nor 1.1 OpenVX support BORDER_REPLICATE for warpings default: return CV_HAL_ERROR_NOT_IMPLEMENTED; } @@ -585,8 +584,9 @@ inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int a int mode; if (interpolation == CV_HAL_INTER_LINEAR) mode = VX_INTERPOLATION_BILINEAR; - else if (interpolation == CV_HAL_INTER_AREA) - mode = VX_INTERPOLATION_AREA; + //AREA interpolation is unsupported + //else if (interpolation == CV_HAL_INTER_AREA) + // mode = VX_INTERPOLATION_AREA; else if (interpolation == CV_HAL_INTER_NEAREST) mode = VX_INTERPOLATION_NEAREST_NEIGHBOR; else @@ -1132,8 +1132,10 @@ inline int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, #undef cv_hal_warpAffine #define cv_hal_warpAffine ovx_hal_warpAffine -#undef cv_hal_warpPerspective -#define cv_hal_warpPerspective ovx_hal_warpPerspectve +//OpenVX perspective warp use round to zero policy at least in sample implementation +//while OpenCV require round to nearest +//#undef cv_hal_warpPerspective +//#define cv_hal_warpPerspective ovx_hal_warpPerspectve #undef cv_hal_filterInit #define cv_hal_filterInit ovx_hal_filterInit From 850d12ae69657219f02df097ddde008941774fea Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Wed, 9 Nov 2016 23:34:10 +0300 Subject: [PATCH 3/6] Completely disabled OpenVX based implementation of warp HAL API --- 3rdparty/openvx/include/openvx_hal.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/3rdparty/openvx/include/openvx_hal.hpp b/3rdparty/openvx/include/openvx_hal.hpp index 78e04082a6..8884c7a4fd 100644 --- a/3rdparty/openvx/include/openvx_hal.hpp +++ b/3rdparty/openvx/include/openvx_hal.hpp @@ -1130,10 +1130,10 @@ inline int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, #undef cv_hal_resize #define cv_hal_resize ovx_hal_resize -#undef cv_hal_warpAffine -#define cv_hal_warpAffine ovx_hal_warpAffine -//OpenVX perspective warp use round to zero policy at least in sample implementation +//OpenVX warps use round to zero policy at least in sample implementation //while OpenCV require round to nearest +//#undef cv_hal_warpAffine +//#define cv_hal_warpAffine ovx_hal_warpAffine //#undef cv_hal_warpPerspective //#define cv_hal_warpPerspective ovx_hal_warpPerspectve From 88ea9f5dd72d261385ffe41b5decd8bedd458b34 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Fri, 30 Sep 2016 14:55:06 +0300 Subject: [PATCH 4/6] Fix for OpenVX based implementation of resize HAL API --- 3rdparty/openvx/include/openvx_hal.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/3rdparty/openvx/include/openvx_hal.hpp b/3rdparty/openvx/include/openvx_hal.hpp index 8884c7a4fd..62c99f5820 100644 --- a/3rdparty/openvx/include/openvx_hal.hpp +++ b/3rdparty/openvx/include/openvx_hal.hpp @@ -479,11 +479,15 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a int mode; if (interpolation == CV_HAL_INTER_LINEAR) + { mode = VX_INTERPOLATION_BILINEAR; + if (inv_scale_x > 1 || inv_scale_y > 1) + return CV_HAL_ERROR_NOT_IMPLEMENTED; + } else if (interpolation == CV_HAL_INTER_AREA) - mode = VX_INTERPOLATION_AREA; + return CV_HAL_ERROR_NOT_IMPLEMENTED; //mode = VX_INTERPOLATION_AREA; else if (interpolation == CV_HAL_INTER_NEAREST) - mode = VX_INTERPOLATION_NEAREST_NEIGHBOR; + return CV_HAL_ERROR_NOT_IMPLEMENTED; //mode = VX_INTERPOLATION_NEAREST_NEIGHBOR; else return CV_HAL_ERROR_NOT_IMPLEMENTED; From 9eac0f057556b7000fe6458a570c4ac6d312fe74 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Wed, 9 Nov 2016 23:33:40 +0300 Subject: [PATCH 5/6] Completely disabled OpenVX based implementation of resize HAL API --- 3rdparty/openvx/include/openvx_hal.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdparty/openvx/include/openvx_hal.hpp b/3rdparty/openvx/include/openvx_hal.hpp index 62c99f5820..f0aa3d5d3b 100644 --- a/3rdparty/openvx/include/openvx_hal.hpp +++ b/3rdparty/openvx/include/openvx_hal.hpp @@ -1131,8 +1131,8 @@ inline int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, #undef cv_hal_merge8u #define cv_hal_merge8u ovx_hal_merge8u -#undef cv_hal_resize -#define cv_hal_resize ovx_hal_resize +//#undef cv_hal_resize +//#define cv_hal_resize ovx_hal_resize //OpenVX warps use round to zero policy at least in sample implementation //while OpenCV require round to nearest From e6f2729c7a73d0e5365d047de00e3efc3bef420a Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Wed, 16 Nov 2016 13:36:37 +0300 Subject: [PATCH 6/6] Replaced magic constant in large image handling check --- 3rdparty/openvx/include/openvx_hal.hpp | 43 +++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/3rdparty/openvx/include/openvx_hal.hpp b/3rdparty/openvx/include/openvx_hal.hpp index f0aa3d5d3b..b027ff0e11 100644 --- a/3rdparty/openvx/include/openvx_hal.hpp +++ b/3rdparty/openvx/include/openvx_hal.hpp @@ -15,6 +15,10 @@ #include #include +#ifndef VX_VENDOR_ID +#define VX_VENDOR_ID VX_ID_DEFAULT +#endif + #if VX_VERSION == VX_VERSION_1_0 #define VX_MEMORY_TYPE_HOST VX_IMPORT_TYPE_HOST @@ -66,6 +70,17 @@ struct Tick }; #endif +inline bool dimTooBig(int size) +{ + if (VX_VENDOR_ID == VX_ID_KHRONOS || VX_VENDOR_ID == VX_ID_DEFAULT) + { + //OpenVX use uint32_t for image addressing + return ((unsigned)size > (UINT_MAX / VX_SCALE_UNITY)); + } + else + return false; +} + //================================================================================================== // One more OpenVX C++ binding :-) // ... @@ -349,7 +364,7 @@ inline void setConstantBorder(vx_border_t &border, vx_uint8 val) template \ inline int ovx_hal_##hal_func(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h) \ { \ - if(w >= 4194304 || h >= 4194304) \ + if(dimTooBig(w) || dimTooBig(h)) \ return CV_HAL_ERROR_NOT_IMPLEMENTED; \ try \ { \ @@ -379,7 +394,7 @@ OVX_BINARY_OP(xor, {vxErr::check(vxuXor(ctx->ctx, ia.img, ib.img, ic.img));}) template inline 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) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; #ifdef _MSC_VER const float MAGIC_SCALE = 0x0.01010102; @@ -418,7 +433,7 @@ inline int ovx_hal_mul(const T *a, size_t astep, const T *b, size_t bstep, T *c, inline int ovx_hal_not(const uchar *a, size_t astep, uchar *c, size_t cstep, int w, int h) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; try { @@ -437,7 +452,7 @@ inline int ovx_hal_not(const uchar *a, size_t astep, uchar *c, size_t cstep, int inline int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int cn) { - if (len >= 4194304) + if(dimTooBig(len)) return CV_HAL_ERROR_NOT_IMPLEMENTED; if (cn != 3 && cn != 4) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -462,7 +477,7 @@ inline int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, double inv_scale_x, double inv_scale_y, int interpolation) { - if (aw >= 4194304 || ah >= 4194304 || bw >= 4194304 || bh >= 4194304) + if(dimTooBig(aw) || dimTooBig(ah) || dimTooBig(bw) || dimTooBig(bh)) return CV_HAL_ERROR_NOT_IMPLEMENTED; try { @@ -503,7 +518,7 @@ inline int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int a inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[6], int interpolation, int borderType, const double borderValue[4]) { - if (aw >= 4194304 || ah >= 4194304 || bw >= 4194304 || bh >= 4194304) + if(dimTooBig(aw) || dimTooBig(ah) || dimTooBig(bw) || dimTooBig(bh)) return CV_HAL_ERROR_NOT_IMPLEMENTED; try { @@ -562,7 +577,7 @@ inline int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, i inline int ovx_hal_warpPerspectve(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]) { - if (aw >= 4194304 || ah >= 4194304 || bw >= 4194304 || bh >= 4194304) + if(dimTooBig(aw) || dimTooBig(ah) || dimTooBig(bw) || dimTooBig(bh)) return CV_HAL_ERROR_NOT_IMPLEMENTED; try { @@ -707,7 +722,7 @@ inline int ovx_hal_filterFree(cvhalFilter2D *filter_context) inline int ovx_hal_filter(cvhalFilter2D *filter_context, uchar *a, size_t astep, uchar *b, size_t bstep, int w, int h, int , int , int , int ) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; try { @@ -929,7 +944,7 @@ inline int ovx_hal_morphFree(cvhalFilter2D *filter_context) inline int ovx_hal_morph(cvhalFilter2D *filter_context, uchar *a, size_t astep, uchar *b, size_t bstep, int w, int h, int , int , int , int , int , int , int , int ) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; try { @@ -961,7 +976,7 @@ inline int ovx_hal_morph(cvhalFilter2D *filter_context, uchar *a, size_t astep, inline int ovx_hal_cvtBGRtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int depth, int acn, int bcn, bool swapBlue) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; if (depth != CV_8U || swapBlue || acn == bcn || (acn != 3 && acn != 4) || (bcn != 3 && bcn != 4)) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -986,7 +1001,7 @@ inline int ovx_hal_cvtBGRtoBGR(const uchar * a, size_t astep, uchar * b, size_t inline int ovx_hal_cvtTwoPlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (bcn != 3 && bcn != 4)) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -1015,7 +1030,7 @@ inline int ovx_hal_cvtTwoPlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, inline int ovx_hal_cvtThreePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (bcn != 3 && bcn != 4) || uIdx || (size_t)w / 2 != astep - (size_t)w / 2) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -1044,7 +1059,7 @@ inline int ovx_hal_cvtThreePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * inline int ovx_hal_cvtBGRtoThreePlaneYUV(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int acn, bool swapBlue, int uIdx) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (acn != 3 && acn != 4) || uIdx || (size_t)w / 2 != bstep - (size_t)w / 2) return CV_HAL_ERROR_NOT_IMPLEMENTED; @@ -1069,7 +1084,7 @@ inline int ovx_hal_cvtBGRtoThreePlaneYUV(const uchar * a, size_t astep, uchar * inline int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx, int ycn) { - if (w >= 4194304 || h >= 4194304) + if(dimTooBig(w) || dimTooBig(h)) return CV_HAL_ERROR_NOT_IMPLEMENTED; if (!swapBlue || (bcn != 3 && bcn != 4) || uIdx) return CV_HAL_ERROR_NOT_IMPLEMENTED;