2011-09-07 15:16:07 +02:00
|
|
|
#ifndef __OPENCV_PERF_GPU_UTILITY_HPP__
|
|
|
|
#define __OPENCV_PERF_GPU_UTILITY_HPP__
|
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
void fill(cv::Mat& m, double a, double b);
|
2011-09-07 15:16:07 +02:00
|
|
|
|
2012-05-22 15:59:40 +02:00
|
|
|
using perf::MatType;
|
|
|
|
using perf::MatDepth;
|
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)
|
2012-06-06 16:45:33 +02:00
|
|
|
CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA)
|
2012-05-23 14:58:01 +02:00
|
|
|
CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING)
|
|
|
|
|
|
|
|
struct CvtColorInfo
|
|
|
|
{
|
|
|
|
int scn;
|
|
|
|
int dcn;
|
|
|
|
int code;
|
|
|
|
|
|
|
|
explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
void PrintTo(const CvtColorInfo& info, std::ostream* os);
|
2011-09-07 15:16:07 +02:00
|
|
|
|
2012-05-22 15:59:40 +02:00
|
|
|
#define IMPLEMENT_PARAM_CLASS(name, type) \
|
|
|
|
class name \
|
|
|
|
{ \
|
|
|
|
public: \
|
|
|
|
name ( type arg = type ()) : val_(arg) {} \
|
|
|
|
operator type () const {return val_;} \
|
|
|
|
private: \
|
|
|
|
type val_; \
|
|
|
|
}; \
|
|
|
|
inline void PrintTo( name param, std::ostream* os) \
|
|
|
|
{ \
|
2012-05-23 14:58:01 +02:00
|
|
|
*os << #name << " = " << testing::PrintToString(static_cast< type >(param)); \
|
2012-05-22 15:59:40 +02:00
|
|
|
}
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
IMPLEMENT_PARAM_CLASS(Channels, int)
|
2011-12-28 13:53:08 +01:00
|
|
|
|
|
|
|
namespace cv { namespace gpu
|
|
|
|
{
|
|
|
|
void PrintTo(const cv::gpu::DeviceInfo& info, std::ostream* os);
|
|
|
|
}}
|
|
|
|
|
|
|
|
#define GPU_PERF_TEST(name, ...) \
|
|
|
|
struct name : perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > \
|
|
|
|
{ \
|
|
|
|
public: \
|
|
|
|
name() {} \
|
|
|
|
protected: \
|
|
|
|
void PerfTestBody(); \
|
|
|
|
}; \
|
|
|
|
TEST_P(name, perf){ RunPerfTestBody(); } \
|
|
|
|
void name :: PerfTestBody()
|
|
|
|
|
|
|
|
#define GPU_PERF_TEST_1(name, param_type) \
|
|
|
|
struct name : perf::TestBaseWithParam< param_type > \
|
|
|
|
{ \
|
|
|
|
public: \
|
|
|
|
name() {} \
|
|
|
|
protected: \
|
|
|
|
void PerfTestBody(); \
|
|
|
|
}; \
|
|
|
|
TEST_P(name, perf){ RunPerfTestBody(); } \
|
|
|
|
void name :: PerfTestBody()
|
|
|
|
|
|
|
|
#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::szSXGA, perf::sz1080p, cv::Size(1800, 1500))
|
|
|
|
|
|
|
|
cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
|
|
|
|
|
2011-09-07 15:16:07 +02:00
|
|
|
const std::vector<cv::gpu::DeviceInfo>& devices();
|
2011-12-28 13:53:08 +01:00
|
|
|
|
|
|
|
#define ALL_DEVICES testing::ValuesIn(devices())
|
2011-09-07 15:16:07 +02:00
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
2011-09-07 15:16:07 +02:00
|
|
|
|
|
|
|
#endif // __OPENCV_PERF_GPU_UTILITY_HPP__
|