opencv/modules/core/perf/perf_dft.cpp

70 lines
2.3 KiB
C++
Raw Normal View History

2012-10-17 15:12:04 +08:00
#include "perf_precomp.hpp"
namespace opencv_test
{
2012-10-17 15:12:04 +08:00
using namespace perf;
2014-04-16 18:31:44 +08:00
///////////////////////////////////////////////////////dft//////////////////////////////////////////////////////////////
2014-04-23 15:32:12 +08:00
#define MAT_TYPES_DFT CV_32FC1, CV_32FC2, CV_64FC1
#define MAT_SIZES_DFT cv::Size(320, 480), cv::Size(800, 600), cv::Size(1280, 1024), sz1080p, sz2K
CV_ENUM(FlagsType, 0, DFT_INVERSE, DFT_SCALE, DFT_COMPLEX_OUTPUT, DFT_ROWS, DFT_INVERSE|DFT_COMPLEX_OUTPUT)
2014-05-06 15:10:26 +08:00
#define TEST_MATS_DFT testing::Combine(testing::Values(MAT_SIZES_DFT), testing::Values(MAT_TYPES_DFT), FlagsType::all(), testing::Values(true, false))
2012-10-17 15:12:04 +08:00
typedef tuple<Size, MatType, FlagsType, bool> Size_MatType_FlagsType_NzeroRows_t;
2014-05-06 15:10:26 +08:00
typedef perf::TestBaseWithParam<Size_MatType_FlagsType_NzeroRows_t> Size_MatType_FlagsType_NzeroRows;
2014-04-23 15:32:12 +08:00
2014-05-06 15:10:26 +08:00
PERF_TEST_P(Size_MatType_FlagsType_NzeroRows, dft, TEST_MATS_DFT)
2012-10-17 15:12:04 +08:00
{
Size sz = get<0>(GetParam());
int type = get<1>(GetParam());
2014-04-23 15:32:12 +08:00
int flags = get<2>(GetParam());
2014-05-06 15:10:26 +08:00
bool isNzeroRows = get<3>(GetParam());
int nonzero_rows = 0;
2012-10-17 15:12:04 +08:00
Mat src(sz, type);
Mat dst(sz, type);
declare.in(src, WARMUP_RNG).time(60);
2014-05-06 15:10:26 +08:00
if (isNzeroRows)
nonzero_rows = sz.height/2;
TEST_CYCLE() dft(src, dst, flags, nonzero_rows);
2012-10-17 15:12:04 +08:00
2014-04-16 18:31:44 +08:00
SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
2014-04-25 16:30:30 +08:00
}
2014-04-16 18:31:44 +08:00
///////////////////////////////////////////////////////dct//////////////////////////////////////////////////////
2014-04-25 16:30:30 +08:00
CV_ENUM(DCT_FlagsType, 0, DCT_INVERSE , DCT_ROWS, DCT_INVERSE|DCT_ROWS)
2014-04-16 18:31:44 +08:00
typedef tuple<Size, MatType, DCT_FlagsType> Size_MatType_Flag_t;
2014-04-16 18:31:44 +08:00
typedef perf::TestBaseWithParam<Size_MatType_Flag_t> Size_MatType_Flag;
PERF_TEST_P(Size_MatType_Flag, dct, testing::Combine(
testing::Values(cv::Size(320, 240),cv::Size(800, 600),
cv::Size(1024, 768), cv::Size(1280, 1024),
sz1080p, sz2K),
2014-04-25 16:30:30 +08:00
testing::Values(CV_32FC1, CV_64FC1), DCT_FlagsType::all()))
2014-04-16 18:31:44 +08:00
{
Size sz = get<0>(GetParam());
int type = get<1>(GetParam());
int flags = get<2>(GetParam());
Mat src(sz, type);
Mat dst(sz, type);
declare
.in(src, WARMUP_RNG)
.out(dst)
.time(60);
2014-04-25 16:30:30 +08:00
TEST_CYCLE() dct(src, dst, flags);
2014-04-16 18:31:44 +08:00
SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
}
} // namespace