1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
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.
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
14 // Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
18 // Fangfang Bai, fangfang@multicorewareinc.com
19 // Jin Ma, jin@multicorewareinc.com
21 // Redistribution and use in source and binary forms, with or without modification,
22 // are permitted provided that the following conditions are met:
24 // * Redistribution's of source code must retain the above copyright notice,
25 // this list of conditions and the following disclaimer.
27 // * Redistribution's in binary form must reproduce the above copyright notice,
28 // this list of conditions and the following disclaimer in the documentation
29 // and/or other materials provided with the distribution.
31 // * The name of the copyright holders may not be used to endorse or promote products
32 // derived from this software without specific prior written permission.
34 // This software is provided by the copyright holders and contributors as is and
35 // any express or implied warranties, including, but not limited to, the implied
36 // warranties of merchantability and fitness for a particular purpose are disclaimed.
37 // In no event shall the Intel Corporation or contributors be liable for any direct,
38 // indirect, incidental, special, exemplary, or consequential damages
39 // (including, but not limited to, procurement of substitute goods or services;
40 // loss of use, data, or profits; or business interruption) however caused
41 // and on any theory of liability, whether in contract, strict liability,
42 // or tort (including negligence or otherwise) arising in any way out of
43 // the use of this software, even if advised of the possibility of such damage.
46 #include "perf_precomp.hpp"
49 using std::tr1::tuple;
52 ///////////// equalizeHist ////////////////////////
54 typedef TestBaseWithParam<Size> equalizeHistFixture;
56 PERF_TEST_P(equalizeHistFixture, equalizeHist, OCL_TYPICAL_MAT_SIZES)
58 const Size srcSize = GetParam();
60 Mat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
61 declare.in(src, WARMUP_RNG).out(dst);
65 ocl::oclMat oclSrc(src), oclDst(srcSize, src.type());
67 OCL_TEST_CYCLE() cv::ocl::equalizeHist(oclSrc, oclDst);
71 SANITY_CHECK(dst, 1 + DBL_EPSILON);
73 else if (RUN_PLAIN_IMPL)
75 TEST_CYCLE() cv::equalizeHist(src, dst);
77 SANITY_CHECK(dst, 1 + DBL_EPSILON);
83 /////////// CopyMakeBorder //////////////////////
85 typedef Size_MatType CopyMakeBorderFixture;
87 PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
88 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
89 OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
91 const Size_MatType_t params = GetParam();
92 const Size srcSize = get<0>(params);
93 const int type = get<1>(params), borderType = BORDER_CONSTANT;
95 Mat src(srcSize, type), dst;
96 const Size dstSize = srcSize + Size(12, 12);
97 dst.create(dstSize, type);
98 declare.in(src, WARMUP_RNG).out(dst);
102 ocl::oclMat oclSrc(src), oclDst(dstSize, type);
104 OCL_TEST_CYCLE() cv::ocl::copyMakeBorder(oclSrc, oclDst, 7, 5, 5, 7, borderType, cv::Scalar(1.0));
106 oclDst.download(dst);
110 else if (RUN_PLAIN_IMPL)
112 TEST_CYCLE() cv::copyMakeBorder(src, dst, 7, 5, 5, 7, borderType, cv::Scalar(1.0));
120 ///////////// cornerMinEigenVal ////////////////////////
122 typedef Size_MatType cornerMinEigenValFixture;
124 PERF_TEST_P(cornerMinEigenValFixture, cornerMinEigenVal,
125 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
126 OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
128 const Size_MatType_t params = GetParam();
129 const Size srcSize = get<0>(params);
130 const int type = get<1>(params), borderType = BORDER_REFLECT;
131 const int blockSize = 7, apertureSize = 1 + 2 * 3;
133 Mat src(srcSize, type), dst(srcSize, CV_32FC1);
134 declare.in(src, WARMUP_RNG).out(dst)
135 .time(srcSize == OCL_SIZE_4000 ? 20 : srcSize == OCL_SIZE_2000 ? 5 : 3);
137 const int depth = CV_MAT_DEPTH(type);
138 const ERROR_TYPE errorType = depth == CV_8U ? ERROR_ABSOLUTE : ERROR_RELATIVE;
142 ocl::oclMat oclSrc(src), oclDst(srcSize, CV_32FC1);
144 OCL_TEST_CYCLE() cv::ocl::cornerMinEigenVal(oclSrc, oclDst, blockSize, apertureSize, borderType);
146 oclDst.download(dst);
148 SANITY_CHECK(dst, 1e-6, errorType);
150 else if (RUN_PLAIN_IMPL)
152 TEST_CYCLE() cv::cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);
154 SANITY_CHECK(dst, 1e-6, errorType);
160 ///////////// cornerHarris ////////////////////////
162 typedef Size_MatType cornerHarrisFixture;
164 PERF_TEST_P(cornerHarrisFixture, cornerHarris,
165 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
166 OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
168 const Size_MatType_t params = GetParam();
169 const Size srcSize = get<0>(params);
170 const int type = get<1>(params), borderType = BORDER_REFLECT;
172 Mat src(srcSize, type), dst(srcSize, CV_32FC1);
174 declare.in(src).out(dst)
175 .time(srcSize == OCL_SIZE_4000 ? 20 : srcSize == OCL_SIZE_2000 ? 5 : 3);
179 ocl::oclMat oclSrc(src), oclDst(srcSize, CV_32FC1);
181 OCL_TEST_CYCLE() cv::ocl::cornerHarris(oclSrc, oclDst, 5, 7, 0.1, borderType);
183 oclDst.download(dst);
185 SANITY_CHECK(dst, 3e-5);
187 else if (RUN_PLAIN_IMPL)
189 TEST_CYCLE() cv::cornerHarris(src, dst, 5, 7, 0.1, borderType);
191 SANITY_CHECK(dst, 3e-5);
197 ///////////// integral ////////////////////////
199 typedef TestBaseWithParam<Size> integralFixture;
201 PERF_TEST_P(integralFixture, integral, OCL_TYPICAL_MAT_SIZES)
203 const Size srcSize = GetParam();
205 Mat src(srcSize, CV_8UC1), dst;
206 declare.in(src, WARMUP_RNG);
210 ocl::oclMat oclSrc(src), oclDst;
212 OCL_TEST_CYCLE() cv::ocl::integral(oclSrc, oclDst);
214 oclDst.download(dst);
218 else if (RUN_PLAIN_IMPL)
220 TEST_CYCLE() cv::integral(src, dst);
228 ///////////// WarpAffine ////////////////////////
230 typedef Size_MatType WarpAffineFixture;
232 PERF_TEST_P(WarpAffineFixture, WarpAffine,
233 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
234 OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
236 static const double coeffs[2][3] =
238 { cos(CV_PI / 6), -sin(CV_PI / 6), 100.0 },
239 { sin(CV_PI / 6), cos(CV_PI / 6), -100.0 }
241 Mat M(2, 3, CV_64F, (void *)coeffs);
242 const int interpolation = INTER_NEAREST;
244 const Size_MatType_t params = GetParam();
245 const Size srcSize = get<0>(params);
246 const int type = get<1>(params);
248 Mat src(srcSize, type), dst(srcSize, type);
249 declare.in(src, WARMUP_RNG).out(dst);
253 ocl::oclMat oclSrc(src), oclDst(srcSize, type);
255 OCL_TEST_CYCLE() cv::ocl::warpAffine(oclSrc, oclDst, M, srcSize, interpolation);
257 oclDst.download(dst);
261 else if (RUN_PLAIN_IMPL)
263 TEST_CYCLE() cv::warpAffine(src, dst, M, srcSize, interpolation);
271 ///////////// WarpPerspective ////////////////////////
273 typedef Size_MatType WarpPerspectiveFixture;
275 PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
276 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
277 OCL_PERF_ENUM(CV_8UC1, CV_8UC4)))
279 static const double coeffs[3][3] =
281 {cos(CV_PI / 6), -sin(CV_PI / 6), 100.0},
282 {sin(CV_PI / 6), cos(CV_PI / 6), -100.0},
285 Mat M(3, 3, CV_64F, (void *)coeffs);
286 const int interpolation = INTER_LINEAR;
288 const Size_MatType_t params = GetParam();
289 const Size srcSize = get<0>(params);
290 const int type = get<1>(params);
292 Mat src(srcSize, type), dst(srcSize, type);
293 declare.in(src, WARMUP_RNG).out(dst)
294 .time(srcSize == OCL_SIZE_4000 ? 18 : srcSize == OCL_SIZE_2000 ? 5 : 2);
298 ocl::oclMat oclSrc(src), oclDst(srcSize, type);
300 OCL_TEST_CYCLE() cv::ocl::warpPerspective(oclSrc, oclDst, M, srcSize, interpolation);
302 oclDst.download(dst);
306 else if (RUN_PLAIN_IMPL)
308 TEST_CYCLE() cv::warpPerspective(src, dst, M, srcSize, interpolation);
316 ///////////// resize ////////////////////////
318 CV_ENUM(resizeInterType, INTER_NEAREST, INTER_LINEAR)
320 typedef tuple<Size, MatType, resizeInterType, double> resizeParams;
321 typedef TestBaseWithParam<resizeParams> resizeFixture;
323 PERF_TEST_P(resizeFixture, resize,
324 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
325 OCL_PERF_ENUM(CV_8UC1, CV_8UC4),
326 resizeInterType::all(),
327 ::testing::Values(0.5, 2.0)))
329 const resizeParams params = GetParam();
330 const Size srcSize = get<0>(params);
331 const int type = get<1>(params), interType = get<2>(params);
332 double scale = get<3>(params);
334 Mat src(srcSize, type), dst;
335 const Size dstSize(cvRound(srcSize.width * scale), cvRound(srcSize.height * scale));
336 dst.create(dstSize, type);
337 declare.in(src, WARMUP_RNG).out(dst);
338 if (interType == INTER_LINEAR && type == CV_8UC4 && OCL_SIZE_4000 == srcSize)
343 ocl::oclMat oclSrc(src), oclDst(dstSize, type);
345 OCL_TEST_CYCLE() cv::ocl::resize(oclSrc, oclDst, Size(), scale, scale, interType);
347 oclDst.download(dst);
349 SANITY_CHECK(dst, 1 + DBL_EPSILON);
351 else if (RUN_PLAIN_IMPL)
353 TEST_CYCLE() cv::resize(src, dst, Size(), scale, scale, interType);
355 SANITY_CHECK(dst, 1 + DBL_EPSILON);
361 ///////////// threshold////////////////////////
363 CV_ENUM(ThreshType, THRESH_BINARY, THRESH_TRUNC)
365 typedef tuple<Size, ThreshType> ThreshParams;
366 typedef TestBaseWithParam<ThreshParams> ThreshFixture;
368 PERF_TEST_P(ThreshFixture, threshold,
369 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
372 const ThreshParams params = GetParam();
373 const Size srcSize = get<0>(params);
374 const int threshType = get<1>(params);
376 Mat src(srcSize, CV_8U), dst(srcSize, CV_8U);
378 declare.in(src).out(dst);
382 ocl::oclMat oclSrc(src), oclDst(srcSize, CV_8U);
384 OCL_TEST_CYCLE() cv::ocl::threshold(oclSrc, oclDst, 50.0, 0.0, threshType);
386 oclDst.download(dst);
390 else if (RUN_PLAIN_IMPL)
392 TEST_CYCLE() cv::threshold(src, dst, 50.0, 0.0, threshType);
400 ///////////// meanShiftFiltering////////////////////////
408 static COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size size, int sp, int sr, int maxIter, float eps, int *tab)
415 uchar *pstart = NULL;
416 int revx = 0, revy = 0;
421 // iterate meanshift procedure
422 for(iter = 0; iter < maxIter; iter++ )
425 int s0 = 0, s1 = 0, s2 = 0, sx = 0, sy = 0;
427 //mean shift: process pixels in window (p-sigmaSp)x(p+sigmaSp)
433 //deal with the image boundary
434 if(minx < 0) minx = 0;
435 if(miny < 0) miny = 0;
436 if(maxx >= size.width) maxx = size.width - 1;
437 if(maxy >= size.height) maxy = size.height - 1;
444 pstart = pstart + revy * sstep + (revx << 2); //point to the new position
447 ptr = ptr + (miny - y0) * sstep + ((minx - x0) << 2); //point to the start in the row
449 for( int y = miny; y <= maxy; y++, ptr += sstep - ((maxx - minx + 1) << 2))
453 #if CV_ENABLE_UNROLLED
454 for( ; x + 4 <= maxx; x += 4, ptr += 16)
457 t0 = ptr[0], t1 = ptr[1], t2 = ptr[2];
458 if(tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
466 t0 = ptr[4], t1 = ptr[5], t2 = ptr[6];
467 if(tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
475 t0 = ptr[8], t1 = ptr[9], t2 = ptr[10];
476 if(tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
484 t0 = ptr[12], t1 = ptr[13], t2 = ptr[14];
485 if(tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
495 for(; x <= maxx; x++, ptr += 4)
497 int t0 = ptr[0], t1 = ptr[1], t2 = ptr[2];
498 if(tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
522 bool stopFlag = (x0 == x1 && y0 == y1) || (abs(x1 - x0) + abs(y1 - y0) +
523 tab[s0 - c0 + 255] + tab[s1 - c1 + 255] + tab[s2 - c2 + 255] <= eps);
525 //revise the pointer corresponding to the new (y0,x0)
545 coor.x = static_cast<short>(x0);
546 coor.y = static_cast<short>(y0);
550 static void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr, cv::TermCriteria crit)
552 if( src_roi.empty() )
553 CV_Error( Error::StsBadArg, "The input image is empty" );
555 if( src_roi.depth() != CV_8U || src_roi.channels() != 4 )
556 CV_Error( Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported" );
558 dst_roi.create(src_roi.size(), src_roi.type());
560 CV_Assert( (src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) );
561 CV_Assert( !(dst_roi.step & 0x3) );
563 if( !(crit.type & cv::TermCriteria::MAX_ITER) )
565 int maxIter = std::min(std::max(crit.maxCount, 1), 100);
567 if( !(crit.type & cv::TermCriteria::EPS) )
569 eps = (float)std::max(crit.epsilon, 0.0);
572 for(int i = 0; i < 512; i++)
573 tab[i] = (i - 255) * (i - 255);
574 uchar *sptr = src_roi.data;
575 uchar *dptr = dst_roi.data;
576 int sstep = (int)src_roi.step;
577 int dstep = (int)dst_roi.step;
578 cv::Size size = src_roi.size();
580 for(int i = 0; i < size.height; i++, sptr += sstep - (size.width << 2),
581 dptr += dstep - (size.width << 2))
583 for(int j = 0; j < size.width; j++, sptr += 4, dptr += 4)
585 do_meanShift(j, i, sptr, dptr, sstep, size, sp, sr, maxIter, eps, tab);
590 typedef TestBaseWithParam<Size> meanShiftFilteringFixture;
592 PERF_TEST_P(meanShiftFilteringFixture, meanShiftFiltering,
593 OCL_TYPICAL_MAT_SIZES)
595 const Size srcSize = GetParam();
596 const int sp = 5, sr = 6;
597 cv::TermCriteria crit(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 5, 1);
599 Mat src(srcSize, CV_8UC4), dst(srcSize, CV_8UC4);
600 declare.in(src, WARMUP_RNG).out(dst)
601 .time(srcSize == OCL_SIZE_4000 ?
602 56 : srcSize == OCL_SIZE_2000 ? 15 : 3.8);
606 TEST_CYCLE() meanShiftFiltering_(src, dst, sp, sr, crit);
610 else if (RUN_OCL_IMPL)
612 ocl::oclMat oclSrc(src), oclDst(srcSize, CV_8UC4);
614 OCL_TEST_CYCLE() ocl::meanShiftFiltering(oclSrc, oclDst, sp, sr, crit);
616 oclDst.download(dst);
624 static void meanShiftProc_(const Mat &src_roi, Mat &dst_roi, Mat &dstCoor_roi, int sp, int sr, cv::TermCriteria crit)
628 CV_Error(Error::StsBadArg, "The input image is empty");
630 if (src_roi.depth() != CV_8U || src_roi.channels() != 4)
632 CV_Error(Error::StsUnsupportedFormat, "Only 8-bit, 4-channel images are supported");
635 dst_roi.create(src_roi.size(), src_roi.type());
636 dstCoor_roi.create(src_roi.size(), CV_16SC2);
638 CV_Assert((src_roi.cols == dst_roi.cols) && (src_roi.rows == dst_roi.rows) &&
639 (src_roi.cols == dstCoor_roi.cols) && (src_roi.rows == dstCoor_roi.rows));
640 CV_Assert(!(dstCoor_roi.step & 0x3));
642 if (!(crit.type & cv::TermCriteria::MAX_ITER))
647 int maxIter = std::min(std::max(crit.maxCount, 1), 100);
650 if (!(crit.type & cv::TermCriteria::EPS))
655 eps = (float)std::max(crit.epsilon, 0.0);
659 for (int i = 0; i < 512; i++)
661 tab[i] = (i - 255) * (i - 255);
664 uchar *sptr = src_roi.data;
665 uchar *dptr = dst_roi.data;
666 short *dCoorptr = (short *)dstCoor_roi.data;
667 int sstep = (int)src_roi.step;
668 int dstep = (int)dst_roi.step;
669 int dCoorstep = (int)dstCoor_roi.step >> 1;
670 cv::Size size = src_roi.size();
672 for (int i = 0; i < size.height; i++, sptr += sstep - (size.width << 2),
673 dptr += dstep - (size.width << 2), dCoorptr += dCoorstep - (size.width << 1))
675 for (int j = 0; j < size.width; j++, sptr += 4, dptr += 4, dCoorptr += 2)
677 *((COOR *)dCoorptr) = do_meanShift(j, i, sptr, dptr, sstep, size, sp, sr, maxIter, eps, tab);
683 typedef TestBaseWithParam<Size> meanShiftProcFixture;
685 PERF_TEST_P(meanShiftProcFixture, meanShiftProc,
686 OCL_TYPICAL_MAT_SIZES)
688 const Size srcSize = GetParam();
689 TermCriteria crit(TermCriteria::COUNT + TermCriteria::EPS, 5, 1);
691 Mat src(srcSize, CV_8UC4), dst1(srcSize, CV_8UC4),
692 dst2(srcSize, CV_16SC2);
693 declare.in(src, WARMUP_RNG).out(dst1, dst2)
694 .time(srcSize == OCL_SIZE_4000 ?
695 56 : srcSize == OCL_SIZE_2000 ? 15 : 3.8);;
699 TEST_CYCLE() meanShiftProc_(src, dst1, dst2, 5, 6, crit);
704 else if (RUN_OCL_IMPL)
706 ocl::oclMat oclSrc(src), oclDst1(srcSize, CV_8UC4),
707 oclDst2(srcSize, CV_16SC2);
709 OCL_TEST_CYCLE() ocl::meanShiftProc(oclSrc, oclDst1, oclDst2, 5, 6, crit);
711 oclDst1.download(dst1);
712 oclDst2.download(dst2);
721 ///////////// remap////////////////////////
723 CV_ENUM(RemapInterType, INTER_NEAREST, INTER_LINEAR)
725 typedef tuple<Size, MatType, RemapInterType> remapParams;
726 typedef TestBaseWithParam<remapParams> remapFixture;
728 PERF_TEST_P(remapFixture, remap,
729 ::testing::Combine(OCL_TYPICAL_MAT_SIZES,
730 OCL_PERF_ENUM(CV_8UC1, CV_8UC4),
731 RemapInterType::all()))
733 const remapParams params = GetParam();
734 const Size srcSize = get<0>(params);
735 const int type = get<1>(params), interpolation = get<2>(params);
737 Mat src(srcSize, type), dst(srcSize, type);
738 declare.in(src, WARMUP_RNG).out(dst);
740 if (srcSize == OCL_SIZE_4000 && interpolation == INTER_LINEAR)
744 xmap.create(srcSize, CV_32FC1);
745 ymap.create(srcSize, CV_32FC1);
747 for (int i = 0; i < srcSize.height; ++i)
749 float * const xmap_row = xmap.ptr<float>(i);
750 float * const ymap_row = ymap.ptr<float>(i);
752 for (int j = 0; j < srcSize.width; ++j)
754 xmap_row[j] = (j - srcSize.width * 0.5f) * 0.75f + srcSize.width * 0.5f;
755 ymap_row[j] = (i - srcSize.height * 0.5f) * 0.75f + srcSize.height * 0.5f;
759 const int borderMode = BORDER_CONSTANT;
763 ocl::oclMat oclSrc(src), oclDst(srcSize, type);
764 ocl::oclMat oclXMap(xmap), oclYMap(ymap);
766 OCL_TEST_CYCLE() cv::ocl::remap(oclSrc, oclDst, oclXMap, oclYMap, interpolation, borderMode);
768 oclDst.download(dst);
770 SANITY_CHECK(dst, 1 + DBL_EPSILON);
772 else if (RUN_PLAIN_IMPL)
774 TEST_CYCLE() cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
776 SANITY_CHECK(dst, 1 + DBL_EPSILON);
782 ///////////// CLAHE ////////////////////////
784 typedef TestBaseWithParam<Size> CLAHEFixture;
786 PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TYPICAL_MAT_SIZES)
788 const Size srcSize = GetParam();
789 const string impl = getSelectedImpl();
791 Mat src(srcSize, CV_8UC1), dst;
792 const double clipLimit = 40.0;
793 declare.in(src, WARMUP_RNG);
795 if (srcSize == OCL_SIZE_4000)
800 ocl::oclMat oclSrc(src), oclDst;
801 cv::Ptr<cv::CLAHE> oclClahe = cv::ocl::createCLAHE(clipLimit);
803 OCL_TEST_CYCLE() oclClahe->apply(oclSrc, oclDst);
805 oclDst.download(dst);
809 else if (RUN_PLAIN_IMPL)
811 cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(clipLimit);
812 TEST_CYCLE() clahe->apply(src, dst);
820 ///////////// columnSum////////////////////////
822 typedef TestBaseWithParam<Size> columnSumFixture;
824 static void columnSumPerfTest(const Mat & src, Mat & dst)
826 for (int j = 0; j < src.cols; j++)
827 dst.at<float>(0, j) = src.at<float>(0, j);
829 for (int i = 1; i < src.rows; ++i)
830 for (int j = 0; j < src.cols; ++j)
831 dst.at<float>(i, j) = dst.at<float>(i - 1 , j) + src.at<float>(i , j);
834 PERF_TEST_P(columnSumFixture, columnSum, OCL_TYPICAL_MAT_SIZES)
836 const Size srcSize = GetParam();
838 Mat src(srcSize, CV_32FC1), dst(srcSize, CV_32FC1);
839 declare.in(src, WARMUP_RNG).out(dst);
841 if (srcSize == OCL_SIZE_4000)
846 ocl::oclMat oclSrc(src), oclDst(srcSize, CV_32FC1);
848 OCL_TEST_CYCLE() cv::ocl::columnSum(oclSrc, oclDst);
850 oclDst.download(dst);
854 else if (RUN_PLAIN_IMPL)
856 TEST_CYCLE() columnSumPerfTest(src, dst);