[opencv] 09/251: core(stat): add required CV_AVX_GUARD

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.

commit b66c349bba98a3ff0c6d0339ad277844d1fb5fda
Author: Alexander Alekhin <alexander.a.alekhin at gmail.com>
Date:   Sun Jul 2 15:33:05 2017 +0000

    core(stat): add required CV_AVX_GUARD
    
    Added guard with 'vzeroupper' instruction
---
 modules/core/include/opencv2/core/cv_cpu_dispatch.h | 6 ++++++
 modules/core/src/stat.simd.hpp                      | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/modules/core/include/opencv2/core/cv_cpu_dispatch.h b/modules/core/include/opencv2/core/cv_cpu_dispatch.h
index c41c21d..779039d 100644
--- a/modules/core/include/opencv2/core/cv_cpu_dispatch.h
+++ b/modules/core/include/opencv2/core/cv_cpu_dispatch.h
@@ -111,6 +111,12 @@ struct VZeroUpperGuard {
 #define __CV_AVX_GUARD VZeroUpperGuard __vzeroupper_guard;
 #endif
 
+#ifdef __CV_AVX_GUARD
+#define CV_AVX_GUARD __CV_AVX_GUARD
+#else
+#define CV_AVX_GUARD
+#endif
+
 #endif // __OPENCV_BUILD
 
 
diff --git a/modules/core/src/stat.simd.hpp b/modules/core/src/stat.simd.hpp
index 4386773..b75100d 100644
--- a/modules/core/src/stat.simd.hpp
+++ b/modules/core/src/stat.simd.hpp
@@ -28,6 +28,8 @@ static inline int _mm256_extract_epi32_(__m256i reg, const int i)
 
 int normHamming(const uchar* a, int n)
 {
+    CV_AVX_GUARD;
+
     int i = 0;
     int result = 0;
 #if CV_AVX2
@@ -94,6 +96,8 @@ int normHamming(const uchar* a, int n)
 
 int normHamming(const uchar* a, const uchar* b, int n)
 {
+    CV_AVX_GUARD;
+
     int i = 0;
     int result = 0;
 #if CV_AVX2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list