show CPU feature correctly when FP16 is available

* make sure that CV_FP16 has the correct meaning
  * check FP16 feature correctly
This commit is contained in:
Tomoaki Teshima 2016-07-29 07:00:10 +09:00
parent 8124b5600f
commit c57f8780e9
3 changed files with 13 additions and 13 deletions

View File

@ -193,10 +193,6 @@ enum CpuFeatures {
# endif
# define CV_POPCNT 1
# endif
# if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
# include <immintrin.h>
# define CV_FP16 1
# endif
# if defined __AVX__ || (defined _MSC_VER && _MSC_VER >= 1600 && 0)
// MS Visual Studio 2010 (2012?) has no macro pre-defined to identify the use of /arch:AVX
// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32
@ -231,10 +227,6 @@ enum CpuFeatures {
# include <arm_neon.h>
#endif
#if defined HAVE_FP16 && defined __GNUC__
# define CV_FP16 1
#endif
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__
# define CV_VFP 1
#endif
@ -265,9 +257,6 @@ enum CpuFeatures {
#ifndef CV_SSE4_2
# define CV_SSE4_2 0
#endif
#ifndef CV_FP16
# define CV_FP16 0
#endif
#ifndef CV_AVX
# define CV_AVX 0
#endif

View File

@ -71,6 +71,17 @@
# endif
#endif
#if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
# include <immintrin.h>
# define CV_FP16 1
#elif defined HAVE_FP16 && defined __GNUC__
# define CV_FP16 1
#endif
#ifndef CV_FP16
# define CV_FP16 0
#endif
//! @cond IGNORED
namespace cv

View File

@ -4568,7 +4568,7 @@ cvtScaleHalf_<float, short>( const float* src, size_t sstep, short* dst, size_t
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
if( checkHardwareSupport(CV_FP16) )
if( checkHardwareSupport(CV_CPU_FP16) )
{
for( ; size.height--; src += sstep, dst += dstep )
{
@ -4622,7 +4622,7 @@ cvtScaleHalf_<short, float>( const short* src, size_t sstep, float* dst, size_t
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
if( checkHardwareSupport(CV_FP16) )
if( checkHardwareSupport(CV_CPU_FP16) )
{
for( ; size.height--; src += sstep, dst += dstep )
{