Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/core/perf/perf_dft.cpp
16354 views
1
#include "perf_precomp.hpp"
2
3
namespace opencv_test
4
{
5
using namespace perf;
6
7
///////////////////////////////////////////////////////dft//////////////////////////////////////////////////////////////
8
9
#define MAT_TYPES_DFT CV_32FC1, CV_32FC2, CV_64FC1
10
#define MAT_SIZES_DFT cv::Size(320, 480), cv::Size(800, 600), cv::Size(1280, 1024), sz1080p, sz2K
11
CV_ENUM(FlagsType, 0, DFT_INVERSE, DFT_SCALE, DFT_COMPLEX_OUTPUT, DFT_ROWS, DFT_INVERSE|DFT_COMPLEX_OUTPUT)
12
#define TEST_MATS_DFT testing::Combine(testing::Values(MAT_SIZES_DFT), testing::Values(MAT_TYPES_DFT), FlagsType::all(), testing::Values(true, false))
13
14
typedef tuple<Size, MatType, FlagsType, bool> Size_MatType_FlagsType_NzeroRows_t;
15
typedef perf::TestBaseWithParam<Size_MatType_FlagsType_NzeroRows_t> Size_MatType_FlagsType_NzeroRows;
16
17
PERF_TEST_P(Size_MatType_FlagsType_NzeroRows, dft, TEST_MATS_DFT)
18
{
19
Size sz = get<0>(GetParam());
20
int type = get<1>(GetParam());
21
int flags = get<2>(GetParam());
22
bool isNzeroRows = get<3>(GetParam());
23
24
int nonzero_rows = 0;
25
26
Mat src(sz, type);
27
Mat dst(sz, type);
28
29
declare.in(src, WARMUP_RNG).time(60);
30
31
if (isNzeroRows)
32
nonzero_rows = sz.height/2;
33
34
TEST_CYCLE() dft(src, dst, flags, nonzero_rows);
35
36
SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
37
}
38
39
///////////////////////////////////////////////////////dct//////////////////////////////////////////////////////
40
41
CV_ENUM(DCT_FlagsType, 0, DCT_INVERSE , DCT_ROWS, DCT_INVERSE|DCT_ROWS)
42
43
typedef tuple<Size, MatType, DCT_FlagsType> Size_MatType_Flag_t;
44
typedef perf::TestBaseWithParam<Size_MatType_Flag_t> Size_MatType_Flag;
45
46
PERF_TEST_P(Size_MatType_Flag, dct, testing::Combine(
47
testing::Values(cv::Size(320, 240),cv::Size(800, 600),
48
cv::Size(1024, 768), cv::Size(1280, 1024),
49
sz1080p, sz2K),
50
testing::Values(CV_32FC1, CV_64FC1), DCT_FlagsType::all()))
51
{
52
Size sz = get<0>(GetParam());
53
int type = get<1>(GetParam());
54
int flags = get<2>(GetParam());
55
56
Mat src(sz, type);
57
Mat dst(sz, type);
58
59
declare
60
.in(src, WARMUP_RNG)
61
.out(dst)
62
.time(60);
63
64
TEST_CYCLE() dct(src, dst, flags);
65
66
SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
67
}
68
69
} // namespace
70
71