Path: blob/master/modules/imgproc/perf/opencl/perf_accumulate.cpp
16344 views
/*M///////////////////////////////////////////////////////////////////////////////////////1//2// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.3//4// By downloading, copying, installing or using the software you agree to this license.5// If you do not agree to this license, do not download, install,6// copy or use the software.7//8//9// License Agreement10// For Open Source Computer Vision Library11//12// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.13// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.14// Third party copyrights are property of their respective owners.15//16// @Authors17// Nathan, [email protected]18//19// Redistribution and use in source and binary forms, with or without modification,20// are permitted provided that the following conditions are met:21//22// * Redistribution's of source code must retain the above copyright notice,23// this list of conditions and the following disclaimer.24//25// * Redistribution's in binary form must reproduce the above copyright notice,26// this list of conditions and the following disclaimer in the documentation27// and/or other materials provided with the distribution.28//29// * The name of the copyright holders may not be used to endorse or promote products30// derived from this software without specific prior written permission.31//32// This software is provided by the copyright holders and contributors as is and33// any express or implied warranties, including, but not limited to, the implied34// warranties of merchantability and fitness for a particular purpose are disclaimed.35// In no event shall the Intel Corporation or contributors be liable for any direct,36// indirect, incidental, special, exemplary, or consequential damages37// (including, but not limited to, procurement of substitute goods or services;38// loss of use, data, or profits; or business interruption) however caused39// and on any theory of liability, whether in contract, strict liability,40// or tort (including negligence or otherwise) arising in any way out of41// the use of this software, even if advised of the possibility of such damage.42//43//M*/4445#include "../perf_precomp.hpp"46#include "opencv2/ts/ocl_perf.hpp"4748#ifdef HAVE_OPENCL4950namespace opencv_test {51namespace ocl {5253/////////////////////////////////// Accumulate ///////////////////////////////////5455typedef Size_MatType AccumulateFixture;5657OCL_PERF_TEST_P(AccumulateFixture, Accumulate,58::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))59{60Size_MatType_t params = GetParam();61const Size srcSize = get<0>(params);62const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);6364checkDeviceMaxMemoryAllocSize(srcSize, dstType);6566UMat src(srcSize, srcType), dst(srcSize, dstType);67declare.in(src, dst, WARMUP_RNG).out(dst);6869OCL_TEST_CYCLE() cv::accumulate(src, dst);7071SANITY_CHECK_NOTHING();72}7374/////////////////////////////////// AccumulateSquare ///////////////////////////////////7576typedef Size_MatType AccumulateSquareFixture;7778OCL_PERF_TEST_P(AccumulateSquareFixture, AccumulateSquare,79::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))80{81Size_MatType_t params = GetParam();82const Size srcSize = get<0>(params);83const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);8485checkDeviceMaxMemoryAllocSize(srcSize, dstType);8687UMat src(srcSize, srcType), dst(srcSize, dstType);88declare.in(src, dst, WARMUP_RNG);8990OCL_TEST_CYCLE() cv::accumulateSquare(src, dst);9192SANITY_CHECK_NOTHING();93}9495/////////////////////////////////// AccumulateProduct ///////////////////////////////////9697typedef Size_MatType AccumulateProductFixture;9899OCL_PERF_TEST_P(AccumulateProductFixture, AccumulateProduct,100::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))101{102Size_MatType_t params = GetParam();103const Size srcSize = get<0>(params);104const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);105106checkDeviceMaxMemoryAllocSize(srcSize, dstType);107108UMat src1(srcSize, srcType), src2(srcSize, srcType), dst(srcSize, dstType);109declare.in(src1, src2, dst, WARMUP_RNG);110111OCL_TEST_CYCLE() cv::accumulateProduct(src1, src2, dst);112113SANITY_CHECK_NOTHING();114}115116/////////////////////////////////// AccumulateWeighted ///////////////////////////////////117118typedef Size_MatType AccumulateWeightedFixture;119120OCL_PERF_TEST_P(AccumulateWeightedFixture, AccumulateWeighted,121::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))122{123Size_MatType_t params = GetParam();124const Size srcSize = get<0>(params);125const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);126127checkDeviceMaxMemoryAllocSize(srcSize, dstType);128129UMat src(srcSize, srcType), dst(srcSize, dstType);130declare.in(src, dst, WARMUP_RNG);131132OCL_TEST_CYCLE() cv::accumulateWeighted(src, dst, 2.0);133134SANITY_CHECK_NOTHING();135}136137} } // namespace opencv_test::ocl138139#endif140141142