Home | History | Annotate | Download | only in perf
      1 #include "perf_precomp.hpp"
      2 
      3 using namespace std;
      4 using namespace cv;
      5 using namespace perf;
      6 using std::tr1::make_tuple;
      7 using std::tr1::get;
      8 
      9 #define TYPICAL_MAT_TYPES_ADWEIGHTED  CV_8UC1, CV_8UC4, CV_8SC1, CV_16UC1, CV_16SC1, CV_32SC1
     10 #define TYPICAL_MATS_ADWEIGHTED       testing::Combine(testing::Values(szVGA, sz720p, sz1080p), testing::Values(TYPICAL_MAT_TYPES_ADWEIGHTED))
     11 
     12 PERF_TEST_P(Size_MatType, addWeighted, TYPICAL_MATS_ADWEIGHTED)
     13 {
     14     Size size = get<0>(GetParam());
     15     int type = get<1>(GetParam());
     16     Mat src1(size, type);
     17     Mat src2(size, type);
     18     double alpha = 3.75;
     19     double beta = -0.125;
     20     double gamma = 100.0;
     21 
     22     Mat dst(size, type);
     23 
     24     declare.in(src1, src2, dst, WARMUP_RNG).out(dst);
     25 
     26     if (CV_MAT_DEPTH(type) == CV_32S)
     27     {
     28         // there might be not enough precision for integers
     29         src1 /= 2048;
     30         src2 /= 2048;
     31     }
     32 
     33     TEST_CYCLE() cv::addWeighted( src1, alpha, src2, beta, gamma, dst, dst.type() );
     34 
     35     SANITY_CHECK(dst, 1);
     36 }
     37