Commit f4d0c9b1 authored by Jin Ma's avatar Jin Ma

Revised the code according to the feedback of the community.

parent b9d7e675
...@@ -63,32 +63,31 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter, ...@@ -63,32 +63,31 @@ PERF_TEST_P(KalmanFilterFixture, KalmanFilter,
cv::Mat sample(dim, 1, CV_32FC1), dresult; cv::Mat sample(dim, 1, CV_32FC1), dresult;
randu(sample, -1, 1); randu(sample, -1, 1);
cv::ocl::oclMat dsample(sample);
cv::Mat statePre_; cv::Mat statePre_;
if(RUN_PLAIN_IMPL) if(RUN_PLAIN_IMPL)
{ {
cv::KalmanFilter kalman;
TEST_CYCLE() TEST_CYCLE()
{ {
cv::KalmanFilter kalman;
kalman.init(dim, dim); kalman.init(dim, dim);
kalman.correct(sample); kalman.correct(sample);
kalman.predict(); kalman.predict();
statePre_ = kalman.statePre;
} }
SANITY_CHECK(statePre_); statePre_ = kalman.statePre;
}else if(RUN_OCL_IMPL) }else if(RUN_OCL_IMPL)
{ {
cv::ocl::oclMat dsample(sample);
cv::ocl::KalmanFilter kalman_ocl;
OCL_TEST_CYCLE() OCL_TEST_CYCLE()
{ {
cv::ocl::KalmanFilter kalman_ocl;
kalman_ocl.init(dim, dim); kalman_ocl.init(dim, dim);
kalman_ocl.correct(dsample); kalman_ocl.correct(dsample);
kalman_ocl.predict(); kalman_ocl.predict();
kalman_ocl.statePre.download(statePre_);
} }
SANITY_CHECK(statePre_); kalman_ocl.statePre.download(statePre_);
}else }else
OCL_PERF_ELSE OCL_PERF_ELSE
SANITY_CHECK(statePre_);
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment