perf_bitwise.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #include "perf_precomp.hpp"
  2. namespace opencv_test
  3. {
  4. using namespace perf;
  5. #define TYPICAL_MAT_SIZES_BITW_ARITHM TYPICAL_MAT_SIZES
  6. #define TYPICAL_MAT_TYPES_BITW_ARITHM CV_8UC1, CV_8SC1, CV_8UC4, CV_32SC1, CV_32SC4
  7. #define TYPICAL_MATS_BITW_ARITHM testing::Combine(testing::Values(TYPICAL_MAT_SIZES_BITW_ARITHM), testing::Values(TYPICAL_MAT_TYPES_BITW_ARITHM))
  8. PERF_TEST_P(Size_MatType, bitwise_not, TYPICAL_MATS_BITW_ARITHM)
  9. {
  10. Size sz = get<0>(GetParam());
  11. int type = get<1>(GetParam());
  12. cv::Mat a = Mat(sz, type);
  13. cv::Mat c = Mat(sz, type);
  14. declare.in(a, WARMUP_RNG).out(c);
  15. declare.iterations(200);
  16. TEST_CYCLE() cv::bitwise_not(a, c);
  17. SANITY_CHECK(c);
  18. }
  19. PERF_TEST_P(Size_MatType, bitwise_and, TYPICAL_MATS_BITW_ARITHM)
  20. {
  21. Size sz = get<0>(GetParam());
  22. int type = get<1>(GetParam());
  23. cv::Mat a = Mat(sz, type);
  24. cv::Mat b = Mat(sz, type);
  25. cv::Mat c = Mat(sz, type);
  26. declare.in(a, b, WARMUP_RNG).out(c);
  27. declare.time(100);
  28. TEST_CYCLE() bitwise_and(a, b, c);
  29. SANITY_CHECK(c);
  30. }
  31. PERF_TEST_P(Size_MatType, bitwise_or, TYPICAL_MATS_BITW_ARITHM)
  32. {
  33. Size sz = get<0>(GetParam());
  34. int type = get<1>(GetParam());
  35. cv::Mat a = Mat(sz, type);
  36. cv::Mat b = Mat(sz, type);
  37. cv::Mat c = Mat(sz, type);
  38. declare.in(a, b, WARMUP_RNG).out(c);
  39. declare.time(100);
  40. TEST_CYCLE() bitwise_or(a, b, c);
  41. SANITY_CHECK(c);
  42. }
  43. PERF_TEST_P(Size_MatType, bitwise_xor, TYPICAL_MATS_BITW_ARITHM)
  44. {
  45. Size sz = get<0>(GetParam());
  46. int type = get<1>(GetParam());
  47. cv::Mat a = Mat(sz, type);
  48. cv::Mat b = Mat(sz, type);
  49. cv::Mat c = Mat(sz, type);
  50. declare.in(a, b, WARMUP_RNG).out(c);
  51. declare.time(100);
  52. TEST_CYCLE() bitwise_xor(a, b, c);
  53. SANITY_CHECK(c);
  54. }
  55. } // namespace