mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Instrumentation for OpenCV API regions and IPP functions;
This commit is contained in:
@@ -184,6 +184,8 @@ namespace cv
|
||||
{
|
||||
static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
#if IPP_VERSION_X100 >= 810
|
||||
if ((0 > dx) || (0 > dy) || (1 != dx + dy))
|
||||
return false;
|
||||
@@ -230,7 +232,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
return false;
|
||||
sts = ippiFilterScharrHorizMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrHorizMaskBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +241,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
return false;
|
||||
sts = ippiFilterScharrVertMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrVertMaskBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
}
|
||||
@@ -253,7 +255,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
return false;
|
||||
sts = ippiFilterScharrHorizMaskBorder_16s_C1R(src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrHorizMaskBorder_16s_C1R, src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -262,7 +264,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
return false;
|
||||
sts = ippiFilterScharrVertMaskBorder_16s_C1R(src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrVertMaskBorder_16s_C1R, src.ptr<Ipp16s>(), (int)src.step, dst.ptr<Ipp16s>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
}
|
||||
@@ -276,7 +278,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
return false;
|
||||
sts = ippiFilterScharrHorizMaskBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrHorizMaskBorder_32f_C1R, src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -285,14 +287,14 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
pBuffer = ippsMalloc_8u(bufferSize);
|
||||
if (NULL == pBuffer)
|
||||
return false;
|
||||
sts = ippiFilterScharrVertMaskBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrVertMaskBorder_32f_C1R, src.ptr<Ipp32f>(), (int)src.step, dst.ptr<Ipp32f>(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer);
|
||||
}
|
||||
ippsFree(pBuffer);
|
||||
if (sts < 0)
|
||||
return false;;
|
||||
|
||||
if (FLT_EPSILON < fabs(scale - 1.0))
|
||||
sts = ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roiSize);
|
||||
sts = CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1R, dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roiSize);
|
||||
}
|
||||
return (0 <= sts);
|
||||
#else
|
||||
@@ -303,6 +305,8 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx
|
||||
|
||||
static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
if ((borderType != BORDER_REPLICATE) || ((3 != ksize) && (5 != ksize)))
|
||||
return false;
|
||||
if (fabs(delta) > FLT_EPSILON)
|
||||
@@ -333,7 +337,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
buffer.allocate(bufSize);
|
||||
#endif
|
||||
|
||||
if (0 > ippiFilterSobelNegVertBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelNegVertBorder_8u16s_C1R, src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
@@ -352,7 +356,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
buffer.allocate(bufSize);
|
||||
#endif
|
||||
|
||||
if (0 > ippiFilterSobelHorizBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizBorder_8u16s_C1R, src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
@@ -371,7 +375,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
buffer.allocate(bufSize);
|
||||
#endif
|
||||
|
||||
if (0 > ippiFilterSobelVertSecondBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelVertSecondBorder_8u16s_C1R, src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
@@ -390,7 +394,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
buffer.allocate(bufSize);
|
||||
#endif
|
||||
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_8u16s_C1R(src.ptr<Ipp8u>(), (int)src.step,
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizSecondBorder_8u16s_C1R, src.ptr<Ipp8u>(), (int)src.step,
|
||||
dst.ptr<Ipp16s>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
@@ -456,12 +460,12 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
buffer.allocate(bufSize);
|
||||
#endif
|
||||
|
||||
if (0 > ippiFilterSobelVertSecondBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelVertSecondBorder_32f_C1R, src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1R, dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -477,13 +481,13 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
buffer.allocate(bufSize);
|
||||
#endif
|
||||
|
||||
if (0 > ippiFilterSobelHorizSecondBorder_32f_C1R(src.ptr<Ipp32f>(), (int)src.step,
|
||||
if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizSecondBorder_32f_C1R, src.ptr<Ipp32f>(), (int)src.step,
|
||||
dst.ptr<Ipp32f>(), (int)dst.step, roi, kernel,
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer))
|
||||
return false;
|
||||
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1R(dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1R, dst.ptr<Ipp32f>(), (int)dst.step, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -492,6 +496,8 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
|
||||
|
||||
static bool ipp_sobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
if (ksize < 0)
|
||||
{
|
||||
if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType))
|
||||
@@ -510,6 +516,8 @@ static bool ipp_sobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int
|
||||
void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
int ksize, double scale, double delta, int borderType )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype);
|
||||
if (ddepth < 0)
|
||||
ddepth = sdepth;
|
||||
@@ -549,6 +557,8 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
double scale, double delta, int borderType )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype);
|
||||
if (ddepth < 0)
|
||||
ddepth = sdepth;
|
||||
@@ -733,6 +743,8 @@ namespace cv
|
||||
static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
double scale, double delta, int borderType)
|
||||
{
|
||||
CV_INSTRUMENT_REGION_IPP()
|
||||
|
||||
int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype);
|
||||
if (ddepth < 0)
|
||||
ddepth = sdepth;
|
||||
@@ -758,7 +770,7 @@ static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksi
|
||||
if (borderTypeIpp >= 0 && ippiFilterLaplacianGetBufferSize_##ippfavor##_C1R(roisize, masksize, &bufsize) >= 0) \
|
||||
{ \
|
||||
Ipp8u * buffer = ippsMalloc_8u(bufsize); \
|
||||
status = ippiFilterLaplacianBorder_##ippfavor##_C1R(src.ptr<ippsrctype>(), (int)src.step, dst.ptr<ippdsttype>(), \
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiFilterLaplacianBorder_##ippfavor##_C1R, src.ptr<ippsrctype>(), (int)src.step, dst.ptr<ippdsttype>(), \
|
||||
(int)dst.step, roisize, masksize, borderTypeIpp, 0, buffer); \
|
||||
ippsFree(buffer); \
|
||||
} \
|
||||
@@ -770,18 +782,18 @@ static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksi
|
||||
IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s);
|
||||
|
||||
if (needScale && status >= 0)
|
||||
status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiMulC_16s_C1IRSfs, (Ipp16s)iscale, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||
if (needDelta && status >= 0)
|
||||
status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiAddC_16s_C1IRSfs, (Ipp16s)idelta, dst.ptr<Ipp16s>(), (int)dst.step, roisize, 0);
|
||||
}
|
||||
else if (sdepth == CV_32F && ddepth == CV_32F)
|
||||
{
|
||||
IPP_FILTER_LAPLACIAN(Ipp32f, Ipp32f, 32f);
|
||||
|
||||
if (needScale && status >= 0)
|
||||
status = ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1IR, (Ipp32f)scale, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||
if (needDelta && status >= 0)
|
||||
status = ippiAddC_32f_C1IR((Ipp32f)delta, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||
status = CV_INSTRUMENT_FUN_IPP(ippiAddC_32f_C1IR, (Ipp32f)delta, dst.ptr<Ipp32f>(), (int)dst.step, roisize);
|
||||
}
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
|
||||
@@ -799,6 +811,8 @@ static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksi
|
||||
void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
double scale, double delta, int borderType )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype);
|
||||
if (ddepth < 0)
|
||||
ddepth = sdepth;
|
||||
|
||||
Reference in New Issue
Block a user