perf_flip.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. #include "perf_precomp.hpp"
  5. namespace opencv_test { namespace {
  6. using namespace perf;
  7. enum
  8. {
  9. FLIP_XY = 0,
  10. FLIP_X = 1,
  11. FLIP_Y = 2,
  12. };
  13. #define FLIP_SIZES szQVGA, szVGA, sz1080p
  14. #define FLIP_TYPES CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4, CV_8SC1, CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4, CV_32SC1, CV_32FC1
  15. #define FLIP_CODES FLIP_X, FLIP_Y, FLIP_XY
  16. CV_FLAGS(FlipCode, FLIP_X, FLIP_Y, FLIP_XY);
  17. typedef tuple<Size, MatType, FlipCode> Size_MatType_FlipCode_t;
  18. typedef perf::TestBaseWithParam<Size_MatType_FlipCode_t> Size_MatType_FlipCode;
  19. PERF_TEST_P(Size_MatType_FlipCode,
  20. flip,
  21. testing::Combine(testing::Values(FLIP_SIZES),
  22. testing::Values(FLIP_TYPES),
  23. testing::Values(FLIP_CODES)))
  24. {
  25. Size sz = get<0>(GetParam());
  26. int matType = get<1>(GetParam());
  27. int flipCode = get<2>(GetParam()) - 1;
  28. Mat src(sz, matType);
  29. Mat dst(sz, matType);
  30. declare.in(src, WARMUP_RNG).out(dst);
  31. TEST_CYCLE() cv::flip(src, dst, flipCode);
  32. SANITY_CHECK_NOTHING();
  33. }
  34. }} // namespace opencv_test