mirror of
https://github.com/opencv/opencv.git
synced 2024-12-25 18:18:04 +08:00
4a297a2443
- removed tr1 usage (dropped in C++17) - moved includes of vector/map/iostream/limits into ts.hpp - require opencv_test + anonymous namespace (added compile check) - fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions - added missing license headers
46 lines
995 B
C++
46 lines
995 B
C++
#include "perf_precomp.hpp"
|
|
|
|
namespace opencv_test
|
|
{
|
|
using namespace perf;
|
|
|
|
template <typename T>
|
|
static void CvRoundMat(const cv::Mat & src, cv::Mat & dst)
|
|
{
|
|
for (int y = 0; y < dst.rows; ++y)
|
|
{
|
|
const T * sptr = src.ptr<T>(y);
|
|
int * dptr = dst.ptr<int>(y);
|
|
|
|
for (int x = 0; x < dst.cols; ++x)
|
|
dptr[x] = cvRound(sptr[x]);
|
|
}
|
|
}
|
|
|
|
PERF_TEST_P(Size_MatType, CvRound_Float,
|
|
testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
|
|
testing::Values(CV_32FC1, CV_64FC1)))
|
|
{
|
|
Size size = get<0>(GetParam());
|
|
int type = get<1>(GetParam()), depth = CV_MAT_DEPTH(type);
|
|
|
|
cv::Mat src(size, type), dst(size, CV_32SC1);
|
|
|
|
declare.in(src, WARMUP_RNG).out(dst);
|
|
|
|
if (depth == CV_32F)
|
|
{
|
|
TEST_CYCLE()
|
|
CvRoundMat<float>(src, dst);
|
|
}
|
|
else if (depth == CV_64F)
|
|
{
|
|
TEST_CYCLE()
|
|
CvRoundMat<double>(src, dst);
|
|
}
|
|
|
|
SANITY_CHECK_NOTHING();
|
|
}
|
|
|
|
} // namespace
|