Tegra-optimized minMaxLoc/minMaxIdx

This commit is contained in:
Andrey Kamaev 2011-09-14 16:20:10 +00:00
parent 82da7f18d8
commit 6ff2ae1d3a
2 changed files with 22 additions and 3 deletions

View File

@ -345,7 +345,9 @@ PERF_TEST_P( Size_MatType, countNonZero, TYPICAL_MATS_C1 )
/*
// void minMaxLoc(InputArray src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
*/
PERF_TEST_P( Size_MatType, minMaxLoc, TYPICAL_MATS_C1 )
PERF_TEST_P( Size_MatType, minMaxLoc, testing::Combine(
testing::Values( TYPICAL_MAT_SIZES ),
testing::Values( CV_8UC1, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_64FC1 ) ) )
{
Size sz = std::tr1::get<0>(GetParam());
int matType = std::tr1::get<1>(GetParam());
@ -354,7 +356,15 @@ PERF_TEST_P( Size_MatType, minMaxLoc, TYPICAL_MATS_C1 )
double minVal, maxVal;
Point minLoc, maxLoc;
declare.in(src, WARMUP_RNG);
// avoid early exit on 1 byte data
if (matType == CV_8U)
randu(src, 1, 254);
else if (matType == CV_8S)
randu(src, -127, 126);
else
warmup(src, WARMUP_RNG);
declare.in(src);
TEST_CYCLE(100) { minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc); }

View File

@ -702,12 +702,21 @@ 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
};
#else
static MinMaxIdxFunc minmaxTab[] =
{
(MinMaxIdxFunc)minMaxIdx_8u, (MinMaxIdxFunc)minMaxIdx_8s, (MinMaxIdxFunc)minMaxIdx_16u,
(MinMaxIdxFunc)minMaxIdx_16s, (MinMaxIdxFunc)minMaxIdx_32s, (MinMaxIdxFunc)minMaxIdx_32f,
(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)
{