1 #include "test_precomp.hpp"
2 #include "opencv2/ts/ocl_test.hpp"
4 #include "opencv2/core/ippasync.hpp"
8 using namespace cvtest;
13 PARAM_TEST_CASE(IPPAsync, MatDepth, Channels, hppAccelType)
18 hppAccelType accelType;
21 Ptr<hppiMatrix> hppMat;
23 hppiVirtualMatrix * virtMatrix;
28 type = CV_MAKE_TYPE(GET_PARAM(0), GET_PARAM(1));
31 accelType = GET_PARAM(2);
34 virtual void generateTestData()
36 Size matrix_Size = randomSize(2, 100);
37 const double upValue = 100;
39 matrix = randomMat(matrix_Size, type, -upValue, upValue);
42 void Near(double threshold = 0.0)
44 EXPECT_MAT_NEAR(matrix, result, threshold);
48 TEST_P(IPPAsync, accuracy)
50 if (depth==CV_32S || depth==CV_64F)
53 sts = hppCreateInstance(accelType, 0, &accel);
54 CV_Assert(sts==HPP_STATUS_NO_ERROR);
55 virtMatrix = hppiCreateVirtualMatrices(accel, 2);
57 for (int j = 0; j < test_loop_times; j++)
60 hppMat = hpp::getHpp(matrix);
64 sts = hppiAddC(accel, hppMat, a, 0, virtMatrix[0]);
65 CV_Assert(sts==HPP_STATUS_NO_ERROR);
66 sts = hppiSubC(accel, virtMatrix[0], a, 0, virtMatrix[1]);
67 CV_Assert(sts==HPP_STATUS_NO_ERROR);
69 sts = hppWait(accel, HPP_TIME_OUT_INFINITE);
70 CV_Assert(sts==HPP_STATUS_NO_ERROR);
72 result = hpp::getMat(virtMatrix[1], accel, cn);
77 sts = hppiDeleteVirtualMatrices(accel, virtMatrix);
78 CV_Assert(sts==HPP_STATUS_NO_ERROR);
79 sts = hppDeleteInstance(accel);
80 CV_Assert(sts==HPP_STATUS_NO_ERROR);
83 TEST_P(IPPAsync, conversion)
85 sts = hppCreateInstance(accelType, 0, &accel);
86 CV_Assert(sts==HPP_STATUS_NO_ERROR);
87 virtMatrix = hppiCreateVirtualMatrices(accel, 1);
89 for (int j = 0; j < test_loop_times; j++)
92 hppMat = hpp::getHpp(matrix);
94 sts = hppiCopy (accel, hppMat, virtMatrix[0]);
95 CV_Assert(sts==HPP_STATUS_NO_ERROR);
97 sts = hppWait(accel, HPP_TIME_OUT_INFINITE);
98 CV_Assert(sts==HPP_STATUS_NO_ERROR);
100 result = hpp::getMat(virtMatrix[0], accel, cn);
105 sts = hppiDeleteVirtualMatrices(accel, virtMatrix);
106 CV_Assert(sts==HPP_STATUS_NO_ERROR);
107 sts = hppDeleteInstance(accel);
108 CV_Assert(sts==HPP_STATUS_NO_ERROR);
111 INSTANTIATE_TEST_CASE_P(IppATest, IPPAsync, Combine(Values(CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F),
113 Values( HPP_ACCEL_TYPE_CPU, HPP_ACCEL_TYPE_GPU)));