Imgproc_Hist_MinMaxVal.accuracy fix;

Some code style corrections;
This commit is contained in:
Pavel Vlasov
2015-06-24 13:50:17 +03:00
parent a5a21019b2
commit 101607a7d0
8 changed files with 556 additions and 606 deletions

View File

@@ -5194,10 +5194,7 @@ 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*) \
{ \
if (src && dst)\
{\
CV_IPP_RUN(true, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0)\
}\
CV_IPP_RUN(src && dst, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0)\
cvt_(src, sstep, dst, dstep, size); \
}
@@ -5205,10 +5202,7 @@ 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*) \
{ \
if (src && dst)\
{\
CV_IPP_RUN(true, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0)\
}\
CV_IPP_RUN(src && dst, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0)\
cvt_(src, sstep, dst, dstep, size); \
}
#else
@@ -5844,6 +5838,46 @@ private:
IppLUTParallelBody_LUTCN& operator=(const IppLUTParallelBody_LUTCN&);
};
} // namespace ipp
static bool ipp_lut(Mat &src, Mat &lut, Mat &dst)
{
int cn = src.channels();
int lutcn = lut.channels();
if(src.dims > 2)
return false;
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 // IPP
class LUTParallelBody : public ParallelLoopBody
@@ -5891,55 +5925,6 @@ 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();
@@ -5952,18 +5937,17 @@ 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();
CV_IPP_RUN(_src.dims() <= 2, ipp_lut(src, lut, dst));
if (_src.dims() <= 2)
{
bool ok = false;
Ptr<ParallelLoopBody> body;
if (body == NULL || ok == false)
{
ok = false;