Prepare codes for ippicv library
This commit is contained in:
@@ -99,7 +99,7 @@
|
||||
#define MAX_IPP8u 255
|
||||
#define MAX_IPP16u 65535
|
||||
#define MAX_IPP32f 1.0
|
||||
static IppStatus sts = ippInit();
|
||||
static IppStatus sts = ippicvInit();
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
@@ -200,9 +200,9 @@ void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt)
|
||||
}
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
typedef IppStatus (CV_STDCALL* ippiReorderFunc)(const void *, int, void *, int, IppiSize, const int *);
|
||||
typedef IppStatus (CV_STDCALL* ippiGeneralFunc)(const void *, int, void *, int, IppiSize);
|
||||
typedef IppStatus (CV_STDCALL* ippiColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *);
|
||||
typedef IppStatus (CV_STDCALL* ippicviReorderFunc)(const void *, int, void *, int, IppiSize, const int *);
|
||||
typedef IppStatus (CV_STDCALL* ippicviGeneralFunc)(const void *, int, void *, int, IppiSize);
|
||||
typedef IppStatus (CV_STDCALL* ippicviColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *);
|
||||
|
||||
template <typename Cvt>
|
||||
class CvtColorIPPLoop_Invoker : public ParallelLoopBody
|
||||
@@ -255,134 +255,134 @@ bool CvtColorIPPLoopCopy(Mat& src, Mat& dst, const Cvt& cvt)
|
||||
return ok;
|
||||
}
|
||||
|
||||
static IppStatus CV_STDCALL ippiSwapChannels_8u_C3C4Rf(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep,
|
||||
static IppStatus CV_STDCALL ippicviSwapChannels_8u_C3C4Rf(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep,
|
||||
IppiSize roiSize, const int *dstOrder)
|
||||
{
|
||||
return ippiSwapChannels_8u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP8u);
|
||||
return ippicviSwapChannels_8u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP8u);
|
||||
}
|
||||
|
||||
static IppStatus CV_STDCALL ippiSwapChannels_16u_C3C4Rf(const Ipp16u* pSrc, int srcStep, Ipp16u* pDst, int dstStep,
|
||||
static IppStatus CV_STDCALL ippicviSwapChannels_16u_C3C4Rf(const Ipp16u* pSrc, int srcStep, Ipp16u* pDst, int dstStep,
|
||||
IppiSize roiSize, const int *dstOrder)
|
||||
{
|
||||
return ippiSwapChannels_16u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP16u);
|
||||
return ippicviSwapChannels_16u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP16u);
|
||||
}
|
||||
|
||||
static IppStatus CV_STDCALL ippiSwapChannels_32f_C3C4Rf(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep,
|
||||
static IppStatus CV_STDCALL ippicviSwapChannels_32f_C3C4Rf(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep,
|
||||
IppiSize roiSize, const int *dstOrder)
|
||||
{
|
||||
return ippiSwapChannels_32f_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP32f);
|
||||
return ippicviSwapChannels_32f_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP32f);
|
||||
}
|
||||
|
||||
static ippiReorderFunc ippiSwapChannelsC3C4RTab[] =
|
||||
static ippicviReorderFunc ippicviSwapChannelsC3C4RTab[] =
|
||||
{
|
||||
(ippiReorderFunc)ippiSwapChannels_8u_C3C4Rf, 0, (ippiReorderFunc)ippiSwapChannels_16u_C3C4Rf, 0,
|
||||
0, (ippiReorderFunc)ippiSwapChannels_32f_C3C4Rf, 0, 0
|
||||
(ippicviReorderFunc)ippicviSwapChannels_8u_C3C4Rf, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C3C4Rf, 0,
|
||||
0, (ippicviReorderFunc)ippicviSwapChannels_32f_C3C4Rf, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiCopyAC4C3RTab[] =
|
||||
static ippicviGeneralFunc ippicviCopyAC4C3RTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiCopy_8u_AC4C3R, 0, (ippiGeneralFunc)ippiCopy_16u_AC4C3R, 0,
|
||||
0, (ippiGeneralFunc)ippiCopy_32f_AC4C3R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviCopy_8u_AC4C3R, 0, (ippicviGeneralFunc)ippicviCopy_16u_AC4C3R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviCopy_32f_AC4C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiReorderFunc ippiSwapChannelsC4C3RTab[] =
|
||||
static ippicviReorderFunc ippicviSwapChannelsC4C3RTab[] =
|
||||
{
|
||||
(ippiReorderFunc)ippiSwapChannels_8u_C4C3R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C4C3R, 0,
|
||||
0, (ippiReorderFunc)ippiSwapChannels_32f_C4C3R, 0, 0
|
||||
(ippicviReorderFunc)ippicviSwapChannels_8u_C4C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C4C3R, 0,
|
||||
0, (ippicviReorderFunc)ippicviSwapChannels_32f_C4C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiReorderFunc ippiSwapChannelsC3RTab[] =
|
||||
static ippicviReorderFunc ippicviSwapChannelsC3RTab[] =
|
||||
{
|
||||
(ippiReorderFunc)ippiSwapChannels_8u_C3R, 0, (ippiReorderFunc)ippiSwapChannels_16u_C3R, 0,
|
||||
0, (ippiReorderFunc)ippiSwapChannels_32f_C3R, 0, 0
|
||||
(ippicviReorderFunc)ippicviSwapChannels_8u_C3R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_C3R, 0,
|
||||
0, (ippicviReorderFunc)ippicviSwapChannels_32f_C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiReorderFunc ippiSwapChannelsC4RTab[] =
|
||||
static ippicviReorderFunc ippicviSwapChannelsC4RTab[] =
|
||||
{
|
||||
(ippiReorderFunc)ippiSwapChannels_8u_AC4R, 0, (ippiReorderFunc)ippiSwapChannels_16u_AC4R, 0,
|
||||
0, (ippiReorderFunc)ippiSwapChannels_32f_AC4R, 0, 0
|
||||
(ippicviReorderFunc)ippicviSwapChannels_8u_AC4R, 0, (ippicviReorderFunc)ippicviSwapChannels_16u_AC4R, 0,
|
||||
0, (ippicviReorderFunc)ippicviSwapChannels_32f_AC4R, 0, 0
|
||||
};
|
||||
|
||||
static ippiColor2GrayFunc ippiColor2GrayC3Tab[] =
|
||||
static ippicviColor2GrayFunc ippicviColor2GrayC3Tab[] =
|
||||
{
|
||||
(ippiColor2GrayFunc)ippiColorToGray_8u_C3C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_C3C1R, 0,
|
||||
0, (ippiColor2GrayFunc)ippiColorToGray_32f_C3C1R, 0, 0
|
||||
(ippicviColor2GrayFunc)ippicviColorToGray_8u_C3C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_16u_C3C1R, 0,
|
||||
0, (ippicviColor2GrayFunc)ippicviColorToGray_32f_C3C1R, 0, 0
|
||||
};
|
||||
|
||||
static ippiColor2GrayFunc ippiColor2GrayC4Tab[] =
|
||||
static ippicviColor2GrayFunc ippicviColor2GrayC4Tab[] =
|
||||
{
|
||||
(ippiColor2GrayFunc)ippiColorToGray_8u_AC4C1R, 0, (ippiColor2GrayFunc)ippiColorToGray_16u_AC4C1R, 0,
|
||||
0, (ippiColor2GrayFunc)ippiColorToGray_32f_AC4C1R, 0, 0
|
||||
(ippicviColor2GrayFunc)ippicviColorToGray_8u_AC4C1R, 0, (ippicviColor2GrayFunc)ippicviColorToGray_16u_AC4C1R, 0,
|
||||
0, (ippicviColor2GrayFunc)ippicviColorToGray_32f_AC4C1R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiRGB2GrayC3Tab[] =
|
||||
static ippicviGeneralFunc ippicviRGB2GrayC3Tab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiRGBToGray_8u_C3C1R, 0, (ippiGeneralFunc)ippiRGBToGray_16u_C3C1R, 0,
|
||||
0, (ippiGeneralFunc)ippiRGBToGray_32f_C3C1R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviRGBToGray_8u_C3C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_16u_C3C1R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviRGBToGray_32f_C3C1R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiRGB2GrayC4Tab[] =
|
||||
static ippicviGeneralFunc ippicviRGB2GrayC4Tab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiRGBToGray_8u_AC4C1R, 0, (ippiGeneralFunc)ippiRGBToGray_16u_AC4C1R, 0,
|
||||
0, (ippiGeneralFunc)ippiRGBToGray_32f_AC4C1R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviRGBToGray_8u_AC4C1R, 0, (ippicviGeneralFunc)ippicviRGBToGray_16u_AC4C1R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviRGBToGray_32f_AC4C1R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiCopyP3C3RTab[] =
|
||||
static ippicviGeneralFunc ippicviCopyP3C3RTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiCopy_8u_P3C3R, 0, (ippiGeneralFunc)ippiCopy_16u_P3C3R, 0,
|
||||
0, (ippiGeneralFunc)ippiCopy_32f_P3C3R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviCopy_8u_P3C3R, 0, (ippicviGeneralFunc)ippicviCopy_16u_P3C3R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviCopy_32f_P3C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiRGB2XYZTab[] =
|
||||
static ippicviGeneralFunc ippicviRGB2XYZTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiRGBToXYZ_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToXYZ_16u_C3R, 0,
|
||||
0, (ippiGeneralFunc)ippiRGBToXYZ_32f_C3R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviRGBToXYZ_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToXYZ_16u_C3R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviRGBToXYZ_32f_C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiXYZ2RGBTab[] =
|
||||
static ippicviGeneralFunc ippicviXYZ2RGBTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiXYZToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiXYZToRGB_16u_C3R, 0,
|
||||
0, (ippiGeneralFunc)ippiXYZToRGB_32f_C3R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviXYZToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviXYZToRGB_16u_C3R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviXYZToRGB_32f_C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiRGB2HSVTab[] =
|
||||
static ippicviGeneralFunc ippicviRGB2HSVTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiRGBToHSV_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToHSV_16u_C3R, 0,
|
||||
(ippicviGeneralFunc)ippicviRGBToHSV_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToHSV_16u_C3R, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiHSV2RGBTab[] =
|
||||
static ippicviGeneralFunc ippicviHSV2RGBTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiHSVToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiHSVToRGB_16u_C3R, 0,
|
||||
(ippicviGeneralFunc)ippicviHSVToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviHSVToRGB_16u_C3R, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiRGB2HLSTab[] =
|
||||
static ippicviGeneralFunc ippicviRGB2HLSTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiRGBToHLS_8u_C3R, 0, (ippiGeneralFunc)ippiRGBToHLS_16u_C3R, 0,
|
||||
0, (ippiGeneralFunc)ippiRGBToHLS_32f_C3R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviRGBToHLS_8u_C3R, 0, (ippicviGeneralFunc)ippicviRGBToHLS_16u_C3R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviRGBToHLS_32f_C3R, 0, 0
|
||||
};
|
||||
|
||||
static ippiGeneralFunc ippiHLS2RGBTab[] =
|
||||
static ippicviGeneralFunc ippicviHLS2RGBTab[] =
|
||||
{
|
||||
(ippiGeneralFunc)ippiHLSToRGB_8u_C3R, 0, (ippiGeneralFunc)ippiHLSToRGB_16u_C3R, 0,
|
||||
0, (ippiGeneralFunc)ippiHLSToRGB_32f_C3R, 0, 0
|
||||
(ippicviGeneralFunc)ippicviHLSToRGB_8u_C3R, 0, (ippicviGeneralFunc)ippicviHLSToRGB_16u_C3R, 0,
|
||||
0, (ippicviGeneralFunc)ippicviHLSToRGB_32f_C3R, 0, 0
|
||||
};
|
||||
|
||||
struct IPPGeneralFunctor
|
||||
{
|
||||
IPPGeneralFunctor(ippiGeneralFunc _func) : func(_func){}
|
||||
IPPGeneralFunctor(ippicviGeneralFunc _func) : func(_func){}
|
||||
bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const
|
||||
{
|
||||
return func(src, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiGeneralFunc func;
|
||||
ippicviGeneralFunc func;
|
||||
};
|
||||
|
||||
struct IPPReorderFunctor
|
||||
{
|
||||
IPPReorderFunctor(ippiReorderFunc _func, int _order0, int _order1, int _order2) : func(_func)
|
||||
IPPReorderFunctor(ippicviReorderFunc _func, int _order0, int _order1, int _order2) : func(_func)
|
||||
{
|
||||
order[0] = _order0;
|
||||
order[1] = _order1;
|
||||
@@ -394,13 +394,13 @@ struct IPPReorderFunctor
|
||||
return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiReorderFunc func;
|
||||
ippicviReorderFunc func;
|
||||
int order[4];
|
||||
};
|
||||
|
||||
struct IPPColor2GrayFunctor
|
||||
{
|
||||
IPPColor2GrayFunctor(ippiColor2GrayFunc _func) : func(_func)
|
||||
IPPColor2GrayFunctor(ippicviColor2GrayFunc _func) : func(_func)
|
||||
{
|
||||
coeffs[0] = 0.114f;
|
||||
coeffs[1] = 0.587f;
|
||||
@@ -411,25 +411,25 @@ struct IPPColor2GrayFunctor
|
||||
return func(src, srcStep, dst, dstStep, ippiSize(cols, rows), coeffs) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiColor2GrayFunc func;
|
||||
ippicviColor2GrayFunc func;
|
||||
Ipp32f coeffs[3];
|
||||
};
|
||||
|
||||
struct IPPGray2BGRFunctor
|
||||
{
|
||||
IPPGray2BGRFunctor(ippiGeneralFunc _func) : func(_func){}
|
||||
IPPGray2BGRFunctor(ippicviGeneralFunc _func) : func(_func){}
|
||||
bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const
|
||||
{
|
||||
const void* srcarray[3] = { src, src, src };
|
||||
return func(srcarray, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiGeneralFunc func;
|
||||
ippicviGeneralFunc func;
|
||||
};
|
||||
|
||||
struct IPPGray2BGRAFunctor
|
||||
{
|
||||
IPPGray2BGRAFunctor(ippiGeneralFunc _func1, ippiReorderFunc _func2, int _depth) : func1(_func1), func2(_func2), depth(_depth){}
|
||||
IPPGray2BGRAFunctor(ippicviGeneralFunc _func1, ippicviReorderFunc _func2, int _depth) : func1(_func1), func2(_func2), depth(_depth){}
|
||||
bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const
|
||||
{
|
||||
const void* srcarray[3] = { src, src, src };
|
||||
@@ -440,14 +440,14 @@ struct IPPGray2BGRAFunctor
|
||||
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiGeneralFunc func1;
|
||||
ippiReorderFunc func2;
|
||||
ippicviGeneralFunc func1;
|
||||
ippicviReorderFunc func2;
|
||||
int depth;
|
||||
};
|
||||
|
||||
struct IPPReorderGeneralFunctor
|
||||
{
|
||||
IPPReorderGeneralFunctor(ippiReorderFunc _func1, ippiGeneralFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth)
|
||||
IPPReorderGeneralFunctor(ippicviReorderFunc _func1, ippicviGeneralFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth)
|
||||
{
|
||||
order[0] = _order0;
|
||||
order[1] = _order1;
|
||||
@@ -463,15 +463,15 @@ struct IPPReorderGeneralFunctor
|
||||
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiReorderFunc func1;
|
||||
ippiGeneralFunc func2;
|
||||
ippicviReorderFunc func1;
|
||||
ippicviGeneralFunc func2;
|
||||
int order[4];
|
||||
int depth;
|
||||
};
|
||||
|
||||
struct IPPGeneralReorderFunctor
|
||||
{
|
||||
IPPGeneralReorderFunctor(ippiGeneralFunc _func1, ippiReorderFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth)
|
||||
IPPGeneralReorderFunctor(ippicviGeneralFunc _func1, ippicviReorderFunc _func2, int _order0, int _order1, int _order2, int _depth) : func1(_func1), func2(_func2), depth(_depth)
|
||||
{
|
||||
order[0] = _order0;
|
||||
order[1] = _order1;
|
||||
@@ -487,8 +487,8 @@ struct IPPGeneralReorderFunctor
|
||||
return func2(temp.data, (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0;
|
||||
}
|
||||
private:
|
||||
ippiGeneralFunc func1;
|
||||
ippiReorderFunc func2;
|
||||
ippicviGeneralFunc func1;
|
||||
ippicviReorderFunc func2;
|
||||
int order[4];
|
||||
int depth;
|
||||
};
|
||||
@@ -3228,32 +3228,32 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( code == CV_BGR2BGRA || code == CV_RGB2RGBA)
|
||||
{
|
||||
if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 0, 1, 2)) )
|
||||
if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGRA2BGR )
|
||||
{
|
||||
if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiCopyAC4C3RTab[depth])) )
|
||||
if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviCopyAC4C3RTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGR2RGBA )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 2, 1, 0)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGBA2BGR )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC4C3RTab[depth], 2, 1, 0)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippicviSwapChannelsC4C3RTab[depth], 2, 1, 0)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2BGR )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippicviSwapChannelsC3RTab[depth], 2, 1, 0)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGBA2BGRA )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippicviSwapChannelsC4RTab[depth], 2, 1, 0)) )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3314,22 +3314,22 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( code == CV_BGR2GRAY )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC3Tab[depth])) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippicviColor2GrayC3Tab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2GRAY )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC3Tab[depth])) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviRGB2GrayC3Tab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGRA2GRAY )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC4Tab[depth])) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippicviColor2GrayC4Tab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGBA2GRAY )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC4Tab[depth])) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippicviRGB2GrayC4Tab[depth])) )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3366,12 +3366,12 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( code == CV_GRAY2BGR )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippiCopyP3C3RTab[depth])) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippicviCopyP3C3RTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_GRAY2BGRA )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippiCopyP3C3RTab[depth], ippiSwapChannelsC3C4RTab[depth], depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippicviCopyP3C3RTab[depth], ippicviSwapChannelsC3C4RTab[depth], depth)) )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3459,22 +3459,22 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( code == CV_BGR2XYZ && scn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC3RTab[depth], ippicviRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGR2XYZ && scn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2XYZTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2XYZ && scn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2XYZTab[depth])) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2XYZTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2XYZ && scn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 0, 1, 2, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2XYZTab[depth], 0, 1, 2, depth)) )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3498,22 +3498,22 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
if( code == CV_XYZ2BGR && dcn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippicviXYZ2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_XYZ2BGR && dcn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviXYZ2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
if( code == CV_XYZ2RGB && dcn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiXYZ2RGBTab[depth])) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviXYZ2RGBTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_XYZ2RGB && dcn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviXYZ2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3543,42 +3543,42 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
{
|
||||
if( code == CV_BGR2HSV_FULL && scn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC3RTab[depth], ippicviRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGR2HSV_FULL && scn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HSVTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2HSV_FULL && scn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HSVTab[depth])) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2HSVTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2HSV_FULL && scn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 0, 1, 2, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HSVTab[depth], 0, 1, 2, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGR2HLS_FULL && scn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC3RTab[depth], ippicviRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_BGR2HLS_FULL && scn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HLSTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2HLS_FULL && scn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HLSTab[depth])) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviRGB2HLSTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_RGB2HLS_FULL && scn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 0, 1, 2, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippicviSwapChannelsC4C3RTab[depth], ippicviRGB2HLSTab[depth], 0, 1, 2, depth)) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3624,42 +3624,42 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
||||
{
|
||||
if( code == CV_HSV2BGR_FULL && dcn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HSV2BGR_FULL && dcn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HSV2RGB_FULL && dcn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHSV2RGBTab[depth])) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviHSV2RGBTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HSV2RGB_FULL && dcn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHSV2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HLS2BGR_FULL && dcn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3RTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HLS2BGR_FULL && dcn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HLS2RGB_FULL && dcn == 3 )
|
||||
{
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHLS2RGBTab[depth])) )
|
||||
if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippicviHLS2RGBTab[depth])) )
|
||||
return;
|
||||
}
|
||||
else if( code == CV_HLS2RGB_FULL && dcn == 4 )
|
||||
{
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||
if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippicviHLS2RGBTab[depth], ippicviSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "opencl_kernels.hpp"
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static IppStatus sts = ippInit();
|
||||
static IppStatus sts = ippicvInit();
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -212,10 +212,10 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy,
|
||||
{
|
||||
if((dx == 1) && (dy == 0))
|
||||
{
|
||||
ippiFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize);
|
||||
ippicviFilterScharrVertGetBufferSize_8u16s_C1R(roi,&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterScharrVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
ippicviFilterScharrVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
|
||||
return true;
|
||||
@@ -223,10 +223,10 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy,
|
||||
|
||||
if((dx == 0) && (dy == 1))
|
||||
{
|
||||
ippiFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize);
|
||||
ippicviFilterScharrHorizGetBufferSize_8u16s_C1R(roi,&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterScharrHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
ippicviFilterScharrHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, roi, ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
|
||||
return true;
|
||||
@@ -245,29 +245,29 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy,
|
||||
case CV_32F:
|
||||
if((dx == 1) && (dy == 0))
|
||||
{
|
||||
ippiFilterScharrVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize);
|
||||
ippicviFilterScharrVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterScharrVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
ippicviFilterScharrVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
if(scale != 1)
|
||||
/* IPP is fast, so MulC produce very little perf degradation */
|
||||
ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f*)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f*)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if((dx == 0) && (dy == 1))
|
||||
{
|
||||
ippiFilterScharrHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize);
|
||||
ippicviFilterScharrHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterScharrHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
ippicviFilterScharrHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -297,10 +297,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k
|
||||
{
|
||||
if((dx == 1) && (dy == 0))
|
||||
{
|
||||
ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelNegVertGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
ippicviFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
return true;
|
||||
@@ -308,10 +308,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k
|
||||
|
||||
if((dx == 0) && (dy == 1))
|
||||
{
|
||||
ippiFilterSobelHorizGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelHorizGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
ippicviFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
|
||||
@@ -320,10 +320,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k
|
||||
|
||||
if((dx == 2) && (dy == 0))
|
||||
{
|
||||
ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
ippicviFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
|
||||
@@ -332,10 +332,10 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k
|
||||
|
||||
if((dx == 0) && (dy == 2))
|
||||
{
|
||||
ippiFilterSobelHorizSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelHorizSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
ippicviFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step,
|
||||
(Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
|
||||
@@ -347,56 +347,56 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k
|
||||
{
|
||||
if((dx == 1) && (dy == 0))
|
||||
{
|
||||
ippiFilterSobelNegVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), &bufSize);
|
||||
ippicviFilterSobelNegVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), &bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelNegVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
ippicviFilterSobelNegVertBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if((dx == 0) && (dy == 1))
|
||||
{
|
||||
ippiFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
ippicviFilterSobelHorizBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if((dx == 2) && (dy == 0))
|
||||
{
|
||||
ippiFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelVertSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
ippicviFilterSobelVertSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if((dx == 0) && (dy == 2))
|
||||
{
|
||||
ippiFilterSobelHorizSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
ippicviFilterSobelHorizSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize);
|
||||
buffer.allocate(bufSize);
|
||||
|
||||
ippiFilterSobelHorizSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
ippicviFilterSobelHorizSecondBorder_32f_C1R((const Ipp32f*)src.data, (int)src.step,
|
||||
(Ipp32f*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),
|
||||
ippBorderRepl, 0, (Ipp8u*)(char*)buffer);
|
||||
if(scale != 1)
|
||||
ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
ippicviMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
|
||||
if( maskSize == CV_DIST_MASK_5 )
|
||||
{
|
||||
IppiSize roi = { src.cols, src.rows };
|
||||
if( ippiDistanceTransform_5x5_8u32f_C1R(
|
||||
if( ippicviDistanceTransform_5x5_8u32f_C1R(
|
||||
src.ptr<uchar>(), (int)src.step,
|
||||
dst.ptr<float>(), (int)dst.step, roi, _mask) >= 0 )
|
||||
return;
|
||||
|
||||
@@ -1420,36 +1420,16 @@ struct RowVec_32f
|
||||
|
||||
int operator()(const uchar* _src, uchar* _dst, int width, int cn) const
|
||||
{
|
||||
#ifdef USE_IPP_SEP_FILTERS
|
||||
int ret = ippicviOperator(_src, _dst, width, cn);
|
||||
if (ret > 0)
|
||||
return ret;
|
||||
#endif
|
||||
int _ksize = kernel.rows + kernel.cols - 1;
|
||||
const float* src0 = (const float*)_src;
|
||||
float* dst = (float*)_dst;
|
||||
const float* _kx = (const float*)kernel.data;
|
||||
|
||||
#ifdef USE_IPP_SEP_FILTERS
|
||||
IppiSize roisz = { width, 1 };
|
||||
if( (cn == 1 || cn == 3) && width >= _ksize*8 )
|
||||
{
|
||||
if( bufsz < 0 )
|
||||
{
|
||||
if( (cn == 1 && ippiFilterRowBorderPipelineGetBufferSize_32f_C1R(roisz, _ksize, &bufsz) < 0) ||
|
||||
(cn == 3 && ippiFilterRowBorderPipelineGetBufferSize_32f_C3R(roisz, _ksize, &bufsz) < 0))
|
||||
return 0;
|
||||
}
|
||||
AutoBuffer<uchar> buf(bufsz + 64);
|
||||
uchar* bufptr = alignPtr((uchar*)buf, 32);
|
||||
int step = (int)(width*sizeof(dst[0])*cn);
|
||||
float borderValue[] = {0.f, 0.f, 0.f};
|
||||
// here is the trick. IPP needs border type and extrapolates the row. We did it already.
|
||||
// So we pass anchor=0 and ignore the right tail of results since they are incorrect there.
|
||||
if( (cn == 1 && ippiFilterRowBorderPipeline_32f_C1R(src0, step, &dst, roisz, _kx, _ksize, 0,
|
||||
ippBorderRepl, borderValue[0], bufptr) < 0) ||
|
||||
(cn == 3 && ippiFilterRowBorderPipeline_32f_C3R(src0, step, &dst, roisz, _kx, _ksize, 0,
|
||||
ippBorderRepl, borderValue, bufptr) < 0))
|
||||
return 0;
|
||||
return width - _ksize + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( !haveSSE )
|
||||
return 0;
|
||||
|
||||
@@ -1479,7 +1459,38 @@ struct RowVec_32f
|
||||
Mat kernel;
|
||||
bool haveSSE;
|
||||
#ifdef USE_IPP_SEP_FILTERS
|
||||
private:
|
||||
mutable int bufsz;
|
||||
int ippicviOperator(const uchar* _src, uchar* _dst, int width, int cn) const
|
||||
{
|
||||
int _ksize = kernel.rows + kernel.cols - 1;
|
||||
if ((1 != cn && 3 != cn) || width < _ksize*8)
|
||||
return 0;
|
||||
|
||||
const float* src = (const float*)_src;
|
||||
float* dst = (float*)_dst;
|
||||
const float* _kx = (const float*)kernel.data;
|
||||
|
||||
IppiSize roisz = { width, 1 };
|
||||
if( bufsz < 0 )
|
||||
{
|
||||
if( (cn == 1 && ippicviFilterRowBorderPipelineGetBufferSize_32f_C1R(roisz, _ksize, &bufsz) < 0) ||
|
||||
(cn == 3 && ippicviFilterRowBorderPipelineGetBufferSize_32f_C3R(roisz, _ksize, &bufsz) < 0))
|
||||
return 0;
|
||||
}
|
||||
AutoBuffer<uchar> buf(bufsz + 64);
|
||||
uchar* bufptr = alignPtr((uchar*)buf, 32);
|
||||
int step = (int)(width*sizeof(dst[0])*cn);
|
||||
float borderValue[] = {0.f, 0.f, 0.f};
|
||||
// here is the trick. IPP needs border type and extrapolates the row. We did it already.
|
||||
// So we pass anchor=0 and ignore the right tail of results since they are incorrect there.
|
||||
if( (cn == 1 && ippicviFilterRowBorderPipeline_32f_C1R(src, step, &dst, roisz, _kx, _ksize, 0,
|
||||
ippBorderRepl, borderValue[0], bufptr) < 0) ||
|
||||
(cn == 3 && ippicviFilterRowBorderPipeline_32f_C3R(src, step, &dst, roisz, _kx, _ksize, 0,
|
||||
ippBorderRepl, borderValue, bufptr) < 0))
|
||||
return 0;
|
||||
return width - _ksize + 1;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -50,24 +50,24 @@
|
||||
#include "opencl_kernels.hpp"
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static IppStatus sts = ippInit();
|
||||
static IppStatus sts = ippicvInit();
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701)
|
||||
typedef IppStatus (CV_STDCALL* ippiResizeFunc)(const void*, int, const void*, int, IppiPoint, IppiSize, IppiBorderType, void*, void*, Ipp8u*);
|
||||
typedef IppStatus (CV_STDCALL* ippiResizeGetBufferSize)(void*, IppiSize, Ipp32u, int*);
|
||||
typedef IppStatus (CV_STDCALL* ippiResizeGetSrcOffset)(void*, IppiPoint, IppiPoint*);
|
||||
typedef IppStatus (CV_STDCALL* ippicviResizeFunc)(const void*, int, const void*, int, IppiPoint, IppiSize, IppiBorderType, void*, void*, Ipp8u*);
|
||||
typedef IppStatus (CV_STDCALL* ippicviResizeGetBufferSize)(void*, IppiSize, Ipp32u, int*);
|
||||
typedef IppStatus (CV_STDCALL* ippicviResizeGetSrcOffset)(void*, IppiPoint, IppiPoint*);
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
typedef IppStatus (CV_STDCALL* ippiSetFunc)(const void*, void *, int, IppiSize);
|
||||
typedef IppStatus (CV_STDCALL* ippiWarpPerspectiveBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [3][3], int);
|
||||
typedef IppStatus (CV_STDCALL* ippiWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int);
|
||||
typedef IppStatus (CV_STDCALL* ippicviSetFunc)(const void*, void *, int, IppiSize);
|
||||
typedef IppStatus (CV_STDCALL* ippicviWarpPerspectiveBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [3][3], int);
|
||||
typedef IppStatus (CV_STDCALL* ippicviWarpAffineBackFunc)(const void*, IppiSize, int, IppiRect, void *, int, IppiRect, double [2][3], int);
|
||||
|
||||
template <int channels, typename Type>
|
||||
bool IPPSetSimple(cv::Scalar value, void *dataPointer, int step, IppiSize &size, ippiSetFunc func)
|
||||
bool IPPSetSimple(cv::Scalar value, void *dataPointer, int step, IppiSize &size, ippicviSetFunc func)
|
||||
{
|
||||
Type values[channels];
|
||||
for( int i = 0; i < channels; i++ )
|
||||
@@ -82,11 +82,11 @@ namespace cv
|
||||
switch( depth )
|
||||
{
|
||||
case CV_8U:
|
||||
return ippiSet_8u_C1R((Ipp8u)value[0], (Ipp8u *)dataPointer, step, size) >= 0;
|
||||
return ippicviSet_8u_C1R((Ipp8u)value[0], (Ipp8u *)dataPointer, step, size) >= 0;
|
||||
case CV_16U:
|
||||
return ippiSet_16u_C1R((Ipp16u)value[0], (Ipp16u *)dataPointer, step, size) >= 0;
|
||||
return ippicviSet_16u_C1R((Ipp16u)value[0], (Ipp16u *)dataPointer, step, size) >= 0;
|
||||
case CV_32F:
|
||||
return ippiSet_32f_C1R((Ipp32f)value[0], (Ipp32f *)dataPointer, step, size) >= 0;
|
||||
return ippicviSet_32f_C1R((Ipp32f)value[0], (Ipp32f *)dataPointer, step, size) >= 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -96,11 +96,11 @@ namespace cv
|
||||
switch( depth )
|
||||
{
|
||||
case CV_8U:
|
||||
return IPPSetSimple<3, Ipp8u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_8u_C3R);
|
||||
return IPPSetSimple<3, Ipp8u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_8u_C3R);
|
||||
case CV_16U:
|
||||
return IPPSetSimple<3, Ipp16u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_16u_C3R);
|
||||
return IPPSetSimple<3, Ipp16u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_16u_C3R);
|
||||
case CV_32F:
|
||||
return IPPSetSimple<3, Ipp32f>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_32f_C3R);
|
||||
return IPPSetSimple<3, Ipp32f>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_32f_C3R);
|
||||
}
|
||||
}
|
||||
else if( channels == 4 )
|
||||
@@ -108,11 +108,11 @@ namespace cv
|
||||
switch( depth )
|
||||
{
|
||||
case CV_8U:
|
||||
return IPPSetSimple<4, Ipp8u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_8u_C4R);
|
||||
return IPPSetSimple<4, Ipp8u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_8u_C4R);
|
||||
case CV_16U:
|
||||
return IPPSetSimple<4, Ipp16u>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_16u_C4R);
|
||||
return IPPSetSimple<4, Ipp16u>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_16u_C4R);
|
||||
case CV_32F:
|
||||
return IPPSetSimple<4, Ipp32f>(value, dataPointer, step, size, (ippiSetFunc)ippiSet_32f_C4R);
|
||||
return IPPSetSimple<4, Ipp32f>(value, dataPointer, step, size, (ippicviSetFunc)ippicviSet_32f_C4R);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1880,37 +1880,37 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
|
||||
#define CHECK_IPP_STATUS(STATUS) if( STATUS!=ippStsNoErr ) { *ok = false; return;}
|
||||
|
||||
#define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \
|
||||
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
|
||||
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
|
||||
func = (ippicviResizeFunc)ippicviResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
|
||||
CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
|
||||
specBuf.allocate(specSize);\
|
||||
pSpec = (uchar*)specBuf;\
|
||||
CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_32f*)pSpec));
|
||||
CHECK_IPP_STATUS(ippicviResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_32f*)pSpec));
|
||||
|
||||
#define SET_IPP_RESIZE_LINEAR_FUNC_64_PTR(TYPE, CN) \
|
||||
if (mode==(int)ippCubic) { *ok = false; return;}\
|
||||
func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
|
||||
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
|
||||
func = (ippicviResizeFunc)ippicviResizeLinear_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
|
||||
CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
|
||||
specBuf.allocate(specSize);\
|
||||
pSpec = (uchar*)specBuf;\
|
||||
CHECK_IPP_STATUS(ippiResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_64f*)pSpec));\
|
||||
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\
|
||||
getSrcOffsetFunc = (ippiResizeGetSrcOffset) ippiResizeGetBufferSize_##TYPE;
|
||||
CHECK_IPP_STATUS(ippicviResizeLinearInit_##TYPE(srcSize, dstSize, (IppiResizeSpec_64f*)pSpec));\
|
||||
getBufferSizeFunc = (ippicviResizeGetBufferSize)ippicviResizeGetBufferSize_##TYPE;\
|
||||
getSrcOffsetFunc = (ippicviResizeGetSrcOffset) ippicviResizeGetBufferSize_##TYPE;
|
||||
|
||||
#define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \
|
||||
func = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
|
||||
CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
|
||||
func = (ippicviResizeFunc)ippicviResizeCubic_##TYPE##_##CN##R; CHECK_IPP_FUNC(func);\
|
||||
CHECK_IPP_STATUS(ippicviResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\
|
||||
specBuf.allocate(specSize);\
|
||||
pSpec = (uchar*)specBuf;\
|
||||
AutoBuffer<uchar> buf(initSize);\
|
||||
uchar* pInit = (uchar*)buf;\
|
||||
CHECK_IPP_STATUS(ippiResizeCubicInit_##TYPE(srcSize, dstSize, 0.f, 0.75f, (IppiResizeSpec_32f*)pSpec, pInit));
|
||||
CHECK_IPP_STATUS(ippicviResizeCubicInit_##TYPE(srcSize, dstSize, 0.f, 0.75f, (IppiResizeSpec_32f*)pSpec, pInit));
|
||||
|
||||
#define SET_IPP_RESIZE_PTR(TYPE, CN) \
|
||||
if (mode == (int)ippLinear) { SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN);}\
|
||||
else if (mode == (int)ippCubic) { SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN);}\
|
||||
else { *ok = false; return;}\
|
||||
getBufferSizeFunc = (ippiResizeGetBufferSize)ippiResizeGetBufferSize_##TYPE;\
|
||||
getSrcOffsetFunc = (ippiResizeGetSrcOffset)ippiResizeGetSrcOffset_##TYPE;
|
||||
getBufferSizeFunc = (ippicviResizeGetBufferSize)ippicviResizeGetBufferSize_##TYPE;\
|
||||
getSrcOffsetFunc = (ippicviResizeGetSrcOffset)ippicviResizeGetSrcOffset_##TYPE;
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR*100 + IPP_VERSION_MINOR >= 701)
|
||||
class IPPresizeInvoker :
|
||||
@@ -1929,6 +1929,7 @@ public:
|
||||
dstSize.width = dst.cols;
|
||||
dstSize.height = dst.rows;
|
||||
|
||||
<<<<<<< HEAD
|
||||
switch (type)
|
||||
{
|
||||
case CV_8UC1: SET_IPP_RESIZE_PTR(8u,C1); break;
|
||||
@@ -1981,6 +1982,37 @@ public:
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
=======
|
||||
~IPPresizeInvoker()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (const Range& range) const
|
||||
{
|
||||
if (*ok == false) return;
|
||||
|
||||
int cn = src.channels();
|
||||
int dsty = min(cvRound(range.start * inv_scale_y), dst.rows);
|
||||
int dstwidth = min(cvRound(src.cols * inv_scale_x), dst.cols);
|
||||
int dstheight = min(cvRound(range.end * inv_scale_y), dst.rows);
|
||||
|
||||
IppiPoint dstOffset = { 0, dsty }, srcOffset = {0, 0};
|
||||
IppiSize dstSize = { dstwidth, dstheight - dsty };
|
||||
int bufsize = 0, itemSize = (int)src.elemSize1();
|
||||
|
||||
CHECK_IPP_STATUS(getBufferSizeFunc(pSpec, dstSize, cn, &bufsize));
|
||||
CHECK_IPP_STATUS(getSrcOffsetFunc(pSpec, dstOffset, &srcOffset));
|
||||
|
||||
Ipp8u* pSrc = (Ipp8u*)src.data + (int)src.step[0] * srcOffset.y + srcOffset.x * cn * itemSize;
|
||||
Ipp8u* pDst = (Ipp8u*)dst.data + (int)dst.step[0] * dstOffset.y + dstOffset.x * cn * itemSize;
|
||||
|
||||
AutoBuffer<uchar> buf(bufsize + 64);
|
||||
uchar* bufptr = alignPtr((uchar*)buf, 32);
|
||||
|
||||
if( func( pSrc, (int)src.step[0], pDst, (int)dst.step[0], dstOffset, dstSize, ippBorderRepl, 0, pSpec, bufptr ) < 0 )
|
||||
*ok = false;
|
||||
}
|
||||
>>>>>>> Prepare codes for ippicv library
|
||||
private:
|
||||
const Mat & src;
|
||||
Mat & dst;
|
||||
@@ -1989,9 +2021,9 @@ private:
|
||||
void *pSpec;
|
||||
AutoBuffer<uchar> specBuf;
|
||||
int mode;
|
||||
ippiResizeFunc func;
|
||||
ippiResizeGetBufferSize getBufferSizeFunc;
|
||||
ippiResizeGetSrcOffset getSrcOffsetFunc;
|
||||
ippicviResizeFunc func;
|
||||
ippicviResizeGetBufferSize getBufferSizeFunc;
|
||||
ippicviResizeGetSrcOffset getSrcOffsetFunc;
|
||||
bool *ok;
|
||||
const IPPresizeInvoker& operator= (const IPPresizeInvoker&);
|
||||
};
|
||||
@@ -4019,31 +4051,31 @@ class IPPwarpAffineInvoker :
|
||||
public ParallelLoopBody
|
||||
{
|
||||
public:
|
||||
IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpAffineBackFunc _func, bool *_ok) :
|
||||
IPPwarpAffineInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[2][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippicviWarpAffineBackFunc _func, bool *_ok) :
|
||||
ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
|
||||
virtual void operator() (const Range& range) const
|
||||
{
|
||||
IppiSize srcsize = { src.cols, src.rows };
|
||||
IppiRect srcroi = { 0, 0, src.cols, src.rows };
|
||||
IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start };
|
||||
int cnn = src.channels();
|
||||
if( borderType == BORDER_CONSTANT )
|
||||
{
|
||||
IppiSize setSize = { dst.cols, range.end - range.start };
|
||||
void *dataPointer = dst.data + dst.step[0] * range.start;
|
||||
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
|
||||
*ok = false;
|
||||
}
|
||||
virtual void operator() (const Range& range) const
|
||||
{
|
||||
IppiSize srcsize = { src.cols, src.rows };
|
||||
IppiRect srcroi = { 0, 0, src.cols, src.rows };
|
||||
IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start };
|
||||
int cnn = src.channels();
|
||||
if( borderType == BORDER_CONSTANT )
|
||||
{
|
||||
IppiSize setSize = { dst.cols, range.end - range.start };
|
||||
void *dataPointer = dst.data + dst.step[0] * range.start;
|
||||
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( func( src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode ) < 0) ////Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr
|
||||
*ok = false;
|
||||
}
|
||||
private:
|
||||
Mat &src;
|
||||
Mat &dst;
|
||||
@@ -4051,7 +4083,7 @@ private:
|
||||
int mode;
|
||||
int borderType;
|
||||
Scalar borderValue;
|
||||
ippiWarpAffineBackFunc func;
|
||||
ippicviWarpAffineBackFunc func;
|
||||
bool *ok;
|
||||
const IPPwarpAffineInvoker& operator= (const IPPwarpAffineInvoker&);
|
||||
};
|
||||
@@ -4214,16 +4246,16 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
|
||||
( borderType == cv::BORDER_TRANSPARENT || ( borderType == cv::BORDER_CONSTANT ) ) )
|
||||
{
|
||||
int type = src.type();
|
||||
ippiWarpAffineBackFunc ippFunc =
|
||||
type == CV_8UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_16u_C4R :
|
||||
type == CV_32FC1 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiWarpAffineBackFunc)ippiWarpAffineBack_32f_C4R :
|
||||
ippicviWarpAffineBackFunc ippFunc =
|
||||
type == CV_8UC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C1R :
|
||||
type == CV_8UC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C3R :
|
||||
type == CV_8UC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_8u_C4R :
|
||||
type == CV_16UC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C1R :
|
||||
type == CV_16UC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C3R :
|
||||
type == CV_16UC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_16u_C4R :
|
||||
type == CV_32FC1 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C1R :
|
||||
type == CV_32FC3 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C3R :
|
||||
type == CV_32FC4 ? (ippicviWarpAffineBackFunc)ippicviWarpAffineBack_32f_C4R :
|
||||
0;
|
||||
int mode =
|
||||
flags == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
||||
@@ -4362,32 +4394,32 @@ class IPPwarpPerspectiveInvoker :
|
||||
public ParallelLoopBody
|
||||
{
|
||||
public:
|
||||
IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippiWarpPerspectiveBackFunc _func, bool *_ok) :
|
||||
IPPwarpPerspectiveInvoker(Mat &_src, Mat &_dst, double (&_coeffs)[3][3], int &_interpolation, int &_borderType, const Scalar &_borderValue, ippicviWarpPerspectiveBackFunc _func, bool *_ok) :
|
||||
ParallelLoopBody(), src(_src), dst(_dst), mode(_interpolation), coeffs(_coeffs), borderType(_borderType), borderValue(_borderValue), func(_func), ok(_ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
|
||||
virtual void operator() (const Range& range) const
|
||||
{
|
||||
IppiSize srcsize = {src.cols, src.rows};
|
||||
IppiRect srcroi = {0, 0, src.cols, src.rows};
|
||||
IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start};
|
||||
int cnn = src.channels();
|
||||
virtual void operator() (const Range& range) const
|
||||
{
|
||||
IppiSize srcsize = {src.cols, src.rows};
|
||||
IppiRect srcroi = {0, 0, src.cols, src.rows};
|
||||
IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start};
|
||||
int cnn = src.channels();
|
||||
|
||||
if( borderType == BORDER_CONSTANT )
|
||||
{
|
||||
IppiSize setSize = {dst.cols, range.end - range.start};
|
||||
void *dataPointer = dst.data + dst.step[0] * range.start;
|
||||
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0)
|
||||
*ok = false;
|
||||
}
|
||||
if( borderType == BORDER_CONSTANT )
|
||||
{
|
||||
IppiSize setSize = {dst.cols, range.end - range.start};
|
||||
void *dataPointer = dst.data + dst.step[0] * range.start;
|
||||
if( !IPPSet( borderValue, dataPointer, (int)dst.step[0], setSize, cnn, src.depth() ) )
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( func(src.data, srcsize, (int)src.step[0], srcroi, dst.data, (int)dst.step[0], dstroi, coeffs, mode) < 0)
|
||||
*ok = false;
|
||||
}
|
||||
private:
|
||||
Mat &src;
|
||||
Mat &dst;
|
||||
@@ -4395,7 +4427,7 @@ private:
|
||||
int mode;
|
||||
int borderType;
|
||||
const Scalar borderValue;
|
||||
ippiWarpPerspectiveBackFunc func;
|
||||
ippicviWarpPerspectiveBackFunc func;
|
||||
bool *ok;
|
||||
const IPPwarpPerspectiveInvoker& operator= (const IPPwarpPerspectiveInvoker&);
|
||||
};
|
||||
@@ -4444,16 +4476,16 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
|
||||
( borderType == cv::BORDER_TRANSPARENT || borderType == cv::BORDER_CONSTANT ) )
|
||||
{
|
||||
int type = src.type();
|
||||
ippiWarpPerspectiveBackFunc ippFunc =
|
||||
type == CV_8UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_16u_C4R :
|
||||
type == CV_32FC1 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiWarpPerspectiveBackFunc)ippiWarpPerspectiveBack_32f_C4R :
|
||||
ippicviWarpPerspectiveBackFunc ippFunc =
|
||||
type == CV_8UC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C1R :
|
||||
type == CV_8UC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C3R :
|
||||
type == CV_8UC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_8u_C4R :
|
||||
type == CV_16UC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C1R :
|
||||
type == CV_16UC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C3R :
|
||||
type == CV_16UC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_16u_C4R :
|
||||
type == CV_32FC1 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C1R :
|
||||
type == CV_32FC3 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C3R :
|
||||
type == CV_32FC4 ? (ippicviWarpPerspectiveBackFunc)ippicviWarpPerspectiveBack_32f_C4R :
|
||||
0;
|
||||
int mode =
|
||||
flags == INTER_LINEAR ? IPPI_INTER_LINEAR :
|
||||
|
||||
@@ -1149,26 +1149,26 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
|
||||
_src = &temp;
|
||||
}
|
||||
//DEPRECATED. Allocates and initializes morphology state structure for erosion or dilation operation.
|
||||
typedef IppStatus (CV_STDCALL* ippiMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **);
|
||||
typedef IppStatus (CV_STDCALL* ippiMorphologyBorderReplicateFunc)(const void*, int, void *, int,
|
||||
typedef IppStatus (CV_STDCALL* ippicviMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **);
|
||||
typedef IppStatus (CV_STDCALL* ippicviMorphologyBorderReplicateFunc)(const void*, int, void *, int,
|
||||
IppiSize, IppiBorderType, IppiMorphState *);
|
||||
typedef IppStatus (CV_STDCALL* ippiFilterMinMaxGetBufferSizeFunc)(int, IppiSize, int*);
|
||||
typedef IppStatus (CV_STDCALL* ippiFilterMinMaxBorderReplicateFunc)(const void*, int, void*, int,
|
||||
typedef IppStatus (CV_STDCALL* ippicviFilterMinMaxGetBufferSizeFunc)(int, IppiSize, int*);
|
||||
typedef IppStatus (CV_STDCALL* ippicviFilterMinMaxBorderReplicateFunc)(const void*, int, void*, int,
|
||||
IppiSize, IppiSize, IppiPoint, void*);
|
||||
|
||||
ippiMorphologyInitAllocFunc initAllocFunc = 0;
|
||||
ippiMorphologyBorderReplicateFunc morphFunc = 0;
|
||||
ippiFilterMinMaxGetBufferSizeFunc getBufSizeFunc = 0;
|
||||
ippiFilterMinMaxBorderReplicateFunc morphRectFunc = 0;
|
||||
ippicviMorphologyInitAllocFunc initAllocFunc = 0;
|
||||
ippicviMorphologyBorderReplicateFunc morphFunc = 0;
|
||||
ippicviFilterMinMaxGetBufferSizeFunc getBufSizeFunc = 0;
|
||||
ippicviFilterMinMaxBorderReplicateFunc morphRectFunc = 0;
|
||||
|
||||
#define IPP_MORPH_CASE(type, flavor) \
|
||||
case type: \
|
||||
initAllocFunc = (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_##flavor; \
|
||||
morphFunc = op == MORPH_ERODE ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_##flavor : \
|
||||
(ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_##flavor; \
|
||||
getBufSizeFunc = (ippiFilterMinMaxGetBufferSizeFunc)ippiFilterMinGetBufferSize_##flavor; \
|
||||
morphRectFunc = op == MORPH_ERODE ? (ippiFilterMinMaxBorderReplicateFunc)ippiFilterMinBorderReplicate_##flavor : \
|
||||
(ippiFilterMinMaxBorderReplicateFunc)ippiFilterMaxBorderReplicate_##flavor; \
|
||||
initAllocFunc = (ippicviMorphologyInitAllocFunc)ippicviMorphologyInitAlloc_##flavor; \
|
||||
morphFunc = op == MORPH_ERODE ? (ippicviMorphologyBorderReplicateFunc)ippicviErodeBorderReplicate_##flavor : \
|
||||
(ippicviMorphologyBorderReplicateFunc)ippicviDilateBorderReplicate_##flavor; \
|
||||
getBufSizeFunc = (ippicviFilterMinMaxGetBufferSizeFunc)ippicviFilterMinGetBufferSize_##flavor; \
|
||||
morphRectFunc = op == MORPH_ERODE ? (ippicviFilterMinMaxBorderReplicateFunc)ippicviFilterMinBorderReplicate_##flavor : \
|
||||
(ippicviFilterMinMaxBorderReplicateFunc)ippicviFilterMaxBorderReplicate_##flavor; \
|
||||
break
|
||||
|
||||
switch( type )
|
||||
@@ -1196,7 +1196,7 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
|
||||
bool is_ok = morphFunc( _src->data, (int)_src->step[0],
|
||||
dst.data, (int)dst.step[0],
|
||||
roiSize, ippBorderRepl, pState ) >= 0;
|
||||
ippiMorphologyFree(pState);
|
||||
ippicviMorphologyFree(pState);
|
||||
return is_ok;
|
||||
}
|
||||
else if( rectKernel && morphRectFunc && getBufSizeFunc )
|
||||
|
||||
@@ -375,7 +375,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
Mat patch = _patch.getMat();
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
typedef IppStatus (CV_STDCALL *ippiGetRectSubPixFunc)( const void* src, int src_step,
|
||||
typedef IppStatus (CV_STDCALL *ippicviGetRectSubPixFunc)( const void* src, int src_step,
|
||||
IppiSize src_size, void* dst,
|
||||
int dst_step, IppiSize win_size,
|
||||
IppiPoint_32f center,
|
||||
@@ -385,10 +385,10 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
|
||||
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;
|
||||
ippicviGetRectSubPixFunc ippfunc =
|
||||
srctype == CV_8UC1 && ddepth == CV_8U ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_8u_C1R :
|
||||
srctype == CV_8UC1 && ddepth == CV_32F ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_8u32f_C1R :
|
||||
srctype == CV_32FC1 && ddepth == CV_32F ? (ippicviGetRectSubPixFunc)ippicviCopySubpixIntersect_32f_C1R : 0;
|
||||
|
||||
if( ippfunc && ippfunc(image.data, (int)image.step, src_size, patch.data,
|
||||
(int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 )
|
||||
|
||||
@@ -1115,14 +1115,16 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize,
|
||||
Mat src = _src.getMat(), dst = _dst.getMat();
|
||||
IppiSize roi = { src.cols, src.rows };
|
||||
int bufSize = 0;
|
||||
ippiFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize);
|
||||
AutoBuffer<uchar> buf(bufSize+128);
|
||||
if( ippiFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step,
|
||||
(Ipp32f *)dst.data, (int)dst.step,
|
||||
roi, ksize.width, (Ipp32f)sigma1,
|
||||
(IppiBorderType)borderType, 0.0,
|
||||
alignPtr(&buf[0],32)) >= 0 )
|
||||
return;
|
||||
if (ippStsNoErr == ippicviFilterGaussGetBufferSize_32f_C1R(roi, ksize.width, &bufSize))
|
||||
{
|
||||
AutoBuffer<uchar> buf(bufSize+128);
|
||||
if( ippicviFilterGaussBorder_32f_C1R((const Ipp32f *)src.data, (int)src.step,
|
||||
(Ipp32f *)dst.data, (int)dst.step,
|
||||
roi, ksize.width, (Ipp32f)sigma1,
|
||||
(IppiBorderType)borderType, 0.0,
|
||||
alignPtr(&buf[0],32)) >= 0 )
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2180,11 +2182,19 @@ public:
|
||||
IppiSize kernel = {d, d};
|
||||
IppiSize roi={dst.cols, range.end - range.start};
|
||||
int bufsize=0;
|
||||
ippiFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize);
|
||||
if (ippStsNoErr != ippicviFilterBilateralGetBufSize_8u_C1R( ippiFilterBilateralGauss, roi, kernel, &bufsize))
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
AutoBuffer<uchar> buf(bufsize);
|
||||
IppiFilterBilateralSpec *pSpec = (IppiFilterBilateralSpec *)alignPtr(&buf[0], 32);
|
||||
ippiFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, (Ipp32f)sigma_color, (Ipp32f)sigma_space, 1, pSpec );
|
||||
if( ippiFilterBilateral_8u_C1R( src.ptr<uchar>(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr<uchar>(range.start), (int)dst.step[0], roi, kernel, pSpec ) < 0)
|
||||
if (ippStsNoErr != ippicviFilterBilateralInit_8u_C1R( ippiFilterBilateralGauss, kernel, (Ipp32f)sigma_color, (Ipp32f)sigma_space, 1, pSpec ))
|
||||
{
|
||||
*ok = false;
|
||||
return;
|
||||
}
|
||||
if( ippicviFilterBilateral_8u_C1R( src.ptr<uchar>(range.start) + radius * ((int)src.step[0] + 1), (int)src.step[0], dst.ptr<uchar>(range.start), (int)dst.step[0], roi, kernel, pSpec ) < 0)
|
||||
*ok = false;
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "opencl_kernels.hpp"
|
||||
|
||||
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
|
||||
static IppStatus sts = ippInit();
|
||||
static IppStatus sts = ippicvInit();
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
@@ -365,30 +365,32 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output
|
||||
#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 ) )
|
||||
{
|
||||
IppStatus status;
|
||||
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 );
|
||||
status = ippicviSqrIntegral_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 );
|
||||
status = ippicviIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 );
|
||||
}
|
||||
}
|
||||
else if( sdepth == CV_32S )
|
||||
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 );
|
||||
status = ippicviSqrIntegral_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 );
|
||||
status = ippicviIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 );
|
||||
}
|
||||
}
|
||||
return;
|
||||
if (ippStsNoErr == status)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user