From dfb9c574a4fc6077bb275cc110f066dbfab408b6 Mon Sep 17 00:00:00 2001 From: Pavel Vlasov Date: Mon, 21 Nov 2016 17:18:03 +0300 Subject: [PATCH] IPP 2017 filter2D fix; filter2D IPP runtime check; --- modules/imgproc/src/filter.cpp | 42 ++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index 68a168f617..e379df2bb0 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -4640,6 +4640,11 @@ struct IppFilter : public hal::Filter2D int ddepth = CV_MAT_DEPTH(dtype); int sdepth = CV_MAT_DEPTH(stype); +#if IPP_VERSION_X100 >= 201700 && IPP_VERSION_X100 < 201702 // IPP bug with 1x1 kernel + if(kernel_width == 1 && kernel_height == 1) + return false; +#endif + bool runIpp = true && (borderTypeNI == BORDER_CONSTANT || borderTypeNI == BORDER_REPLICATE) && (sdepth == ddepth) @@ -4911,26 +4916,29 @@ Ptr Filter2D::create(uchar* kernel_data, size_t kernel_step, int } #ifdef HAVE_IPP - if (kernel_type == CV_32FC1) { - IppFilter* impl = new IppFilter(); - if (impl->init(kernel_data, kernel_step, kernel_type, kernel_width, kernel_height, - max_width, max_height, stype, dtype, - borderType, delta, anchor_x, anchor_y, isSubmatrix, isInplace)) - { - return Ptr(impl); + CV_IPP_CHECK() + { + if (kernel_type == CV_32FC1) { + IppFilter* impl = new IppFilter(); + if (impl->init(kernel_data, kernel_step, kernel_type, kernel_width, kernel_height, + max_width, max_height, stype, dtype, + borderType, delta, anchor_x, anchor_y, isSubmatrix, isInplace)) + { + return Ptr(impl); + } + delete impl; } - delete impl; - } - if (kernel_type == CV_16SC1) { - IppFilter* impl = new IppFilter(); - if (impl->init(kernel_data, kernel_step, kernel_type, kernel_width, kernel_height, - max_width, max_height, stype, dtype, - borderType, delta, anchor_x, anchor_y, isSubmatrix, isInplace)) - { - return Ptr(impl); + if (kernel_type == CV_16SC1) { + IppFilter* impl = new IppFilter(); + if (impl->init(kernel_data, kernel_step, kernel_type, kernel_width, kernel_height, + max_width, max_height, stype, dtype, + borderType, delta, anchor_x, anchor_y, isSubmatrix, isInplace)) + { + return Ptr(impl); + } + delete impl; } - delete impl; } #endif