gapi_compiler_perf_tests.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include "../perf_precomp.hpp"
  7. #include "../../test/common/gapi_tests_common.hpp"
  8. namespace opencv_test
  9. {
  10. using namespace perf;
  11. class CompilerPerfTest : public TestPerfParams<tuple<cv::Size, MatType>> {};
  12. PERF_TEST_P_(CompilerPerfTest, TestPerformance)
  13. {
  14. const auto params = GetParam();
  15. Size sz = get<0>(params);
  16. MatType type = get<1>(params);
  17. initMatsRandU(type, sz, type, false);
  18. // G-API code ////////////////////////////////////////////////////////////
  19. cv::GMat in;
  20. auto splitted = cv::gapi::split3(in);
  21. auto add1 = cv::gapi::addC({1}, std::get<0>(splitted));
  22. auto add2 = cv::gapi::addC({2}, std::get<1>(splitted));
  23. auto add3 = cv::gapi::addC({3}, std::get<2>(splitted));
  24. auto out = cv::gapi::merge3(add1, add2, add3);
  25. TEST_CYCLE()
  26. {
  27. cv::GComputation c(in, out);
  28. c.apply(in_mat1, out_mat_gapi, cv::compile_args(cv::gapi::core::fluid::kernels()));
  29. }
  30. SANITY_CHECK_NOTHING();
  31. }
  32. INSTANTIATE_TEST_CASE_P(CompilerPerfTest, CompilerPerfTest,
  33. Combine(Values(szSmall128, szVGA, sz720p, sz1080p),
  34. Values(CV_8UC3)));
  35. } // namespace opencv_test