Merge pull request #1263 from abidrahmank:pyCLAHE_24
[profile/ivi/opencv.git] / modules / ocl / test / test_arithm.cpp
1 ///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                           License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
14 // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
15 // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
16 // Third party copyrights are property of their respective owners.
17 //
18 // @Authors
19 //    Niko Li, newlife20080214@gmail.com
20 //    Jia Haipeng, jiahaipeng95@gmail.com
21 //    Shengen Yan, yanshengen@gmail.com
22 //    Jiang Liyuan,jlyuan001.good@163.com
23 //    Rock Li, Rock.Li@amd.com
24 //    Zailong Wu, bullet@yeah.net
25 //    Yao Wang, bitwangyaoyao@gmail.com
26 //
27 // Redistribution and use in source and binary forms, with or without modification,
28 // are permitted provided that the following conditions are met:
29 //
30 //   * Redistribution's of source code must retain the above copyright notice,
31 //     this list of conditions and the following disclaimer.
32 //
33 //   * Redistribution's in binary form must reproduce the above copyright notice,
34 //     this list of conditions and the following disclaimer in the documentation
35 //     and/or other oclMaterials provided with the distribution.
36 //
37 //   * The name of the copyright holders may not be used to endorse or promote products
38 //     derived from this software without specific prior written permission.
39 //
40 // This software is provided by the copyright holders and contributors "as is" and
41 // any express or implied warranties, including, but not limited to, the implied
42 // warranties of merchantability and fitness for a particular purpose are disclaimed.
43 // In no event shall the Intel Corporation or contributors be liable for any direct,
44 // indirect, incidental, special, exemplary, or consequential damages
45 // (including, but not limited to, procurement of substitute goods or services;
46 // loss of use, data, or profits; or business interruption) however caused
47 // and on any theory of liability, whether in contract, strict liability,
48 // or tort (including negligence or otherwise) arising in any way out of
49 // the use of this software, even if advised of the possibility of such damage.
50 //
51 //M*/
52
53 //#define PRINT_CPU_TIME 1000
54 //#define PRINT_TIME
55
56
57 #include "test_precomp.hpp"
58 #include <iomanip>
59
60 #ifdef HAVE_OPENCL
61
62 using namespace cv;
63 using namespace cv::ocl;
64 using namespace cvtest;
65 using namespace testing;
66 using namespace std;
67
68 PARAM_TEST_CASE(ArithmTestBase, MatType, bool)
69 {
70     int type;
71     cv::Scalar val;
72
73     //src mat
74     cv::Mat mat1;
75     cv::Mat mat2;
76     cv::Mat mask;
77     cv::Mat dst;
78     cv::Mat dst1; //bak, for two outputs
79
80     // set up roi
81     int roicols;
82     int roirows;
83     int src1x;
84     int src1y;
85     int src2x;
86     int src2y;
87     int dstx;
88     int dsty;
89     int maskx;
90     int masky;
91
92     //src mat with roi
93     cv::Mat mat1_roi;
94     cv::Mat mat2_roi;
95     cv::Mat mask_roi;
96     cv::Mat dst_roi;
97     cv::Mat dst1_roi; //bak
98
99     //ocl dst mat for testing
100     cv::ocl::oclMat gdst_whole;
101     cv::ocl::oclMat gdst1_whole; //bak
102
103     //ocl mat with roi
104     cv::ocl::oclMat gmat1;
105     cv::ocl::oclMat gmat2;
106     cv::ocl::oclMat gdst;
107     cv::ocl::oclMat gdst1;   //bak
108     cv::ocl::oclMat gmask;
109
110     virtual void SetUp()
111     {
112         type = GET_PARAM(0);
113
114         cv::RNG &rng = TS::ptr()->get_rng();
115
116         cv::Size size(MWIDTH, MHEIGHT);
117
118         mat1 = randomMat(rng, size, type, 5, 16, false);
119         //mat2 = randomMat(rng, size, type, 5, 16, false);
120         mat2 = randomMat(rng, size, type, 5, 16, false);
121         dst  = randomMat(rng, size, type, 5, 16, false);
122         dst1  = randomMat(rng, size, type, 5, 16, false);
123         mask = randomMat(rng, size, CV_8UC1, 0, 2,  false);
124
125         cv::threshold(mask, mask, 0.5, 255., CV_8UC1);
126
127         val = cv::Scalar(rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0));
128
129     }
130
131     void random_roi()
132     {
133 #ifdef RANDOMROI
134         //randomize ROI
135         cv::RNG &rng = TS::ptr()->get_rng();
136         roicols = rng.uniform(1, mat1.cols);
137         roirows = rng.uniform(1, mat1.rows);
138         src1x   = rng.uniform(0, mat1.cols - roicols);
139         src1y   = rng.uniform(0, mat1.rows - roirows);
140         dstx    = rng.uniform(0, dst.cols  - roicols);
141         dsty    = rng.uniform(0, dst.rows  - roirows);
142         maskx   = rng.uniform(0, mask.cols - roicols);
143         masky   = rng.uniform(0, mask.rows - roirows);
144         src2x   = rng.uniform(0, mat2.cols - roicols);
145         src2y   = rng.uniform(0, mat2.rows - roirows);
146 #else
147         roicols = mat1.cols;
148         roirows = mat1.rows;
149         src1x = 0;
150         src1y = 0;
151         dstx = 0;
152         dsty = 0;
153         maskx   = 0;
154         masky   = 0;
155         src2x   = 0;
156         src2y   = 0;
157 #endif
158         mat1_roi = mat1(Rect(src1x, src1y, roicols, roirows));
159         mat2_roi = mat2(Rect(src2x, src2y, roicols, roirows));
160         mask_roi = mask(Rect(maskx, masky, roicols, roirows));
161         dst_roi  = dst(Rect(dstx, dsty, roicols, roirows));
162         dst1_roi = dst1(Rect(dstx, dsty, roicols, roirows));
163
164         gdst_whole = dst;
165         gdst = gdst_whole(Rect(dstx, dsty, roicols, roirows));
166
167         gdst1_whole = dst1;
168         gdst1 = gdst1_whole(Rect(dstx, dsty, roicols, roirows));
169
170         gmat1 = mat1_roi;
171         gmat2 = mat2_roi;
172         gmask = mask_roi; //end
173     }
174
175     void Near(double threshold = 0.)
176     {
177         EXPECT_MAT_NEAR(dst, Mat(gdst_whole), threshold);
178     }
179
180     void Near1(double threshold = 0.)
181     {     
182         EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), threshold);
183     }
184
185 };
186 ////////////////////////////////lut/////////////////////////////////////////////////
187 struct Lut : ArithmTestBase {};
188 #define VARNAME(A) string(#A);
189
190
191 TEST_P(Lut, Mat)
192 {
193
194     cv::Mat mat2(3, 512, CV_8UC1);
195     cv::RNG &rng = TS::ptr()->get_rng();
196     rng.fill(mat2, cv::RNG::UNIFORM, cv::Scalar::all(0), cv::Scalar::all(256));
197
198     for(int j = 0; j < LOOP_TIMES; j ++)
199     {
200         random_roi();
201
202         src2x = rng.uniform( 0, mat2.cols - 256);
203         src2y = rng.uniform (0, mat2.rows - 1);
204
205         cv::Mat mat2_roi = mat2(Rect(src2x, src2y, 256, 1));
206
207         cv::ocl::oclMat gmat2(mat2_roi);
208
209         cv::LUT(mat1_roi, mat2_roi, dst_roi);
210         cv::ocl::LUT(gmat1, gmat2, gdst);
211         Near(0);
212     }
213 }
214
215
216 ////////////////////////////////exp/////////////////////////////////////////////////
217 struct Exp : ArithmTestBase {};
218
219 TEST_P(Exp, Mat)
220 {
221     for(int j = 0; j < LOOP_TIMES; j++)
222     {
223         random_roi();
224
225         cv::exp(mat1_roi, dst_roi);
226         cv::ocl::exp(gmat1, gdst);
227         Near(2);
228     }
229 }
230
231
232 ////////////////////////////////log/////////////////////////////////////////////////
233 struct Log : ArithmTestBase {};
234
235 TEST_P(Log, Mat)
236 {
237     for(int j = 0; j < LOOP_TIMES; j++)
238     {
239         random_roi();
240
241         cv::log(mat1_roi, dst_roi);
242         cv::ocl::log(gmat1, gdst);
243         Near(1);
244     }
245 }
246
247
248 ////////////////////////////////add/////////////////////////////////////////////////
249 struct Add : ArithmTestBase {};
250
251 TEST_P(Add, Mat)
252 {
253     for(int j = 0; j < LOOP_TIMES; j++)
254     {
255         random_roi();
256
257         cv::add(mat1_roi, mat2_roi, dst_roi);
258         cv::ocl::add(gmat1, gmat2, gdst);
259         Near(0);
260     }
261 }
262
263 TEST_P(Add, Mat_Mask)
264 {
265     for(int j = 0; j < LOOP_TIMES; j++)
266     {
267         random_roi();
268
269         cv::add(mat1_roi, mat2_roi, dst_roi, mask_roi);
270         cv::ocl::add(gmat1, gmat2, gdst, gmask);
271         Near(0);
272     }
273 }
274
275 TEST_P(Add, Scalar)
276 {
277     for(int j = 0; j < LOOP_TIMES; j++)
278     {
279         random_roi();
280
281         cv::add(mat1_roi, val, dst_roi);
282         cv::ocl::add(gmat1, val, gdst);
283         Near(1e-5);
284     }
285 }
286
287 TEST_P(Add, Scalar_Mask)
288 {
289     for(int j = 0; j < LOOP_TIMES; j++)
290     {
291         random_roi();
292
293         cv::add(mat1_roi, val, dst_roi, mask_roi);
294         cv::ocl::add(gmat1, val, gdst, gmask);
295         Near(1e-5);
296     }
297 }
298
299
300
301 ////////////////////////////////sub/////////////////////////////////////////////////
302 struct Sub : ArithmTestBase {};
303
304 TEST_P(Sub, Mat)
305 {
306     for(int j = 0; j < LOOP_TIMES; j++)
307     {
308         random_roi();
309
310         cv::subtract(mat1_roi, mat2_roi, dst_roi);
311         cv::ocl::subtract(gmat1, gmat2, gdst);
312         Near(0);
313     }
314 }
315
316 TEST_P(Sub, Mat_Mask)
317 {
318     for(int j = 0; j < LOOP_TIMES; j++)
319     {
320         random_roi();
321
322         cv::subtract(mat1_roi, mat2_roi, dst_roi, mask_roi);
323         cv::ocl::subtract(gmat1, gmat2, gdst, gmask);
324         Near(0);
325     }
326 }
327
328 TEST_P(Sub, Scalar)
329 {
330     for(int j = 0; j < LOOP_TIMES; j++)
331     {
332         random_roi();
333
334         cv::subtract(mat1_roi, val, dst_roi);
335         cv::ocl::subtract(gmat1, val, gdst);
336         Near(1e-5);
337     }
338 }
339
340 TEST_P(Sub, Scalar_Mask)
341 {
342     for(int j = 0; j < LOOP_TIMES; j++)
343     {
344         random_roi();
345
346         cv::subtract(mat1_roi, val, dst_roi, mask_roi);
347         cv::ocl::subtract(gmat1, val, gdst, gmask);
348         Near(1e-5);
349     }
350 }
351
352
353
354 ////////////////////////////////Mul/////////////////////////////////////////////////
355 struct Mul : ArithmTestBase {};
356
357 TEST_P(Mul, Mat)
358 {
359     for(int j = 0; j < LOOP_TIMES; j++)
360     {
361         random_roi();
362
363         cv::multiply(mat1_roi, mat2_roi, dst_roi);
364         cv::ocl::multiply(gmat1, gmat2, gdst);
365         Near(0);
366     }
367 }
368
369 TEST_P(Mul, Mat_Scalar)
370 {
371     for(int j = 0; j < LOOP_TIMES; j++)
372     {
373         random_roi();
374
375         cv::RNG &rng = TS::ptr()->get_rng();
376         double s = rng.uniform(-10.0, 10.0);
377
378         cv::multiply(mat1_roi, mat2_roi, dst_roi, s);
379         cv::ocl::multiply(gmat1, gmat2, gdst, s);
380         Near(.001);
381     }
382 }
383
384
385
386 struct Div : ArithmTestBase {};
387
388 TEST_P(Div, Mat)
389 {
390     for(int j = 0; j < LOOP_TIMES; j++)
391     {
392         random_roi();
393
394         cv::divide(mat1_roi, mat2_roi, dst_roi);
395         cv::ocl::divide(gmat1, gmat2, gdst);
396         Near(1);
397     }
398 }
399
400 TEST_P(Div, Mat_Scalar)
401 {
402     for(int j = 0; j < LOOP_TIMES; j++)
403     {
404         random_roi();
405
406         cv::RNG &rng = TS::ptr()->get_rng();
407         double s = rng.uniform(-10.0, 10.0);
408
409         cv::divide(mat1_roi, mat2_roi, dst_roi, s);
410         cv::ocl::divide(gmat1, gmat2, gdst, s);
411         Near(.001);
412     }
413 }
414
415
416 struct Absdiff : ArithmTestBase {};
417
418 TEST_P(Absdiff, Mat)
419 {
420     for(int j = 0; j < LOOP_TIMES; j++)
421     {
422         random_roi();
423
424         cv::absdiff(mat1_roi, mat2_roi, dst_roi);
425         cv::ocl::absdiff(gmat1, gmat2, gdst);
426         Near(0);
427     }
428 }
429
430 TEST_P(Absdiff, Mat_Scalar)
431 {
432     for(int j = 0; j < LOOP_TIMES; j++)
433     {
434         random_roi();
435
436         cv::absdiff(mat1_roi, val, dst_roi);
437         cv::ocl::absdiff(gmat1, val, gdst);
438         Near(1e-5);
439     }
440 }
441
442
443
444 struct CartToPolar : ArithmTestBase {};
445
446 TEST_P(CartToPolar, angleInDegree)
447 {
448     for(int j = 0; j < LOOP_TIMES; j++)
449     {
450         random_roi();
451
452         cv::cartToPolar(mat1_roi, mat2_roi, dst_roi, dst1_roi, 1);
453         cv::ocl::cartToPolar(gmat1, gmat2, gdst, gdst1, 1);
454         Near(.5);
455         Near1(.5);
456     }
457 }
458
459 TEST_P(CartToPolar, angleInRadians)
460 {
461     for(int j = 0; j < LOOP_TIMES; j++)
462     {
463         random_roi();
464
465         cv::cartToPolar(mat1_roi, mat2_roi, dst_roi, dst1_roi, 0);
466         cv::ocl::cartToPolar(gmat1, gmat2, gdst, gdst1, 0);
467         Near(.5);
468         Near1(.5);
469     }
470 }
471
472
473 struct PolarToCart : ArithmTestBase {};
474
475 TEST_P(PolarToCart, angleInDegree)
476 {
477     for(int j = 0; j < LOOP_TIMES; j++)
478     {
479         random_roi();
480
481         cv::polarToCart(mat1_roi, mat2_roi, dst_roi, dst1_roi, 1);
482         cv::ocl::polarToCart(gmat1, gmat2, gdst, gdst1, 1);
483         Near(.5);
484         Near1(.5);
485     }
486 }
487
488 TEST_P(PolarToCart, angleInRadians)
489 {
490     for(int j = 0; j < LOOP_TIMES; j++)
491     {
492         random_roi();
493
494         cv::polarToCart(mat1_roi, mat2_roi, dst_roi, dst1_roi, 0);
495         cv::ocl::polarToCart(gmat1, gmat2, gdst, gdst1, 0);
496         Near(.5);
497         Near1(.5);
498     }
499 }
500
501
502
503
504 struct Magnitude : ArithmTestBase {};
505
506 TEST_P(Magnitude, Mat)
507 {
508     for(int j = 0; j < LOOP_TIMES; j++)
509     {
510         random_roi();
511
512         cv::magnitude(mat1_roi, mat2_roi, dst_roi);
513         cv::ocl::magnitude(gmat1, gmat2, gdst);
514         Near(1e-5);
515     }
516 }
517
518
519 struct Transpose : ArithmTestBase {};
520
521 TEST_P(Transpose, Mat)
522 {
523     for(int j = 0; j < LOOP_TIMES; j++)
524     {
525         random_roi();
526
527         cv::transpose(mat1_roi, dst_roi);
528         cv::ocl::transpose(gmat1, gdst);
529         Near(1e-5);
530     }
531 }
532
533
534 struct Flip : ArithmTestBase {};
535
536 TEST_P(Flip, X)
537 {
538     for(int j = 0; j < LOOP_TIMES; j++)
539     {
540         random_roi();
541
542         cv::flip(mat1_roi, dst_roi, 0);
543         cv::ocl::flip(gmat1, gdst, 0);
544         Near(1e-5);
545     }
546 }
547
548 TEST_P(Flip, Y)
549 {
550     for(int j = 0; j < LOOP_TIMES; j++)
551     {
552         random_roi();
553
554         cv::flip(mat1_roi, dst_roi, 1);
555         cv::ocl::flip(gmat1, gdst, 1);
556         Near(1e-5);
557     }
558 }
559
560 TEST_P(Flip, BOTH)
561 {
562     for(int j = 0; j < LOOP_TIMES; j++)
563     {
564         random_roi();
565
566         cv::flip(mat1_roi, dst_roi, -1);
567         cv::ocl::flip(gmat1, gdst, -1);
568         Near(1e-5);
569     }
570 }
571
572
573 struct MinMax : ArithmTestBase {};
574
575 TEST_P(MinMax, MAT)
576 {
577     for(int j = 0; j < LOOP_TIMES; j++)
578     {
579         random_roi();
580         double minVal, maxVal;
581         cv::Point minLoc, maxLoc;
582
583         if (mat1.depth() != CV_8S)
584         {
585             cv::minMaxLoc(mat1_roi, &minVal, &maxVal, &minLoc, &maxLoc);
586         }
587         else
588         {
589             minVal = std::numeric_limits<double>::max();
590             maxVal = -std::numeric_limits<double>::max();
591             for (int i = 0; i < mat1_roi.rows; ++i)
592                 for (int j = 0; j < mat1_roi.cols; ++j)
593                 {
594                     signed char val = mat1_roi.at<signed char>(i, j);
595                     if (val < minVal) minVal = val;
596                     if (val > maxVal) maxVal = val;
597                 }
598         }
599
600         double minVal_, maxVal_;
601         cv::ocl::minMax(gmat1, &minVal_, &maxVal_);
602
603         EXPECT_DOUBLE_EQ(minVal_, minVal);
604         EXPECT_DOUBLE_EQ(maxVal_, maxVal);
605     }
606 }
607
608 TEST_P(MinMax, MASK)
609 {
610     for(int j = 0; j < LOOP_TIMES; j++)
611     {
612         random_roi();
613         double minVal, maxVal;
614         cv::Point minLoc, maxLoc;
615
616         if (mat1.depth() != CV_8S)
617         {
618             cv::minMaxLoc(mat1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi);
619         }
620         else
621         {
622             minVal = std::numeric_limits<double>::max();
623             maxVal = -std::numeric_limits<double>::max();
624             for (int i = 0; i < mat1_roi.rows; ++i)
625                 for (int j = 0; j < mat1_roi.cols; ++j)
626                 {
627                     signed char val = mat1_roi.at<signed char>(i, j);
628                     unsigned char m = mask_roi.at<unsigned char>(i, j);
629                     if (val < minVal && m) minVal = val;
630                     if (val > maxVal && m) maxVal = val;
631                 }
632         }
633
634         double minVal_, maxVal_;
635         cv::ocl::minMax(gmat1, &minVal_, &maxVal_, gmask);
636
637         EXPECT_DOUBLE_EQ(minVal_, minVal);
638         EXPECT_DOUBLE_EQ(maxVal_, maxVal);
639     }
640 }
641
642
643 struct MinMaxLoc : ArithmTestBase {};
644
645 TEST_P(MinMaxLoc, MAT)
646 {
647     for(int j = 0; j < LOOP_TIMES; j++)
648     {
649         random_roi();
650         double minVal, maxVal;
651         cv::Point minLoc, maxLoc;
652         int depth = mat1.depth();
653         if (depth != CV_8S)
654         {
655             cv::minMaxLoc(mat1_roi, &minVal, &maxVal, &minLoc, &maxLoc);
656         }
657         else
658         {
659             minVal = std::numeric_limits<double>::max();
660             maxVal = -std::numeric_limits<double>::max();
661             for (int i = 0; i < mat1_roi.rows; ++i)
662                 for (int j = 0; j < mat1_roi.cols; ++j)
663                 {
664                     signed char val = mat1_roi.at<signed char>(i, j);
665                     if (val < minVal)
666                     {
667                         minVal = val;
668                         minLoc.x = j;
669                         minLoc.y = i;
670                     }
671                     if (val > maxVal)
672                     {
673                         maxVal = val;
674                         maxLoc.x = j;
675                         maxLoc.y = i;
676                     }
677                 }
678         }
679
680         double minVal_, maxVal_;
681         cv::Point minLoc_, maxLoc_;
682         cv::ocl::minMaxLoc(gmat1, &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::ocl::oclMat());
683
684         double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.;
685         if(depth == 0)
686         {
687             minlocVal = mat1_roi.at<unsigned char>(minLoc);
688             minlocVal_ = mat1_roi.at<unsigned char>(minLoc_);
689             maxlocVal = mat1_roi.at<unsigned char>(maxLoc);
690             maxlocVal_ = mat1_roi.at<unsigned char>(maxLoc_);
691             error0 = ::abs(mat1_roi.at<unsigned char>(minLoc_) - mat1_roi.at<unsigned char>(minLoc));
692             error1 = ::abs(mat1_roi.at<unsigned char>(maxLoc_) - mat1_roi.at<unsigned char>(maxLoc));
693         }
694         if(depth == 1)
695         {
696             minlocVal = mat1_roi.at<signed char>(minLoc);
697             minlocVal_ = mat1_roi.at<signed char>(minLoc_);
698             maxlocVal = mat1_roi.at<signed char>(maxLoc);
699             maxlocVal_ = mat1_roi.at<signed char>(maxLoc_);
700             error0 = ::abs(mat1_roi.at<signed char>(minLoc_) - mat1_roi.at<signed char>(minLoc));
701             error1 = ::abs(mat1_roi.at<signed char>(maxLoc_) - mat1_roi.at<signed char>(maxLoc));
702         }
703         if(depth == 2)
704         {
705             minlocVal = mat1_roi.at<unsigned short>(minLoc);
706             minlocVal_ = mat1_roi.at<unsigned short>(minLoc_);
707             maxlocVal = mat1_roi.at<unsigned short>(maxLoc);
708             maxlocVal_ = mat1_roi.at<unsigned short>(maxLoc_);
709             error0 = ::abs(mat1_roi.at<unsigned short>(minLoc_) - mat1_roi.at<unsigned short>(minLoc));
710             error1 = ::abs(mat1_roi.at<unsigned short>(maxLoc_) - mat1_roi.at<unsigned short>(maxLoc));
711         }
712         if(depth == 3)
713         {
714             minlocVal = mat1_roi.at<signed short>(minLoc);
715             minlocVal_ = mat1_roi.at<signed short>(minLoc_);
716             maxlocVal = mat1_roi.at<signed short>(maxLoc);
717             maxlocVal_ = mat1_roi.at<signed short>(maxLoc_);
718             error0 = ::abs(mat1_roi.at<signed short>(minLoc_) - mat1_roi.at<signed short>(minLoc));
719             error1 = ::abs(mat1_roi.at<signed short>(maxLoc_) - mat1_roi.at<signed short>(maxLoc));
720         }
721         if(depth == 4)
722         {
723             minlocVal = mat1_roi.at<int>(minLoc);
724             minlocVal_ = mat1_roi.at<int>(minLoc_);
725             maxlocVal = mat1_roi.at<int>(maxLoc);
726             maxlocVal_ = mat1_roi.at<int>(maxLoc_);
727             error0 = ::abs(mat1_roi.at<int>(minLoc_) - mat1_roi.at<int>(minLoc));
728             error1 = ::abs(mat1_roi.at<int>(maxLoc_) - mat1_roi.at<int>(maxLoc));
729         }
730         if(depth == 5)
731         {
732             minlocVal = mat1_roi.at<float>(minLoc);
733             minlocVal_ = mat1_roi.at<float>(minLoc_);
734             maxlocVal = mat1_roi.at<float>(maxLoc);
735             maxlocVal_ = mat1_roi.at<float>(maxLoc_);
736             error0 = ::abs(mat1_roi.at<float>(minLoc_) - mat1_roi.at<float>(minLoc));
737             error1 = ::abs(mat1_roi.at<float>(maxLoc_) - mat1_roi.at<float>(maxLoc));
738         }
739         if(depth == 6)
740         {
741             minlocVal = mat1_roi.at<double>(minLoc);
742             minlocVal_ = mat1_roi.at<double>(minLoc_);
743             maxlocVal = mat1_roi.at<double>(maxLoc);
744             maxlocVal_ = mat1_roi.at<double>(maxLoc_);
745             error0 = ::abs(mat1_roi.at<double>(minLoc_) - mat1_roi.at<double>(minLoc));
746             error1 = ::abs(mat1_roi.at<double>(maxLoc_) - mat1_roi.at<double>(maxLoc));
747         }
748
749         EXPECT_DOUBLE_EQ(minVal_, minVal);
750         EXPECT_DOUBLE_EQ(maxVal_, maxVal);
751         EXPECT_DOUBLE_EQ(minlocVal_, minlocVal);
752         EXPECT_DOUBLE_EQ(maxlocVal_, maxlocVal);
753
754         EXPECT_DOUBLE_EQ(error0, 0.0);
755         EXPECT_DOUBLE_EQ(error1, 0.0);
756     }
757 }
758
759
760 TEST_P(MinMaxLoc, MASK)
761 {
762     for(int j = 0; j < LOOP_TIMES; j++)
763     {
764         random_roi();
765         double minVal, maxVal;
766         cv::Point minLoc, maxLoc;
767         int depth = mat1.depth();
768         if (depth != CV_8S)
769         {
770             cv::minMaxLoc(mat1_roi, &minVal, &maxVal, &minLoc, &maxLoc, mask_roi);
771         }
772         else
773         {
774             minVal = std::numeric_limits<double>::max();
775             maxVal = -std::numeric_limits<double>::max();
776             for (int i = 0; i < mat1_roi.rows; ++i)
777                 for (int j = 0; j < mat1_roi.cols; ++j)
778                 {
779                     signed char val = mat1_roi.at<signed char>(i, j);
780                     unsigned char m = mask_roi.at<unsigned char>(i , j);
781                     if (val < minVal && m)
782                     {
783                         minVal = val;
784                         minLoc.x = j;
785                         minLoc.y = i;
786                     }
787                     if (val > maxVal && m)
788                     {
789                         maxVal = val;
790                         maxLoc.x = j;
791                         maxLoc.y = i;
792                     }
793                 }
794         }
795
796         double minVal_, maxVal_;
797         cv::Point minLoc_, maxLoc_;
798         cv::ocl::minMaxLoc(gmat1, &minVal_, &maxVal_, &minLoc_, &maxLoc_, gmask);
799
800         double error0 = 0., error1 = 0., minlocVal = 0., minlocVal_ = 0., maxlocVal = 0., maxlocVal_ = 0.;
801         if(minLoc_.x == -1 || minLoc_.y == -1 || maxLoc_.x == -1 || maxLoc_.y == -1) continue;
802         if(depth == 0)
803         {
804             minlocVal = mat1_roi.at<unsigned char>(minLoc);
805             minlocVal_ = mat1_roi.at<unsigned char>(minLoc_);
806             maxlocVal = mat1_roi.at<unsigned char>(maxLoc);
807             maxlocVal_ = mat1_roi.at<unsigned char>(maxLoc_);
808             error0 = ::abs(mat1_roi.at<unsigned char>(minLoc_) - mat1_roi.at<unsigned char>(minLoc));
809             error1 = ::abs(mat1_roi.at<unsigned char>(maxLoc_) - mat1_roi.at<unsigned char>(maxLoc));
810         }
811         if(depth == 1)
812         {
813             minlocVal = mat1_roi.at<signed char>(minLoc);
814             minlocVal_ = mat1_roi.at<signed char>(minLoc_);
815             maxlocVal = mat1_roi.at<signed char>(maxLoc);
816             maxlocVal_ = mat1_roi.at<signed char>(maxLoc_);
817             error0 = ::abs(mat1_roi.at<signed char>(minLoc_) - mat1_roi.at<signed char>(minLoc));
818             error1 = ::abs(mat1_roi.at<signed char>(maxLoc_) - mat1_roi.at<signed char>(maxLoc));
819         }
820         if(depth == 2)
821         {
822             minlocVal = mat1_roi.at<unsigned short>(minLoc);
823             minlocVal_ = mat1_roi.at<unsigned short>(minLoc_);
824             maxlocVal = mat1_roi.at<unsigned short>(maxLoc);
825             maxlocVal_ = mat1_roi.at<unsigned short>(maxLoc_);
826             error0 = ::abs(mat1_roi.at<unsigned short>(minLoc_) - mat1_roi.at<unsigned short>(minLoc));
827             error1 = ::abs(mat1_roi.at<unsigned short>(maxLoc_) - mat1_roi.at<unsigned short>(maxLoc));
828         }
829         if(depth == 3)
830         {
831             minlocVal = mat1_roi.at<signed short>(minLoc);
832             minlocVal_ = mat1_roi.at<signed short>(minLoc_);
833             maxlocVal = mat1_roi.at<signed short>(maxLoc);
834             maxlocVal_ = mat1_roi.at<signed short>(maxLoc_);
835             error0 = ::abs(mat1_roi.at<signed short>(minLoc_) - mat1_roi.at<signed short>(minLoc));
836             error1 = ::abs(mat1_roi.at<signed short>(maxLoc_) - mat1_roi.at<signed short>(maxLoc));
837         }
838         if(depth == 4)
839         {
840             minlocVal = mat1_roi.at<int>(minLoc);
841             minlocVal_ = mat1_roi.at<int>(minLoc_);
842             maxlocVal = mat1_roi.at<int>(maxLoc);
843             maxlocVal_ = mat1_roi.at<int>(maxLoc_);
844             error0 = ::abs(mat1_roi.at<int>(minLoc_) - mat1_roi.at<int>(minLoc));
845             error1 = ::abs(mat1_roi.at<int>(maxLoc_) - mat1_roi.at<int>(maxLoc));
846         }
847         if(depth == 5)
848         {
849             minlocVal = mat1_roi.at<float>(minLoc);
850             minlocVal_ = mat1_roi.at<float>(minLoc_);
851             maxlocVal = mat1_roi.at<float>(maxLoc);
852             maxlocVal_ = mat1_roi.at<float>(maxLoc_);
853             error0 = ::abs(mat1_roi.at<float>(minLoc_) - mat1_roi.at<float>(minLoc));
854             error1 = ::abs(mat1_roi.at<float>(maxLoc_) - mat1_roi.at<float>(maxLoc));
855         }
856         if(depth == 6)
857         {
858             minlocVal = mat1_roi.at<double>(minLoc);
859             minlocVal_ = mat1_roi.at<double>(minLoc_);
860             maxlocVal = mat1_roi.at<double>(maxLoc);
861             maxlocVal_ = mat1_roi.at<double>(maxLoc_);
862             error0 = ::abs(mat1_roi.at<double>(minLoc_) - mat1_roi.at<double>(minLoc));
863             error1 = ::abs(mat1_roi.at<double>(maxLoc_) - mat1_roi.at<double>(maxLoc));
864         }
865
866         EXPECT_DOUBLE_EQ(minVal_, minVal);
867         EXPECT_DOUBLE_EQ(maxVal_, maxVal);
868         EXPECT_DOUBLE_EQ(minlocVal_, minlocVal);
869         EXPECT_DOUBLE_EQ(maxlocVal_, maxlocVal);
870
871         EXPECT_DOUBLE_EQ(error0, 0.0);
872         EXPECT_DOUBLE_EQ(error1, 0.0);
873     }
874 }
875
876
877 struct Sum : ArithmTestBase {};
878
879 TEST_P(Sum, MAT)
880 {
881     for(int j = 0; j < LOOP_TIMES; j++)
882     {
883         random_roi();
884         Scalar cpures = cv::sum(mat1_roi);
885         Scalar gpures = cv::ocl::sum(gmat1);
886
887         //check results
888         EXPECT_NEAR(cpures[0], gpures[0], 0.1);
889         EXPECT_NEAR(cpures[1], gpures[1], 0.1);
890         EXPECT_NEAR(cpures[2], gpures[2], 0.1);
891         EXPECT_NEAR(cpures[3], gpures[3], 0.1);
892     }
893 }
894
895
896 struct CountNonZero : ArithmTestBase {};
897
898 TEST_P(CountNonZero, MAT)
899 {
900     for(int j = 0; j < LOOP_TIMES; j++)
901     {
902         random_roi();
903         int cpures = cv::countNonZero(mat1_roi);
904         int gpures = cv::ocl::countNonZero(gmat1);
905
906         EXPECT_DOUBLE_EQ((double)cpures, (double)gpures);
907     }
908 }
909
910
911
912 ////////////////////////////////phase/////////////////////////////////////////////////
913 struct Phase : ArithmTestBase {};
914
915 TEST_P(Phase, Mat)
916 {
917     if(mat1.depth() != CV_32F && mat1.depth() != CV_64F)
918     {
919         cout << "\tUnsupported type\t\n";
920     }
921     for(int angelInDegrees = 0; angelInDegrees < 2; angelInDegrees++)
922     {
923         for(int j = 0; j < LOOP_TIMES; j++)
924         {
925             random_roi();
926             cv::phase(mat1_roi, mat2_roi, dst_roi, angelInDegrees ? true : false);
927             cv::ocl::phase(gmat1, gmat2, gdst, angelInDegrees ? true : false);
928             Near(1e-2);
929         }
930     }
931 }
932
933
934 ////////////////////////////////bitwise_and/////////////////////////////////////////////////
935 struct Bitwise_and : ArithmTestBase {};
936
937 TEST_P(Bitwise_and, Mat)
938 {
939     for(int j = 0; j < LOOP_TIMES; j++)
940     {
941         random_roi();
942
943         cv::bitwise_and(mat1_roi, mat2_roi, dst_roi);
944         cv::ocl::bitwise_and(gmat1, gmat2, gdst);
945         Near(0);
946     }
947 }
948
949 TEST_P(Bitwise_and, Mat_Mask)
950 {
951     for(int j = 0; j < LOOP_TIMES; j++)
952     {
953         random_roi();
954
955         cv::bitwise_and(mat1_roi, mat2_roi, dst_roi, mask_roi);
956         cv::ocl::bitwise_and(gmat1, gmat2, gdst, gmask);
957         Near(0);
958     }
959 }
960
961 TEST_P(Bitwise_and, Scalar)
962 {
963     for(int j = 0; j < LOOP_TIMES; j++)
964     {
965         random_roi();
966
967         cv::bitwise_and(mat1_roi, val, dst_roi);
968         cv::ocl::bitwise_and(gmat1, val, gdst);
969         Near(1e-5);
970     }
971 }
972
973 TEST_P(Bitwise_and, Scalar_Mask)
974 {
975     for(int j = 0; j < LOOP_TIMES; j++)
976     {
977         random_roi();
978
979         cv::bitwise_and(mat1_roi, val, dst_roi, mask_roi);
980         cv::ocl::bitwise_and(gmat1, val, gdst, gmask);
981         Near(1e-5);
982     }
983 }
984
985
986
987 ////////////////////////////////bitwise_or/////////////////////////////////////////////////
988
989 struct Bitwise_or : ArithmTestBase {};
990
991 TEST_P(Bitwise_or, Mat)
992 {
993     for(int j = 0; j < LOOP_TIMES; j++)
994     {
995         random_roi();
996
997         cv::bitwise_or(mat1_roi, mat2_roi, dst_roi);
998         cv::ocl::bitwise_or(gmat1, gmat2, gdst);
999         Near(0);
1000     }
1001 }
1002
1003 TEST_P(Bitwise_or, Mat_Mask)
1004 {
1005     for(int j = 0; j < LOOP_TIMES; j++)
1006     {
1007         random_roi();
1008
1009         cv::bitwise_or(mat1_roi, mat2_roi, dst_roi, mask_roi);
1010         cv::ocl::bitwise_or(gmat1, gmat2, gdst, gmask);
1011         Near(0);
1012     }
1013 }
1014
1015 TEST_P(Bitwise_or, Scalar)
1016 {
1017     for(int j = 0; j < LOOP_TIMES; j++)
1018     {
1019         random_roi();
1020
1021         cv::bitwise_or(mat1_roi, val, dst_roi);
1022         cv::ocl::bitwise_or(gmat1, val, gdst);
1023         Near(1e-5);
1024     }
1025 }
1026
1027 TEST_P(Bitwise_or, Scalar_Mask)
1028 {
1029     for(int j = 0; j < LOOP_TIMES; j++)
1030     {
1031         random_roi();
1032
1033         cv::bitwise_or(mat1_roi, val, dst_roi, mask_roi);
1034         cv::ocl::bitwise_or(gmat1, val, gdst, gmask);
1035         Near(1e-5);
1036     }
1037 }
1038
1039
1040
1041 ////////////////////////////////bitwise_xor/////////////////////////////////////////////////
1042
1043 struct Bitwise_xor : ArithmTestBase {};
1044
1045 TEST_P(Bitwise_xor, Mat)
1046 {
1047     for(int j = 0; j < LOOP_TIMES; j++)
1048     {
1049         random_roi();
1050
1051         cv::bitwise_xor(mat1_roi, mat2_roi, dst_roi);
1052         cv::ocl::bitwise_xor(gmat1, gmat2, gdst);
1053         Near(0);
1054     }
1055 }
1056
1057 TEST_P(Bitwise_xor, Mat_Mask)
1058 {
1059     for(int j = 0; j < LOOP_TIMES; j++)
1060     {
1061         random_roi();
1062
1063         cv::bitwise_xor(mat1_roi, mat2_roi, dst_roi, mask_roi);
1064         cv::ocl::bitwise_xor(gmat1, gmat2, gdst, gmask);
1065         Near(0);
1066     }
1067 }
1068
1069 TEST_P(Bitwise_xor, Scalar)
1070 {
1071     for(int j = 0; j < LOOP_TIMES; j++)
1072     {
1073         random_roi();
1074
1075         cv::bitwise_xor(mat1_roi, val, dst_roi);
1076         cv::ocl::bitwise_xor(gmat1, val, gdst);
1077         Near(1e-5);
1078     }
1079 }
1080
1081 TEST_P(Bitwise_xor, Scalar_Mask)
1082 {
1083     for(int j = 0; j < LOOP_TIMES; j++)
1084     {
1085         random_roi();
1086
1087         cv::bitwise_xor(mat1_roi, val, dst_roi, mask_roi);
1088         cv::ocl::bitwise_xor(gmat1, val, gdst, gmask);
1089         Near(1e-5);
1090     }
1091 }
1092
1093
1094 ////////////////////////////////bitwise_not/////////////////////////////////////////////////
1095
1096 struct Bitwise_not : ArithmTestBase {};
1097
1098 TEST_P(Bitwise_not, Mat)
1099 {
1100     for(int j = 0; j < LOOP_TIMES; j++)
1101     {
1102         random_roi();
1103
1104         cv::bitwise_not(mat1_roi, dst_roi);
1105         cv::ocl::bitwise_not(gmat1, gdst);
1106         Near(0);
1107     }
1108 }
1109
1110
1111 ////////////////////////////////compare/////////////////////////////////////////////////
1112 struct Compare : ArithmTestBase {};
1113
1114 TEST_P(Compare, Mat)
1115 {
1116     if(mat1.type() == CV_8SC1)
1117         //if(mat1.type() != CV_8UC1 || mat1.type()!= CV_16UC1 || mat1.type()!= CV_16SC1|| mat1.type()!= CV_32SC1 || mat1.type()!= CV_32FC1|| mat1.type()!= CV_64FC1)
1118     {
1119         cout << "\tUnsupported type\t\n";
1120     }
1121
1122     int cmp_codes[] = {CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE};
1123     //const char *cmp_str[] = {"CMP_EQ", "CMP_GT", "CMP_GE", "CMP_LT", "CMP_LE", "CMP_NE"};
1124     int cmp_num = sizeof(cmp_codes) / sizeof(int);
1125
1126     for (int i = 0; i < cmp_num; ++i)
1127     {
1128
1129         for(int j = 0; j < LOOP_TIMES; j++)
1130         {
1131             random_roi();
1132
1133             cv::compare(mat1_roi, mat2_roi, dst_roi, cmp_codes[i]);
1134             cv::ocl::compare(gmat1, gmat2, gdst, cmp_codes[i]);
1135             Near(0);
1136         }
1137     }
1138
1139 }
1140
1141
1142 struct Pow : ArithmTestBase {};
1143
1144 TEST_P(Pow, Mat)
1145 {
1146     if(mat1.depth() != CV_32F && mat1.depth() != CV_64F)
1147     {
1148         cout << "\tUnsupported type\t\n";
1149     }
1150
1151     for(int j = 0; j < LOOP_TIMES; j++)
1152     {
1153         random_roi();
1154         double p = 4.5;
1155         cv::pow(mat1_roi, p, dst_roi);
1156         cv::ocl::pow(gmat1, p, gdst);
1157         Near(1);
1158     }
1159 }
1160
1161
1162 struct MagnitudeSqr : ArithmTestBase {};
1163
1164 TEST_P(MagnitudeSqr, Mat)
1165 {
1166     for(int j = 0; j < LOOP_TIMES; j++)
1167     {
1168         random_roi();
1169         for(int i = 0; i < mat1.rows; ++i)
1170             for(int j = 0; j < mat1.cols; ++j)
1171             {
1172                 float val1 = mat1.at<float>(i, j);
1173                 float val2 = mat2.at<float>(i, j);
1174                 ((float *)(dst.data))[i * dst.step / 4 + j] = val1 * val1 + val2 * val2;
1175             }
1176
1177         cv::ocl::oclMat clmat1(mat1), clmat2(mat2);
1178         cv::ocl::magnitudeSqr(clmat1, clmat2, gdst);
1179         Near(1);
1180     }
1181 }
1182
1183
1184 struct AddWeighted : ArithmTestBase {};
1185
1186 TEST_P(AddWeighted, Mat)
1187 {
1188     for(int j = 0; j < LOOP_TIMES; j++)
1189     {
1190         random_roi();
1191         double alpha = 2.0, beta = 1.0, gama = 3.0;
1192
1193
1194         cv::addWeighted(mat1_roi, alpha, mat2_roi, beta, gama, dst_roi);
1195
1196         //      cv::ocl::oclMat clmat1(mat1),clmat2(mat2),cldst;
1197
1198         cv::ocl::addWeighted(gmat1, alpha, gmat2, beta, gama, gdst);
1199
1200         Near(1e-5);
1201     }
1202 }
1203
1204
1205
1206
1207 //********test****************
1208
1209 INSTANTIATE_TEST_CASE_P(Arithm, Lut, Combine(
1210                             Values(CV_8UC1, CV_8UC3, CV_8UC4),
1211                             Values(false))); // Values(false) is the reserved parameter
1212
1213 INSTANTIATE_TEST_CASE_P(Arithm, Exp, Combine(
1214                             Values(CV_32FC1, CV_32FC1),
1215                             Values(false))); // Values(false) is the reserved parameter
1216
1217 INSTANTIATE_TEST_CASE_P(Arithm, Log, Combine(
1218                             Values(CV_32FC1, CV_32FC1),
1219                             Values(false))); // Values(false) is the reserved parameter
1220
1221 INSTANTIATE_TEST_CASE_P(Arithm, Add, Combine(
1222                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
1223                             Values(false)));
1224
1225 INSTANTIATE_TEST_CASE_P(Arithm, Sub, Combine(
1226                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
1227                             Values(false)));
1228
1229 INSTANTIATE_TEST_CASE_P(Arithm, Mul, Combine(
1230                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
1231                             Values(false))); // Values(false) is the reserved parameter
1232
1233 INSTANTIATE_TEST_CASE_P(Arithm, Div, Combine(
1234                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
1235                             Values(false))); // Values(false) is the reserved parameter
1236
1237
1238 INSTANTIATE_TEST_CASE_P(Arithm, Absdiff, Combine(
1239                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
1240                             Values(false))); // Values(false) is the reserved parameter
1241
1242 INSTANTIATE_TEST_CASE_P(Arithm, CartToPolar, Combine(
1243                             Values(CV_32FC1, CV_32FC3, CV_32FC4),
1244                             Values(false))); // Values(false) is the reserved parameter
1245
1246 INSTANTIATE_TEST_CASE_P(Arithm, PolarToCart, Combine(
1247                             Values(CV_32FC1, CV_32FC3, CV_32FC4),
1248                             Values(false))); // Values(false) is the reserved parameter
1249
1250 INSTANTIATE_TEST_CASE_P(Arithm, Magnitude, Combine(
1251                             Values(CV_32FC1, CV_32FC3, CV_32FC4),
1252                             Values(false))); // Values(false) is the reserved parameter
1253
1254 INSTANTIATE_TEST_CASE_P(Arithm, Transpose, Combine(
1255                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32FC1),
1256                             Values(false))); // Values(false) is the reserved parameter
1257
1258 INSTANTIATE_TEST_CASE_P(Arithm, Flip, Combine(
1259                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4),
1260                             Values(false))); // Values(false) is the reserved parameter
1261
1262 INSTANTIATE_TEST_CASE_P(Arithm, MinMax, Combine(
1263                             Values(CV_8UC1, CV_32SC1, CV_32FC1),
1264                             Values(false)));
1265
1266 INSTANTIATE_TEST_CASE_P(Arithm, MinMaxLoc, Combine(
1267                             Values(CV_8UC1, CV_32SC1, CV_32FC1),
1268                             Values(false)));
1269
1270 INSTANTIATE_TEST_CASE_P(Arithm, Sum, Combine(
1271                             Values(CV_8U, CV_32S, CV_32F),
1272                             Values(false)));
1273
1274 INSTANTIATE_TEST_CASE_P(Arithm, CountNonZero, Combine(
1275                             Values(CV_8U, CV_32S, CV_32F),
1276                             Values(false)));
1277
1278
1279 INSTANTIATE_TEST_CASE_P(Arithm, Phase, Combine(Values(CV_32FC1, CV_32FC3, CV_32FC4), Values(false)));
1280 // Values(false) is the reserved parameter
1281
1282
1283 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_and, Combine(
1284                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32SC3, CV_32SC4, CV_32FC1, CV_32FC3, CV_32FC4), Values(false)));
1285 //Values(false) is the reserved parameter
1286
1287 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_or, Combine(
1288                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32FC1, CV_32FC3, CV_32FC4), Values(false)));
1289 //Values(false) is the reserved parameter
1290
1291 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_xor, Combine(
1292                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32FC1, CV_32FC3, CV_32FC4), Values(false)));
1293 //Values(false) is the reserved parameter
1294
1295 INSTANTIATE_TEST_CASE_P(Arithm, Bitwise_not, Combine(
1296                             Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32SC1, CV_32FC1, CV_32FC3, CV_32FC4), Values(false)));
1297 //Values(false) is the reserved parameter
1298
1299 INSTANTIATE_TEST_CASE_P(Arithm, Compare, Combine(Values(CV_8UC1, CV_32SC1, CV_32FC1), Values(false)));
1300 // Values(false) is the reserved parameter
1301
1302 INSTANTIATE_TEST_CASE_P(Arithm, Pow, Combine(Values(CV_32FC1, CV_32FC3, CV_32FC4), Values(false)));
1303 // Values(false) is the reserved parameter
1304
1305 INSTANTIATE_TEST_CASE_P(Arithm, MagnitudeSqr, Combine(
1306                             Values(CV_32FC1, CV_32FC1),
1307                             Values(false))); // Values(false) is the reserved parameter
1308
1309 INSTANTIATE_TEST_CASE_P(Arithm, AddWeighted, Combine(
1310                             Values(CV_8UC1, CV_32SC1, CV_32FC1),
1311                             Values(false))); // Values(false) is the reserved parameter
1312
1313
1314
1315 #endif // HAVE_OPENCL