Commit 664cd546 authored by Andrey Kamaev's avatar Andrey Kamaev

Tegra-optimized cv::compare

parent 938b1b67
......@@ -59,6 +59,8 @@
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/calib3d/calib3d_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif
#endif
......@@ -1124,55 +1124,45 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
static BinaryFunc maxTab[] =
{
(BinaryFunc)max8u, (BinaryFunc)max8s, (BinaryFunc)max16u, (BinaryFunc)max16s,
(BinaryFunc)max32s, (BinaryFunc)max32f, (BinaryFunc)max64f, 0
(BinaryFunc)GET_OPTIMIZED(max8u), (BinaryFunc)GET_OPTIMIZED(max8s),
(BinaryFunc)GET_OPTIMIZED(max16u), (BinaryFunc)GET_OPTIMIZED(max16s),
(BinaryFunc)GET_OPTIMIZED(max32s),
(BinaryFunc)GET_OPTIMIZED(max32f), (BinaryFunc)max64f,
0
};
static BinaryFunc minTab[] =
{
(BinaryFunc)min8u, (BinaryFunc)min8s, (BinaryFunc)min16u, (BinaryFunc)min16s,
(BinaryFunc)min32s, (BinaryFunc)min32f, (BinaryFunc)min64f, 0
(BinaryFunc)GET_OPTIMIZED(min8u), (BinaryFunc)GET_OPTIMIZED(min8s),
(BinaryFunc)GET_OPTIMIZED(min16u), (BinaryFunc)GET_OPTIMIZED(min16s),
(BinaryFunc)GET_OPTIMIZED(min32s),
(BinaryFunc)GET_OPTIMIZED(min32f), (BinaryFunc)min64f,
0
};
}
void cv::bitwise_and(InputArray a, InputArray b, OutputArray c, InputArray mask)
{
BinaryFunc f =
#ifdef HAVE_TEGRA_OPTIMIZATION
(BinaryFunc)tegra::
#endif
and8u;
BinaryFunc f = (BinaryFunc)GET_OPTIMIZED(and8u);
binary_op(a, b, c, mask, &f, true);
}
void cv::bitwise_or(InputArray a, InputArray b, OutputArray c, InputArray mask)
{
BinaryFunc f =
#ifdef HAVE_TEGRA_OPTIMIZATION
(BinaryFunc)tegra::
#endif
or8u;
BinaryFunc f = (BinaryFunc)GET_OPTIMIZED(or8u);
binary_op(a, b, c, mask, &f, true);
}
void cv::bitwise_xor(InputArray a, InputArray b, OutputArray c, InputArray mask)
{
BinaryFunc f =
#ifdef HAVE_TEGRA_OPTIMIZATION
(BinaryFunc)tegra::
#endif
xor8u;
BinaryFunc f = (BinaryFunc)GET_OPTIMIZED(xor8u);
binary_op(a, b, c, mask, &f, true);
}
void cv::bitwise_not(InputArray a, OutputArray c, InputArray mask)
{
BinaryFunc f =
#ifdef HAVE_TEGRA_OPTIMIZATION
(BinaryFunc)tegra::
#endif
not8u;
BinaryFunc f = (BinaryFunc)GET_OPTIMIZED(not8u);
binary_op(a, a, c, mask, &f, true);
}
......@@ -1453,38 +1443,31 @@ void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
}
}
#ifdef HAVE_TEGRA_OPTIMIZATION
static BinaryFunc addTab[] =
{
(BinaryFunc)tegra::add8u, (BinaryFunc)add8s, (BinaryFunc)add16u, (BinaryFunc)add16s,
(BinaryFunc)add32s, (BinaryFunc)add32f, (BinaryFunc)add64f, 0
};
static BinaryFunc subTab[] =
{
(BinaryFunc)tegra::sub8u, (BinaryFunc)sub8s, (BinaryFunc)sub16u, (BinaryFunc)sub16s,
(BinaryFunc)sub32s, (BinaryFunc)sub32f, (BinaryFunc)sub64f, 0
};
#else
static BinaryFunc addTab[] =
{
(BinaryFunc)add8u, (BinaryFunc)add8s, (BinaryFunc)add16u, (BinaryFunc)add16s,
(BinaryFunc)add32s, (BinaryFunc)add32f, (BinaryFunc)add64f, 0
(BinaryFunc)GET_OPTIMIZED(add8u), (BinaryFunc)GET_OPTIMIZED(add8s),
(BinaryFunc)GET_OPTIMIZED(add16u), (BinaryFunc)GET_OPTIMIZED(add16s),
(BinaryFunc)GET_OPTIMIZED(add32s),
(BinaryFunc)GET_OPTIMIZED(add32f), (BinaryFunc)add64f,
0
};
static BinaryFunc subTab[] =
{
(BinaryFunc)sub8u, (BinaryFunc)sub8s, (BinaryFunc)sub16u, (BinaryFunc)sub16s,
(BinaryFunc)sub32s, (BinaryFunc)sub32f, (BinaryFunc)sub64f, 0
(BinaryFunc)GET_OPTIMIZED(sub8u), (BinaryFunc)GET_OPTIMIZED(sub8s),
(BinaryFunc)GET_OPTIMIZED(sub16u), (BinaryFunc)GET_OPTIMIZED(sub16s),
(BinaryFunc)GET_OPTIMIZED(sub32s),
(BinaryFunc)GET_OPTIMIZED(sub32f), (BinaryFunc)sub64f,
0
};
#endif
static BinaryFunc absdiffTab[] =
{
(BinaryFunc)absdiff8u, (BinaryFunc)absdiff8s, (BinaryFunc)absdiff16u,
(BinaryFunc)absdiff16s, (BinaryFunc)absdiff32s, (BinaryFunc)absdiff32f,
(BinaryFunc)absdiff64f, 0
(BinaryFunc)GET_OPTIMIZED(absdiff8u), (BinaryFunc)GET_OPTIMIZED(absdiff8s),
(BinaryFunc)GET_OPTIMIZED(absdiff16u), (BinaryFunc)GET_OPTIMIZED(absdiff16s),
(BinaryFunc)GET_OPTIMIZED(absdiff32s),
(BinaryFunc)GET_OPTIMIZED(absdiff32f), (BinaryFunc)absdiff64f,
0
};
}
......@@ -2094,9 +2077,11 @@ static void cmp64f(const double* src1, size_t step1, const double* src2, size_t
static BinaryFunc cmpTab[] =
{
(BinaryFunc)cmp8u, (BinaryFunc)cmp8s, (BinaryFunc)cmp16u,
(BinaryFunc)cmp16s, (BinaryFunc)cmp32s, (BinaryFunc)cmp32f,
(BinaryFunc)cmp64f, 0
(BinaryFunc)GET_OPTIMIZED(cmp8u), (BinaryFunc)GET_OPTIMIZED(cmp8s),
(BinaryFunc)GET_OPTIMIZED(cmp16u), (BinaryFunc)GET_OPTIMIZED(cmp16s),
(BinaryFunc)GET_OPTIMIZED(cmp32s),
(BinaryFunc)GET_OPTIMIZED(cmp32f), (BinaryFunc)cmp64f,
0
};
......
......@@ -67,6 +67,8 @@
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/core/core_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif
namespace cv
......
......@@ -193,19 +193,14 @@ static int sum64f( const double* src, const uchar* mask, double* dst, int len, i
typedef int (*SumFunc)(const uchar*, const uchar* mask, uchar*, int, int);
#ifdef HAVE_TEGRA_OPTIMIZATION
static SumFunc sumTab[] =
{
(SumFunc)tegra::sum8u, (SumFunc)sum8s, (SumFunc)sum16u, (SumFunc)sum16s,
(SumFunc)sum32s, (SumFunc)tegra::sum32f, (SumFunc)sum64f, 0
(SumFunc)GET_OPTIMIZED(sum8u), (SumFunc)sum8s,
(SumFunc)sum16u, (SumFunc)sum16s,
(SumFunc)sum32s,
(SumFunc)GET_OPTIMIZED(sum32f), (SumFunc)sum64f,
0
};
#else
static SumFunc sumTab[] =
{
(SumFunc)sum8u, (SumFunc)sum8s, (SumFunc)sum16u, (SumFunc)sum16s,
(SumFunc)sum32s, (SumFunc)sum32f, (SumFunc)sum64f, 0
};
#endif
template<typename T>
static int countNonZero_(const T* src, int len )
......@@ -709,21 +704,14 @@ static void minMaxIdx_64f(const double* src, const uchar* mask, double* minval,
typedef void (*MinMaxIdxFunc)(const uchar*, const uchar*, int*, int*, size_t*, size_t*, int, size_t);
#ifdef HAVE_TEGRA_OPTIMIZATION
static MinMaxIdxFunc minmaxTab[] =
{
(MinMaxIdxFunc)tegra::minMaxIdx_8u, (MinMaxIdxFunc)tegra::minMaxIdx_8s, (MinMaxIdxFunc)tegra::minMaxIdx_16u,
(MinMaxIdxFunc)tegra::minMaxIdx_16s, (MinMaxIdxFunc)tegra::minMaxIdx_32s, (MinMaxIdxFunc)tegra::minMaxIdx_32f,
(MinMaxIdxFunc)tegra::minMaxIdx_64f, 0
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_8u), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_8s),
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_16u), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_16s),
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32s),
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32f), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_64f),
0
};
#else
static MinMaxIdxFunc minmaxTab[] =
{
(MinMaxIdxFunc)minMaxIdx_8u, (MinMaxIdxFunc)minMaxIdx_8s, (MinMaxIdxFunc)minMaxIdx_16u,
(MinMaxIdxFunc)minMaxIdx_16s, (MinMaxIdxFunc)minMaxIdx_32s, (MinMaxIdxFunc)minMaxIdx_32f,
(MinMaxIdxFunc)minMaxIdx_64f, 0
};
#endif
static void ofs2idx(const Mat& a, size_t ofs, int* idx)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment