perf_dft.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "perf_precomp.hpp"
  2. namespace opencv_test
  3. {
  4. using namespace perf;
  5. ///////////////////////////////////////////////////////dft//////////////////////////////////////////////////////////////
  6. #define MAT_TYPES_DFT CV_32FC1, CV_32FC2, CV_64FC1
  7. #define MAT_SIZES_DFT cv::Size(320, 480), cv::Size(800, 600), cv::Size(1280, 1024), sz1080p, sz2K
  8. CV_ENUM(FlagsType, 0, DFT_INVERSE, DFT_SCALE, DFT_COMPLEX_OUTPUT, DFT_ROWS, DFT_INVERSE|DFT_COMPLEX_OUTPUT)
  9. #define TEST_MATS_DFT testing::Combine(testing::Values(MAT_SIZES_DFT), testing::Values(MAT_TYPES_DFT), FlagsType::all(), testing::Values(true, false))
  10. typedef tuple<Size, MatType, FlagsType, bool> Size_MatType_FlagsType_NzeroRows_t;
  11. typedef perf::TestBaseWithParam<Size_MatType_FlagsType_NzeroRows_t> Size_MatType_FlagsType_NzeroRows;
  12. PERF_TEST_P(Size_MatType_FlagsType_NzeroRows, dft, TEST_MATS_DFT)
  13. {
  14. Size sz = get<0>(GetParam());
  15. int type = get<1>(GetParam());
  16. int flags = get<2>(GetParam());
  17. bool isNzeroRows = get<3>(GetParam());
  18. int nonzero_rows = 0;
  19. Mat src(sz, type);
  20. Mat dst(sz, type);
  21. declare.in(src, WARMUP_RNG).time(60);
  22. if (isNzeroRows)
  23. nonzero_rows = sz.height/2;
  24. TEST_CYCLE() dft(src, dst, flags, nonzero_rows);
  25. SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
  26. }
  27. ///////////////////////////////////////////////////////dct//////////////////////////////////////////////////////
  28. CV_ENUM(DCT_FlagsType, 0, DCT_INVERSE , DCT_ROWS, DCT_INVERSE|DCT_ROWS)
  29. typedef tuple<Size, MatType, DCT_FlagsType> Size_MatType_Flag_t;
  30. typedef perf::TestBaseWithParam<Size_MatType_Flag_t> Size_MatType_Flag;
  31. PERF_TEST_P(Size_MatType_Flag, dct, testing::Combine(
  32. testing::Values(cv::Size(320, 240),cv::Size(800, 600),
  33. cv::Size(1024, 768), cv::Size(1280, 1024),
  34. sz1080p, sz2K),
  35. testing::Values(CV_32FC1, CV_64FC1), DCT_FlagsType::all()))
  36. {
  37. Size sz = get<0>(GetParam());
  38. int type = get<1>(GetParam());
  39. int flags = get<2>(GetParam());
  40. Mat src(sz, type);
  41. Mat dst(sz, type);
  42. declare
  43. .in(src, WARMUP_RNG)
  44. .out(dst)
  45. .time(60);
  46. TEST_CYCLE() dct(src, dst, flags);
  47. SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
  48. }
  49. } // namespace