mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Merge pull request #1485 from vpisarev:ipp_fixes
This commit is contained in:
commit
0d49206a98
@ -1616,8 +1616,10 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
size_t total_size = src.total();
|
||||
int rows = src.size[0], cols = (int)(total_size/rows);
|
||||
if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size)
|
||||
&& (normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR) )
|
||||
if( (src.dims == 2 || (src.isContinuous() && mask.isContinuous()))
|
||||
&& cols > 0 && (size_t)rows*cols == total_size
|
||||
&& (normType == NORM_INF || normType == NORM_L1 ||
|
||||
normType == NORM_L2 || normType == NORM_L2SQR) )
|
||||
{
|
||||
IppiSize sz = { cols, rows };
|
||||
int type = src.type();
|
||||
@ -1903,8 +1905,10 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
||||
((normType == NORM_HAMMING || normType == NORM_HAMMING2) && src1.type() == CV_8U) );
|
||||
size_t total_size = src1.total();
|
||||
int rows = src1.size[0], cols = (int)(total_size/rows);
|
||||
if( src1.dims == 2 || (src1.isContinuous() && src2.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size)
|
||||
&& (normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR) )
|
||||
if( (src1.dims == 2 || (src1.isContinuous() && src2.isContinuous() && mask.isContinuous()))
|
||||
&& cols > 0 && (size_t)rows*cols == total_size
|
||||
&& (normType == NORM_INF || normType == NORM_L1 ||
|
||||
normType == NORM_L2 || normType == NORM_L2SQR) )
|
||||
{
|
||||
IppiSize sz = { cols, rows };
|
||||
int type = src1.type();
|
||||
@ -1983,8 +1987,10 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
size_t total_size = src1.total();
|
||||
int rows = src1.size[0], cols = (int)(total_size/rows);
|
||||
if( src1.dims == 2 || (src1.isContinuous() && src2.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size)
|
||||
&& (normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR) )
|
||||
if( (src1.dims == 2 || (src1.isContinuous() && src2.isContinuous() && mask.isContinuous()))
|
||||
&& cols > 0 && (size_t)rows*cols == total_size
|
||||
&& (normType == NORM_INF || normType == NORM_L1 ||
|
||||
normType == NORM_L2 || normType == NORM_L2SQR) )
|
||||
{
|
||||
IppiSize sz = { cols, rows };
|
||||
int type = src1.type();
|
||||
|
@ -747,10 +747,10 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( maskSize == CV_DIST_MASK_5 )
|
||||
{
|
||||
IppiSize roi = { src->cols, src->rows };
|
||||
IppiSize roi = { src.cols, src.rows };
|
||||
if( ippiDistanceTransform_5x5_8u32f_C1R(
|
||||
src->data.ptr, src->step,
|
||||
dst->data.fl, dst->step, roi, _mask) >= 0 )
|
||||
src.ptr<uchar>(), (int)src.step,
|
||||
dst.ptr<float>(), (int)dst.step, roi, _mask) >= 0 )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -267,12 +267,6 @@ static void getRectSubPix_8u32f
|
||||
}
|
||||
}
|
||||
|
||||
typedef CvStatus (CV_STDCALL *CvIPPGetRectSubPixFunc)( const void* src, int src_step,
|
||||
CvSize src_size, void* dst,
|
||||
int dst_step, CvSize win_size,
|
||||
CvPoint2D32f center,
|
||||
CvPoint* minpt, CvPoint* maxpt );
|
||||
|
||||
static void
|
||||
getQuadrangleSubPix_8u32f_CnR( const uchar* src, size_t src_step, Size src_size,
|
||||
float* dst, size_t dst_step, Size win_size,
|
||||
@ -367,6 +361,7 @@ getQuadrangleSubPix_8u32f_CnR( const uchar* src, size_t src_step, Size src_size,
|
||||
|
||||
}
|
||||
|
||||
|
||||
void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
OutputArray _patch, int patchType )
|
||||
{
|
||||
@ -380,15 +375,23 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
Mat patch = _patch.getMat();
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
CvPoint minpt, maxpt;
|
||||
int srctype = CV_MAT_TYPE(src->type), dsttype = CV_MAT_TYPE(dst->type);
|
||||
CvIPPGetRectSubPixFunc ippfunc =
|
||||
srctype == CV_8UC1 && dsttype == CV_8UC1 ? (CvIPPGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R :
|
||||
srctype == CV_8UC1 && dsttype == CV_32FC1 ? (CvIPPGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R :
|
||||
srctype == CV_32FC1 && dsttype == CV_32FC1 ? (CvIPPGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0;
|
||||
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step,
|
||||
IppiSize src_size, void* dst,
|
||||
int dst_step, IppiSize win_size,
|
||||
IppiPoint_32f center,
|
||||
IppiPoint* minpt, IppiPoint* maxpt );
|
||||
|
||||
if( ippfunc && ippfunc(src->data.ptr, src->step, src_size, dst->data.ptr,
|
||||
dst->step, dst_size, center, &minpt, &maxpt) >= 0 )
|
||||
IppiPoint minpt={0,0}, maxpt={0,0};
|
||||
IppiPoint_32f icenter = {center.x, center.y};
|
||||
IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows};
|
||||
int srctype = image.type();
|
||||
ippiGetRectSubPixFunc ippfunc =
|
||||
srctype == CV_8UC1 && ddepth == CV_8U ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R :
|
||||
srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R :
|
||||
srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0;
|
||||
|
||||
if( ippfunc && ippfunc(image.data, (int)image.step, src_size, patch.data,
|
||||
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
@ -1564,7 +1564,7 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
|
||||
int use_ipp = cascade->hid_cascade->ipp_stages != 0;
|
||||
|
||||
if( use_ipp )
|
||||
normImg = cvCreateMat( img->rows, img->cols, CV_32FC1 );
|
||||
normImg.reset(cvCreateMat( img->rows, img->cols, CV_32FC1));
|
||||
#endif
|
||||
imgSmall.reset(cvCreateMat( img->rows + 1, img->cols + 1, CV_8UC1 ));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user