1#include "perf_precomp.hpp"
2
3using namespace std;
4using namespace cv;
5using namespace perf;
6using std::tr1::make_tuple;
7using std::tr1::get;
8
9typedef std::tr1::tuple<Size, MatType, int> Size_SrcDepth_DstChannels_t;
10typedef perf::TestBaseWithParam<Size_SrcDepth_DstChannels_t> Size_SrcDepth_DstChannels;
11
12PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
13             testing::Combine
14             (
15                 testing::Values(TYPICAL_MAT_SIZES),
16                 testing::Values(CV_8U, CV_16S, CV_32S, CV_32F, CV_64F),
17                 testing::Values(2, 3, 4)
18             )
19           )
20{
21    Size sz = get<0>(GetParam());
22    int srcDepth = get<1>(GetParam());
23    int dstChannels = get<2>(GetParam());
24
25    vector<Mat> mv;
26    for( int i = 0; i < dstChannels; ++i )
27    {
28        mv.push_back( Mat(sz, CV_MAKETYPE(srcDepth, 1)) );
29        randu(mv[i], 0, 255);
30    }
31
32    Mat dst;
33    int runs = (sz.width <= 640) ? 8 : 1;
34    TEST_CYCLE_MULTIRUN(runs) merge( (vector<Mat> &)mv, dst );
35
36    SANITY_CHECK(dst, 1e-12);
37}
38