diff --git a/modules/cudaoptflow/src/cuda/pyrlk.cu b/modules/cudaoptflow/src/cuda/pyrlk.cu index 5c81edfac..2f2865057 100644 --- a/modules/cudaoptflow/src/cuda/pyrlk.cu +++ b/modules/cudaoptflow/src/cuda/pyrlk.cu @@ -347,13 +347,19 @@ namespace pyrlk template struct DenormalizationFactor { - static const float factor = 1.0; + static __device__ __forceinline__ float factor() + { + return 1.0f; + } }; template <> struct DenormalizationFactor { - static const float factor = 255.0; + static __device__ __forceinline__ float factor() + { + return 255.0f; + } }; template @@ -544,7 +550,7 @@ namespace pyrlk nextPts[blockIdx.x] = nextPt; if (calcErr) - err[blockIdx.x] = static_cast(errval) / (::min(cn, 3) * c_winSize_x * c_winSize_y) * DenormalizationFactor::factor; + err[blockIdx.x] = static_cast(errval) / (::min(cn, 3) * c_winSize_x * c_winSize_y) * DenormalizationFactor::factor(); } }