ipp_countNonZero build fix;
Removed IPP port for tiny arithm.cpp functions Additional warnings fix on various platforms. Build without OPENCL and GCC warnings fixed Fixed warnings, trailing spaces and removed unused secure_cpy. IPP code refactored. IPP code path implemented as separate static functions to simplify future work with IPP code and make it more readable.
This commit is contained in:

committed by
Pavel Vlasov

parent
b1a8e4f760
commit
a5a21019b2
@@ -5194,17 +5194,9 @@ dtype* dst, size_t dstep, Size size, double* scale) \
|
||||
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||
dtype* dst, size_t dstep, Size size, double*) \
|
||||
{ \
|
||||
CV_IPP_CHECK()\
|
||||
if (src && dst)\
|
||||
{\
|
||||
if (src && dst)\
|
||||
{\
|
||||
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \
|
||||
{\
|
||||
CV_IMPL_ADD(CV_IMPL_IPP)\
|
||||
return; \
|
||||
}\
|
||||
setIppErrorStatus(); \
|
||||
}\
|
||||
CV_IPP_RUN(true, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0)\
|
||||
}\
|
||||
cvt_(src, sstep, dst, dstep, size); \
|
||||
}
|
||||
@@ -5213,17 +5205,9 @@ static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
|
||||
dtype* dst, size_t dstep, Size size, double*) \
|
||||
{ \
|
||||
CV_IPP_CHECK()\
|
||||
if (src && dst)\
|
||||
{\
|
||||
if (src && dst)\
|
||||
{\
|
||||
if (ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \
|
||||
{\
|
||||
CV_IMPL_ADD(CV_IMPL_IPP)\
|
||||
return; \
|
||||
}\
|
||||
setIppErrorStatus(); \
|
||||
}\
|
||||
CV_IPP_RUN(true, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0)\
|
||||
}\
|
||||
cvt_(src, sstep, dst, dstep, size); \
|
||||
}
|
||||
@@ -5907,6 +5891,55 @@ private:
|
||||
|
||||
}
|
||||
|
||||
namespace cv
|
||||
{
|
||||
#if defined(HAVE_IPP)
|
||||
static bool ipp_lut(InputArray _src, InputArray _lut, OutputArray _dst)
|
||||
{
|
||||
int cn = _src.channels();
|
||||
int lutcn = _lut.channels();
|
||||
|
||||
Mat src = _src.getMat(), lut = _lut.getMat();
|
||||
_dst.create(src.dims, src.size, CV_MAKETYPE(_lut.depth(), cn));
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
if (_src.dims() <= 2)
|
||||
{
|
||||
bool ok = false;
|
||||
Ptr<ParallelLoopBody> body;
|
||||
|
||||
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
|
||||
#if 0 // there are no performance benefits (PR #2653)
|
||||
if (lutcn == 1)
|
||||
{
|
||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTC1(src, lut, dst, &ok);
|
||||
body.reset(p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((lutcn == 3 || lutcn == 4) && elemSize1 == 1)
|
||||
{
|
||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTCN(src, lut, dst, &ok);
|
||||
body.reset(p);
|
||||
}
|
||||
|
||||
if (body != NULL && ok)
|
||||
{
|
||||
Range all(0, dst.rows);
|
||||
if (dst.total()>>18)
|
||||
parallel_for_(all, *body, (double)std::max((size_t)1, dst.total()>>16));
|
||||
else
|
||||
(*body)(all);
|
||||
if (ok)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
{
|
||||
int cn = _src.channels(), depth = _src.depth();
|
||||
@@ -5919,6 +5952,10 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2,
|
||||
ocl_LUT(_src, _lut, _dst))
|
||||
|
||||
CV_IPP_RUN((_src.dims() <= 2 && ((lutcn == 1 || lutcn == 3 || lutcn == 4) && CV_ELEM_SIZE1(_dst.depth()) == 1) && lutcn != 1), //lutcn == 1 ipp implementation switched off
|
||||
ipp_lut(_src, _lut, _dst));
|
||||
|
||||
|
||||
Mat src = _src.getMat(), lut = _lut.getMat();
|
||||
_dst.create(src.dims, src.size, CV_MAKETYPE(_lut.depth(), cn));
|
||||
Mat dst = _dst.getMat();
|
||||
@@ -5927,25 +5964,6 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
|
||||
{
|
||||
bool ok = false;
|
||||
Ptr<ParallelLoopBody> body;
|
||||
#if defined(HAVE_IPP)
|
||||
CV_IPP_CHECK()
|
||||
{
|
||||
size_t elemSize1 = CV_ELEM_SIZE1(dst.depth());
|
||||
#if 0 // there are no performance benefits (PR #2653)
|
||||
if (lutcn == 1)
|
||||
{
|
||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTC1(src, lut, dst, &ok);
|
||||
body.reset(p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((lutcn == 3 || lutcn == 4) && elemSize1 == 1)
|
||||
{
|
||||
ParallelLoopBody* p = new ipp::IppLUTParallelBody_LUTCN(src, lut, dst, &ok);
|
||||
body.reset(p);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (body == NULL || ok == false)
|
||||
{
|
||||
ok = false;
|
||||
|
Reference in New Issue
Block a user