Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/gapi/perf/internal/gapi_compiler_perf_tests.cpp
16358 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
//
5
// Copyright (C) 2018 Intel Corporation
6
7
8
#include "perf_precomp.hpp"
9
#include "../../test/common/gapi_tests_common.hpp"
10
#include "../../src/backends/fluid/gfluidcore.hpp"
11
12
namespace opencv_test
13
{
14
using namespace perf;
15
16
class CompilerPerfTest : public TestPerfParams<tuple<cv::Size, MatType>> {};
17
PERF_TEST_P_(CompilerPerfTest, TestPerformance)
18
{
19
const auto params = GetParam();
20
Size sz = get<0>(params);
21
MatType type = get<1>(params);
22
23
initMatsRandU(type, sz, type, false);
24
25
// G-API code ////////////////////////////////////////////////////////////
26
cv::GMat in;
27
auto splitted = cv::gapi::split3(in);
28
auto add1 = cv::gapi::addC({1}, std::get<0>(splitted));
29
auto add2 = cv::gapi::addC({2}, std::get<1>(splitted));
30
auto add3 = cv::gapi::addC({3}, std::get<2>(splitted));
31
auto out = cv::gapi::merge3(add1, add2, add3);
32
33
TEST_CYCLE()
34
{
35
cv::GComputation c(in, out);
36
c.apply(in_mat1, out_mat_gapi, cv::compile_args(cv::gapi::core::fluid::kernels()));
37
}
38
39
SANITY_CHECK_NOTHING();
40
}
41
42
INSTANTIATE_TEST_CASE_P(CompilerPerfTest, CompilerPerfTest,
43
Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
44
Values(CV_8UC3)));
45
46
} // namespace opencv_test
47
48