From f38fe76025d96bf8512e5dc366dc232d1365ccd9 Mon Sep 17 00:00:00 2001
From: mlyashko <maria.lyashko@itseez.com>
Date: Tue, 25 Mar 2014 14:50:37 +0400
Subject: [PATCH 1/2] added perf test for CalcBackProj

---
 modules/imgproc/perf/opencl/perf_imgproc.cpp | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/modules/imgproc/perf/opencl/perf_imgproc.cpp b/modules/imgproc/perf/opencl/perf_imgproc.cpp
index 0d63e940ef..da3ef3f025 100644
--- a/modules/imgproc/perf/opencl/perf_imgproc.cpp
+++ b/modules/imgproc/perf/opencl/perf_imgproc.cpp
@@ -95,6 +95,34 @@ OCL_PERF_TEST_P(CalcHistFixture, CalcHist, OCL_TEST_SIZES)
     SANITY_CHECK(hist);
 }
 
+///////////// calcHist ////////////////////////
+
+typedef TestBaseWithParam<Size> CalcBackProjFixture;
+
+OCL_PERF_TEST_P(CalcBackProjFixture, CalcBackProj, OCL_TEST_SIZES)
+{
+    const Size srcSize = GetParam();
+
+    const std::vector<int> channels(1, 0);
+    std::vector<float> ranges(2);
+    std::vector<int> histSize(1, 256);
+    ranges[0] = 0;
+    ranges[1] = 256;
+
+    checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
+
+    UMat src(srcSize, CV_8UC1), hist(256, 1, CV_32FC1), dst(srcSize, CV_8UC1);
+    declare.in(src, WARMUP_RNG).out(hist);
+
+    cv::calcHist(std::vector<UMat>(1, src), channels, noArray(), hist, histSize, ranges, false);
+
+    declare.in(src, WARMUP_RNG).out(dst);
+    OCL_TEST_CYCLE() cv::calcBackProject(std::vector<UMat>(1,src), channels, hist, dst, ranges, 1);
+
+    SANITY_CHECK(dst, 1e-3);
+}
+
+
 /////////// CopyMakeBorder //////////////////////
 
 CV_ENUM(Border, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101)

From 70fdfa0bdbd5b8687b314944cfdc516651d94180 Mon Sep 17 00:00:00 2001
From: mlyashko <maria.lyashko@itseez.com>
Date: Tue, 25 Mar 2014 16:43:20 +0400
Subject: [PATCH 2/2] changed type of sanity check

---
 modules/imgproc/perf/opencl/perf_imgproc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/imgproc/perf/opencl/perf_imgproc.cpp b/modules/imgproc/perf/opencl/perf_imgproc.cpp
index da3ef3f025..71449872f7 100644
--- a/modules/imgproc/perf/opencl/perf_imgproc.cpp
+++ b/modules/imgproc/perf/opencl/perf_imgproc.cpp
@@ -119,7 +119,7 @@ OCL_PERF_TEST_P(CalcBackProjFixture, CalcBackProj, OCL_TEST_SIZES)
     declare.in(src, WARMUP_RNG).out(dst);
     OCL_TEST_CYCLE() cv::calcBackProject(std::vector<UMat>(1,src), channels, hist, dst, ranges, 1);
 
-    SANITY_CHECK(dst, 1e-3);
+    SANITY_CHECK_NOTHING();
 }