From 9c22d4887c945a1e2fb70b3ef22cfd51eb745436 Mon Sep 17 00:00:00 2001 From: Leszek Swirski Date: Fri, 20 Dec 2013 12:38:31 +0000 Subject: [PATCH] imgproc: IPP compilation fix and minor cleanup --- modules/imgproc/src/deriv.cpp | 2 +- modules/imgproc/src/sumpixels.cpp | 76 ++++++++++++------------------- 2 files changed, 31 insertions(+), 47 deletions(-) diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index bc11b2463..6dccef99f 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -472,7 +472,7 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, #endif #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - if(dx < 2 && dy < 2 && src.channels() == 1 && borderType == 1) + if(dx < 2 && dy < 2 && _src.channels() == 1 && borderType == 1) { Mat src = _src.getMat(), dst = _dst.getMat(); if(IPPDerivScharr(src, dst, ddepth, dx, dy, scale)) diff --git a/modules/imgproc/src/sumpixels.cpp b/modules/imgproc/src/sumpixels.cpp index 2160b2057..c6ce0f296 100644 --- a/modules/imgproc/src/sumpixels.cpp +++ b/modules/imgproc/src/sumpixels.cpp @@ -350,52 +350,6 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output } } -#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - if( ( depth == CV_8U ) && ( !_tilted.needed() ) ) - { - if( sdepth == CV_32F ) - { - if( cn == 1 ) - { - IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); - _sum.create( isize, CV_MAKETYPE( sdepth, cn ) ); - sum = _sum.getMat(); - if( _sqsum.needed() && sqdepth == CV_64F ) - { - _sqsum.create( isize, CV_MAKETYPE( sqdepth, cn ) ); - sqsum = _sqsum.getMat(); - ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); - } - else - { - ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 ); - } - return; - } - } - if( sdepth == CV_32S ) - { - if( cn == 1 ) - { - IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); - _sum.create( isize, CV_MAKETYPE( sdepth, cn ) ); - sum = _sum.getMat(); - if( _sqsum.needed() && sqdepth == CV_64F ) - { - _sqsum.create( isize, CV_MAKETYPE( sqdepth, cn ) ); - sqsum = _sqsum.getMat(); - ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); - } - else - { - ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 ); - } - return; - } - } - } -#endif - Size ssize = _src.size(), isize(ssize.width + 1, ssize.height + 1); _sum.create( isize, CV_MAKETYPE(sdepth, cn) ); Mat src = _src.getMat(), sum =_sum.getMat(), sqsum, tilted; @@ -404,7 +358,37 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output { _sqsum.create( isize, CV_MAKETYPE(sqdepth, cn) ); sqsum = _sqsum.getMat(); + }; + +#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) + if( ( depth == CV_8U ) && ( sdepth == CV_32F || sdepth == CV_32S ) && ( !_tilted.needed() ) && ( !_sqsum.needed() || sqdepth == CV_64F ) && ( cn == 1 ) ) + { + IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); + if( sdepth == CV_32F ) + { + if( _sqsum.needed() ) + { + ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); + } + else + { + ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 ); + } + } + else if( sdepth == CV_32S ) + { + if( _sqsum.needed() ) + { + ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); + } + else + { + ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 ); + } + } + return; } +#endif if( _tilted.needed() ) {