From 612b8ce2cbdd1f878d771b40550549623a53bc01 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 12 Jan 2015 10:59:30 +0300 Subject: [PATCH] fixed compilation issues --- cmake/OpenCVCompilerOptions.cmake | 6 ++++++ modules/core/src/convert.cpp | 15 +++++++++------ modules/imgproc/src/color.cpp | 9 ++------- modules/imgproc/src/imgwarp.cpp | 2 +- modules/imgproc/src/pyramids.cpp | 13 ++++++++++--- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 2f5f13d7bf..ecd9a8b41e 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -227,6 +227,12 @@ if(MSVC) if(ENABLE_AVX AND NOT MSVC_VERSION LESS 1600) set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:AVX") endif() + if(ENABLE_AVX2 AND NOT MSVC_VERSION LESS 1600) + set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:AVX2") + endif() + if(ENABLE_FMA3 AND NOT MSVC_VERSION LESS 1600) + set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:FMA") + endif() if(ENABLE_SSE4_1 AND CV_ICC AND NOT OPENCV_EXTRA_FLAGS MATCHES "/arch:") set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /arch:SSE4.1") diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 5cb2a15fd4..7f450e5810 100644 --- a/modules/core/src/convert.cpp +++ b/modules/core/src/convert.cpp @@ -617,15 +617,18 @@ struct VMerge4 } MERGE2_KERNEL_TEMPLATE( uchar, __m128i, __m128i, _mm_deinterleave_epi8, si128); +MERGE3_KERNEL_TEMPLATE( uchar, __m128i, __m128i, _mm_interleave_epi8, si128); +MERGE4_KERNEL_TEMPLATE( uchar, __m128i, __m128i, _mm_interleave_epi8, si128); + MERGE2_KERNEL_TEMPLATE(ushort, __m128i, __m128i, _mm_deinterleave_epi16, si128); -MERGE2_KERNEL_TEMPLATE( int, __m128, float, _mm_deinterleave_ps, ps); -MERGE3_KERNEL_TEMPLATE( uchar, __m128i, __m128i, _mm_interleave_epi8, si128); +#if CV_SSE4_1 MERGE3_KERNEL_TEMPLATE(ushort, __m128i, __m128i, _mm_interleave_epi16, si128); -MERGE3_KERNEL_TEMPLATE( int, __m128, float, _mm_interleave_ps, ps); - -MERGE4_KERNEL_TEMPLATE( uchar, __m128i, __m128i, _mm_interleave_epi8, si128); MERGE4_KERNEL_TEMPLATE(ushort, __m128i, __m128i, _mm_interleave_epi16, si128); +#endif + +MERGE2_KERNEL_TEMPLATE( int, __m128, float, _mm_deinterleave_ps, ps); +MERGE3_KERNEL_TEMPLATE( int, __m128, float, _mm_interleave_ps, ps); MERGE4_KERNEL_TEMPLATE( int, __m128, float, _mm_interleave_ps, ps); #endif @@ -4328,7 +4331,7 @@ cvtScale_( const short* src, size_t sstep, { __m256 scale256 = _mm256_set1_ps(scale); __m256 shift256 = _mm256_set1_ps(shift); - int shuffle = 0xD8; + const int shuffle = 0xD8; for ( ; x <= size.width - 16; x += 16) { diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 19cf1357b6..c1130db402 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -1445,7 +1445,7 @@ struct RGB2Gray float32x4_t v_cb, v_cg, v_cr; }; -#elif CV_SSE2 +#elif CV_SSE4_1 template <> struct RGB2Gray @@ -2106,7 +2106,7 @@ struct RGB2YCrCb_i int32x4_t v_c0, v_c1, v_c2, v_c3, v_c4, v_delta, v_delta2; }; -#elif CV_SSE2 +#elif CV_SSE4_1 template <> struct RGB2YCrCb_i @@ -2247,8 +2247,6 @@ struct RGB2YCrCb_i __m128i v_zero; }; -#if CV_SSE4_1 - template <> struct RGB2YCrCb_i { @@ -2369,9 +2367,6 @@ struct RGB2YCrCb_i #endif // CV_SSE4_1 - -#endif - template struct YCrCb2RGB_f { typedef _Tp channel_type; diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index d8b5385910..0de7089812 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -2306,7 +2306,7 @@ struct ResizeAreaFastVec_SIMD_32f if (cn == 1) { - int shuffle_lo = _MM_SHUFFLE(2, 0, 2, 0), shuffle_hi = _MM_SHUFFLE(3, 1, 3, 1); + const int shuffle_lo = _MM_SHUFFLE(2, 0, 2, 0), shuffle_hi = _MM_SHUFFLE(3, 1, 3, 1); for ( ; dx <= w - 4; dx += 4, S0 += 8, S1 += 8, D += 4) { __m128 v_row00 = _mm_loadu_ps(S0), v_row01 = _mm_loadu_ps(S0 + 4), diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index f489372188..93b9bfa166 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -236,7 +236,11 @@ struct PyrDownVec_32s16u bool haveSSE; }; -#endif +#else + +typedef PyrDownNoVec PyrDownVec_32s16u; + +#endif // CV_SSE4_1 struct PyrDownVec_32s16s { @@ -288,7 +292,6 @@ struct PyrDownVec_32s16s bool haveSSE; }; - struct PyrUpVec_32s8u { int operator()(int** src, uchar** dst, int, int width) const @@ -471,7 +474,11 @@ struct PyrUpVec_32s16u } }; -#endif +#else + +typedef PyrUpNoVec PyrUpVec_32s16u; + +#endif // CV_SSE4_1 struct PyrUpVec_32f {