Commit 5669ee81 authored by Peter J. Stieber's avatar Peter J. Stieber

Replace private.cuda.hpp with conditional include of cuda_fp16.h.

parent 2a253772
...@@ -47,7 +47,9 @@ ...@@ -47,7 +47,9 @@
#define OPENCV_CUDEV_UTIL_SATURATE_CAST_HPP #define OPENCV_CUDEV_UTIL_SATURATE_CAST_HPP
#include "../common.hpp" #include "../common.hpp"
#include "opencv2/core/private.cuda.hpp" #if __CUDACC_VER_MAJOR__ >= 9
#include <cuda_fp16.h>
#endif
namespace cv { namespace cudev { namespace cv { namespace cudev {
...@@ -275,7 +277,7 @@ template <typename T, typename D> __device__ __forceinline__ D cast_fp16(T v); ...@@ -275,7 +277,7 @@ template <typename T, typename D> __device__ __forceinline__ D cast_fp16(T v);
template <> __device__ __forceinline__ float cast_fp16<short, float>(short v) template <> __device__ __forceinline__ float cast_fp16<short, float>(short v)
{ {
#if __CUDACC_VER_MAJOR__ >= 9 #if __CUDACC_VER_MAJOR__ >= 9
return float(*(__half*)&v); return float(*(__half*)&v);
#else #else
return __half2float(v); return __half2float(v);
...@@ -284,7 +286,7 @@ template <> __device__ __forceinline__ float cast_fp16<short, float>(short v) ...@@ -284,7 +286,7 @@ template <> __device__ __forceinline__ float cast_fp16<short, float>(short v)
template <> __device__ __forceinline__ short cast_fp16<float, short>(float v) template <> __device__ __forceinline__ short cast_fp16<float, short>(float v)
{ {
#if __CUDACC_VER_MAJOR__ >= 9 #if __CUDACC_VER_MAJOR__ >= 9
__half h(v); __half h(v);
return *(short*)&v; return *(short*)&v;
#else #else
......
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