Commit 644c0dd5 authored by Maksim Shabunin's avatar Maksim Shabunin

Merge pull request #6940 from andy-held:cuda_pyrlk_static_const_init

parents ce05d6cb 13d1ee10
...@@ -347,13 +347,19 @@ namespace pyrlk ...@@ -347,13 +347,19 @@ namespace pyrlk
template <typename T> template <typename T>
struct DenormalizationFactor struct DenormalizationFactor
{ {
static const float factor = 1.0; static __device__ __forceinline__ float factor()
{
return 1.0f;
}
}; };
template <> template <>
struct DenormalizationFactor<uchar> struct DenormalizationFactor<uchar>
{ {
static const float factor = 255.0; static __device__ __forceinline__ float factor()
{
return 255.0f;
}
}; };
template <int cn, int PATCH_X, int PATCH_Y, bool calcErr, typename T> template <int cn, int PATCH_X, int PATCH_Y, bool calcErr, typename T>
...@@ -544,7 +550,7 @@ namespace pyrlk ...@@ -544,7 +550,7 @@ namespace pyrlk
nextPts[blockIdx.x] = nextPt; nextPts[blockIdx.x] = nextPt;
if (calcErr) if (calcErr)
err[blockIdx.x] = static_cast<float>(errval) / (::min(cn, 3) * c_winSize_x * c_winSize_y) * DenormalizationFactor<T>::factor; err[blockIdx.x] = static_cast<float>(errval) / (::min(cn, 3) * c_winSize_x * c_winSize_y) * DenormalizationFactor<T>::factor();
} }
} }
......
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